diff libmpeg2/slice.c @ 31329:60709ef498be

Reinstate libmpeg2 hook to export quantization The quant value is used by the postproc filters to fine tune their application
author lu_zero
date Mon, 14 Jun 2010 08:55:32 +0000
parents a51baa308479
children
line wrap: on
line diff
--- a/libmpeg2/slice.c	Sun Jun 13 22:38:15 2010 +0000
+++ b/libmpeg2/slice.c	Mon Jun 14 08:55:32 2010 +0000
@@ -20,6 +20,10 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
+ * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
+ * $Id$
  */
 
 #include "config.h"
@@ -142,6 +146,7 @@
 
     quantizer_scale_code = UBITS (bit_buf, 5);
     DUMPBITS (bit_buf, bits, 5);
+    decoder->quantizer_scale = decoder->quantizer_scales[quantizer_scale_code];
 
     decoder->quantizer_matrix[0] =
 	decoder->quantizer_prescale[0][quantizer_scale_code];
@@ -1564,6 +1569,24 @@
 
 #define NEXT_MACROBLOCK							\
 do {									\
+    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 */		\