[x265] [PATCH] Modify TComPicYuv structure to support multiple color space formats
ashok at multicorewareinc.com
ashok at multicorewareinc.com
Fri Dec 20 15:09:15 CET 2013
# HG changeset patch
# User ashok at multicorewareinc.com
# Date 1387548541 -19800
# Fri Dec 20 19:39:01 2013 +0530
# Node ID c770ea0efdda6e2563cf1ea529a47a2309e8d3b9
# Parent a2e9fb27bb041900ae334496ecdc1ecb13e0f7fa
Modify TComPicYuv structure to support multiple color space formats
diff -r a2e9fb27bb04 -r c770ea0efdda source/Lib/TLibCommon/CommonDef.h
--- a/source/Lib/TLibCommon/CommonDef.h Fri Dec 20 19:37:17 2013 +0530
+++ b/source/Lib/TLibCommon/CommonDef.h Fri Dec 20 19:39:01 2013 +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 a2e9fb27bb04 -r c770ea0efdda source/Lib/TLibCommon/ContextTables.h
--- a/source/Lib/TLibCommon/ContextTables.h Fri Dec 20 19:37:17 2013 +0530
+++ b/source/Lib/TLibCommon/ContextTables.h Fri Dec 20 19:39:01 2013 +0530
@@ -150,6 +150,10 @@
#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
// ====================================================================================================================
@@ -157,6 +161,14 @@
namespace x265 {
// private namespace
+#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
INIT_CU_TRANSQUANT_BYPASS_FLAG[3][NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX] =
diff -r a2e9fb27bb04 -r c770ea0efdda source/Lib/TLibCommon/TComPicYuv.cpp
--- a/source/Lib/TLibCommon/TComPicYuv.cpp Fri Dec 20 19:37:17 2013 +0530
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp Fri Dec 20 19:39:01 2013 +0530
@@ -89,8 +89,8 @@
int maxHeight = m_numCuInHeight * g_maxCUHeight;
m_picBufY = (Pel*)X265_MALLOC(Pel, m_stride * (maxHeight + (m_lumaMarginY << 1)));
- m_picBufU = (Pel*)X265_MALLOC(Pel, m_strideC * ((maxHeight >> 1) + (m_chromaMarginY << 1)));
- m_picBufV = (Pel*)X265_MALLOC(Pel, m_strideC * ((maxHeight >> 1) + (m_chromaMarginY << 1)));
+ m_picBufU = (Pel*)X265_MALLOC(Pel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY << 1)));
+ m_picBufV = (Pel*)X265_MALLOC(Pel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY << 1)));
m_picOrgY = m_picBufY + m_lumaMarginY * getStride() + m_lumaMarginX;
m_picOrgU = m_picBufU + m_chromaMarginY * getCStride() + m_chromaMarginX;
diff -r a2e9fb27bb04 -r c770ea0efdda source/Lib/TLibCommon/TComYuv.h
--- a/source/Lib/TLibCommon/TComYuv.h Fri Dec 20 19:37:17 2013 +0530
+++ b/source/Lib/TLibCommon/TComYuv.h Fri Dec 20 19:39:01 2013 +0530
@@ -183,9 +183,9 @@
// Access starting position of YUV partition unit buffer
Pel* getLumaAddr(uint32_t partUnitIdx) { return m_bufY + getAddrOffset(partUnitIdx, m_width); }
- Pel* getCbAddr(uint32_t partUnitIdx) { return m_bufU + (getAddrOffset(partUnitIdx, m_cwidth) >> 1); }
+ Pel* getCbAddr(uint32_t partUnitIdx) { return m_bufU + (getAddrOffset(partUnitIdx, m_cwidth) >> m_hChromaShift); }
- Pel* getCrAddr(uint32_t partUnitIdx) { return m_bufV + (getAddrOffset(partUnitIdx, m_cwidth) >> 1); }
+ Pel* getCrAddr(uint32_t partUnitIdx) { return m_bufV + (getAddrOffset(partUnitIdx, m_cwidth) >> m_hChromaShift); }
// Access starting position of YUV transform unit buffer
Pel* getLumaAddr(uint32_t iTransUnitIdx, uint32_t iBlkSize) { return m_bufY + getAddrOffset(iTransUnitIdx, iBlkSize, m_width); }
diff -r a2e9fb27bb04 -r c770ea0efdda source/Lib/TLibCommon/TypeDef.h
--- a/source/Lib/TLibCommon/TypeDef.h Fri Dec 20 19:37:17 2013 +0530
+++ b/source/Lib/TLibCommon/TypeDef.h Fri Dec 20 19:39:01 2013 +0530
@@ -82,6 +82,10 @@
// ====================================================================================================================
// Enumeration
// ====================================================================================================================
+#define MDCS_MODE MDCS_BOTH_DIRECTIONS ///< Name taken from definition of MDCSMode enumeration below
+#define MDCS_ANGLE_LIMIT 4 ///< (default 4) 0 = Horizontal/vertical only, 1 = Horizontal/vertical +/- 1, 2 = Horizontal/vertical +/- 2 etc...
+#define MDCS_MAXIMUM_WIDTH 8 ///< (default 8) (measured in pixels) TUs with width greater than this can only use diagonal scan
+#define MDCS_MAXIMUM_HEIGHT 8 ///< (default 8) (measured in pixels) TUs with height greater than this can only use diagonal scan
/// supported slice type
enum SliceType
@@ -97,7 +101,18 @@
CHROMA_400 = 0,
CHROMA_420 = 1,
CHROMA_422 = 2,
- CHROMA_444 = 3
+ CHROMA_444 = 3,
+ NUM_CHROMA_FORMAT = 4
+};
+
+///MDCS modes
+enum MDCSMode
+{
+ MDCS_DISABLED = 0,
+ MDCS_HORIZONTAL_ONLY = 1,
+ MDCS_VERTICAL_ONLY = 2,
+ MDCS_BOTH_DIRECTIONS = 3,
+ MDCS_NUMBER_OF_MODES = 4
};
#define CHROMA_H_SHIFT(x) (x == CHROMA_420 || x == CHROMA_422)
@@ -160,9 +175,36 @@
/// coefficient scanning type used in ACS
enum COEFF_SCAN_TYPE
{
- SCAN_DIAG = 0, ///< up-right diagonal scan
- SCAN_HOR, ///< horizontal first scan
- SCAN_VER ///< vertical first scan
+ SCAN_DIAG = 0, ///< up-right diagonal scan
+ SCAN_HOR = 1, ///< horizontal first scan
+ SCAN_VER = 2, ///< vertical first scan
+ SCAN_NUMBER_OF_TYPES = 3
+};
+
+enum SignificanceMapContextType
+{
+ CONTEXT_TYPE_4x4 = 0,
+ CONTEXT_TYPE_8x8 = 1,
+ CONTEXT_TYPE_NxN = 2,
+ CONTEXT_NUMBER_OF_TYPES = 3
+};
+
+enum COEFF_SCAN_GROUP_TYPE
+{
+ SCAN_UNGROUPED = 0,
+ SCAN_GROUPED_4x4 = 1,
+ SCAN_NUMBER_OF_GROUP_TYPES = 2
+};
+
+//TU settings for entropy encoding
+struct TUEntropyCodingParameters
+{
+ const uint32_t *scan;
+ const uint32_t *scanCG;
+ COEFF_SCAN_TYPE scanType;
+ uint32_t widthInGroups;
+ uint32_t heightInGroups;
+ uint32_t firstSignificanceMapContext;
};
namespace Profile {
More information about the x265-devel
mailing list