void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift)
{
    *h_shift = pix_fmt_info[pix_fmt].x_chroma_shift;
    *v_shift = pix_fmt_info[pix_fmt].y_chroma_shift;
}
['static int h261_decode_frame(AVCodecContext *avctx,\n                             void *data, int *data_size,\n                             const uint8_t *buf, int buf_size)\n{\n    H261Context *h= avctx->priv_data;\n    MpegEncContext *s = &h->s;\n    int ret;\n    AVFrame *pict = data;\n#ifdef DEBUG\n    av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\\n", avctx->frame_number, buf_size);\n    av_log(avctx, AV_LOG_DEBUG, "bytes=%x %x %x %x\\n", buf[0], buf[1], buf[2], buf[3]);\n#endif\n    s->flags= avctx->flags;\n    s->flags2= avctx->flags2;\n    h->gob_start_code_skipped=0;\nretry:\n    init_get_bits(&s->gb, buf, buf_size*8);\n    if(!s->context_initialized){\n        if (MPV_common_init(s) < 0)\n            return -1;\n    }\n    if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){\n        int i= ff_find_unused_picture(s, 0);\n        s->current_picture_ptr= &s->picture[i];\n    }\n    ret = h261_decode_picture_header(h);\n    if (ret < 0){\n        av_log(s->avctx, AV_LOG_ERROR, "header damaged\\n");\n        return -1;\n    }\n    if (s->width != avctx->coded_width || s->height != avctx->coded_height){\n        ParseContext pc= s->parse_context;\n        s->parse_context.buffer=0;\n        MPV_common_end(s);\n        s->parse_context= pc;\n    }\n    if (!s->context_initialized) {\n        avcodec_set_dimensions(avctx, s->width, s->height);\n        goto retry;\n    }\n    s->current_picture.pict_type= s->pict_type;\n    s->current_picture.key_frame= s->pict_type == FF_I_TYPE;\n    if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);\n    if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)\n       ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)\n       || avctx->skip_frame >= AVDISCARD_ALL)\n        return get_consumed_bytes(s, buf_size);\n    if(MPV_frame_start(s, avctx) < 0)\n        return -1;\n    ff_er_frame_start(s);\n    s->mb_x=0;\n    s->mb_y=0;\n    while(h->gob_number < (s->mb_height==18 ? 12 : 5)){\n        if(ff_h261_resync(h)<0)\n            break;\n        h261_decode_gob(h);\n    }\n    MPV_frame_end(s);\nassert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);\nassert(s->current_picture.pict_type == s->pict_type);\n    *pict= *(AVFrame*)s->current_picture_ptr;\n    ff_print_debug_info(s, pict);\n    *data_size = sizeof(AVFrame);\n    return get_consumed_bytes(s, buf_size);\n}', 'static int h261_decode_picture_header(H261Context *h){\n    MpegEncContext * const s = &h->s;\n    int format, i;\n    uint32_t startcode= 0;\n    for(i= s->gb.size_in_bits - get_bits_count(&s->gb); i>24; i-=1){\n        startcode = ((startcode << 1) | get_bits(&s->gb, 1)) & 0x000FFFFF;\n        if(startcode == 0x10)\n            break;\n    }\n    if (startcode != 0x10){\n        av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\\n");\n        return -1;\n    }\n    i= get_bits(&s->gb, 5);\n    if(i < (s->picture_number&31))\n        i += 32;\n    s->picture_number = (s->picture_number&~31) + i;\n    s->avctx->time_base= (AVRational){1001, 30000};\n    s->current_picture.pts= s->picture_number;\n    skip_bits1(&s->gb);\n    skip_bits1(&s->gb);\n    skip_bits1(&s->gb);\n    format = get_bits1(&s->gb);\n    if (format == 0){\n        s->width = 176;\n        s->height = 144;\n        s->mb_width = 11;\n        s->mb_height = 9;\n    }else{\n        s->width = 352;\n        s->height = 288;\n        s->mb_width = 22;\n        s->mb_height = 18;\n    }\n    s->mb_num = s->mb_width * s->mb_height;\n    skip_bits1(&s->gb);\n    skip_bits1(&s->gb);\n    while (get_bits1(&s->gb) != 0){\n        skip_bits(&s->gb, 8);\n    }\n    s->pict_type = FF_P_TYPE;\n    h->gob_number = 0;\n    return 0;\n}', 'int MPV_common_init(MpegEncContext *s)\n{\n    int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads;\n    s->mb_height = (s->height + 15) / 16;\n    if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){\n        av_log(s->avctx, AV_LOG_ERROR, "too many threads\\n");\n        return -1;\n    }\n    if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height))\n        return -1;\n    dsputil_init(&s->dsp, s->avctx);\n    ff_dct_common_init(s);\n    s->flags= s->avctx->flags;\n    s->flags2= s->avctx->flags2;\n    s->mb_width  = (s->width  + 15) / 16;\n    s->mb_stride = s->mb_width + 1;\n    s->b8_stride = s->mb_width*2 + 1;\n    s->b4_stride = s->mb_width*4 + 1;\n    mb_array_size= s->mb_height * s->mb_stride;\n    mv_table_size= (s->mb_height+2) * s->mb_stride + 1;\n    avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift),\n                                                    &(s->chroma_y_shift) );\n    s->h_edge_pos= s->mb_width*16;\n    s->v_edge_pos= s->mb_height*16;\n    s->mb_num = s->mb_width * s->mb_height;\n    s->block_wrap[0]=\n    s->block_wrap[1]=\n    s->block_wrap[2]=\n    s->block_wrap[3]= s->b8_stride;\n    s->block_wrap[4]=\n    s->block_wrap[5]= s->mb_stride;\n    y_size = s->b8_stride * (2 * s->mb_height + 1);\n    c_size = s->mb_stride * (s->mb_height + 1);\n    yc_size = y_size + 2 * c_size;\n    s->codec_tag=          toupper( s->avctx->codec_tag     &0xFF)\n                        + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 )\n                        + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16)\n                        + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24);\n    s->stream_codec_tag=          toupper( s->avctx->stream_codec_tag     &0xFF)\n                               + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 )\n                               + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16)\n                               + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24);\n    s->avctx->coded_frame= (AVFrame*)&s->current_picture;\n    CHECKED_ALLOCZ(s->mb_index2xy, (s->mb_num+1)*sizeof(int))\n    for(y=0; y<s->mb_height; y++){\n        for(x=0; x<s->mb_width; x++){\n            s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride;\n        }\n    }\n    s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width;\n    if (s->encoding) {\n        CHECKED_ALLOCZ(s->p_mv_table_base            , mv_table_size * 2 * sizeof(int16_t))\n        CHECKED_ALLOCZ(s->b_forw_mv_table_base       , mv_table_size * 2 * sizeof(int16_t))\n        CHECKED_ALLOCZ(s->b_back_mv_table_base       , mv_table_size * 2 * sizeof(int16_t))\n        CHECKED_ALLOCZ(s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t))\n        CHECKED_ALLOCZ(s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t))\n        CHECKED_ALLOCZ(s->b_direct_mv_table_base     , mv_table_size * 2 * sizeof(int16_t))\n        s->p_mv_table           = s->p_mv_table_base            + s->mb_stride + 1;\n        s->b_forw_mv_table      = s->b_forw_mv_table_base       + s->mb_stride + 1;\n        s->b_back_mv_table      = s->b_back_mv_table_base       + s->mb_stride + 1;\n        s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1;\n        s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1;\n        s->b_direct_mv_table    = s->b_direct_mv_table_base     + s->mb_stride + 1;\n        if(s->msmpeg4_version){\n            CHECKED_ALLOCZ(s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int));\n        }\n        CHECKED_ALLOCZ(s->avctx->stats_out, 256);\n        CHECKED_ALLOCZ(s->mb_type  , mb_array_size * sizeof(uint16_t))\n        CHECKED_ALLOCZ(s->lambda_table, mb_array_size * sizeof(int))\n        CHECKED_ALLOCZ(s->q_intra_matrix, 64*32 * sizeof(int))\n        CHECKED_ALLOCZ(s->q_inter_matrix, 64*32 * sizeof(int))\n        CHECKED_ALLOCZ(s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t))\n        CHECKED_ALLOCZ(s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t))\n        CHECKED_ALLOCZ(s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*))\n        CHECKED_ALLOCZ(s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*))\n        if(s->avctx->noise_reduction){\n            CHECKED_ALLOCZ(s->dct_offset, 2 * 64 * sizeof(uint16_t))\n        }\n    }\n    CHECKED_ALLOCZ(s->picture, MAX_PICTURE_COUNT * sizeof(Picture))\n    CHECKED_ALLOCZ(s->error_status_table, mb_array_size*sizeof(uint8_t))\n    if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){\n            for(i=0; i<2; i++){\n                int j, k;\n                for(j=0; j<2; j++){\n                    for(k=0; k<2; k++){\n                        CHECKED_ALLOCZ(s->b_field_mv_table_base[i][j][k]     , mv_table_size * 2 * sizeof(int16_t))\n                        s->b_field_mv_table[i][j][k]    = s->b_field_mv_table_base[i][j][k]     + s->mb_stride + 1;\n                    }\n                    CHECKED_ALLOCZ(s->b_field_select_table[i][j]     , mb_array_size * 2 * sizeof(uint8_t))\n                    CHECKED_ALLOCZ(s->p_field_mv_table_base[i][j]     , mv_table_size * 2 * sizeof(int16_t))\n                    s->p_field_mv_table[i][j]    = s->p_field_mv_table_base[i][j]     + s->mb_stride + 1;\n                }\n                CHECKED_ALLOCZ(s->p_field_select_table[i]      , mb_array_size * 2 * sizeof(uint8_t))\n            }\n    }\n    if (s->out_format == FMT_H263) {\n        CHECKED_ALLOCZ(s->ac_val_base, yc_size * sizeof(int16_t) * 16);\n        s->ac_val[0] = s->ac_val_base + s->b8_stride + 1;\n        s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1;\n        s->ac_val[2] = s->ac_val[1] + c_size;\n        CHECKED_ALLOCZ(s->coded_block_base, y_size);\n        s->coded_block= s->coded_block_base + s->b8_stride + 1;\n        CHECKED_ALLOCZ(s->cbp_table  , mb_array_size * sizeof(uint8_t))\n        CHECKED_ALLOCZ(s->pred_dir_table, mb_array_size * sizeof(uint8_t))\n    }\n    if (s->h263_pred || s->h263_plus || !s->encoding) {\n        CHECKED_ALLOCZ(s->dc_val_base, yc_size * sizeof(int16_t));\n        s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;\n        s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;\n        s->dc_val[2] = s->dc_val[1] + c_size;\n        for(i=0;i<yc_size;i++)\n            s->dc_val_base[i] = 1024;\n    }\n    CHECKED_ALLOCZ(s->mbintra_table, mb_array_size);\n    memset(s->mbintra_table, 1, mb_array_size);\n    CHECKED_ALLOCZ(s->mbskip_table, mb_array_size+2);\n    CHECKED_ALLOCZ(s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE);\n    s->parse_context.state= -1;\n    if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){\n       s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);\n       s->visualization_buffer[1] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH);\n       s->visualization_buffer[2] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH);\n    }\n    s->context_initialized = 1;\n    s->thread_context[0]= s;\n    threads = s->avctx->thread_count;\n    for(i=1; i<threads; i++){\n        s->thread_context[i]= av_malloc(sizeof(MpegEncContext));\n        memcpy(s->thread_context[i], s, sizeof(MpegEncContext));\n    }\n    for(i=0; i<threads; i++){\n        if(init_duplicate_context(s->thread_context[i], s) < 0)\n           goto fail;\n        s->thread_context[i]->start_mb_y= (s->mb_height*(i  ) + s->avctx->thread_count/2) / s->avctx->thread_count;\n        s->thread_context[i]->end_mb_y  = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count;\n    }\n    return 0;\n fail:\n    MPV_common_end(s);\n    return -1;\n}', 'void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift)\n{\n    *h_shift = pix_fmt_info[pix_fmt].x_chroma_shift;\n    *v_shift = pix_fmt_info[pix_fmt].y_chroma_shift;\n}']