diff libmpeg2/libmpeg2_changes.diff @ 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 32a214ee10e5
line wrap: on
line diff
--- a/libmpeg2/libmpeg2_changes.diff	Sun Jun 13 22:38:15 2010 +0000
+++ b/libmpeg2/libmpeg2_changes.diff	Mon Jun 14 08:55:32 2010 +0000
@@ -126,6 +126,16 @@
      if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
  	mpeg2_cpu_state_save = state_save_altivec;
  	mpeg2_cpu_state_restore = state_restore_altivec;
+--- libmpeg2/header.c	2006-06-16 20:12:26.000000000 +0200
++++ libmpeg2/header.c	2006-06-16 20:12:50.000000000 +0200
+@@ -872,6 +879,7 @@
+ 	mpeg2dec->scaled[idx] = decoder->q_scale_type;
+ 	for (i = 0; i < 32; i++) {
+ 	    k = decoder->q_scale_type ? non_linear_scale[i] : (i << 1);
++	    decoder->quantizer_scales[i] = k;
+ 	    for (j = 0; j < 64; j++)
+ 		decoder->quantizer_prescale[idx][i][j] =
+ 		    k * mpeg2dec->quantizer_matrix[idx][j];
 --- libmpeg2/idct.c	(revision 26652)
 +++ libmpeg2/idct.c	(working copy)
 @@ -235,34 +239,40 @@
@@ -333,6 +343,18 @@
 
 --- libmpeg2/mpeg2_internal.h	2006-06-16 20:12:26.000000000 +0200
 +++ libmpeg2/mpeg2_internal.h	2006-06-16 20:12:50.000000000 +0200
+@@ -152,6 +156,11 @@
+
+     /* XXX: stuff due to xine shit */
+     int8_t q_scale_type;
++
++    int quantizer_scales[32];
++    int quantizer_scale;
++    char* quant_store;
++    int quant_stride;
+ };
+
+ typedef struct {
 @@ -226,7 +238,7 @@
  };
 
@@ -342,3 +364,38 @@
      uint8_t regv[12*16];
  #endif
      int dummy;
+--- libmpeg2/slice.c	2006-06-16 20:12:26.000000000 +0200
++++ libmpeg2/slice.c	2006-06-16 20:12:50.000000000 +0200
+@@ -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 */		\