Revision 2a1f431d libavcodec/h264.c

View differences:

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

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

  
261
    for(i=0; i<4; i++){
262
        const int offset= y_offset[i];
263
        const int z0= block[offset+stride*0] + block[offset+stride*4];
264
        const int z1= block[offset+stride*0] - block[offset+stride*4];
265
        const int z2= block[offset+stride*1] - block[offset+stride*5];
266
        const int z3= block[offset+stride*1] + block[offset+stride*5];
267

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

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

  
281
        block[stride*0 +offset]= (z0 + z3)>>1;
282
        block[stride*2 +offset]= (z1 + z2)>>1;
283
        block[stride*8 +offset]= (z1 - z2)>>1;
284
        block[stride*10+offset]= (z0 - z3)>>1;
285
    }
286
}
287
#endif
288

  
289
#undef xStride
290
#undef stride
291

  
292
static void chroma_dc_dequant_idct_c(DCTELEM *block, int qmul){
293
    const int stride= 16*2;
294
    const int xStride= 16;
295
    int a,b,c,d,e;
296

  
297
    a= block[stride*0 + xStride*0];
298
    b= block[stride*0 + xStride*1];
299
    c= block[stride*1 + xStride*0];
300
    d= block[stride*1 + xStride*1];
301

  
302
    e= a-b;
303
    a= a+b;
304
    b= c-d;
305
    c= c+d;
306

  
307
    block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7;
308
    block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7;
309
    block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7;
310
    block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7;
311
}
312

  
313
#if 0
314
static void chroma_dc_dct_c(DCTELEM *block){
315
    const int stride= 16*2;
316
    const int xStride= 16;
317
    int a,b,c,d,e;
318

  
319
    a= block[stride*0 + xStride*0];
320
    b= block[stride*0 + xStride*1];
321
    c= block[stride*1 + xStride*0];
322
    d= block[stride*1 + xStride*1];
323

  
324
    e= a-b;
325
    a= a+b;
326
    b= c-d;
327
    c= c+d;
328

  
329
    block[stride*0 + xStride*0]= (a+c);
330
    block[stride*0 + xStride*1]= (e+b);
331
    block[stride*1 + xStride*0]= (a-c);
332
    block[stride*1 + xStride*1]= (e-b);
333
}
334
#endif
335

  
336 249
static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, int chroma_height, int delta, int list,
337 250
                           uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
338 251
                           int src_x_offset, int src_y_offset,
......
1283 1196
                    }
1284 1197
                }
1285 1198
            }else{
1199
                int chroma_qpu = h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0];
1200
                int chroma_qpv = h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0];
1286 1201
                if(is_h264){
1287 1202
                    if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+0] ])
1288
                        chroma_dc_dequant_idct_c(h->mb + 16*16     , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
1203
                        h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+0*16, &h->mb_chroma_dc[0], chroma_qpu );
1289 1204
                    if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+1] ])
1290
                        chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
1205
                        h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, &h->mb_chroma_dc[1], chroma_qpv );
1291 1206
                    h->h264dsp.h264_idct_add8(dest, block_offset,
1292 1207
                                              h->mb, uvlinesize,
1293 1208
                                              h->non_zero_count_cache);
1294 1209
                }else{
1295
                    chroma_dc_dequant_idct_c(h->mb + 16*16     , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
1296
                    chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
1210
                    h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+0*16, &h->mb_chroma_dc[0], chroma_qpu );
1211
                    h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, &h->mb_chroma_dc[1], chroma_qpv );
1297 1212
                    for(i=16; i<16+8; i++){
1298 1213
                        if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
1299 1214
                            uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i];

Also available in: Unified diff