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

ashok at multicorewareinc.com ashok at multicorewareinc.com
Fri Dec 20 14:54:33 CET 2013


# HG changeset patch
# User ashok at multicorewareinc.com
# Date 1387547644 -19800
#      Fri Dec 20 19:24:04 2013 +0530
# Node ID 90e8cdd7c12d22b15b7494d5954e04ad59e6b09e
# Parent  7ec2dcfad72a9bf0f5e65b5c48f248b33ff77e2a
Modify TComLoopFilter structure to support multiple color space formats

diff -r 7ec2dcfad72a -r 90e8cdd7c12d source/Lib/TLibCommon/TComLoopFilter.cpp
--- a/source/Lib/TLibCommon/TComLoopFilter.cpp	Fri Dec 20 19:20:51 2013 +0530
+++ b/source/Lib/TLibCommon/TComLoopFilter.cpp	Fri Dec 20 19:24:04 2013 +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