changeset 347:3c5266cda02d libavcodec

fixing msmpeg4v3 dc-scale for quantizers 24-31
author michaelni
date Tue, 30 Apr 2002 01:29:29 +0000
parents c2f789fe4945
children ae9e9af0b627
files h263dec.c mpegvideo.c mpegvideo.h msmpeg4.c
diffstat 4 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/h263dec.c	Sat Apr 27 14:10:47 2002 +0000
+++ b/h263dec.c	Tue Apr 30 01:29:29 2002 +0000
@@ -199,9 +199,7 @@
 #endif
             //fprintf(stderr,"\nFrame: %d\tMB: %d",avctx->frame_number, (s->mb_y * s->mb_width) + s->mb_x);
             /* DCT & quantize */
-            if (s->h263_msmpeg4) {
-                msmpeg4_dc_scale(s);
-            } else if (s->h263_pred) {
+            if (s->h263_pred && s->msmpeg4_version!=2) {
                 h263_dc_scale(s);
             } else {
                 /* default quantization values */
--- a/mpegvideo.c	Sat Apr 27 14:10:47 2002 +0000
+++ b/mpegvideo.c	Tue Apr 30 01:29:29 2002 +0000
@@ -1439,9 +1439,7 @@
             }
 #endif
     /* DCT & quantize */
-    if (s->h263_msmpeg4) {
-        msmpeg4_dc_scale(s);
-    } else if (s->h263_pred) {
+    if (s->h263_pred && s->msmpeg4_version!=2) {
         h263_dc_scale(s);
     } else {
         /* default quantization values */
--- a/mpegvideo.h	Sat Apr 27 14:10:47 2002 +0000
+++ b/mpegvideo.h	Tue Apr 30 01:29:29 2002 +0000
@@ -490,7 +490,6 @@
 void msmpeg4_encode_mb(MpegEncContext * s, 
                        DCTELEM block[6][64],
                        int motion_x, int motion_y);
-void msmpeg4_dc_scale(MpegEncContext * s);
 int msmpeg4_decode_picture_header(MpegEncContext * s);
 int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
 int msmpeg4_decode_mb(MpegEncContext *s, 
--- a/msmpeg4.c	Sat Apr 27 14:10:47 2002 +0000
+++ b/msmpeg4.c	Tue Apr 30 01:29:29 2002 +0000
@@ -411,7 +411,8 @@
 }
 
 
-/* strongly inspirated from MPEG4, but not exactly the same ! */
+#if 0
+/* identical to mpeg4 for msmpeg4v3 but not msmpeg4v2 */
 void msmpeg4_dc_scale(MpegEncContext * s)
 {
     if (s->qscale < 5 || s->msmpeg4_version==2){
@@ -420,11 +421,15 @@
     }else if (s->qscale < 9){
         s->y_dc_scale = 2 * s->qscale;
         s->c_dc_scale = (s->qscale + 13)>>1;
-    }else{
+    }else if(s->qscale < 25){
         s->y_dc_scale = s->qscale + 8;
         s->c_dc_scale = (s->qscale + 13)>>1;
+    }else{
+        s->y_dc_scale = 2 * s->qscale - 16;
+        s->c_dc_scale = s->qscale - 6;
     }
 }
+#endif
 
 /* dir = 0: left, dir = 1: top prediction */
 static int msmpeg4_pred_dc(MpegEncContext * s, int n,