static int bit8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2,

                    ptrdiff_t stride, int h)

{

    const uint8_t *scantable = s->intra_scantable.permutated;

    LOCAL_ALIGNED_16(int16_t, temp, [64]);

    int i, last, run, bits, level, start_i;

    const int esc_length = s->ac_esc_length;

    uint8_t *length, *last_length;



    av_assert2(h == 8);



    s->pdsp.diff_pixels(temp, src1, src2, stride);



    s->block_last_index[0 /* FIXME */] =

    last                               =

        s->fast_dct_quantize(s, temp, 0 /* FIXME */, s->qscale, &i);



    bits = 0;



    if (s->mb_intra) {

        start_i     = 1;

        length      = s->intra_ac_vlc_length;

        last_length = s->intra_ac_vlc_last_length;

        bits       += s->luma_dc_vlc_length[temp[0] + 256]; // FIXME: chroma

    } else {

        start_i     = 0;

        length      = s->inter_ac_vlc_length;

        last_length = s->inter_ac_vlc_last_length;

    }



    if (last >= start_i) {

        run = 0;

        for (i = start_i; i < last; i++) {

            int j = scantable[i];

            level = temp[j];



            if (level) {

                level += 64;

                if ((level & (~127)) == 0)

                    bits += length[UNI_AC_ENC_INDEX(run, level)];

                else

                    bits += esc_length;

                run = 0;

            } else

                run++;

        }

        i = scantable[last];



        level = temp[i] + 64;



        av_assert2(level - 64);



        if ((level & (~127)) == 0)

            bits += last_length[UNI_AC_ENC_INDEX(run, level)];

        else

            bits += esc_length;

    }



    return bits;

}

static int bit8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2,

                    ptrdiff_t stride, int h)

{

    const uint8_t *scantable = s->intra_scantable.permutated;

    LOCAL_ALIGNED_16(int16_t, temp, [64]);

    int i, last, run, bits, level, start_i;

    const int esc_length = s->ac_esc_length;

    uint8_t *length, *last_length;



    av_assert2(h == 8);



    s->pdsp.diff_pixels(temp, src1, src2, stride);



    s->block_last_index[0 ] =

    last                               =

        s->fast_dct_quantize(s, temp, 0 , s->qscale, &i);



    bits = 0;



    if (s->mb_intra) {

        start_i     = 1;

        length      = s->intra_ac_vlc_length;

        last_length = s->intra_ac_vlc_last_length;

        bits       += s->luma_dc_vlc_length[temp[0] + 256]; 

    } else {

        start_i     = 0;

        length      = s->inter_ac_vlc_length;

        last_length = s->inter_ac_vlc_last_length;

    }



    if (last >= start_i) {

        run = 0;

        for (i = start_i; i < last; i++) {

            int j = scantable[i];

            level = temp[j];



            if (level) {

                level += 64;

                if ((level & (~127)) == 0)

                    bits += length[UNI_AC_ENC_INDEX(run, level)];

                else

                    bits += esc_length;

                run = 0;

            } else

                run++;

        }

        i = scantable[last];



        level = temp[i] + 64;



        av_assert2(level - 64);



        if ((level & (~127)) == 0)

            bits += last_length[UNI_AC_ENC_INDEX(run, level)];

        else

            bits += esc_length;

    }



    return bits;

}

    s->pdsp.diff_pixels(temp, src1, src2, stride);     s->pdsp.diff_pixels(temp, src1, src2, stride);     s->pdsp.diff_pixels(temp, src1, src2, stride);     s->pdsp.diff_pixels(temp, src1, src2, stride);
static int FUNC_0(MpegEncContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2,

                    ptrdiff_t VAR_3, int VAR_4)

{

    const uint8_t *VAR_5 = VAR_0->intra_scantable.permutated;

    LOCAL_ALIGNED_16(int16_t, temp, [64]);

    int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;

    const int VAR_12 = VAR_0->ac_esc_length;

    uint8_t *length, *last_length;



    av_assert2(VAR_4 == 8);



    VAR_0->pdsp.diff_pixels(temp, VAR_1, VAR_2, VAR_3);



    VAR_0->block_last_index[0 ] =

    VAR_7                               =

        VAR_0->fast_dct_quantize(VAR_0, temp, 0 , VAR_0->qscale, &VAR_6);



    VAR_9 = 0;



    if (VAR_0->mb_intra) {

        VAR_11     = 1;

        length      = VAR_0->intra_ac_vlc_length;

        last_length = VAR_0->intra_ac_vlc_last_length;

        VAR_9       += VAR_0->luma_dc_vlc_length[temp[0] + 256]; 

    } else {

        VAR_11     = 0;

        length      = VAR_0->inter_ac_vlc_length;

        last_length = VAR_0->inter_ac_vlc_last_length;

    }



    if (VAR_7 >= VAR_11) {

        VAR_8 = 0;

        for (VAR_6 = VAR_11; VAR_6 < VAR_7; VAR_6++) {

            int VAR_13 = VAR_5[VAR_6];

            VAR_10 = temp[VAR_13];



            if (VAR_10) {

                VAR_10 += 64;

                if ((VAR_10 & (~127)) == 0)

                    VAR_9 += length[UNI_AC_ENC_INDEX(VAR_8, VAR_10)];

                else

                    VAR_9 += VAR_12;

                VAR_8 = 0;

            } else

                VAR_8++;

        }

        VAR_6 = VAR_5[VAR_7];



        VAR_10 = temp[VAR_6] + 64;



        av_assert2(VAR_10 - 64);



        if ((VAR_10 & (~127)) == 0)

            VAR_9 += last_length[UNI_AC_ENC_INDEX(VAR_8, VAR_10)];

        else

            VAR_9 += VAR_12;

    }



    return VAR_9;

}

static int FUNC_0(MpegEncContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2,
ptrdiff_t VAR_3, int VAR_4)
{ const uint8_t *VAR_5 = VAR_0->intra_scantable.permutated; LOCAL_ALIGNED_16(int16_t, temp, [64]); int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; const int VAR_12 = VAR_0->ac_esc_length; uint8_t *length, *last_length; av_assert2(VAR_4 == 8); VAR_0->pdsp.diff_pixels(temp, VAR_1, VAR_2, VAR_3); VAR_0->block_last_index[0 ] =
VAR_7                               =
VAR_0->fast_dct_quantize(VAR_0, temp, 0 , VAR_0->qscale, &VAR_6); VAR_9 = 0; if (VAR_0->mb_intra) { VAR_11     = 1; length      = VAR_0->intra_ac_vlc_length; last_length = VAR_0->intra_ac_vlc_last_length; VAR_9       += VAR_0->luma_dc_vlc_length[temp[0] + 256]; } else { VAR_11     = 0; length      = VAR_0->inter_ac_vlc_length; last_length = VAR_0->inter_ac_vlc_last_length; } if (VAR_7 >= VAR_11) { VAR_8 = 0; for (VAR_6 = VAR_11; VAR_6 < VAR_7; VAR_6++) { int VAR_13 = VAR_5[VAR_6]; VAR_10 = temp[VAR_13]; if (VAR_10) { VAR_10 += 64; if ((VAR_10 & (~127)) == 0)
VAR_9 += length[UNI_AC_ENC_INDEX(VAR_8, VAR_10)]; else
VAR_9 += VAR_12; VAR_8 = 0; } else VAR_8++; } VAR_6 = VAR_5[VAR_7]; VAR_10 = temp[VAR_6] + 64; av_assert2(VAR_10 - 64); if ((VAR_10 & (~127)) == 0)
VAR_9 += last_length[UNI_AC_ENC_INDEX(VAR_8, VAR_10)]; else
VAR_9 += VAR_12; } return VAR_9; }