Mercurial > libavcodec.hg
comparison simple_idct.c @ 1064:b32afefe7d33 libavcodec
* UINTX -> uintx_t INTX -> intx_t
author | kabi |
---|---|
date | Tue, 11 Feb 2003 16:35:48 +0000 |
parents | fb6cbb8a04a3 |
children | 1e39f273ecd6 |
comparison
equal
deleted
inserted
replaced
1063:fdeac9642346 | 1064:b32afefe7d33 |
---|---|
170 row[5] = (a2 - b2) >> ROW_SHIFT; | 170 row[5] = (a2 - b2) >> ROW_SHIFT; |
171 row[3] = (a3 + b3) >> ROW_SHIFT; | 171 row[3] = (a3 + b3) >> ROW_SHIFT; |
172 row[4] = (a3 - b3) >> ROW_SHIFT; | 172 row[4] = (a3 - b3) >> ROW_SHIFT; |
173 } | 173 } |
174 | 174 |
175 static inline void idctSparseColPut (UINT8 *dest, int line_size, | 175 static inline void idctSparseColPut (uint8_t *dest, int line_size, |
176 DCTELEM * col) | 176 DCTELEM * col) |
177 { | 177 { |
178 int a0, a1, a2, a3, b0, b1, b2, b3; | 178 int a0, a1, a2, a3, b0, b1, b2, b3; |
179 UINT8 *cm = cropTbl + MAX_NEG_CROP; | 179 uint8_t *cm = cropTbl + MAX_NEG_CROP; |
180 | 180 |
181 /* XXX: I did that only to give same values as previous code */ | 181 /* XXX: I did that only to give same values as previous code */ |
182 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); | 182 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); |
183 a1 = a0; | 183 a1 = a0; |
184 a2 = a0; | 184 a2 = a0; |
242 dest[0] = cm[(a1 - b1) >> COL_SHIFT]; | 242 dest[0] = cm[(a1 - b1) >> COL_SHIFT]; |
243 dest += line_size; | 243 dest += line_size; |
244 dest[0] = cm[(a0 - b0) >> COL_SHIFT]; | 244 dest[0] = cm[(a0 - b0) >> COL_SHIFT]; |
245 } | 245 } |
246 | 246 |
247 static inline void idctSparseColAdd (UINT8 *dest, int line_size, | 247 static inline void idctSparseColAdd (uint8_t *dest, int line_size, |
248 DCTELEM * col) | 248 DCTELEM * col) |
249 { | 249 { |
250 int a0, a1, a2, a3, b0, b1, b2, b3; | 250 int a0, a1, a2, a3, b0, b1, b2, b3; |
251 UINT8 *cm = cropTbl + MAX_NEG_CROP; | 251 uint8_t *cm = cropTbl + MAX_NEG_CROP; |
252 | 252 |
253 /* XXX: I did that only to give same values as previous code */ | 253 /* XXX: I did that only to give same values as previous code */ |
254 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); | 254 a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); |
255 a1 = a0; | 255 a1 = a0; |
256 a2 = a0; | 256 a2 = a0; |
377 col[40] = ((a2 - b2) >> COL_SHIFT); | 377 col[40] = ((a2 - b2) >> COL_SHIFT); |
378 col[48] = ((a1 - b1) >> COL_SHIFT); | 378 col[48] = ((a1 - b1) >> COL_SHIFT); |
379 col[56] = ((a0 - b0) >> COL_SHIFT); | 379 col[56] = ((a0 - b0) >> COL_SHIFT); |
380 } | 380 } |
381 | 381 |
382 void simple_idct_put(UINT8 *dest, int line_size, DCTELEM *block) | 382 void simple_idct_put(uint8_t *dest, int line_size, DCTELEM *block) |
383 { | 383 { |
384 int i; | 384 int i; |
385 for(i=0; i<8; i++) | 385 for(i=0; i<8; i++) |
386 idctRowCondDC(block + i*8); | 386 idctRowCondDC(block + i*8); |
387 | 387 |
388 for(i=0; i<8; i++) | 388 for(i=0; i<8; i++) |
389 idctSparseColPut(dest + i, line_size, block + i); | 389 idctSparseColPut(dest + i, line_size, block + i); |
390 } | 390 } |
391 | 391 |
392 void simple_idct_add(UINT8 *dest, int line_size, DCTELEM *block) | 392 void simple_idct_add(uint8_t *dest, int line_size, DCTELEM *block) |
393 { | 393 { |
394 int i; | 394 int i; |
395 for(i=0; i<8; i++) | 395 for(i=0; i<8; i++) |
396 idctRowCondDC(block + i*8); | 396 idctRowCondDC(block + i*8); |
397 | 397 |
418 | 418 |
419 /* row idct is multiple by 16 * sqrt(2.0), col idct4 is normalized, | 419 /* row idct is multiple by 16 * sqrt(2.0), col idct4 is normalized, |
420 and the butterfly must be multiplied by 0.5 * sqrt(2.0) */ | 420 and the butterfly must be multiplied by 0.5 * sqrt(2.0) */ |
421 #define C_SHIFT (4+1+12) | 421 #define C_SHIFT (4+1+12) |
422 | 422 |
423 static inline void idct4col(UINT8 *dest, int line_size, const DCTELEM *col) | 423 static inline void idct4col(uint8_t *dest, int line_size, const DCTELEM *col) |
424 { | 424 { |
425 int c0, c1, c2, c3, a0, a1, a2, a3; | 425 int c0, c1, c2, c3, a0, a1, a2, a3; |
426 const UINT8 *cm = cropTbl + MAX_NEG_CROP; | 426 const uint8_t *cm = cropTbl + MAX_NEG_CROP; |
427 | 427 |
428 a0 = col[8*0]; | 428 a0 = col[8*0]; |
429 a1 = col[8*2]; | 429 a1 = col[8*2]; |
430 a2 = col[8*4]; | 430 a2 = col[8*4]; |
431 a3 = col[8*6]; | 431 a3 = col[8*6]; |
455 to the pixels before clamping to avoid systematic error | 455 to the pixels before clamping to avoid systematic error |
456 (1024*sqrt(2)) offset would be needed otherwise. */ | 456 (1024*sqrt(2)) offset would be needed otherwise. */ |
457 /* XXX: I think a 1.0/sqrt(2) normalization should be needed to | 457 /* XXX: I think a 1.0/sqrt(2) normalization should be needed to |
458 compensate the extra butterfly stage - I don't have the full DV | 458 compensate the extra butterfly stage - I don't have the full DV |
459 specification */ | 459 specification */ |
460 void simple_idct248_put(UINT8 *dest, int line_size, DCTELEM *block) | 460 void simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block) |
461 { | 461 { |
462 int i; | 462 int i; |
463 DCTELEM *ptr; | 463 DCTELEM *ptr; |
464 | 464 |
465 /* butterfly */ | 465 /* butterfly */ |
498 #define C_FIX(x) ((int)((x) * 1.414213562 * (1 << CN_SHIFT) + 0.5)) | 498 #define C_FIX(x) ((int)((x) * 1.414213562 * (1 << CN_SHIFT) + 0.5)) |
499 #define C1 C_FIX(0.6532814824) | 499 #define C1 C_FIX(0.6532814824) |
500 #define C2 C_FIX(0.2705980501) | 500 #define C2 C_FIX(0.2705980501) |
501 #define C3 C_FIX(0.5) | 501 #define C3 C_FIX(0.5) |
502 #define C_SHIFT (4+1+12) | 502 #define C_SHIFT (4+1+12) |
503 static inline void idct4col_add(UINT8 *dest, int line_size, const DCTELEM *col) | 503 static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col) |
504 { | 504 { |
505 int c0, c1, c2, c3, a0, a1, a2, a3; | 505 int c0, c1, c2, c3, a0, a1, a2, a3; |
506 const UINT8 *cm = cropTbl + MAX_NEG_CROP; | 506 const uint8_t *cm = cropTbl + MAX_NEG_CROP; |
507 | 507 |
508 a0 = col[8*0]; | 508 a0 = col[8*0]; |
509 a1 = col[8*1]; | 509 a1 = col[8*1]; |
510 a2 = col[8*2]; | 510 a2 = col[8*2]; |
511 a3 = col[8*3]; | 511 a3 = col[8*3]; |
529 #define R3 R_FIX(0.5) | 529 #define R3 R_FIX(0.5) |
530 #define R_SHIFT 11 | 530 #define R_SHIFT 11 |
531 static inline void idct4row(DCTELEM *row) | 531 static inline void idct4row(DCTELEM *row) |
532 { | 532 { |
533 int c0, c1, c2, c3, a0, a1, a2, a3; | 533 int c0, c1, c2, c3, a0, a1, a2, a3; |
534 const UINT8 *cm = cropTbl + MAX_NEG_CROP; | 534 //const uint8_t *cm = cropTbl + MAX_NEG_CROP; |
535 | 535 |
536 a0 = row[0]; | 536 a0 = row[0]; |
537 a1 = row[1]; | 537 a1 = row[1]; |
538 a2 = row[2]; | 538 a2 = row[2]; |
539 a3 = row[3]; | 539 a3 = row[3]; |
545 row[1]= (c2 + c3) >> R_SHIFT; | 545 row[1]= (c2 + c3) >> R_SHIFT; |
546 row[2]= (c2 - c3) >> R_SHIFT; | 546 row[2]= (c2 - c3) >> R_SHIFT; |
547 row[3]= (c0 - c1) >> R_SHIFT; | 547 row[3]= (c0 - c1) >> R_SHIFT; |
548 } | 548 } |
549 | 549 |
550 void simple_idct84_add(UINT8 *dest, int line_size, DCTELEM *block) | 550 void simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block) |
551 { | 551 { |
552 int i; | 552 int i; |
553 | 553 |
554 /* IDCT8 on each line */ | 554 /* IDCT8 on each line */ |
555 for(i=0; i<4; i++) { | 555 for(i=0; i<4; i++) { |
560 for(i=0;i<8;i++) { | 560 for(i=0;i<8;i++) { |
561 idct4col_add(dest + i, line_size, block + i); | 561 idct4col_add(dest + i, line_size, block + i); |
562 } | 562 } |
563 } | 563 } |
564 | 564 |
565 void simple_idct48_add(UINT8 *dest, int line_size, DCTELEM *block) | 565 void simple_idct48_add(uint8_t *dest, int line_size, DCTELEM *block) |
566 { | 566 { |
567 int i; | 567 int i; |
568 | 568 |
569 /* IDCT4 on each line */ | 569 /* IDCT4 on each line */ |
570 for(i=0; i<8; i++) { | 570 for(i=0; i<8; i++) { |