Mercurial > libavcodec.hg
comparison simple_idct.c @ 936:caa77cd960c0 libavcodec
qpel encoding
4mv+b frames encoding finally fixed
chroma ME
5 comparission functions for ME
b frame encoding speedup
wmv2 codec (unfinished)
user specified diamond size for EPZS
| author | michaelni |
|---|---|
| date | Fri, 27 Dec 2002 23:51:46 +0000 |
| parents | 2f7da29ede37 |
| children | fb6cbb8a04a3 |
comparison
equal
deleted
inserted
replaced
| 935:c9bbd35064b6 | 936:caa77cd960c0 |
|---|---|
| 471 for(i=0;i<8;i++) { | 471 for(i=0;i<8;i++) { |
| 472 idct4col(dest + i, 2 * line_size, block + i); | 472 idct4col(dest + i, 2 * line_size, block + i); |
| 473 idct4col(dest + line_size + i, 2 * line_size, block + 8 + i); | 473 idct4col(dest + line_size + i, 2 * line_size, block + 8 + i); |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 | |
| 477 /* 8x4 & 4x8 WMV2 IDCT */ | |
| 478 #undef CN_SHIFT | |
| 479 #undef C_SHIFT | |
| 480 #undef C_FIX | |
| 481 #undef C1 | |
| 482 #undef C2 | |
| 483 #define CN_SHIFT 12 | |
| 484 #define C_FIX(x) ((int)((x) * 1.414213562 * (1 << CN_SHIFT) + 0.5)) | |
| 485 #define C1 C_FIX(0.6532814824) | |
| 486 #define C2 C_FIX(0.2705980501) | |
| 487 #define C3 C_FIX(0.5) | |
| 488 #define C_SHIFT (4+1+12) | |
| 489 static inline void idct4col_add(UINT8 *dest, int line_size, const INT16 *col) | |
| 490 { | |
| 491 int c0, c1, c2, c3, a0, a1, a2, a3; | |
| 492 const UINT8 *cm = cropTbl + MAX_NEG_CROP; | |
| 493 | |
| 494 a0 = col[8*0]; | |
| 495 a1 = col[8*1]; | |
| 496 a2 = col[8*2]; | |
| 497 a3 = col[8*3]; | |
| 498 c0 = (a0 + a2)*C3 + (1 << (C_SHIFT - 1)); | |
| 499 c2 = (a0 - a2)*C3 + (1 << (C_SHIFT - 1)); | |
| 500 c1 = a1 * C1 + a3 * C2; | |
| 501 c3 = a1 * C2 - a3 * C1; | |
| 502 dest[0] = cm[dest[0] + ((c0 + c1) >> C_SHIFT)]; | |
| 503 dest += line_size; | |
| 504 dest[0] = cm[dest[0] + ((c2 + c3) >> C_SHIFT)]; | |
| 505 dest += line_size; | |
| 506 dest[0] = cm[dest[0] + ((c2 - c3) >> C_SHIFT)]; | |
| 507 dest += line_size; | |
| 508 dest[0] = cm[dest[0] + ((c0 - c1) >> C_SHIFT)]; | |
| 509 } | |
| 510 | |
| 511 #define RN_SHIFT 15 | |
| 512 #define R_FIX(x) ((int)((x) * 1.414213562 * (1 << RN_SHIFT) + 0.5)) | |
| 513 #define R1 R_FIX(0.6532814824) | |
| 514 #define R2 R_FIX(0.2705980501) | |
| 515 #define R3 R_FIX(0.5) | |
| 516 #define R_SHIFT 11 | |
| 517 static inline void idct4row(INT16 *row) | |
| 518 { | |
| 519 int c0, c1, c2, c3, a0, a1, a2, a3; | |
| 520 const UINT8 *cm = cropTbl + MAX_NEG_CROP; | |
| 521 | |
| 522 a0 = row[0]; | |
| 523 a1 = row[1]; | |
| 524 a2 = row[2]; | |
| 525 a3 = row[3]; | |
| 526 c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1)); | |
| 527 c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1)); | |
| 528 c1 = a1 * R1 + a3 * R2; | |
| 529 c3 = a1 * R2 - a3 * R1; | |
| 530 row[0]= (c0 + c1) >> R_SHIFT; | |
| 531 row[1]= (c2 + c3) >> R_SHIFT; | |
| 532 row[2]= (c2 - c3) >> R_SHIFT; | |
| 533 row[3]= (c0 - c1) >> R_SHIFT; | |
| 534 } | |
| 535 | |
| 536 void simple_idct84_add(UINT8 *dest, int line_size, INT16 *block) | |
| 537 { | |
| 538 int i; | |
| 539 | |
| 540 /* IDCT8 on each line */ | |
| 541 for(i=0; i<4; i++) { | |
| 542 idctRowCondDC(block + i*8); | |
| 543 } | |
| 544 | |
| 545 /* IDCT4 and store */ | |
| 546 for(i=0;i<8;i++) { | |
| 547 idct4col_add(dest + i, line_size, block + i); | |
| 548 } | |
| 549 } | |
| 550 | |
| 551 void simple_idct48_add(UINT8 *dest, int line_size, INT16 *block) | |
| 552 { | |
| 553 int i; | |
| 554 | |
| 555 /* IDCT4 on each line */ | |
| 556 for(i=0; i<8; i++) { | |
| 557 idct4row(block + i*8); | |
| 558 } | |
| 559 | |
| 560 /* IDCT8 and store */ | |
| 561 for(i=0; i<4; i++){ | |
| 562 idctSparseColAdd(dest + i, line_size, block + i); | |
| 563 } | |
| 564 } | |
| 565 |
