static void init_dequant8_coeff_table(H264Context *h){

    int i,q,x;

    const int transpose = (h->h264dsp.h264_idct8_add != ff_h264_idct8_add_c); //FIXME ugly

    h->dequant8_coeff[0] = h->dequant8_buffer[0];

    h->dequant8_coeff[1] = h->dequant8_buffer[1];



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

        if(i && !memcmp(h->pps.scaling_matrix8[0], h->pps.scaling_matrix8[1], 64*sizeof(uint8_t))){

            h->dequant8_coeff[1] = h->dequant8_buffer[0];

            break;

        }



        for(q=0; q<52; q++){

            int shift = div6[q];

            int idx = rem6[q];

            for(x=0; x<64; x++)

                h->dequant8_coeff[i][q][transpose ? (x>>3)|((x&7)<<3) : x] =

                    ((uint32_t)dequant8_coeff_init[idx][ dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] *

                    h->pps.scaling_matrix8[i][x]) << shift;

        }

    }

}

static void init_dequant8_coeff_table(H264Context *h){

    int i,q,x;

    const int transpose = (h->h264dsp.h264_idct8_add != ff_h264_idct8_add_c); 

    h->dequant8_coeff[0] = h->dequant8_buffer[0];

    h->dequant8_coeff[1] = h->dequant8_buffer[1];



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

        if(i && !memcmp(h->pps.scaling_matrix8[0], h->pps.scaling_matrix8[1], 64*sizeof(uint8_t))){

            h->dequant8_coeff[1] = h->dequant8_buffer[0];

            break;

        }



        for(q=0; q<52; q++){

            int shift = div6[q];

            int idx = rem6[q];

            for(x=0; x<64; x++)

                h->dequant8_coeff[i][q][transpose ? (x>>3)|((x&7)<<3) : x] =

                    ((uint32_t)dequant8_coeff_init[idx][ dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] *

                    h->pps.scaling_matrix8[i][x]) << shift;

        }

    }

}

static void FUNC_0(H264Context *VAR_0){

    int VAR_1,VAR_2,VAR_3;

    const int VAR_4 = (VAR_0->h264dsp.h264_idct8_add != ff_h264_idct8_add_c); 

    VAR_0->dequant8_coeff[0] = VAR_0->dequant8_buffer[0];

    VAR_0->dequant8_coeff[1] = VAR_0->dequant8_buffer[1];



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

        if(VAR_1 && !memcmp(VAR_0->pps.scaling_matrix8[0], VAR_0->pps.scaling_matrix8[1], 64*sizeof(uint8_t))){

            VAR_0->dequant8_coeff[1] = VAR_0->dequant8_buffer[0];

            break;

        }



        for(VAR_2=0; VAR_2<52; VAR_2++){

            int VAR_5 = div6[VAR_2];

            int VAR_6 = rem6[VAR_2];

            for(VAR_3=0; VAR_3<64; VAR_3++)

                VAR_0->dequant8_coeff[VAR_1][VAR_2][VAR_4 ? (VAR_3>>3)|((VAR_3&7)<<3) : VAR_3] =

                    ((uint32_t)dequant8_coeff_init[VAR_6][ dequant8_coeff_init_scan[((VAR_3>>1)&12) | (VAR_3&3)] ] *

                    VAR_0->pps.scaling_matrix8[VAR_1][VAR_3]) << VAR_5;

        }

    }

}

static void FUNC_0(H264Context *VAR_0){ int VAR_1,VAR_2,VAR_3; const int VAR_4 = (VAR_0->h264dsp.h264_idct8_add != ff_h264_idct8_add_c); VAR_0->dequant8_coeff[0] = VAR_0->dequant8_buffer[0]; VAR_0->dequant8_coeff[1] = VAR_0->dequant8_buffer[1]; for(VAR_1=0; VAR_1<2; VAR_1++ ){ if(VAR_1 && !memcmp(VAR_0->pps.scaling_matrix8[0], VAR_0->pps.scaling_matrix8[1], 64*sizeof(uint8_t))){ VAR_0->dequant8_coeff[1] = VAR_0->dequant8_buffer[0]; break; } for(VAR_2=0; VAR_2<52; VAR_2++){ int VAR_5 = div6[VAR_2]; int VAR_6 = rem6[VAR_2]; for(VAR_3=0; VAR_3<64; VAR_3++) VAR_0->dequant8_coeff[VAR_1][VAR_2][VAR_4 ? (VAR_3>>3)|((VAR_3&7)<<3) : VAR_3] =
((uint32_t)dequant8_coeff_init[VAR_6][ dequant8_coeff_init_scan[((VAR_3>>1)&12) | (VAR_3&3)] ] *
VAR_0->pps.scaling_matrix8[VAR_1][VAR_3]) << VAR_5; } } }