diff 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
line wrap: on
line diff
--- a/dv.c	Mon Feb 27 12:17:20 2006 +0000
+++ b/dv.c	Tue Feb 28 02:54:48 2006 +0000
@@ -658,8 +658,22 @@
                                               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];