changeset 20638:d56ce5b63c86

fix quantizer export for interlaced video
author henry
date Sat, 04 Nov 2006 07:05:21 +0000
parents 092cb80a8ba4
children 2a2f3db46103
files libmpeg2/slice.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpeg2/slice.c	Fri Nov 03 23:11:00 2006 +0000
+++ b/libmpeg2/slice.c	Sat Nov 04 07:05:21 2006 +0000
@@ -1569,9 +1569,18 @@
 
 #define NEXT_MACROBLOCK							\
 do {									\
-    if(decoder->quant_store)                                            \
+    if(decoder->quant_store) {                                          \
+       if (decoder->picture_structure == TOP_FIELD)                     \
+        decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \
+                    +(decoder->offset>>4)] = decoder->quantizer_scale;  \
+       else if (decoder->picture_structure == BOTTOM_FIELD)             \
+        decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \
+	            + decoder->quant_stride                             \
+                    +(decoder->offset>>4)] = decoder->quantizer_scale;  \
+       else                                                             \
         decoder->quant_store[decoder->quant_stride*(decoder->v_offset>>4) \
                     +(decoder->offset>>4)] = decoder->quantizer_scale;  \
+    }                                                                   \
     decoder->offset += 16;						\
     if (decoder->offset == decoder->width) {				\
 	do { /* just so we can use the break statement */		\