[x265] [PATCH] Scalinglists support for 4:4:4 videos

vignesh at multicorewareinc.com vignesh at multicorewareinc.com
Tue Jan 3 11:51:19 CET 2017


# HG changeset patch
# User Vignesh Vijayakumar <vignesh at multicorewareinc.com>
# Date 1482915844 -19800
#      Wed Dec 28 14:34:04 2016 +0530
# Node ID cfaadf16b7ce1f87a9ff484546109aa071a15d53
# Parent  af10eaeb36cd22c7ad20ed2dafeac6f8e388ed9d
Scalinglists support for 4:4:4 videos

diff -r af10eaeb36cd -r cfaadf16b7ce source/common/scalinglist.cpp
--- a/source/common/scalinglist.cpp	Wed Dec 28 10:17:08 2016 +0530
+++ b/source/common/scalinglist.cpp	Wed Dec 28 14:34:04 2016 +0530
@@ -339,7 +339,7 @@
 }
 
 /** set quantized matrix coefficient for encode */
-void ScalingList::setupQuantMatrices()
+void ScalingList::setupQuantMatrices(int internalCsp)
 {
     for (int size = 0; size < NUM_SIZES; size++)
     {
@@ -360,6 +360,21 @@
 
                 if (m_bEnabled)
                 {
+                    if (internalCsp == X265_CSP_I444)
+                    {
+                        for (int i = 0; i < 64; i++)
+                        {
+                            m_scalingListCoef[BLOCK_32x32][1][i] = m_scalingListCoef[BLOCK_16x16][1][i];
+                            m_scalingListCoef[BLOCK_32x32][2][i] = m_scalingListCoef[BLOCK_16x16][2][i];
+                            m_scalingListCoef[BLOCK_32x32][4][i] = m_scalingListCoef[BLOCK_16x16][4][i];
+                            m_scalingListCoef[BLOCK_32x32][5][i] = m_scalingListCoef[BLOCK_16x16][5][i];
+                        }
+
+                        m_scalingListDC[BLOCK_32x32][1] = m_scalingListDC[BLOCK_16x16][1];
+                        m_scalingListDC[BLOCK_32x32][2] = m_scalingListDC[BLOCK_16x16][2];
+                        m_scalingListDC[BLOCK_32x32][4] = m_scalingListDC[BLOCK_16x16][4];
+                        m_scalingListDC[BLOCK_32x32][5] = m_scalingListDC[BLOCK_16x16][5];
+                    }
                     processScalingListEnc(coeff, quantCoeff, s_quantScales[rem] << 4, width, width, ratio, stride, dc);
                     processScalingListDec(coeff, dequantCoeff, s_invQuantScales[rem], width, width, ratio, stride, dc);
                 }
diff -r af10eaeb36cd -r cfaadf16b7ce source/common/scalinglist.h
--- a/source/common/scalinglist.h	Wed Dec 28 10:17:08 2016 +0530
+++ b/source/common/scalinglist.h	Wed Dec 28 14:34:04 2016 +0530
@@ -60,7 +60,7 @@
     bool     init();
     void     setDefaultScalingList();
     bool     parseScalingList(const char* filename);
-    void     setupQuantMatrices();
+    void     setupQuantMatrices(int internalCsp);
 
     /* used during SPS coding */
     int      checkPredMode(int sizeId, int listId) const;
diff -r af10eaeb36cd -r cfaadf16b7ce source/encoder/api.cpp
--- a/source/encoder/api.cpp	Wed Dec 28 10:17:08 2016 +0530
+++ b/source/encoder/api.cpp	Wed Dec 28 14:34:04 2016 +0530
@@ -189,7 +189,7 @@
             {
                 if (encoder->m_scalingList.parseScalingList(encoder->m_latestParam->scalingLists))
                     return -1;
-                encoder->m_scalingList.setupQuantMatrices();
+                encoder->m_scalingList.setupQuantMatrices(encoder->m_param->internalCsp);
             }
             else
             {
diff -r af10eaeb36cd -r cfaadf16b7ce source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Dec 28 10:17:08 2016 +0530
+++ b/source/encoder/encoder.cpp	Wed Dec 28 14:34:04 2016 +0530
@@ -252,10 +252,10 @@
         if (!scalingEnabled)
         {
             m_scalingList.setDefaultScalingList();
-            m_scalingList.setupQuantMatrices();
+            m_scalingList.setupQuantMatrices(m_sps.chromaFormatIdc);
         }
         else
-            m_scalingList.setupQuantMatrices();
+            m_scalingList.setupQuantMatrices(m_sps.chromaFormatIdc);
 
         for (int q = 0; q < QP_MAX_MAX - QP_MAX_SPEC; q++)
         {
@@ -308,11 +308,11 @@
         {
             m_scalingList.m_bEnabled = false;
             m_scalingList.m_bDataPresent = false;
-            m_scalingList.setupQuantMatrices();
+            m_scalingList.setupQuantMatrices(m_sps.chromaFormatIdc);
         }
     }
     else
-        m_scalingList.setupQuantMatrices();
+        m_scalingList.setupQuantMatrices(m_sps.chromaFormatIdc);
 
     int numRows = (m_param->sourceHeight + g_maxCUSize - 1) / g_maxCUSize;
     int numCols = (m_param->sourceWidth  + g_maxCUSize - 1) / g_maxCUSize;
@@ -1986,12 +1986,6 @@
     }
 
 
-    if (p->scalingLists && p->internalCsp == X265_CSP_I444)
-    {
-        x265_log(p, X265_LOG_WARNING, "Scaling lists are not yet supported for 4:4:4 chroma subsampling\n");
-        p->scalingLists = 0;
-    }
-
     if (p->interlaceMode)
         x265_log(p, X265_LOG_WARNING, "Support for interlaced video is experimental\n");
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 4669 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20170103/53ab63e6/attachment.bin>


More information about the x265-devel mailing list