Mercurial > libavcodec.hg
comparison dv.c @ 3152:28a087ad41d1 libavcodec
Assign class 2 to most macroblocks by default, instead of a more conservative
method defined by SMPTE
Patch by Dan Maas
author | romansh |
---|---|
date | Tue, 28 Feb 2006 02:54:48 +0000 |
parents | c4b6411b4b53 |
children | 312b86bc4202 |
comparison
equal
deleted
inserted
replaced
3151:27e1b9632715 | 3152:28a087ad41d1 |
---|---|
656 | 656 |
657 static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, | 657 static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, |
658 const uint8_t* zigzag_scan, const int *weight, int bias) | 658 const uint8_t* zigzag_scan, const int *weight, int bias) |
659 { | 659 { |
660 int i, area; | 660 int i, area; |
661 /* We offer two different methods for class number assignment: the | |
662 method suggested in SMPTE 314M Table 22, and an improved | |
663 method. The SMPTE method is very conservative; it assigns class | |
664 3 (i.e. severe quantization) to any block where the largest AC | |
665 component is greater than 36. ffmpeg's DV encoder tracks AC bit | |
666 consumption precisely, so there is no need to bias most blocks | |
667 towards strongly lossy compression. Instead, we assign class 2 | |
668 to most blocks, and use class 3 only when strictly necessary | |
669 (for blocks whose largest AC component exceeds 255). */ | |
670 | |
671 #if 0 /* SMPTE spec method */ | |
661 static const int classes[] = {12, 24, 36, 0xffff}; | 672 static const int classes[] = {12, 24, 36, 0xffff}; |
662 int max=12; | 673 #else /* improved ffmpeg method */ |
674 static const int classes[] = {-1, -1, 255, 0xffff}; | |
675 #endif | |
676 int max=classes[0]; | |
663 int prev=0; | 677 int prev=0; |
664 | 678 |
665 bi->mb[0] = blk[0]; | 679 bi->mb[0] = blk[0]; |
666 | 680 |
667 for (area = 0; area < 4; area++) { | 681 for (area = 0; area < 4; area++) { |