Revision 19fb234e libavcodec/h264.c

View differences:

libavcodec/h264.c
246 246
    return 0;
247 247
}
248 248

  
249
/**
250
 * IDCT transforms the 16 dc values and dequantizes them.
251
 * @param qp quantization parameter
252
 */
253
static void h264_luma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul){
254
#define stride 16
255
    int i;
256
    int temp[16]; //FIXME check if this is a good idea
257
    static const int x_offset[4]={0, 1*stride, 4* stride,  5*stride};
258
    static const int y_offset[4]={0, 2*stride, 8* stride, 10*stride};
259

  
260
//memset(block, 64, 2*256);
261
//return;
262
    for(i=0; i<4; i++){
263
        const int offset= y_offset[i];
264
        const int z0= block[offset+stride*0] + block[offset+stride*4];
265
        const int z1= block[offset+stride*0] - block[offset+stride*4];
266
        const int z2= block[offset+stride*1] - block[offset+stride*5];
267
        const int z3= block[offset+stride*1] + block[offset+stride*5];
268

  
269
        temp[4*i+0]= z0+z3;
270
        temp[4*i+1]= z1+z2;
271
        temp[4*i+2]= z1-z2;
272
        temp[4*i+3]= z0-z3;
273
    }
274

  
275
    for(i=0; i<4; i++){
276
        const int offset= x_offset[i];
277
        const int z0= temp[4*0+i] + temp[4*2+i];
278
        const int z1= temp[4*0+i] - temp[4*2+i];
279
        const int z2= temp[4*1+i] - temp[4*3+i];
280
        const int z3= temp[4*1+i] + temp[4*3+i];
281

  
282
        block[stride*0 +offset]= ((((z0 + z3)*qmul + 128 ) >> 8)); //FIXME think about merging this into decode_residual
283
        block[stride*2 +offset]= ((((z1 + z2)*qmul + 128 ) >> 8));
284
        block[stride*8 +offset]= ((((z1 - z2)*qmul + 128 ) >> 8));
285
        block[stride*10+offset]= ((((z0 - z3)*qmul + 128 ) >> 8));
286
    }
287
}
288

  
289 249
#if 0
290 250
/**
291 251
 * DCT transforms the 16 dc values.
......
1245 1205
                h->hpc.pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize);
1246 1206
                if(is_h264){
1247 1207
                    if(!transform_bypass)
1248
                        h264_luma_dc_dequant_idct_c(h->mb, s->qscale, h->dequant4_coeff[0][s->qscale][0]);
1208
                        h->h264dsp.h264_luma_dc_dequant_idct(h->mb, h->mb_luma_dc, h->dequant4_coeff[0][s->qscale][0]);
1209
                    else{
1210
                        static const uint8_t dc_mapping[16] = { 0*16, 1*16, 4*16, 5*16, 2*16, 3*16, 6*16, 7*16,
1211
                                                                8*16, 9*16,12*16,13*16,10*16,11*16,14*16,15*16};
1212
                        for(i = 0; i < 16; i++)
1213
                            h->mb[dc_mapping[i]] = h->mb_luma_dc[i];
1214
                    }
1249 1215
                }else
1250
                    ff_svq3_luma_dc_dequant_idct_c(h->mb, s->qscale);
1216
                    ff_svq3_luma_dc_dequant_idct_c(h->mb, h->mb_luma_dc, s->qscale);
1251 1217
            }
1252 1218
            if(h->deblocking_filter)
1253 1219
                xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, simple);

Also available in: Unified diff