[x265] [PATCH] Modify TComDataCU structure to support multiple color space formats
ashok at multicorewareinc.com
ashok at multicorewareinc.com
Fri Jan 3 13:51:57 CET 2014
# HG changeset patch
# User ashok at multicorewareinc.com
# Date 1388753501 -19800
# Fri Jan 03 18:21:41 2014 +0530
# Node ID 98e238489f843ff233c512570c1fab75b2ff801a
# Parent f83443bbae4d5b0e98bc85e011d8a4f4fe0bce95
Modify TComDataCU structure to support multiple color space formats
diff -r f83443bbae4d -r 98e238489f84 source/Lib/TLibCommon/CommonDef.h
--- a/source/Lib/TLibCommon/CommonDef.h Fri Jan 03 18:16:18 2014 +0530
+++ b/source/Lib/TLibCommon/CommonDef.h Fri Jan 03 18:21:41 2014 +0530
@@ -88,6 +88,9 @@
#define MLS_GRP_NUM 64 ///< G644 : Max number of coefficient groups, max(16, 64)
#define MLS_CG_SIZE 4 ///< G644 : Coefficient group size of 4x4
+#define MLS_CG_LOG2_WIDTH 2
+#define MLS_CG_LOG2_HEIGHT 2
+
#define ARL_C_PRECISION 7 ///< G382: 7-bit arithmetic precision
#define LEVEL_RANGE 30 ///< G382: max coefficient level in statistics collection
diff -r f83443bbae4d -r 98e238489f84 source/Lib/TLibCommon/ContextTables.h
--- a/source/Lib/TLibCommon/ContextTables.h Fri Jan 03 18:16:18 2014 +0530
+++ b/source/Lib/TLibCommon/ContextTables.h Fri Jan 03 18:21:41 2014 +0530
@@ -153,10 +153,21 @@
#define sbacGetEntropyBits(S, V) (g_entropyBits[(S) ^ (V)])
#define sbacGetEntropyBitsTrm(V) (g_entropyBits[126 ^ (V)])
+#define CHANNEL_TYPE_LUMA 0
+#define CHANNEL_TYPE_CHROMA 1
+#define MAX_NUM_CHANNEL_TYPE 2
+
// ====================================================================================================================
// Tables
// ====================================================================================================================
+#define NEIGHBOURHOOD_00_CONTEXT_1_THRESHOLD_4x4 3
+#define NEIGHBOURHOOD_00_CONTEXT_2_THRESHOLD_4x4 1
+
+static const uint32_t significanceMapContextSetStart [MAX_NUM_CHANNEL_TYPE][3] = { {0, 9, 21}, {0, 9, 12} };
+static const uint32_t significanceMapContextSetSize [MAX_NUM_CHANNEL_TYPE][3] = { {9, 12, 6}, {9, 3, 3} };
+static const uint32_t nonDiagonalScan8x8ContextOffset [MAX_NUM_CHANNEL_TYPE] = { 6, 0 };
+static const uint32_t notFirstGroupNeighbourhoodContextOffset[MAX_NUM_CHANNEL_TYPE] = { 3, 0 };
// initial probability for cu_transquant_bypass flag
static const uint8_t
diff -r f83443bbae4d -r 98e238489f84 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp Fri Jan 03 18:16:18 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp Fri Jan 03 18:21:41 2014 +0530
@@ -629,7 +629,7 @@
memcpy(rpcCU->getCoeffY() + tmp2, m_trCoeffY, sizeof(TCoeff) * tmp);
memcpy(rpcCU->getPCMSampleY() + tmp2, m_iPCMSampleY, sizeof(Pel) * tmp);
- tmp = ((g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_hChromaShift)) >> (uhDepth << 1);
+ tmp = ((g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_vChromaShift)) >> (uhDepth << 1);
tmp2 = m_absIdxInLCU * (m_pic->getMinCUWidth() >> m_hChromaShift) * (m_pic->getMinCUHeight() >> m_vChromaShift);
memcpy(rpcCU->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(TCoeff) * tmp);
memcpy(rpcCU->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(TCoeff) * tmp);
@@ -2961,60 +2961,71 @@
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:
+ //std::cerr << "ERROR: Unrecognised MDCS mode" << std::endl;
+ //assert(false);
+ scanIdx = 0;
+ //exit(1);
+ break;
}
return scanIdx;
diff -r f83443bbae4d -r 98e238489f84 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h Fri Jan 03 18:16:18 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.h Fri Jan 03 18:21:41 2014 +0530
@@ -493,6 +493,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