static void filter_mb_edgech( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) {

    int i, d;

    const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 );

    const int alpha = alpha_table[index_a];

    const int beta  = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )];

    const int pix_next  = stride;



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

    {

        if( bS[i] == 0 ) {

            pix += 2;

            continue;

        }



        /* 2px edge length (see deblocking_filter_edgecv) */

        for( d = 0; d < 2; d++ ) {

            const uint8_t p0 = pix[-1*pix_next];

            const uint8_t p1 = pix[-2*pix_next];

            const uint8_t q0 = pix[0];

            const uint8_t q1 = pix[1*pix_next];



            if( abs( p0 - q0 ) >= alpha ||

                abs( p1 - p0 ) >= beta ||

                abs( q1 - q0 ) >= beta ) {

                pix++;

                continue;

            }



            if( bS[i] < 4 ) {

                int tc = tc0_table[index_a][bS[i] - 1] + 1;

                int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );



                pix[-pix_next] = clip( p0 + i_delta, 0, 255 );    /* p0' */

                pix[0]         = clip( q0 - i_delta, 0, 255 );    /* q0' */

            }

            else

            {

                pix[-pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2;   /* p0' */

                pix[0]         = ( 2*q1 + q0 + p1 + 2 ) >> 2;   /* q0' */

            }

            pix++;

        }

    }

}

static void filter_mb_edgech( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) {

    int i, d;

    const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 );

    const int alpha = alpha_table[index_a];

    const int beta  = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )];

    const int pix_next  = stride;



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

    {

        if( bS[i] == 0 ) {

            pix += 2;

            continue;

        }



        

        for( d = 0; d < 2; d++ ) {

            const uint8_t p0 = pix[-1*pix_next];

            const uint8_t p1 = pix[-2*pix_next];

            const uint8_t q0 = pix[0];

            const uint8_t q1 = pix[1*pix_next];



            if( abs( p0 - q0 ) >= alpha ||

                abs( p1 - p0 ) >= beta ||

                abs( q1 - q0 ) >= beta ) {

                pix++;

                continue;

            }



            if( bS[i] < 4 ) {

                int tc = tc0_table[index_a][bS[i] - 1] + 1;

                int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );



                pix[-pix_next] = clip( p0 + i_delta, 0, 255 );    

                pix[0]         = clip( q0 - i_delta, 0, 255 );    

            }

            else

            {

                pix[-pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2;   

                pix[0]         = ( 2*q1 + q0 + p1 + 2 ) >> 2;   

            }

            pix++;

        }

    }

}

static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3[4], int VAR_4 ) {

    int VAR_5, VAR_6;

    const int VAR_7 = clip( VAR_4 + VAR_0->slice_alpha_c0_offset, 0, 51 );

    const int VAR_8 = alpha_table[VAR_7];

    const int VAR_9  = beta_table[clip( VAR_4 + VAR_0->slice_beta_offset, 0, 51 )];

    const int VAR_10  = VAR_2;



    for( VAR_5 = 0; VAR_5 < 4; VAR_5++ )

    {

        if( VAR_3[VAR_5] == 0 ) {

            VAR_1 += 2;

            continue;

        }



        

        for( VAR_6 = 0; VAR_6 < 2; VAR_6++ ) {

            const uint8_t VAR_11 = VAR_1[-1*VAR_10];

            const uint8_t VAR_12 = VAR_1[-2*VAR_10];

            const uint8_t VAR_13 = VAR_1[0];

            const uint8_t VAR_14 = VAR_1[1*VAR_10];



            if( abs( VAR_11 - VAR_13 ) >= VAR_8 ||

                abs( VAR_12 - VAR_11 ) >= VAR_9 ||

                abs( VAR_14 - VAR_13 ) >= VAR_9 ) {

                VAR_1++;

                continue;

            }



            if( VAR_3[VAR_5] < 4 ) {

                int VAR_15 = tc0_table[VAR_7][VAR_3[VAR_5] - 1] + 1;

                int VAR_16 = clip( (((VAR_13 - VAR_11 ) << 2) + (VAR_12 - VAR_14) + 4) >> 3, -VAR_15, VAR_15 );



                VAR_1[-VAR_10] = clip( VAR_11 + VAR_16, 0, 255 );    

                VAR_1[0]         = clip( VAR_13 - VAR_16, 0, 255 );    

            }

            else

            {

                VAR_1[-VAR_10] = ( 2*VAR_12 + VAR_11 + VAR_14 + 2 ) >> 2;   

                VAR_1[0]         = ( 2*VAR_14 + VAR_13 + VAR_12 + 2 ) >> 2;   

            }

            VAR_1++;

        }

    }

}

static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3[4], int VAR_4 ) { int VAR_5, VAR_6; const int VAR_7 = clip( VAR_4 + VAR_0->slice_alpha_c0_offset, 0, 51 ); const int VAR_8 = alpha_table[VAR_7]; const int VAR_9  = beta_table[clip( VAR_4 + VAR_0->slice_beta_offset, 0, 51 )]; const int VAR_10  = VAR_2; for( VAR_5 = 0; VAR_5 < 4; VAR_5++ ) { if( VAR_3[VAR_5] == 0 ) { VAR_1 += 2; continue; } for( VAR_6 = 0; VAR_6 < 2; VAR_6++ ) { const uint8_t VAR_11 = VAR_1[-1*VAR_10]; const uint8_t VAR_12 = VAR_1[-2*VAR_10]; const uint8_t VAR_13 = VAR_1[0]; const uint8_t VAR_14 = VAR_1[1*VAR_10]; if( abs( VAR_11 - VAR_13 ) >= VAR_8 ||
abs( VAR_12 - VAR_11 ) >= VAR_9 ||
abs( VAR_14 - VAR_13 ) >= VAR_9 ) { VAR_1++; continue; } if( VAR_3[VAR_5] < 4 ) { int VAR_15 = tc0_table[VAR_7][VAR_3[VAR_5] - 1] + 1; int VAR_16 = clip( (((VAR_13 - VAR_11 ) << 2) + (VAR_12 - VAR_14) + 4) >> 3, -VAR_15, VAR_15 ); VAR_1[-VAR_10] = clip( VAR_11 + VAR_16, 0, 255 ); VAR_1[0]         = clip( VAR_13 - VAR_16, 0, 255 ); } else
{ VAR_1[-VAR_10] = ( 2*VAR_12 + VAR_11 + VAR_14 + 2 ) >> 2; VAR_1[0]         = ( 2*VAR_14 + VAR_13 + VAR_12 + 2 ) >> 2; } VAR_1++; } } }