[x265] [PATCH] Modify TComLoopFilter structure to support multiple color space formats

ashok at multicorewareinc.com ashok at multicorewareinc.com
Fri Jan 3 14:04:01 CET 2014


# HG changeset patch
# User ashok at multicorewareinc.com
# Date 1388754229 -19800
#      Fri Jan 03 18:33:49 2014 +0530
# Node ID eb68ca275978396b583891717f476d9eb35ab112
# Parent  a30b08b84798ed73e90033d84ba71a7b7dd04c04
Modify TComLoopFilter structure to support multiple color space formats

diff -r a30b08b84798 -r eb68ca275978 source/Lib/TLibCommon/TComLoopFilter.cpp
--- a/source/Lib/TLibCommon/TComLoopFilter.cpp	Fri Jan 03 18:32:04 2014 +0530
+++ b/source/Lib/TLibCommon/TComLoopFilter.cpp	Fri Jan 03 18:33:49 2014 +0530
@@ -48,7 +48,7 @@
 // Constants
 // ====================================================================================================================
 
-#define   QpUV(iQpY)  (((iQpY) < 0) ? (iQpY) : (((iQpY) > 57) ? ((iQpY) - 6) : g_chromaScale[(iQpY)]))
+#define   QpUV(iQpY, chFmt)  (((iQpY) < 0) ? (iQpY) : (((iQpY) > 57) ? ((iQpY) - 6) : g_chromaScale[chFmt][(iQpY)]))
 
 #define DEFAULT_INTRA_TC_OFFSET 2 ///< Default intra TC offset
 
@@ -227,10 +227,11 @@
 
     uint32_t sizeInPU = pic->getNumPartInWidth() >> (depth);
 
+    const bool bAlwaysDoChroma = (cu->getChromaFormat() == CHROMA_444);
     for (uint32_t e = 0; e < sizeInPU; e += partIdxIncr)
     {
         xEdgeFilterLuma(cu, absZOrderIdx, depth, dir, e);
-        if ((pelsInPart > DEBLOCK_SMALLEST_BLOCK) || (e % ((DEBLOCK_SMALLEST_BLOCK << 1) / pelsInPart)) == 0)
+        if (bAlwaysDoChroma || (pelsInPart > DEBLOCK_SMALLEST_BLOCK) || (e % ((DEBLOCK_SMALLEST_BLOCK << 1) / pelsInPart)) == 0)
         {
             xEdgeFilterChroma(cu, absZOrderIdx, depth, dir, e);
         }
@@ -644,7 +645,7 @@
     int qpP = 0;
     int qpQ = 0;
 
-    uint32_t  pelsInPartChroma = g_maxCUWidth >> (g_maxCUDepth + 1);
+    uint32_t  pelsInPartChroma = g_maxCUWidth >> (g_maxCUDepth + cu->getHorzChromaShift());
     int   offset, srcStep;
 
     const uint32_t lcuWidthInBaseUnits = cu->getPic()->getNumPartInWidth();
@@ -731,7 +732,7 @@
                 int chromaQPOffset  = (chromaIdx == 0) ? cu->getSlice()->getPPS()->getChromaCbQpOffset() : cu->getSlice()->getPPS()->getChromaCrQpOffset();
                 Pel* piTmpSrcChroma = (chromaIdx == 0) ? tmpSrcCb : tmpSrcCr;
 
-                qp = QpUV(((qpP + qpQ + 1) >> 1) + chromaQPOffset);
+                qp = QpUV((((qpP + qpQ + 1) >> 1) + chromaQPOffset), cu->getChromaFormat());
                 int iBitdepthScale = 1 << (X265_DEPTH - 8);
 
                 int iIndexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, qp + DEFAULT_INTRA_TC_OFFSET * (bs - 1) + (tcOffsetDiv2 << 1));


More information about the x265-devel mailing list