static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const uint8_t **bs, const uint8_t *buf_end){

    int mode;

    int i;

    int8_t dc[6];



    mode = bytestream_get_byte(bs);

    if (mode>buf_end-*bs) {

        av_log(s->avctx, AV_LOG_ERROR, "truncated macroblock\n");

        return;

    }



    if (mode>12) {

        GetBitContext gb;

        init_get_bits(&gb, *bs, mode*8);

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

            tgq_decode_block(s, s->block[i], &gb);

        tgq_idct_put_mb(s, s->block, mb_x, mb_y);

    }else{

        if (mode==3) {

            memset(dc, (*bs)[0], 4);

            dc[4] = (*bs)[1];

            dc[5] = (*bs)[2];

        }else if (mode==6) {

            memcpy(dc, *bs, 6);

        }else if (mode==12) {

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

                dc[i] = (*bs)[i*2];

        }else{

            av_log(s->avctx, AV_LOG_ERROR, "unsupported mb mode %i\n", mode);

        }

        tgq_idct_put_mb_dconly(s, mb_x, mb_y, dc);

    }

    *bs += mode;

}

static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const uint8_t **bs, const uint8_t *buf_end){

    int mode;

    int i;

    int8_t dc[6];



    mode = bytestream_get_byte(bs);

    if (mode>buf_end-*bs) {

        av_log(s->avctx, AV_LOG_ERROR, "truncated macroblock\n");

        return;

    }



    if (mode>12) {

        GetBitContext gb;

        init_get_bits(&gb, *bs, mode*8);

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

            tgq_decode_block(s, s->block[i], &gb);

        tgq_idct_put_mb(s, s->block, mb_x, mb_y);

    }else{

        if (mode==3) {

            memset(dc, (*bs)[0], 4);

            dc[4] = (*bs)[1];

            dc[5] = (*bs)[2];

        }else if (mode==6) {

            memcpy(dc, *bs, 6);

        }else if (mode==12) {

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

                dc[i] = (*bs)[i*2];

        }else{

            av_log(s->avctx, AV_LOG_ERROR, "unsupported mb mode %i\n", mode);

        }

        tgq_idct_put_mb_dconly(s, mb_x, mb_y, dc);

    }

    *bs += mode;

}

static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const uint8_t **bs, const uint8_t *buf_end){     mode = bytestream_get_byte(bs);     if (mode>buf_end-*bs) {         av_log(s->avctx, AV_LOG_ERROR, "truncated macroblock\n");         init_get_bits(&gb, *bs, mode*8);             memset(dc, (*bs)[0], 4);             dc[4] = (*bs)[1];             dc[5] = (*bs)[2];             memcpy(dc, *bs, 6);             for(i=0; i<6; i++)                 dc[i] = (*bs)[i*2];     *bs += mode;
static void FUNC_0(TgqContext *VAR_0, int VAR_1, int VAR_2, const uint8_t **VAR_3, const uint8_t *VAR_4){

    int VAR_5;

    int VAR_6;

    int8_t dc[6];



    VAR_5 = bytestream_get_byte(VAR_3);

    if (VAR_5>VAR_4-*VAR_3) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "truncated macroblock\n");

        return;

    }



    if (VAR_5>12) {

        GetBitContext gb;

        init_get_bits(&gb, *VAR_3, VAR_5*8);

        for(VAR_6=0; VAR_6<6; VAR_6++)

            tgq_decode_block(VAR_0, VAR_0->block[VAR_6], &gb);

        tgq_idct_put_mb(VAR_0, VAR_0->block, VAR_2, VAR_1);

    }else{

        if (VAR_5==3) {

            memset(dc, (*VAR_3)[0], 4);

            dc[4] = (*VAR_3)[1];

            dc[5] = (*VAR_3)[2];

        }else if (VAR_5==6) {

            memcpy(dc, *VAR_3, 6);

        }else if (VAR_5==12) {

            for(VAR_6=0; VAR_6<6; VAR_6++)

                dc[VAR_6] = (*VAR_3)[VAR_6*2];

        }else{

            av_log(VAR_0->avctx, AV_LOG_ERROR, "unsupported mb VAR_5 %VAR_6\n", VAR_5);

        }

        tgq_idct_put_mb_dconly(VAR_0, VAR_2, VAR_1, dc);

    }

    *VAR_3 += VAR_5;

}

static void FUNC_0(TgqContext *VAR_0, int VAR_1, int VAR_2, const uint8_t **VAR_3, const uint8_t *VAR_4){ int VAR_5; int VAR_6; int8_t dc[6]; VAR_5 = bytestream_get_byte(VAR_3); if (VAR_5>VAR_4-*VAR_3) { av_log(VAR_0->avctx, AV_LOG_ERROR, "truncated macroblock\n"); return; } if (VAR_5>12) { GetBitContext gb; init_get_bits(&gb, *VAR_3, VAR_5*8); for(VAR_6=0; VAR_6<6; VAR_6++) tgq_decode_block(VAR_0, VAR_0->block[VAR_6], &gb); tgq_idct_put_mb(VAR_0, VAR_0->block, VAR_2, VAR_1); }else{ if (VAR_5==3) { memset(dc, (*VAR_3)[0], 4); dc[4] = (*VAR_3)[1]; dc[5] = (*VAR_3)[2]; }else if (VAR_5==6) { memcpy(dc, *VAR_3, 6); }else if (VAR_5==12) { for(VAR_6=0; VAR_6<6; VAR_6++) dc[VAR_6] = (*VAR_3)[VAR_6*2]; }else{ av_log(VAR_0->avctx, AV_LOG_ERROR, "unsupported mb VAR_5 %VAR_6\n", VAR_5); } tgq_idct_put_mb_dconly(VAR_0, VAR_2, VAR_1, dc); } *VAR_3 += VAR_5; }