static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {
    const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
    int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
    int alpha = alpha_table[index_a];
    int beta  = beta_table[qp - qp_bd_offset + h->slice_beta_offset];
    if (alpha ==0 || beta == 0) return;
    if( bS[0] < 4 ) {
        int8_t tc[4];
        tc[0] = tc0_table[index_a][bS[0*bsi]];
        tc[1] = tc0_table[index_a][bS[1*bsi]];
        tc[2] = tc0_table[index_a][bS[2*bsi]];
        tc[3] = tc0_table[index_a][bS[3*bsi]];
        h->h264dsp.h264_h_loop_filter_luma_mbaff(pix, stride, alpha, beta, tc);
    } else {
        h->h264dsp.h264_h_loop_filter_luma_mbaff_intra(pix, stride, alpha, beta);
    }
}
['void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) {\n    MpegEncContext * const s = &h->s;\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    const int mvy_limit = IS_INTERLACED(mb_type) ? 2 : 4;\n    int first_vertical_edge_done = 0;\n    av_unused int dir;\n    int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY));\n    if (FRAME_MBAFF\n            && IS_INTERLACED(mb_type^h->left_type[LTOP])\n            && h->left_type[LTOP]) {\n        DECLARE_ALIGNED(8, int16_t, bS)[8];\n        int qp[2];\n        int bqp[2];\n        int rqp[2];\n        int mb_qp, mbn0_qp, mbn1_qp;\n        int i;\n        first_vertical_edge_done = 1;\n        if( IS_INTRA(mb_type) ) {\n            AV_WN64A(&bS[0], 0x0004000400040004ULL);\n            AV_WN64A(&bS[4], 0x0004000400040004ULL);\n        } else {\n            static const uint8_t offset[2][2][8]={\n                {\n                    {3+4*0, 3+4*0, 3+4*0, 3+4*0, 3+4*1, 3+4*1, 3+4*1, 3+4*1},\n                    {3+4*2, 3+4*2, 3+4*2, 3+4*2, 3+4*3, 3+4*3, 3+4*3, 3+4*3},\n                },{\n                    {3+4*0, 3+4*1, 3+4*2, 3+4*3, 3+4*0, 3+4*1, 3+4*2, 3+4*3},\n                    {3+4*0, 3+4*1, 3+4*2, 3+4*3, 3+4*0, 3+4*1, 3+4*2, 3+4*3},\n                }\n            };\n            const uint8_t *off= offset[MB_FIELD][mb_y&1];\n            for( i = 0; i < 8; i++ ) {\n                int j= MB_FIELD ? i>>2 : i&1;\n                int mbn_xy = h->left_mb_xy[LEFT(j)];\n                int mbn_type= h->left_type[LEFT(j)];\n                if( IS_INTRA( mbn_type ) )\n                    bS[i] = 4;\n                else{\n                    bS[i] = 1 + !!(h->non_zero_count_cache[12+8*(i>>1)] |\n                         ((!h->pps.cabac && IS_8x8DCT(mbn_type)) ?\n                            (h->cbp_table[mbn_xy] & (((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2) << 12))\n                                                                       :\n                            h->non_zero_count[mbn_xy][ off[i] ]));\n                }\n            }\n        }\n        mb_qp = s->current_picture.qscale_table[mb_xy];\n        mbn0_qp = s->current_picture.qscale_table[h->left_mb_xy[0]];\n        mbn1_qp = s->current_picture.qscale_table[h->left_mb_xy[1]];\n        qp[0] = ( mb_qp + mbn0_qp + 1 ) >> 1;\n        bqp[0] = ( get_chroma_qp( h, 0, mb_qp ) +\n                   get_chroma_qp( h, 0, mbn0_qp ) + 1 ) >> 1;\n        rqp[0] = ( get_chroma_qp( h, 1, mb_qp ) +\n                   get_chroma_qp( h, 1, mbn0_qp ) + 1 ) >> 1;\n        qp[1] = ( mb_qp + mbn1_qp + 1 ) >> 1;\n        bqp[1] = ( get_chroma_qp( h, 0, mb_qp ) +\n                   get_chroma_qp( h, 0, mbn1_qp ) + 1 ) >> 1;\n        rqp[1] = ( get_chroma_qp( h, 1, mb_qp ) +\n                   get_chroma_qp( h, 1, mbn1_qp ) + 1 ) >> 1;\n        tprintf(s->avctx, "filter mb:%d/%d MBAFF, QPy:%d/%d, QPb:%d/%d QPr:%d/%d ls:%d uvls:%d", mb_x, mb_y, qp[0], qp[1], bqp[0], bqp[1], rqp[0], rqp[1], linesize, uvlinesize);\n        { int i; for (i = 0; i < 8; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\\n"); }\n        if(MB_FIELD){\n            filter_mb_mbaff_edgev ( h, img_y                ,   linesize, bS  , 1, qp [0] );\n            filter_mb_mbaff_edgev ( h, img_y  + 8*  linesize,   linesize, bS+4, 1, qp [1] );\n            if (chroma){\n                if (CHROMA444) {\n                    filter_mb_mbaff_edgev ( h, img_cb,                uvlinesize, bS  , 1, bqp[0] );\n                    filter_mb_mbaff_edgev ( h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1] );\n                    filter_mb_mbaff_edgev ( h, img_cr,                uvlinesize, bS  , 1, rqp[0] );\n                    filter_mb_mbaff_edgev ( h, img_cr + 8*uvlinesize, uvlinesize, bS+4, 1, rqp[1] );\n                }else{\n                    filter_mb_mbaff_edgecv( h, img_cb,                uvlinesize, bS  , 1, bqp[0] );\n                    filter_mb_mbaff_edgecv( h, img_cb + 4*uvlinesize, uvlinesize, bS+4, 1, bqp[1] );\n                    filter_mb_mbaff_edgecv( h, img_cr,                uvlinesize, bS  , 1, rqp[0] );\n                    filter_mb_mbaff_edgecv( h, img_cr + 4*uvlinesize, uvlinesize, bS+4, 1, rqp[1] );\n                }\n            }\n        }else{\n            filter_mb_mbaff_edgev ( h, img_y              , 2*  linesize, bS  , 2, qp [0] );\n            filter_mb_mbaff_edgev ( h, img_y  +   linesize, 2*  linesize, bS+1, 2, qp [1] );\n            if (chroma){\n                if (CHROMA444) {\n                    filter_mb_mbaff_edgev ( h, img_cb,              2*uvlinesize, bS  , 2, bqp[0] );\n                    filter_mb_mbaff_edgev ( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] );\n                    filter_mb_mbaff_edgev ( h, img_cr,              2*uvlinesize, bS  , 2, rqp[0] );\n                    filter_mb_mbaff_edgev ( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] );\n                }else{\n                    filter_mb_mbaff_edgecv( h, img_cb,              2*uvlinesize, bS  , 2, bqp[0] );\n                    filter_mb_mbaff_edgecv( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] );\n                    filter_mb_mbaff_edgecv( h, img_cr,              2*uvlinesize, bS  , 2, rqp[0] );\n                    filter_mb_mbaff_edgecv( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] );\n                }\n            }\n        }\n    }\n#if CONFIG_SMALL\n    for( dir = 0; dir < 2; dir++ )\n        filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : first_vertical_edge_done, chroma, CHROMA444, dir);\n#else\n    filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, first_vertical_edge_done, chroma, CHROMA444, 0);\n    filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, 0, chroma, CHROMA444, 1);\n#endif\n}', 'static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {\n    const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);\n    int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;\n    int alpha = alpha_table[index_a];\n    int beta  = beta_table[qp - qp_bd_offset + h->slice_beta_offset];\n    if (alpha ==0 || beta == 0) return;\n    if( bS[0] < 4 ) {\n        int8_t tc[4];\n        tc[0] = tc0_table[index_a][bS[0*bsi]];\n        tc[1] = tc0_table[index_a][bS[1*bsi]];\n        tc[2] = tc0_table[index_a][bS[2*bsi]];\n        tc[3] = tc0_table[index_a][bS[3*bsi]];\n        h->h264dsp.h264_h_loop_filter_luma_mbaff(pix, stride, alpha, beta, tc);\n    } else {\n        h->h264dsp.h264_h_loop_filter_luma_mbaff_intra(pix, stride, alpha, beta);\n    }\n}']