static void await_references(H264Context *h){
    MpegEncContext * const s = &h->s;
    const int mb_xy= h->mb_xy;
    const int mb_type= s->current_picture.mb_type[mb_xy];
    int refs[2][48];
    int nrefs[2] = {0};
    int ref, list;
    memset(refs, -1, sizeof(refs));
    if(IS_16X16(mb_type)){
        get_lowest_part_y(h, refs, 0, 16, 0,
                  IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
    }else if(IS_16X8(mb_type)){
        get_lowest_part_y(h, refs, 0, 8, 0,
                  IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
        get_lowest_part_y(h, refs, 8, 8, 8,
                  IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
    }else if(IS_8X16(mb_type)){
        get_lowest_part_y(h, refs, 0, 16, 0,
                  IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
        get_lowest_part_y(h, refs, 4, 16, 0,
                  IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
    }else{
        int i;
        assert(IS_8X8(mb_type));
        for(i=0; i<4; i++){
            const int sub_mb_type= h->sub_mb_type[i];
            const int n= 4*i;
            int y_offset= (i&2)<<2;
            if(IS_SUB_8X8(sub_mb_type)){
                get_lowest_part_y(h, refs, n  , 8, y_offset,
                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
            }else if(IS_SUB_8X4(sub_mb_type)){
                get_lowest_part_y(h, refs, n  , 4, y_offset,
                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
                get_lowest_part_y(h, refs, n+2, 4, y_offset+4,
                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
            }else if(IS_SUB_4X8(sub_mb_type)){
                get_lowest_part_y(h, refs, n  , 8, y_offset,
                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
                get_lowest_part_y(h, refs, n+1, 8, y_offset,
                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
            }else{
                int j;
                assert(IS_SUB_4X4(sub_mb_type));
                for(j=0; j<4; j++){
                    int sub_y_offset= y_offset + 2*(j&2);
                    get_lowest_part_y(h, refs, n+j, 4, sub_y_offset,
                              IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
                }
            }
        }
    }
    for(list=h->list_count-1; list>=0; list--){
        for(ref=0; ref<48 && nrefs[list]; ref++){
            int row = refs[list][ref];
            if(row >= 0){
                Picture *ref_pic = &h->ref_list[list][ref];
                int ref_field = ref_pic->reference - 1;
                int ref_field_picture = ref_pic->field_picture;
                int pic_height = 16*s->mb_height >> ref_field_picture;
                row <<= MB_MBAFF;
                nrefs[list]--;
                if(!FIELD_PICTURE && ref_field_picture){
                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) - !(row&1), pic_height-1), 1);
                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1)           , pic_height-1), 0);
                }else if(FIELD_PICTURE && !ref_field_picture){
                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row*2 + ref_field    , pic_height-1), 0);
                }else if(FIELD_PICTURE){
                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), ref_field);
                }else{
                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), 0);
                }
            }
        }
    }
}
['static int slice_end(AVCodecContext *avctx, AVFrame *pict)\n{\n    Mpeg1Context *s1 = avctx->priv_data;\n    MpegEncContext *s = &s1->mpeg_enc_ctx;\n    if (!s1->mpeg_enc_ctx_allocated || !s->current_picture_ptr)\n        return 0;\n    if (s->avctx->hwaccel) {\n        if (s->avctx->hwaccel->end_frame(s->avctx) < 0)\n            av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\\n");\n    }\n    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)\n        ff_xvmc_field_end(s);\n    if (  !s->first_field) {\n        s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_MPEG2;\n        ff_er_frame_end(s);\n        MPV_frame_end(s);\n        if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {\n            *pict= *(AVFrame*)s->current_picture_ptr;\n            ff_print_debug_info(s, pict);\n        } else {\n            if (avctx->active_thread_type & FF_THREAD_FRAME)\n                s->picture_number++;\n            if (s->last_picture_ptr != NULL) {\n                *pict= *(AVFrame*)s->last_picture_ptr;\n                 ff_print_debug_info(s, pict);\n            }\n        }\n        return 1;\n    } else {\n        return 0;\n    }\n}', 'void ff_er_frame_end(MpegEncContext *s){\n    int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error;\n    int distance;\n    int threshold_part[4]= {100,100,100};\n    int threshold= 50;\n    int is_intra_likely;\n    int size = s->b8_stride * 2 * s->mb_height;\n    Picture *pic= s->current_picture_ptr;\n    if(!s->error_recognition || s->error_count==0 || s->avctx->lowres ||\n       s->avctx->hwaccel ||\n       s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||\n       s->picture_structure != PICT_FRAME ||\n       s->error_count==3*s->mb_width*(s->avctx->skip_top + s->avctx->skip_bottom)) return;\n    if(s->current_picture.motion_val[0] == NULL){\n        av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\\n");\n        for(i=0; i<2; i++){\n            pic->ref_index[i]= av_mallocz(s->mb_stride * s->mb_height * 4 * sizeof(uint8_t));\n            pic->motion_val_base[i]= av_mallocz((size+4) * 2 * sizeof(uint16_t));\n            pic->motion_val[i]= pic->motion_val_base[i]+4;\n        }\n        pic->motion_subsample_log2= 3;\n        s->current_picture= *s->current_picture_ptr;\n    }\n    if(s->avctx->debug&FF_DEBUG_ER){\n        for(mb_y=0; mb_y<s->mb_height; mb_y++){\n            for(mb_x=0; mb_x<s->mb_width; mb_x++){\n                int status= s->error_status_table[mb_x + mb_y*s->mb_stride];\n                av_log(s->avctx, AV_LOG_DEBUG, "%2X ", status);\n            }\n            av_log(s->avctx, AV_LOG_DEBUG, "\\n");\n        }\n    }\n    for(error_type=1; error_type<=3; error_type++){\n        int end_ok=0;\n        for(i=s->mb_num-1; i>=0; i--){\n            const int mb_xy= s->mb_index2xy[i];\n            int error= s->error_status_table[mb_xy];\n            if(error&(1<<error_type))\n                end_ok=1;\n            if(error&(8<<error_type))\n                end_ok=1;\n            if(!end_ok)\n                s->error_status_table[mb_xy]|= 1<<error_type;\n            if(error&VP_START)\n                end_ok=0;\n        }\n    }\n    if(s->partitioned_frame){\n        int end_ok=0;\n        for(i=s->mb_num-1; i>=0; i--){\n            const int mb_xy= s->mb_index2xy[i];\n            int error= s->error_status_table[mb_xy];\n            if(error&AC_END)\n                end_ok=0;\n            if((error&MV_END) || (error&DC_END) || (error&AC_ERROR))\n                end_ok=1;\n            if(!end_ok)\n                s->error_status_table[mb_xy]|= AC_ERROR;\n            if(error&VP_START)\n                end_ok=0;\n        }\n    }\n    if(s->error_recognition>=4){\n        int end_ok=1;\n        for(i=s->mb_num-2; i>=s->mb_width+100; i--){\n            const int mb_xy= s->mb_index2xy[i];\n            int error1= s->error_status_table[mb_xy  ];\n            int error2= s->error_status_table[s->mb_index2xy[i+1]];\n            if(error1&VP_START)\n                end_ok=1;\n            if(   error2==(VP_START|DC_ERROR|AC_ERROR|MV_ERROR|AC_END|DC_END|MV_END)\n               && error1!=(VP_START|DC_ERROR|AC_ERROR|MV_ERROR|AC_END|DC_END|MV_END)\n               && ((error1&AC_END) || (error1&DC_END) || (error1&MV_END))){\n                end_ok=0;\n            }\n            if(!end_ok)\n                s->error_status_table[mb_xy]|= DC_ERROR|AC_ERROR|MV_ERROR;\n        }\n    }\n    distance=9999999;\n    for(error_type=1; error_type<=3; error_type++){\n        for(i=s->mb_num-1; i>=0; i--){\n            const int mb_xy= s->mb_index2xy[i];\n            int error= s->error_status_table[mb_xy];\n            if(!s->mbskip_table[mb_xy])\n                distance++;\n            if(error&(1<<error_type))\n                distance= 0;\n            if(s->partitioned_frame){\n                if(distance < threshold_part[error_type-1])\n                    s->error_status_table[mb_xy]|= 1<<error_type;\n            }else{\n                if(distance < threshold)\n                    s->error_status_table[mb_xy]|= 1<<error_type;\n            }\n            if(error&VP_START)\n                distance= 9999999;\n        }\n    }\n    error=0;\n    for(i=0; i<s->mb_num; i++){\n        const int mb_xy= s->mb_index2xy[i];\n        int old_error= s->error_status_table[mb_xy];\n        if(old_error&VP_START)\n            error= old_error& (DC_ERROR|AC_ERROR|MV_ERROR);\n        else{\n            error|= old_error& (DC_ERROR|AC_ERROR|MV_ERROR);\n            s->error_status_table[mb_xy]|= error;\n        }\n    }\n    if(!s->partitioned_frame){\n        for(i=0; i<s->mb_num; i++){\n            const int mb_xy= s->mb_index2xy[i];\n            error= s->error_status_table[mb_xy];\n            if(error&(AC_ERROR|DC_ERROR|MV_ERROR))\n                error|= AC_ERROR|DC_ERROR|MV_ERROR;\n            s->error_status_table[mb_xy]= error;\n        }\n    }\n    dc_error= ac_error= mv_error=0;\n    for(i=0; i<s->mb_num; i++){\n        const int mb_xy= s->mb_index2xy[i];\n        error= s->error_status_table[mb_xy];\n        if(error&DC_ERROR) dc_error ++;\n        if(error&AC_ERROR) ac_error ++;\n        if(error&MV_ERROR) mv_error ++;\n    }\n    av_log(s->avctx, AV_LOG_INFO, "concealing %d DC, %d AC, %d MV errors\\n", dc_error, ac_error, mv_error);\n    is_intra_likely= is_intra_more_likely(s);\n    for(i=0; i<s->mb_num; i++){\n        const int mb_xy= s->mb_index2xy[i];\n        error= s->error_status_table[mb_xy];\n        if(!((error&DC_ERROR) && (error&MV_ERROR)))\n            continue;\n        if(is_intra_likely)\n            s->current_picture.mb_type[mb_xy]= MB_TYPE_INTRA4x4;\n        else\n            s->current_picture.mb_type[mb_xy]= MB_TYPE_16x16 | MB_TYPE_L0;\n    }\n    if (!s->last_picture.data[0] && !s->next_picture.data[0])\n        for(i=0; i<s->mb_num; i++){\n            const int mb_xy= s->mb_index2xy[i];\n            if(!IS_INTRA(s->current_picture.mb_type[mb_xy]))\n                s->current_picture.mb_type[mb_xy]= MB_TYPE_INTRA4x4;\n        }\n    for(mb_y=0; mb_y<s->mb_height; mb_y++){\n        for(mb_x=0; mb_x<s->mb_width; mb_x++){\n            const int mb_xy= mb_x + mb_y * s->mb_stride;\n            const int mb_type= s->current_picture.mb_type[mb_xy];\n            int dir = !s->last_picture.data[0];\n            error= s->error_status_table[mb_xy];\n            if(IS_INTRA(mb_type)) continue;\n            if(error&MV_ERROR) continue;\n            if(!(error&AC_ERROR)) continue;\n            s->mv_dir = dir ? MV_DIR_BACKWARD : MV_DIR_FORWARD;\n            s->mb_intra=0;\n            s->mb_skipped=0;\n            if(IS_8X8(mb_type)){\n                int mb_index= mb_x*2 + mb_y*2*s->b8_stride;\n                int j;\n                s->mv_type = MV_TYPE_8X8;\n                for(j=0; j<4; j++){\n                    s->mv[0][j][0] = s->current_picture.motion_val[dir][ mb_index + (j&1) + (j>>1)*s->b8_stride ][0];\n                    s->mv[0][j][1] = s->current_picture.motion_val[dir][ mb_index + (j&1) + (j>>1)*s->b8_stride ][1];\n                }\n            }else{\n                s->mv_type = MV_TYPE_16X16;\n                s->mv[0][0][0] = s->current_picture.motion_val[dir][ mb_x*2 + mb_y*2*s->b8_stride ][0];\n                s->mv[0][0][1] = s->current_picture.motion_val[dir][ mb_x*2 + mb_y*2*s->b8_stride ][1];\n            }\n            s->dsp.clear_blocks(s->block[0]);\n            s->mb_x= mb_x;\n            s->mb_y= mb_y;\n            decode_mb(s, 0 );\n        }\n    }\n    if(s->pict_type==AV_PICTURE_TYPE_B){\n        for(mb_y=0; mb_y<s->mb_height; mb_y++){\n            for(mb_x=0; mb_x<s->mb_width; mb_x++){\n                int xy= mb_x*2 + mb_y*2*s->b8_stride;\n                const int mb_xy= mb_x + mb_y * s->mb_stride;\n                const int mb_type= s->current_picture.mb_type[mb_xy];\n                error= s->error_status_table[mb_xy];\n                if(IS_INTRA(mb_type)) continue;\n                if(!(error&MV_ERROR)) continue;\n                if(!(error&AC_ERROR)) continue;\n                s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD;\n                if(!s->last_picture.data[0]) s->mv_dir &= ~MV_DIR_FORWARD;\n                if(!s->next_picture.data[0]) s->mv_dir &= ~MV_DIR_BACKWARD;\n                s->mb_intra=0;\n                s->mv_type = MV_TYPE_16X16;\n                s->mb_skipped=0;\n                if(s->pp_time){\n                    int time_pp= s->pp_time;\n                    int time_pb= s->pb_time;\n                    if (s->avctx->codec_id == CODEC_ID_H264) {\n                    } else {\n                        ff_thread_await_progress((AVFrame *) s->next_picture_ptr,\n                                                 mb_y, 0);\n                    }\n                    s->mv[0][0][0] = s->next_picture.motion_val[0][xy][0]*time_pb/time_pp;\n                    s->mv[0][0][1] = s->next_picture.motion_val[0][xy][1]*time_pb/time_pp;\n                    s->mv[1][0][0] = s->next_picture.motion_val[0][xy][0]*(time_pb - time_pp)/time_pp;\n                    s->mv[1][0][1] = s->next_picture.motion_val[0][xy][1]*(time_pb - time_pp)/time_pp;\n                }else{\n                    s->mv[0][0][0]= 0;\n                    s->mv[0][0][1]= 0;\n                    s->mv[1][0][0]= 0;\n                    s->mv[1][0][1]= 0;\n                }\n                s->dsp.clear_blocks(s->block[0]);\n                s->mb_x= mb_x;\n                s->mb_y= mb_y;\n                decode_mb(s, 0);\n            }\n        }\n    }else\n        guess_mv(s);\n    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)\n        goto ec_clean;\n    for(mb_y=0; mb_y<s->mb_height; mb_y++){\n        for(mb_x=0; mb_x<s->mb_width; mb_x++){\n            int dc, dcu, dcv, y, n;\n            int16_t *dc_ptr;\n            uint8_t *dest_y, *dest_cb, *dest_cr;\n            const int mb_xy= mb_x + mb_y * s->mb_stride;\n            const int mb_type= s->current_picture.mb_type[mb_xy];\n            error= s->error_status_table[mb_xy];\n            if(IS_INTRA(mb_type) && s->partitioned_frame) continue;\n            dest_y = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;\n            dest_cb= s->current_picture.data[1] + mb_x*8  + mb_y*8 *s->uvlinesize;\n            dest_cr= s->current_picture.data[2] + mb_x*8  + mb_y*8 *s->uvlinesize;\n            dc_ptr= &s->dc_val[0][mb_x*2 + mb_y*2*s->b8_stride];\n            for(n=0; n<4; n++){\n                dc=0;\n                for(y=0; y<8; y++){\n                    int x;\n                    for(x=0; x<8; x++){\n                       dc+= dest_y[x + (n&1)*8 + (y + (n>>1)*8)*s->linesize];\n                    }\n                }\n                dc_ptr[(n&1) + (n>>1)*s->b8_stride]= (dc+4)>>3;\n            }\n            dcu=dcv=0;\n            for(y=0; y<8; y++){\n                int x;\n                for(x=0; x<8; x++){\n                    dcu+=dest_cb[x + y*(s->uvlinesize)];\n                    dcv+=dest_cr[x + y*(s->uvlinesize)];\n                }\n            }\n            s->dc_val[1][mb_x + mb_y*s->mb_stride]= (dcu+4)>>3;\n            s->dc_val[2][mb_x + mb_y*s->mb_stride]= (dcv+4)>>3;\n        }\n    }\n    guess_dc(s, s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride, 1);\n    guess_dc(s, s->dc_val[1], s->mb_width  , s->mb_height  , s->mb_stride, 0);\n    guess_dc(s, s->dc_val[2], s->mb_width  , s->mb_height  , s->mb_stride, 0);\n    filter181(s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride);\n    for(mb_y=0; mb_y<s->mb_height; mb_y++){\n        for(mb_x=0; mb_x<s->mb_width; mb_x++){\n            uint8_t *dest_y, *dest_cb, *dest_cr;\n            const int mb_xy= mb_x + mb_y * s->mb_stride;\n            const int mb_type= s->current_picture.mb_type[mb_xy];\n            error= s->error_status_table[mb_xy];\n            if(IS_INTER(mb_type)) continue;\n            if(!(error&AC_ERROR)) continue;\n            dest_y = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;\n            dest_cb= s->current_picture.data[1] + mb_x*8  + mb_y*8 *s->uvlinesize;\n            dest_cr= s->current_picture.data[2] + mb_x*8  + mb_y*8 *s->uvlinesize;\n            put_dc(s, dest_y, dest_cb, dest_cr, mb_x, mb_y);\n        }\n    }\n    if(s->avctx->error_concealment&FF_EC_DEBLOCK){\n        h_block_filter(s, s->current_picture.data[0], s->mb_width*2, s->mb_height*2, s->linesize  , 1);\n        h_block_filter(s, s->current_picture.data[1], s->mb_width  , s->mb_height  , s->uvlinesize, 0);\n        h_block_filter(s, s->current_picture.data[2], s->mb_width  , s->mb_height  , s->uvlinesize, 0);\n        v_block_filter(s, s->current_picture.data[0], s->mb_width*2, s->mb_height*2, s->linesize  , 1);\n        v_block_filter(s, s->current_picture.data[1], s->mb_width  , s->mb_height  , s->uvlinesize, 0);\n        v_block_filter(s, s->current_picture.data[2], s->mb_width  , s->mb_height  , s->uvlinesize, 0);\n    }\nec_clean:\n    for(i=0; i<s->mb_num; i++){\n        const int mb_xy= s->mb_index2xy[i];\n        int error= s->error_status_table[mb_xy];\n        if(s->pict_type!=AV_PICTURE_TYPE_B && (error&(DC_ERROR|MV_ERROR|AC_ERROR))){\n            s->mbskip_table[mb_xy]=0;\n        }\n        s->mbintra_table[mb_xy]=1;\n    }\n}', 'static void decode_mb(MpegEncContext *s, int ref){\n    s->dest[0] = s->current_picture.data[0] + (s->mb_y * 16* s->linesize  ) + s->mb_x * 16;\n    s->dest[1] = s->current_picture.data[1] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift);\n    s->dest[2] = s->current_picture.data[2] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift);\n    if(CONFIG_H264_DECODER && s->codec_id == CODEC_ID_H264){\n        H264Context *h= (void*)s;\n        h->mb_xy= s->mb_x + s->mb_y*s->mb_stride;\n        memset(h->non_zero_count_cache, 0, sizeof(h->non_zero_count_cache));\n        assert(ref>=0);\n        if(ref >= h->ref_count[0])\n            ref=0;\n        fill_rectangle(&s->current_picture.ref_index[0][4*h->mb_xy], 2, 2, 2, ref, 1);\n        fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);\n        fill_rectangle(h->mv_cache[0][ scan8[0] ], 4, 4, 8, pack16to32(s->mv[0][0][0],s->mv[0][0][1]), 4);\n        assert(!FRAME_MBAFF);\n        ff_h264_hl_decode_mb(h);\n    }else{\n        assert(ref==0);\n    MPV_decode_mb(s, s->block);\n    }\n}', 'void ff_h264_hl_decode_mb(H264Context *h){\n    MpegEncContext * const s = &h->s;\n    const int mb_xy= h->mb_xy;\n    const int mb_type= s->current_picture.mb_type[mb_xy];\n    int is_complex = CONFIG_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || s->qscale == 0;\n    if (is_complex) {\n        hl_decode_mb_complex(h);\n    } else if (h->pixel_shift) {\n        hl_decode_mb_simple_16(h);\n    } else\n        hl_decode_mb_simple_8(h);\n}', 'static void av_noinline hl_decode_mb_complex(H264Context *h){\n    hl_decode_mb_internal(h, 0, h->pixel_shift);\n}', 'static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, int pixel_shift){\n    MpegEncContext * const s = &h->s;\n    const int mb_x= s->mb_x;\n    const int mb_y= s->mb_y;\n    const int mb_xy= h->mb_xy;\n    const int mb_type= s->current_picture.mb_type[mb_xy];\n    uint8_t  *dest_y, *dest_cb, *dest_cr;\n    int linesize, uvlinesize  ;\n    int i;\n    int *block_offset = &h->block_offset[0];\n    const int transform_bypass = !simple && (s->qscale == 0 && h->sps.transform_bypass);\n    const int is_h264 = !CONFIG_SVQ3_DECODER || simple || s->codec_id == CODEC_ID_H264;\n    void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride);\n    void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride);\n    dest_y  = s->current_picture.data[0] + ((mb_x << pixel_shift) + mb_y * s->linesize  ) * 16;\n    dest_cb = s->current_picture.data[1] + ((mb_x << pixel_shift) + mb_y * s->uvlinesize) * 8;\n    dest_cr = s->current_picture.data[2] + ((mb_x << pixel_shift) + mb_y * s->uvlinesize) * 8;\n    s->dsp.prefetch(dest_y + (s->mb_x&3)*4*s->linesize + (64 << pixel_shift), s->linesize, 4);\n    s->dsp.prefetch(dest_cb + (s->mb_x&7)*s->uvlinesize + (64 << pixel_shift), dest_cr - dest_cb, 2);\n    h->list_counts[mb_xy]= h->list_count;\n    if (!simple && MB_FIELD) {\n        linesize   = h->mb_linesize   = s->linesize * 2;\n        uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;\n        block_offset = &h->block_offset[24];\n        if(mb_y&1){\n            dest_y -= s->linesize*15;\n            dest_cb-= s->uvlinesize*7;\n            dest_cr-= s->uvlinesize*7;\n        }\n        if(FRAME_MBAFF) {\n            int list;\n            for(list=0; list<h->list_count; list++){\n                if(!USES_LIST(mb_type, list))\n                    continue;\n                if(IS_16X16(mb_type)){\n                    int8_t *ref = &h->ref_cache[list][scan8[0]];\n                    fill_rectangle(ref, 4, 4, 8, (16+*ref)^(s->mb_y&1), 1);\n                }else{\n                    for(i=0; i<16; i+=4){\n                        int ref = h->ref_cache[list][scan8[i]];\n                        if(ref >= 0)\n                            fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2, 8, (16+ref)^(s->mb_y&1), 1);\n                    }\n                }\n            }\n        }\n    } else {\n        linesize   = h->mb_linesize   = s->linesize;\n        uvlinesize = h->mb_uvlinesize = s->uvlinesize;\n    }\n    if (!simple && IS_INTRA_PCM(mb_type)) {\n        if (pixel_shift) {\n            const int bit_depth = h->sps.bit_depth_luma;\n            int j;\n            GetBitContext gb;\n            init_get_bits(&gb, (uint8_t*)h->mb, 384*bit_depth);\n            for (i = 0; i < 16; i++) {\n                uint16_t *tmp_y  = (uint16_t*)(dest_y  + i*linesize);\n                for (j = 0; j < 16; j++)\n                    tmp_y[j] = get_bits(&gb, bit_depth);\n            }\n            for (i = 0; i < 8; i++) {\n                uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize);\n                for (j = 0; j < 8; j++)\n                    tmp_cb[j] = get_bits(&gb, bit_depth);\n            }\n            for (i = 0; i < 8; i++) {\n                uint16_t *tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize);\n                for (j = 0; j < 8; j++)\n                    tmp_cr[j] = get_bits(&gb, bit_depth);\n            }\n        } else {\n        for (i=0; i<16; i++) {\n            memcpy(dest_y + i*  linesize, h->mb       + i*8, 16);\n        }\n        for (i=0; i<8; i++) {\n            memcpy(dest_cb+ i*uvlinesize, h->mb + 128 + i*4,  8);\n            memcpy(dest_cr+ i*uvlinesize, h->mb + 160 + i*4,  8);\n        }\n        }\n    } else {\n        if(IS_INTRA(mb_type)){\n            if(h->deblocking_filter)\n                xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple, pixel_shift);\n            if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){\n                h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize);\n                h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize);\n            }\n            if(IS_INTRA4x4(mb_type)){\n                if(simple || !s->encoding){\n                    if(IS_8x8DCT(mb_type)){\n                        if(transform_bypass){\n                            idct_dc_add =\n                            idct_add    = s->dsp.add_pixels8;\n                        }else{\n                            idct_dc_add = h->h264dsp.h264_idct8_dc_add;\n                            idct_add    = h->h264dsp.h264_idct8_add;\n                        }\n                        for(i=0; i<16; i+=4){\n                            uint8_t * const ptr= dest_y + block_offset[i];\n                            const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];\n                            if(transform_bypass && h->sps.profile_idc==244 && dir<=1){\n                                h->hpc.pred8x8l_add[dir](ptr, h->mb + (i*16 << pixel_shift), linesize);\n                            }else{\n                                const int nnz = h->non_zero_count_cache[ scan8[i] ];\n                                h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,\n                                                            (h->topright_samples_available<<i)&0x4000, linesize);\n                                if(nnz){\n                                    if(nnz == 1 && dctcoef_get(h->mb, pixel_shift, i*16))\n                                        idct_dc_add(ptr, h->mb + (i*16 << pixel_shift), linesize);\n                                    else\n                                        idct_add   (ptr, h->mb + (i*16 << pixel_shift), linesize);\n                                }\n                            }\n                        }\n                    }else{\n                        if(transform_bypass){\n                            idct_dc_add =\n                            idct_add    = s->dsp.add_pixels4;\n                        }else{\n                            idct_dc_add = h->h264dsp.h264_idct_dc_add;\n                            idct_add    = h->h264dsp.h264_idct_add;\n                        }\n                        for(i=0; i<16; i++){\n                            uint8_t * const ptr= dest_y + block_offset[i];\n                            const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];\n                            if(transform_bypass && h->sps.profile_idc==244 && dir<=1){\n                                h->hpc.pred4x4_add[dir](ptr, h->mb + (i*16 << pixel_shift), linesize);\n                            }else{\n                                uint8_t *topright;\n                                int nnz, tr;\n                                uint64_t tr_high;\n                                if(dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED){\n                                    const int topright_avail= (h->topright_samples_available<<i)&0x8000;\n                                    assert(mb_y || linesize <= block_offset[i]);\n                                    if(!topright_avail){\n                                        if (pixel_shift) {\n                                            tr_high= ((uint16_t*)ptr)[3 - linesize/2]*0x0001000100010001ULL;\n                                            topright= (uint8_t*) &tr_high;\n                                        } else {\n                                        tr= ptr[3 - linesize]*0x01010101;\n                                        topright= (uint8_t*) &tr;\n                                        }\n                                    }else\n                                        topright= ptr + (4 << pixel_shift) - linesize;\n                                }else\n                                    topright= NULL;\n                                h->hpc.pred4x4[ dir ](ptr, topright, linesize);\n                                nnz = h->non_zero_count_cache[ scan8[i] ];\n                                if(nnz){\n                                    if(is_h264){\n                                        if(nnz == 1 && dctcoef_get(h->mb, pixel_shift, i*16))\n                                            idct_dc_add(ptr, h->mb + (i*16 << pixel_shift), linesize);\n                                        else\n                                            idct_add   (ptr, h->mb + (i*16 << pixel_shift), linesize);\n                                    }else\n                                        ff_svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0);\n                                }\n                            }\n                        }\n                    }\n                }\n            }else{\n                h->hpc.pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize);\n                if(is_h264){\n                    if(h->non_zero_count_cache[ scan8[LUMA_DC_BLOCK_INDEX] ]){\n                        if(!transform_bypass)\n                            h->h264dsp.h264_luma_dc_dequant_idct(h->mb, h->mb_luma_dc, h->dequant4_coeff[0][s->qscale][0]);\n                        else{\n                            static const uint8_t dc_mapping[16] = { 0*16, 1*16, 4*16, 5*16, 2*16, 3*16, 6*16, 7*16,\n                                                                    8*16, 9*16,12*16,13*16,10*16,11*16,14*16,15*16};\n                            for(i = 0; i < 16; i++)\n                                dctcoef_set(h->mb, pixel_shift, dc_mapping[i], dctcoef_get(h->mb_luma_dc, pixel_shift, i));\n                        }\n                    }\n                }else\n                    ff_svq3_luma_dc_dequant_idct_c(h->mb, h->mb_luma_dc, s->qscale);\n            }\n            if(h->deblocking_filter)\n                xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, simple, pixel_shift);\n        }else if(is_h264){\n            if (pixel_shift) {\n                hl_motion_16(h, dest_y, dest_cb, dest_cr,\n                             s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,\n                             s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,\n                             h->h264dsp.weight_h264_pixels_tab,\n                             h->h264dsp.biweight_h264_pixels_tab);\n            } else\n                hl_motion_8(h, dest_y, dest_cb, dest_cr,\n                            s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,\n                            s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,\n                            h->h264dsp.weight_h264_pixels_tab,\n                            h->h264dsp.biweight_h264_pixels_tab);\n        }\n        if(!IS_INTRA4x4(mb_type)){\n            if(is_h264){\n                if(IS_INTRA16x16(mb_type)){\n                    if(transform_bypass){\n                        if(h->sps.profile_idc==244 && (h->intra16x16_pred_mode==VERT_PRED8x8 || h->intra16x16_pred_mode==HOR_PRED8x8)){\n                            h->hpc.pred16x16_add[h->intra16x16_pred_mode](dest_y, block_offset, h->mb, linesize);\n                        }else{\n                            for(i=0; i<16; i++){\n                                if(h->non_zero_count_cache[ scan8[i] ] || dctcoef_get(h->mb, pixel_shift, i*16))\n                                    s->dsp.add_pixels4(dest_y + block_offset[i], h->mb + (i*16 << pixel_shift), linesize);\n                            }\n                        }\n                    }else{\n                         h->h264dsp.h264_idct_add16intra(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);\n                    }\n                }else if(h->cbp&15){\n                    if(transform_bypass){\n                        const int di = IS_8x8DCT(mb_type) ? 4 : 1;\n                        idct_add= IS_8x8DCT(mb_type) ? s->dsp.add_pixels8 : s->dsp.add_pixels4;\n                        for(i=0; i<16; i+=di){\n                            if(h->non_zero_count_cache[ scan8[i] ]){\n                                idct_add(dest_y + block_offset[i], h->mb + (i*16 << pixel_shift), linesize);\n                            }\n                        }\n                    }else{\n                        if(IS_8x8DCT(mb_type)){\n                            h->h264dsp.h264_idct8_add4(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);\n                        }else{\n                            h->h264dsp.h264_idct_add16(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);\n                        }\n                    }\n                }\n            }else{\n                for(i=0; i<16; i++){\n                    if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){\n                        uint8_t * const ptr= dest_y + block_offset[i];\n                        ff_svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, IS_INTRA(mb_type) ? 1 : 0);\n                    }\n                }\n            }\n        }\n        if((simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) && (h->cbp&0x30)){\n            uint8_t *dest[2] = {dest_cb, dest_cr};\n            if(transform_bypass){\n                if(IS_INTRA(mb_type) && h->sps.profile_idc==244 && (h->chroma_pred_mode==VERT_PRED8x8 || h->chroma_pred_mode==HOR_PRED8x8)){\n                    h->hpc.pred8x8_add[h->chroma_pred_mode](dest[0], block_offset + 16, h->mb + (16*16 << pixel_shift), uvlinesize);\n                    h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1], block_offset + 20, h->mb + (20*16 << pixel_shift), uvlinesize);\n                }else{\n                    idct_add = s->dsp.add_pixels4;\n                    for(i=16; i<16+8; i++){\n                        if(h->non_zero_count_cache[ scan8[i] ] || dctcoef_get(h->mb, pixel_shift, i*16))\n                            idct_add   (dest[(i&4)>>2] + block_offset[i], h->mb + (i*16 << pixel_shift), uvlinesize);\n                    }\n                }\n            }else{\n                if(is_h264){\n                    if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+0] ])\n                        h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16*16 << pixel_shift)       , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);\n                    if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+1] ])\n                        h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + ((16*16+4*16) << pixel_shift), h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);\n                    h->h264dsp.h264_idct_add8(dest, block_offset,\n                                              h->mb, uvlinesize,\n                                              h->non_zero_count_cache);\n                }else{\n                    h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16     , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);\n                    h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);\n                    for(i=16; i<16+8; i++){\n                        if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){\n                            uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i];\n                            ff_svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, ff_h264_chroma_qp[0][s->qscale + 12] - 12, 2);\n                        }\n                    }\n                }\n            }\n        }\n    }\n    if(h->cbp || IS_INTRA(mb_type))\n        s->dsp.clear_blocks(h->mb);\n}', 'hl_motion_fn(1, 16)', 'static av_always_inline void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,\n                      qpel_mc_func (*qpix_put)[16], h264_chroma_mc_func (*chroma_put),\n                      qpel_mc_func (*qpix_avg)[16], h264_chroma_mc_func (*chroma_avg),\n                      h264_weight_func *weight_op, h264_biweight_func *weight_avg,\n                      int pixel_shift){\n    MpegEncContext * const s = &h->s;\n    const int mb_xy= h->mb_xy;\n    const int mb_type= s->current_picture.mb_type[mb_xy];\n    assert(IS_INTER(mb_type));\n    if(HAVE_PTHREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))\n        await_references(h);\n    prefetch_motion(h, 0, pixel_shift);\n    if(IS_16X16(mb_type)){\n        mc_part(h, 0, 1, 8, 0, dest_y, dest_cb, dest_cr, 0, 0,\n                qpix_put[0], chroma_put[0], qpix_avg[0], chroma_avg[0],\n                weight_op, weight_avg,\n                IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1),\n                pixel_shift);\n    }else if(IS_16X8(mb_type)){\n        mc_part(h, 0, 0, 4, 8 << pixel_shift, dest_y, dest_cb, dest_cr, 0, 0,\n                qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],\n                &weight_op[1], &weight_avg[1],\n                IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1),\n                pixel_shift);\n        mc_part(h, 8, 0, 4, 8 << pixel_shift, dest_y, dest_cb, dest_cr, 0, 4,\n                qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],\n                &weight_op[1], &weight_avg[1],\n                IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1),\n                pixel_shift);\n    }else if(IS_8X16(mb_type)){\n        mc_part(h, 0, 0, 8, 8*h->mb_linesize, dest_y, dest_cb, dest_cr, 0, 0,\n                qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],\n                &weight_op[2], &weight_avg[2],\n                IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1),\n                pixel_shift);\n        mc_part(h, 4, 0, 8, 8*h->mb_linesize, dest_y, dest_cb, dest_cr, 4, 0,\n                qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],\n                &weight_op[2], &weight_avg[2],\n                IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1),\n                pixel_shift);\n    }else{\n        int i;\n        assert(IS_8X8(mb_type));\n        for(i=0; i<4; i++){\n            const int sub_mb_type= h->sub_mb_type[i];\n            const int n= 4*i;\n            int x_offset= (i&1)<<2;\n            int y_offset= (i&2)<<1;\n            if(IS_SUB_8X8(sub_mb_type)){\n                mc_part(h, n, 1, 4, 0, dest_y, dest_cb, dest_cr, x_offset, y_offset,\n                    qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],\n                    &weight_op[3], &weight_avg[3],\n                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),\n                    pixel_shift);\n            }else if(IS_SUB_8X4(sub_mb_type)){\n                mc_part(h, n  , 0, 2, 4 << pixel_shift, dest_y, dest_cb, dest_cr, x_offset, y_offset,\n                    qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],\n                    &weight_op[4], &weight_avg[4],\n                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),\n                    pixel_shift);\n                mc_part(h, n+2, 0, 2, 4 << pixel_shift, dest_y, dest_cb, dest_cr, x_offset, y_offset+2,\n                    qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],\n                    &weight_op[4], &weight_avg[4],\n                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),\n                    pixel_shift);\n            }else if(IS_SUB_4X8(sub_mb_type)){\n                mc_part(h, n  , 0, 4, 4*h->mb_linesize, dest_y, dest_cb, dest_cr, x_offset, y_offset,\n                    qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],\n                    &weight_op[5], &weight_avg[5],\n                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),\n                    pixel_shift);\n                mc_part(h, n+1, 0, 4, 4*h->mb_linesize, dest_y, dest_cb, dest_cr, x_offset+2, y_offset,\n                    qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],\n                    &weight_op[5], &weight_avg[5],\n                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),\n                    pixel_shift);\n            }else{\n                int j;\n                assert(IS_SUB_4X4(sub_mb_type));\n                for(j=0; j<4; j++){\n                    int sub_x_offset= x_offset + 2*(j&1);\n                    int sub_y_offset= y_offset +   (j&2);\n                    mc_part(h, n+j, 1, 2, 0, dest_y, dest_cb, dest_cr, sub_x_offset, sub_y_offset,\n                        qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],\n                        &weight_op[6], &weight_avg[6],\n                        IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),\n                        pixel_shift);\n                }\n            }\n        }\n    }\n    prefetch_motion(h, 1, pixel_shift);\n}', 'static void await_references(H264Context *h){\n    MpegEncContext * const s = &h->s;\n    const int mb_xy= h->mb_xy;\n    const int mb_type= s->current_picture.mb_type[mb_xy];\n    int refs[2][48];\n    int nrefs[2] = {0};\n    int ref, list;\n    memset(refs, -1, sizeof(refs));\n    if(IS_16X16(mb_type)){\n        get_lowest_part_y(h, refs, 0, 16, 0,\n                  IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);\n    }else if(IS_16X8(mb_type)){\n        get_lowest_part_y(h, refs, 0, 8, 0,\n                  IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);\n        get_lowest_part_y(h, refs, 8, 8, 8,\n                  IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);\n    }else if(IS_8X16(mb_type)){\n        get_lowest_part_y(h, refs, 0, 16, 0,\n                  IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);\n        get_lowest_part_y(h, refs, 4, 16, 0,\n                  IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);\n    }else{\n        int i;\n        assert(IS_8X8(mb_type));\n        for(i=0; i<4; i++){\n            const int sub_mb_type= h->sub_mb_type[i];\n            const int n= 4*i;\n            int y_offset= (i&2)<<2;\n            if(IS_SUB_8X8(sub_mb_type)){\n                get_lowest_part_y(h, refs, n  , 8, y_offset,\n                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);\n            }else if(IS_SUB_8X4(sub_mb_type)){\n                get_lowest_part_y(h, refs, n  , 4, y_offset,\n                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);\n                get_lowest_part_y(h, refs, n+2, 4, y_offset+4,\n                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);\n            }else if(IS_SUB_4X8(sub_mb_type)){\n                get_lowest_part_y(h, refs, n  , 8, y_offset,\n                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);\n                get_lowest_part_y(h, refs, n+1, 8, y_offset,\n                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);\n            }else{\n                int j;\n                assert(IS_SUB_4X4(sub_mb_type));\n                for(j=0; j<4; j++){\n                    int sub_y_offset= y_offset + 2*(j&2);\n                    get_lowest_part_y(h, refs, n+j, 4, sub_y_offset,\n                              IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);\n                }\n            }\n        }\n    }\n    for(list=h->list_count-1; list>=0; list--){\n        for(ref=0; ref<48 && nrefs[list]; ref++){\n            int row = refs[list][ref];\n            if(row >= 0){\n                Picture *ref_pic = &h->ref_list[list][ref];\n                int ref_field = ref_pic->reference - 1;\n                int ref_field_picture = ref_pic->field_picture;\n                int pic_height = 16*s->mb_height >> ref_field_picture;\n                row <<= MB_MBAFF;\n                nrefs[list]--;\n                if(!FIELD_PICTURE && ref_field_picture){\n                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) - !(row&1), pic_height-1), 1);\n                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1)           , pic_height-1), 0);\n                }else if(FIELD_PICTURE && !ref_field_picture){\n                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row*2 + ref_field    , pic_height-1), 0);\n                }else if(FIELD_PICTURE){\n                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), ref_field);\n                }else{\n                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), 0);\n                }\n            }\n        }\n    }\n}']