diff options
-rw-r--r-- | libavcodec/dv.c | 16 | ||||
-rw-r--r-- | tests/ffmpeg.regression.ref | 6 | ||||
-rw-r--r-- | tests/libav.regression.ref | 4 | ||||
-rw-r--r-- | tests/rotozoom.regression.ref | 6 |
4 files changed, 23 insertions, 9 deletions
diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 9c31570..d4661fe 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -658,8 +658,22 @@ static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, const uint8_t* zigzag_scan, const int *weight, int bias) { int i, area; + /* We offer two different methods for class number assignment: the + method suggested in SMPTE 314M Table 22, and an improved + method. The SMPTE method is very conservative; it assigns class + 3 (i.e. severe quantization) to any block where the largest AC + component is greater than 36. ffmpeg's DV encoder tracks AC bit + consumption precisely, so there is no need to bias most blocks + towards strongly lossy compression. Instead, we assign class 2 + to most blocks, and use class 3 only when strictly necessary + (for blocks whose largest AC component exceeds 255). */ + +#if 0 /* SMPTE spec method */ static const int classes[] = {12, 24, 36, 0xffff}; - int max=12; +#else /* improved ffmpeg method */ + static const int classes[] = {-1, -1, 255, 0xffff}; +#endif + int max=classes[0]; int prev=0; bi->mb[0] = blk[0]; diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index 5684a57..d061327 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -133,10 +133,10 @@ stddev: 23.20 PSNR:20.81 bytes:7602176 3533710 ./data/a-snow53.avi 799d3db687f6cdd7a837ec156efc171f *./data/out.yuv stddev: 0.00 PSNR:99.99 bytes:7602176 -1352049a75c5c94f21a360888b12d75d *./data/a-dv.dv +85529d9838c5a8aef041445fa8ef3c85 *./data/a-dv.dv 7200000 ./data/a-dv.dv -2c7f745a74c1ac25566b6c49ed619649 *./data/out.yuv -stddev: 9.00 PSNR:29.03 bytes:7602176 +c2082cd8adf417c4ebc32654e446cba1 *./data/out.yuv +stddev: 8.86 PSNR:29.17 bytes:7602176 bd0db310a36ad94bcd4448abe0a88368 *./data/a-svq1.mov 1379827 ./data/a-svq1.mov bbff871d1475e1eee4231a08e075de2c *./data/out.yuv diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref index eafc4f3..d907369 100644 --- a/tests/libav.regression.ref +++ b/tests/libav.regression.ref @@ -28,9 +28,9 @@ e4ed8d635d867e2f5980fd9c73c9cf3d *./data/b-libav.mov 8bf16d40a2ec19fa36b124a928e47e23 *./data/b-libav.nut 332358 ./data/b-libav.nut ./data/b-libav.nut CRC=0xccab3a27 -afe55c5769eb6d1873d4106b3ef2b691 *./data/b-libav.dv +2cc647904d3cca01703f36056b9d3f42 *./data/b-libav.dv 3600000 ./data/b-libav.dv -./data/b-libav.dv CRC=0x9292dedd +./data/b-libav.dv CRC=0xa6b8b635 9a9da315747599f7718cc9a9a09c21ff *./data/b-libav.pbm 317075 ./data/b-libav.pbm ./data/b-libav.pbm CRC=0xb92906cb diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index 5f9639e..cac3a07 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -133,10 +133,10 @@ stddev: 10.94 PSNR:27.34 bytes:7602176 2725570 ./data/a-snow53.avi dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv stddev: 0.00 PSNR:99.99 bytes:7602176 -3d7def2ed47e896790945c3c634fa4e8 *./data/a-dv.dv +6568326ee439099e8a0e1680336ed351 *./data/a-dv.dv 7200000 ./data/a-dv.dv -49020c3651d58137db4dc56ca13ff26d *./data/out.yuv -stddev: 3.06 PSNR:38.40 bytes:7602176 +bb69dda7a84a5b166434e28e1243d3d1 *./data/out.yuv +stddev: 2.99 PSNR:38.59 bytes:7602176 5b02b6ae7ffa257a66ae9857a992fdfe *./data/a-svq1.mov 769527 ./data/a-svq1.mov 44777d1ddbccd0ef7f8d08394465670c *./data/out.yuv |