[SCM] libav/experimental: fixing encoding at high QPs (was broken after the dct accuracy increase due to too small inverse table)

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 15:33:12 UTC 2013


The following commit has been merged in the experimental branch:
commit 1a684b3d53c19756d76872ba745e00209548b0db
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Mon Sep 2 16:56:29 2002 +0000

    fixing encoding at high QPs (was broken after the dct accuracy increase due to too small inverse table)
    
    Originally committed as revision 901 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/i386/mpegvideo_mmx_template.c b/libavcodec/i386/mpegvideo_mmx_template.c
index 185baaa..27229ba 100644
--- a/libavcodec/i386/mpegvideo_mmx_template.c
+++ b/libavcodec/i386/mpegvideo_mmx_template.c
@@ -46,9 +46,9 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
     if (s->mb_intra) {
         int dummy;
         if (n < 4)
-            q = s->y_dc_scale<<3;
+            q = s->y_dc_scale;
         else
-            q = s->c_dc_scale<<3;
+            q = s->c_dc_scale;
         /* note: block[0] is assumed to be positive */
         if (!s->h263_aic) {
 #if 1
@@ -56,7 +56,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
         	"xorl %%edx, %%edx	\n\t"
         	"mul %%ecx		\n\t"
         	: "=d" (level), "=a"(dummy)
-        	: "a" (block[0] + (q >> 1)), "c" (inverse[q])
+        	: "a" ((block[0]>>2) + q), "c" (inverse[q<<1])
         );
 #else
         asm volatile (
@@ -64,13 +64,13 @@ static int RENAME(dct_quantize)(MpegEncContext *s,
         	"divw %%cx		\n\t"
         	"movzwl %%ax, %%eax	\n\t"
         	: "=a" (level)
-        	: "a" (block[0] + (q >> 1)), "c" (q)
+        	: "a" ((block[0]>>2) + q), "c" (q<<1)
         	: "%edx"
         );
 #endif
         } else
             /* For AIC we skip quant/dequant of INTRADC */
-            level = block[0]>>3;
+            level = (block[0] + 4)>>3;
             
         block[0]=0; //avoid fake overflow
 //        temp_block[0] = (block[0] + (q >> 1)) / q;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list