static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], uint16_t matrix1[64], int intra)

{

    int i;



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

        int j = s->dsp.idct_permutation[ff_zigzag_direct[i]];

        int v = get_bits(&s->gb, 8);

        if (v == 0) {

            av_log(s->avctx, AV_LOG_ERROR, "matrix damaged\n");

            return -1;

        }

        if (intra && i == 0 && v != 8) {

            av_log(s->avctx, AV_LOG_ERROR, "intra matrix specifies invalid DC quantizer %d, ignoring\n", v);

            v = 8; // needed by pink.mpg / issue1046

        }

        matrix0[j] = v;

        if (matrix1)

            matrix1[j] = v;

    }

    return 0;

}

static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], uint16_t matrix1[64], int intra)

{

    int i;



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

        int j = s->dsp.idct_permutation[ff_zigzag_direct[i]];

        int v = get_bits(&s->gb, 8);

        if (v == 0) {

            av_log(s->avctx, AV_LOG_ERROR, "matrix damaged\n");

            return -1;

        }

        if (intra && i == 0 && v != 8) {

            av_log(s->avctx, AV_LOG_ERROR, "intra matrix specifies invalid DC quantizer %d, ignoring\n", v);

            v = 8; 

        }

        matrix0[j] = v;

        if (matrix1)

            matrix1[j] = v;

    }

    return 0;

}

static int FUNC_0(MpegEncContext *VAR_0, uint16_t VAR_1[64], uint16_t VAR_2[64], int VAR_3)

{

    int VAR_4;



    for (VAR_4 = 0; VAR_4 < 64; VAR_4++) {

        int VAR_5 = VAR_0->dsp.idct_permutation[ff_zigzag_direct[VAR_4]];

        int VAR_6 = get_bits(&VAR_0->gb, 8);

        if (VAR_6 == 0) {

            av_log(VAR_0->avctx, AV_LOG_ERROR, "matrix damaged\n");

            return -1;

        }

        if (VAR_3 && VAR_4 == 0 && VAR_6 != 8) {

            av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_3 matrix specifies invalid DC quantizer %d, ignoring\n", VAR_6);

            VAR_6 = 8; 

        }

        VAR_1[VAR_5] = VAR_6;

        if (VAR_2)

            VAR_2[VAR_5] = VAR_6;

    }

    return 0;

}

static int FUNC_0(MpegEncContext *VAR_0, uint16_t VAR_1[64], uint16_t VAR_2[64], int VAR_3)
{ int VAR_4; for (VAR_4 = 0; VAR_4 < 64; VAR_4++) { int VAR_5 = VAR_0->dsp.idct_permutation[ff_zigzag_direct[VAR_4]]; int VAR_6 = get_bits(&VAR_0->gb, 8); if (VAR_6 == 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "matrix damaged\n"); return -1; } if (VAR_3 && VAR_4 == 0 && VAR_6 != 8) { av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_3 matrix specifies invalid DC quantizer %d, ignoring\n", VAR_6); VAR_6 = 8; } VAR_1[VAR_5] = VAR_6; if (VAR_2)
VAR_2[VAR_5] = VAR_6; } return 0; }