Skip to content
Snippets Groups Projects
Commit 89749f2e authored by Yukinobu Yasugi's avatar Yukinobu Yasugi
Browse files

JVET_M0064_CCLM_SIMPLIFICATION: replace calculations of CCLM parameter

  * Division table reduction
  * bit-width restriction
parent e880934c
No related branches found
No related tags found
1 merge request!164JVET-M0064: CCLM Simplification
......@@ -1784,6 +1784,37 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component
if (leftAvailable || aboveAvailable)
{
#if JVET_M0064_CCLM_SIMPLIFICATION
int diff = maxLuma[0] - minLuma[0];
if (diff > 0)
{
int diffC = maxLuma[1] - minLuma[1];
int x = floorLog2( diff );
static const uint8_t DivSigTable[1 << 4] = {
// 4bit significands - 8 ( MSB is omitted )
0, 7, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 0
};
int normDiff = (diff << 4 >> x) & 15;
int v = DivSigTable[normDiff] | 8;
x += normDiff != 0;
int y = floorLog2( abs( diffC ) ) + 1;
int add = 1 << y >> 1;
a = (diffC * v + add) >> y;
iShift = 3 + x - y;
if ( iShift < 1 ) {
iShift = 1;
a = ( (a == 0)? 0: (a < 0)? -15 : 15 ); // a=Sign(a)*15
}
b = minLuma[1] - ((a * minLuma[0]) >> iShift);
}
else
{
a = 0;
b = minLuma[1];
iShift = 0;
}
#else // original
a = 0;
iShift = 16;
int shift = (internalBitDepth > 8) ? internalBitDepth - 9 : 0;
......@@ -1795,6 +1826,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component
a = (((maxLuma[1] - minLuma[1]) * g_aiLMDivTableHigh[diff - 1] + div + add) >> shift);
}
b = minLuma[1] - ((a * minLuma[0]) >> iShift);
#endif
}
else
{
......
......@@ -180,6 +180,7 @@ public:
return rtn;
}
};
#if !JVET_M0064_CCLM_SIMPLIFICATION
int g_aiLMDivTableLow[] = {
0, 0, 21845, 0, 13107, 43690, 18724, 0, 50972, 39321, 53620, 21845, 15123, 9362, 4369, 0, 3855,
58254, 17246, 52428, 49932, 59578, 25644, 43690, 28835, 40329, 16990, 37449, 56496, 34952, 4228, 0, 61564, 34695,
......@@ -244,6 +245,7 @@ int g_aiLMDivTableHigh[] = {
134, 134, 134, 133, 133, 133, 132, 132, 132, 132, 131, 131, 131, 131, 130, 130, 130, 130,
129, 129, 129, 129, 128, 128, 128, 128,
};
#endif
const int8_t g_GbiLog2WeightBase = 3;
const int8_t g_GbiWeightBase = (1 << g_GbiLog2WeightBase);
const int8_t g_GbiWeights[GBI_NUM] = { -2, 3, 4, 5, 10 };
......
......@@ -214,8 +214,10 @@ extern const uint32_t g_scalingListSizeX[SCALING_LIST_SIZE_NUM];
extern MsgLevel g_verbosity;
#if !JVET_M0064_CCLM_SIMPLIFICATION
extern int g_aiLMDivTableLow[];
extern int g_aiLMDivTableHigh[];
#endif
extern const int g_aiNonLMPosThrs[];
......
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_M0064_CCLM_SIMPLIFICATION 1
#define JVET_M0479_18BITS_MV_CLIP 1
#define JVET_M0502_PRED_MODE_CTX 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment