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

ashok at multicorewareinc.com ashok at multicorewareinc.com
Fri Dec 20 14:55:40 CET 2013


# HG changeset patch
# User ashok at multicorewareinc.com
# Date 1387547718 -19800
#      Fri Dec 20 19:25:18 2013 +0530
# Node ID 02769c943b1fc6904b0335d797efed536004eae9
# Parent  90e8cdd7c12d22b15b7494d5954e04ad59e6b09e
Modify TComDataCU structure to support multiple color space formats

diff -r 90e8cdd7c12d -r 02769c943b1f source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Fri Dec 20 19:24:04 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Fri Dec 20 19:25:18 2013 +0530
@@ -2899,60 +2899,68 @@
 
 uint32_t TComDataCU::getCoefScanIdx(uint32_t absPartIdx, uint32_t width, bool bIsLuma, bool bIsIntra)
 {
-    uint32_t uiCTXIdx;
     uint32_t scanIdx;
     uint32_t dirMode;
 
     if (!bIsIntra)
     {
-        scanIdx = SCAN_DIAG;
-        return scanIdx;
+        return SCAN_DIAG;
     }
 
-    switch (width)
-    {
-    case  2: uiCTXIdx = 6;
-        break;
-    case  4: uiCTXIdx = 5;
-        break;
-    case  8: uiCTXIdx = 4;
-        break;
-    case 16: uiCTXIdx = 3;
-        break;
-    case 32: uiCTXIdx = 2;
-        break;
-    case 64: uiCTXIdx = 1;
-        break;
-    default: uiCTXIdx = 0;
-        break;
-    }
-
+    //check that MDCS can be used for this TU
+
+    uint32_t height = width; // For testing Need to change later
     if (bIsLuma)
     {
+        const uint32_t maximumWidth  = MDCS_MAXIMUM_WIDTH;
+        const uint32_t maximumHeight = MDCS_MAXIMUM_HEIGHT;
+
+        if ((width > maximumWidth) || (height > maximumHeight)) return SCAN_DIAG;
+
         dirMode = getLumaIntraDir(absPartIdx);
-        scanIdx = SCAN_DIAG;
-        if (uiCTXIdx > 3 && uiCTXIdx < 6) //if multiple scans supported for transform size
-        {
-            scanIdx = abs((int)dirMode - VER_IDX) < 5 ? SCAN_HOR : (abs((int)dirMode - HOR_IDX) < 5 ? SCAN_VER : SCAN_DIAG);
-        }
     }
     else
     {
-        dirMode = getChromaIntraDir(absPartIdx);
+        const uint32_t maximumWidth  = MDCS_MAXIMUM_WIDTH  >> m_hChromaShift;
+        const uint32_t maximumHeight = MDCS_MAXIMUM_HEIGHT >> m_vChromaShift;
+
+        if ((width > maximumWidth) || (height > maximumHeight)) return SCAN_DIAG;
+
+        dirMode  = getChromaIntraDir(absPartIdx);
         if (dirMode == DM_CHROMA_IDX)
         {
-            // get number of partitions in current CU
-            uint32_t depth = getDepth(absPartIdx);
-            uint32_t numParts = getPic()->getNumPartInCU() >> (2 * depth);
-
-            // get luma mode from upper-left corner of current CU
-            dirMode = getLumaIntraDir((absPartIdx / numParts) * numParts);
+            dirMode = getLumaIntraDir(absPartIdx);
         }
-        scanIdx = SCAN_DIAG;
-        if (uiCTXIdx > 4 && uiCTXIdx < 7) //if multiple scans supported for transform size
-        {
-            scanIdx = abs((int)dirMode - VER_IDX) < 5 ? SCAN_HOR : (abs((int)dirMode - HOR_IDX) < 5 ? SCAN_VER : SCAN_DIAG);
-        }
+    }
+
+    switch (MDCS_MODE)
+    {
+    case MDCS_BOTH_DIRECTIONS:
+        if (abs((int)dirMode - VER_IDX) <= MDCS_ANGLE_LIMIT)
+            scanIdx = SCAN_HOR;
+        else if (abs((int)dirMode - HOR_IDX) <= MDCS_ANGLE_LIMIT)
+            scanIdx = SCAN_VER;
+        else
+            scanIdx = SCAN_DIAG;
+        break;
+
+    case MDCS_VERTICAL_ONLY:
+        if (abs((int)dirMode - HOR_IDX) <= MDCS_ANGLE_LIMIT)
+            scanIdx = SCAN_VER;
+        break;
+
+    case MDCS_HORIZONTAL_ONLY:
+        if (abs((int)dirMode - VER_IDX) <= MDCS_ANGLE_LIMIT)
+            scanIdx = SCAN_HOR;
+        break;
+
+    case MDCS_DISABLED:
+        scanIdx = 0;
+        break;
+
+    default:
+        assert(false);
+        break;
     }
 
     return scanIdx;
diff -r 90e8cdd7c12d -r 02769c943b1f source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Fri Dec 20 19:24:04 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.h	Fri Dec 20 19:25:18 2013 +0530
@@ -491,6 +491,7 @@
     int           getHorzChromaShift()  { return m_hChromaShift; }
 
     int           getVertChromaShift()  { return m_vChromaShift; }
+    int           getChromaFormat()     { return m_chromaFormat; }
 };
 
 namespace RasterAddress {


More information about the x265-devel mailing list