diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index 5993ccca8c2e5337530c6f8b3b9c6ff5f37e6331..4f79060760bd2c1dca8327c0775806d57a055cdb 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -439,24 +439,15 @@ void AreaBuf<T>::removeWeightHighFreq(const AreaBuf<T>& other, const bool bClip, else { #endif -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS Intermediate_Int normalizer = ((1 << 16) + (bcwWeight > 0 ? (bcwWeight >> 1) : -(bcwWeight >> 1))) / bcwWeight; -#else - int normalizer = ((1 << 16) + (bcwWeight > 0 ? (bcwWeight >> 1) : -(bcwWeight >> 1))) / bcwWeight; -#endif Intermediate_Int weight0 = normalizer << log2WeightBase; Intermediate_Int weight1 = bcwWeightOther * normalizer; #define REM_HF_INC \ src += srcStride; \ dst += dstStride; \ -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS #define REM_HF_OP_CLIP( ADDR ) dst[ADDR] = ClipPel<T>( T((dst[ADDR]*weight0 - src[ADDR]*weight1 + (1<<15))>>16), clpRng ) #define REM_HF_OP( ADDR ) dst[ADDR] = T((dst[ADDR]*weight0 - src[ADDR]*weight1 + (1<<15))>>16) -#else -#define REM_HF_OP_CLIP( ADDR ) dst[ADDR] = ClipPel<T>( (dst[ADDR]*weight0 - src[ADDR]*weight1 + (1<<15))>>16, clpRng ) -#define REM_HF_OP( ADDR ) dst[ADDR] = (dst[ADDR]*weight0 - src[ADDR]*weight1 + (1<<15))>>16 -#endif if(bClip) { diff --git a/source/Lib/CommonLib/ContextModelling.h b/source/Lib/CommonLib/ContextModelling.h index ec50e55329412aa6df98d51d70be938dce26efe2..e3006c3e503723e4974ea1ebadace39de13dc6eb 100644 --- a/source/Lib/CommonLib/ContextModelling.h +++ b/source/Lib/CommonLib/ContextModelling.h @@ -112,13 +112,8 @@ public: const TCoeff* pData = coeff + posX + posY * m_width; const int diag = posX + posY; int numPos = 0; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff sumAbs = 0; #define UPDATE(x) {TCoeff a=abs(x);sumAbs+=std::min(4+(a&1),a);numPos+=int(!!a);} -#else - int sumAbs = 0; -#define UPDATE(x) {int a=abs(x);sumAbs+=std::min(4+(a&1),a);numPos+=!!a;} -#endif if( posX < m_width-1 ) { UPDATE( pData[1] ); @@ -142,11 +137,7 @@ public: #undef UPDATE -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS int ctxOfs = int(std::min<TCoeff>((sumAbs+1)>>1, 3)) + ( diag < 2 ? 4 : 0 ); -#else - int ctxOfs = std::min((sumAbs+1)>>1, 3) + ( diag < 2 ? 4 : 0 ); -#endif if( m_chType == CHANNEL_TYPE_LUMA ) { @@ -163,11 +154,7 @@ public: int offset = 0; if( m_tmplCpDiag != -1 ) { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS offset = int(std::min<TCoeff>( m_tmplCpSum1, 4 )) + 1; -#else - offset = std::min( m_tmplCpSum1, 4 ) + 1; -#endif offset += ( !m_tmplCpDiag ? ( m_chType == CHANNEL_TYPE_LUMA ? 15 : 5 ) : m_chType == CHANNEL_TYPE_LUMA ? m_tmplCpDiag < 3 ? 10 : ( m_tmplCpDiag < 10 ? 5 : 0 ) : 0 ); } return uint8_t(offset); @@ -181,11 +168,7 @@ public: const uint32_t posY = m_scan[scanPos].y; const uint32_t posX = m_scan[scanPos].x; const TCoeff* pData = coeff + posX + posY * m_width; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff sum = 0; -#else - int sum = 0; -#endif if (posX < m_width - 1) { sum += abs(pData[1]); @@ -206,11 +189,7 @@ public: sum += abs(pData[m_width << 1]); } } -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS return unsigned(std::max<TCoeff>(std::min<TCoeff>(sum - 5 * baseLevel, 31), 0)); -#else - return std::max(std::min(sum - 5 * baseLevel, 31), 0); -#endif } unsigned sigCtxIdAbsTS( int scanPos, const TCoeff* coeff ) @@ -219,11 +198,7 @@ public: const uint32_t posX = m_scan[scanPos].x; const TCoeff* posC = coeff + posX + posY * m_width; int numPos = 0; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS #define UPDATE(x) {TCoeff a=abs(x);numPos+=int(!!a);} -#else -#define UPDATE(x) {int a=abs(x);numPos+=!!a;} -#endif if( posX > 0 ) { UPDATE( posC[-1] ); @@ -247,11 +222,7 @@ public: const TCoeff* posC = coeff + posX + posY * m_width; int numPos = 0; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS #define UPDATE(x) {TCoeff a=abs(x);numPos+=int(!!a);} -#else -#define UPDATE(x) {int a=abs(x);numPos+=!!a;} -#endif if (bdpcm) { @@ -325,69 +296,41 @@ public: if (posX > 0) { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS rightPixel = int(data[-1]); -#else - rightPixel = data[-1]; -#endif } if (posY > 0) { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS belowPixel = int(data[-(int)m_width]); -#else - belowPixel = data[-(int)m_width]; -#endif } } -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS int deriveModCoeff(int rightPixel, int belowPixel, TCoeff absCoeff, int bdpcm = 0) -#else - int deriveModCoeff(int rightPixel, int belowPixel, int absCoeff, int bdpcm = 0) -#endif { if (absCoeff == 0) return 0; int pred1, absBelow = abs(belowPixel), absRight = abs(rightPixel); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS int absCoeffMod = int(absCoeff); -#else - int absCoeffMod = absCoeff; -#endif if (bdpcm == 0) { pred1 = std::max(absBelow, absRight); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS if (absCoeffMod == pred1) -#else - if (absCoeff == pred1) -#endif { absCoeffMod = 1; } else { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS absCoeffMod = absCoeffMod < pred1 ? absCoeffMod + 1 : absCoeffMod; -#else - absCoeffMod = absCoeff < pred1 ? absCoeff + 1 : absCoeff; -#endif } } return(absCoeffMod); } -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff decDeriveModCoeff(int rightPixel, int belowPixel, TCoeff absCoeff) -#else - int decDeriveModCoeff(int rightPixel, int belowPixel, int absCoeff) -#endif { if (absCoeff == 0) @@ -396,11 +339,7 @@ public: int pred1, absBelow = abs(belowPixel), absRight = abs(rightPixel); pred1 = std::max(absBelow, absRight); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff absCoeffMod; -#else - int absCoeffMod; -#endif if (absCoeff == 1 && pred1 > 0) { @@ -460,11 +399,7 @@ private: int m_minSubPos; int m_maxSubPos; unsigned m_sigGroupCtxId; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff m_tmplCpSum1; -#else - int m_tmplCpSum1; -#endif int m_tmplCpDiag; CtxSet m_sigFlagCtxSet[3]; CtxSet m_parFlagCtxSet; diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index 43bf11b348f144c323ecc9d77a48799f202179d7..85c07184d0a1b77c1052b385fdbbe37fde6f12be 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -629,11 +629,7 @@ namespace DQIntern Quantizer() {} void dequantBlock ( const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, CoeffBuf& recCoeff, bool enableScalingLists, int* piDequantCoef ) const; void initQuantBlock ( const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, const double lambda, int gValue ); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS inline void preQuantCoeff( const TCoeff absCoeff, PQData *pqData, TCoeff quanCoeff ) const; -#else - inline void preQuantCoeff( const TCoeff absCoeff, PQData *pqData, int quanCoeff ) const; -#endif inline TCoeff getLastThreshold() const { return m_thresLast; } inline TCoeff getSSbbThreshold() const { return m_thresSSbb; } @@ -686,11 +682,7 @@ namespace DQIntern // quant parameters m_QShift = QUANT_SHIFT - 1 + qpPer + transformShift; m_QAdd = -( ( 3 << m_QShift ) >> 1 ); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift; -#else - Intermediate_Int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift; -#endif m_QScale = g_quantScales[needsSqrt2ScaleAdjustment?1:0][ qpRem ]; const unsigned qIdxBD = std::min<unsigned>( maxLog2TrDynamicRange + 1, 8*sizeof(Intermediate_Int) + invShift - IQUANT_SHIFT - 1 ); m_maxQIdx = ( 1 << (qIdxBD-1) ) - 4; @@ -777,11 +769,7 @@ namespace DQIntern } } -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS inline void Quantizer::preQuantCoeff(const TCoeff absCoeff, PQData *pqData, TCoeff quanCoeff) const -#else - inline void Quantizer::preQuantCoeff(const TCoeff absCoeff, PQData *pqData, int quanCoeff) const -#endif { int64_t scaledOrg = int64_t( absCoeff ) * quanCoeff; TCoeff qIdx = std::max<TCoeff>( 1, std::min<TCoeff>( m_maxQIdx, TCoeff( ( scaledOrg + m_QAdd ) >> m_QShift ) ) ); @@ -898,22 +886,14 @@ namespace DQIntern rdCostA += m_coeffFracBits.bits[ pqDataA.absLevel ]; else { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS const TCoeff value = ( pqDataA.absLevel - 4 ) >> 1; -#else - const unsigned value = ( pqDataA.absLevel - 4 ) >> 1; -#endif rdCostA += m_coeffFracBits.bits[ pqDataA.absLevel - ( value << 1 ) ] + goRiceTab[ value < RICEMAX ? value : RICEMAX - 1 ]; } if( pqDataB.absLevel < 4 ) rdCostB += m_coeffFracBits.bits[ pqDataB.absLevel ]; else { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS const TCoeff value = ( pqDataB.absLevel - 4 ) >> 1; -#else - const unsigned value = ( pqDataB.absLevel - 4 ) >> 1; -#endif rdCostB += m_coeffFracBits.bits[ pqDataB.absLevel - ( value << 1 ) ] + goRiceTab[ value < RICEMAX ? value : RICEMAX - 1 ]; } if( spt == SCAN_ISCSBB ) @@ -974,11 +954,7 @@ namespace DQIntern } else { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS const TCoeff value = (pqData.absLevel - 4) >> 1; -#else - const unsigned value = (pqData.absLevel - 4) >> 1; -#endif rdCost += m_coeffFracBits.bits[pqData.absLevel - (value << 1)] + g_goRiceBits[m_goRicePar][value < RICEMAX ? value : RICEMAX-1]; } if( rdCost < decision.rdCost ) @@ -1054,11 +1030,7 @@ namespace DQIntern m_goRicePar = prvState->m_goRicePar; if( m_remRegBins >= 4 ) { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS m_remRegBins -= (decision.absLevel < 2 ? (unsigned)decision.absLevel : 3); -#else - m_remRegBins -= (decision.absLevel < 2 ? decision.absLevel : 3); -#endif } ::memcpy( m_absLevelsAndCtxInit, prvState->m_absLevelsAndCtxInit, 48*sizeof(uint8_t) ); } @@ -1067,11 +1039,7 @@ namespace DQIntern m_numSigSbb = 1; m_refSbbCtxId = -1; int ctxBinSampleRatio = (scanInfo.chType == CHANNEL_TYPE_LUMA) ? MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA : MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS m_remRegBins = (effWidth * effHeight *ctxBinSampleRatio) / 16 - (decision.absLevel < 2 ? (unsigned)decision.absLevel : 3); -#else - m_remRegBins = (effWidth * effHeight *ctxBinSampleRatio) / 16 - (decision.absLevel < 2 ? decision.absLevel : 3); -#endif ::memset( m_absLevelsAndCtxInit, 0, 48*sizeof(uint8_t) ); } @@ -1323,13 +1291,8 @@ namespace DQIntern void dequant ( const TransformUnit& tu, CoeffBuf& recCoeff, const ComponentID compID, const QpParam& cQP, bool enableScalingLists, int* quantCoeff ); private: -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS void xDecideAndUpdate ( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, TCoeff quantCoeff); void xDecide ( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, TCoeff quantCoeff ); -#else - void xDecideAndUpdate ( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, int quantCoeff); - void xDecide ( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, int quantCoeff ); -#endif private: CommonCtx m_commonCtx; @@ -1367,11 +1330,7 @@ namespace DQIntern #undef DINIT -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS void DepQuant::xDecide( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, TCoeff quanCoeff) -#else - void DepQuant::xDecide( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, int quanCoeff) -#endif { ::memcpy( decisions, startDec, 8*sizeof(Decision) ); @@ -1405,11 +1364,7 @@ namespace DQIntern m_startState.checkRdCostStart( lastOffset, pqData[2], decisions[2] ); } -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS void DepQuant::xDecideAndUpdate( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, TCoeff quantCoeff ) -#else - void DepQuant::xDecideAndUpdate( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, int quantCoeff ) -#endif { Decision* decisions = m_trellis[ scanInfo.scanIdx ]; diff --git a/source/Lib/CommonLib/TrQuant.cpp b/source/Lib/CommonLib/TrQuant.cpp index 7f61ad7bcff9d8516ad8314bdd4339dde4992640..6a7fbf4151f781b34efe323688073c7ac98492c4 100644 --- a/source/Lib/CommonLib/TrQuant.cpp +++ b/source/Lib/CommonLib/TrQuant.cpp @@ -935,11 +935,7 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const xT( tu, compID, resiBuf, tempCoeff, width, height ); } -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff sumAbs = 0; -#else - int sumAbs = 0; -#endif for( int pos = 0; pos < width*height; pos++ ) { sumAbs += abs( tempCoeff.buf[pos] ); @@ -957,11 +953,7 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const scaleSAD *= pow(2, trShift); } -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS trCosts.push_back( TrCost( int(std::min<double>(sumAbs*scaleSAD, std::numeric_limits<int>::max())), pos++ ) ); -#else - trCosts.push_back( TrCost( int(sumAbs*scaleSAD), pos++ ) ); -#endif it++; } diff --git a/source/Lib/CommonLib/TrQuant_EMT.cpp b/source/Lib/CommonLib/TrQuant_EMT.cpp index d7f94fc9d46d600aad0d7f0e790b3de5c8a57b0c..fd2e3917dad1c457a132a2ac9ddf9ba7c129fa94 100644 --- a/source/Lib/CommonLib/TrQuant_EMT.cpp +++ b/source/Lib/CommonLib/TrQuant_EMT.cpp @@ -86,11 +86,7 @@ void fastInverseDCT2_B2(const TCoeff *src, TCoeff *dst, int shift, int line, int { int j; TCoeff E, O; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff add = TCoeff(1) << (shift - 1); -#else - TCoeff add = 1 << (shift - 1); -#endif const TMatrixCoeff *iT = g_trCoreDCT2P2[TRANSFORM_INVERSE][0]; @@ -169,11 +165,7 @@ void fastInverseDCT2_B4( const TCoeff *src, TCoeff *dst, int shift, int line, in { int j; TCoeff E[2], O[2]; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff add = TCoeff(1) << ( shift - 1 ); -#else - TCoeff add = 1 << ( shift - 1 ); -#endif const TMatrixCoeff *iT = g_trCoreDCT2P4[TRANSFORM_INVERSE][0]; @@ -205,11 +197,7 @@ void fastInverseDCT2_B4( const TCoeff *src, TCoeff *dst, int shift, int line, in template< int uiTrSize > inline void _fastInverseMM( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum, const TMatrixCoeff* iT ) { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS const TCoeff rnd_factor = TCoeff(1) << (shift - 1); -#else - const TCoeff rnd_factor = 1 << (shift - 1); -#endif const int reducedLine = line - iSkipLine; const int cutoff = uiTrSize - iSkipLine2; @@ -236,11 +224,7 @@ inline void _fastInverseMM( const TCoeff *src, TCoeff *dst, int shift, int line, template< int uiTrSize > inline void _fastForwardMM( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TMatrixCoeff* tc ) { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS const TCoeff rnd_factor = TCoeff(1) << (shift - 1); -#else - const TCoeff rnd_factor = 1 << (shift - 1); -#endif const int reducedLine = line - iSkipLine; const int cutoff = uiTrSize - iSkipLine2; TCoeff *pCoef; @@ -350,11 +334,7 @@ void fastInverseDCT2_B8(const TCoeff *src, TCoeff *dst, int shift, int line, int int j, k; TCoeff E[4], O[4]; TCoeff EE[2], EO[2]; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff add = TCoeff(1) << (shift - 1); -#else - TCoeff add = 1 << (shift - 1); -#endif const TMatrixCoeff *iT = g_trCoreDCT2P8[TRANSFORM_INVERSE][0]; @@ -476,11 +456,7 @@ void fastInverseDCT2_B16( const TCoeff *src, TCoeff *dst, int shift, int line, i TCoeff E [8], O [8]; TCoeff EE [4], EO [4]; TCoeff EEE[2], EEO[2]; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff add = TCoeff(1) << ( shift - 1 ); -#else - TCoeff add = 1 << ( shift - 1 ); -#endif const TMatrixCoeff *iT = g_trCoreDCT2P16[TRANSFORM_INVERSE][0]; @@ -622,11 +598,7 @@ void fastInverseDCT2_B32(const TCoeff *src, TCoeff *dst, int shift, int line, in TCoeff EE[8], EO[8]; TCoeff EEE[4], EEO[4]; TCoeff EEEE[2], EEEO[2]; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff add = TCoeff(1) << (shift - 1); -#else - TCoeff add = 1 << (shift - 1); -#endif const TMatrixCoeff *iT = g_trCoreDCT2P32[TRANSFORM_INVERSE][0]; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 81c8129299ef45f30906c9c3dc315ab7047367b7..0ee67456d0ea1b39e7ff14ac5310654d55980f99 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -139,7 +139,6 @@ //########### place macros to be be kept below this line ############### #define JVET_S0257_DUMP_360SEI_MESSAGE 1 // Software support of 360 SEI messages -#define JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS 1 // JVET-R0351: high bit depth coding support (syntax changes for Visual Studio) #define JVET_R0351_HIGH_BIT_DEPTH_ENABLED 0 // JVET-R0351: high bit depth coding enabled (increases accuracies of some calculations, e.g. transforms) #define JVET_R0164_MEAN_SCALED_SATD 1 // JVET-R0164: Use a mean scaled version of SATD in encoder decisions diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 455d3add3aeb4f88960f727109b79d05342da165..2980b49c3e0fa65fc548fe24306f6edf97349f32 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -1930,11 +1930,7 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u if (compID == COMPONENT_Y || compBegin != COMPONENT_Y) { escapeValue.at(posx, posy) = exp_golomb_eqprob(5); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS assert(escapeValue.at(posx, posy) < (TCoeff(1) << (cu.cs->sps->getBitDepth(toChannelType((ComponentID)comp)) + 1))); -#else - assert(escapeValue.at(posx, posy) < (1 << (cu.cs->sps->getBitDepth(toChannelType((ComponentID)comp)) + 1))); -#endif DTRACE(g_trace_ctx, D_SYNTAX, "plt_escape_val() value=%d etype=%d sp=%d\n", escapeValue.at(posx, posy), comp, curPos); } if (compBegin == COMPONENT_Y && compID != COMPONENT_Y && posy % (1 << scaleY) == 0 && posx % (1 << scaleX) == 0) @@ -1942,11 +1938,7 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u uint32_t posxC = posx >> scaleX; uint32_t posyC = posy >> scaleY; escapeValue.at(posxC, posyC) = exp_golomb_eqprob(5); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS assert(escapeValue.at(posxC, posyC) < (TCoeff(1) << (cu.cs->sps->getBitDepth(toChannelType(compID)) + 1))); -#else - assert(escapeValue.at(posxC, posyC) < (1 << (cu.cs->sps->getBitDepth(toChannelType(compID)) + 1))); -#endif DTRACE(g_trace_ctx, D_SYNTAX, "plt_escape_val() value=%d etype=%d sp=%d\n", escapeValue.at(posx, posy), comp, curPos); } } @@ -3328,18 +3320,10 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co unsigned signPattern = m_BinDecoder.decodeBinsEP( numSigns ) << ( 32 - numSigns ); //===== set final coefficents ===== -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff sumAbs = 0; -#else - int sumAbs = 0; -#endif for( unsigned k = 0; k < numSigns; k++ ) { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff AbsCoeff = coeff[ sigBlkPos[ k ] ]; -#else - int AbsCoeff = coeff[ sigBlkPos[ k ] ]; -#endif sumAbs += AbsCoeff; coeff[ sigBlkPos[k] ] = ( signPattern & ( 1u << 31 ) ? -AbsCoeff : AbsCoeff ); signPattern <<= 1; @@ -3348,11 +3332,7 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co if( numNonZero > numSigns ) { int k = numSigns; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff AbsCoeff = coeff[ sigBlkPos[ k ] ]; -#else - int AbsCoeff = coeff[ sigBlkPos[ k ] ]; -#endif sumAbs += AbsCoeff; coeff[ sigBlkPos[k] ] = ( sumAbs & 1 ? -AbsCoeff : AbsCoeff ); check_coeff_conformance( cctx, coeff[ sigBlkPos[k] ] ); @@ -3544,11 +3524,7 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff* //===== set final coefficents ===== for( unsigned k = 0; k < numNonZero; k++ ) { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff AbsCoeff = coeff[ sigBlkPos[ k ] ]; -#else - int AbsCoeff = coeff[ sigBlkPos[ k ] ]; -#endif coeff[ sigBlkPos[k] ] = ( signPattern & 1 ? -AbsCoeff : AbsCoeff ); signPattern >>= 1; check_coeff_conformance( cctx, coeff[ sigBlkPos[k] ] ); diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 675baeb6f01d61c5549f25f20003b391d98c542a..eeec34743555978b0171a48d8c77a5bb24d0f643 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -522,11 +522,7 @@ void DecCu::xReconPLT(CodingUnit &cu, ComponentID compBegin, uint32_t numComp) PLTescapeBuf escapeValue = tu.getescapeValue((ComponentID)compID); if (curPLTIdx.at(x, y) == cu.curPLTSize[compBegin]) { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff value; -#else - Pel value; -#endif QpParam cQP(tu, (ComponentID)compID); int qp = cQP.Qp(true); int qpRem = qp % 6; @@ -536,13 +532,8 @@ void DecCu::xReconPLT(CodingUnit &cu, ComponentID compBegin, uint32_t numComp) int invquantiserRightShift = IQUANT_SHIFT; int add = 1 << (invquantiserRightShift - 1); value = ((((escapeValue.at(x, y)*g_invQuantScales[0][qpRem]) << qpPer) + add) >> invquantiserRightShift); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS value = ClipBD<TCoeff>(value, channelBitDepth); picReco.at(x, y) = Pel(value); -#else - value = Pel(ClipBD<int>(value, channelBitDepth)); - picReco.at(x, y) = value; -#endif } else if (compBegin == COMPONENT_Y && compID != COMPONENT_Y && y % (1 << scaleY) == 0 && x % (1 << scaleX) == 0) { @@ -551,13 +542,8 @@ void DecCu::xReconPLT(CodingUnit &cu, ComponentID compBegin, uint32_t numComp) int invquantiserRightShift = IQUANT_SHIFT; int add = 1 << (invquantiserRightShift - 1); value = ((((escapeValue.at(posXC, posYC)*g_invQuantScales[0][qpRem]) << qpPer) + add) >> invquantiserRightShift); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS value = ClipBD<TCoeff>(value, channelBitDepth); picReco.at(posXC, posYC) = Pel(value); -#else - value = Pel(ClipBD<int>(value, channelBitDepth)); - picReco.at(posXC, posYC) = value; -#endif } } diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 7c17c24f5e9e7f851707bdb92b41ba3ece071d4b..087cb0c179cb7c632cbebc16f4f94fac166108d1 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -2910,11 +2910,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe const int inferSigPos = nextSigPos != cctx.scanPosLast() ? ( cctx.isNotFirst() ? minSubPos : -1 ) : nextSigPos; int firstNZPos = nextSigPos; int lastNZPos = -1; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS TCoeff remAbsLevel = -1; -#else - int remAbsLevel = -1; -#endif int numNonZero = 0; unsigned signPattern = 0; int remRegBins = cctx.regBinLimit; @@ -2980,11 +2976,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe { int sumAll = cctx.templateAbsSum(scanPos, coeff, 4); ricePar = g_auiGoRiceParsCoeff[sumAll]; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS unsigned absLevel = (unsigned) abs( coeff[ cctx.blockPos( scanPos ) ] ); -#else - unsigned absLevel = abs( coeff[ cctx.blockPos( scanPos ) ] ); -#endif if( absLevel >= 4 ) { unsigned rem = ( absLevel - 4 ) >> 1; @@ -2997,11 +2989,7 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe for( int scanPos = firstPosMode2; scanPos >= minSubPos; scanPos-- ) { TCoeff Coeff = coeff[ cctx.blockPos( scanPos ) ]; -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS unsigned absLevel = (unsigned) abs( Coeff ); -#else - unsigned absLevel = abs( Coeff ); -#endif int sumAll = cctx.templateAbsSum(scanPos, coeff, 0); int rice = g_auiGoRiceParsCoeff [sumAll]; int pos0 = g_auiGoRicePosCoeff0(state, rice); diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index dc95c7228685eb773d786dd38482c47b474a1195..063ef8b3af12195d427cc82260aa1f4114c003ad 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -2334,25 +2334,14 @@ void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, u if (lossless) { escapeValue.at(xPos, yPos) = orgBuf[ch].at(xPos, yPos); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS recBuf.at(xPos, yPos) = orgBuf[ch].at(xPos, yPos); -#else - recBuf.at(xPos, yPos) = escapeValue.at(xPos, yPos); -#endif } else { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS escapeValue.at(xPos, yPos) = std::max<TCoeff>(0, ((orgBuf[ch].at(xPos, yPos) * quantiserScale[ch] + rightShiftOffset[ch]) >> quantiserRightShift[ch])); assert(escapeValue.at(xPos, yPos) < (TCoeff(1) << (channelBitDepth + 1))); TCoeff value = (((escapeValue.at(xPos, yPos)*g_invQuantScales[0][qpRem[ch]]) << qpPer[ch]) + add[ch]) >> invquantiserRightShift[ch]; recBuf.at(xPos, yPos) = Pel(ClipBD<TCoeff>(value, channelBitDepth));//to be checked -#else - escapeValue.at(xPos, yPos) = TCoeff(std::max<int>(0, ((orgBuf[ch].at(xPos, yPos) * quantiserScale[ch] + rightShiftOffset[ch]) >> quantiserRightShift[ch]))); - assert(escapeValue.at(xPos, yPos) < (1 << (channelBitDepth + 1))); - recBuf.at(xPos, yPos) = (((escapeValue.at(xPos, yPos)*g_invQuantScales[0][qpRem[ch]]) << qpPer[ch]) + add[ch]) >> invquantiserRightShift[ch]; - recBuf.at(xPos, yPos) = Pel(ClipBD<int>(recBuf.at(xPos, yPos), channelBitDepth));//to be checked -#endif } } else if (compBegin == COMPONENT_Y && ch > 0 && yPos % (1 << scaleY) == 0 && xPos % (1 << scaleX) == 0) @@ -2362,30 +2351,16 @@ void IntraSearch::calcPixelPred(CodingStructure& cs, Partitioner& partitioner, u if (lossless) { escapeValue.at(xPosC, yPosC) = orgBuf[ch].at(xPosC, yPosC); -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS recBuf.at(xPosC, yPosC) = orgBuf[ch].at(xPosC, yPosC); -#else - recBuf.at(xPosC, yPosC) = escapeValue.at(xPosC, yPosC); -#endif } else { -#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS escapeValue.at(xPosC, yPosC) = std::max<TCoeff>( 0, ((orgBuf[ch].at(xPosC, yPosC) * quantiserScale[ch] + rightShiftOffset[ch]) >> quantiserRightShift[ch])); assert(escapeValue.at(xPosC, yPosC) < (TCoeff(1) << (channelBitDepth + 1))); TCoeff value = (((escapeValue.at(xPosC, yPosC) * g_invQuantScales[0][qpRem[ch]]) << qpPer[ch]) + add[ch]) >> invquantiserRightShift[ch]; recBuf.at(xPosC, yPosC) = Pel(ClipBD<TCoeff>(value, channelBitDepth)); // to be checked -#else - escapeValue.at(xPosC, yPosC) = TCoeff(std::max<int>( - 0, ((orgBuf[ch].at(xPosC, yPosC) * quantiserScale[ch] + rightShiftOffset[ch]) >> quantiserRightShift[ch]))); - assert(escapeValue.at(xPosC, yPosC) < (1 << (channelBitDepth + 1))); - recBuf.at(xPosC, yPosC) = - (((escapeValue.at(xPosC, yPosC) * g_invQuantScales[0][qpRem[ch]]) << qpPer[ch]) + add[ch]) - >> invquantiserRightShift[ch]; - recBuf.at(xPosC, yPosC) = Pel(ClipBD<int>(recBuf.at(xPosC, yPosC), channelBitDepth)); // to be checked -#endif } } }