memmove(s->prev_pict_types+1, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE-1); s->prev_pict_types[0]= s->pict_type; if(pic->age < PREV_PICT_TYPES_BUFFER_SIZE && s->prev_pict_types[pic->age] == B_TYPE) pic->age= INT_MAX;
static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){        if(shared){        assert(pic->data[0]);        assert(pic->type == 0 || pic->type == FF_BUFFER_TYPE_SHARED);        pic->type= FF_BUFFER_TYPE_SHARED;    }else{        int r;                assert(!pic->data[0]);                r= s->avctx->get_buffer(s->avctx, (AVFrame*)pic);                if(r<0 || !pic->age || !pic->type || !pic->data[0]){            fprintf(stderr, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);            return -1;        }        if(s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])){            fprintf(stderr, "get_buffer() failed (stride changed)\n");            return -1;        }        if(pic->linesize[1] != pic->linesize[2]){            fprintf(stderr, "get_buffer() failed (uv stride missmatch)\n");            return -1;        }        s->linesize  = pic->linesize[0];        s->uvlinesize= pic->linesize[1];    }        if(pic->qscale_table==NULL){        if (s->encoding) {                    CHECKED_ALLOCZ(pic->mb_var   , s->mb_num * sizeof(INT16))            CHECKED_ALLOCZ(pic->mc_mb_var, s->mb_num * sizeof(INT16))            CHECKED_ALLOCZ(pic->mb_mean  , s->mb_num * sizeof(INT8))            CHECKED_ALLOCZ(pic->mb_cmp_score, s->mb_num * sizeof(int32_t))        }        CHECKED_ALLOCZ(pic->mbskip_table , s->mb_num * sizeof(UINT8)+1) //the +1 is for the slice end check        CHECKED_ALLOCZ(pic->qscale_table , s->mb_num * sizeof(UINT8))        pic->qstride= s->mb_width;    }        return 0;fail: //for the CHECKED_ALLOCZ macro    return -1;}