int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,

                              int quant_offset)

{

    MpegEncContext *const s = w->s;

    int mb_xy;

    assert(s);

    w->use_quant_matrix = get_bits1(&s->gb);



    w->dquant = dquant;

    w->quant  = dquant >> 1;

    w->qsum   = quant_offset;



    w->divide_quant_dc_luma = ((1 << 16) + (w->quant >> 1)) / w->quant;

    if (w->quant < 5) {

        w->quant_dc_chroma        = w->quant;

        w->divide_quant_dc_chroma = w->divide_quant_dc_luma;

    } else {

        w->quant_dc_chroma        = w->quant + ((w->quant + 3) >> 3);

        w->divide_quant_dc_chroma = ((1 << 16) + (w->quant_dc_chroma >> 1)) / w->quant_dc_chroma;

    }

    x8_reset_vlc_tables(w);



    for (s->mb_y = 0; s->mb_y < s->mb_height * 2; s->mb_y++) {

        x8_init_block_index(w, s->current_picture.f, s->mb_y);

        mb_xy = (s->mb_y >> 1) * s->mb_stride;



        for (s->mb_x = 0; s->mb_x < s->mb_width * 2; s->mb_x++) {

            x8_get_prediction(w);

            if (x8_setup_spatial_predictor(w, 0))

                goto error;

            if (x8_decode_intra_mb(w, 0))

                goto error;



            if (s->mb_x & s->mb_y & 1) {

                x8_get_prediction_chroma(w);



                /* when setting up chroma, no vlc is read,

                 * so no error condition can be reached */

                x8_setup_spatial_predictor(w, 1);

                if (x8_decode_intra_mb(w, 1))

                    goto error;



                x8_setup_spatial_predictor(w, 2);

                if (x8_decode_intra_mb(w, 2))

                    goto error;



                w->dest[1] += 8;

                w->dest[2] += 8;



                /* emulate MB info in the relevant tables */

                s->mbskip_table[mb_xy]                 = 0;

                s->mbintra_table[mb_xy]                = 1;

                s->current_picture.qscale_table[mb_xy] = w->quant;

                mb_xy++;

            }

            w->dest[0] += 8;

        }

        if (s->mb_y & 1)

            ff_mpeg_draw_horiz_band(s, (s->mb_y - 1) * 8, 16);

    }



error:

    return 0;

}

int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,

                              int quant_offset)

{

    MpegEncContext *const s = w->s;

    int mb_xy;

    assert(s);

    w->use_quant_matrix = get_bits1(&s->gb);



    w->dquant = dquant;

    w->quant  = dquant >> 1;

    w->qsum   = quant_offset;



    w->divide_quant_dc_luma = ((1 << 16) + (w->quant >> 1)) / w->quant;

    if (w->quant < 5) {

        w->quant_dc_chroma        = w->quant;

        w->divide_quant_dc_chroma = w->divide_quant_dc_luma;

    } else {

        w->quant_dc_chroma        = w->quant + ((w->quant + 3) >> 3);

        w->divide_quant_dc_chroma = ((1 << 16) + (w->quant_dc_chroma >> 1)) / w->quant_dc_chroma;

    }

    x8_reset_vlc_tables(w);



    for (s->mb_y = 0; s->mb_y < s->mb_height * 2; s->mb_y++) {

        x8_init_block_index(w, s->current_picture.f, s->mb_y);

        mb_xy = (s->mb_y >> 1) * s->mb_stride;



        for (s->mb_x = 0; s->mb_x < s->mb_width * 2; s->mb_x++) {

            x8_get_prediction(w);

            if (x8_setup_spatial_predictor(w, 0))

                goto error;

            if (x8_decode_intra_mb(w, 0))

                goto error;



            if (s->mb_x & s->mb_y & 1) {

                x8_get_prediction_chroma(w);



                



                x8_setup_spatial_predictor(w, 1);

                if (x8_decode_intra_mb(w, 1))

                    goto error;



                x8_setup_spatial_predictor(w, 2);

                if (x8_decode_intra_mb(w, 2))

                    goto error;



                w->dest[1] += 8;

                w->dest[2] += 8;



                

                s->mbskip_table[mb_xy]                 = 0;

                s->mbintra_table[mb_xy]                = 1;

                s->current_picture.qscale_table[mb_xy] = w->quant;

                mb_xy++;

            }

            w->dest[0] += 8;

        }

        if (s->mb_y & 1)

            ff_mpeg_draw_horiz_band(s, (s->mb_y - 1) * 8, 16);

    }



error:

    return 0;

}

int FUNC_0(IntraX8Context *const VAR_0, int VAR_1,

                              int VAR_2)

{

    MpegEncContext *const s = VAR_0->s;

    int VAR_3;

    assert(s);

    VAR_0->use_quant_matrix = get_bits1(&s->gb);



    VAR_0->VAR_1 = VAR_1;

    VAR_0->quant  = VAR_1 >> 1;

    VAR_0->qsum   = VAR_2;



    VAR_0->divide_quant_dc_luma = ((1 << 16) + (VAR_0->quant >> 1)) / VAR_0->quant;

    if (VAR_0->quant < 5) {

        VAR_0->quant_dc_chroma        = VAR_0->quant;

        VAR_0->divide_quant_dc_chroma = VAR_0->divide_quant_dc_luma;

    } else {

        VAR_0->quant_dc_chroma        = VAR_0->quant + ((VAR_0->quant + 3) >> 3);

        VAR_0->divide_quant_dc_chroma = ((1 << 16) + (VAR_0->quant_dc_chroma >> 1)) / VAR_0->quant_dc_chroma;

    }

    x8_reset_vlc_tables(VAR_0);



    for (s->mb_y = 0; s->mb_y < s->mb_height * 2; s->mb_y++) {

        x8_init_block_index(VAR_0, s->current_picture.f, s->mb_y);

        VAR_3 = (s->mb_y >> 1) * s->mb_stride;



        for (s->mb_x = 0; s->mb_x < s->mb_width * 2; s->mb_x++) {

            x8_get_prediction(VAR_0);

            if (x8_setup_spatial_predictor(VAR_0, 0))

                goto error;

            if (x8_decode_intra_mb(VAR_0, 0))

                goto error;



            if (s->mb_x & s->mb_y & 1) {

                x8_get_prediction_chroma(VAR_0);



                



                x8_setup_spatial_predictor(VAR_0, 1);

                if (x8_decode_intra_mb(VAR_0, 1))

                    goto error;



                x8_setup_spatial_predictor(VAR_0, 2);

                if (x8_decode_intra_mb(VAR_0, 2))

                    goto error;



                VAR_0->dest[1] += 8;

                VAR_0->dest[2] += 8;



                

                s->mbskip_table[VAR_3]                 = 0;

                s->mbintra_table[VAR_3]                = 1;

                s->current_picture.qscale_table[VAR_3] = VAR_0->quant;

                VAR_3++;

            }

            VAR_0->dest[0] += 8;

        }

        if (s->mb_y & 1)

            ff_mpeg_draw_horiz_band(s, (s->mb_y - 1) * 8, 16);

    }



error:

    return 0;

}

int FUNC_0(IntraX8Context *const VAR_0, int VAR_1,
int VAR_2)
{ MpegEncContext *const s = VAR_0->s; int VAR_3; assert(s); VAR_0->use_quant_matrix = get_bits1(&s->gb); VAR_0->VAR_1 = VAR_1; VAR_0->quant  = VAR_1 >> 1; VAR_0->qsum   = VAR_2; VAR_0->divide_quant_dc_luma = ((1 << 16) + (VAR_0->quant >> 1)) / VAR_0->quant; if (VAR_0->quant < 5) { VAR_0->quant_dc_chroma        = VAR_0->quant; VAR_0->divide_quant_dc_chroma = VAR_0->divide_quant_dc_luma; } else { VAR_0->quant_dc_chroma        = VAR_0->quant + ((VAR_0->quant + 3) >> 3); VAR_0->divide_quant_dc_chroma = ((1 << 16) + (VAR_0->quant_dc_chroma >> 1)) / VAR_0->quant_dc_chroma; } x8_reset_vlc_tables(VAR_0); for (s->mb_y = 0; s->mb_y < s->mb_height * 2; s->mb_y++) { x8_init_block_index(VAR_0, s->current_picture.f, s->mb_y); VAR_3 = (s->mb_y >> 1) * s->mb_stride; for (s->mb_x = 0; s->mb_x < s->mb_width * 2; s->mb_x++) { x8_get_prediction(VAR_0); if (x8_setup_spatial_predictor(VAR_0, 0))
goto error; if (x8_decode_intra_mb(VAR_0, 0))
goto error; if (s->mb_x & s->mb_y & 1) { x8_get_prediction_chroma(VAR_0); x8_setup_spatial_predictor(VAR_0, 1); if (x8_decode_intra_mb(VAR_0, 1))
goto error; x8_setup_spatial_predictor(VAR_0, 2); if (x8_decode_intra_mb(VAR_0, 2))
goto error; VAR_0->dest[1] += 8; VAR_0->dest[2] += 8; s->mbskip_table[VAR_3]                 = 0; s->mbintra_table[VAR_3]                = 1; s->current_picture.qscale_table[VAR_3] = VAR_0->quant; VAR_3++; } VAR_0->dest[0] += 8; } if (s->mb_y & 1)
ff_mpeg_draw_horiz_band(s, (s->mb_y - 1) * 8, 16); } error:
return 0; }