changeset 12935:cda4ad0d3e70

forgotten libmpeg2 postprocessing
author henry
date Mon, 02 Aug 2004 13:09:17 +0000
parents 34394ef08238
children 662377ccbc53
files libmpcodecs/vd_libmpeg2.c libmpeg2/header.c libmpeg2/mpeg2_internal.h libmpeg2/slice.c
diffstat 4 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_libmpeg2.c	Mon Aug 02 12:38:05 2004 +0000
+++ b/libmpcodecs/vd_libmpeg2.c	Mon Aug 02 13:09:17 2004 +0000
@@ -154,6 +154,17 @@
 	    else mpi->fields &= ~MP_IMGFIELD_REPEAT_FIRST;
 	    mpi->fields |= MP_IMGFIELD_ORDERED;
 
+#ifdef MPEG12_POSTPROC
+	    if(!mpi->qscale){
+		mpi->qstride=(info->sequence->picture_width+15)>>4;
+		mpi->qscale=malloc(mpi->qstride*((info->sequence->picture_height+15)>>4));
+	    }
+	    mpeg2dec->decoder.quant_store=mpi->qscale;
+	    mpeg2dec->decoder.quant_stride=mpi->qstride;
+	    mpi->pict_type=type; // 1->I, 2->P, 3->B
+	    mpi->qscale_type= 1;
+#endif
+
 	    if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK &&
 		!(mpi->flags&MP_IMGFLAG_DIRECT)){
 		   // nice, filter/vo likes draw_callback :)
--- a/libmpeg2/header.c	Mon Aug 02 12:38:05 2004 +0000
+++ b/libmpeg2/header.c	Mon Aug 02 13:09:17 2004 +0000
@@ -803,6 +803,7 @@
 	mpeg2dec->scaled[index] = mpeg2dec->q_scale_type;
 	for (i = 0; i < 32; i++) {
 	    k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1);
+	    decoder->quantizer_scale = k;
 	    for (j = 0; j < 64; j++)
 		decoder->quantizer_prescale[index][i][j] =
 		    k * mpeg2dec->quantizer_matrix[index][j];
--- a/libmpeg2/mpeg2_internal.h	Mon Aug 02 12:38:05 2004 +0000
+++ b/libmpeg2/mpeg2_internal.h	Mon Aug 02 13:09:17 2004 +0000
@@ -144,6 +144,11 @@
     int second_field;
 
     int mpeg1;
+
+    /* for MPlayer: */
+    int quantizer_scale;
+    char* quant_store;
+    int quant_stride;
 };
 
 typedef struct {
--- a/libmpeg2/slice.c	Mon Aug 02 12:38:05 2004 +0000
+++ b/libmpeg2/slice.c	Mon Aug 02 13:09:17 2004 +0000
@@ -1564,6 +1564,9 @@
 
 #define NEXT_MACROBLOCK							\
 do {									\
+    if(decoder->quant_store)                                            \
+        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 */		\