forgotten libmpeg2 postprocessing
authorhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>
Mon, 2 Aug 2004 13:09:17 +0000 (13:09 +0000)
committerhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>
Mon, 2 Aug 2004 13:09:17 +0000 (13:09 +0000)
git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@12936 b3059339-0415-0410-9bf9-f77b7e298cf2

libmpcodecs/vd_libmpeg2.c
libmpeg2/header.c
libmpeg2/mpeg2_internal.h
libmpeg2/slice.c

index b73ea1a..be41e5f 100644 (file)
@@ -154,6 +154,17 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
            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 :)
index 8312e9a..fb22884 100644 (file)
@@ -803,6 +803,7 @@ static void prescale (mpeg2dec_t * mpeg2dec, int index)
        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];
index 850456b..1ba3300 100644 (file)
@@ -144,6 +144,11 @@ struct mpeg2_decoder_s {
     int second_field;
 
     int mpeg1;
+
+    /* for MPlayer: */
+    int quantizer_scale;
+    char* quant_store;
+    int quant_stride;
 };
 
 typedef struct {
index 15740e1..35d99b6 100644 (file)
@@ -1564,6 +1564,9 @@ do {                                                              \
 
 #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 */               \