Commit 4ebd35fa authored by Yu Han's avatar Yu Han Committed by Xiang Li
Browse files

JVET-O1168: cu chroma QP offset

parent 24b520d5
......@@ -112,7 +112,16 @@ QpParam::QpParam(const TransformUnit& tu, const ComponentID &compIDX, const int
chromaQpOffset += tu.cs->pps->getQpOffset ( tu.jointCbCr ? JOINT_CbCr : compID );
chromaQpOffset += tu.cs->slice->getSliceChromaQpDelta( tu.jointCbCr ? JOINT_CbCr : compID );
#endif
#if JVET_O1168_CU_CHROMA_QP_OFFSET
#if JVET_O0105_ICT
chromaQpOffset += tu.cs->pps->getPpsRangeExtension().getChromaQpOffsetListEntry( tu.cu->chromaQpAdj ).u.offset[int( useJQP ? JOINT_CbCr : compID ) - 1];
#else
chromaQpOffset += tu.cs->pps->getPpsRangeExtension().getChromaQpOffsetListEntry( tu.cu->chromaQpAdj ).u.offset[int( tu.jointCbCr ? JOINT_CbCr : compID ) - 1];
#endif
#else
chromaQpOffset += tu.cs->pps->getPpsRangeExtension().getChromaQpOffsetListEntry( tu.cu->chromaQpAdj ).u.offset[int( compID ) - 1];
#endif
}
int dqp = 0;
......
......@@ -1495,6 +1495,9 @@ PPSRExt::PPSRExt()
{
m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CbOffset = 0; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0. This is initialised here and never subsequently changed.
m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CrOffset = 0;
#if JVET_O1168_CU_CHROMA_QP_OFFSET
m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.JointCbCrOffset = 0;
#endif
for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
{
m_log2SaoOffsetScale[ch] = 0;
......
......@@ -399,8 +399,15 @@ struct ChromaQpAdj
struct {
int CbOffset;
int CrOffset;
#if JVET_O1168_CU_CHROMA_QP_OFFSET
int JointCbCrOffset;
#endif
} comp;
#if JVET_O1168_CU_CHROMA_QP_OFFSET
int offset[3];
#else
int offset[2]; /* two chroma components */
#endif
} u;
};
......@@ -1066,11 +1073,18 @@ public:
return m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1]; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise
}
#if JVET_O1168_CU_CHROMA_QP_OFFSET
void setChromaQpOffsetListEntry( int cuChromaQpOffsetIdxPlus1, int cbOffset, int crOffset, int jointCbCrOffset )
#else
void setChromaQpOffsetListEntry( int cuChromaQpOffsetIdxPlus1, int cbOffset, int crOffset )
#endif
{
CHECK(cuChromaQpOffsetIdxPlus1 == 0 || cuChromaQpOffsetIdxPlus1 > MAX_QP_OFFSET_LIST_SIZE, "Invalid chroma QP offset");
m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.CbOffset = cbOffset; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise
m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.CrOffset = crOffset;
#if JVET_O1168_CU_CHROMA_QP_OFFSET
m_ChromaQpAdjTableIncludingNullEntry[cuChromaQpOffsetIdxPlus1].u.comp.JointCbCrOffset = jointCbCrOffset;
#endif
m_chromaQpOffsetListLen = std::max(m_chromaQpOffsetListLen, cuChromaQpOffsetIdxPlus1);
}
......
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_O1168_CU_CHROMA_QP_OFFSET 1 // JVET-O1168: cu chroma QP offset
#define JVET_O0368_LFNST_WITH_DCT2_ONLY 1 // JVET-O0368/O0292/O0521/O0466: disable LFNST for non-DCT2 MTS candidates normatively
#define JVET_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN 1 // JVET-O0106: use 4xN prediction regions for 1xN and 2xN subblocks
......@@ -71,7 +73,7 @@
#define JVET_O0065_CABAC_INIT 0 // JVET-O0065: CABAC initialization
#define JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT 1 // JVET-O0052 Method-1: TU-level context coded bin constraint
#define JVET_O0105_ICT 1 // JVET-O0105: inter-chroma transform (ICT) as extension of joint chroma coding (JCC)
#define JVET_O0543_ICT_ICU_ONLY 1 // JVET-O0543: ICT only in Intra CUs (was Intra slices, modified during adoption)
#define JVET_N0288_PROPOSAL1 1 // JVET-N0288 Proposal 1
......
......@@ -2506,7 +2506,11 @@ void CABACReader::transform_unit( TransformUnit& tu, CUCtx& cuCtx, ChromaCbfs& c
cuCtx.isDQPCoded = true;
}
}
#if JVET_O1168_CU_CHROMA_QP_OFFSET
if (cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cuCtx.isChromaQpAdjCoded)
#else
if( cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cu.transQuantBypass && !cuCtx.isChromaQpAdjCoded )
#endif
{
cu_chroma_qp_offset( cu );
cuCtx.isChromaQpAdjCoded = true;
......
......@@ -712,12 +712,23 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana
{
int cbOffset;
int crOffset;
#if JVET_O1168_CU_CHROMA_QP_OFFSET
int jointCbCrOffset;
#endif
READ_SVLC(cbOffset, "cb_qp_offset_list[i]");
CHECK(cbOffset < -12 || cbOffset > 12, "Invalid chroma QP offset");
READ_SVLC(crOffset, "cr_qp_offset_list[i]");
CHECK(crOffset < -12 || crOffset > 12, "Invalid chroma QP offset");
#if JVET_O1168_CU_CHROMA_QP_OFFSET
READ_SVLC(jointCbCrOffset, "joint_cbcr_qp_offset_list[i]");
CHECK(jointCbCrOffset < -12 || jointCbCrOffset > 12, "Invalid chroma QP offset");
#endif
// table uses +1 for index (see comment inside the function)
#if JVET_O1168_CU_CHROMA_QP_OFFSET
ppsRangeExtension.setChromaQpOffsetListEntry(cuChromaQpOffsetIdx + 1, cbOffset, crOffset, jointCbCrOffset);
#else
ppsRangeExtension.setChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1, cbOffset, crOffset);
#endif
}
CHECK(ppsRangeExtension.getChromaQpOffsetListLen() != tableSizeMinus1 + 1, "Invalid chroma QP offset list lenght");
}
......
......@@ -2391,7 +2391,11 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC
cuCtx.isDQPCoded = true;
}
}
#if JVET_O1168_CU_CHROMA_QP_OFFSET
if (cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cuCtx.isChromaQpAdjCoded)
#else
if( cu.cs->slice->getUseChromaQpAdj() && cbfChroma && !cu.transQuantBypass && !cuCtx.isChromaQpAdjCoded )
#endif
{
cu_chroma_qp_offset( cu );
cuCtx.isChromaQpAdjCoded = true;
......
......@@ -1111,7 +1111,11 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
{
pps.getPpsRangeExtension().setCuChromaQpOffsetSubdiv(m_cuChromaQpOffsetSubdiv);
pps.getPpsRangeExtension().clearChromaQpOffsetList();
#if JVET_O1168_CU_CHROMA_QP_OFFSET
pps.getPpsRangeExtension().setChromaQpOffsetListEntry(1, 6, 6, 6);
#else
pps.getPpsRangeExtension().setChromaQpOffsetListEntry(1, 6, 6);
#endif
/* todo, insert table entries from command line (NB, 0 should not be touched) */
}
else
......
......@@ -428,6 +428,9 @@ void HLSWriter::codePPS( const PPS* pcPPS )
{
WRITE_SVLC(ppsRangeExtension.getChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1).u.comp.CbOffset, "cb_qp_offset_list[i]");
WRITE_SVLC(ppsRangeExtension.getChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1).u.comp.CrOffset, "cr_qp_offset_list[i]");
#if JVET_O1168_CU_CHROMA_QP_OFFSET
WRITE_SVLC(ppsRangeExtension.getChromaQpOffsetListEntry(cuChromaQpOffsetIdx + 1).u.comp.JointCbCrOffset, "joint_cbcr_qp_offset_list[i]");
#endif
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment