changeset 1651:ccf7c96a630f libavcodec

h263 modified quantization fix
author michael
date Wed, 03 Dec 2003 16:07:41 +0000
parents bdade3baabfc
children 834922115010
files h263dec.c mpegvideo.c msmpeg4.c wmv2.c
diffstat 4 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/h263dec.c	Wed Dec 03 04:22:15 2003 +0000
+++ b/h263dec.c	Wed Dec 03 16:07:41 2003 +0000
@@ -147,7 +147,7 @@
     s->resync_mb_y= s->mb_y;
 
     s->y_dc_scale= s->y_dc_scale_table[ s->qscale ];
-    s->c_dc_scale= s->c_dc_scale_table[ s->qscale ];
+    s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ];
     
     if(s->partitioned_frame){
         const int qscale= s->qscale;
--- a/mpegvideo.c	Wed Dec 03 04:22:15 2003 +0000
+++ b/mpegvideo.c	Wed Dec 03 16:07:41 2003 +0000
@@ -2651,9 +2651,9 @@
 
 /* put block[] to dest[] */
 static inline void put_dct(MpegEncContext *s, 
-                           DCTELEM *block, int i, uint8_t *dest, int line_size)
+                           DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
 {
-    s->dct_unquantize(s, block, i, s->qscale);
+    s->dct_unquantize(s, block, i, qscale);
     s->dsp.idct_put (dest, line_size, block);
 }
 
@@ -2857,14 +2857,14 @@
         } else {
             /* dct only in intra block */
             if(s->encoding || !(s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO)){
-                put_dct(s, block[0], 0, dest_y, dct_linesize);
-                put_dct(s, block[1], 1, dest_y + 8, dct_linesize);
-                put_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize);
-                put_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize);
+                put_dct(s, block[0], 0, dest_y, dct_linesize, s->qscale);
+                put_dct(s, block[1], 1, dest_y + 8, dct_linesize, s->qscale);
+                put_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize, s->qscale);
+                put_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize, s->qscale);
 
                 if(!(s->flags&CODEC_FLAG_GRAY)){
-                    put_dct(s, block[4], 4, dest_cb, uvlinesize);
-                    put_dct(s, block[5], 5, dest_cr, uvlinesize);
+                    put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
+                    put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
                 }
             }else{
                 s->dsp.idct_put(dest_y                 , dct_linesize, block[0]);
--- a/msmpeg4.c	Wed Dec 03 04:22:15 2003 +0000
+++ b/msmpeg4.c	Wed Dec 03 16:07:41 2003 +0000
@@ -1258,7 +1258,7 @@
     if(!had_i) return -1;
 }
 #endif
-    s->qscale = get_bits(&s->gb, 5);
+    s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
     if(s->qscale==0){
         av_log(s->avctx, AV_LOG_ERROR, "invalid qscale\n");
         return -1;
--- a/wmv2.c	Wed Dec 03 04:22:15 2003 +0000
+++ b/wmv2.c	Wed Dec 03 16:07:41 2003 +0000
@@ -368,7 +368,7 @@
         code = get_bits(&s->gb, 7);
         av_log(s->avctx, AV_LOG_ERROR, "I7:%X/\n", code);
     }
-    s->qscale = get_bits(&s->gb, 5);
+    s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
     if(s->qscale < 0)
        return -1;