[x265] HM: context table
Satoshi Nakagawa
nakagawa424 at oki.com
Sat Jan 25 05:48:57 CET 2014
# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1390624003 -32400
# Sat Jan 25 13:26:43 2014 +0900
# Node ID c59cbc166bede46c227ca47a9d7207d84d117544
# Parent 237bf66674056639581ef2aa3466ea2fc5523ceb
HM: context table
diff -r 237bf6667405 -r c59cbc166bed source/Lib/TLibCommon/ContextTables.h
--- a/source/Lib/TLibCommon/ContextTables.h Fri Jan 24 14:43:31 2014 -0600
+++ b/source/Lib/TLibCommon/ContextTables.h Sat Jan 25 13:26:43 2014 +0900
@@ -56,8 +56,7 @@
#define NUM_MERGE_FLAG_EXT_CTX 1 ///< number of context models for merge flag of merge extended
#define NUM_MERGE_IDX_EXT_CTX 1 ///< number of context models for merge index of merge extended
-#define NUM_PART_SIZE_CTX 3 ///< number of context models for partition size
-#define NUM_CU_AMP_CTX 1 ///< number of context models for partition size (AMP)
+#define NUM_PART_SIZE_CTX 4 ///< number of context models for partition size
#define NUM_PRED_MODE_CTX 1 ///< number of context models for prediction mode
#define NUM_ADI_CTX 1 ///< number of context models for intra prediction
@@ -87,7 +86,7 @@
#define NUM_ABS_FLAG_CTX_LUMA 4 ///< number of context models for greater than 2 flag of luma
#define NUM_ABS_FLAG_CTX_CHROMA 2 ///< number of context models for greater than 2 flag of chroma
-#define NUM_MVP_IDX_CTX 2 ///< number of context models for MVP index
+#define NUM_MVP_IDX_CTX 1 ///< number of context models for MVP index
#define NUM_SAO_MERGE_FLAG_CTX 1 ///< number of context models for SAO merge flags
#define NUM_SAO_TYPE_IDX_CTX 1 ///< number of context models for SAO type index
@@ -119,8 +118,7 @@
#define OFF_ONE_FLAG_CTX (OFF_CTX_LAST_FLAG_Y + 2 * NUM_CTX_LAST_FLAG_XY)
#define OFF_ABS_FLAG_CTX (OFF_ONE_FLAG_CTX + NUM_ONE_FLAG_CTX)
#define OFF_MVP_IDX_CTX (OFF_ABS_FLAG_CTX + NUM_ABS_FLAG_CTX)
-#define OFF_CU_AMP_CTX (OFF_MVP_IDX_CTX + NUM_MVP_IDX_CTX)
-#define OFF_SAO_MERGE_FLAG_CTX (OFF_CU_AMP_CTX + NUM_CU_AMP_CTX)
+#define OFF_SAO_MERGE_FLAG_CTX (OFF_MVP_IDX_CTX + NUM_MVP_IDX_CTX)
#define OFF_SAO_TYPE_IDX_CTX (OFF_SAO_MERGE_FLAG_CTX + NUM_SAO_MERGE_FLAG_CTX)
#define OFF_TRANSFORMSKIP_FLAG_CTX (OFF_SAO_TYPE_IDX_CTX + NUM_SAO_TYPE_IDX_CTX)
#define OFF_CU_TRANSQUANT_BYPASS_FLAG_CTX (OFF_TRANSFORMSKIP_FLAG_CTX + 2 * NUM_TRANSFORMSKIP_FLAG_CTX)
@@ -203,17 +201,9 @@
static const uint8_t
INIT_PART_SIZE[3][NUM_PART_SIZE_CTX] =
{
- { 154, 139, CNU, },
- { 154, 139, CNU, },
- { 184, CNU, CNU, },
-};
-
-static const uint8_t
- INIT_CU_AMP_POS[3][NUM_CU_AMP_CTX] =
-{
- { 154, },
- { 154, },
- { CNU, },
+ { 154, 139, 154, 154 },
+ { 154, 139, 154, 154 },
+ { 184, CNU, CNU, CNU },
};
static const uint8_t
@@ -275,9 +265,9 @@
static const uint8_t
INIT_QT_CBF[3][2 * NUM_QT_CBF_CTX] =
{
- { 153, 111, CNU, CNU, 149, 92, 167, CNU, },
- { 153, 111, CNU, CNU, 149, 107, 167, CNU, },
- { 111, 141, CNU, CNU, 94, 138, 182, CNU, },
+ { 153, 111, CNU, CNU, 149, 92, 167, 154, },
+ { 153, 111, CNU, CNU, 149, 107, 167, 154, },
+ { 111, 141, CNU, CNU, 94, 138, 182, 154, },
};
static const uint8_t
@@ -337,9 +327,9 @@
static const uint8_t
INIT_MVP_IDX[3][NUM_MVP_IDX_CTX] =
{
- { 168, CNU, },
- { 168, CNU, },
- { CNU, CNU, },
+ { 168 },
+ { 168 },
+ { CNU },
};
static const uint8_t
diff -r 237bf6667405 -r c59cbc166bed source/Lib/TLibEncoder/TEncSbac.cpp
--- a/source/Lib/TLibEncoder/TEncSbac.cpp Fri Jan 24 14:43:31 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp Sat Jan 25 13:26:43 2014 +0900
@@ -234,7 +234,6 @@
initBuffer(&m_contextModels[OFF_ONE_FLAG_CTX], sliceType, qp, (UChar*)INIT_ONE_FLAG, NUM_ONE_FLAG_CTX);
initBuffer(&m_contextModels[OFF_ABS_FLAG_CTX], sliceType, qp, (UChar*)INIT_ABS_FLAG, NUM_ABS_FLAG_CTX);
initBuffer(&m_contextModels[OFF_MVP_IDX_CTX], sliceType, qp, (UChar*)INIT_MVP_IDX, NUM_MVP_IDX_CTX);
- initBuffer(&m_contextModels[OFF_CU_AMP_CTX], sliceType, qp, (UChar*)INIT_CU_AMP_POS, NUM_CU_AMP_CTX);
initBuffer(&m_contextModels[OFF_SAO_MERGE_FLAG_CTX], sliceType, qp, (UChar*)INIT_SAO_MERGE_FLAG, NUM_SAO_MERGE_FLAG_CTX);
initBuffer(&m_contextModels[OFF_SAO_TYPE_IDX_CTX], sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX, NUM_SAO_TYPE_IDX_CTX);
initBuffer(&m_contextModels[OFF_TRANSFORMSKIP_FLAG_CTX], sliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG, 2 * NUM_TRANSFORMSKIP_FLAG_CTX);
@@ -286,7 +285,6 @@
curCost += calcCost(&m_contextModels[OFF_ONE_FLAG_CTX], curSliceType, qp, (UChar*)INIT_ONE_FLAG, NUM_ONE_FLAG_CTX);
curCost += calcCost(&m_contextModels[OFF_ABS_FLAG_CTX], curSliceType, qp, (UChar*)INIT_ABS_FLAG, NUM_ABS_FLAG_CTX);
curCost += calcCost(&m_contextModels[OFF_MVP_IDX_CTX], curSliceType, qp, (UChar*)INIT_MVP_IDX, NUM_MVP_IDX_CTX);
- curCost += calcCost(&m_contextModels[OFF_CU_AMP_CTX], curSliceType, qp, (UChar*)INIT_CU_AMP_POS, NUM_CU_AMP_CTX);
curCost += calcCost(&m_contextModels[OFF_SAO_MERGE_FLAG_CTX], curSliceType, qp, (UChar*)INIT_SAO_MERGE_FLAG, NUM_SAO_MERGE_FLAG_CTX);
curCost += calcCost(&m_contextModels[OFF_SAO_TYPE_IDX_CTX], curSliceType, qp, (UChar*)INIT_SAO_TYPE_IDX, NUM_SAO_TYPE_IDX_CTX);
curCost += calcCost(&m_contextModels[OFF_TRANSFORMSKIP_FLAG_CTX], curSliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG, 2 * NUM_TRANSFORMSKIP_FLAG_CTX);
@@ -1523,7 +1521,7 @@
m_binIf->encodeBin(1, m_contextModels[OFF_PART_SIZE_CTX + 1]);
if (cu->getSlice()->getSPS()->getAMPAcc(depth))
{
- m_binIf->encodeBin((partSize == SIZE_2NxN) ? 1 : 0, m_contextModels[OFF_CU_AMP_CTX]);
+ m_binIf->encodeBin((partSize == SIZE_2NxN) ? 1 : 0, m_contextModels[OFF_PART_SIZE_CTX + 3]);
if (partSize != SIZE_2NxN)
{
m_binIf->encodeBinEP((partSize == SIZE_2NxnU ? 0 : 1));
@@ -1543,7 +1541,7 @@
}
if (cu->getSlice()->getSPS()->getAMPAcc(depth))
{
- m_binIf->encodeBin((partSize == SIZE_Nx2N) ? 1 : 0, m_contextModels[OFF_CU_AMP_CTX]);
+ m_binIf->encodeBin((partSize == SIZE_Nx2N) ? 1 : 0, m_contextModels[OFF_PART_SIZE_CTX + 3]);
if (partSize != SIZE_Nx2N)
{
m_binIf->encodeBinEP((partSize == SIZE_nLx2N ? 0 : 1));
More information about the x265-devel
mailing list