diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 9ed20447a0ba672564f75f3930d706ae36ac5c31..e234637d6548b61fb6c765cd272e2a8917b1116c 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -1093,21 +1093,25 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) { const SPS* sps = pcPic->cs->sps; #if JVET_AB0081 - m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range, m_upscaleFilterForDisplay); + m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, + NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range, m_upscaleFilterForDisplay); #else - m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); + m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, + NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range); #endif } else { - m_cVideoIOYuvReconFile[pcPic->layerId].write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(), - m_outputColourSpaceConvert, - m_packedYUVMode, - conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), - conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), - NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); + m_cVideoIOYuvReconFile[pcPic->layerId].write( + pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, + pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, + conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), NUM_CHROMA_FORMAT, + m_clipOutputVideoToRec709Range); } } // Perform FGS on decoded frame and write to output FGS file @@ -1119,20 +1123,25 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) if (m_upscaledOutput) { #if JVET_AB0081 - m_videoIOYuvSEIFGSFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range, m_upscaleFilterForDisplay); + m_videoIOYuvSEIFGSFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range, m_upscaleFilterForDisplay); #else - m_videoIOYuvSEIFGSFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_videoIOYuvSEIFGSFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range); #endif } else { - m_videoIOYuvSEIFGSFile[pcPic->layerId].write(pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, pcPic->getDisplayBufFG(), - m_outputColourSpaceConvert, m_packedYUVMode, - conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), - conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), - conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), - conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), - NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_videoIOYuvSEIFGSFile[pcPic->layerId].write( + pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, + pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, + conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), NUM_CHROMA_FORMAT, + m_clipOutputVideoToRec709Range); } } @@ -1147,17 +1156,14 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) const SPS* sps = pcPic->cs->sps; ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc(); - m_cTVideoIOYuvSIIPostFile.write( - pcPic->getPostRecBuf().get(COMPONENT_Y).width, - pcPic->getPostRecBuf().get(COMPONENT_Y).height, - pcPic->getPostRecBuf(), - m_outputColourSpaceConvert, - m_packedYUVMode, - conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), - conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), - conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), - conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), - NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_cTVideoIOYuvSIIPostFile.write(pcPic->getPostRecBuf().get(COMPONENT_Y).width, + pcPic->getPostRecBuf().get(COMPONENT_Y).height, pcPic->getPostRecBuf(), + m_outputColourSpaceConvert, m_packedYUVMode, + conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), + NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range); } #endif @@ -1170,20 +1176,25 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) if (m_upscaledOutput) { #if JVET_AB0081 - m_cVideoIOYuvSEICTIFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range, m_upscaleFilterForDisplay); + m_cVideoIOYuvSEICTIFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range, m_upscaleFilterForDisplay); #else - m_cVideoIOYuvSEICTIFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_cVideoIOYuvSEICTIFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range); #endif } else { - m_cVideoIOYuvSEICTIFile[pcPic->layerId].write(pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, pcPic->getDisplayBuf(), - m_outputColourSpaceConvert, m_packedYUVMode, + m_cVideoIOYuvSEICTIFile[pcPic->layerId].write( + pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, + pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), - conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), - NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), NUM_CHROMA_FORMAT, + m_clipOutputVideoToRec709Range); } } writeLineToOutputLog(pcPic); @@ -1308,21 +1319,25 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId ) { const SPS* sps = pcPic->cs->sps; #if JVET_AB0081 - m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range, m_upscaleFilterForDisplay); + m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range, m_upscaleFilterForDisplay); #else - m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); + m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range); #endif } else { - m_cVideoIOYuvReconFile[pcPic->layerId].write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(), - m_outputColourSpaceConvert, - m_packedYUVMode, - conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), - conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), - NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); + m_cVideoIOYuvReconFile[pcPic->layerId].write( + pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, + pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, + conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), NUM_CHROMA_FORMAT, + m_clipOutputVideoToRec709Range); } } // Perform FGS on decoded frame and write to output FGS file @@ -1334,20 +1349,25 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId ) if (m_upscaledOutput) { #if JVET_AB0081 - m_videoIOYuvSEIFGSFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range, m_upscaleFilterForDisplay); + m_videoIOYuvSEIFGSFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range, m_upscaleFilterForDisplay); #else - m_videoIOYuvSEIFGSFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_videoIOYuvSEIFGSFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range); #endif } else { - m_videoIOYuvSEIFGSFile[pcPic->layerId].write(pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, pcPic->getDisplayBufFG(), - m_outputColourSpaceConvert, m_packedYUVMode, - conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), - conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), - conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), - conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), - NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_videoIOYuvSEIFGSFile[pcPic->layerId].write( + pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, + pcPic->getDisplayBufFG(), m_outputColourSpaceConvert, m_packedYUVMode, + conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), NUM_CHROMA_FORMAT, + m_clipOutputVideoToRec709Range); } } @@ -1361,16 +1381,14 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId ) const SPS* sps = pcPic->cs->sps; ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc(); - m_cTVideoIOYuvSIIPostFile.write( - pcPic->getPostRecBuf().get(COMPONENT_Y).width, - pcPic->getPostRecBuf().get(COMPONENT_Y).height, - pcPic->getPostRecBuf(), - m_outputColourSpaceConvert, m_packedYUVMode, - conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), - conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), - conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), - conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), - NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_cTVideoIOYuvSIIPostFile.write(pcPic->getPostRecBuf().get(COMPONENT_Y).width, + pcPic->getPostRecBuf().get(COMPONENT_Y).height, pcPic->getPostRecBuf(), + m_outputColourSpaceConvert, m_packedYUVMode, + conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), + NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range); } #endif @@ -1383,20 +1401,25 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId ) if (m_upscaledOutput) { #if JVET_AB0081 - m_cVideoIOYuvSEICTIFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range, m_upscaleFilterForDisplay); + m_cVideoIOYuvSEICTIFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range, m_upscaleFilterForDisplay); #else - m_cVideoIOYuvSEICTIFile[pcPic->layerId].writeUpscaledPicture(*sps, *pcPic->cs->pps, pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_cVideoIOYuvSEICTIFile[pcPic->layerId].writeUpscaledPicture( + *sps, *pcPic->cs->pps, pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, + m_upscaledOutput, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range); #endif } else { - m_cVideoIOYuvSEICTIFile[pcPic->layerId].write(pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, pcPic->getDisplayBuf(), - m_outputColourSpaceConvert, m_packedYUVMode, + m_cVideoIOYuvSEICTIFile[pcPic->layerId].write( + pcPic->getRecoBuf().get(COMPONENT_Y).width, pcPic->getRecoBuf().get(COMPONENT_Y).height, + pcPic->getDisplayBuf(), m_outputColourSpaceConvert, m_packedYUVMode, conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), - conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), - NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), NUM_CHROMA_FORMAT, + m_clipOutputVideoToRec709Range); } } writeLineToOutputLog(pcPic); diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp index e5f1a7ccb7651d332bf1f319f5afc1f1093e37c5..68d4f9a02849173f7bdfe7dc79fd04bf3dd0b7ce 100644 --- a/source/App/DecoderApp/DecAppCfg.cpp +++ b/source/App/DecoderApp/DecAppCfg.cpp @@ -107,7 +107,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) #if JVET_S0257_DUMP_360SEI_MESSAGE ("360DumpFile", m_outputDecoded360SEIMessagesFilename, string(""), "When non empty, output decoded 360 SEI messages to the indicated file.\n") #endif - ("ClipOutputVideoToRec709Range", m_bClipOutputVideoToRec709Range, false, "If true then clip output video to the Rec. 709 Range on saving") + ("ClipOutputVideoToRec709Range", m_clipOutputVideoToRec709Range, false, "If true then clip output video to the Rec. 709 Range on saving") ("PYUV", m_packedYUVMode, false, "If true then output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data. Ignored for interlaced output.") #if ENABLE_TRACING ("TraceChannelsList", bTracingChannelsList, false, "List all available tracing channels" ) @@ -281,7 +281,7 @@ DecAppCfg::DecAppCfg() #if JVET_S0257_DUMP_360SEI_MESSAGE , m_outputDecoded360SEIMessagesFilename() #endif -, m_bClipOutputVideoToRec709Range(false) +, m_clipOutputVideoToRec709Range(false) , m_packedYUVMode(false) , m_statMode(0) , m_mctsCheck(false) diff --git a/source/App/DecoderApp/DecAppCfg.h b/source/App/DecoderApp/DecAppCfg.h index 4721ba11bb0d010748aedbafd5ea8e5d943073a2..4f1c5113086ff958f6eaad56158ed6e85395e49f 100644 --- a/source/App/DecoderApp/DecAppCfg.h +++ b/source/App/DecoderApp/DecAppCfg.h @@ -85,7 +85,7 @@ protected: std::string m_shutterIntervalPostFileName; ///< output Post Filtering file name #endif - bool m_bClipOutputVideoToRec709Range; ///< If true, clip the output video to the Rec 709 range on saving. + bool m_clipOutputVideoToRec709Range; ///< If true, clip the output video to the Rec 709 range on saving. bool m_packedYUVMode; ///< If true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data std::string m_cacheCfgFile; ///< Config file of cache model int m_statMode; ///< Config statistic mode (0 - bit stat, 1 - tool stat, 3 - both) diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 005392c1c8a44d3e0ee65348426e1504e43f6f2e..1453c892e22496ddb26585423ad14d69ba8338f2 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -59,7 +59,7 @@ EncApp::EncApp( fstream& bitStream, EncLibCommon* encLibCommon ) : m_cEncLib( encLibCommon ) , m_bitstream( bitStream ) { - m_iFrameRcvd = 0; + m_frameRcvd = 0; m_totalBytes = 0; m_essentialBytes = 0; #if JVET_O0756_CALCULATE_HDRMETRICS @@ -256,12 +256,15 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setPrintWPSNR ( m_printWPSNR ); m_cEncLib.setCabacZeroWordPaddingEnabled ( m_cabacZeroWordPaddingEnabled ); - m_cEncLib.setFrameRate ( m_iFrameRate ); - m_cEncLib.setFrameSkip ( m_FrameSkip ); + m_cEncLib.setFrameRate(m_frameRate); + m_cEncLib.setFrameSkip(m_frameSkip); m_cEncLib.setTemporalSubsampleRatio ( m_temporalSubsampleRatio ); m_cEncLib.setSourceWidth ( m_sourceWidth ); m_cEncLib.setSourceHeight ( m_sourceHeight ); - m_cEncLib.setConformanceWindow ( m_confWinLeft / SPS::getWinUnitX( m_InputChromaFormatIDC ), m_confWinRight / SPS::getWinUnitX( m_InputChromaFormatIDC ), m_confWinTop / SPS::getWinUnitY( m_InputChromaFormatIDC ), m_confWinBottom / SPS::getWinUnitY( m_InputChromaFormatIDC ) ); + m_cEncLib.setConformanceWindow(m_confWinLeft / SPS::getWinUnitX(m_inputChromaFormatIDC), + m_confWinRight / SPS::getWinUnitX(m_inputChromaFormatIDC), + m_confWinTop / SPS::getWinUnitY(m_inputChromaFormatIDC), + m_confWinBottom / SPS::getWinUnitY(m_inputChromaFormatIDC)); m_cEncLib.setScalingRatio ( m_scalingRatioHor, m_scalingRatioVer ); #if JVET_AB0080 m_cEncLib.setGOPBasedRPREnabledFlag (m_gopBasedRPREnabledFlag); @@ -313,19 +316,24 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setNoCuQpDeltaConstraintFlag(m_noCuQpDeltaConstraintFlag); m_cEncLib.setNoTrailConstraintFlag(m_noTrailConstraintFlag); - CHECK(m_noTrailConstraintFlag && m_iIntraPeriod != 1, "TRAIL shall be deactivated when m_noTrailConstraintFlag is equal to 1"); + CHECK(m_noTrailConstraintFlag && m_intraPeriod != 1, + "TRAIL shall be deactivated when m_noTrailConstraintFlag is equal to 1"); m_cEncLib.setNoStsaConstraintFlag(m_noStsaConstraintFlag); - CHECK(m_noStsaConstraintFlag && (m_iIntraPeriod != 1 || xHasNonZeroTemporalID()), "STSA shall be deactivated when m_noStsaConstraintFlag is equal to 1"); + CHECK(m_noStsaConstraintFlag && (m_intraPeriod != 1 || xHasNonZeroTemporalID()), + "STSA shall be deactivated when m_noStsaConstraintFlag is equal to 1"); m_cEncLib.setNoRaslConstraintFlag(m_noRaslConstraintFlag); - CHECK(m_noRaslConstraintFlag && (m_iIntraPeriod != 1 || xHasLeadingPicture()), "RASL shall be deactivated when m_noRaslConstraintFlag is equal to 1"); + CHECK(m_noRaslConstraintFlag && (m_intraPeriod != 1 || xHasLeadingPicture()), + "RASL shall be deactivated when m_noRaslConstraintFlag is equal to 1"); m_cEncLib.setNoRadlConstraintFlag(m_noRadlConstraintFlag); - CHECK(m_noRadlConstraintFlag && (m_iIntraPeriod != 1 || xHasLeadingPicture()), "RADL shall be deactivated when m_noRadlConstraintFlag is equal to 1"); + CHECK(m_noRadlConstraintFlag && (m_intraPeriod != 1 || xHasLeadingPicture()), + "RADL shall be deactivated when m_noRadlConstraintFlag is equal to 1"); m_cEncLib.setNoCraConstraintFlag(m_noCraConstraintFlag); - CHECK(m_noCraConstraintFlag && (m_iDecodingRefreshType == 1), "CRA shall be deactivated when m_noCraConstraintFlag is equal to 1"); + CHECK(m_noCraConstraintFlag && (m_intraRefreshType == 1), + "CRA shall be deactivated when m_noCraConstraintFlag is equal to 1"); m_cEncLib.setNoRprConstraintFlag(m_noRprConstraintFlag); CHECK(m_noRprConstraintFlag && m_rprEnabledFlag, "Reference picture resampling shall be deactivated when m_noRprConstraintFlag is equal to 1"); @@ -346,7 +354,8 @@ void EncApp::xInitLibCfg( int layerIdx ) CHECK(m_noQtbttDualTreeIntraConstraintFlag && m_dualTree, "Dual tree shall be deactivated when m_bNoQtbttDualTreeIntraConstraintFlag is equal to 1"); m_cEncLib.setMaxLog2CtuSizeConstraintIdc(m_maxLog2CtuSizeConstraintIdc); - CHECK( m_uiCTUSize > (1<<(m_maxLog2CtuSizeConstraintIdc)), "CTUSize shall be less than or equal to 1 << m_maxLog2CtuSize"); + CHECK(m_ctuSize > (1 << (m_maxLog2CtuSizeConstraintIdc)), + "CTUSize shall be less than or equal to 1 << m_maxLog2CtuSize"); m_cEncLib.setNoPartitionConstraintsOverrideConstraintFlag(m_noPartitionConstraintsOverrideConstraintFlag); CHECK(m_noPartitionConstraintsOverrideConstraintFlag && m_SplitConsOverrideEnabledFlag, "Partition override shall be deactivated when m_noPartitionConstraintsOverrideConstraintFlag is equal to 1"); @@ -553,7 +562,7 @@ void EncApp::xInitLibCfg( int layerIdx ) } //====== Coding Structure ======== - m_cEncLib.setIntraPeriod ( m_iIntraPeriod ); + m_cEncLib.setIntraPeriod(m_intraPeriod); #if GDR_ENABLED m_cEncLib.setGdrEnabled ( m_gdrEnabled ); m_cEncLib.setGdrPeriod ( m_gdrPeriod ); @@ -561,8 +570,8 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setGdrInterval ( m_gdrInterval); m_cEncLib.setGdrNoHash ( m_gdrNoHash ); #endif - m_cEncLib.setDecodingRefreshType ( m_iDecodingRefreshType ); - m_cEncLib.setGOPSize ( m_iGOPSize ); + m_cEncLib.setDecodingRefreshType(m_intraRefreshType); + m_cEncLib.setGOPSize(m_gopSize); m_cEncLib.setDrapPeriod ( m_drapPeriod ); m_cEncLib.setEdrapPeriod ( m_edrapPeriod ); m_cEncLib.setReWriteParamSets ( m_rewriteParamSets ); @@ -676,7 +685,7 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setUseRDOQTS ( m_useRDOQTS ); m_cEncLib.setUseSelectiveRDOQ ( m_useSelectiveRDOQ ); m_cEncLib.setRDpenalty ( m_rdPenalty ); - m_cEncLib.setCTUSize ( m_uiCTUSize ); + m_cEncLib.setCTUSize(m_ctuSize); m_cEncLib.setSubPicInfoPresentFlag ( m_subPicInfoPresentFlag ); if(m_subPicInfoPresentFlag) { @@ -704,11 +713,11 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setUseSplitConsOverride ( m_SplitConsOverrideEnabledFlag ); // convert the Intra Chroma minQT setting from chroma unit to luma unit - m_uiMinQT[2] <<= getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC); - m_cEncLib.setMinQTSizes ( m_uiMinQT ); + m_minQt[2] <<= getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC); + m_cEncLib.setMinQTSizes(m_minQt); m_cEncLib.setMaxMTTHierarchyDepth ( m_uiMaxMTTHierarchyDepth, m_uiMaxMTTHierarchyDepthI, m_uiMaxMTTHierarchyDepthIChroma ); - m_cEncLib.setMaxBTSizes ( m_uiMaxBT ); - m_cEncLib.setMaxTTSizes ( m_uiMaxTT ); + m_cEncLib.setMaxBTSizes(m_maxBt); + m_cEncLib.setMaxTTSizes(m_maxTt); m_cEncLib.setFastTTskip ( m_ttFastSkip ); m_cEncLib.setFastTTskipThr ( m_ttFastSkipThr ); m_cEncLib.setDualITree ( m_dualTree ); @@ -787,8 +796,8 @@ void EncApp::xInitLibCfg( int layerIdx ) } } - m_cEncLib.setMaxCUWidth ( m_uiCTUSize ); - m_cEncLib.setMaxCUHeight ( m_uiCTUSize ); + m_cEncLib.setMaxCUWidth(m_ctuSize); + m_cEncLib.setMaxCUHeight(m_ctuSize); m_cEncLib.setLog2MinCodingBlockSize ( m_log2MinCuSize ); m_cEncLib.setLog2MaxTbSize ( m_log2MaxTbSize ); m_cEncLib.setUseEncDbOpt(m_encDbOpt); @@ -1366,12 +1375,14 @@ void EncApp::xInitLibCfg( int layerIdx ) void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId ) { // Video I/O - m_cVideoIOYuvInputFile.open( m_inputFileName, false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth ); // read mode + m_cVideoIOYuvInputFile.open(m_inputFileName, false, m_inputBitDepth, m_msbExtendedBitDepth, + m_internalBitDepth); // read mode #if EXTENSION_360_VIDEO - m_cVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_inputFileWidth, m_inputFileHeight, m_InputChromaFormatIDC); + m_cVideoIOYuvInputFile.skipFrames(m_frameSkip, m_inputFileWidth, m_inputFileHeight, m_inputChromaFormatIDC); #else const int sourceHeight = m_isField ? m_iSourceHeightOrg : m_sourceHeight; - m_cVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_sourceWidth - m_sourcePadding[0], sourceHeight - m_sourcePadding[1], m_InputChromaFormatIDC); + m_cVideoIOYuvInputFile.skipFrames(m_frameSkip, m_sourceWidth - m_sourcePadding[0], sourceHeight - m_sourcePadding[1], + m_inputChromaFormatIDC); #endif if (!m_reconFileName.empty()) { @@ -1404,7 +1415,8 @@ void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId ) const auto sx = SPS::getWinUnitX(m_chromaFormatIDC); const auto sy = SPS::getWinUnitY(m_chromaFormatIDC); m_cVideoIOYuvReconFile.setOutputY4mInfo(m_sourceWidth - (m_confWinLeft + m_confWinRight) * sx, - m_sourceHeight - (m_confWinTop + m_confWinBottom) * sy, m_iFrameRate, 1, m_internalBitDepth[0], m_chromaFormatIDC); + m_sourceHeight - (m_confWinTop + m_confWinBottom) * sy, m_frameRate, 1, + m_internalBitDepth[0], m_chromaFormatIDC); } m_cVideoIOYuvReconFile.open( reconFileName, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth ); // write mode } @@ -1419,7 +1431,7 @@ void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId ) m_cEncLib.create( layerId ); // create the output buffer - for( int i = 0; i < (m_iGOPSize + 1 + (m_isField ? 1 : 0)); i++ ) + for (int i = 0; i < (m_gopSize + 1 + (m_isField ? 1 : 0)); i++) { recBufList.push_back( new PelUnitBuf ); } @@ -1509,23 +1521,20 @@ void EncApp::createLib( const int layerIdx ) if( m_gopBasedTemporalFilterEnabled || m_bimEnabled ) { - m_temporalFilter.init(m_FrameSkip, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth, m_sourceWidth, - sourceHeight, m_sourcePadding, m_bClipInputVideoToRec709Range, m_inputFileName, + m_temporalFilter.init(m_frameSkip, m_inputBitDepth, m_msbExtendedBitDepth, m_internalBitDepth, m_sourceWidth, + sourceHeight, m_sourcePadding, m_clipInputVideoToRec709Range, m_inputFileName, m_chromaFormatIDC, m_inputColourSpaceConvert, m_iQP, m_gopBasedTemporalFilterStrengths, m_gopBasedTemporalFilterPastRefs, m_gopBasedTemporalFilterFutureRefs, m_firstValidFrame, - m_lastValidFrame - , m_gopBasedTemporalFilterEnabled, m_cEncLib.getAdaptQPmap(), m_cEncLib.getBIM(), m_uiCTUSize - ); + m_lastValidFrame, m_gopBasedTemporalFilterEnabled, m_cEncLib.getAdaptQPmap(), + m_cEncLib.getBIM(), m_ctuSize); } if ( m_fgcSEIAnalysisEnabled && m_fgcSEIExternalDenoised.empty() ) { - m_temporalFilterForFG.init(m_FrameSkip, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth, m_sourceWidth, - sourceHeight, m_sourcePadding, m_bClipInputVideoToRec709Range, m_inputFileName, + m_temporalFilterForFG.init(m_frameSkip, m_inputBitDepth, m_msbExtendedBitDepth, m_internalBitDepth, m_sourceWidth, + sourceHeight, m_sourcePadding, m_clipInputVideoToRec709Range, m_inputFileName, m_chromaFormatIDC, m_inputColourSpaceConvert, m_iQP, m_fgcSEITemporalFilterStrengths, m_fgcSEITemporalFilterPastRefs, m_fgcSEITemporalFilterFutureRefs, m_firstValidFrame, - m_lastValidFrame - , true, m_cEncLib.getAdaptQPmap(), m_cEncLib.getBIM(), m_uiCTUSize - ); + m_lastValidFrame, true, m_cEncLib.getAdaptQPmap(), m_cEncLib.getBIM(), m_ctuSize); } } @@ -1606,35 +1615,38 @@ bool EncApp::encodePrep( bool& eos ) } else { - m_cVideoIOYuvInputFile.read( *m_orgPic, *m_trueOrgPic, ipCSC, m_sourcePadding, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range ); + m_cVideoIOYuvInputFile.read(*m_orgPic, *m_trueOrgPic, ipCSC, m_sourcePadding, m_inputChromaFormatIDC, + m_clipInputVideoToRec709Range); } #else - m_cVideoIOYuvInputFile.read( *m_orgPic, *m_trueOrgPic, ipCSC, m_sourcePadding, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range ); + m_cVideoIOYuvInputFile.read(*m_orgPic, *m_trueOrgPic, ipCSC, m_sourcePadding, m_inputChromaFormatIDC, + m_clipInputVideoToRec709Range); #endif if (m_fgcSEIAnalysisEnabled && m_fgcSEIExternalDenoised.empty()) { m_filteredOrgPicForFG->copyFrom(*m_orgPic); - m_temporalFilterForFG.filter(m_filteredOrgPicForFG, m_iFrameRcvd); + m_temporalFilterForFG.filter(m_filteredOrgPicForFG, m_frameRcvd); } if ( m_gopBasedTemporalFilterEnabled || m_bimEnabled ) { - m_temporalFilter.filter(m_orgPic, m_iFrameRcvd); + m_temporalFilter.filter(m_orgPic, m_frameRcvd); m_filteredOrgPic->copyFrom(*m_orgPic); } // increase number of received frames - m_iFrameRcvd++; + m_frameRcvd++; - eos = ( m_isField && ( m_iFrameRcvd == ( m_framesToBeEncoded >> 1 ) ) ) || ( !m_isField && ( m_iFrameRcvd == m_framesToBeEncoded ) ); + eos = + (m_isField && (m_frameRcvd == (m_framesToBeEncoded >> 1))) || (!m_isField && (m_frameRcvd == m_framesToBeEncoded)); // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures if( m_cVideoIOYuvInputFile.isEof() ) { m_flush = true; eos = true; - m_iFrameRcvd--; - m_cEncLib.setFramesToBeEncoded( m_iFrameRcvd ); + m_frameRcvd--; + m_cEncLib.setFramesToBeEncoded(m_frameRcvd); } bool keepDoing = false; @@ -1656,8 +1668,9 @@ bool EncApp::encodePrep( bool& eos ) #if JVET_Z0120_SII_SEI_PROCESSING if (m_ShutterFilterEnable && !m_shutterIntervalPreFileName.empty()) { - m_cTVideoIOYuvSIIPreFile.write(m_orgPic->get(COMPONENT_Y).width, m_orgPic->get(COMPONENT_Y).height, *m_orgPic, m_inputColourSpaceConvert, m_packedYUVMode, - m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_cTVideoIOYuvSIIPreFile.write(m_orgPic->get(COMPONENT_Y).width, m_orgPic->get(COMPONENT_Y).height, *m_orgPic, + m_inputColourSpaceConvert, m_packedYUVMode, m_confWinLeft, m_confWinRight, + m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_clipOutputVideoToRec709Range); } #endif @@ -1695,10 +1708,12 @@ bool EncApp::encode() if( m_temporalSubsampleRatio > 1 ) { #if EXTENSION_360_VIDEO - m_cVideoIOYuvInputFile.skipFrames( m_temporalSubsampleRatio - 1, m_inputFileWidth, m_inputFileHeight, m_InputChromaFormatIDC ); + m_cVideoIOYuvInputFile.skipFrames(m_temporalSubsampleRatio - 1, m_inputFileWidth, m_inputFileHeight, + m_inputChromaFormatIDC); #else const int sourceHeight = m_isField ? m_iSourceHeightOrg : m_sourceHeight; - m_cVideoIOYuvInputFile.skipFrames( m_temporalSubsampleRatio - 1, m_sourceWidth - m_sourcePadding[0], sourceHeight - m_sourcePadding[1], m_InputChromaFormatIDC ); + m_cVideoIOYuvInputFile.skipFrames(m_temporalSubsampleRatio - 1, m_sourceWidth - m_sourcePadding[0], + sourceHeight - m_sourcePadding[1], m_inputChromaFormatIDC); #endif } } @@ -1788,16 +1803,25 @@ void EncApp::xWriteOutput(int numEncoded, std::list<PelUnitBuf *> &recBufList) if( m_cEncLib.isResChangeInClvsEnabled() && m_cEncLib.getUpscaledOutput() ) { #if JVET_AB0081 - m_cVideoIOYuvReconFile.writeUpscaledPicture(sps, pps, *pcPicYuvRec, ipCSC, m_packedYUVMode, m_cEncLib.getUpscaledOutput(), NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range, m_upscaleFilterForDisplay); + m_cVideoIOYuvReconFile.writeUpscaledPicture(sps, pps, *pcPicYuvRec, ipCSC, m_packedYUVMode, + m_cEncLib.getUpscaledOutput(), NUM_CHROMA_FORMAT, + m_clipOutputVideoToRec709Range, m_upscaleFilterForDisplay); #else - m_cVideoIOYuvReconFile.writeUpscaledPicture( sps, pps, *pcPicYuvRec, ipCSC, m_packedYUVMode, m_cEncLib.getUpscaledOutput(), NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); + m_cVideoIOYuvReconFile.writeUpscaledPicture(sps, pps, *pcPicYuvRec, ipCSC, m_packedYUVMode, + m_cEncLib.getUpscaledOutput(), NUM_CHROMA_FORMAT, + m_clipOutputVideoToRec709Range); #endif } else { Window confWindowPPS = pps.getConformanceWindow(); - m_cVideoIOYuvReconFile.write(pcPicYuvRec->get(COMPONENT_Y).width, pcPicYuvRec->get(COMPONENT_Y).height, *pcPicYuvRec, ipCSC, m_packedYUVMode, - confWindowPPS.getWindowLeftOffset()*SPS::getWinUnitX(m_cEncLib.getChromaFormatIdc()), confWindowPPS.getWindowRightOffset()*SPS::getWinUnitX(m_cEncLib.getChromaFormatIdc()), confWindowPPS.getWindowTopOffset()*SPS::getWinUnitY(m_cEncLib.getChromaFormatIdc()), confWindowPPS.getWindowBottomOffset() * SPS::getWinUnitY(m_cEncLib.getChromaFormatIdc()), NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range); + m_cVideoIOYuvReconFile.write( + pcPicYuvRec->get(COMPONENT_Y).width, pcPicYuvRec->get(COMPONENT_Y).height, *pcPicYuvRec, ipCSC, + m_packedYUVMode, confWindowPPS.getWindowLeftOffset() * SPS::getWinUnitX(m_cEncLib.getChromaFormatIdc()), + confWindowPPS.getWindowRightOffset() * SPS::getWinUnitX(m_cEncLib.getChromaFormatIdc()), + confWindowPPS.getWindowTopOffset() * SPS::getWinUnitY(m_cEncLib.getChromaFormatIdc()), + confWindowPPS.getWindowBottomOffset() * SPS::getWinUnitY(m_cEncLib.getChromaFormatIdc()), NUM_CHROMA_FORMAT, + m_clipOutputVideoToRec709Range); } } } @@ -1853,7 +1877,7 @@ void EncApp::rateStatsAccum(const AccessUnit& au, const std::vector<uint32_t>& a void EncApp::printRateSummary() { - double time = (double) m_iFrameRcvd / m_iFrameRate * m_temporalSubsampleRatio; + double time = (double) m_frameRcvd / m_frameRate * m_temporalSubsampleRatio; msg( DETAILS,"Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time ); if (m_summaryVerboseness > 0) { @@ -1866,7 +1890,7 @@ void EncApp::printChromaFormat() if( g_verbosity >= DETAILS ) { std::cout << std::setw(43) << "Input ChromaFormatIDC = "; - switch (m_InputChromaFormatIDC) + switch (m_inputChromaFormatIDC) { case CHROMA_400: std::cout << " 4:0:0"; break; case CHROMA_420: std::cout << " 4:2:0"; break; diff --git a/source/App/EncoderApp/EncApp.h b/source/App/EncoderApp/EncApp.h index 7c4138c60d8aff97c6eb14a243bc21c62330c2ce..d95b564f5151dcee82c2d569c2bea57e19bad1ea 100644 --- a/source/App/EncoderApp/EncApp.h +++ b/source/App/EncoderApp/EncApp.h @@ -74,7 +74,7 @@ private: #if JVET_Z0120_SII_SEI_PROCESSING VideoIOYuv m_cTVideoIOYuvSIIPreFile; ///< output pre-filtered file #endif - int m_iFrameRcvd; ///< number of received frames + int m_frameRcvd; ///< number of received frames uint32_t m_essentialBytes; uint32_t m_totalBytes; std::fstream &m_bitstream; diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index da97b78e23310cc71be984e492c37e9dde0a9a1f..35dc7265672849209ebb90561354c7577f94e50e 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -767,11 +767,11 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SourceHeight,-hgt", m_sourceHeight, 0, "Source picture height") ("InputBitDepth", m_inputBitDepth[CHANNEL_TYPE_LUMA], 8, "Bit-depth of input file") ("OutputBitDepth", m_outputBitDepth[CHANNEL_TYPE_LUMA], 0, "Bit-depth of output file (default:InternalBitDepth)") - ("MSBExtendedBitDepth", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], 0, "bit depth of luma component after addition of MSBs of value 0 (used for synthesising High Dynamic Range source material). (default:InputBitDepth)") + ("MSBExtendedBitDepth", m_msbExtendedBitDepth[CHANNEL_TYPE_LUMA], 0, "bit depth of luma component after addition of MSBs of value 0 (used for synthesising High Dynamic Range source material). (default:InputBitDepth)") ("InternalBitDepth", m_internalBitDepth[CHANNEL_TYPE_LUMA], 0, "Bit-depth the codec operates at. (default: MSBExtendedBitDepth). If different to MSBExtendedBitDepth, source data will be converted") ("InputBitDepthC", m_inputBitDepth[CHANNEL_TYPE_CHROMA], 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") ("OutputBitDepthC", m_outputBitDepth[CHANNEL_TYPE_CHROMA], 0, "As per OutputBitDepth but for chroma component. (default: use luma output bit-depth)") - ("MSBExtendedBitDepthC", m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA], 0, "As per MSBExtendedBitDepth but for chroma component. (default:MSBExtendedBitDepth)") + ("MSBExtendedBitDepthC", m_msbExtendedBitDepth[CHANNEL_TYPE_CHROMA], 0, "As per MSBExtendedBitDepth but for chroma component. (default:MSBExtendedBitDepth)") ("ExtendedPrecision", m_extendedPrecisionProcessingFlag, false, "Increased internal accuracies to support high bit depths (not valid in V1 profiles)") ("TSRCRicePresent", m_tsrcRicePresentFlag, false, "Indicate that TSRC Rice information is present in slice header (not valid in V1 profiles)") ("ReverseLastSigCoeff", m_reverseLastSigCoeffEnabledFlag, false, "enable reverse last significant coefficient postion in RRC (not valid in V1 profiles)") @@ -797,12 +797,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3") ("AccessUnitDelimiter", m_AccessUnitDelimiter, false, "Enable Access Unit Delimiter NALUs") ("EnablePictureHeaderInSliceHeader", m_enablePictureHeaderInSliceHeader, true, "Enable Picture Header in Slice Header") - ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") - ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") + ("FrameRate,-fr", m_frameRate, 0, "Frame rate") + ("FrameSkip,-fs", m_frameSkip, 0u, "Number of frames to skip at start of input YUV") ("TemporalSubsampleRatio,-ts", m_temporalSubsampleRatio, 1u, "Temporal sub-sample ratio when reading input YUV") ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") - ("ClipInputVideoToRec709Range", m_bClipInputVideoToRec709Range, false, "If true then clip input video to the Rec. 709 Range on loading when InternalBitDepth is less than MSBExtendedBitDepth") - ("ClipOutputVideoToRec709Range", m_bClipOutputVideoToRec709Range, false, "If true then clip output video to the Rec. 709 Range on saving when OutputBitDepth is less than InternalBitDepth") + ("ClipInputVideoToRec709Range", m_clipInputVideoToRec709Range, false, "If true then clip input video to the Rec. 709 Range on loading when InternalBitDepth is less than MSBExtendedBitDepth") + ("ClipOutputVideoToRec709Range", m_clipOutputVideoToRec709Range, false, "If true then clip output video to the Rec. 709 Range on saving when OutputBitDepth is less than InternalBitDepth") ("PYUV", m_packedYUVMode, false, "If true then output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data. Ignored for interlaced output.") ("SummaryOutFilename", m_summaryOutFilename, string(), "Filename to use for producing summary output file. If empty, do not produce a file.") ("SummaryPicFilenameBase", m_summaryPicFilenameBase, string(), "Base filename to use for producing summary picture output files. The actual filenames used will have I.txt, P.txt and B.txt appended. If empty, do not produce a file.") @@ -930,7 +930,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("NoPersistentRiceAdaptationConstraintFlag", m_noPersistentRiceAdaptationConstraintFlag, false, "Indicate that GolombRiceParameterAdaptation is deactivated") ("NoReverseLastSigCoeffConstraintFlag", m_noReverseLastSigCoeffConstraintFlag, false, "Indicate that ReverseLastSigCoeff is deactivated") - ("CTUSize", m_uiCTUSize, 128u, "CTUSize (specifies the CTU size if QTBT is on) [default: 128]") + ("CTUSize", m_ctuSize, 128u, "CTUSize (specifies the CTU size if QTBT is on) [default: 128]") ("Log2MinCuSize", m_log2MinCuSize, 2u, "Log2 min CU size") ("SubPicInfoPresentFlag", m_subPicInfoPresentFlag, false, "equal to 1 specifies that subpicture parameters are present in in the SPS RBSP syntax") ("NumSubPics", m_numSubPics, 0u, "specifies the number of subpictures") @@ -947,20 +947,20 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SubPicId", cfg_subPicId, cfg_subPicId, "specifies that subpicture ID of the i-th subpicture") ("SingleSlicePerSubpic", m_singleSlicePerSubPicFlag, false, "Enables setting of a single slice per sub-picture (no explicit configuration required)") ("EnablePartitionConstraintsOverride", m_SplitConsOverrideEnabledFlag, true, "Enable partition constraints override") - ("MinQTISlice", m_uiMinQT[0], 8u, "MinQTISlice") - ("MinQTLumaISlice", m_uiMinQT[0], 8u, "MinQTLumaISlice") - ("MinQTChromaISliceInChromaSamples", m_uiMinQT[2], 4u, "MinQTChromaISliceInChromaSamples") - ("MinQTNonISlice", m_uiMinQT[1], 8u, "MinQTNonISlice") + ("MinQTISlice", m_minQt[0], 8u, "MinQTISlice") + ("MinQTLumaISlice", m_minQt[0], 8u, "MinQTLumaISlice") + ("MinQTChromaISliceInChromaSamples", m_minQt[2], 4u, "MinQTChromaISliceInChromaSamples") + ("MinQTNonISlice", m_minQt[1], 8u, "MinQTNonISlice") ("MaxMTTHierarchyDepth", m_uiMaxMTTHierarchyDepth, 3u, "MaxMTTHierarchyDepth") ("MaxMTTHierarchyDepthI", m_uiMaxMTTHierarchyDepthI, 3u, "MaxMTTHierarchyDepthI") ("MaxMTTHierarchyDepthISliceL", m_uiMaxMTTHierarchyDepthI, 3u, "MaxMTTHierarchyDepthISliceL") ("MaxMTTHierarchyDepthISliceC", m_uiMaxMTTHierarchyDepthIChroma, 3u, "MaxMTTHierarchyDepthISliceC") - ("MaxBTLumaISlice", m_uiMaxBT[0], 32u, "MaxBTLumaISlice") - ("MaxBTChromaISlice", m_uiMaxBT[2], 64u, "MaxBTChromaISlice") - ("MaxBTNonISlice", m_uiMaxBT[1], 128u, "MaxBTNonISlice") - ("MaxTTLumaISlice", m_uiMaxTT[0], 32u, "MaxTTLumaISlice") - ("MaxTTChromaISlice", m_uiMaxTT[2], 32u, "MaxTTChromaISlice") - ("MaxTTNonISlice", m_uiMaxTT[1], 64u, "MaxTTNonISlice") + ("MaxBTLumaISlice", m_maxBt[0], 32u, "MaxBTLumaISlice") + ("MaxBTChromaISlice", m_maxBt[2], 64u, "MaxBTChromaISlice") + ("MaxBTNonISlice", m_maxBt[1], 128u, "MaxBTNonISlice") + ("MaxTTLumaISlice", m_maxTt[0], 32u, "MaxTTLumaISlice") + ("MaxTTChromaISlice", m_maxTt[2], 32u, "MaxTTChromaISlice") + ("MaxTTNonISlice", m_maxTt[1], 64u, "MaxTTNonISlice") ("TTFastSkip", m_ttFastSkip, 31, "fast skip method for TT split partition") ("TTFastSkipThr", m_ttFastSkipThr, 1.075, "Threshold value of fast skip method for TT split partition") ("DualITree", m_dualTree, false, "Use separate QTBT trees for intra slice luma and chroma channel types") @@ -1063,16 +1063,16 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("SplitPredictAdaptMode", m_fastAdaptCostPredMode, 0, "Mode for split cost prediction, 0..2 (Default: 0)" ) ("DisableFastTTfromBT", m_disableFastDecisionTT, false, "Disable fast decision for TT from BT") // Unit definition parameters - ("MaxCUWidth", m_uiMaxCUWidth, 64u) - ("MaxCUHeight", m_uiMaxCUHeight, 64u) + ("MaxCUWidth", m_maxCuWidth, 64u) + ("MaxCUHeight", m_maxCuHeight, 64u) // todo: remove defaults from MaxCUSize - ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "Maximum CU size") - ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") + ("MaxCUSize,s", m_maxCuWidth, 64u, "Maximum CU size") + ("MaxCUSize,s", m_maxCuHeight, 64u, "Maximum CU size") ("Log2MaxTbSize", m_log2MaxTbSize, 6, "Maximum transform block size in logarithm base 2 (Default: 6)") // Coding structure paramters - ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") + ("IntraPeriod,-ip", m_intraPeriod, -1, "Intra period in frames, (-1: only first frame)") #if GDR_ENABLED ("GdrEnabled", m_gdrEnabled, false, "GDR enabled") ("GdrPocStart", m_gdrPocStart, -1, "GDR poc start") @@ -1080,8 +1080,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("GdrInterval", m_gdrInterval, -1, "Number of frames from GDR picture to the recovery point picture") ("GdrNoHash", m_gdrNoHash, true, "Do not generate decode picture hash SEI messages for GDR and recovering pictures") #endif - ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)") - ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") + ("DecodingRefreshType,-dr", m_intraRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)") + ("GOPSize,g", m_gopSize, 1, "GOP size of temporal structure") ("DRAPPeriod", m_drapPeriod, 0, "DRAP period in frames (0: disable Dependent RAP indication SEI messages)") ("EDRAPPeriod", m_edrapPeriod, 0, "EDRAP period in frames (0: disable Extended Dependent RAP indication SEI messages)") ("ReWriteParamSets", m_rewriteParamSets, false, "Enable rewriting of Parameter sets before every (intra) random access point") @@ -1875,29 +1875,29 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) if (m_resChangeInClvsEnabled && !m_switchPocPeriod) { - m_switchPocPeriod = m_iFrameRate / 2 / m_iGOPSize * m_iGOPSize; + m_switchPocPeriod = m_frameRate / 2 / m_gopSize * m_gopSize; } //Check the given value of intra period and decoding refresh type. If intra period is -1, set decoding refresh type to be equal to 0. And vice versa - if( m_iIntraPeriod == -1 ) + if (m_intraPeriod == -1) { - m_iDecodingRefreshType = 0; + m_intraRefreshType = 0; } - if( !m_iDecodingRefreshType ) + if (!m_intraRefreshType) { - m_iIntraPeriod = -1; + m_intraPeriod = -1; } #if GDR_ENABLED if ( m_gdrEnabled ) { - m_iDecodingRefreshType = 3; + m_intraRefreshType = 3; m_intraQPOffset = 0; - for (int i = 1; i < m_iGOPSize; i++) + for (int i = 1; i < m_gopSize; i++) { m_GOPList[i].m_POC = -1; } - m_iGOPSize = 1; + m_gopSize = 1; int8_t sliceType = m_GOPList[0].m_sliceType; @@ -1939,12 +1939,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) if (m_gdrPeriod < 0) { - m_gdrPeriod = m_iFrameRate * 2; + m_gdrPeriod = m_frameRate * 2; } if (m_gdrInterval < 0) { - m_gdrInterval = m_iFrameRate; + m_gdrInterval = m_frameRate; } if (m_gdrPocStart < 0) @@ -1952,19 +1952,23 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_gdrPocStart = m_gdrPeriod; } - if (m_iIntraPeriod == -1) + if (m_intraPeriod == -1) { - m_iFrameRate = (m_iFrameRate == 0) ? 30 : m_iFrameRate; - if (m_gdrPocStart % m_iFrameRate != 0) - m_iIntraPeriod = -1; + m_frameRate = (m_frameRate == 0) ? 30 : m_frameRate; + if (m_gdrPocStart % m_frameRate != 0) + { + m_intraPeriod = -1; + } else - m_iIntraPeriod = m_gdrPeriod; + { + m_intraPeriod = m_gdrPeriod; + } } } #endif m_bpDeltasGOPStructure = false; - if(m_iGOPSize == 16) + if (m_gopSize == 16) { if ((m_GOPList[0].m_POC == 16 && m_GOPList[0].m_temporalId == 0 ) && (m_GOPList[1].m_POC == 8 && m_GOPList[1].m_temporalId == 1 ) @@ -1986,7 +1990,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_bpDeltasGOPStructure = true; } } - else if(m_iGOPSize == 8) + else if (m_gopSize == 8) { if ((m_GOPList[0].m_POC == 8 && m_GOPList[0].m_temporalId == 0 ) && (m_GOPList[1].m_POC == 4 && m_GOPList[1].m_temporalId == 1 ) @@ -2026,7 +2030,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) if (m_compositeRefEnabled) { - for (int i = 0; i < m_iGOPSize; i++) + for (int i = 0; i < m_gopSize; i++) { m_GOPList[i].m_POC *= 2; m_RPLList0[i].m_POC *= 2; @@ -2072,7 +2076,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #if EXTENSION_360_VIDEO m_inputFileWidth = m_sourceWidth; m_inputFileHeight = m_sourceHeight; - m_ext360.setMaxCUInfo(m_uiCTUSize, 1 << MIN_CU_LOG2); + m_ext360.setMaxCUInfo(m_ctuSize, 1 << MIN_CU_LOG2); #endif if (!inputPathPrefix.empty() && inputPathPrefix.back() != '/' && inputPathPrefix.back() != '\\' ) @@ -2083,7 +2087,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) if (m_firstValidFrame < 0) { - m_firstValidFrame = m_FrameSkip; + m_firstValidFrame = m_frameSkip; } if (m_lastValidFrame < 0) { @@ -2142,8 +2146,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_subPicId[i] = cfg_subPicId.values[i]; } } - uint32_t tmpWidthVal = (m_sourceWidth + m_uiCTUSize - 1) / m_uiCTUSize; - uint32_t tmpHeightVal = (m_sourceHeight + m_uiCTUSize - 1) / m_uiCTUSize; + uint32_t tmpWidthVal = (m_sourceWidth + m_ctuSize - 1) / m_ctuSize; + uint32_t tmpHeightVal = (m_sourceHeight + m_ctuSize - 1) / m_ctuSize; if (!m_subPicSameSizeFlag) { for (int i = 0; i < m_numSubPics; i++) @@ -2301,17 +2305,17 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_subProfile[i] = cfg_SubProfile.values[i]; } /* rules for input, output and internal bitdepths as per help text */ - if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] == 0) + if (m_msbExtendedBitDepth[CHANNEL_TYPE_LUMA] == 0) { - m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] = m_inputBitDepth [CHANNEL_TYPE_LUMA ]; + m_msbExtendedBitDepth[CHANNEL_TYPE_LUMA] = m_inputBitDepth[CHANNEL_TYPE_LUMA]; } - if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0) + if (m_msbExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0) { - m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ]; + m_msbExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_msbExtendedBitDepth[CHANNEL_TYPE_LUMA]; } if (m_internalBitDepth [CHANNEL_TYPE_LUMA ] == 0) { - m_internalBitDepth [CHANNEL_TYPE_LUMA ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ]; + m_internalBitDepth[CHANNEL_TYPE_LUMA] = m_msbExtendedBitDepth[CHANNEL_TYPE_LUMA]; } m_internalBitDepth [CHANNEL_TYPE_CHROMA] = m_internalBitDepth [CHANNEL_TYPE_LUMA ]; if (m_inputBitDepth [CHANNEL_TYPE_CHROMA] == 0) @@ -2327,9 +2331,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_outputBitDepth [CHANNEL_TYPE_CHROMA] = m_outputBitDepth [CHANNEL_TYPE_LUMA ]; } - - m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat); - m_chromaFormatIDC = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat))); + m_inputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat); + m_chromaFormatIDC = ((tmpChromaFormat == 0) ? (m_inputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat))); #if EXTENSION_360_VIDEO m_ext360.processOptions(ext360CfgContext); #endif @@ -2340,18 +2343,18 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ChromaFormat chromaFormat = CHROMA_420; VideoIOYuv inputFile; inputFile.parseY4mFileHeader(m_inputFileName, width, height, frameRate, inputBitDepth, chromaFormat); - if (width != m_sourceWidth || height != m_sourceHeight || frameRate != m_iFrameRate + if (width != m_sourceWidth || height != m_sourceHeight || frameRate != m_frameRate || inputBitDepth != m_inputBitDepth[0] || chromaFormat != m_chromaFormatIDC) { msg(WARNING, "\nWarning: Y4M file info is different from input setting. Using the info from Y4M file\n"); m_sourceWidth = width; m_sourceHeight = height; - m_iFrameRate = frameRate; + m_frameRate = frameRate; m_inputBitDepth[0] = inputBitDepth; m_inputBitDepth[1] = inputBitDepth; m_chromaFormatIDC = chromaFormat; - m_MSBExtendedBitDepth[0] = m_inputBitDepth[0]; - m_MSBExtendedBitDepth[1] = m_inputBitDepth[1]; + m_msbExtendedBitDepth[0] = m_inputBitDepth[0]; + m_msbExtendedBitDepth[1] = m_inputBitDepth[1]; } } @@ -2442,7 +2445,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } if (m_profile == Profile::MAIN_12_INTRA || m_profile == Profile::MAIN_12_444_INTRA || m_profile == Profile::MAIN_16_444_INTRA) { - CHECK(m_iIntraPeriod != 1, "IntraPeriod setting must be 1 for Intra profiles") + CHECK(m_intraPeriod != 1, "IntraPeriod setting must be 1 for Intra profiles") } if (m_profile == Profile::MULTILAYER_MAIN_10_STILL_PICTURE || m_profile == Profile::MAIN_10_STILL_PICTURE || m_profile == Profile::MAIN_12_STILL_PICTURE || m_profile == Profile::MAIN_12_444_STILL_PICTURE || m_profile == Profile::MAIN_16_444_STILL_PICTURE) @@ -2528,14 +2531,18 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) { for(int i = 0; i < m_numSubPics; i++) { - CHECK( (m_subPicCtuTopLeftX[i] * m_uiCTUSize) >= (m_sourceWidth - m_confWinRight * SPS::getWinUnitX(m_chromaFormatIDC)), - "No subpicture can be located completely outside of the conformance cropping window"); - CHECK( ((m_subPicCtuTopLeftX[i] + m_subPicWidth[i]) * m_uiCTUSize) <= (m_confWinLeft * SPS::getWinUnitX(m_chromaFormatIDC)), - "No subpicture can be located completely outside of the conformance cropping window" ); - CHECK( (m_subPicCtuTopLeftY[i] * m_uiCTUSize) >= (m_sourceHeight - m_confWinBottom * SPS::getWinUnitY(m_chromaFormatIDC)), - "No subpicture can be located completely outside of the conformance cropping window"); - CHECK( ((m_subPicCtuTopLeftY[i] + m_subPicHeight[i]) * m_uiCTUSize) <= (m_confWinTop * SPS::getWinUnitY(m_chromaFormatIDC)), - "No subpicture can be located completely outside of the conformance cropping window"); + CHECK((m_subPicCtuTopLeftX[i] * m_ctuSize) + >= (m_sourceWidth - m_confWinRight * SPS::getWinUnitX(m_chromaFormatIDC)), + "No subpicture can be located completely outside of the conformance cropping window"); + CHECK(((m_subPicCtuTopLeftX[i] + m_subPicWidth[i]) * m_ctuSize) + <= (m_confWinLeft * SPS::getWinUnitX(m_chromaFormatIDC)), + "No subpicture can be located completely outside of the conformance cropping window"); + CHECK((m_subPicCtuTopLeftY[i] * m_ctuSize) + >= (m_sourceHeight - m_confWinBottom * SPS::getWinUnitY(m_chromaFormatIDC)), + "No subpicture can be located completely outside of the conformance cropping window"); + CHECK(((m_subPicCtuTopLeftY[i] + m_subPicHeight[i]) * m_ctuSize) + <= (m_confWinTop * SPS::getWinUnitY(m_chromaFormatIDC)), + "No subpicture can be located completely outside of the conformance cropping window"); } } @@ -2562,18 +2569,18 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_subpicDecodedPictureHashType = static_cast<HashType>(tmpSubpicDecodedPictureHashMappedType - 1); } // allocate slice-based dQP values - m_frameDeltaQps.resize(m_framesToBeEncoded + m_iGOPSize + 1); + m_frameDeltaQps.resize(m_framesToBeEncoded + m_gopSize + 1); std::fill(m_frameDeltaQps.begin(), m_frameDeltaQps.end(), 0); if (m_qpIncrementAtSourceFrame.bPresent) { uint32_t switchingPOC = 0; - if (m_qpIncrementAtSourceFrame.value > m_FrameSkip) + if (m_qpIncrementAtSourceFrame.value > m_frameSkip) { // if switch source frame (ssf) = 10, and frame skip (fs)=2 and temporal subsample ratio (tsr) =1, then // for this simulation switch at POC 8 (=10-2). // if ssf=10, fs=2, tsr=2, then for this simulation, switch at POC 4 (=(10-2)/2): POC0=Src2, POC1=Src4, POC2=Src6, POC3=Src8, POC4=Src10 - switchingPOC = (m_qpIncrementAtSourceFrame.value - m_FrameSkip) / m_temporalSubsampleRatio; + switchingPOC = (m_qpIncrementAtSourceFrame.value - m_frameSkip) / m_temporalSubsampleRatio; } for (uint32_t i = switchingPOC; i < m_frameDeltaQps.size(); i++) { @@ -2761,7 +2768,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) CHECK( m_virtualBoundariesPosX[i] % 8, "The vertical virtual boundary must be a multiple of 8 luma samples" ); if (i > 0) { - CHECK( m_virtualBoundariesPosX[i] - m_virtualBoundariesPosX[i-1] < m_uiCTUSize, "The distance between any two vertical virtual boundaries shall be greater than or equal to the CTU size" ); + CHECK( + m_virtualBoundariesPosX[i] - m_virtualBoundariesPosX[i - 1] < m_ctuSize, + "The distance between any two vertical virtual boundaries shall be greater than or equal to the CTU size"); } } m_virtualBoundariesPosY = cfg_virtualBoundariesPosY.values; @@ -2775,7 +2784,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) CHECK( m_virtualBoundariesPosY[i] % 8, "The horizontal virtual boundary must be a multiple of 8 luma samples" ); if (i > 0) { - CHECK( m_virtualBoundariesPosY[i] - m_virtualBoundariesPosY[i-1] < m_uiCTUSize, "The distance between any two horizontal virtual boundaries shall be greater than or equal to the CTU size" ); + CHECK(m_virtualBoundariesPosY[i] - m_virtualBoundariesPosY[i - 1] < m_ctuSize, + "The distance between any two horizontal virtual boundaries shall be greater than or equal to the CTU " + "size"); } } } @@ -2830,19 +2841,21 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) msg(WARNING, "*************************************************************************\n"); m_fgcSEIAnalysisEnabled = false; } - if (m_iIntraPeriod < 1) { // low delay configuration + if (m_intraPeriod < 1) + { // low delay configuration msg(WARNING, "*************************************************************************\n"); msg(WARNING, "* WARNING: For low delay configuration, FGC SEI is inserted for first frame only!*\n"); msg(WARNING, "*************************************************************************\n"); m_fgcSEIPerPictureSEI = false; m_fgcSEIPersistenceFlag = true; } - else if (m_iIntraPeriod == 1) { // all intra configuration - msg(WARNING, "*************************************************************************\n"); - msg(WARNING, "* WARNING: For Intra Period = 1, FGC SEI is inserted per frame!*\n"); - msg(WARNING, "*************************************************************************\n"); - m_fgcSEIPerPictureSEI = true; - m_fgcSEIPersistenceFlag = false; + else if (m_intraPeriod == 1) + { // all intra configuration + msg(WARNING, "*************************************************************************\n"); + msg(WARNING, "* WARNING: For Intra Period = 1, FGC SEI is inserted per frame!*\n"); + msg(WARNING, "*************************************************************************\n"); + m_fgcSEIPerPictureSEI = true; + m_fgcSEIPersistenceFlag = false; } if (!m_fgcSEIPerPictureSEI && !m_fgcSEIPersistenceFlag) { msg(WARNING, "*************************************************************************\n"); @@ -2859,7 +2872,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) if (m_fgcSEIAnalysisEnabled && m_fgcSEITemporalFilterStrengths.empty()) { // By default: in random-acces = filter RAPs, in all-intra = filter every frame, otherwise = filter every 2s - int filteredFrame = m_iIntraPeriod < 1 ? 2 * m_iFrameRate : m_iIntraPeriod; + int filteredFrame = m_intraPeriod < 1 ? 2 * m_frameRate : m_intraPeriod; m_fgcSEITemporalFilterStrengths[filteredFrame] = 1.5; } uint32_t numModelCtr; @@ -3145,9 +3158,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } } m_reshapeCW.binCW.resize(3); - m_reshapeCW.rspFps = m_iFrameRate; + m_reshapeCW.rspFps = m_frameRate; m_reshapeCW.rspPicSize = m_sourceWidth*m_sourceHeight; - m_reshapeCW.rspFpsToIp = std::max(16, 16 * (int)(round((double)m_iFrameRate /16.0))); + m_reshapeCW.rspFpsToIp = std::max(16, 16 * (int) (round((double) m_frameRate / 16.0))); m_reshapeCW.rspBaseQP = m_iQP; m_reshapeCW.updateCtrl = m_updateCtrl; m_reshapeCW.adpOption = m_adpOption; @@ -3172,22 +3185,26 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #if ENABLE_QPA_SUB_CTU if ((m_iQP < 38) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && (m_sourceWidth <= 2048) && (m_sourceHeight <= 1280) - #if WCG_EXT && ER_CHROMA_QP_WCG_PPS +#if WCG_EXT && ER_CHROMA_QP_WCG_PPS && (!m_wcgChromaQpControl.enabled) - #endif - && ((1 << (m_log2MaxTbSize + 1)) == m_uiCTUSize) && (m_sourceWidth > 512 || m_sourceHeight > 320)) +#endif + && ((1 << (m_log2MaxTbSize + 1)) == m_ctuSize) && (m_sourceWidth > 512 || m_sourceHeight > 320)) { m_cuQpDeltaSubdiv = 2; } #else - if( ( m_iQP < 38 ) && ( m_iGOPSize > 4 ) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && ( m_sourceHeight <= 1280 ) && ( m_sourceWidth <= 2048 ) ) + if ((m_iQP < 38) && (m_gopSize > 4) && m_bUsePerceptQPA && !m_bUseAdaptiveQP && (m_sourceHeight <= 1280) + && (m_sourceWidth <= 2048)) { msg( WARNING, "*************************************************************************\n" ); msg( WARNING, "* WARNING: QPA on with large CTU for <=HD sequences, limiting CTU size! *\n" ); msg( WARNING, "*************************************************************************\n" ); - m_uiCTUSize = m_uiMaxCUWidth; - if( ( 1u << m_log2MaxTbSize ) > m_uiCTUSize ) m_log2MaxTbSize--; + m_ctuSize = m_maxCuWidth; + if ((1u << m_log2MaxTbSize) > m_ctuSize) + { + m_log2MaxTbSize--; + } } #endif #endif // ENABLE_QPA @@ -3223,7 +3240,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) (blending_ratio * m_siiSEISubLayerNumUnitsInSI[siiMaxSubLayersMinus1])) { m_ShutterFilterEnable = true; - double fpsHFR = (double)m_iFrameRate; + double fpsHFR = (double) m_frameRate; int32_t i; bool checkEqualValuesOfSFR = true; bool checkSubLayerSI = false; @@ -3322,8 +3339,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_iQP = LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP - ( ( m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8 ) * 6 ); } - - m_uiMaxCUWidth = m_uiMaxCUHeight = m_uiCTUSize; + m_maxCuWidth = m_maxCuHeight = m_ctuSize; // check validity of input parameters if( xCheckParameter() ) @@ -3370,12 +3386,16 @@ int EncAppCfg::xAutoDetermineProfile() } else if (maxBitDepth <= 12) { - m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_12_STILL_PICTURE : (m_iIntraPeriod == 1) ? Profile::MAIN_12_INTRA : Profile::MAIN_12; + m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_12_STILL_PICTURE + : (m_intraPeriod == 1) ? Profile::MAIN_12_INTRA + : Profile::MAIN_12; } else if (maxBitDepth <= 16) { // Since there's no 16bit 420 profiles in VVC, we use 444 profiles. - m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_16_444_STILL_PICTURE : (m_iIntraPeriod == 1) ? Profile::MAIN_16_444_INTRA : Profile::MAIN_16_444; + m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_16_444_STILL_PICTURE + : (m_intraPeriod == 1) ? Profile::MAIN_16_444_INTRA + : Profile::MAIN_16_444; } break; @@ -3395,11 +3415,15 @@ int EncAppCfg::xAutoDetermineProfile() } else if (maxBitDepth <= 12) { - m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_12_444_STILL_PICTURE : (m_iIntraPeriod == 1) ? Profile::MAIN_12_444_INTRA : Profile::MAIN_12_444; + m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_12_444_STILL_PICTURE + : (m_intraPeriod == 1) ? Profile::MAIN_12_444_INTRA + : Profile::MAIN_12_444; } else if (maxBitDepth <= 16) { - m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_16_444_STILL_PICTURE : (m_iIntraPeriod == 1) ? Profile::MAIN_16_444_INTRA : Profile::MAIN_16_444; + m_profile = (m_level == Level::LEVEL15_5 && m_framesToBeEncoded == 1) ? Profile::MAIN_16_444_STILL_PICTURE + : (m_intraPeriod == 1) ? Profile::MAIN_16_444_INTRA + : Profile::MAIN_16_444; } break; @@ -3452,7 +3476,8 @@ bool EncAppCfg::xCheckParameter() if( m_wrapAround ) { const int minCUSize = 1 << m_log2MinCuSize; - xConfirmPara(m_wrapAroundOffset <= m_uiCTUSize + minCUSize, "Wrap-around offset must be greater than CtbSizeY + MinCbSize"); + xConfirmPara(m_wrapAroundOffset <= m_ctuSize + minCUSize, + "Wrap-around offset must be greater than CtbSizeY + MinCbSize"); xConfirmPara(m_wrapAroundOffset > m_sourceWidth, "Wrap-around offset must not be greater than the source picture width"); xConfirmPara( m_wrapAroundOffset % minCUSize != 0, "Wrap-around offset must be an integer multiple of the specified minimum CU size" ); } @@ -3523,8 +3548,12 @@ bool EncAppCfg::xCheckParameter() } #endif - xConfirmPara( (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] < m_inputBitDepth[CHANNEL_TYPE_LUMA ]), "MSB-extended bit depth for luma channel (--MSBExtendedBitDepth) must be greater than or equal to input bit depth for luma channel (--InputBitDepth)" ); - xConfirmPara( (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] < m_inputBitDepth[CHANNEL_TYPE_CHROMA]), "MSB-extended bit depth for chroma channel (--MSBExtendedBitDepthC) must be greater than or equal to input bit depth for chroma channel (--InputBitDepthC)" ); + xConfirmPara((m_msbExtendedBitDepth[CHANNEL_TYPE_LUMA] < m_inputBitDepth[CHANNEL_TYPE_LUMA]), + "MSB-extended bit depth for luma channel (--MSBExtendedBitDepth) must be greater than or equal to input " + "bit depth for luma channel (--InputBitDepth)"); + xConfirmPara((m_msbExtendedBitDepth[CHANNEL_TYPE_CHROMA] < m_inputBitDepth[CHANNEL_TYPE_CHROMA]), + "MSB-extended bit depth for chroma channel (--MSBExtendedBitDepthC) must be greater than or equal to " + "input bit depth for chroma channel (--InputBitDepthC)"); bool check_sps_range_extension_flag = m_extendedPrecisionProcessingFlag || m_rrcRiceExtensionEnableFlag || m_persistentRiceAdaptationEnabledFlag || m_tsrcRicePresentFlag; @@ -3535,17 +3564,19 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_chromaFormatIDC >= NUM_CHROMA_FORMAT, "ChromaFormatIDC must be either 400, 420, 422 or 444" ); std::string sTempIPCSC="InputColourSpaceConvert must be empty, "+getListOfColourSpaceConverts(true); xConfirmPara( m_inputColourSpaceConvert >= NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS, sTempIPCSC.c_str() ); - xConfirmPara( m_InputChromaFormatIDC >= NUM_CHROMA_FORMAT, "InputChromaFormatIDC must be either 400, 420, 422 or 444" ); - xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); + xConfirmPara(m_inputChromaFormatIDC >= NUM_CHROMA_FORMAT, "InputChromaFormatIDC must be either 400, 420, 422 or 444"); + xConfirmPara(m_frameRate <= 0, "Frame rate must be more than 1"); xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); xConfirmPara( m_framesToBeEncoded < m_switchPOC, "debug POC out of range" ); - xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); - xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); - xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); + xConfirmPara(m_gopSize < 1, "GOP Size must be greater or equal to 1"); + xConfirmPara(m_gopSize > 1 && m_gopSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1"); + xConfirmPara((m_intraPeriod > 0 && m_intraPeriod < m_gopSize) || m_intraPeriod == 0, + "Intra period must be more than GOP size, or -1 , not 0"); xConfirmPara( m_drapPeriod < 0, "DRAP period must be greater or equal to 0" ); xConfirmPara( m_edrapPeriod < 0, "EDRAP period must be greater or equal to 0" ); - xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 3, "Decoding Refresh Type must be comprised between 0 and 3 included" ); + xConfirmPara(m_intraRefreshType < 0 || m_intraRefreshType > 3, + "Decoding Refresh Type must be comprised between 0 and 3 included"); if (m_isField) { @@ -3696,61 +3727,82 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( m_cbCrQpOffsetDualTree > 12, "Max. Joint Cb-Cr QP Offset for dual tree is 12"); } xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); - if (m_iDecodingRefreshType == 2) + if (m_intraRefreshType == 2) { - xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); + xConfirmPara(m_intraPeriod > 0 && m_intraPeriod <= m_gopSize, + "Intra period must be larger than GOP size for periodic IDR pictures"); } - xConfirmPara( m_uiMaxCUWidth > MAX_CU_SIZE, "MaxCUWith exceeds predefined MAX_CU_SIZE limit"); + xConfirmPara(m_maxCuWidth > MAX_CU_SIZE, "MaxCUWith exceeds predefined MAX_CU_SIZE limit"); const int minCuSize = 1 << m_log2MinCuSize; - xConfirmPara( m_uiMinQT[0] > 64, "Min Luma QT size in I slices should be smaller than or equal to 64"); - xConfirmPara( m_uiMinQT[1] > 64, "Min Luma QT size in non-I slices should be smaller than or equal to 64"); - xConfirmPara( m_uiMaxBT[2] > 64, "Maximum BT size for chroma block in I slice should be smaller than or equal to 64"); - xConfirmPara( m_uiMaxTT[0] > 64, "Maximum TT size for luma block in I slice should be smaller than or equal to 64"); - xConfirmPara( m_uiMaxTT[1] > 64, "Maximum TT size for luma block in non-I slice should be smaller than or equal to 64"); - xConfirmPara( m_uiMaxTT[2] > 64, "Maximum TT size for chroma block in I slice should be smaller than or equal to 64"); - xConfirmPara( m_uiMinQT[0] < minCuSize, "Min Luma QT size in I slices should be larger than or equal to minCuSize"); - xConfirmPara( m_uiMinQT[1] < minCuSize, "Min Luma QT size in non-I slices should be larger than or equal to minCuSize"); + xConfirmPara(m_minQt[0] > 64, "Min Luma QT size in I slices should be smaller than or equal to 64"); + xConfirmPara(m_minQt[1] > 64, "Min Luma QT size in non-I slices should be smaller than or equal to 64"); + xConfirmPara(m_maxBt[2] > 64, "Maximum BT size for chroma block in I slice should be smaller than or equal to 64"); + xConfirmPara(m_maxTt[0] > 64, "Maximum TT size for luma block in I slice should be smaller than or equal to 64"); + xConfirmPara(m_maxTt[1] > 64, "Maximum TT size for luma block in non-I slice should be smaller than or equal to 64"); + xConfirmPara(m_maxTt[2] > 64, "Maximum TT size for chroma block in I slice should be smaller than or equal to 64"); + xConfirmPara(m_minQt[0] < minCuSize, "Min Luma QT size in I slices should be larger than or equal to minCuSize"); + xConfirmPara(m_minQt[1] < minCuSize, "Min Luma QT size in non-I slices should be larger than or equal to minCuSize"); xConfirmPara((m_sourceWidth % minCuSize ) || (m_sourceHeight % minCuSize), "Picture width or height is not a multiple of minCuSize"); - const int minDiff = (int)floorLog2(m_uiMinQT[2]) - std::max(MIN_CU_LOG2, (int)m_log2MinCuSize - (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)); + const int minDiff = + (int) floorLog2(m_minQt[2]) + - std::max(MIN_CU_LOG2, (int) m_log2MinCuSize - (int) getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)); xConfirmPara( minDiff < 0 , "Min Chroma QT size in I slices is smaller than Min Luma CU size even considering color format"); - xConfirmPara( (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)) > std::min(64, (int)m_uiCTUSize), - "Min Chroma QT size in I slices should be smaller than or equal to CTB size or CB size after implicit split of CTB"); - xConfirmPara( m_uiCTUSize < 32, "CTUSize must be greater than or equal to 32"); - xConfirmPara( m_uiCTUSize > 128, "CTUSize must be less than or equal to 128"); - xConfirmPara( m_uiCTUSize != 32 && m_uiCTUSize != 64 && m_uiCTUSize != 128, "CTUSize must be a power of 2 (32, 64, or 128)"); - xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); - xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); - xConfirmPara( m_uiMaxBT[0] < m_uiMinQT[0], "Maximum BT size for luma block in I slice should be larger than minimum QT size"); - xConfirmPara( m_uiMaxBT[0] > m_uiCTUSize, "Maximum BT size for luma block in I slice should be smaller than or equal to CTUSize"); - xConfirmPara( m_uiMaxBT[1] < m_uiMinQT[1], "Maximum BT size for luma block in non I slice should be larger than minimum QT size"); - xConfirmPara( m_uiMaxBT[1] > m_uiCTUSize, "Maximum BT size for luma block in non I slice should be smaller than or equal to CTUSize"); - xConfirmPara( m_uiMaxBT[2] < (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), - "Maximum BT size for chroma block in I slice should be larger than minimum QT size"); - xConfirmPara( m_uiMaxBT[2] > m_uiCTUSize, "Maximum BT size for chroma block in I slice should be smaller than or equal to CTUSize"); - xConfirmPara( m_uiMaxTT[0] < m_uiMinQT[0], "Maximum TT size for luma block in I slice should be larger than minimum QT size"); - xConfirmPara( m_uiMaxTT[0] > m_uiCTUSize, "Maximum TT size for luma block in I slice should be smaller than or equal to CTUSize"); - xConfirmPara( m_uiMaxTT[1] < m_uiMinQT[1], "Maximum TT size for luma block in non I slice should be larger than minimum QT size"); - xConfirmPara( m_uiMaxTT[1] > m_uiCTUSize, "Maximum TT size for luma block in non I slice should be smaller than or equal to CTUSize"); - xConfirmPara( m_uiMaxTT[2] < (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), - "Maximum TT size for chroma block in I slice should be larger than minimum QT size"); - xConfirmPara( m_uiMaxTT[2] > m_uiCTUSize, "Maximum TT size for chroma block in I slice should be smaller than or equal to CTUSize"); + xConfirmPara((m_minQt[2] << (int) getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)) + > std::min(64, (int) m_ctuSize), + "Min Chroma QT size in I slices should be smaller than or equal to CTB size or CB size after implicit " + "split of CTB"); + xConfirmPara(m_ctuSize < 32, "CTUSize must be greater than or equal to 32"); + xConfirmPara(m_ctuSize > 128, "CTUSize must be less than or equal to 128"); + xConfirmPara(m_ctuSize != 32 && m_ctuSize != 64 && m_ctuSize != 128, "CTUSize must be a power of 2 (32, 64, or 128)"); + xConfirmPara(m_maxCuWidth < 16, "Maximum partition width size should be larger than or equal to 16"); + xConfirmPara(m_maxCuHeight < 16, "Maximum partition height size should be larger than or equal to 16"); + xConfirmPara(m_maxBt[0] < m_minQt[0], + "Maximum BT size for luma block in I slice should be larger than minimum QT size"); + xConfirmPara(m_maxBt[0] > m_ctuSize, + "Maximum BT size for luma block in I slice should be smaller than or equal to CTUSize"); + xConfirmPara(m_maxBt[1] < m_minQt[1], + "Maximum BT size for luma block in non I slice should be larger than minimum QT size"); + xConfirmPara(m_maxBt[1] > m_ctuSize, + "Maximum BT size for luma block in non I slice should be smaller than or equal to CTUSize"); + xConfirmPara(m_maxBt[2] < (m_minQt[2] << (int) getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), + "Maximum BT size for chroma block in I slice should be larger than minimum QT size"); + xConfirmPara(m_maxBt[2] > m_ctuSize, + "Maximum BT size for chroma block in I slice should be smaller than or equal to CTUSize"); + xConfirmPara(m_maxTt[0] < m_minQt[0], + "Maximum TT size for luma block in I slice should be larger than minimum QT size"); + xConfirmPara(m_maxTt[0] > m_ctuSize, + "Maximum TT size for luma block in I slice should be smaller than or equal to CTUSize"); + xConfirmPara(m_maxTt[1] < m_minQt[1], + "Maximum TT size for luma block in non I slice should be larger than minimum QT size"); + xConfirmPara(m_maxTt[1] > m_ctuSize, + "Maximum TT size for luma block in non I slice should be smaller than or equal to CTUSize"); + xConfirmPara(m_maxTt[2] < (m_minQt[2] << (int) getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), + "Maximum TT size for chroma block in I slice should be larger than minimum QT size"); + xConfirmPara(m_maxTt[2] > m_ctuSize, + "Maximum TT size for chroma block in I slice should be smaller than or equal to CTUSize"); xConfirmPara( (m_sourceWidth % (std::max(8u, m_log2MinCuSize))) != 0, "Resulting coded frame width must be a multiple of Max(8, the minimum CU size)"); xConfirmPara( (m_sourceHeight % (std::max(8u, m_log2MinCuSize))) != 0, "Resulting coded frame height must be a multiple of Max(8, the minimum CU size)"); if (m_uiMaxMTTHierarchyDepthI == 0) { - xConfirmPara(m_uiMaxBT[0] != m_uiMinQT[0], "MaxBTLumaISlice shall be equal to MinQTLumaISlice when MaxMTTHierarchyDepthISliceL is 0."); - xConfirmPara(m_uiMaxTT[0] != m_uiMinQT[0], "MaxTTLumaISlice shall be equal to MinQTLumaISlice when MaxMTTHierarchyDepthISliceL is 0."); + xConfirmPara(m_maxBt[0] != m_minQt[0], + "MaxBTLumaISlice shall be equal to MinQTLumaISlice when MaxMTTHierarchyDepthISliceL is 0."); + xConfirmPara(m_maxTt[0] != m_minQt[0], + "MaxTTLumaISlice shall be equal to MinQTLumaISlice when MaxMTTHierarchyDepthISliceL is 0."); } if (m_uiMaxMTTHierarchyDepthIChroma == 0) { - xConfirmPara(m_uiMaxBT[2] != (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), "MaxBTChromaISlice shall be equal to MinQTChromaISlice when MaxMTTHierarchyDepthISliceC is 0."); - xConfirmPara(m_uiMaxTT[2] != (m_uiMinQT[2] << (int)getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), "MaxTTChromaISlice shall be equal to MinQTChromaISlice when MaxMTTHierarchyDepthISliceC is 0."); + xConfirmPara(m_maxBt[2] != (m_minQt[2] << (int) getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), + "MaxBTChromaISlice shall be equal to MinQTChromaISlice when MaxMTTHierarchyDepthISliceC is 0."); + xConfirmPara(m_maxTt[2] != (m_minQt[2] << (int) getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC)), + "MaxTTChromaISlice shall be equal to MinQTChromaISlice when MaxMTTHierarchyDepthISliceC is 0."); } if (m_uiMaxMTTHierarchyDepth == 0) { - xConfirmPara(m_uiMaxBT[1] != m_uiMinQT[1], "MaxBTNonISlice shall be equal to MinQTNonISlice when MaxMTTHierarchyDepth is 0."); - xConfirmPara(m_uiMaxTT[1] != m_uiMinQT[1], "MaxTTNonISlice shall be equal to MinQTNonISlice when MaxMTTHierarchyDepth is 0."); + xConfirmPara(m_maxBt[1] != m_minQt[1], + "MaxBTNonISlice shall be equal to MinQTNonISlice when MaxMTTHierarchyDepth is 0."); + xConfirmPara(m_maxTt[1] != m_minQt[1], + "MaxTTNonISlice shall be equal to MinQTNonISlice when MaxMTTHierarchyDepth is 0."); } xConfirmPara( m_log2MaxTbSize > 6, "Log2MaxTbSize must be 6 or smaller." ); xConfirmPara( m_log2MaxTbSize < 5, "Log2MaxTbSize must be 5 or greater." ); @@ -3809,7 +3861,7 @@ bool EncAppCfg::xCheckParameter() // max CU width and height should be power of 2 - uint32_t ui = m_uiMaxCUWidth; + uint32_t ui = m_maxCuWidth; while(ui) { ui >>= 1; @@ -3818,7 +3870,7 @@ bool EncAppCfg::xCheckParameter() xConfirmPara( ui != 1 , "Width should be 2^n"); } } - ui = m_uiMaxCUHeight; + ui = m_maxCuHeight; while(ui) { ui >>= 1; @@ -3830,7 +3882,7 @@ bool EncAppCfg::xCheckParameter() /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure * This permits the ability to omit a GOP structure specification */ - if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) + if (m_intraPeriod == 1 && m_GOPList[0].m_POC == -1) { m_GOPList[0] = GOPEntry(); m_GOPList[0].m_QPFactor = 1; @@ -3868,19 +3920,20 @@ bool EncAppCfg::xCheckParameter() isOK[i]=false; } int numOK=0; - xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); + xConfirmPara(m_intraPeriod >= 0 && (m_intraPeriod % m_gopSize != 0), + "Intra period must be a multiple of GOPSize, or -1"); - for(int i=0; i<m_iGOPSize; i++) + for (int i = 0; i < m_gopSize; i++) { - if (m_GOPList[i].m_POC == m_iGOPSize * multipleFactor) + if (m_GOPList[i].m_POC == m_gopSize * multipleFactor) { xConfirmPara( m_GOPList[i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " ); } } - if ( (m_iIntraPeriod != 1) && !m_deblockingFilterOffsetInPPS && (!m_deblockingFilterDisable) ) + if ((m_intraPeriod != 1) && !m_deblockingFilterOffsetInPPS && (!m_deblockingFilterDisable)) { - for(int i=0; i<m_iGOPSize; i++) + for (int i = 0; i < m_gopSize; i++) { xConfirmPara( (m_GOPList[i].m_betaOffsetDiv2 + m_deblockingFilterBetaOffsetDiv2) < -12 || (m_GOPList[i].m_betaOffsetDiv2 + m_deblockingFilterBetaOffsetDiv2) > 12, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-12 to 12)" ); xConfirmPara( (m_GOPList[i].m_tcOffsetDiv2 + m_deblockingFilterTcOffsetDiv2) < -12 || (m_GOPList[i].m_tcOffsetDiv2 + m_deblockingFilterTcOffsetDiv2) > 12, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-12 to 12)" ); @@ -3892,7 +3945,7 @@ bool EncAppCfg::xCheckParameter() } #if W0038_CQP_ADJ - for(int i=0; i<m_iGOPSize; i++) + for (int i = 0; i < m_gopSize; i++) { xConfirmPara( abs(m_GOPList[i].m_CbQPoffset ) > 12, "Cb QP Offset for one of the GOP entries exceeds supported range (-12 to 12)" ); xConfirmPara( abs(m_GOPList[i].m_CbQPoffset + m_cbQpOffset) > 12, "Cb QP Offset for one of the GOP entries, when combined with the PPS Cb offset, exceeds supported range (-12 to 12)" ); @@ -3917,8 +3970,8 @@ bool EncAppCfg::xCheckParameter() //start looping through frames in coding order until we can verify that the GOP structure is correct. while (!verifiedGOP && !errorGOP) { - int curGOP = (checkGOP - 1) % m_iGOPSize; - int curPOC = ((checkGOP - 1) / m_iGOPSize)*m_iGOPSize * multipleFactor + m_RPLList0[curGOP].m_POC; + int curGOP = (checkGOP - 1) % m_gopSize; + int curPOC = ((checkGOP - 1) / m_gopSize) * m_gopSize * multipleFactor + m_RPLList0[curGOP].m_POC; if (m_RPLList0[curGOP].m_POC < 0 || m_RPLList1[curGOP].m_POC < 0) { msg(WARNING, "\nError: found fewer Reference Picture Sets than GOPSize\n"); @@ -3943,9 +3996,9 @@ bool EncAppCfg::xCheckParameter() if (refList[j] == absPOC) { found = true; - for (int k = 0; k<m_iGOPSize; k++) + for (int k = 0; k < m_gopSize; k++) { - if (absPOC % (m_iGOPSize * multipleFactor) == m_RPLList0[k].m_POC % (m_iGOPSize * multipleFactor)) + if (absPOC % (m_gopSize * multipleFactor) == m_RPLList0[k].m_POC % (m_gopSize * multipleFactor)) { if (m_RPLList0[k].m_temporalId == m_RPLList0[curGOP].m_temporalId) { @@ -3969,7 +4022,7 @@ bool EncAppCfg::xCheckParameter() { numOK++; isOK[curGOP] = true; - if (numOK == m_iGOPSize) + if (numOK == m_gopSize) { verifiedGOP = true; } @@ -3978,15 +4031,15 @@ bool EncAppCfg::xCheckParameter() else { //create a new RPLEntry for this frame containing all the reference pictures that were available (POC > 0) - m_RPLList0[m_iGOPSize + extraRPLs] = m_RPLList0[curGOP]; - m_RPLList1[m_iGOPSize + extraRPLs] = m_RPLList1[curGOP]; + m_RPLList0[m_gopSize + extraRPLs] = m_RPLList0[curGOP]; + m_RPLList1[m_gopSize + extraRPLs] = m_RPLList1[curGOP]; int newRefs0 = 0; for (int i = 0; i< m_RPLList0[curGOP].m_numRefPics; i++) { int absPOC = curPOC - m_RPLList0[curGOP].m_deltaRefPics[i]; if (absPOC >= 0) { - m_RPLList0[m_iGOPSize + extraRPLs].m_deltaRefPics[newRefs0] = m_RPLList0[curGOP].m_deltaRefPics[i]; + m_RPLList0[m_gopSize + extraRPLs].m_deltaRefPics[newRefs0] = m_RPLList0[curGOP].m_deltaRefPics[i]; newRefs0++; } } @@ -3998,7 +4051,7 @@ bool EncAppCfg::xCheckParameter() int absPOC = curPOC - m_RPLList1[curGOP].m_deltaRefPics[i]; if (absPOC >= 0) { - m_RPLList1[m_iGOPSize + extraRPLs].m_deltaRefPics[newRefs1] = m_RPLList1[curGOP].m_deltaRefPics[i]; + m_RPLList1[m_gopSize + extraRPLs].m_deltaRefPics[newRefs1] = m_RPLList1[curGOP].m_deltaRefPics[i]; newRefs1++; } } @@ -4007,8 +4060,8 @@ bool EncAppCfg::xCheckParameter() for (int offset = -1; offset>-checkGOP; offset--) { //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. - int offGOP = (checkGOP - 1 + offset) % m_iGOPSize; - int offPOC = ((checkGOP - 1 + offset) / m_iGOPSize)*(m_iGOPSize * multipleFactor) + m_RPLList0[offGOP].m_POC; + int offGOP = (checkGOP - 1 + offset) % m_gopSize; + int offPOC = ((checkGOP - 1 + offset) / m_gopSize) * (m_gopSize * multipleFactor) + m_RPLList0[offGOP].m_POC; if (offPOC >= 0 && m_RPLList0[offGOP].m_temporalId <= m_RPLList0[curGOP].m_temporalId) { bool newRef = false; @@ -4021,7 +4074,7 @@ bool EncAppCfg::xCheckParameter() } for (int i = 0; i<newRefs0; i++) { - if (m_RPLList0[m_iGOPSize + extraRPLs].m_deltaRefPics[i] == curPOC - offPOC) + if (m_RPLList0[m_gopSize + extraRPLs].m_deltaRefPics[i] == curPOC - offPOC) { newRef = false; } @@ -4036,7 +4089,7 @@ bool EncAppCfg::xCheckParameter() } for (int j = 0; j<newRefs0; j++) { - if (m_RPLList0[m_iGOPSize + extraRPLs].m_deltaRefPics[j] > curPOC - offPOC && curPOC - offPOC > 0) + if (m_RPLList0[m_gopSize + extraRPLs].m_deltaRefPics[j] > curPOC - offPOC && curPOC - offPOC > 0) { insertPoint = j; break; @@ -4045,8 +4098,8 @@ bool EncAppCfg::xCheckParameter() int prev = curPOC - offPOC; for (int j = insertPoint; j<newRefs0 + 1; j++) { - int newPrev = m_RPLList0[m_iGOPSize + extraRPLs].m_deltaRefPics[j]; - m_RPLList0[m_iGOPSize + extraRPLs].m_deltaRefPics[j] = prev; + int newPrev = m_RPLList0[m_gopSize + extraRPLs].m_deltaRefPics[j]; + m_RPLList0[m_gopSize + extraRPLs].m_deltaRefPics[j] = prev; prev = newPrev; } newRefs0++; @@ -4061,8 +4114,8 @@ bool EncAppCfg::xCheckParameter() for (int offset = -1; offset>-checkGOP; offset--) { //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. - int offGOP = (checkGOP - 1 + offset) % m_iGOPSize; - int offPOC = ((checkGOP - 1 + offset) / m_iGOPSize)*(m_iGOPSize * multipleFactor) + m_RPLList1[offGOP].m_POC; + int offGOP = (checkGOP - 1 + offset) % m_gopSize; + int offPOC = ((checkGOP - 1 + offset) / m_gopSize) * (m_gopSize * multipleFactor) + m_RPLList1[offGOP].m_POC; if (offPOC >= 0 && m_RPLList1[offGOP].m_temporalId <= m_RPLList1[curGOP].m_temporalId) { bool newRef = false; @@ -4075,7 +4128,7 @@ bool EncAppCfg::xCheckParameter() } for (int i = 0; i<newRefs1; i++) { - if (m_RPLList1[m_iGOPSize + extraRPLs].m_deltaRefPics[i] == curPOC - offPOC) + if (m_RPLList1[m_gopSize + extraRPLs].m_deltaRefPics[i] == curPOC - offPOC) { newRef = false; } @@ -4090,7 +4143,7 @@ bool EncAppCfg::xCheckParameter() } for (int j = 0; j<newRefs1; j++) { - if (m_RPLList1[m_iGOPSize + extraRPLs].m_deltaRefPics[j] > curPOC - offPOC && curPOC - offPOC > 0) + if (m_RPLList1[m_gopSize + extraRPLs].m_deltaRefPics[j] > curPOC - offPOC && curPOC - offPOC > 0) { insertPoint = j; break; @@ -4099,8 +4152,8 @@ bool EncAppCfg::xCheckParameter() int prev = curPOC - offPOC; for (int j = insertPoint; j<newRefs1 + 1; j++) { - int newPrev = m_RPLList1[m_iGOPSize + extraRPLs].m_deltaRefPics[j]; - m_RPLList1[m_iGOPSize + extraRPLs].m_deltaRefPics[j] = prev; + int newPrev = m_RPLList1[m_gopSize + extraRPLs].m_deltaRefPics[j]; + m_RPLList1[m_gopSize + extraRPLs].m_deltaRefPics[j] = prev; prev = newPrev; } newRefs1++; @@ -4112,11 +4165,13 @@ bool EncAppCfg::xCheckParameter() } } - m_RPLList0[m_iGOPSize + extraRPLs].m_numRefPics = newRefs0; - m_RPLList0[m_iGOPSize + extraRPLs].m_numRefPicsActive = min(m_RPLList0[m_iGOPSize + extraRPLs].m_numRefPics, m_RPLList0[m_iGOPSize + extraRPLs].m_numRefPicsActive); - m_RPLList1[m_iGOPSize + extraRPLs].m_numRefPics = newRefs1; - m_RPLList1[m_iGOPSize + extraRPLs].m_numRefPicsActive = min(m_RPLList1[m_iGOPSize + extraRPLs].m_numRefPics, m_RPLList1[m_iGOPSize + extraRPLs].m_numRefPicsActive); - curGOP = m_iGOPSize + extraRPLs; + m_RPLList0[m_gopSize + extraRPLs].m_numRefPics = newRefs0; + m_RPLList0[m_gopSize + extraRPLs].m_numRefPicsActive = + min(m_RPLList0[m_gopSize + extraRPLs].m_numRefPics, m_RPLList0[m_gopSize + extraRPLs].m_numRefPicsActive); + m_RPLList1[m_gopSize + extraRPLs].m_numRefPics = newRefs1; + m_RPLList1[m_gopSize + extraRPLs].m_numRefPicsActive = + min(m_RPLList1[m_gopSize + extraRPLs].m_numRefPics, m_RPLList1[m_gopSize + extraRPLs].m_numRefPicsActive); + curGOP = m_gopSize + extraRPLs; extraRPLs++; } numRefs = 0; @@ -4156,12 +4211,12 @@ bool EncAppCfg::xCheckParameter() } checkGOP++; } - m_isLowDelay = !hasFutureRef && m_iIntraPeriod != 1; + m_isLowDelay = !hasFutureRef && m_intraPeriod != 1; xConfirmPara(errorGOP, "Invalid GOP structure given"); m_maxTempLayer = 1; - for(int i=0; i<m_iGOPSize; i++) + for (int i = 0; i < m_gopSize; i++) { if(m_GOPList[i].m_temporalId >= m_maxTempLayer) { @@ -4174,7 +4229,7 @@ bool EncAppCfg::xCheckParameter() m_maxNumReorderPics[i] = 0; m_maxDecPicBuffering[i] = 1; } - for(int i=0; i<m_iGOPSize; i++) + for (int i = 0; i < m_gopSize; i++) { int numRefPic = m_RPLList0[i].m_numRefPics; for (int tmp = 0; tmp < m_RPLList1[i].m_numRefPics; tmp++) @@ -4191,7 +4246,7 @@ bool EncAppCfg::xCheckParameter() m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = numRefPic + 1; } int highestDecodingNumberWithLowerPOC = 0; - for(int j=0; j<m_iGOPSize; j++) + for (int j = 0; j < m_gopSize; j++) { if(m_GOPList[j].m_POC <= m_GOPList[i].m_POC) { @@ -4246,7 +4301,7 @@ bool EncAppCfg::xCheckParameter() pps.setPicWidthInLumaSamples( m_sourceWidth ); pps.setPicHeightInLumaSamples( m_sourceHeight ); - pps.setLog2CtuSize( floorLog2(m_uiCTUSize) ); + pps.setLog2CtuSize(floorLog2(m_ctuSize)); // set default tile column if not provided if( m_tileColumnWidth.size() == 0 ) @@ -4732,7 +4787,7 @@ bool EncAppCfg::xCheckParameter() } xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); - xConfirmPara(m_log2ParallelMergeLevel > m_uiCTUSize, "Log2ParallelMergeLevel should be less than or equal to CTU size"); + xConfirmPara(m_log2ParallelMergeLevel > m_ctuSize, "Log2ParallelMergeLevel should be less than or equal to CTU size"); xConfirmPara(m_preferredTransferCharacteristics > 255, "transfer_characteristics_idc should not be greater than 255."); xConfirmPara( unsigned(m_ImvMode) > 1, "ImvMode exceeds range (0 to 1)" ); if (m_AffineAmvr) @@ -4768,8 +4823,7 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_useColorTrans && (m_log2MaxTbSize == 6), "Log2MaxTbSize must be less than 6 when ACT is enabled, otherwise ACT needs to be disabled"); - xConfirmPara(m_uiCTUSize <= 32 && (m_log2MaxTbSize == 6), "Log2MaxTbSize must be less than 6 when CTU size is 32"); - + xConfirmPara(m_ctuSize <= 32 && (m_log2MaxTbSize == 6), "Log2MaxTbSize must be less than 6 when CTU size is 32"); #undef xConfirmPara return check_failed; @@ -4804,8 +4858,10 @@ void EncAppCfg::xPrintParameter() msg(DETAILS,"SII Pre-processed File : %s\n", m_shutterIntervalPreFileName.c_str()); } #endif - msg( DETAILS, "Real Format : %dx%d %gHz\n", m_sourceWidth - m_confWinLeft - m_confWinRight, m_sourceHeight - m_confWinTop - m_confWinBottom, (double)m_iFrameRate / m_temporalSubsampleRatio ); - msg( DETAILS, "Internal Format : %dx%d %gHz\n", m_sourceWidth, m_sourceHeight, (double)m_iFrameRate / m_temporalSubsampleRatio ); + msg(DETAILS, "Real Format : %dx%d %gHz\n", m_sourceWidth - m_confWinLeft - m_confWinRight, + m_sourceHeight - m_confWinTop - m_confWinBottom, (double) m_frameRate / m_temporalSubsampleRatio); + msg(DETAILS, "Internal Format : %dx%d %gHz\n", m_sourceWidth, m_sourceHeight, + (double) m_frameRate / m_temporalSubsampleRatio); msg( DETAILS, "Sequence PSNR output : %s\n", ( m_printMSEBasedSequencePSNR ? "Linear average, MSE-based" : "Linear average only" ) ); msg( DETAILS, "Hexadecimal PSNR output : %s\n", ( m_printHexPsnr ? "Enabled" : "Disabled" ) ); msg( DETAILS, "Sequence MSE output : %s\n", ( m_printSequenceMSE ? "Enabled" : "Disabled" ) ); @@ -4815,20 +4871,22 @@ void EncAppCfg::xPrintParameter() if (m_isField) { msg( DETAILS, "Frame/Field : Field based coding\n" ); - msg( DETAILS, "Field index : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip + m_framesToBeEncoded - 1, m_framesToBeEncoded ); + msg(DETAILS, "Field index : %u - %d (%d fields)\n", m_frameSkip, + m_frameSkip + m_framesToBeEncoded - 1, m_framesToBeEncoded); msg( DETAILS, "Field Order : %s field first\n", m_isTopFieldFirst ? "Top" : "Bottom" ); } else { msg( DETAILS, "Frame/Field : Frame based coding\n" ); - msg( DETAILS, "Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip + m_framesToBeEncoded - 1, m_framesToBeEncoded ); + msg(DETAILS, "Frame index : %u - %d (%d frames)\n", m_frameSkip, + m_frameSkip + m_framesToBeEncoded - 1, m_framesToBeEncoded); } { msg( DETAILS, "Profile : %s\n", profileToString(m_profile) ); } msg( DETAILS,"AllRapPicturesFlag : %d\n", m_allRapPicturesFlag ); - msg(DETAILS, "CTU size / min CU size : %d / %d \n", m_uiMaxCUWidth, 1 << m_log2MinCuSize); + msg(DETAILS, "CTU size / min CU size : %d / %d \n", m_maxCuWidth, 1 << m_log2MinCuSize); msg(DETAILS, "subpicture info present flag : %s\n", m_subPicInfoPresentFlag ? "Enabled" : "Disabled"); if (m_subPicInfoPresentFlag) @@ -4867,8 +4925,8 @@ void EncAppCfg::xPrintParameter() } msg( DETAILS, "Max TB size : %d \n", 1 << m_log2MaxTbSize ); msg( DETAILS, "Motion search range : %d\n", m_iSearchRange ); - msg( DETAILS, "Intra period : %d\n", m_iIntraPeriod ); - msg( DETAILS, "Decoding refresh type : %d\n", m_iDecodingRefreshType ); + msg(DETAILS, "Intra period : %d\n", m_intraPeriod); + msg(DETAILS, "Decoding refresh type : %d\n", m_intraRefreshType); msg( DETAILS, "DRAP period : %d\n", m_drapPeriod ); msg( DETAILS, "EDRAP period : %d\n", m_edrapPeriod ); if (m_qpIncrementAtSourceFrame.bPresent) @@ -4884,9 +4942,10 @@ void EncAppCfg::xPrintParameter() msg( DETAILS, "Cb QP Offset (dual tree) : %d (%d)\n", m_cbQpOffset, m_cbQpOffsetDualTree); msg( DETAILS, "Cr QP Offset (dual tree) : %d (%d)\n", m_crQpOffset, m_crQpOffsetDualTree); msg( DETAILS, "QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); - msg( DETAILS, "GOP size : %d\n", m_iGOPSize ); + msg(DETAILS, "GOP size : %d\n", m_gopSize); msg( DETAILS, "Input bit depth : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] ); - msg( DETAILS, "MSB-extended bit depth : (Y:%d, C:%d)\n", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] ); + msg(DETAILS, "MSB-extended bit depth : (Y:%d, C:%d)\n", m_msbExtendedBitDepth[CHANNEL_TYPE_LUMA], + m_msbExtendedBitDepth[CHANNEL_TYPE_CHROMA]); msg( DETAILS, "Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] ); if (m_cuChromaQpOffsetList.size() > 0) { @@ -4959,7 +5018,9 @@ void EncAppCfg::xPrintParameter() msg( DETAILS, "\n"); msg( VERBOSE, "TOOL CFG: "); - msg( VERBOSE, "IBD:%d ", ((m_internalBitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (m_internalBitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA]))); + msg(VERBOSE, "IBD:%d ", + ((m_internalBitDepth[CHANNEL_TYPE_LUMA] > m_msbExtendedBitDepth[CHANNEL_TYPE_LUMA]) + || (m_internalBitDepth[CHANNEL_TYPE_CHROMA] > m_msbExtendedBitDepth[CHANNEL_TYPE_CHROMA]))); msg( VERBOSE, "HAD:%d ", m_bUseHADME ); msg( VERBOSE, "RDQ:%d ", m_useRDOQ ); msg( VERBOSE, "RDQTS:%d ", m_useRDOQTS ); @@ -4992,8 +5053,10 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "WPP:%d ", (int)m_useWeightedPred); msg( VERBOSE, "WPB:%d ", (int)m_useWeightedBiPred); msg( VERBOSE, "PME:%d ", m_log2ParallelMergeLevel); - const int iWaveFrontSubstreams = m_entropyCodingSyncEnabledFlag ? (m_sourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; - msg( VERBOSE, " WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_entropyCodingSyncEnabledFlag?1:0, iWaveFrontSubstreams); + const int wavefrontSubstreams = + m_entropyCodingSyncEnabledFlag ? (m_sourceHeight + m_maxCuHeight - 1) / m_maxCuHeight : 1; + msg(VERBOSE, " WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_entropyCodingSyncEnabledFlag ? 1 : 0, + wavefrontSubstreams); msg( VERBOSE, " ScalingList:%d ", m_useScalingListId ); msg( VERBOSE, "TMVPMode:%d ", m_TMVPModeId ); msg( VERBOSE, " DQ:%d ", m_depQuantEnabledFlag); @@ -5163,7 +5226,7 @@ void EncAppCfg::xPrintParameter() bool EncAppCfg::xHasNonZeroTemporalID () { - for (unsigned int i = 0; i < m_iGOPSize; i++) + for (unsigned int i = 0; i < m_gopSize; i++) { if ( m_GOPList[i].m_temporalId != 0 ) { @@ -5186,7 +5249,7 @@ std::string EncAppCfg::getGMFAFile (){ bool EncAppCfg::xHasLeadingPicture () { - for (unsigned int i = 0; i < m_iGOPSize; i++) + for (unsigned int i = 0; i < m_gopSize; i++) { for ( unsigned int j = 0; j < m_GOPList[i].m_numRefPics0; j++) { diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 9a43eba2816cca8a81c42ef760f5b7d9e6d41b4a..df101195efc557a558fa411c3efb62cdd2692798 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -90,8 +90,8 @@ protected: double m_dIntraQpFactor; ///< Intra Q Factor. If negative, use a default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(double)(isField ? (GopSize-1)/2 : GopSize-1) )) // source specification - int m_iFrameRate; ///< source frame-rates (Hz) - uint32_t m_FrameSkip; ///< number of skipped frames from the beginning + int m_frameRate; ///< source frame-rates (Hz) + uint32_t m_frameSkip; ///< number of skipped frames from the beginning uint32_t m_temporalSubsampleRatio; ///< temporal subsample ratio, 2 means code every two frames int m_sourceWidth; ///< source width in pixel int m_sourceHeight; ///< source height in pixel (when interlaced = field height) @@ -121,7 +121,7 @@ protected: InputColourSpaceConversion m_inputColourSpaceConvert; ///< colour space conversion to apply to input video bool m_snrInternalColourSpace; ///< if true, then no colour space conversion is applied for snr calculation, otherwise inverse of input is applied. bool m_outputInternalColourSpace; ///< if true, then no colour space conversion is applied for reconstructed video, otherwise inverse of input is applied. - ChromaFormat m_InputChromaFormatIDC; + ChromaFormat m_inputChromaFormatIDC; bool m_printMSEBasedSequencePSNR; bool m_printHexPsnr; @@ -130,8 +130,8 @@ protected: bool m_printMSSSIM; bool m_printWPSNR; bool m_cabacZeroWordPaddingEnabled; - bool m_bClipInputVideoToRec709Range; - bool m_bClipOutputVideoToRec709Range; + bool m_clipInputVideoToRec709Range; + bool m_clipOutputVideoToRec709Range; bool m_packedYUVMode; ///< If true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data bool m_gciPresentFlag; @@ -222,7 +222,7 @@ protected: bool m_oneSlicePerSubpicConstraintFlag; bool m_noSubpicInfoConstraintFlag; // coding structure - int m_iIntraPeriod; ///< period of I-slice (random access period) + int m_intraPeriod; ///< period of I-slice (random access period) #if GDR_ENABLED bool m_gdrEnabled; int m_gdrPocStart; @@ -230,8 +230,8 @@ protected: int m_gdrInterval; bool m_gdrNoHash; #endif - int m_iDecodingRefreshType; ///< random access type - int m_iGOPSize; ///< GOP size of hierarchical structure + int m_intraRefreshType; ///< random access type + int m_gopSize; ///< GOP size of hierarchical structure int m_drapPeriod; ///< period of dependent RAP pictures int m_edrapPeriod; ///< period of extended dependent RAP pictures bool m_rewriteParamSets; ///< Flag to enable rewriting of parameter sets at random access points @@ -313,7 +313,7 @@ protected: bool m_isLowDelay; // coding unit (CU) definition - unsigned m_uiCTUSize; + unsigned m_ctuSize; bool m_subPicInfoPresentFlag; unsigned m_numSubPics; bool m_subPicSameSizeFlag; @@ -328,12 +328,12 @@ protected: unsigned m_subPicIdLen; std::vector<uint16_t> m_subPicId; bool m_SplitConsOverrideEnabledFlag; - unsigned m_uiMinQT[3]; // 0: I slice luma; 1: P/B slice; 2: I slice chroma + unsigned m_minQt[3]; // 0: I slice luma; 1: P/B slice; 2: I slice chroma unsigned m_uiMaxMTTHierarchyDepth; unsigned m_uiMaxMTTHierarchyDepthI; unsigned m_uiMaxMTTHierarchyDepthIChroma; - unsigned m_uiMaxBT[3]; - unsigned m_uiMaxTT[3]; + unsigned m_maxBt[3]; + unsigned m_maxTt[3]; int m_ttFastSkip; double m_ttFastSkipThr; bool m_dualTree; @@ -407,8 +407,8 @@ protected: uint32_t m_initialCW; int m_CSoffset; bool m_encDbOpt; - unsigned m_uiMaxCUWidth; ///< max. CU width in pixel - unsigned m_uiMaxCUHeight; ///< max. CU height in pixel + unsigned m_maxCuWidth; ///< max. CU width in pixel + unsigned m_maxCuHeight; ///< max. CU height in pixel unsigned m_log2MinCuSize; ///< min. CU size log2 bool m_useFastLCTU; @@ -429,7 +429,7 @@ protected: // coding tools (bit-depth) int m_inputBitDepth [MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input file int m_outputBitDepth [MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of output file - int m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input samples after MSB extension + int m_msbExtendedBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input samples after MSB extension int m_internalBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit-depth codec operates at (input/output files will be converted) bool m_extendedPrecisionProcessingFlag; bool m_tsrcRicePresentFlag; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index e1822fdb73040cdbeb35b29711bd7add87c6314e..c94911fc86c1013d8f45c3914407625b31f258c0 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -2916,8 +2916,8 @@ SPS::SPS() , m_maxMTTHierarchyDepth{ MAX_BT_DEPTH, MAX_BT_DEPTH_INTER, MAX_BT_DEPTH_C } , m_maxBTSize{ 0, 0, 0 } , m_maxTTSize{ 0, 0, 0 } - , m_uiMaxCUWidth(32) - , m_uiMaxCUHeight(32) + , m_maxCuWidth(32) + , m_maxCuHeight(32) , m_numRPL0(0) , m_numRPL1(0) , m_rpl1CopyFromRpl0Flag(false) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 9c94d193950415517bebe6575558a096e0b351af..48cb5bd1e5e1fbf4c0e231ec2e369db962467714 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -1426,8 +1426,8 @@ private: unsigned m_maxTTSize[3]; bool m_idrRefParamList; unsigned m_dualITree; - uint32_t m_uiMaxCUWidth; - uint32_t m_uiMaxCUHeight; + uint32_t m_maxCuWidth; + uint32_t m_maxCuHeight; RPLList m_RPLList0; RPLList m_RPLList1; @@ -1688,10 +1688,10 @@ public: void setUseDualITree(bool b) { m_dualITree = b; } bool getUseDualITree() const { return m_dualITree; } - void setMaxCUWidth( uint32_t u ) { m_uiMaxCUWidth = u; } - uint32_t getMaxCUWidth() const { return m_uiMaxCUWidth; } - void setMaxCUHeight( uint32_t u ) { m_uiMaxCUHeight = u; } - uint32_t getMaxCUHeight() const { return m_uiMaxCUHeight; } + void setMaxCUWidth(uint32_t u) { m_maxCuWidth = u; } + uint32_t getMaxCUWidth() const { return m_maxCuWidth; } + void setMaxCUHeight(uint32_t u) { m_maxCuHeight = u; } + uint32_t getMaxCUHeight() const { return m_maxCuHeight; } bool getTransformSkipEnabledFlag() const { return m_transformSkipEnabledFlag; } void setTransformSkipEnabledFlag( bool b ) { m_transformSkipEnabledFlag = b; } uint32_t getLog2MaxTransformSkipBlockSize() const { return m_log2MaxTransformSkipBlockSize; } diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 8c38a9772f70675d8c23870f3911bf2ede64260a..9ece8c4710309b66e8350c47b8ee7197e40990e2 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -154,8 +154,8 @@ class EncCfg { protected: //==== File I/O ======== - int m_iFrameRate; - int m_FrameSkip; + int m_frameRate; + int m_frameSkip; uint32_t m_temporalSubsampleRatio; int m_sourceWidth; int m_sourceHeight; @@ -271,7 +271,7 @@ protected: uint32_t m_decodingRefreshType; ///< the type of decoding refresh employed for the random access. bool m_rewriteParamSets; bool m_idrRefParamList; - int m_iGOPSize; + int m_gopSize; RPLEntry m_RPLList0[MAX_GOP]; RPLEntry m_RPLList1[MAX_GOP]; int m_numRPLList0; @@ -317,9 +317,9 @@ protected: bool m_gdrNoHash; #endif bool m_useSplitConsOverride; - unsigned m_uiMinQT[3]; //0: I slice; 1: P/B slice, 2: I slice chroma - unsigned m_uiMaxBT[3]; //0: I slice; 1: P/B slice, 2: I slice chroma - unsigned m_uiMaxTT[3]; //0: I slice; 1: P/B slice, 2: I slice chroma + unsigned m_minQt[3]; // 0: I slice; 1: P/B slice, 2: I slice chroma + unsigned m_maxBt[3]; // 0: I slice; 1: P/B slice, 2: I slice chroma + unsigned m_maxTt[3]; // 0: I slice; 1: P/B slice, 2: I slice chroma unsigned m_uiMaxMTTHierarchyDepth; unsigned m_uiMaxMTTHierarchyDepthI; unsigned m_uiMaxMTTHierarchyDepthIChroma; @@ -1147,8 +1147,8 @@ public: bool getNoReverseLastSigCoeffConstraintFlag() const { return m_noReverseLastSigCoeffConstraintFlag; } void setNoReverseLastSigCoeffConstraintFlag(bool val) { m_noReverseLastSigCoeffConstraintFlag = val; } - void setFrameRate ( int i ) { m_iFrameRate = i; } - void setFrameSkip ( uint32_t i ) { m_FrameSkip = i; } + void setFrameRate(int i) { m_frameRate = i; } + void setFrameSkip(uint32_t i) { m_frameSkip = i; } void setTemporalSubsampleRatio ( uint32_t i ) { m_temporalSubsampleRatio = i; } void setSourceWidth ( int i ) { m_sourceWidth = i; } void setSourceHeight ( int i ) { m_sourceHeight = i; } @@ -1199,7 +1199,7 @@ public: void setReWriteParamSets ( bool b ) { m_rewriteParamSets = b; } void setIDRRefParamListPresent ( bool b ) { m_idrRefParamList = b; } bool getIDRRefParamListPresent () const { return m_idrRefParamList; } - void setGOPSize ( int i ) { m_iGOPSize = i; } + void setGOPSize(int i) { m_gopSize = i; } void setGopList(const GOPEntry GOPList[MAX_GOP]) { for (int i = 0; i < MAX_GOP; i++) m_GOPList[i] = GOPList[i]; } const GOPEntry &getGOPEntry ( int i ) const { return m_GOPList[i]; } void setRPLList0(const RPLEntry RPLList[MAX_GOP]) @@ -1251,9 +1251,24 @@ public: void setIsLowDelay ( bool isLowDelay ) { m_isLowDelay = isLowDelay; } void setCTUSize ( unsigned u ) { m_CTUSize = u; } - void setMinQTSizes ( unsigned* minQT) { m_uiMinQT[0] = minQT[0]; m_uiMinQT[1] = minQT[1]; m_uiMinQT[2] = minQT[2]; } - void setMaxBTSizes ( unsigned* maxBT) { m_uiMaxBT[0] = maxBT[0]; m_uiMaxBT[1] = maxBT[1]; m_uiMaxBT[2] = maxBT[2]; } - void setMaxTTSizes ( unsigned* maxTT) { m_uiMaxTT[0] = maxTT[0]; m_uiMaxTT[1] = maxTT[1]; m_uiMaxTT[2] = maxTT[2]; } + void setMinQTSizes(unsigned *minQT) + { + m_minQt[0] = minQT[0]; + m_minQt[1] = minQT[1]; + m_minQt[2] = minQT[2]; + } + void setMaxBTSizes(unsigned *maxBT) + { + m_maxBt[0] = maxBT[0]; + m_maxBt[1] = maxBT[1]; + m_maxBt[2] = maxBT[2]; + } + void setMaxTTSizes(unsigned *maxTT) + { + m_maxTt[0] = maxTT[0]; + m_maxTt[1] = maxTT[1]; + m_maxTt[2] = maxTT[2]; + } #if GDR_ENABLED void setGdrEnabled(bool b) { m_gdrEnabled = b; } void setGdrPeriod(unsigned u) { m_gdrPeriod = u; } @@ -1609,8 +1624,8 @@ public: #endif //====== Sequence ======== - int getFrameRate () const { return m_iFrameRate; } - uint32_t getFrameSkip () const { return m_FrameSkip; } + int getFrameRate() const { return m_frameRate; } + uint32_t getFrameSkip() const { return m_frameSkip; } uint32_t getTemporalSubsampleRatio () const { return m_temporalSubsampleRatio; } int getSourceWidth () const { return m_sourceWidth; } int getSourceHeight () const { return m_sourceHeight; } @@ -1628,7 +1643,7 @@ public: int getIntraPeriod () const { return m_intraPeriod; } uint32_t getDecodingRefreshType () const { return m_decodingRefreshType; } bool getReWriteParamSets () const { return m_rewriteParamSets; } - int getGOPSize () const { return m_iGOPSize; } + int getGOPSize() const { return m_gopSize; } int getMaxDecPicBuffering (uint32_t tlayer) { return m_maxDecPicBuffering[tlayer]; } int getMaxNumReorderPics (uint32_t tlayer) { return m_maxNumReorderPics[tlayer]; } int getDrapPeriod () { return m_drapPeriod; } diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 63fc838688e08017e0b1594781769808c804b8c9..7d5d7b5647c1c1f00a911810687268b4309ae5a3 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -118,8 +118,10 @@ void EncLib::create( const int layerId ) } if ( m_RCEnableRateControl ) { - m_cRateCtrl.init(m_framesToBeEncoded, m_RCTargetBitrate, (int)((double)m_iFrameRate / m_temporalSubsampleRatio + 0.5), m_iGOPSize, m_intraPeriod, m_sourceWidth, m_sourceHeight, - m_maxCUWidth, m_maxCUHeight, getBitDepth(CHANNEL_TYPE_LUMA), m_RCKeepHierarchicalBit, m_RCUseLCUSeparateModel, m_GOPList); + m_cRateCtrl.init(m_framesToBeEncoded, m_RCTargetBitrate, + (int) ((double) m_frameRate / m_temporalSubsampleRatio + 0.5), m_gopSize, m_intraPeriod, + m_sourceWidth, m_sourceHeight, m_maxCUWidth, m_maxCUHeight, getBitDepth(CHANNEL_TYPE_LUMA), + m_RCKeepHierarchicalBit, m_RCUseLCUSeparateModel, m_GOPList); } } @@ -178,7 +180,8 @@ void EncLib::init(AUWriterIf *auWriterIf) if (m_RCCpbSaturationEnabled) { - m_cRateCtrl.initHrdParam(sps0.getGeneralHrdParameters(), sps0.getOlsHrdParameters(), m_iFrameRate, m_RCInitialCpbFullness); + m_cRateCtrl.initHrdParam(sps0.getGeneralHrdParameters(), sps0.getOlsHrdParameters(), m_frameRate, + m_RCInitialCpbFullness); } m_cRdCost.setCostMode ( m_costMode ); @@ -905,7 +908,7 @@ bool EncLib::encodePrep(bool flush, PelStorage *pcPicYuvOrg, PelStorage *cPicYuv } if ((m_receivedPicCount == 0) - || (!flush && (m_pocLast != 0) && (m_receivedPicCount != m_iGOPSize) && (m_iGOPSize != 0))) + || (!flush && (m_pocLast != 0) && (m_receivedPicCount != m_gopSize) && (m_gopSize != 0))) { numEncoded = 0; return true; @@ -945,7 +948,7 @@ bool EncLib::encode(const InputColourSpaceConversion snrCSC, std::list<PelUnitBu m_picIdInGOP++; // go over all pictures in a GOP excluding the first IRAP - if (m_picIdInGOP != m_iGOPSize && m_pocLast) + if (m_picIdInGOP != m_gopSize && m_pocLast) { return true; } @@ -1074,7 +1077,7 @@ bool EncLib::encodePrep(bool flush, PelStorage *pcPicYuvOrg, PelStorage *pcPicYu } - if (m_receivedPicCount && (flush || m_pocLast == 1 || m_receivedPicCount == m_iGOPSize)) + if (m_receivedPicCount && (flush || m_pocLast == 1 || m_receivedPicCount == m_gopSize)) { m_picIdInGOP = 0; keepDoing = false; @@ -1104,7 +1107,7 @@ bool EncLib::encode(const InputColourSpaceConversion snrCSC, std::list<PelUnitBu } // go over all pictures in a GOP excluding first top field and first bottom field - if (m_picIdInGOP != m_iGOPSize && m_pocLast > 1) + if (m_picIdInGOP != m_gopSize && m_pocLast > 1) { return true; } @@ -1148,7 +1151,7 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict // use an entry in the buffered list if the maximum number that need buffering has been reached: int maxDecPicBuffering = ( m_vps == nullptr || m_vps->m_numLayersInOls[m_vps->m_targetOlsIdx] == 1 ) ? sps.getMaxDecPicBuffering( MAX_TLAYER - 1 ) : m_vps->getMaxDecPicBuffering( MAX_TLAYER - 1 ); - if( m_cListPic.size() >= (uint32_t)( m_iGOPSize + maxDecPicBuffering + 2 ) ) + if (m_cListPic.size() >= (uint32_t) (m_gopSize + maxDecPicBuffering + 2)) { PicList::iterator iterPic = m_cListPic.begin(); int size = int(m_cListPic.size()); @@ -1501,10 +1504,10 @@ void EncLib::xInitSPS( SPS& sps ) sps.setCTUSize ( m_CTUSize ); sps.setSplitConsOverrideEnabledFlag ( m_useSplitConsOverride ); - sps.setMinQTSizes ( m_uiMinQT ); + sps.setMinQTSizes(m_minQt); sps.setMaxMTTHierarchyDepth ( m_uiMaxMTTHierarchyDepth, m_uiMaxMTTHierarchyDepthI, m_uiMaxMTTHierarchyDepthIChroma ); - sps.setMaxBTSize( m_uiMaxBT[1], m_uiMaxBT[0], m_uiMaxBT[2] ); - sps.setMaxTTSize( m_uiMaxTT[1], m_uiMaxTT[0], m_uiMaxTT[2] ); + sps.setMaxBTSize(m_maxBt[1], m_maxBt[0], m_maxBt[2]); + sps.setMaxTTSize(m_maxTt[1], m_maxTt[0], m_maxTt[2]); sps.setIDRRefParamListPresent ( m_idrRefParamList ); sps.setUseDualITree ( m_dualITree ); sps.setUseLFNST ( m_LFNST ); @@ -1920,7 +1923,7 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) bChromaDeltaQPEnabled = ( m_sliceChromaQpOffsetIntraOrPeriodic[0] || m_sliceChromaQpOffsetIntraOrPeriodic[1] ); if( !bChromaDeltaQPEnabled ) { - for( int i=0; i<m_iGOPSize; i++ ) + for (int i = 0; i < m_gopSize; i++) { if( m_GOPList[i].m_CbQPoffset || m_GOPList[i].m_CrQPoffset ) { @@ -2438,8 +2441,8 @@ void EncLib::selectReferencePictureList(Slice* slice, int POCCurr, int GOPid, in rplLists[1] = slice->getSPS()->getRPLList(1); } - int fullListNum = m_iGOPSize; - int partialListNum = getRPLCandidateSize(0) - m_iGOPSize; + int fullListNum = m_gopSize; + int partialListNum = getRPLCandidateSize(0) - m_gopSize; int extraNum = fullListNum; int rplPeriod = m_intraPeriod; @@ -2447,21 +2450,23 @@ void EncLib::selectReferencePictureList(Slice* slice, int POCCurr, int GOPid, in { if (rplLists[0]->getReferencePictureList(1)->getRefPicIdentifier(0) * rplLists[1]->getReferencePictureList(1)->getRefPicIdentifier(0) < 0) { - rplPeriod = m_iGOPSize * 2; + rplPeriod = m_gopSize * 2; } } if (m_isLowDelay) { const int currPOCsinceLastIDR = POCCurr - slice->getLastIDR(); - if (currPOCsinceLastIDR < (2 * m_iGOPSize + 2)) + if (currPOCsinceLastIDR < (2 * m_gopSize + 2)) { - int candidateIdx = (currPOCsinceLastIDR + m_iGOPSize - 1 >= fullListNum + partialListNum) ? GOPid : currPOCsinceLastIDR + m_iGOPSize - 1; + int candidateIdx = (currPOCsinceLastIDR + m_gopSize - 1 >= fullListNum + partialListNum) + ? GOPid + : currPOCsinceLastIDR + m_gopSize - 1; RPLIdx = candidateIdx; } else { - RPLIdx = (POCCurr % m_iGOPSize == 0) ? m_iGOPSize - 1 : POCCurr % m_iGOPSize - 1; + RPLIdx = (POCCurr % m_gopSize == 0) ? m_gopSize - 1 : POCCurr % m_gopSize - 1; } extraNum = fullListNum + partialListNum; } @@ -2494,23 +2499,23 @@ void EncLib::selectReferencePictureList(Slice* slice, int POCCurr, int GOPid, in { // To set RPL indexes for LD int numRPLCandidates = getRPLCandidateSize(0); - if (POCCurr < numRPLCandidates - m_iGOPSize + 2) + if (POCCurr < numRPLCandidates - m_gopSize + 2) { - RPLIdx = POCCurr + m_iGOPSize - 2; + RPLIdx = POCCurr + m_gopSize - 2; } else { - if (POCCurr%m_iGOPSize == 0) + if (POCCurr % m_gopSize == 0) { - RPLIdx = m_iGOPSize - 2; + RPLIdx = m_gopSize - 2; } - else if (POCCurr%m_iGOPSize == 1) + else if (POCCurr % m_gopSize == 1) { - RPLIdx = m_iGOPSize - 1; + RPLIdx = m_gopSize - 1; } else { - RPLIdx = POCCurr % m_iGOPSize - 2; + RPLIdx = POCCurr % m_gopSize - 2; } } } diff --git a/source/Lib/EncoderLib/EncTemporalFilter.cpp b/source/Lib/EncoderLib/EncTemporalFilter.cpp index 5360ed74fde68001d0d8cd81a8709f809d24d975..069697ceff54e04ad29e7d6ac467519378cf3ac5 100644 --- a/source/Lib/EncoderLib/EncTemporalFilter.cpp +++ b/source/Lib/EncoderLib/EncTemporalFilter.cpp @@ -77,14 +77,14 @@ const double EncTemporalFilter::m_refStrengths[2][4] = { const int EncTemporalFilter::m_cuTreeThresh[4] = { 75, 60, 30, 15 }; -EncTemporalFilter::EncTemporalFilter() : - m_FrameSkip(0), - m_chromaFormatIDC(NUM_CHROMA_FORMAT), - m_sourceWidth(0), - m_sourceHeight(0), - m_QP(0), - m_clipInputVideoToRec709Range(false), - m_inputColourSpaceConvert(NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS) +EncTemporalFilter::EncTemporalFilter() + : m_frameSkip(0) + , m_chromaFormatIDC(NUM_CHROMA_FORMAT) + , m_sourceWidth(0) + , m_sourceHeight(0) + , m_QP(0) + , m_clipInputVideoToRec709Range(false) + , m_inputColourSpaceConvert(NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS) {} void EncTemporalFilter::init(const int frameSkip, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], @@ -97,11 +97,11 @@ void EncTemporalFilter::init(const int frameSkip, const int inputBitDepth[MAX_NU , const bool mctfEnabled, std::map<int, int*> *adaptQPmap, const bool bimEnabled, const int ctuSize ) { - m_FrameSkip = frameSkip; + m_frameSkip = frameSkip; for (int i = 0; i < MAX_NUM_CHANNEL_TYPE; i++) { m_inputBitDepth[i] = inputBitDepth[i]; - m_MSBExtendedBitDepth[i] = msbExtendedBitDepth[i]; + m_msbExtendedBitDepth[i] = msbExtendedBitDepth[i]; m_internalBitDepth[i] = internalBitDepth[i]; } @@ -153,11 +153,11 @@ bool EncTemporalFilter::filter(PelStorage *orgPic, int receivedPoc) if (isFilterThisFrame) { - const int currentFilePoc = receivedPoc + m_FrameSkip; + const int currentFilePoc = receivedPoc + m_frameSkip; const int firstFrame = std::max(currentFilePoc - m_pastRefs, m_firstValidFrame); const int lastFrame = std::min(currentFilePoc + m_futureRefs, m_lastValidFrame); VideoIOYuv yuvFrames; - yuvFrames.open(m_inputFileName, false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth); + yuvFrames.open(m_inputFileName, false, m_inputBitDepth, m_msbExtendedBitDepth, m_internalBitDepth); yuvFrames.skipFrames(firstFrame, m_sourceWidth - m_pad[0], m_sourceHeight - m_pad[1], m_chromaFormatIDC); std::deque<TemporalFilterSourcePicInfo> srcFrameInfo; diff --git a/source/Lib/EncoderLib/EncTemporalFilter.h b/source/Lib/EncoderLib/EncTemporalFilter.h index fd75c2adb77a04e1750724992aeb4d5b90e563e2..04c482d708327bb104802be54afac135c834a06b 100644 --- a/source/Lib/EncoderLib/EncTemporalFilter.h +++ b/source/Lib/EncoderLib/EncTemporalFilter.h @@ -130,10 +130,10 @@ private: static const int m_cuTreeThresh[4]; // Private member variables - int m_FrameSkip; + int m_frameSkip; std::string m_inputFileName; int m_inputBitDepth[MAX_NUM_CHANNEL_TYPE]; - int m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE]; + int m_msbExtendedBitDepth[MAX_NUM_CHANNEL_TYPE]; int m_internalBitDepth[MAX_NUM_CHANNEL_TYPE]; ChromaFormat m_chromaFormatIDC; int m_sourceWidth; diff --git a/source/Lib/Utilities/VideoIOYuv.cpp b/source/Lib/Utilities/VideoIOYuv.cpp index 3528b0ea08d5ac093ff21617a74198c2ffc17572..600ef555f35da97e0e21e40e376810ceaf68c65a 100644 --- a/source/Lib/Utilities/VideoIOYuv.cpp +++ b/source/Lib/Utilities/VideoIOYuv.cpp @@ -136,8 +136,8 @@ void VideoIOYuv::open( const std::string &fileName, bool bWriteMode, const int f for(uint32_t ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) { m_fileBitdepth [ch] = std::min<uint32_t>(fileBitDepth[ch], 16); - m_MSBExtendedBitDepth[ch] = MSBExtendedBitDepth[ch]; - m_bitdepthShift [ch] = internalBitDepth[ch] - m_MSBExtendedBitDepth[ch]; + m_msbExtendedBitDepth[ch] = MSBExtendedBitDepth[ch]; + m_bitdepthShift[ch] = internalBitDepth[ch] - m_msbExtendedBitDepth[ch]; if (m_fileBitdepth[ch] > 16) { @@ -1039,7 +1039,8 @@ static bool writeField(ostream& fd, const Pel* top, const Pel* bottom, * @param format chroma format * @return true for success, false in case of error */ -bool VideoIOYuv::read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSpaceConversion ipcsc, int aiPad[2], ChromaFormat format, const bool bClipToRec709 ) +bool VideoIOYuv::read(PelUnitBuf &pic, PelUnitBuf &picOrg, const InputColourSpaceConversion ipcsc, int aiPad[2], + ChromaFormat format, const bool clipToRec709) { // check end-of-file if ( isEof() ) @@ -1092,11 +1093,14 @@ bool VideoIOYuv::read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSp const ComponentID compID = ComponentID(comp); const ChannelType chType=toChannelType(compID); - const int desired_bitdepth = m_MSBExtendedBitDepth[chType] + m_bitdepthShift[chType]; + const int desired_bitdepth = m_msbExtendedBitDepth[chType] + m_bitdepthShift[chType]; - const bool b709Compliance=(bClipToRec709) && (m_bitdepthShift[chType] < 0 && desired_bitdepth >= 8); /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */ - const Pel minval = b709Compliance? (( 1 << (desired_bitdepth - 8)) ) : 0; - const Pel maxval = b709Compliance? ((0xff << (desired_bitdepth - 8)) -1) : (1 << desired_bitdepth) - 1; + const bool rec709Compliance = + (clipToRec709) + && (m_bitdepthShift[chType] < 0 + && desired_bitdepth >= 8); /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */ + const Pel minval = rec709Compliance ? ((1 << (desired_bitdepth - 8))) : 0; + const Pel maxval = rec709Compliance ? ((0xff << (desired_bitdepth - 8)) - 1) : (1 << desired_bitdepth) - 1; const bool processComponent = (size_t)compID < picOrg.bufs.size(); Pel* const dst = processComponent ? picOrg.get(compID).bufAt(0,0) : nullptr; #if EXTENSION_360_VIDEO @@ -1149,10 +1153,10 @@ bool VideoIOYuv::read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSp * @return true for success, false in case of error */ // here orgWidth and orgHeight are for luma -bool VideoIOYuv::write( uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf& pic, - const InputColourSpaceConversion ipCSC, - const bool bPackedYUVOutputMode, - int confLeft, int confRight, int confTop, int confBottom, ChromaFormat format, const bool bClipToRec709, const bool subtractConfWindowOffsets ) +bool VideoIOYuv::write(uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf &pic, + const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int confLeft, + int confRight, int confTop, int confBottom, ChromaFormat format, const bool clipToRec709, + const bool subtractConfWindowOffsets) { PelStorage interm; @@ -1196,9 +1200,13 @@ bool VideoIOYuv::write( uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf { const ComponentID compID=ComponentID(comp); const ChannelType ch=toChannelType(compID); - const bool b709Compliance = bClipToRec709 && (-m_bitdepthShift[ch] < 0 && m_MSBExtendedBitDepth[ch] >= 8); /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */ - const Pel minval = b709Compliance? (( 1 << (m_MSBExtendedBitDepth[ch] - 8)) ) : 0; - const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1; + const bool rec709Compliance = + clipToRec709 + && (-m_bitdepthShift[ch] < 0 + && m_msbExtendedBitDepth[ch] >= 8); /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */ + const Pel minval = rec709Compliance ? ((1 << (m_msbExtendedBitDepth[ch] - 8))) : 0; + const Pel maxval = + rec709Compliance ? ((0xff << (m_msbExtendedBitDepth[ch] - 8)) - 1) : (1 << m_msbExtendedBitDepth[ch]) - 1; scalePlane( picZ.get(compID), -m_bitdepthShift[ch], minval, maxval); } @@ -1245,10 +1253,9 @@ bool VideoIOYuv::write( uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf return retval; } -bool VideoIOYuv::write( const CPelUnitBuf& picTop, const CPelUnitBuf& picBottom, - const InputColourSpaceConversion ipCSC, - const bool bPackedYUVOutputMode, - int confLeft, int confRight, int confTop, int confBottom, ChromaFormat format, const bool isTff, const bool bClipToRec709 ) +bool VideoIOYuv::write(const CPelUnitBuf &picTop, const CPelUnitBuf &picBottom, const InputColourSpaceConversion ipCSC, + const bool bPackedYUVOutputMode, int confLeft, int confRight, int confTop, int confBottom, + ChromaFormat format, const bool isTff, const bool clipToRec709) { PelStorage intermTop; PelStorage intermBottom; @@ -1301,9 +1308,13 @@ bool VideoIOYuv::write( const CPelUnitBuf& picTop, const CPelUnitBuf& picBottom, { const ComponentID compID=ComponentID(comp); const ChannelType ch=toChannelType(compID); - const bool b709Compliance=bClipToRec709 && (-m_bitdepthShift[ch] < 0 && m_MSBExtendedBitDepth[ch] >= 8); /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */ - const Pel minval = b709Compliance? (( 1 << (m_MSBExtendedBitDepth[ch] - 8)) ) : 0; - const Pel maxval = b709Compliance? ((0xff << (m_MSBExtendedBitDepth[ch] - 8)) -1) : (1 << m_MSBExtendedBitDepth[ch]) - 1; + const bool rec709Compliance = + clipToRec709 + && (-m_bitdepthShift[ch] < 0 + && m_msbExtendedBitDepth[ch] >= 8); /* ITU-R BT.709 compliant clipping for converting say 10b to 8b */ + const Pel minval = rec709Compliance ? ((1 << (m_msbExtendedBitDepth[ch] - 8))) : 0; + const Pel maxval = + rec709Compliance ? ((0xff << (m_msbExtendedBitDepth[ch] - 8)) - 1) : (1 << m_msbExtendedBitDepth[ch]) - 1; scalePlane( picZ.get(compID), -m_bitdepthShift[ch], minval, maxval); } @@ -1419,9 +1430,14 @@ void VideoIOYuv::ColourSpaceConvert(const CPelUnitBuf &src, PelUnitBuf &dest, co } #if !JVET_AB0081 -bool VideoIOYuv::writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPelUnitBuf& pic, const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int outputChoice, ChromaFormat format, const bool bClipToRec709) +bool VideoIOYuv::writeUpscaledPicture(const SPS &sps, const PPS &pps, const CPelUnitBuf &pic, + const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, + int outputChoice, ChromaFormat format, const bool clipToRec709) #else -bool VideoIOYuv::writeUpscaledPicture(const SPS& sps, const PPS& pps, const CPelUnitBuf& pic, const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int outputChoice, ChromaFormat format, const bool bClipToRec709, int upscaleFilterForDisplay) +bool VideoIOYuv::writeUpscaledPicture(const SPS &sps, const PPS &pps, const CPelUnitBuf &pic, + const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, + int outputChoice, ChromaFormat format, const bool clipToRec709, + int upscaleFilterForDisplay) #endif { ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); @@ -1460,41 +1476,34 @@ bool VideoIOYuv::writeUpscaledPicture(const SPS& sps, const PPS& pps, const CPel #else Picture::rescalePicture( std::pair<int, int>( xScale, yScale ), pic, pps.getScalingWindow(), upscaledPic, afterScaleWindowFullResolution, chromaFormatIDC, sps.getBitDepths(), false, false, sps.getHorCollocatedChromaFlag(), sps.getVerCollocatedChromaFlag() ); #endif - ret = write( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples(), upscaledPic, - ipCSC, - bPackedYUVOutputMode, - confFullResolution.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), - confFullResolution.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), - confFullResolution.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), - confFullResolution.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), - NUM_CHROMA_FORMAT, bClipToRec709, false ); + ret = write(sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples(), upscaledPic, ipCSC, + bPackedYUVOutputMode, confFullResolution.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), + confFullResolution.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), + confFullResolution.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), + confFullResolution.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), NUM_CHROMA_FORMAT, + clipToRec709, false); } else { const Window &conf = pps.getConformanceWindow(); - ret = write( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples(), pic, - ipCSC, - bPackedYUVOutputMode, - conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), - conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), - NUM_CHROMA_FORMAT, bClipToRec709, false ); + ret = + write(sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples(), pic, ipCSC, bPackedYUVOutputMode, + conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), NUM_CHROMA_FORMAT, clipToRec709, false); } } else { const Window &conf = pps.getConformanceWindow(); - ret = write( pic.get( COMPONENT_Y ).width, pic.get( COMPONENT_Y ).height, pic, - ipCSC, - bPackedYUVOutputMode, - conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowRightOffset() * SPS::getWinUnitX( chromaFormatIDC ), - conf.getWindowTopOffset() * SPS::getWinUnitY( chromaFormatIDC ), - conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ), - NUM_CHROMA_FORMAT, bClipToRec709 ); + ret = write(pic.get(COMPONENT_Y).width, pic.get(COMPONENT_Y).height, pic, ipCSC, bPackedYUVOutputMode, + conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIDC), + conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIDC), + conf.getWindowBottomOffset() * SPS::getWinUnitY(chromaFormatIDC), NUM_CHROMA_FORMAT, clipToRec709); } return ret; diff --git a/source/Lib/Utilities/VideoIOYuv.h b/source/Lib/Utilities/VideoIOYuv.h index daaec390a7f83282343dc5e5815d403d601cb128..fa5910ff88d2929e7aa0ab5dd01468f34bc5a013 100644 --- a/source/Lib/Utilities/VideoIOYuv.h +++ b/source/Lib/Utilities/VideoIOYuv.h @@ -57,7 +57,7 @@ class VideoIOYuv private: std::fstream m_cHandle; ///< file handle int m_fileBitdepth[MAX_NUM_CHANNEL_TYPE]; ///< bitdepth of input/output video file - int m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bitdepth after addition of MSBs (with value 0) + int m_msbExtendedBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bitdepth after addition of MSBs (with value 0) int m_bitdepthShift[MAX_NUM_CHANNEL_TYPE]; ///< number of bits to increase or decrease image by before/after write/read int m_inY4mFileHeaderLength = 0; int m_outPicWidth = 0; @@ -89,19 +89,20 @@ public: // If fileFormat=NUM_CHROMA_FORMAT, use the format defined by pPicYuvTrueOrg - bool read ( PelUnitBuf& pic, PelUnitBuf& picOrg, const InputColourSpaceConversion ipcsc, int aiPad[2], ChromaFormat fileFormat=NUM_CHROMA_FORMAT, const bool bClipToRec709=false ); ///< read one frame with padding parameter + bool read(PelUnitBuf &pic, PelUnitBuf &picOrg, const InputColourSpaceConversion ipcsc, int aiPad[2], + ChromaFormat fileFormat = NUM_CHROMA_FORMAT, + const bool clipToRec709 = false); ///< read one frame with padding parameter // If fileFormat=NUM_CHROMA_FORMAT, use the format defined by pPicYuv - bool write( uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf& pic, - const InputColourSpaceConversion ipCSC, - const bool bPackedYUVOutputMode, - int confLeft = 0, int confRight = 0, int confTop = 0, int confBottom = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool bClipToRec709 = false, const bool subtractConfWindowOffsets = true ); ///< write one YUV frame with padding parameter + bool write(uint32_t orgWidth, uint32_t orgHeight, const CPelUnitBuf &pic, const InputColourSpaceConversion ipCSC, + const bool bPackedYUVOutputMode, int confLeft = 0, int confRight = 0, int confTop = 0, int confBottom = 0, + ChromaFormat format = NUM_CHROMA_FORMAT, const bool clipToRec709 = false, + const bool subtractConfWindowOffsets = true); ///< write one YUV frame with padding parameter // If fileFormat=NUM_CHROMA_FORMAT, use the format defined by pPicYuvTop and pPicYuvBottom - bool write( const CPelUnitBuf& picTop, const CPelUnitBuf& picBot, - const InputColourSpaceConversion ipCSC, - const bool bPackedYUVOutputMode, - int confLeft = 0, int confRight = 0, int confTop = 0, int confBottom = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool isTff = false, const bool bClipToRec709 = false ); + bool write(const CPelUnitBuf &picTop, const CPelUnitBuf &picBot, const InputColourSpaceConversion ipCSC, + const bool bPackedYUVOutputMode, int confLeft = 0, int confRight = 0, int confTop = 0, int confBottom = 0, + ChromaFormat format = NUM_CHROMA_FORMAT, const bool isTff = false, const bool clipToRec709 = false); static void ColourSpaceConvert(const CPelUnitBuf &src, PelUnitBuf &dest, const InputColourSpaceConversion conversion, bool bIsForwards); @@ -112,11 +113,16 @@ public: int getBitdepthShift( int ch ) { return m_bitdepthShift[ch]; } int getFileBitdepth( int ch ) { return m_fileBitdepth[ch]; } - bool writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPelUnitBuf& pic, + bool writeUpscaledPicture(const SPS &sps, const PPS &pps, const CPelUnitBuf &pic, #if !JVET_AB0081 - const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int outputChoice = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool bClipToRec709 = false); ///< write one upsaled YUV frame + const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, + int outputChoice = 0, ChromaFormat format = NUM_CHROMA_FORMAT, + const bool clipToRec709 = false); ///< write one upsaled YUV frame #else - const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int outputChoice = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool bClipToRec709 = false, int upscaleFilterForDisplay = 1); ///< write one upsaled YUV frame + const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, + int outputChoice = 0, ChromaFormat format = NUM_CHROMA_FORMAT, + const bool clipToRec709 = false, + int upscaleFilterForDisplay = 1); ///< write one upsaled YUV frame #endif