Commit 8fd17769 authored by Tomonori Hashimoto's avatar Tomonori Hashimoto
Browse files

printout wPSNR for hbd ctc

parent a1b6cab2
......@@ -25,3 +25,5 @@ VerCollocatedChroma : 1
#======== HDR Metrics ============
CalculateHdrMetrics : 1 # Calculate HDR metrics for Class H1 (PQ) content
PrintWPSNR : 1
\ No newline at end of file
......@@ -250,6 +250,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setPrintHexPsnr(m_printHexPsnr);
m_cEncLib.setPrintSequenceMSE ( m_printSequenceMSE);
m_cEncLib.setPrintMSSSIM ( m_printMSSSIM );
#if PRINT_WPSNR
m_cEncLib.setPrintWPSNR ( m_printWPSNR );
#endif
m_cEncLib.setCabacZeroWordPaddingEnabled ( m_cabacZeroWordPaddingEnabled );
m_cEncLib.setFrameRate ( m_iFrameRate );
......
......@@ -728,6 +728,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("PrintFrameMSE", m_printFrameMSE, false, "0 (default) emit only bit count and PSNRs for each frame, 1 = also emit MSE values")
("PrintSequenceMSE", m_printSequenceMSE, false, "0 (default) emit only bit rate and PSNRs for the whole sequence, 1 = also emit MSE values")
("PrintMSSSIM", m_printMSSSIM, false, "0 (default) do not print MS-SSIM scores, 1 = print MS-SSIM scores for each frame and for the whole sequence")
#if PRINT_WPSNR
("PrintWPSNR", m_printWPSNR, false, "0 (default) do not print HDR-PQ based wPSNR, 1 = print HDR-PQ based wPSNR")
#endif
("CabacZeroWordPaddingEnabled", m_cabacZeroWordPaddingEnabled, true, "0 do not add conforming cabac-zero-words to bit streams, 1 (default) = add cabac-zero-words as required")
("ChromaFormatIDC,-cf", tmpChromaFormat, 0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
("ConformanceMode", m_conformanceWindowMode, 0, "Deprecated alias of ConformanceWindowMode")
......
......@@ -127,6 +127,9 @@ protected:
bool m_printFrameMSE;
bool m_printSequenceMSE;
bool m_printMSSSIM;
#if PRINT_WPSNR
bool m_printWPSNR;
#endif
bool m_cabacZeroWordPaddingEnabled;
bool m_bClipInputVideoToRec709Range;
bool m_bClipOutputVideoToRec709Range;
......
......@@ -2950,11 +2950,28 @@ void RdCost::saveUnadjustedLambda()
m_DistScaleUnadjusted = m_DistScale;
}
#if PRINT_WPSNR
void RdCost::initLumaLevelToWeightTable(int bitDepth)
#else
void RdCost::initLumaLevelToWeightTable()
#endif
{
#if PRINT_WPSNR
int lutSize = 1 << bitDepth;
if (m_lumaLevelToWeightPLUT.empty())
{
m_lumaLevelToWeightPLUT.resize(lutSize, 1.0);
}
for (int i = 0; i < lutSize; i++)
#else
for (int i = 0; i < LUMA_LEVEL_TO_DQP_LUT_MAXSIZE; i++)
#endif
{
#if PRINT_WPSNR
double x = bitDepth < 10 ? i << (10 - bitDepth) : bitDepth > 10 ? i >> (bitDepth - 10) : i;
#else
double x = i;
#endif
double y;
y = 0.015 * x - 1.5
......
......@@ -315,7 +315,11 @@ public:
uint32_t getBitsOfVectorWithPredictor( const int x, const int y, const unsigned imvShift ) { return xGetExpGolombNumberOfBits(((x << m_iCostScale) - m_mvPredictor.getHor())>>imvShift) + xGetExpGolombNumberOfBits(((y << m_iCostScale) - m_mvPredictor.getVer())>>imvShift); }
#if WCG_EXT
void saveUnadjustedLambda ();
#if PRINT_WPSNR
void initLumaLevelToWeightTable (int bitDepth);
#else
void initLumaLevelToWeightTable ();
#endif
inline double getWPSNRLumaLevelWeight (int val) { return m_lumaLevelToWeightPLUT[val]; }
void initLumaLevelToWeightTableReshape();
void updateReshapeLumaLevelToWeightTableChromaMD (std::vector<Pel>& ILUT);
......
......@@ -50,6 +50,10 @@
#include <assert.h>
#include <cassert>
#define PRINT_WPSNR 1
// clang-format off
#define JVET_U0081 1 // ALF filter strength target
......
......@@ -174,6 +174,9 @@ protected:
bool m_printFrameMSE;
bool m_printSequenceMSE;
bool m_printMSSSIM;
#if PRINT_WPSNR
bool m_printWPSNR;
#endif
bool m_cabacZeroWordPaddingEnabled;
bool m_gciPresentFlag;
......@@ -935,6 +938,11 @@ public:
bool getPrintMSSSIM () const { return m_printMSSSIM; }
void setPrintMSSSIM (bool value) { m_printMSSSIM = value; }
#if PRINT_WPSNR
bool getPrintWPSNR () const { return m_printWPSNR; }
void setPrintWPSNR (bool value) { m_printWPSNR = value; }
#endif
bool getCabacZeroWordPaddingEnabled() const { return m_cabacZeroWordPaddingEnabled; }
void setCabacZeroWordPaddingEnabled(bool value) { m_cabacZeroWordPaddingEnabled = value; }
......
......@@ -231,6 +231,12 @@ void EncGOP::init ( EncLib* pcEncLib )
pcEncLib->getRdCost()->setReshapeInfo(RESHAPE_SIGNAL_PQ, m_pcCfg->getBitDepth(CHANNEL_TYPE_LUMA));
pcEncLib->getRdCost()->initLumaLevelToWeightTableReshape();
}
#if PRINT_WPSNR
else if (m_pcCfg->getPrintWPSNR())
{
pcEncLib->getRdCost()->initLumaLevelToWeightTable(m_pcCfg->getBitDepth(CHANNEL_TYPE_LUMA));
}
#endif
pcEncLib->getALF()->getLumaLevelWeightTable() = pcEncLib->getRdCost()->getLumaLevelWeightTable();
int alfWSSD = 0;
if (m_pcCfg->getLmcs() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ )
......@@ -3679,7 +3685,11 @@ void EncGOP::printOutSummary( uint32_t uiNumAllPicCoded, bool isField, const boo
const bool useWPSNR = m_pcEncLib->getUseWPSNR();
#endif
#if WCG_WPSNR
#if PRINT_WPSNR
const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcCfg->getLmcs() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ) || m_pcEncLib->getPrintWPSNR();
#else
const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcCfg->getLmcs() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ);
#endif
#endif
if( m_pcCfg->getDecodeBitstream(0).empty() && m_pcCfg->getDecodeBitstream(1).empty() && !m_pcCfg->useFastForwardToPOC() )
......@@ -4039,7 +4049,11 @@ uint64_t EncGOP::xFindDistortionPlane(const CPelBuf& pic0, const CPelBuf& pic1,
double EncGOP::xFindDistortionPlaneWPSNR(const CPelBuf& pic0, const CPelBuf& pic1, const uint32_t rshift, const CPelBuf& picLuma0,
ComponentID compID, const ChromaFormat chfmt )
{
#if PRINT_WPSNR
const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcCfg->getLmcs() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ) || m_pcEncLib->getPrintWPSNR();
#else
const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcCfg->getLmcs() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ);
#endif
if (!useLumaWPSNR)
{
return 0;
......@@ -4178,7 +4192,11 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni
double dPSNR[MAX_NUM_COMPONENT];
double msssim[MAX_NUM_COMPONENT] = {0.0};
#if WCG_WPSNR
#if PRINT_WPSNR
const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcCfg->getLmcs() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ) || m_pcEncLib->getPrintWPSNR();
#else
const bool useLumaWPSNR = m_pcEncLib->getLumaLevelToDeltaQPMapping().isEnabled() || (m_pcCfg->getLmcs() && m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_PQ);
#endif
double dPSNRWeighted[MAX_NUM_COMPONENT];
double MSEyuvframeWeighted[MAX_NUM_COMPONENT];
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment