[x265] [PATCH] xDeQuant renamed and code cleanup

praveen at multicorewareinc.com praveen at multicorewareinc.com
Mon Jul 8 13:09:25 CEST 2013


# HG changeset patch
# User praveentiwari
# Date 1373281751 -19800
# Node ID 8c8996bbec6ba6e5fadf97b460243084f9fed5c7
# Parent  fad2ee52b66b82c78edde5b767546e0ffc9aa721
xDeQuant renamed and code cleanup

diff -r fad2ee52b66b -r 8c8996bbec6b source/common/vec/dct.inc
--- a/source/common/vec/dct.inc	Mon Jul 08 16:20:22 2013 +0530
+++ b/source/common/vec/dct.inc	Mon Jul 08 16:39:11 2013 +0530
@@ -44,12 +44,9 @@
 #define IF_FILTER_PREC    6 ///< Log2 of sum of filter taps
 #define IF_INTERNAL_OFFS (1 << (IF_INTERNAL_PREC - 1)) ///< Offset used internally
 
-void xDeQuant(int bitDepth, const int* src, int* dst, int width, int height, int per, int rem, bool useScalingList, unsigned int log2TrSize, int *deQuantCoefOrig)
+void dequant(int bitDepth, const int* quantCoef, int* coef, int width, int height, int per, int rem, bool useScalingList, unsigned int log2TrSize, int *deQuantCoef)
 {
-    const int* qCoef = src;
-    int* coef = dst;
-
-    int g_invQuantScales[6] = { 40, 45, 51, 57, 64, 72 };
+    int invQuantScales[6] = { 40, 45, 51, 57, 64, 72 };
 
     if (width > 32)
     {
@@ -66,7 +63,6 @@
     if (useScalingList)
     {
         shift += 4;
-        int *deQuantCoef = deQuantCoefOrig;
 
         if (shift > per)
         {
@@ -75,95 +71,95 @@
 
             for (int n = 0; n < width * height; n = n + 8)
             {
-                Vec4i qCoef1, qCoef2, deQuantCoef1, deQuantCoef2;
-
-                qCoef1.load(qCoef + n);
-                qCoef2.load(qCoef + n + 4);
+                Vec4i quantCoef1, quantCoef2, deQuantCoef1, deQuantCoef2;
+
+                quantCoef1.load(quantCoef + n);
+                quantCoef2.load(quantCoef + n + 4);
 
                 deQuantCoef1.load(deQuantCoef + n);
                 deQuantCoef2.load(deQuantCoef + n + 4);
 
-                Vec8s qCoef12 = compress_saturated(qCoef1, qCoef2);
-
-                qCoef1 = extend_low(qCoef12);
-                qCoef2 = extend_high(qCoef12);
-
-                qCoef1 =  (qCoef1 *  deQuantCoef1 + IAdd) >> (shift - per);
-                qCoef2 =  (qCoef2 *  deQuantCoef2 + IAdd) >> (shift - per);
-
-                qCoef12 = compress_saturated(qCoef1, qCoef2);
-
-                qCoef1 = extend_low(qCoef12);
-                qCoef1.store(coef + n);
-                qCoef2 = extend_high(qCoef12);
-                qCoef2.store(coef + n + 4);
+                Vec8s quantCoef12 = compress_saturated(quantCoef1, quantCoef2);
+
+                quantCoef1 = extend_low(quantCoef12);
+                quantCoef2 = extend_high(quantCoef12);
+
+                quantCoef1 =  (quantCoef1 *  deQuantCoef1 + IAdd) >> (shift - per);
+                quantCoef2 =  (quantCoef2 *  deQuantCoef2 + IAdd) >> (shift - per);
+
+                quantCoef12 = compress_saturated(quantCoef1, quantCoef2);
+
+                quantCoef1 = extend_low(quantCoef12);
+                quantCoef1.store(coef + n);
+                quantCoef2 = extend_high(quantCoef12);
+                quantCoef2.store(coef + n + 4);
             }
         }
         else
         {
             for (int n = 0; n < width * height; n = n + 8)
             {
-                Vec4i qCoef1, qCoef2, deQuantCoef1, deQuantCoef2;
-
-                qCoef1.load(qCoef + n);
-                qCoef2.load(qCoef + n + 4);
+                Vec4i quantCoef1, quantCoef2, deQuantCoef1, deQuantCoef2;
+
+                quantCoef1.load(quantCoef + n);
+                quantCoef2.load(quantCoef + n + 4);
 
                 deQuantCoef1.load(deQuantCoef + n);
                 deQuantCoef2.load(deQuantCoef + n + 4);
 
-                Vec8s qCoef12 = compress_saturated(qCoef1, qCoef2);
-
-                qCoef1 = extend_low(qCoef12);
-                qCoef2 = extend_high(qCoef12);
-
-                qCoef1 = qCoef1 * deQuantCoef1;
-                qCoef2 = qCoef2 * deQuantCoef2;
-
-                qCoef12 = compress_saturated(qCoef1, qCoef2);
-
-                qCoef1 = extend_low(qCoef12);
-                qCoef2 = extend_high(qCoef12);
-
-                qCoef1 = qCoef1 << (per - shift);
-                qCoef2 = qCoef2 << (per - shift);
-
-                qCoef12 = compress_saturated(qCoef1, qCoef2);
-
-                qCoef1 = extend_low(qCoef12);
-                qCoef1.store(coef + n);
-                qCoef2 = extend_high(qCoef12);
-                qCoef2.store(coef + n + 4);
+                Vec8s quantCoef12 = compress_saturated(quantCoef1, quantCoef2);
+
+                quantCoef1 = extend_low(quantCoef12);
+                quantCoef2 = extend_high(quantCoef12);
+
+                quantCoef1 = quantCoef1 * deQuantCoef1;
+                quantCoef2 = quantCoef2 * deQuantCoef2;
+
+                quantCoef12 = compress_saturated(quantCoef1, quantCoef2);
+
+                quantCoef1 = extend_low(quantCoef12);
+                quantCoef2 = extend_high(quantCoef12);
+
+                quantCoef1 = quantCoef1 << (per - shift);
+                quantCoef2 = quantCoef2 << (per - shift);
+
+                quantCoef12 = compress_saturated(quantCoef1, quantCoef2);
+
+                quantCoef1 = extend_low(quantCoef12);
+                quantCoef1.store(coef + n);
+                quantCoef2 = extend_high(quantCoef12);
+                quantCoef2.store(coef + n + 4);
             }
         }
     }
     else
     {
         valueToAdd = 1 << (shift - 1);
-        int scale = g_invQuantScales[rem] << per;
+        int scale = invQuantScales[rem] << per;
 
         Vec4i Scale(scale);
         Vec4i IAdd(valueToAdd);
 
         for (int n = 0; n < width * height; n = n + 8)
         {
-            Vec4i qCoef1, qCoef2;
-            qCoef1.load(qCoef + n);
-            qCoef2.load(qCoef + n + 4);
-
-            Vec8s qCoef12 = compress_saturated(qCoef1, qCoef2);
-
-            qCoef1 = extend_low(qCoef12);
-            qCoef2 = extend_high(qCoef12);
-
-            qCoef1 = (qCoef1 * Scale + IAdd) >> shift;
-            qCoef2 = (qCoef2 * Scale + IAdd) >> shift;
-
-            qCoef12 = compress_saturated(qCoef1, qCoef2);
-
-            qCoef1 = extend_low(qCoef12);
-            qCoef1.store(coef + n);
-            qCoef2 = extend_high(qCoef12);
-            qCoef2.store(coef + n + 4);
+            Vec4i quantCoef1, quantCoef2;
+            quantCoef1.load(quantCoef + n);
+            quantCoef2.load(quantCoef + n + 4);
+
+            Vec8s quantCoef12 = compress_saturated(quantCoef1, quantCoef2);
+
+            quantCoef1 = extend_low(quantCoef12);
+            quantCoef2 = extend_high(quantCoef12);
+
+            quantCoef1 = (quantCoef1 * Scale + IAdd) >> shift;
+            quantCoef2 = (quantCoef2 * Scale + IAdd) >> shift;
+
+            quantCoef12 = compress_saturated(quantCoef1, quantCoef2);
+
+            quantCoef1 = extend_low(quantCoef12);
+            quantCoef1.store(coef + n);
+            quantCoef2 = extend_high(quantCoef12);
+            quantCoef2.store(coef + n + 4);
         }
     }
 }
@@ -4084,7 +4080,7 @@
 
 void NAME(Setup_Vec_DCTPrimitives)(EncoderPrimitives &p)
 {
-    p.deQuant = xDeQuant;
+    p.deQuant = dequant;
     p.quantaq = quantaq;
     p.quant = quant;
 


More information about the x265-devel mailing list