From a3b04c5b734d82cc4e5497a4164704a6370d6523 Mon Sep 17 00:00:00 2001 From: Frank Bossen <fbossen@gmail.com> Date: Fri, 17 Jan 2020 15:29:57 +0100 Subject: [PATCH] remove macro JVET_P0077_LINE_CG_PALETTE --- source/Lib/CommonLib/CodingStructure.cpp | 19 -- source/Lib/CommonLib/CodingStructure.h | 3 - source/Lib/CommonLib/CommonDef.h | 7 - source/Lib/CommonLib/ContextModelling.cpp | 2 - source/Lib/CommonLib/ContextModelling.h | 2 - source/Lib/CommonLib/IntraPrediction.cpp | 92 -------- source/Lib/CommonLib/IntraPrediction.h | 12 - source/Lib/CommonLib/Rom.cpp | 4 - source/Lib/CommonLib/TypeDef.h | 1 - source/Lib/CommonLib/Unit.cpp | 26 --- source/Lib/CommonLib/Unit.h | 14 -- source/Lib/DecoderLib/CABACReader.cpp | 267 ---------------------- source/Lib/DecoderLib/CABACReader.h | 7 - source/Lib/EncoderLib/CABACWriter.cpp | 252 -------------------- source/Lib/EncoderLib/CABACWriter.h | 9 - source/Lib/EncoderLib/EncLib.cpp | 4 - source/Lib/EncoderLib/EncModeCtrl.cpp | 26 --- source/Lib/EncoderLib/EncModeCtrl.h | 3 - source/Lib/EncoderLib/IntraSearch.cpp | 239 ------------------- source/Lib/EncoderLib/IntraSearch.h | 15 -- 20 files changed, 1004 deletions(-) diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 9876c4010..336daef4f 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -82,9 +82,6 @@ CodingStructure::CodingStructure(CUCache& cuCache, PUCache& puCache, TUCache& tu for (uint32_t i = 0; i < MAX_NUM_CHANNEL_TYPE; i++) { m_runType[i] = nullptr; -#if !JVET_P0077_LINE_CG_PALETTE - m_runLength[i] = nullptr; -#endif } for( uint32_t i = 0; i < MAX_NUM_CHANNEL_TYPE; i++ ) @@ -610,9 +607,6 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c TCoeff *coeffs[5] = { nullptr, nullptr, nullptr, nullptr, nullptr }; Pel *pcmbuf[5] = { nullptr, nullptr, nullptr, nullptr, nullptr }; bool *runType[5] = { nullptr, nullptr, nullptr, nullptr, nullptr }; -#if !JVET_P0077_LINE_CG_PALETTE - Pel *runLength[5] = { nullptr, nullptr, nullptr, nullptr, nullptr }; -#endif uint32_t numCh = ::getNumberValidComponents( area.chromaFormat ); @@ -653,19 +647,12 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c if (i < MAX_NUM_CHANNEL_TYPE) { if (m_runType[i] != nullptr) runType[i] = m_runType[i] + m_offsets[i]; -#if !JVET_P0077_LINE_CG_PALETTE - if (m_runLength[i] != nullptr) runLength[i] = m_runLength[i] + m_offsets[i]; -#endif } unsigned areaSize = tu->blocks[i].area(); m_offsets[i] += areaSize; } -#if JVET_P0077_LINE_CG_PALETTE tu->init(coeffs, pcmbuf, runType); -#else - tu->init( coeffs, pcmbuf, runLength, runType); -#endif return *tu; } @@ -957,9 +944,6 @@ void CodingStructure::createCoeffs(const bool isPLTused) unsigned _area = area.blocks[i].area(); m_runType[i] = _area > 0 ? (bool*)xMalloc(bool, _area) : nullptr; -#if !JVET_P0077_LINE_CG_PALETTE - m_runLength[i] = _area > 0 ? (Pel*)xMalloc(Pel, _area) : nullptr; -#endif } } } @@ -975,9 +959,6 @@ void CodingStructure::destroyCoeffs() for (uint32_t i = 0; i < MAX_NUM_CHANNEL_TYPE; i++) { if (m_runType[i]) { xFree(m_runType[i]); m_runType[i] = nullptr; } -#if !JVET_P0077_LINE_CG_PALETTE - if (m_runLength[i]) { xFree(m_runLength[i]); m_runLength[i] = nullptr; } -#endif } } diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index b7ffa1789..317e330ba 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -231,9 +231,6 @@ private: TCoeff *m_coeffs [ MAX_NUM_COMPONENT ]; Pel *m_pcmbuf [ MAX_NUM_COMPONENT ]; bool *m_runType[ MAX_NUM_CHANNEL_TYPE ]; -#if !JVET_P0077_LINE_CG_PALETTE - Pel *m_runLength[MAX_NUM_CHANNEL_TYPE]; -#endif int m_offsets[ MAX_NUM_COMPONENT ]; MotionInfo *m_motionBuf; diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 3c7c7e51d..f83880246 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -466,22 +466,15 @@ static const int FP_PREC = 11; static const int CSCALE_FP_PREC = 11; static const int NEIG_NUM_LOG = 6; static const int NEIG_NUM = 1 << NEIG_NUM_LOG; -#if JVET_P0077_LINE_CG_PALETTE static const int LOG2_PALETTE_CG_SIZE = 4; static const int RUN_IDX_THRE = 4; static const int MAX_CU_BLKSIZE_PLT = 64; static const int NUM_TRELLIS_STATE = 3; static const double ENC_CHROMA_WEIGHTING = 0.8; -#endif static const int MAXPLTPREDSIZE = 63; static const int MAXPLTSIZE = 31; static const double PLT_CHROMA_WEIGHTING = 0.8; static const int PLT_ENCBITDEPTH = 8; -#if !JVET_P0077_LINE_CG_PALETTE -static const int PLT_RUN_MSB_IDX_CABAC_BYPASS_THRE = 4; -static const int PLT_RUN_MSB_IDX_CTX_T1 = 1; -static const int PLT_RUN_MSB_IDX_CTX_T2 = 3; -#endif static const int PLT_FAST_RATIO = 100; #if RExt__DECODER_DEBUG_TOOL_MAX_FRAME_STATS static const int EPBIN_WEIGHT_FACTOR = 4; diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index dac605f0c..a8cd73368 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -539,7 +539,6 @@ unsigned DeriveCtx::CtxMipFlag( const CodingUnit& cu ) return ctxId; } -#if JVET_P0077_LINE_CG_PALETTE unsigned DeriveCtx::CtxPltCopyFlag( const unsigned prevRunType, const unsigned dist ) { uint8_t *ucCtxLut = (prevRunType == PLT_RUN_INDEX) ? g_paletteRunLeftLut : g_paletteRunTopLut; @@ -552,4 +551,3 @@ unsigned DeriveCtx::CtxPltCopyFlag( const unsigned prevRunType, const unsigned d return ucCtxLut[RUN_IDX_THRE]; } } -#endif diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h index 3d0c30613..2d107e472 100644 --- a/source/Lib/CommonLib/ContextModelling.h +++ b/source/Lib/CommonLib/ContextModelling.h @@ -513,9 +513,7 @@ unsigned CtxAffineFlag( const CodingUnit& cu ); unsigned CtxPredModeFlag( const CodingUnit& cu ); unsigned CtxIBCFlag(const CodingUnit& cu); unsigned CtxMipFlag ( const CodingUnit& cu ); -#if JVET_P0077_LINE_CG_PALETTE unsigned CtxPltCopyFlag( const unsigned prevRunType, const unsigned dist ); -#endif } #endif // __CONTEXTMODELLING__ diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp index 914fd9943..696b1beb3 100644 --- a/source/Lib/CommonLib/IntraPrediction.cpp +++ b/source/Lib/CommonLib/IntraPrediction.cpp @@ -86,10 +86,6 @@ IntraPrediction::IntraPrediction() m_piTemp = nullptr; m_pMdlmTemp = nullptr; -#if !JVET_P0077_LINE_CG_PALETTE - m_runTypeRD = nullptr; - m_runLengthRD = nullptr; -#endif } IntraPrediction::~IntraPrediction() @@ -112,10 +108,6 @@ void IntraPrediction::destroy() m_piTemp = nullptr; delete[] m_pMdlmTemp; m_pMdlmTemp = nullptr; -#if !JVET_P0077_LINE_CG_PALETTE - if (m_runTypeRD) { xFree( m_runTypeRD ); m_runTypeRD = NULL; } - if (m_runLengthRD) { xFree( m_runLengthRD); m_runLengthRD = NULL; } -#endif } void IntraPrediction::init(ChromaFormat chromaFormatIDC, const unsigned bitDepthY) @@ -150,16 +142,6 @@ void IntraPrediction::init(ChromaFormat chromaFormatIDC, const unsigned bitDepth { m_pMdlmTemp = new Pel[(2 * MAX_CU_SIZE + 1)*(2 * MAX_CU_SIZE + 1)];//MDLM will use top-above and left-below samples. } -#if !JVET_P0077_LINE_CG_PALETTE - if (m_runTypeRD == nullptr) - { - m_runTypeRD = (bool *) xMalloc(bool, MAX_CU_SIZE * MAX_CU_SIZE); - } - if (m_runLengthRD == nullptr) - { - m_runLengthRD = (Pel *) xMalloc(Pel, MAX_CU_SIZE * MAX_CU_SIZE); - } -#endif } // ==================================================================================================================== @@ -1856,80 +1838,6 @@ void IntraPrediction::predIntraMip( const ComponentID compId, PelBuf &piPred, co } } } -#if !JVET_P0077_LINE_CG_PALETTE -bool IntraPrediction::calCopyRun(CodingStructure &cs, Partitioner& partitioner, uint32_t startPos, uint32_t total, uint32_t &run, ComponentID compBegin) -{ - CodingUnit &cu = *cs.getCU(partitioner.chType); - TransformUnit &tu = *cs.getTU(partitioner.chType); - PelBuf curPLTIdx = tu.getcurPLTIdx(compBegin); - PLTtypeBuf runType = tu.getrunType(compBegin); - - uint32_t idx = startPos; - uint32_t xPos; - uint32_t yPos; - bool valid = false; - run = 0; - while (idx < total) - { - xPos = m_scanOrder[idx].x; - yPos = m_scanOrder[idx].y; - runType.at(xPos, yPos) = PLT_RUN_COPY; - - if (yPos == 0 && !cu.useRotation[compBegin]) - { - return false; - } - if (xPos == 0 && cu.useRotation[compBegin]) - { - return false; - } - if (!cu.useRotation[compBegin] && curPLTIdx.at(xPos, yPos) == curPLTIdx.at(xPos, yPos - 1)) - { - run++; - valid = true; - } - else if (cu.useRotation[compBegin] && curPLTIdx.at(xPos, yPos) == curPLTIdx.at(xPos - 1, yPos)) - { - run++; - valid = true; - } - else - { - break; - } - idx++; - } - return valid; -} -bool IntraPrediction::calIndexRun(CodingStructure &cs, Partitioner& partitioner, uint32_t startPos, uint32_t total, uint32_t &run, ComponentID compBegin) -{ - TransformUnit &tu = *cs.getTU(partitioner.chType); - PelBuf curPLTIdx = tu.getcurPLTIdx(compBegin); - PLTtypeBuf runType = tu.getrunType(compBegin); - - run = 1; - uint32_t idx = startPos; - while (idx < total) - { - uint32_t xPos = m_scanOrder[idx].x; - uint32_t yPos = m_scanOrder[idx].y; - runType.at(xPos, yPos) = PLT_RUN_INDEX; - - uint32_t xPrev = idx == 0 ? 0 : m_scanOrder[idx - 1].x; - uint32_t yPrev = idx == 0 ? 0 : m_scanOrder[idx - 1].y; - if (idx > startPos && curPLTIdx.at(xPos, yPos) == curPLTIdx.at(xPrev, yPrev)) - { - run++; - } - else if (idx > startPos) - { - break; - } - idx++; - } - return true; -} -#endif void IntraPrediction::reorderPLT(CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp) { CodingUnit &cu = *cs.getCU(partitioner.chType); diff --git a/source/Lib/CommonLib/IntraPrediction.h b/source/Lib/CommonLib/IntraPrediction.h index bb5fc44b0..d8a8f4a23 100644 --- a/source/Lib/CommonLib/IntraPrediction.h +++ b/source/Lib/CommonLib/IntraPrediction.h @@ -117,14 +117,6 @@ protected: int m_leftRefLength; ScanElement* m_scanOrder; bool m_bestScanRotationMode; -#if !JVET_P0077_LINE_CG_PALETTE - Ctx m_storeCtxRun; - Ctx m_storeCtxRunIndex; - Ctx m_storeCtxRunCopy; - Ctx m_orgCtxRD; - bool *m_runTypeRD; - Pel *m_runLengthRD; -#endif // prediction void xPredIntraPlanar ( const CPelBuf &pSrc, PelBuf &pDst ); void xPredIntraDc ( const CPelBuf &pSrc, PelBuf &pDst, const ChannelType channelType, const bool enableBoundaryFilter = true ); @@ -177,10 +169,6 @@ public: void switchBuffer (const PredictionUnit &pu, ComponentID compID, PelBuf srcBuff, Pel *dst); void geneIntrainterPred (const CodingUnit &cu); void reorderPLT (CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); -#if !JVET_P0077_LINE_CG_PALETTE - bool calCopyRun (CodingStructure &cs, Partitioner& partitioner, uint32_t startPos, uint32_t total, uint32_t &run, ComponentID compBegin); - bool calIndexRun (CodingStructure &cs, Partitioner& partitioner, uint32_t startPos, uint32_t total, uint32_t &run, ComponentID compBegin); -#endif }; //! \} diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index 25a490a27..96b06bdd1 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -721,9 +721,5 @@ bool g_isReusedUniMVsFilled[32][32][8][8]; const uint8_t g_paletteQuant[52] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 24, 23, 25, 26, 28, 29, 31, 32, 34, 36, 37, 39, 41, 42, 45 }; uint8_t g_paletteRunTopLut [5] = { 0, 1, 1, 2, 2 }; -#if JVET_P0077_LINE_CG_PALETTE uint8_t g_paletteRunLeftLut[5] = { 0, 1, 2, 3, 4 }; -#else -uint8_t g_paletteRunLeftLut[5] = { 0, 3, 3, 4, 4 }; -#endif //! \} diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 1dd12e591..08e3e2783 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -130,7 +130,6 @@ -#define JVET_P0077_LINE_CG_PALETTE 1 // JVET-P0077: Line CG palette mode #define JVET_P0164_ALF_SYNTAX_SIMP 1 // JVET-p0164: simplify alf syntax with method2 diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 05b3a6f18..041b241b8 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -709,9 +709,6 @@ TransformUnit::TransformUnit(const UnitArea& unit) : UnitArea(unit), cu(nullptr) for (unsigned i = 0; i < MAX_NUM_TBLOCKS - 1; i++) { m_runType[i] = nullptr; -#if !JVET_P0077_LINE_CG_PALETTE - m_runLength[i] = nullptr; -#endif } initData(); @@ -728,9 +725,6 @@ TransformUnit::TransformUnit(const ChromaFormat _chromaFormat, const Area &_area for (unsigned i = 0; i < MAX_NUM_TBLOCKS - 1; i++) { m_runType[i] = nullptr; -#if !JVET_P0077_LINE_CG_PALETTE - m_runLength[i] = nullptr; -#endif } initData(); @@ -750,11 +744,7 @@ void TransformUnit::initData() jointCbCr = 0; m_chromaResScaleInv = 0; } -#if JVET_P0077_LINE_CG_PALETTE void TransformUnit::init(TCoeff **coeffs, Pel **pcmbuf, bool **runType) -#else -void TransformUnit::init(TCoeff **coeffs, Pel **pcmbuf, Pel **runLength, bool **runType) -#endif { uint32_t numBlocks = getNumberValidTBlocks(*cs->pcv); @@ -767,9 +757,6 @@ void TransformUnit::init(TCoeff **coeffs, Pel **pcmbuf, Pel **runLength, bool ** for (uint32_t i = 0; i < numBlocks - 1; i++) { m_runType[i] = runType[i]; -#if !JVET_P0077_LINE_CG_PALETTE - m_runLength[i] = runLength[i]; -#endif } } @@ -789,9 +776,6 @@ TransformUnit& TransformUnit::operator=(const TransformUnit& other) if (cu->slice->getSPS()->getPLTMode() && i < 2) { if (m_runType[i] && other.m_runType[i] && m_runType[i] != other.m_runType[i] ) memcpy(m_runType[i], other.m_runType[i], sizeof(bool) * area); -#if !JVET_P0077_LINE_CG_PALETTE - if (m_runLength[i] && other.m_runLength[i] && m_runLength[i] != other.m_runLength[i]) memcpy(m_runLength[i], other.m_runLength[i], sizeof(Pel) * area ); -#endif } cbf[i] = other.cbf[i]; rdpcm[i] = other.rdpcm[i]; @@ -817,9 +801,6 @@ void TransformUnit::copyComponentFrom(const TransformUnit& other, const Componen if ((i == COMPONENT_Y || i == COMPONENT_Cb)) { if (m_runType[i] && other.m_runType[i] && m_runType[i] != other.m_runType[i]) memcpy(m_runType[i], other.m_runType[i], sizeof(bool) * area); -#if !JVET_P0077_LINE_CG_PALETTE - if (m_runLength[i] && other.m_runLength[i] && m_runLength[i] != other.m_runLength[i]) memcpy(m_runLength[i], other.m_runLength[i], sizeof(Pel) * area); -#endif } cbf[i] = other.cbf[i]; @@ -841,10 +822,6 @@ const CPelBuf TransformUnit::getPcmbuf(const ComponentID id) const { return CP PelBuf TransformUnit::getcurPLTIdx(const ComponentID id) { return PelBuf(m_pcmbuf[id], blocks[id]); } const CPelBuf TransformUnit::getcurPLTIdx(const ComponentID id) const { return CPelBuf(m_pcmbuf[id], blocks[id]); } -#if !JVET_P0077_LINE_CG_PALETTE - PelBuf TransformUnit::getrunLength(const ComponentID id) { return PelBuf(m_runLength[id], blocks[id]); } -const CPelBuf TransformUnit::getrunLength(const ComponentID id) const { return CPelBuf(m_runLength[id], blocks[id]); } -#endif PLTtypeBuf TransformUnit::getrunType (const ComponentID id) { return PLTtypeBuf(m_runType[id], blocks[id]); } const CPLTtypeBuf TransformUnit::getrunType (const ComponentID id) const { return CPLTtypeBuf(m_runType[id], blocks[id]); } @@ -852,9 +829,6 @@ const CPLTtypeBuf TransformUnit::getrunType (const ComponentID id) const { const CPLTescapeBuf TransformUnit::getescapeValue(const ComponentID id) const { return CPLTescapeBuf(m_coeffs[id], blocks[id]); } Pel* TransformUnit::getPLTIndex (const ComponentID id) { return m_pcmbuf[id]; } -#if !JVET_P0077_LINE_CG_PALETTE - Pel* TransformUnit::getRunLens (const ComponentID id) { return m_runLength[id]; } -#endif bool* TransformUnit::getRunTypes (const ComponentID id) { return m_runType[id]; } void TransformUnit::checkTuNoResidual( unsigned idx ) diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index 60bb51f7e..91130a722 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -469,11 +469,7 @@ struct TransformUnit : public UnitArea unsigned idx; TransformUnit *next; TransformUnit *prev; -#if JVET_P0077_LINE_CG_PALETTE void init(TCoeff **coeffs, Pel **pcmbuf, bool **runType); -#else - void init(TCoeff **coeffs, Pel **pcmbuf, Pel **runLength, bool **runType); -#endif TransformUnit& operator=(const TransformUnit& other); void copyComponentFrom (const TransformUnit& other, const ComponentID compID); @@ -488,18 +484,11 @@ struct TransformUnit : public UnitArea void setChromaAdj(int i); PelBuf getcurPLTIdx(const ComponentID id); const CPelBuf getcurPLTIdx(const ComponentID id) const; -#if !JVET_P0077_LINE_CG_PALETTE - PelBuf getrunLength(const ComponentID id); - const CPelBuf getrunLength(const ComponentID id) const; -#endif PLTtypeBuf getrunType(const ComponentID id); const CPLTtypeBuf getrunType(const ComponentID id) const; PLTescapeBuf getescapeValue(const ComponentID id); const CPLTescapeBuf getescapeValue(const ComponentID id) const; Pel* getPLTIndex(const ComponentID id); -#if !JVET_P0077_LINE_CG_PALETTE - Pel* getRunLens(const ComponentID id); -#endif bool* getRunTypes(const ComponentID id); #if ENABLE_SPLIT_PARALLELISM @@ -511,9 +500,6 @@ private: TCoeff *m_coeffs[ MAX_NUM_TBLOCKS ]; Pel *m_pcmbuf[ MAX_NUM_TBLOCKS ]; bool *m_runType[ MAX_NUM_TBLOCKS - 1 ]; -#if !JVET_P0077_LINE_CG_PALETTE - Pel *m_runLength[MAX_NUM_TBLOCKS - 1]; -#endif }; // --------------------------------------------------------------------------- diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index df754ed72..7e050d8e9 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -1633,15 +1633,9 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_ } uint32_t indexMaxSize = cu.useEscape[compBegin] ? (cu.curPLTSize[compBegin] + 1) : cu.curPLTSize[compBegin]; //encode index map -#if !JVET_P0077_LINE_CG_PALETTE - PLTtypeBuf runType = tu.getrunType(compBegin); - PelBuf runLength = tu.getrunLength(compBegin); - PelBuf curPLTIdx = tu.getcurPLTIdx(compBegin); -#endif uint32_t height = cu.block(compBegin).height; uint32_t width = cu.block(compBegin).width; -#if JVET_P0077_LINE_CG_PALETTE uint32_t total = height * width; if (indexMaxSize > 1) parseScanRotationModeFlag(cu, compBegin); @@ -1673,198 +1667,7 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_ { cuPaletteSubblockInfo(cu, compBegin, numComp, subSetId, prevRunPos, prevRunType); } -#else - int numCopyIndexRuns = -1; - bool lastRunType = 0; - uint32_t numIndices = 0; - uint32_t adjust = 0; - uint32_t symbol = 0; - std::list<int> parsedIdxList; - if (indexMaxSize > 1) - { - uint32_t currParam = 3 + ((indexMaxSize) >> 3); - numIndices = m_BinDecoder.decodeRemAbsEP(currParam, COEF_REMAIN_BIN_REDUCTION, MAX_NUM_CHANNEL_TYPE); // JC: number of indices (INDEX RUN) - numIndices++; - numCopyIndexRuns = numIndices; - while (numIndices--) - { - xReadTruncBinCode(symbol, indexMaxSize - adjust); - adjust = 1; - parsedIdxList.push_back(symbol); - } - lastRunType = m_BinDecoder.decodeBin(Ctx::RunTypeFlag()); - parseScanRotationModeFlag(cu, compBegin); - adjust = 0; - } - else - { - cu.useRotation[compBegin] = false; - } - - if (cu.useEscape[compBegin] && cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded) - { - if (!cu.isSepTree() || isLuma(tu.chType)) - { - cu_qp_delta(cu, cuCtx.qp, cu.qp); - cuCtx.qp = cu.qp; - cuCtx.isDQPCoded = true; - } - } - if (cu.useEscape[compBegin] && cu.cs->slice->getUseChromaQpAdj() && !cuCtx.isChromaQpAdjCoded) - { - if (!cu.isSepTree() || isChroma(tu.chType)) - { - cu_chroma_qp_offset(cu); - cuCtx.isChromaQpAdjCoded = true; - } - } - - - m_scanOrder = g_scanOrder[SCAN_UNGROUPED][(cu.useRotation[compBegin]) ? SCAN_TRAV_VER : SCAN_TRAV_HOR][gp_sizeIdxInfo->idxFrom(width)][gp_sizeIdxInfo->idxFrom(height)]; - uint32_t strPos = 0; - uint32_t endPos = height * width; - while (strPos < endPos) - { - uint32_t posy = m_scanOrder[strPos].y; - uint32_t posx = m_scanOrder[strPos].x; - uint32_t posyprev = strPos == 0 ? 0 : m_scanOrder[strPos - 1].y; - uint32_t posxprev = strPos == 0 ? 0 : m_scanOrder[strPos - 1].x; - - if (indexMaxSize > 1) - { - if (((posy == 0) && !cu.useRotation[compBegin]) || ((posx == 0) && cu.useRotation[compBegin])) - { - runType.at(posx, posy) = PLT_RUN_INDEX; - } - else if (strPos != 0 && runType.at(posxprev, posyprev) == PLT_RUN_COPY) - { - runType.at(posx, posy) = PLT_RUN_INDEX; - } - else - { - if (numCopyIndexRuns && strPos < endPos - 1) // JC: if numIndices (decoder will know this value) == 0 - > only CopyAbove, if strPos == endPos - 1, the last RunType was already coded - { - runType.at(posx, posy) = (m_BinDecoder.decodeBin(Ctx::RunTypeFlag())); - } - else - { - if (strPos == endPos - 1 && numCopyIndexRuns) - { - runType.at(posx, posy) = PLT_RUN_INDEX; - } - else - { - runType.at(posx, posy) = PLT_RUN_COPY; - } - } - } - } - else - { - runType.at(posx, posy) = PLT_RUN_INDEX; - } - - Pel curLevel = 0; - if (runType.at(posx, posy) == PLT_RUN_INDEX) - { - if (!parsedIdxList.empty()) - { - curLevel = parsedIdxList.front(); - parsedIdxList.pop_front(); - } - else - { - curLevel = 0; - } - xAdjustPLTIndex(cu, curLevel, strPos, curPLTIdx, runType, indexMaxSize, compBegin); - } - - if (indexMaxSize > 1) - { - bool lastRun; - numCopyIndexRuns -= (runType.at(posx, posy) == PLT_RUN_INDEX); - lastRun = numCopyIndexRuns == 0 && runType.at(posx, posy) == lastRunType; - if (!lastRun) - { - runLength.at(posx, posy) = cu_run_val((PLTRunMode)runType.at(posx, posy), curLevel, endPos - strPos - numCopyIndexRuns - 1 - lastRunType) + 1; - } - else - { - runLength.at(posx, posy) = endPos - strPos; - } - - } - else - { - runLength.at(posx, posy) = endPos - strPos; - } - - //assign run information - for (int runidx = 1; runidx < runLength.at(posx, posy); runidx++) - { - int posYrun, posXrun; - posYrun = m_scanOrder[strPos + runidx].y; - posXrun = m_scanOrder[strPos + runidx].x; - runType.at(posXrun, posYrun) = runType.at(posx, posy); - runLength.at(posXrun, posYrun) = runLength.at(posx, posy); - } - - uint32_t posYrun; - uint32_t posXrun; - if (runType.at(posx, posy) == PLT_RUN_INDEX) - { - for (uint32_t idx = 1; idx < runLength.at(posx, posy); idx++) - { - posYrun = m_scanOrder[strPos + idx].y; - posXrun = m_scanOrder[strPos + idx].x; - curPLTIdx.at(posXrun, posYrun) = curPLTIdx.at(posx, posy); - } - } - else if (runType.at(posx, posy) == PLT_RUN_COPY) - { - for (uint32_t idx = 0; idx < runLength.at(posx, posy); idx++) - { - posYrun = m_scanOrder[strPos + idx].y; - posXrun = m_scanOrder[strPos + idx].x; - curPLTIdx.at(posXrun, posYrun) = (cu.useRotation[compBegin]) ? curPLTIdx.at(posXrun - 1, posYrun) : curPLTIdx.at(posXrun, posYrun - 1); - } - } - strPos += (runLength.at(posx, posy)); - } - assert(strPos == endPos); - - uint32_t scaleX = getComponentScaleX(COMPONENT_Cb, sps.getChromaFormatIdc()); - uint32_t scaleY = getComponentScaleY(COMPONENT_Cb, sps.getChromaFormatIdc()); - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - ComponentID compID = (ComponentID)comp; - for (strPos = 0; strPos < endPos; strPos++) - { - uint32_t posy = m_scanOrder[strPos].y; - uint32_t posx = m_scanOrder[strPos].x; - if (curPLTIdx.at(posx, posy) == cu.curPLTSize[compBegin]) - { - { - PLTescapeBuf escapeValue = tu.getescapeValue((ComponentID)comp); - if (compID == COMPONENT_Y || compBegin != COMPONENT_Y) - { - escapeValue.at(posx, posy) = exp_golomb_eqprob(3); - assert(escapeValue.at(posx, posy) < (1 << (cu.cs->sps->getBitDepth(toChannelType((ComponentID)comp)) + 1))); - } - if (compBegin == COMPONENT_Y && compID != COMPONENT_Y && posy % (1 << scaleY) == 0 && posx % (1 << scaleX) == 0) - { - uint32_t posxC = posx >> scaleX; - uint32_t posyC = posy >> scaleY; - escapeValue.at(posxC, posyC) = exp_golomb_eqprob(3); - assert(escapeValue.at(posxC, posyC) < (1 << (cu.cs->sps->getBitDepth(toChannelType(compID)) + 1))); - } - } - } - } - } -#endif } -#if JVET_P0077_LINE_CG_PALETTE void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, uint32_t numComp, int subSetId, uint32_t& prevRunPos, unsigned& prevRunType) { const SPS& sps = *(cu.cs->sps); @@ -2012,7 +1815,6 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u } } } -#endif void CABACReader::parseScanRotationModeFlag(CodingUnit& cu, ComponentID compBegin) { cu.useRotation[compBegin] = m_BinDecoder.decodeBin(Ctx::RotationFlag()); @@ -2094,75 +1896,6 @@ void CABACReader::xAdjustPLTIndex(CodingUnit& cu, Pel curLevel, uint32_t idx, Pe } paletteIdx.at(posx, posy) = symbol; } -#if !JVET_P0077_LINE_CG_PALETTE -uint32_t CABACReader::cu_run_val(PLTRunMode runtype, const uint32_t paletteIdx, const uint32_t maxRun) -{ - uint32_t symbol = 0; - if (runtype == PLT_RUN_COPY) - { - } - else - { - g_paletteRunLeftLut[0] = (paletteIdx < PLT_RUN_MSB_IDX_CTX_T1 ? 0 : (paletteIdx < PLT_RUN_MSB_IDX_CTX_T2 ? 1 : 2)); - } - symbol = xReadTruncMsbP1RefinementBits(runtype, maxRun, PLT_RUN_MSB_IDX_CABAC_BYPASS_THRE); - return symbol; -} -uint32_t CABACReader::xReadTruncUnarySymbol(PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT) -{ - if (maxVal == 0) - return 0; - - uint8_t *ctxLut; - ctxLut = (runtype == PLT_RUN_INDEX) ? g_paletteRunLeftLut : g_paletteRunTopLut; - uint32_t bin, idx = 0; - do - { - if (idx > ctxT) - bin = m_BinDecoder.decodeBinEP(); - else - { - bin = m_BinDecoder.decodeBin( - (idx <= ctxT) - ? ((runtype == PLT_RUN_INDEX) ? Ctx::IdxRunModel(ctxLut[idx]) : Ctx::CopyRunModel(ctxLut[idx])) - : ((runtype == PLT_RUN_INDEX) ? Ctx::IdxRunModel(ctxLut[ctxT]) : Ctx::CopyRunModel(ctxLut[ctxT]))); - // idx <= ctxT? pcSCModel[ctxLut[idx]] : pcSCModel[ctxLut[ctxT]] RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(whichStat) ); - } - idx++; - } while (bin && idx < maxVal); - - return (bin && idx == maxVal) ? maxVal : idx - 1; -} -uint32_t CABACReader::xReadTruncMsbP1RefinementBits(PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT) -{ - if (maxVal == 0) - { - return 0; - } - uint32_t symbol; - uint32_t msbP1 = xReadTruncUnarySymbol(runtype, floorLog2(maxVal) + 1, ctxT); - if (msbP1 > 1) - { - uint32_t numBins = floorLog2(maxVal) + 1; - if (msbP1 < numBins) - { - uint32_t bits = msbP1 - 1; - symbol = m_BinDecoder.decodeBinsEP(bits); - symbol |= (1 << bits); - } - else - { - uint32_t curValue = 1 << (numBins - 1); - xReadTruncBinCode(symbol, maxVal + 1 - curValue); - symbol += curValue; - } - } - else - symbol = msbP1; - - return symbol; -} -#endif //================================================================================ // clause 7.3.8.6 diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h index f406728b6..132c50232 100644 --- a/source/Lib/DecoderLib/CABACReader.h +++ b/source/Lib/DecoderLib/CABACReader.h @@ -96,9 +96,7 @@ public: void mip_pred_modes ( CodingUnit& cu ); void mip_pred_mode ( PredictionUnit& pu ); void cu_palette_info ( CodingUnit& cu, ComponentID compBegin, uint32_t numComp, CUCtx& cuCtx ); -#if JVET_P0077_LINE_CG_PALETTE void cuPaletteSubblockInfo ( CodingUnit& cu, ComponentID compBegin, uint32_t numComp, int subSetId, uint32_t& prevRunPos, unsigned& prevRunType ); -#endif // prediction unit (clause 7.3.8.6) void prediction_unit ( PredictionUnit& pu, MergeCtx& mrgCtx ); void merge_flag ( PredictionUnit& pu ); @@ -155,11 +153,6 @@ private: void parseScanRotationModeFlag ( CodingUnit& cu, ComponentID compBegin ); void xDecodePLTPredIndicator ( CodingUnit& cu, uint32_t maxPLTSize, ComponentID compBegin ); void xAdjustPLTIndex ( CodingUnit& cu, Pel curLevel, uint32_t idx, PelBuf& paletteIdx, PLTtypeBuf& paletteRunType, int maxSymbol, ComponentID compBegin ); -#if !JVET_P0077_LINE_CG_PALETTE - uint32_t cu_run_val ( PLTRunMode runtype, const uint32_t pltIdx, const uint32_t maxRun ); - uint32_t xReadTruncUnarySymbol ( PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT ); - uint32_t xReadTruncMsbP1RefinementBits( PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT ); -#endif public: private: BinDecoderBase& m_BinDecoder; diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 0419deebc..af66f8d36 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -1449,17 +1449,11 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u m_BinEncoder.encodeBinEP(signalEscape); } //encode index map -#if !JVET_P0077_LINE_CG_PALETTE - PLTtypeBuf runType = tu.getrunType(compBegin); - PelBuf runLength = tu.getrunLength(compBegin); - PelBuf curPLTIdx = tu.getcurPLTIdx(compBegin); -#endif uint32_t height = cu.block(compBegin).height; uint32_t width = cu.block(compBegin).width; m_scanOrder = g_scanOrder[SCAN_UNGROUPED][(cu.useRotation[compBegin]) ? SCAN_TRAV_VER : SCAN_TRAV_HOR][gp_sizeIdxInfo->idxFrom(width)][gp_sizeIdxInfo->idxFrom(height)]; uint32_t total = height * width; -#if JVET_P0077_LINE_CG_PALETTE if (indexMaxSize > 1) codeScanRotationModeFlag(cu, compBegin); else @@ -1489,155 +1483,7 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u { cuPaletteSubblockInfo(cu, compBegin, numComp, subSetId, prevRunPos, prevRunType); } -#else - int lastRunPos = -1; - uint32_t lastRunType = 0; - uint32_t numIndices = 0; - std::vector<int> idxPos, parsedIdx; - idxPos.reserve(total); - parsedIdx.reserve(total); - if (indexMaxSize > 1) - { - int idx = 0, run = 0; - while (idx < total) - { - uint32_t posy = m_scanOrder[idx].y; - uint32_t posx = m_scanOrder[idx].x; - if (runType.at(posx, posy) == PLT_RUN_INDEX) - { - idxPos.push_back(idx); - numIndices++; - } - lastRunType = runType.at(posx, posy); - lastRunPos = idx; - run = runLength.at(posx, posy); - idx += run; - } - uint32_t currParam = 3 + ((indexMaxSize) >> 3); - uint32_t mappedValue; - assert(numIndices); - assert(numIndices > 0); - mappedValue = numIndices - 1; - m_BinEncoder.encodeRemAbsEP(mappedValue, currParam, COEF_REMAIN_BIN_REDUCTION, MAX_NUM_CHANNEL_TYPE); // JC: code number of indices (PLT_RUN_INDEX) - auto idxPosEnd = idxPos.end(); - for (auto iter = idxPos.begin(); iter != idxPosEnd; ++iter) - { - parsedIdx.push_back( writePLTIndex(cu, *iter, curPLTIdx, runType, indexMaxSize, compBegin)); - } - m_BinEncoder.encodeBin(lastRunType, Ctx::RunTypeFlag()); - codeScanRotationModeFlag(cu, compBegin); - } - else - { - assert(!cu.useRotation[compBegin]); - } - - if (cu.useEscape[compBegin] && cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded) - { - if (!cu.isSepTree() || isLuma(tu.chType)) - { - cu_qp_delta(cu, cuCtx.qp, cu.qp); - cuCtx.qp = cu.qp; - cuCtx.isDQPCoded = true; - } - } - if ( cu.useEscape[compBegin] && cu.cs->slice->getUseChromaQpAdj() && !cuCtx.isChromaQpAdjCoded) - { - if (!CS::isDualITree(*tu.cs) || isChroma(tu.chType)) - { - cu_chroma_qp_offset(cu); - cuCtx.isChromaQpAdjCoded = true; - } - } - - uint32_t strPos = 0; - uint32_t endPos = height * width; - auto parsedIdxEnd = parsedIdx.end(); - auto parsedIdxIter = parsedIdx.begin(); - while (strPos < endPos) - { - uint32_t posy = m_scanOrder[strPos].y; - uint32_t posx = m_scanOrder[strPos].x; - uint32_t posyprev = strPos == 0 ? 0 : m_scanOrder[strPos - 1].y; - uint32_t posxprev = strPos == 0 ? 0 : m_scanOrder[strPos - 1].x; - - if (indexMaxSize > 1) - { - if (((posy == 0) && !cu.useRotation[compBegin]) || ((posx == 0) && cu.useRotation[compBegin])) - - { - assert(runType.at(posx, posy) == PLT_RUN_INDEX); - } - else if (strPos != 0 && runType.at(posxprev, posyprev) == PLT_RUN_COPY) - { - assert(runType.at(posx, posy) == PLT_RUN_INDEX); - } - else - { - if (numIndices && strPos < endPos - 1) // if numIndices (decoder will know this value) == 0 - > only CopyAbove, if strPos == endPos - 1, the last RunType was already coded - { - m_BinEncoder.encodeBin((runType.at(posx, posy)), Ctx::RunTypeFlag()); - } - } - } - - Pel curLevel = 0; - if (runType.at(posx, posy) == PLT_RUN_INDEX) - { - if (parsedIdxIter != parsedIdxEnd) - { - curLevel = *parsedIdxIter++; - } - else - { - curLevel = 0; - } - } - - if (indexMaxSize > 1) - { - if (lastRunPos != strPos) - { - numIndices -= (runType.at(posx, posy) == PLT_RUN_INDEX); - cu_run_val(runLength.at(posx, posy) - 1, (PLTRunMode)runType.at(posx, posy), curLevel, endPos - strPos - numIndices - 1 - lastRunType); - } - - } - - strPos += (runLength.at(posx, posy)); - } - assert(strPos == endPos); - - uint32_t scaleX = getComponentScaleX(COMPONENT_Cb, sps.getChromaFormatIdc()); - uint32_t scaleY = getComponentScaleY(COMPONENT_Cb, sps.getChromaFormatIdc()); - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - ComponentID compID = (ComponentID)comp; - for (strPos = 0; strPos < endPos; strPos++) - { - uint32_t posy = m_scanOrder[strPos].y; - uint32_t posx = m_scanOrder[strPos].x; - if (curPLTIdx.at(posx, posy) == cu.curPLTSize[compBegin]) - { - { - PLTescapeBuf escapeValue = tu.getescapeValue((ComponentID)comp); - if (compID == COMPONENT_Y || compBegin != COMPONENT_Y) - { - exp_golomb_eqprob((unsigned)escapeValue.at(posx, posy), 3); - } - if (compBegin == COMPONENT_Y && compID != COMPONENT_Y && posy % (1 << scaleY) == 0 && posx % (1 << scaleX) == 0) - { - uint32_t posxC = posx >> scaleX; - uint32_t posyC = posy >> scaleY; - exp_golomb_eqprob((unsigned)escapeValue.at(posxC, posyC), 3); - } - } - } - } - } -#endif } -#if JVET_P0077_LINE_CG_PALETTE void CABACWriter::cuPaletteSubblockInfo(const CodingUnit& cu, ComponentID compBegin, uint32_t numComp, int subSetId, uint32_t& prevRunPos, unsigned& prevRunType) { const SPS& sps = *(cu.cs->sps); @@ -1745,7 +1591,6 @@ void CABACWriter::cuPaletteSubblockInfo(const CodingUnit& cu, ComponentID compBe } } } -#endif void CABACWriter::codeScanRotationModeFlag(const CodingUnit& cu, ComponentID compBegin) { m_BinEncoder.encodeBin((cu.useRotation[compBegin]), Ctx::RotationFlag()); @@ -1843,103 +1688,6 @@ Pel CABACWriter::writePLTIndex(const CodingUnit& cu, uint32_t idx, PelBuf& palet } return curLevel; } -#if !JVET_P0077_LINE_CG_PALETTE -void CABACWriter::encodeRunType(const CodingUnit& cu, PLTtypeBuf& runType, uint32_t idx, ScanElement *refScanOrder, ComponentID compBegin) -{ - if (refScanOrder) - { - m_scanOrder = refScanOrder; - } - uint32_t posy = m_scanOrder[idx].y; - uint32_t posx = m_scanOrder[idx].x; - uint32_t posyprev = (idx == 0) ? 0 : m_scanOrder[idx - 1].y; - uint32_t posxprev = (idx == 0) ? 0 : m_scanOrder[idx - 1].x; - - if (((posy == 0) && !cu.useRotation[compBegin]) || ((posx == 0) && cu.useRotation[compBegin])) - { - assert(runType.at(posx, posy) == PLT_RUN_INDEX); - } - else if (idx != 0 && runType.at(posxprev, posyprev) == PLT_RUN_COPY) - { - assert(runType.at(posx, posy) == PLT_RUN_INDEX); - } - else - { - m_BinEncoder.encodeBin((runType.at(posx, posy)), Ctx::RunTypeFlag()); - } -} -void CABACWriter::cu_run_val(uint32_t run, PLTRunMode runtype, const uint32_t paletteIdx, const uint32_t maxRun) -{ - if (runtype == PLT_RUN_COPY) - { - } - else - { - g_paletteRunLeftLut[0] = (paletteIdx < PLT_RUN_MSB_IDX_CTX_T1 ? 0 : (paletteIdx < PLT_RUN_MSB_IDX_CTX_T2 ? 1 : 2)); - } - xWriteTruncMsbP1RefinementBits(run, runtype, maxRun, PLT_RUN_MSB_IDX_CABAC_BYPASS_THRE); -} -uint32_t CABACWriter::xWriteTruncMsbP1(uint32_t symbol, PLTRunMode runtype, uint32_t uiMax, uint32_t uiCtxT) -{ - if (uiMax == 0) - return 0; - - uint8_t *ctxLut; - ctxLut = (runtype == PLT_RUN_INDEX) ? g_paletteRunLeftLut : g_paletteRunTopLut; - - uint32_t msbP1; - for (msbP1 = 0; symbol > 0; msbP1++) - { - symbol >>= 1; - if (msbP1 > uiCtxT) - { - m_BinEncoder.encodeBinEP(1); - } - else - m_BinEncoder.encodeBin(1, (msbP1 <= uiCtxT) - ? ((runtype == PLT_RUN_INDEX) ? Ctx::IdxRunModel(ctxLut[msbP1]) : Ctx::CopyRunModel(ctxLut[msbP1])) - : ((runtype == PLT_RUN_INDEX) ? Ctx::IdxRunModel(ctxLut[uiCtxT]) : Ctx::CopyRunModel(ctxLut[uiCtxT]))); - } - assert(msbP1 <= uiMax); - if (msbP1 < uiMax) - { - if (msbP1 > uiCtxT) - { - m_BinEncoder.encodeBinEP(0); - } - else - m_BinEncoder.encodeBin(0, msbP1 <= uiCtxT - ? ((runtype == PLT_RUN_INDEX) ? Ctx::IdxRunModel(ctxLut[msbP1]) : Ctx::CopyRunModel(ctxLut[msbP1])) - : ((runtype == PLT_RUN_INDEX) ? Ctx::IdxRunModel(ctxLut[uiCtxT]) : Ctx::CopyRunModel(ctxLut[uiCtxT]))); - - //m_pcBinIf->encodeBin(0, msbP1 <= uiCtxT? pcSCModel[ctxLut[msbP1]] : pcSCModel[ctxLut[uiCtxT]]); - } - return msbP1; -} - -void CABACWriter::xWriteTruncMsbP1RefinementBits(uint32_t symbol, PLTRunMode runtype, uint32_t maxVal, uint32_t uiCtxT) -{ - if (maxVal == 0) - return; - - uint32_t msbP1 = xWriteTruncMsbP1(symbol, runtype, floorLog2(maxVal) + 1, uiCtxT); - if (msbP1 > 1) - { - uint32_t numBins = floorLog2(maxVal) + 1; - if (msbP1 < numBins) - { - - uint32_t bits = msbP1 - 1; - m_BinEncoder.encodeBinsEP(symbol & ((1 << bits) - 1), bits); - } - else - { - uint32_t curValue = 1 << (numBins - 1); - xWriteTruncBinCode(symbol - curValue, maxVal + 1 - curValue); - } - } -} -#endif //================================================================================ diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h index daba8d27e..940fa4c22 100644 --- a/source/Lib/EncoderLib/CABACWriter.h +++ b/source/Lib/EncoderLib/CABACWriter.h @@ -109,12 +109,7 @@ public: void mip_pred_modes ( const CodingUnit& cu ); void mip_pred_mode ( const PredictionUnit& pu ); void cu_palette_info ( const CodingUnit& cu, ComponentID compBegin, uint32_t numComp, CUCtx& cuCtx); -#if JVET_P0077_LINE_CG_PALETTE void cuPaletteSubblockInfo ( const CodingUnit& cu, ComponentID compBegin, uint32_t numComp, int subSetId, uint32_t& prevRunPos, unsigned& prevRunType ); -#else - void cu_run_val ( uint32_t run, PLTRunMode runtype, const uint32_t paletteIdx, const uint32_t maxRun); - void encodeRunType ( const CodingUnit& cu, PLTtypeBuf& runType, uint32_t idx, ScanElement *refScanOrder, ComponentID compBegin); -#endif Pel writePLTIndex ( const CodingUnit& cu, uint32_t idx, PelBuf& paletteIdx, PLTtypeBuf& paletteRunType, int maxSymbol, ComponentID compBegin ); // prediction unit (clause 7.3.8.6) void prediction_unit ( const PredictionUnit& pu ); @@ -182,10 +177,6 @@ private: void xWriteTruncBinCode(uint32_t uiSymbol, uint32_t uiMaxSymbol); void codeScanRotationModeFlag ( const CodingUnit& cu, ComponentID compBegin); void xEncodePLTPredIndicator ( const CodingUnit& cu, uint32_t maxPltSize, ComponentID compBegin); -#if !JVET_P0077_LINE_CG_PALETTE - uint32_t xWriteTruncMsbP1 ( uint32_t symbol, PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT); - void xWriteTruncMsbP1RefinementBits( uint32_t symbol, PLTRunMode runtype, uint32_t maxVal, uint32_t ctxT); -#endif private: BinEncIf& m_BinEncoder; OutputBitstream* m_Bitstream; diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 1dab80ae2..a54b889d1 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -340,9 +340,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) cabacEstimator, getCtxCache( jId ), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth , &m_cReshaper[jId] -#if JVET_P0077_LINE_CG_PALETTE , sps0.getBitDepth(CHANNEL_TYPE_LUMA) -#endif ); m_cInterSearch[jId].init( this, &m_cTrQuant[jId], @@ -379,9 +377,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) cabacEstimator, getCtxCache(), m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth , &m_cReshaper -#if JVET_P0077_LINE_CG_PALETTE , sps0.getBitDepth(CHANNEL_TYPE_LUMA) -#endif ); m_cInterSearch.init( this, &m_cTrQuant, diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 842cad4e4..922835d58 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -742,13 +742,6 @@ void BestEncInfoCache::destroy() delete[] m_runType; m_runType = nullptr; } -#if !JVET_P0077_LINE_CG_PALETTE - if (m_runLength != nullptr) - { - delete[] m_runLength; - m_runLength = nullptr; - } -#endif } void BestEncInfoCache::init( const Slice &slice ) @@ -792,9 +785,6 @@ void BestEncInfoCache::init( const Slice &slice ) if (slice.getSPS()->getPLTMode()) { m_runType = new bool[numCoeff*MAX_NUM_TUS]; -#if !JVET_P0077_LINE_CG_PALETTE - m_runLength = new Pel [numCoeff*MAX_NUM_TUS]; -#endif } #else m_pCoeff = new TCoeff[numCoeff]; @@ -802,18 +792,12 @@ void BestEncInfoCache::init( const Slice &slice ) if (slice.getSPS()->getPLTMode()) { m_runType = new bool[numCoeff]; -#if !JVET_P0077_LINE_CG_PALETTE - m_runLength = new Pel [numCoeff]; -#endif } #endif TCoeff *coeffPtr = m_pCoeff; Pel *pcmPtr = m_pPcmBuf; bool *runTypePtr = m_runType; -#if !JVET_P0077_LINE_CG_PALETTE - Pel *runLengthPtr = m_runLength; -#endif m_dummyCS.pcv = m_slice_bencinf->getPPS()->pcv; for( unsigned x = 0; x < numPos; x++ ) @@ -829,9 +813,6 @@ void BestEncInfoCache::init( const Slice &slice ) TCoeff *coeff[MAX_NUM_TBLOCKS] = { 0, }; Pel *pcmbf[MAX_NUM_TBLOCKS] = { 0, }; bool *runType[MAX_NUM_TBLOCKS - 1] = { 0, }; -#if !JVET_P0077_LINE_CG_PALETTE - Pel *runLength[MAX_NUM_TBLOCKS - 1] = { 0, }; -#endif #if REUSE_CU_RESULTS_WITH_MULTIPLE_TUS for( int i = 0; i < MAX_NUM_TUS; i++ ) @@ -846,18 +827,11 @@ void BestEncInfoCache::init( const Slice &slice ) if (i < 2) { runType[i] = runTypePtr; runTypePtr += area.blocks[i].area(); -#if !JVET_P0077_LINE_CG_PALETTE - runLength[i] = runLengthPtr; runLengthPtr += area.blocks[i].area(); -#endif } } tu.cs = &m_dummyCS; -#if JVET_P0077_LINE_CG_PALETTE tu.init(coeff, pcmbf, runType); -#else - tu.init(coeff, pcmbf, runLength, runType); -#endif } #else const UnitArea &area = m_bestEncInfo[x][y][wIdx][hIdx]->tu; diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index 02dac2eb7..3ab1b298b 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -524,9 +524,6 @@ private: TCoeff *m_pCoeff; Pel *m_pPcmBuf; bool *m_runType; -#if !JVET_P0077_LINE_CG_PALETTE - Pel *m_runLength; -#endif CodingStructure m_dummyCS; XUCache m_dummyCache; #if ENABLE_SPLIT_PARALLELISM diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 919a95bb1..7128325a6 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -68,7 +68,6 @@ IntraSearch::IntraSearch() { m_pSharedPredTransformSkip[ch] = nullptr; } -#if JVET_P0077_LINE_CG_PALETTE m_truncBinBits = nullptr; m_escapeNumBins = nullptr; m_minErrorIndexMap = nullptr; @@ -80,7 +79,6 @@ IntraSearch::IntraSearch() { m_statePtRDOQ[i] = nullptr; } -#endif } @@ -165,7 +163,6 @@ void IntraSearch::destroy() m_tmpStorageLCU.destroy(); m_colorTransResiBuf.destroy(); m_isInitialized = false; -#if JVET_P0077_LINE_CG_PALETTE if (m_truncBinBits != nullptr) { for (unsigned i = 0; i < m_symbolSize; i++) @@ -202,7 +199,6 @@ void IntraSearch::destroy() m_statePtRDOQ[i] = nullptr; } } -#endif } IntraSearch::~IntraSearch() @@ -222,9 +218,7 @@ void IntraSearch::init( EncCfg* pcEncCfg, const uint32_t maxCUHeight, const uint32_t maxTotalCUDepth , EncReshape* pcReshape -#if JVET_P0077_LINE_CG_PALETTE , const unsigned bitDepthY -#endif ) { CHECK(m_isInitialized, "Already initialized"); @@ -314,7 +308,6 @@ void IntraSearch::init( EncCfg* pcEncCfg, } m_isInitialized = true; -#if JVET_P0077_LINE_CG_PALETTE if (pcEncCfg->getPLTMode()) { m_symbolSize = (1 << bitDepthY); // pixel values are within [0, SymbolSize-1] with size SymbolSize @@ -350,7 +343,6 @@ void IntraSearch::init( EncCfg* pcEncCfg, } } } -#endif } @@ -1532,25 +1524,17 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo TransformUnit &tu = *cs.getTU(partitioner.chType); uint32_t height = cu.block(compBegin).height; uint32_t width = cu.block(compBegin).width; -#if !JVET_P0077_LINE_CG_PALETTE - m_orgCtxRD = PLTCtx(m_CABACEstimator->getCtx()); -#endif if (m_pcEncCfg->getLmcs() && (cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) { cs.getPredBuf().copyFrom(cs.getOrgBuf()); cs.getPredBuf().Y().rspSignal(m_pcReshape->getFwdLUT()); } -#if !JVET_P0077_LINE_CG_PALETTE - Pel *runLength = tu.getRunLens (compBegin); - bool *runType = tu.getRunTypes(compBegin); -#endif cu.lastPLTSize[compBegin] = cs.prevPLT.curPLTSize[compBegin]; //derive palette derivePLTLossy(cs, partitioner, compBegin, numComp); reorderPLT(cs, partitioner, compBegin, numComp); -#if JVET_P0077_LINE_CG_PALETTE preCalcPLTIndexRD(cs, partitioner, compBegin, numComp); // Pre-calculate distortions for each pixel double rdCost = MAX_DOUBLE; deriveIndexMap(cs, partitioner, compBegin, numComp, PLT_SCAN_HORTRAV, rdCost); // Optimize palette index map (horizontal scan) @@ -1558,28 +1542,12 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo { deriveIndexMap(cs, partitioner, compBegin, numComp, PLT_SCAN_VERTRAV, rdCost); // Optimize palette index map (vertical scan) } -#else - //calculate palette index - preCalcPLTIndex(cs, partitioner, compBegin, numComp); - //derive run - uint64_t bits = MAX_UINT64; - deriveRunAndCalcBits(cs, partitioner, compBegin, numComp, PLT_SCAN_HORTRAV, bits); - if ((cu.curPLTSize[compBegin] + cu.useEscape[compBegin]) > 1) - { - deriveRunAndCalcBits(cs, partitioner, compBegin, numComp, PLT_SCAN_VERTRAV, bits); - } -#endif cu.useRotation[compBegin] = m_bestScanRotationMode; -#if JVET_P0077_LINE_CG_PALETTE int indexMaxSize = cu.useEscape[compBegin] ? (cu.curPLTSize[compBegin] + 1) : cu.curPLTSize[compBegin]; if (indexMaxSize <= 1) { cu.useRotation[compBegin] = false; } -#else - memcpy(runType, m_runTypeRD, sizeof(bool)*width*height); - memcpy(runLength, m_runLengthRD, sizeof(Pel)*width*height); -#endif //reconstruct pixel PelBuf curPLTIdx = tu.getcurPLTIdx(compBegin); for (uint32_t y = 0; y < height; y++) @@ -1588,9 +1556,7 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo { if (curPLTIdx.at(x, y) == cu.curPLTSize[compBegin]) { -#if JVET_P0077_LINE_CG_PALETTE calcPixelPred(cs, partitioner, y, x, compBegin, numComp); -#endif } else { @@ -1655,7 +1621,6 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo cs.setDecomp(area); cs.picture->getRecoBuf(area).copyFrom(cs.getRecoBuf(area)); } -#if JVET_P0077_LINE_CG_PALETTE void IntraSearch::calcPixelPredRD(CodingStructure& cs, Partitioner& partitioner, Pel* orgBuf, Pel* paPixelValue, Pel* paRecoValue, ComponentID compBegin, uint32_t numComp) { CodingUnit &cu = *cs.getCU(partitioner.chType); @@ -2163,210 +2128,6 @@ void IntraSearch::initTBCTable(int bitDepth) m_escapeNumBins[i] = getEpExGolombNumBins(i, 3); } } -#else -void IntraSearch::deriveRunAndCalcBits(CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp, PLTScanMode pltScanMode, uint64_t& minBits) -{ - CodingUnit &cu = *cs.getCU(partitioner.chType); - TransformUnit &tu = *cs.getTU(partitioner.chType); - uint32_t height = cu.block(compBegin).height; - uint32_t width = cu.block(compBegin).width; - Pel *runLength = tu.getRunLens (compBegin); - bool *runType = tu.getRunTypes(compBegin); - - cu.useRotation[compBegin] = (pltScanMode == PLT_SCAN_VERTRAV); - m_scanOrder = g_scanOrder[SCAN_UNGROUPED][(cu.useRotation[compBegin]) ? SCAN_TRAV_VER : SCAN_TRAV_HOR][gp_sizeIdxInfo->idxFrom(width)][gp_sizeIdxInfo->idxFrom(height)]; - deriveRun(cs, partitioner, compBegin); - - m_CABACEstimator->getCtx() = PLTCtx(m_orgCtxRD); - m_CABACEstimator->resetBits(); - CUCtx cuCtx; - cuCtx.isDQPCoded = true; - cuCtx.isChromaQpAdjCoded = true; - m_CABACEstimator->cu_palette_info(cu, compBegin, numComp, cuCtx); - uint64_t bitsTemp = m_CABACEstimator->getEstFracBits(); - if (minBits > bitsTemp) - { - m_bestScanRotationMode = pltScanMode; - memcpy(m_runTypeRD, runType, sizeof(bool)*width*height); - memcpy(m_runLengthRD, runLength, sizeof(Pel)*width*height); - minBits = bitsTemp; - } -} -void IntraSearch::deriveRun(CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin) -{ - CodingUnit &cu = *cs.getCU(partitioner.chType); - TransformUnit &tu = *cs.getTU(partitioner.chType); - uint32_t height = cu.block(compBegin).height; - uint32_t width = cu.block(compBegin).width; - uint32_t total = height * width, idx = 0; - uint32_t startPos = 0; - uint64_t indexBits = 0, runBitsIndex = 0, runBitsCopy = 0; - m_storeCtxRun = PLTCtx(m_orgCtxRD); - - PLTtypeBuf runType = tu.getrunType(compBegin); - PelBuf runLength = tu.getrunLength(compBegin); - while (idx < total) - { - startPos = idx; - double aveBitsPerPix[NUM_PLT_RUN]; - uint32_t indexRun = 0; - bool runValid = calIndexRun(cs, partitioner, startPos, total, indexRun, compBegin); - m_CABACEstimator->getCtx() = PLTCtx(m_storeCtxRun); - aveBitsPerPix[PLT_RUN_INDEX] = runValid ? getRunBits(cu, indexRun, startPos, PLT_RUN_INDEX, &indexBits, &runBitsIndex, compBegin) : MAX_DOUBLE; - m_storeCtxRunIndex = PLTCtx(m_CABACEstimator->getCtx()); - - uint32_t copyRun = 0; - bool copyValid = calCopyRun(cs, partitioner, startPos, total, copyRun, compBegin); - m_CABACEstimator->getCtx() = PLTCtx(m_storeCtxRun); - aveBitsPerPix[PLT_RUN_COPY] = copyValid ? getRunBits(cu, copyRun, startPos, PLT_RUN_COPY, &indexBits, &runBitsCopy, compBegin) : MAX_DOUBLE; - m_storeCtxRunCopy = PLTCtx(m_CABACEstimator->getCtx()); - - if (copyValid == 0 && runValid == 0) - { - assert(0); - } - else - { - if (aveBitsPerPix[PLT_RUN_COPY] <= aveBitsPerPix[PLT_RUN_INDEX]) - { - for (int runidx = 0; runidx <copyRun; runidx++) - { - uint32_t posy = m_scanOrder[idx + runidx].y; - uint32_t posx = m_scanOrder[idx + runidx].x; - runType.at(posx, posy) = PLT_RUN_COPY; - runLength.at(posx, posy) = copyRun; - } - idx += copyRun; - m_storeCtxRun = PLTCtx(m_storeCtxRunCopy); - - } - else - { - for (int runidx = 0; runidx <indexRun; runidx++) - { - uint32_t posy = m_scanOrder[idx + runidx].y; - uint32_t posx = m_scanOrder[idx + runidx].x; - runType.at(posx, posy) = PLT_RUN_INDEX; - runLength.at(posx, posy) = indexRun; - } - idx += indexRun; - m_storeCtxRun = PLTCtx(m_storeCtxRunIndex); - - } - } - } - assert(idx == total); -} -double IntraSearch::getRunBits(const CodingUnit& cu, uint32_t run, uint32_t strPos, PLTRunMode paletteRunMode, uint64_t* indexBits, uint64_t* runBits, ComponentID compBegin) -{ - TransformUnit& tu = *cu.firstTU; - uint32_t height = cu.block(compBegin).height; - uint32_t width = cu.block(compBegin).width; - uint32_t endPos = height*width; - PLTtypeBuf runType = tu.getrunType(compBegin); - PelBuf curPLTIdx = tu.getcurPLTIdx(compBegin); - uint32_t indexMaxSize = (cu.useEscape[compBegin]) ? (cu.curPLTSize[compBegin] + 1) : cu.curPLTSize[compBegin]; - - m_CABACEstimator->resetBits(); - ///////////////// encode Run Type - m_CABACEstimator->encodeRunType(cu, runType, strPos, m_scanOrder, compBegin); - uint64_t runTypeBits = m_CABACEstimator->getEstFracBits(); - uint32_t curLevel = 0; - switch (paletteRunMode) - { - case PLT_RUN_INDEX: - curLevel = m_CABACEstimator->writePLTIndex(cu, strPos, curPLTIdx, runType, indexMaxSize, compBegin); - *indexBits = m_CABACEstimator->getEstFracBits() - runTypeBits; - m_CABACEstimator->cu_run_val(run - 1, PLT_RUN_INDEX, curLevel, endPos - strPos - 1); - *runBits = m_CABACEstimator->getEstFracBits() - runTypeBits - (*indexBits); - break; - case PLT_RUN_COPY: - m_CABACEstimator->cu_run_val(run - 1, PLT_RUN_COPY, curLevel, endPos - strPos - 1); - *runBits = m_CABACEstimator->getEstFracBits() - runTypeBits; - break; - default: - assert(0); - } - assert(run >= 1); - double costPerPixel = (double)m_CABACEstimator->getEstFracBits() / (double)run; - return costPerPixel; -} -void IntraSearch::preCalcPLTIndex(CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp) -{ - CodingUnit &cu = *cs.getCU(partitioner.chType); - TransformUnit &tu = *cs.getTU(partitioner.chType); - const int channelBitDepth_L = cs.sps->getBitDepth(CHANNEL_TYPE_LUMA); - const int channelBitDepth_C = cs.sps->getBitDepth(CHANNEL_TYPE_CHROMA); - const int pcmShiftRight_L = (channelBitDepth_L - PLT_ENCBITDEPTH); - const int pcmShiftRight_C = (channelBitDepth_C - PLT_ENCBITDEPTH); - - uint32_t height = cu.block(compBegin).height; - uint32_t width = cu.block(compBegin).width; - - CPelBuf orgBuf[3]; - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - CompArea area = cu.blocks[comp]; - if (m_pcEncCfg->getLmcs() && (cs.slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())) - { - orgBuf[comp] = cs.getPredBuf(area); - } - else - { - orgBuf[comp] = cs.getOrgBuf(area); - } - } - - PelBuf curPLTIdx = tu.getcurPLTIdx(compBegin); - int errorLimit = numComp * g_paletteQuant[cu.qp]; - uint32_t bestIdx = 0; - uint32_t scaleX = getComponentScaleX(COMPONENT_Cb, cs.sps->getChromaFormatIdc()); - uint32_t scaleY = getComponentScaleY(COMPONENT_Cb, cs.sps->getChromaFormatIdc()); - for (uint32_t y = 0; y < height; y++) - { - for (uint32_t x = 0; x < width; x++) - { - uint32_t pltIdx = 0; - uint32_t minError = MAX_UINT; - while (pltIdx < cu.curPLTSize[compBegin]) - { - uint32_t absError = 0, pX, pY; - for (int comp = compBegin; comp < (compBegin + numComp); comp++) - { - pX = (comp > 0 && compBegin == COMPONENT_Y) ? (x >> scaleX) : x; - pY = (comp > 0 && compBegin == COMPONENT_Y) ? (y >> scaleY) : y; - if (isChroma((ComponentID) comp)) - { - absError += int(double(abs(cu.curPLT[comp][pltIdx] - orgBuf[comp].at(pX, pY))) * PLT_CHROMA_WEIGHTING) >> pcmShiftRight_C; - } - else - { - absError += abs(cu.curPLT[comp][pltIdx] - orgBuf[comp].at(pX, pY)) >> pcmShiftRight_L; - } - } - - if (absError < minError) - { - bestIdx = pltIdx; - minError = absError; - if (minError == 0) - { - break; - } - } - pltIdx++; - } - curPLTIdx.at(x, y) = bestIdx; - if (minError > errorLimit) - { - curPLTIdx.at(x, y) = cu.curPLTSize[compBegin]; - cu.useEscape[compBegin] = true; - calcPixelPred(cs, partitioner, y, x, compBegin, numComp); - } - } - } -} -#endif void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, uint32_t yPos, uint32_t xPos, ComponentID compBegin, uint32_t numComp) { CodingUnit &cu = *cs.getCU(partitioner.chType); diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h index fe14978c3..72ccaa021 100644 --- a/source/Lib/EncoderLib/IntraSearch.h +++ b/source/Lib/EncoderLib/IntraSearch.h @@ -365,7 +365,6 @@ protected: CtxCache* m_CtxCache; bool m_isInitialized; -#if JVET_P0077_LINE_CG_PALETTE uint32_t m_symbolSize; uint16_t** m_truncBinBits; uint16_t* m_escapeNumBins; @@ -378,7 +377,6 @@ protected: bool m_prevRunTypeRDOQ[2][NUM_TRELLIS_STATE]; int m_prevRunPosRDOQ [2][NUM_TRELLIS_STATE]; double m_stateCostRDOQ [2][NUM_TRELLIS_STATE]; -#endif public: IntraSearch(); @@ -393,9 +391,7 @@ public: const uint32_t maxCUHeight, const uint32_t maxTotalCUDepth , EncReshape* m_pcReshape -#if JVET_P0077_LINE_CG_PALETTE , const unsigned bitDepthY -#endif ); void destroy (); @@ -417,9 +413,6 @@ public: bool estIntraPredLumaQT(CodingUnit &cu, Partitioner& pm, const double bestCostSoFar = MAX_DOUBLE, bool mtsCheckRangeFlag = false, int mtsFirstCheckId = 0, int mtsLastCheckId = 0, bool moreProbMTSIdxFirst = false, CodingStructure* bestCS = NULL); void estIntraPredChromaQT ( CodingUnit &cu, Partitioner& pm, const double maxCostAllowed = MAX_DOUBLE ); void PLTSearch ( CodingStructure &cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); -#if !JVET_P0077_LINE_CG_PALETTE - void deriveRunAndCalcBits ( CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp, PLTScanMode pltScanMode, uint64_t& bits); -#endif uint64_t xFracModeBitsIntra (PredictionUnit &pu, const uint32_t &uiMode, const ChannelType &compID); void invalidateBestModeCost () { for( int i = 0; i < NUM_LFNST_NUM_PER_SET; i++ ) m_bestModeCostValid[ i ] = false; }; @@ -456,13 +449,8 @@ protected: template<typename T, size_t N> void reduceHadCandList(static_vector<T, N>& candModeList, static_vector<double, N>& candCostList, int& numModesForFullRD, const double thresholdHadCost, const double* mipHadCost, const PredictionUnit &pu, const bool fastMip); -#if !JVET_P0077_LINE_CG_PALETTE - void deriveRun ( CodingStructure &cs, Partitioner& partitioner, ComponentID compBegin); - double getRunBits (const CodingUnit& cu, uint32_t run, uint32_t strPos, PLTRunMode paletteRunMode, uint64_t* indexBits, uint64_t* runBits, ComponentID compBegin); -#endif void derivePLTLossy ( CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); void calcPixelPred ( CodingStructure& cs, Partitioner& partitioner, uint32_t yPos, uint32_t xPos, ComponentID compBegin, uint32_t numComp); -#if JVET_P0077_LINE_CG_PALETTE void preCalcPLTIndexRD (CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); void calcPixelPredRD (CodingStructure& cs, Partitioner& partitioner, Pel* orgBuf, Pel* pixelValue, Pel* recoValue, ComponentID compBegin, uint32_t numComp); void deriveIndexMap (CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp, PLTScanMode pltScanMode, double& dCost); @@ -471,9 +459,6 @@ protected: void initTBCTable (int bitDepth); uint32_t getTruncBinBits (uint32_t symbol, uint32_t maxSymbol); uint32_t getEpExGolombNumBins (uint32_t symbol, uint32_t count); -#else - void preCalcPLTIndex ( CodingStructure& cs, Partitioner& partitioner, ComponentID compBegin, uint32_t numComp); -#endif void xGetNextISPMode ( ModeInfo& modeInfo, const ModeInfo* lastMode, const Size cuSize ); bool xSortISPCandList ( double bestCostSoFar, double bestNonISPCost, ModeInfo bestNonISPMode ); void xSortISPCandListLFNST ( ); -- GitLab