static av_always_inline void filter_mb_dir(const H264Context *h, H264SliceContext *sl,

                                           int mb_x, int mb_y,

                                           uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,

                                           unsigned int linesize, unsigned int uvlinesize,

                                           int mb_xy, int mb_type, int mvy_limit,

                                           int first_vertical_edge_done, int a, int b,

                                           int chroma, int dir)

{

    int edge;

    int chroma_qp_avg[2];

    int chroma444 = CHROMA444(h);

    int chroma422 = CHROMA422(h);

    const int mbm_xy = dir == 0 ? mb_xy -1 : sl->top_mb_xy;

    const int mbm_type = dir == 0 ? sl->left_type[LTOP] : sl->top_type;



    // how often to recheck mv-based bS when iterating between edges

    static const uint8_t mask_edge_tab[2][8]={{0,3,3,3,1,1,1,1},

                                              {0,3,1,1,3,3,3,3}};

    const int mask_edge = mask_edge_tab[dir][(mb_type>>3)&7];

    const int edges = mask_edge== 3 && !(sl->cbp&15) ? 1 : 4;



    // how often to recheck mv-based bS when iterating along each edge

    const int mask_par0 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir));



    if(mbm_type && !first_vertical_edge_done){



        if (FRAME_MBAFF(h) && (dir == 1) && ((mb_y&1) == 0)

            && IS_INTERLACED(mbm_type&~mb_type)

            ) {

            // This is a special case in the norm where the filtering must

            // be done twice (one each of the field) even if we are in a

            // frame macroblock.

            //

            unsigned int tmp_linesize   = 2 *   linesize;

            unsigned int tmp_uvlinesize = 2 * uvlinesize;

            int mbn_xy = mb_xy - 2 * h->mb_stride;

            int j;



            for(j=0; j<2; j++, mbn_xy += h->mb_stride){

                DECLARE_ALIGNED(8, int16_t, bS)[4];

                int qp;

                if (IS_INTRA(mb_type | h->cur_pic.mb_type[mbn_xy])) {

                    AV_WN64A(bS, 0x0003000300030003ULL);

                } else {

                    if (!CABAC(h) && IS_8x8DCT(h->cur_pic.mb_type[mbn_xy])) {

                        bS[0]= 1+((h->cbp_table[mbn_xy] & 0x4000) || sl->non_zero_count_cache[scan8[0]+0]);

                        bS[1]= 1+((h->cbp_table[mbn_xy] & 0x4000) || sl->non_zero_count_cache[scan8[0]+1]);

                        bS[2]= 1+((h->cbp_table[mbn_xy] & 0x8000) || sl->non_zero_count_cache[scan8[0]+2]);

                        bS[3]= 1+((h->cbp_table[mbn_xy] & 0x8000) || sl->non_zero_count_cache[scan8[0]+3]);

                    }else{

                    const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 3*4;

                    int i;

                    for( i = 0; i < 4; i++ ) {

                        bS[i] = 1 + !!(sl->non_zero_count_cache[scan8[0]+i] | mbn_nnz[i]);

                    }

                    }

                }

                // Do not use s->qscale as luma quantizer because it has not the same

                // value in IPCM macroblocks.

                qp = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[mbn_xy] + 1) >> 1;

                ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize);

                { int i; for (i = 0; i < 4; i++) ff_tlog(h->avctx, " bS[%d]:%d", i, bS[i]); ff_tlog(h->avctx, "\n"); }

                filter_mb_edgeh( &img_y[j*linesize], tmp_linesize, bS, qp, a, b, h, 0 );

                chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1;

                chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1;

                if (chroma) {

                    if (chroma444) {

                        filter_mb_edgeh (&img_cb[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[0], a, b, h, 0);

                        filter_mb_edgeh (&img_cr[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[1], a, b, h, 0);

                    } else {

                        filter_mb_edgech(&img_cb[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[0], a, b, h, 0);

                        filter_mb_edgech(&img_cr[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[1], a, b, h, 0);

                    }

                }

            }

        }else{

            DECLARE_ALIGNED(8, int16_t, bS)[4];

            int qp;



            if( IS_INTRA(mb_type|mbm_type)) {

                AV_WN64A(bS, 0x0003000300030003ULL);

                if (   (!IS_INTERLACED(mb_type|mbm_type))

                    || ((FRAME_MBAFF(h) || (h->picture_structure != PICT_FRAME)) && (dir == 0))

                )

                    AV_WN64A(bS, 0x0004000400040004ULL);

            } else {

                int i;

                int mv_done;



                if( dir && FRAME_MBAFF(h) && IS_INTERLACED(mb_type ^ mbm_type)) {

                    AV_WN64A(bS, 0x0001000100010001ULL);

                    mv_done = 1;

                }

                else if( mask_par0 && ((mbm_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) {

                    int b_idx= 8 + 4;

                    int bn_idx= b_idx - (dir ? 8:1);



                    bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, 8 + 4, bn_idx, mvy_limit);

                    mv_done = 1;

                }

                else

                    mv_done = 0;



                for( i = 0; i < 4; i++ ) {

                    int x = dir == 0 ? 0 : i;

                    int y = dir == 0 ? i    : 0;

                    int b_idx= 8 + 4 + x + 8*y;

                    int bn_idx= b_idx - (dir ? 8:1);



                    if (sl->non_zero_count_cache[b_idx] |

                        sl->non_zero_count_cache[bn_idx]) {

                        bS[i] = 2;

                    }

                    else if(!mv_done)

                    {

                        bS[i] = check_mv(sl, b_idx, bn_idx, mvy_limit);

                    }

                }

            }



            /* Filter edge */

            // Do not use s->qscale as luma quantizer because it has not the same

            // value in IPCM macroblocks.

            if(bS[0]+bS[1]+bS[2]+bS[3]){

                qp = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[mbm_xy] + 1) >> 1;

                ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);

                chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1;

                chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1;

                if( dir == 0 ) {

                    filter_mb_edgev( &img_y[0], linesize, bS, qp, a, b, h, 1 );

                    if (chroma) {

                        if (chroma444) {

                            filter_mb_edgev ( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1);

                            filter_mb_edgev ( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1);

                        } else {

                            filter_mb_edgecv( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1);

                            filter_mb_edgecv( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1);

                        }

                    }

                } else {

                    filter_mb_edgeh( &img_y[0], linesize, bS, qp, a, b, h, 1 );

                    if (chroma) {

                        if (chroma444) {

                            filter_mb_edgeh ( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1);

                            filter_mb_edgeh ( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1);

                        } else {

                            filter_mb_edgech( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1);

                            filter_mb_edgech( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1);

                        }

                    }

                }

            }

        }

    }



    /* Calculate bS */

    for( edge = 1; edge < edges; edge++ ) {

        DECLARE_ALIGNED(8, int16_t, bS)[4];

        int qp;

        const int deblock_edge = !IS_8x8DCT(mb_type & (edge<<24)); // (edge&1) && IS_8x8DCT(mb_type)



        if (!deblock_edge && (!chroma422 || dir == 0))

            continue;



        if( IS_INTRA(mb_type)) {

            AV_WN64A(bS, 0x0003000300030003ULL);

        } else {

            int i;

            int mv_done;



            if( edge & mask_edge ) {

                AV_ZERO64(bS);

                mv_done = 1;

            }

            else if( mask_par0 ) {

                int b_idx= 8 + 4 + edge * (dir ? 8:1);

                int bn_idx= b_idx - (dir ? 8:1);



                bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, b_idx, bn_idx, mvy_limit);

                mv_done = 1;

            }

            else

                mv_done = 0;



            for( i = 0; i < 4; i++ ) {

                int x = dir == 0 ? edge : i;

                int y = dir == 0 ? i    : edge;

                int b_idx= 8 + 4 + x + 8*y;

                int bn_idx= b_idx - (dir ? 8:1);



                if (sl->non_zero_count_cache[b_idx] |

                    sl->non_zero_count_cache[bn_idx]) {

                    bS[i] = 2;

                }

                else if(!mv_done)

                {

                    bS[i] = check_mv(sl, b_idx, bn_idx, mvy_limit);

                }

            }



            if(bS[0]+bS[1]+bS[2]+bS[3] == 0)

                continue;

        }



        /* Filter edge */

        // Do not use s->qscale as luma quantizer because it has not the same

        // value in IPCM macroblocks.

        qp = h->cur_pic.qscale_table[mb_xy];

        ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);

        if( dir == 0 ) {

            filter_mb_edgev( &img_y[4*edge << h->pixel_shift], linesize, bS, qp, a, b, h, 0 );

            if (chroma) {

                if (chroma444) {

                    filter_mb_edgev ( &img_cb[4*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                    filter_mb_edgev ( &img_cr[4*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                } else if( (edge&1) == 0 ) {

                    filter_mb_edgecv( &img_cb[2*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                    filter_mb_edgecv( &img_cr[2*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                }

            }

        } else {

            if (chroma422) {

                if (deblock_edge)

                    filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0);

                if (chroma) {

                    filter_mb_edgech(&img_cb[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                    filter_mb_edgech(&img_cr[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                }

            } else {

                filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0);

                if (chroma) {

                    if (chroma444) {

                        filter_mb_edgeh (&img_cb[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                        filter_mb_edgeh (&img_cr[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                    } else if ((edge&1) == 0) {

                        filter_mb_edgech(&img_cb[2*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                        filter_mb_edgech(&img_cr[2*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                    }

                }

            }

        }

    }

}

static av_always_inline void filter_mb_dir(const H264Context *h, H264SliceContext *sl,

                                           int mb_x, int mb_y,

                                           uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,

                                           unsigned int linesize, unsigned int uvlinesize,

                                           int mb_xy, int mb_type, int mvy_limit,

                                           int first_vertical_edge_done, int a, int b,

                                           int chroma, int dir)

{

    int edge;

    int chroma_qp_avg[2];

    int chroma444 = CHROMA444(h);

    int chroma422 = CHROMA422(h);

    const int mbm_xy = dir == 0 ? mb_xy -1 : sl->top_mb_xy;

    const int mbm_type = dir == 0 ? sl->left_type[LTOP] : sl->top_type;



    

    static const uint8_t mask_edge_tab[2][8]={{0,3,3,3,1,1,1,1},

                                              {0,3,1,1,3,3,3,3}};

    const int mask_edge = mask_edge_tab[dir][(mb_type>>3)&7];

    const int edges = mask_edge== 3 && !(sl->cbp&15) ? 1 : 4;



    

    const int mask_par0 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir));



    if(mbm_type && !first_vertical_edge_done){



        if (FRAME_MBAFF(h) && (dir == 1) && ((mb_y&1) == 0)

            && IS_INTERLACED(mbm_type&~mb_type)

            ) {

            

            

            

            

            unsigned int tmp_linesize   = 2 *   linesize;

            unsigned int tmp_uvlinesize = 2 * uvlinesize;

            int mbn_xy = mb_xy - 2 * h->mb_stride;

            int j;



            for(j=0; j<2; j++, mbn_xy += h->mb_stride){

                DECLARE_ALIGNED(8, int16_t, bS)[4];

                int qp;

                if (IS_INTRA(mb_type | h->cur_pic.mb_type[mbn_xy])) {

                    AV_WN64A(bS, 0x0003000300030003ULL);

                } else {

                    if (!CABAC(h) && IS_8x8DCT(h->cur_pic.mb_type[mbn_xy])) {

                        bS[0]= 1+((h->cbp_table[mbn_xy] & 0x4000) || sl->non_zero_count_cache[scan8[0]+0]);

                        bS[1]= 1+((h->cbp_table[mbn_xy] & 0x4000) || sl->non_zero_count_cache[scan8[0]+1]);

                        bS[2]= 1+((h->cbp_table[mbn_xy] & 0x8000) || sl->non_zero_count_cache[scan8[0]+2]);

                        bS[3]= 1+((h->cbp_table[mbn_xy] & 0x8000) || sl->non_zero_count_cache[scan8[0]+3]);

                    }else{

                    const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 3*4;

                    int i;

                    for( i = 0; i < 4; i++ ) {

                        bS[i] = 1 + !!(sl->non_zero_count_cache[scan8[0]+i] | mbn_nnz[i]);

                    }

                    }

                }

                 Do not use s->qscale as luma quantizer because it has not the same

                 value in IPCM macroblocks.

                qp = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[mbn_xy] + 1) >> 1;

                ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize);

                { int i; for (i = 0; i < 4; i++) ff_tlog(h->avctx, " bS[%d]:%d", i, bS[i]); ff_tlog(h->avctx, "\n"); }

                filter_mb_edgeh( &img_y[j*linesize], tmp_linesize, bS, qp, a, b, h, 0 );

                chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1;

                chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1;

                if (chroma) {

                    if (chroma444) {

                        filter_mb_edgeh (&img_cb[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[0], a, b, h, 0);

                        filter_mb_edgeh (&img_cr[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[1], a, b, h, 0);

                    } else {

                        filter_mb_edgech(&img_cb[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[0], a, b, h, 0);

                        filter_mb_edgech(&img_cr[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[1], a, b, h, 0);

                    }

                }

            }

        }else{

            DECLARE_ALIGNED(8, int16_t, bS)[4];

            int qp;



            if( IS_INTRA(mb_type|mbm_type)) {

                AV_WN64A(bS, 0x0003000300030003ULL);

                if (   (!IS_INTERLACED(mb_type|mbm_type))

                    || ((FRAME_MBAFF(h) || (h->picture_structure != PICT_FRAME)) && (dir == 0))

                )

                    AV_WN64A(bS, 0x0004000400040004ULL);

            } else {

                int i;

                int mv_done;



                if( dir && FRAME_MBAFF(h) && IS_INTERLACED(mb_type ^ mbm_type)) {

                    AV_WN64A(bS, 0x0001000100010001ULL);

                    mv_done = 1;

                }

                else if( mask_par0 && ((mbm_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) {

                    int b_idx= 8 + 4;

                    int bn_idx= b_idx - (dir ? 8:1);



                    bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, 8 + 4, bn_idx, mvy_limit);

                    mv_done = 1;

                }

                else

                    mv_done = 0;



                for( i = 0; i < 4; i++ ) {

                    int x = dir == 0 ? 0 : i;

                    int y = dir == 0 ? i    : 0;

                    int b_idx= 8 + 4 + x + 8*y;

                    int bn_idx= b_idx - (dir ? 8:1);



                    if (sl->non_zero_count_cache[b_idx] |

                        sl->non_zero_count_cache[bn_idx]) {

                        bS[i] = 2;

                    }

                    else if(!mv_done)

                    {

                        bS[i] = check_mv(sl, b_idx, bn_idx, mvy_limit);

                    }

                }

            }



            

             Do not use s->qscale as luma quantizer because it has not the same

             value in IPCM macroblocks.

            if(bS[0]+bS[1]+bS[2]+bS[3]){

                qp = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[mbm_xy] + 1) >> 1;

                ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);

                chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1;

                chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1;

                if( dir == 0 ) {

                    filter_mb_edgev( &img_y[0], linesize, bS, qp, a, b, h, 1 );

                    if (chroma) {

                        if (chroma444) {

                            filter_mb_edgev ( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1);

                            filter_mb_edgev ( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1);

                        } else {

                            filter_mb_edgecv( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1);

                            filter_mb_edgecv( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1);

                        }

                    }

                } else {

                    filter_mb_edgeh( &img_y[0], linesize, bS, qp, a, b, h, 1 );

                    if (chroma) {

                        if (chroma444) {

                            filter_mb_edgeh ( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1);

                            filter_mb_edgeh ( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1);

                        } else {

                            filter_mb_edgech( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1);

                            filter_mb_edgech( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1);

                        }

                    }

                }

            }

        }

    }



    

    for( edge = 1; edge < edges; edge++ ) {

        DECLARE_ALIGNED(8, int16_t, bS)[4];

        int qp;

        const int deblock_edge = !IS_8x8DCT(mb_type & (edge<<24));  (edge&1) && IS_8x8DCT(mb_type)



        if (!deblock_edge && (!chroma422 || dir == 0))

            continue;



        if( IS_INTRA(mb_type)) {

            AV_WN64A(bS, 0x0003000300030003ULL);

        } else {

            int i;

            int mv_done;



            if( edge & mask_edge ) {

                AV_ZERO64(bS);

                mv_done = 1;

            }

            else if( mask_par0 ) {

                int b_idx= 8 + 4 + edge * (dir ? 8:1);

                int bn_idx= b_idx - (dir ? 8:1);



                bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, b_idx, bn_idx, mvy_limit);

                mv_done = 1;

            }

            else

                mv_done = 0;



            for( i = 0; i < 4; i++ ) {

                int x = dir == 0 ? edge : i;

                int y = dir == 0 ? i    : edge;

                int b_idx= 8 + 4 + x + 8*y;

                int bn_idx= b_idx - (dir ? 8:1);



                if (sl->non_zero_count_cache[b_idx] |

                    sl->non_zero_count_cache[bn_idx]) {

                    bS[i] = 2;

                }

                else if(!mv_done)

                {

                    bS[i] = check_mv(sl, b_idx, bn_idx, mvy_limit);

                }

            }



            if(bS[0]+bS[1]+bS[2]+bS[3] == 0)

                continue;

        }



        

         Do not use s->qscale as luma quantizer because it has not the same

         value in IPCM macroblocks.

        qp = h->cur_pic.qscale_table[mb_xy];

        ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);

        if( dir == 0 ) {

            filter_mb_edgev( &img_y[4*edge << h->pixel_shift], linesize, bS, qp, a, b, h, 0 );

            if (chroma) {

                if (chroma444) {

                    filter_mb_edgev ( &img_cb[4*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                    filter_mb_edgev ( &img_cr[4*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                } else if( (edge&1) == 0 ) {

                    filter_mb_edgecv( &img_cb[2*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                    filter_mb_edgecv( &img_cr[2*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                }

            }

        } else {

            if (chroma422) {

                if (deblock_edge)

                    filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0);

                if (chroma) {

                    filter_mb_edgech(&img_cb[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                    filter_mb_edgech(&img_cr[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                }

            } else {

                filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0);

                if (chroma) {

                    if (chroma444) {

                        filter_mb_edgeh (&img_cb[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                        filter_mb_edgeh (&img_cr[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                    } else if ((edge&1) == 0) {

                        filter_mb_edgech(&img_cb[2*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                        filter_mb_edgech(&img_cr[2*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                    }

                }

            }

        }

    }

}

                ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize);
static av_always_inline void FUNC_0(const H264Context *h, H264SliceContext *sl,

                                           int mb_x, int mb_y,

                                           uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,

                                           unsigned int linesize, unsigned int uvlinesize,

                                           int mb_xy, int mb_type, int mvy_limit,

                                           int first_vertical_edge_done, int a, int b,

                                           int chroma, int dir)

{

    int VAR_0;

    int VAR_1[2];

    int VAR_2 = CHROMA444(h);

    int VAR_3 = CHROMA422(h);

    const int VAR_4 = dir == 0 ? mb_xy -1 : sl->top_mb_xy;

    const int VAR_5 = dir == 0 ? sl->left_type[LTOP] : sl->top_type;



    

    static const uint8_t VAR_6[2][8]={{0,3,3,3,1,1,1,1},

                                              {0,3,1,1,3,3,3,3}};

    const int VAR_7 = VAR_6[dir][(mb_type>>3)&7];

    const int VAR_8 = VAR_7== 3 && !(sl->cbp&15) ? 1 : 4;



    

    const int VAR_9 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir));



    if(VAR_5 && !first_vertical_edge_done){



        if (FRAME_MBAFF(h) && (dir == 1) && ((mb_y&1) == 0)

            && IS_INTERLACED(VAR_5&~mb_type)

            ) {

            

            

            

            

            unsigned int VAR_10   = 2 *   linesize;

            unsigned int VAR_11 = 2 * uvlinesize;

            int VAR_12 = mb_xy - 2 * h->mb_stride;

            int VAR_13;



            for(VAR_13=0; VAR_13<2; VAR_13++, VAR_12 += h->mb_stride){

                DECLARE_ALIGNED(8, int16_t, bS)[4];

                int VAR_22;

                if (IS_INTRA(mb_type | h->cur_pic.mb_type[VAR_12])) {

                    AV_WN64A(bS, 0x0003000300030003ULL);

                } else {

                    if (!CABAC(h) && IS_8x8DCT(h->cur_pic.mb_type[VAR_12])) {

                        bS[0]= 1+((h->cbp_table[VAR_12] & 0x4000) || sl->non_zero_count_cache[scan8[0]+0]);

                        bS[1]= 1+((h->cbp_table[VAR_12] & 0x4000) || sl->non_zero_count_cache[scan8[0]+1]);

                        bS[2]= 1+((h->cbp_table[VAR_12] & 0x8000) || sl->non_zero_count_cache[scan8[0]+2]);

                        bS[3]= 1+((h->cbp_table[VAR_12] & 0x8000) || sl->non_zero_count_cache[scan8[0]+3]);

                    }else{

                    const uint8_t *VAR_15 = h->non_zero_count[VAR_12] + 3*4;

                    int VAR_23;

                    for( VAR_23 = 0; VAR_23 < 4; VAR_23++ ) {

                        bS[VAR_23] = 1 + !!(sl->non_zero_count_cache[scan8[0]+VAR_23] | VAR_15[VAR_23]);

                    }

                    }

                }

                 Do not use s->qscale as luma quantizer because it has not the same

                 value in IPCM macroblocks.

                VAR_22 = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[VAR_12] + 1) >> 1;

                ff_tlog(h->avctx, "filter mb:%d/%d dir:%d VAR_0:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, VAR_0, VAR_22, VAR_10, VAR_11);

                { int VAR_23; for (VAR_23 = 0; VAR_23 < 4; VAR_23++) ff_tlog(h->avctx, " bS[%d]:%d", VAR_23, bS[VAR_23]); ff_tlog(h->avctx, "\n"); }

                filter_mb_edgeh( &img_y[VAR_13*linesize], VAR_10, bS, VAR_22, a, b, h, 0 );

                VAR_1[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[VAR_12]) + 1) >> 1;

                VAR_1[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[VAR_12]) + 1) >> 1;

                if (chroma) {

                    if (VAR_2) {

                        filter_mb_edgeh (&img_cb[VAR_13*uvlinesize], VAR_11, bS, VAR_1[0], a, b, h, 0);

                        filter_mb_edgeh (&img_cr[VAR_13*uvlinesize], VAR_11, bS, VAR_1[1], a, b, h, 0);

                    } else {

                        filter_mb_edgech(&img_cb[VAR_13*uvlinesize], VAR_11, bS, VAR_1[0], a, b, h, 0);

                        filter_mb_edgech(&img_cr[VAR_13*uvlinesize], VAR_11, bS, VAR_1[1], a, b, h, 0);

                    }

                }

            }

        }else{

            DECLARE_ALIGNED(8, int16_t, bS)[4];

            int VAR_22;



            if( IS_INTRA(mb_type|VAR_5)) {

                AV_WN64A(bS, 0x0003000300030003ULL);

                if (   (!IS_INTERLACED(mb_type|VAR_5))

                    || ((FRAME_MBAFF(h) || (h->picture_structure != PICT_FRAME)) && (dir == 0))

                )

                    AV_WN64A(bS, 0x0004000400040004ULL);

            } else {

                int VAR_23;

                int VAR_23;



                if( dir && FRAME_MBAFF(h) && IS_INTERLACED(mb_type ^ VAR_5)) {

                    AV_WN64A(bS, 0x0001000100010001ULL);

                    VAR_23 = 1;

                }

                else if( VAR_9 && ((VAR_5 & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) {

                    int VAR_23= 8 + 4;

                    int VAR_23= VAR_23 - (dir ? 8:1);



                    bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, 8 + 4, VAR_23, mvy_limit);

                    VAR_23 = 1;

                }

                else

                    VAR_23 = 0;



                for( VAR_23 = 0; VAR_23 < 4; VAR_23++ ) {

                    int VAR_23 = dir == 0 ? 0 : VAR_23;

                    int VAR_23 = dir == 0 ? VAR_23    : 0;

                    int VAR_23= 8 + 4 + VAR_23 + 8*VAR_23;

                    int VAR_23= VAR_23 - (dir ? 8:1);



                    if (sl->non_zero_count_cache[VAR_23] |

                        sl->non_zero_count_cache[VAR_23]) {

                        bS[VAR_23] = 2;

                    }

                    else if(!VAR_23)

                    {

                        bS[VAR_23] = check_mv(sl, VAR_23, VAR_23, mvy_limit);

                    }

                }

            }



            

             Do not use s->qscale as luma quantizer because it has not the same

             value in IPCM macroblocks.

            if(bS[0]+bS[1]+bS[2]+bS[3]){

                VAR_22 = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[VAR_4] + 1) >> 1;

                ff_tlog(h->avctx, "filter mb:%d/%d dir:%d VAR_0:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, VAR_0, VAR_22, linesize, uvlinesize);

                VAR_1[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[VAR_4]) + 1) >> 1;

                VAR_1[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[VAR_4]) + 1) >> 1;

                if( dir == 0 ) {

                    filter_mb_edgev( &img_y[0], linesize, bS, VAR_22, a, b, h, 1 );

                    if (chroma) {

                        if (VAR_2) {

                            filter_mb_edgev ( &img_cb[0], uvlinesize, bS, VAR_1[0], a, b, h, 1);

                            filter_mb_edgev ( &img_cr[0], uvlinesize, bS, VAR_1[1], a, b, h, 1);

                        } else {

                            filter_mb_edgecv( &img_cb[0], uvlinesize, bS, VAR_1[0], a, b, h, 1);

                            filter_mb_edgecv( &img_cr[0], uvlinesize, bS, VAR_1[1], a, b, h, 1);

                        }

                    }

                } else {

                    filter_mb_edgeh( &img_y[0], linesize, bS, VAR_22, a, b, h, 1 );

                    if (chroma) {

                        if (VAR_2) {

                            filter_mb_edgeh ( &img_cb[0], uvlinesize, bS, VAR_1[0], a, b, h, 1);

                            filter_mb_edgeh ( &img_cr[0], uvlinesize, bS, VAR_1[1], a, b, h, 1);

                        } else {

                            filter_mb_edgech( &img_cb[0], uvlinesize, bS, VAR_1[0], a, b, h, 1);

                            filter_mb_edgech( &img_cr[0], uvlinesize, bS, VAR_1[1], a, b, h, 1);

                        }

                    }

                }

            }

        }

    }



    

    for( VAR_0 = 1; VAR_0 < VAR_8; VAR_0++ ) {

        DECLARE_ALIGNED(8, int16_t, bS)[4];

        int VAR_22;

        const int VAR_22 = !IS_8x8DCT(mb_type & (VAR_0<<24));  (VAR_0&1) && IS_8x8DCT(mb_type)



        if (!VAR_22 && (!VAR_3 || dir == 0))

            continue;



        if( IS_INTRA(mb_type)) {

            AV_WN64A(bS, 0x0003000300030003ULL);

        } else {

            int VAR_23;

            int VAR_23;



            if( VAR_0 & VAR_7 ) {

                AV_ZERO64(bS);

                VAR_23 = 1;

            }

            else if( VAR_9 ) {

                int VAR_23= 8 + 4 + VAR_0 * (dir ? 8:1);

                int VAR_23= VAR_23 - (dir ? 8:1);



                bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, VAR_23, VAR_23, mvy_limit);

                VAR_23 = 1;

            }

            else

                VAR_23 = 0;



            for( VAR_23 = 0; VAR_23 < 4; VAR_23++ ) {

                int VAR_23 = dir == 0 ? VAR_0 : VAR_23;

                int VAR_23 = dir == 0 ? VAR_23    : VAR_0;

                int VAR_23= 8 + 4 + VAR_23 + 8*VAR_23;

                int VAR_23= VAR_23 - (dir ? 8:1);



                if (sl->non_zero_count_cache[VAR_23] |

                    sl->non_zero_count_cache[VAR_23]) {

                    bS[VAR_23] = 2;

                }

                else if(!VAR_23)

                {

                    bS[VAR_23] = check_mv(sl, VAR_23, VAR_23, mvy_limit);

                }

            }



            if(bS[0]+bS[1]+bS[2]+bS[3] == 0)

                continue;

        }



        

         Do not use s->qscale as luma quantizer because it has not the same

         value in IPCM macroblocks.

        VAR_22 = h->cur_pic.qscale_table[mb_xy];

        ff_tlog(h->avctx, "filter mb:%d/%d dir:%d VAR_0:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, VAR_0, VAR_22, linesize, uvlinesize);

        if( dir == 0 ) {

            filter_mb_edgev( &img_y[4*VAR_0 << h->pixel_shift], linesize, bS, VAR_22, a, b, h, 0 );

            if (chroma) {

                if (VAR_2) {

                    filter_mb_edgev ( &img_cb[4*VAR_0 << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                    filter_mb_edgev ( &img_cr[4*VAR_0 << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                } else if( (VAR_0&1) == 0 ) {

                    filter_mb_edgecv( &img_cb[2*VAR_0 << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                    filter_mb_edgecv( &img_cr[2*VAR_0 << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                }

            }

        } else {

            if (VAR_3) {

                if (VAR_22)

                    filter_mb_edgeh(&img_y[4*VAR_0*linesize], linesize, bS, VAR_22, a, b, h, 0);

                if (chroma) {

                    filter_mb_edgech(&img_cb[4*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                    filter_mb_edgech(&img_cr[4*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                }

            } else {

                filter_mb_edgeh(&img_y[4*VAR_0*linesize], linesize, bS, VAR_22, a, b, h, 0);

                if (chroma) {

                    if (VAR_2) {

                        filter_mb_edgeh (&img_cb[4*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                        filter_mb_edgeh (&img_cr[4*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                    } else if ((VAR_0&1) == 0) {

                        filter_mb_edgech(&img_cb[2*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0);

                        filter_mb_edgech(&img_cr[2*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0);

                    }

                }

            }

        }

    }

}

static av_always_inline void FUNC_0(const H264Context *h, H264SliceContext *sl,
int mb_x, int mb_y,
uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,
unsigned int linesize, unsigned int uvlinesize,
int mb_xy, int mb_type, int mvy_limit,
int first_vertical_edge_done, int a, int b,
int chroma, int dir)
{ int VAR_0; int VAR_1[2]; int VAR_2 = CHROMA444(h); int VAR_3 = CHROMA422(h); const int VAR_4 = dir == 0 ? mb_xy -1 : sl->top_mb_xy; const int VAR_5 = dir == 0 ? sl->left_type[LTOP] : sl->top_type; static const uint8_t VAR_6[2][8]={{0,3,3,3,1,1,1,1}, {0,3,1,1,3,3,3,3}}; const int VAR_7 = VAR_6[dir][(mb_type>>3)&7]; const int VAR_8 = VAR_7== 3 && !(sl->cbp&15) ? 1 : 4; const int VAR_9 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)); if(VAR_5 && !first_vertical_edge_done){ if (FRAME_MBAFF(h) && (dir == 1) && ((mb_y&1) == 0)
&& IS_INTERLACED(VAR_5&~mb_type)
) { unsigned int VAR_10   = 2 *   linesize; unsigned int VAR_11 = 2 * uvlinesize; int VAR_12 = mb_xy - 2 * h->mb_stride; int VAR_13; for(VAR_13=0; VAR_13<2; VAR_13++, VAR_12 += h->mb_stride){ DECLARE_ALIGNED(8, int16_t, bS)[4]; int VAR_22; if (IS_INTRA(mb_type | h->cur_pic.mb_type[VAR_12])) { AV_WN64A(bS, 0x0003000300030003ULL); } else { if (!CABAC(h) && IS_8x8DCT(h->cur_pic.mb_type[VAR_12])) { bS[0]= 1+((h->cbp_table[VAR_12] & 0x4000) || sl->non_zero_count_cache[scan8[0]+0]); bS[1]= 1+((h->cbp_table[VAR_12] & 0x4000) || sl->non_zero_count_cache[scan8[0]+1]); bS[2]= 1+((h->cbp_table[VAR_12] & 0x8000) || sl->non_zero_count_cache[scan8[0]+2]); bS[3]= 1+((h->cbp_table[VAR_12] & 0x8000) || sl->non_zero_count_cache[scan8[0]+3]); }else{ const uint8_t *VAR_15 = h->non_zero_count[VAR_12] + 3*4; int VAR_23; for( VAR_23 = 0; VAR_23 < 4; VAR_23++ ) { bS[VAR_23] = 1 + !!(sl->non_zero_count_cache[scan8[0]+VAR_23] | VAR_15[VAR_23]); } } } Do not use s->qscale as luma quantizer because it has not the same
value in IPCM macroblocks.
VAR_22 = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[VAR_12] + 1) >> 1; ff_tlog(h->avctx, "filter mb:%d/%d dir:%d VAR_0:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, VAR_0, VAR_22, VAR_10, VAR_11); { int VAR_23; for (VAR_23 = 0; VAR_23 < 4; VAR_23++) ff_tlog(h->avctx, " bS[%d]:%d", VAR_23, bS[VAR_23]); ff_tlog(h->avctx, "\n"); } filter_mb_edgeh( &img_y[VAR_13*linesize], VAR_10, bS, VAR_22, a, b, h, 0 ); VAR_1[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[VAR_12]) + 1) >> 1; VAR_1[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[VAR_12]) + 1) >> 1; if (chroma) { if (VAR_2) { filter_mb_edgeh (&img_cb[VAR_13*uvlinesize], VAR_11, bS, VAR_1[0], a, b, h, 0); filter_mb_edgeh (&img_cr[VAR_13*uvlinesize], VAR_11, bS, VAR_1[1], a, b, h, 0); } else { filter_mb_edgech(&img_cb[VAR_13*uvlinesize], VAR_11, bS, VAR_1[0], a, b, h, 0); filter_mb_edgech(&img_cr[VAR_13*uvlinesize], VAR_11, bS, VAR_1[1], a, b, h, 0); } } } }else{ DECLARE_ALIGNED(8, int16_t, bS)[4]; int VAR_22; if( IS_INTRA(mb_type|VAR_5)) { AV_WN64A(bS, 0x0003000300030003ULL); if (   (!IS_INTERLACED(mb_type|VAR_5))
|| ((FRAME_MBAFF(h) || (h->picture_structure != PICT_FRAME)) && (dir == 0))
)
AV_WN64A(bS, 0x0004000400040004ULL); } else { int VAR_23; int VAR_23; if( dir && FRAME_MBAFF(h) && IS_INTERLACED(mb_type ^ VAR_5)) { AV_WN64A(bS, 0x0001000100010001ULL); VAR_23 = 1; } else if( VAR_9 && ((VAR_5 & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) { int VAR_23= 8 + 4; int VAR_23= VAR_23 - (dir ? 8:1); bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, 8 + 4, VAR_23, mvy_limit); VAR_23 = 1; } else
VAR_23 = 0; for( VAR_23 = 0; VAR_23 < 4; VAR_23++ ) { int VAR_23 = dir == 0 ? 0 : VAR_23; int VAR_23 = dir == 0 ? VAR_23    : 0; int VAR_23= 8 + 4 + VAR_23 + 8*VAR_23; int VAR_23= VAR_23 - (dir ? 8:1); if (sl->non_zero_count_cache[VAR_23] |
sl->non_zero_count_cache[VAR_23]) { bS[VAR_23] = 2; } else if(!VAR_23)
{ bS[VAR_23] = check_mv(sl, VAR_23, VAR_23, mvy_limit); } } } Do not use s->qscale as luma quantizer because it has not the same
value in IPCM macroblocks.
if(bS[0]+bS[1]+bS[2]+bS[3]){ VAR_22 = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[VAR_4] + 1) >> 1; ff_tlog(h->avctx, "filter mb:%d/%d dir:%d VAR_0:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, VAR_0, VAR_22, linesize, uvlinesize); VAR_1[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[VAR_4]) + 1) >> 1; VAR_1[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[VAR_4]) + 1) >> 1; if( dir == 0 ) { filter_mb_edgev( &img_y[0], linesize, bS, VAR_22, a, b, h, 1 ); if (chroma) { if (VAR_2) { filter_mb_edgev ( &img_cb[0], uvlinesize, bS, VAR_1[0], a, b, h, 1); filter_mb_edgev ( &img_cr[0], uvlinesize, bS, VAR_1[1], a, b, h, 1); } else { filter_mb_edgecv( &img_cb[0], uvlinesize, bS, VAR_1[0], a, b, h, 1); filter_mb_edgecv( &img_cr[0], uvlinesize, bS, VAR_1[1], a, b, h, 1); } } } else { filter_mb_edgeh( &img_y[0], linesize, bS, VAR_22, a, b, h, 1 ); if (chroma) { if (VAR_2) { filter_mb_edgeh ( &img_cb[0], uvlinesize, bS, VAR_1[0], a, b, h, 1); filter_mb_edgeh ( &img_cr[0], uvlinesize, bS, VAR_1[1], a, b, h, 1); } else { filter_mb_edgech( &img_cb[0], uvlinesize, bS, VAR_1[0], a, b, h, 1); filter_mb_edgech( &img_cr[0], uvlinesize, bS, VAR_1[1], a, b, h, 1); } } } } } } for( VAR_0 = 1; VAR_0 < VAR_8; VAR_0++ ) { DECLARE_ALIGNED(8, int16_t, bS)[4]; int VAR_22; const int VAR_22 = !IS_8x8DCT(mb_type & (VAR_0<<24));  (VAR_0&1) && IS_8x8DCT(mb_type) if (!VAR_22 && (!VAR_3 || dir == 0))
continue; if( IS_INTRA(mb_type)) { AV_WN64A(bS, 0x0003000300030003ULL); } else { int VAR_23; int VAR_23; if( VAR_0 & VAR_7 ) { AV_ZERO64(bS); VAR_23 = 1; } else if( VAR_9 ) { int VAR_23= 8 + 4 + VAR_0 * (dir ? 8:1); int VAR_23= VAR_23 - (dir ? 8:1); bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, VAR_23, VAR_23, mvy_limit); VAR_23 = 1; } else
VAR_23 = 0; for( VAR_23 = 0; VAR_23 < 4; VAR_23++ ) { int VAR_23 = dir == 0 ? VAR_0 : VAR_23; int VAR_23 = dir == 0 ? VAR_23    : VAR_0; int VAR_23= 8 + 4 + VAR_23 + 8*VAR_23; int VAR_23= VAR_23 - (dir ? 8:1); if (sl->non_zero_count_cache[VAR_23] |
sl->non_zero_count_cache[VAR_23]) { bS[VAR_23] = 2; } else if(!VAR_23)
{ bS[VAR_23] = check_mv(sl, VAR_23, VAR_23, mvy_limit); } } if(bS[0]+bS[1]+bS[2]+bS[3] == 0)
continue; } Do not use s->qscale as luma quantizer because it has not the same
value in IPCM macroblocks.
VAR_22 = h->cur_pic.qscale_table[mb_xy]; ff_tlog(h->avctx, "filter mb:%d/%d dir:%d VAR_0:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, VAR_0, VAR_22, linesize, uvlinesize); if( dir == 0 ) { filter_mb_edgev( &img_y[4*VAR_0 << h->pixel_shift], linesize, bS, VAR_22, a, b, h, 0 ); if (chroma) { if (VAR_2) { filter_mb_edgev ( &img_cb[4*VAR_0 << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgev ( &img_cr[4*VAR_0 << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } else if( (VAR_0&1) == 0 ) { filter_mb_edgecv( &img_cb[2*VAR_0 << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgecv( &img_cr[2*VAR_0 << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } } } else { if (VAR_3) { if (VAR_22)
filter_mb_edgeh(&img_y[4*VAR_0*linesize], linesize, bS, VAR_22, a, b, h, 0); if (chroma) { filter_mb_edgech(&img_cb[4*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgech(&img_cr[4*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } } else { filter_mb_edgeh(&img_y[4*VAR_0*linesize], linesize, bS, VAR_22, a, b, h, 0); if (chroma) { if (VAR_2) { filter_mb_edgeh (&img_cb[4*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgeh (&img_cr[4*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } else if ((VAR_0&1) == 0) { filter_mb_edgech(&img_cb[2*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgech(&img_cr[2*VAR_0*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } } } } } }