static int alloc_picture(MpegEncContext *s, Picture *pic){ 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))
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, (AVVideoFrame*)pic);  if(r<0 || !pic->age || !pic->type || !pic->data[0]){ fprintf(stderr, "get_buffer() failed (%d %d %d %X)\n", r, pic->age, pic->type, (int)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];
static int alloc_picture(MpegEncContext *s, Picture *pic){    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->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;}