[x265] [PATCH 3 of 5] Fix index to dct primitive when using dst

Kevin Wu kevin at multicorewareinc.com
Fri Jan 9 07:53:50 CET 2015


# HG changeset patch
# User Kevin Wu <kevin at multicorewareinc.com>
# Date 1420584367 21600
#      Tue Jan 06 16:46:07 2015 -0600
# Node ID 2452bd8f18fdc0fccfe65905fbd4ba10ef546401
# Parent  e5ad493e60de85e58193d49218997ace8fa43c00
Fix index to dct primitive when using dst.

Use the dst4x4 or idst4x4 function pointers instead of indexing over the
EncoderPrimitives and calling dct/idct.

diff -r e5ad493e60de -r 2452bd8f18fd source/common/primitives.h
--- a/source/common/primitives.h	Thu Jan 08 15:30:26 2015 -0600
+++ b/source/common/primitives.h	Tue Jan 06 16:46:07 2015 -0600
@@ -93,27 +93,6 @@
 
 enum { NUM_TR_SIZE = 4 };
 
-// NOTE: Not all DCT functions support dest stride
-enum Dcts
-{
-    DST_4x4,
-    DCT_4x4,
-    DCT_8x8,
-    DCT_16x16,
-    DCT_32x32,
-    NUM_DCTS
-};
-
-enum IDcts
-{
-    IDST_4x4,
-    IDCT_4x4,
-    IDCT_8x8,
-    IDCT_16x16,
-    IDCT_32x32,
-    NUM_IDCTS
-};
-
 // Returns a LumaPartitions enum for the given size, always expected to return a valid enum
 inline int partitionFromSizes(int width, int height)
 {
diff -r e5ad493e60de -r 2452bd8f18fd source/common/quant.cpp
--- a/source/common/quant.cpp	Thu Jan 08 15:30:26 2015 -0600
+++ b/source/common/quant.cpp	Tue Jan 06 16:46:07 2015 -0600
@@ -353,9 +353,13 @@
     {
         bool isIntra = cu.isIntra(absPartIdx);
         int useDST = !sizeIdx && isLuma && isIntra;
-        int index = BLOCK_4x4 + sizeIdx - useDST;
+        int index = BLOCK_4x4 + sizeIdx;
 
-        primitives.cu[index].dct(residual, m_resiDctCoeff, resiStride);
+        if(useDST)
+          primitives.dst4x4(residual, m_resiDctCoeff, resiStride);
+        else
+          primitives.cu[index].dct(residual, m_resiDctCoeff, resiStride);
+
 
         /* NOTE: if RDOQ is disabled globally, psy-rdoq is also disabled, so
          * there is no risk of performing this DCT unnecessarily */
@@ -465,7 +469,10 @@
             return;
         }
 
-        primitives.cu[BLOCK_4x4 + sizeIdx - useDST].idct(m_resiDctCoeff, residual, resiStride);
+        if(useDST)
+          primitives.idst4x4(m_resiDctCoeff, residual, resiStride);
+        else
+          primitives.cu[BLOCK_4x4 + sizeIdx].idct(m_resiDctCoeff, residual, resiStride);
     }
 }
 


More information about the x265-devel mailing list