diff h264idct.c @ 3105:2d35fb3cb940 libavcodec

h264: special case dc-only idct. ~1% faster overall
author lorenm
date Fri, 10 Feb 2006 06:55:25 +0000
parents 0b546eab515d
children c8c591fe26f8
line wrap: on
line diff
--- a/h264idct.c	Fri Feb 10 01:19:54 2006 +0000
+++ b/h264idct.c	Fri Feb 10 06:55:25 2006 +0000
@@ -139,3 +139,28 @@
         dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b7) >> 6) ];
     }
 }
+
+// assumes all AC coefs are 0
+void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){
+    int i, j;
+    uint8_t *cm = cropTbl + MAX_NEG_CROP;
+    int dc = (block[0] + 32) >> 6;
+    for( j = 0; j < 4; j++ )
+    {
+        for( i = 0; i < 4; i++ )
+            dst[i] = cm[ dst[i] + dc ];
+        dst += stride;
+    }
+}
+
+void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){
+    int i, j;
+    uint8_t *cm = cropTbl + MAX_NEG_CROP;
+    int dc = (block[0] + 32) >> 6;
+    for( j = 0; j < 8; j++ )
+    {
+        for( i = 0; i < 8; i++ )
+            dst[i] = cm[ dst[i] + dc ];
+        dst += stride;
+    }
+}