Commit ec897cb1 authored by Xiang Li's avatar Xiang Li

Merge branch 'hex-psnr' into 'master'

Output average PSNR in hexadecimal

See merge request !85
parents 1ca7f9ec bdaf83f0
Pipeline #59 passed with stage
......@@ -45,6 +45,7 @@
#include <stdio.h>
#include <memory.h>
#include <assert.h>
#include <cinttypes>
#include "CommonLib/CommonDef.h"
#include "CommonLib/ChromaFormat.h"
#include "math.h"
......@@ -181,11 +182,10 @@ public:
PSNRyuv = (MSEyuv == 0) ? 999.99 : 10.0 * log10((maxval * maxval) / MSEyuv);
}
#if ENABLE_QPA || WCG_WPSNR
void printOut ( char cDelim, const ChromaFormat chFmt, const bool printMSEBasedSNR, const bool printSequenceMSE, const BitDepths &bitDepths, const bool useWPSNR = false )
void printOut ( char cDelim, const ChromaFormat chFmt, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const BitDepths &bitDepths, const bool useWPSNR = false )
#else
void printOut ( char cDelim, const ChromaFormat chFmt, const bool printMSEBasedSNR, const bool printSequenceMSE, const BitDepths &bitDepths )
void printOut ( char cDelim, const ChromaFormat chFmt, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const BitDepths &bitDepths )
#endif
{
#if !WCG_WPSNR
......@@ -234,6 +234,11 @@ public:
#endif
msg( e_msg_level, " \tTotal Frames | " "Bitrate " "Y-PSNR" );
if (printHexPsnr)
{
msg(e_msg_level, "xY-PSNR ");
}
if (printSequenceMSE)
{
msg( e_msg_level, " Y-MSE\n" );
......@@ -252,6 +257,19 @@ public:
#endif
getPsnr(COMPONENT_Y) / (double)getNumPic() );
if (printHexPsnr)
{
double dPsnr;
uint64_t xPsnr;
dPsnr = getPsnr(COMPONENT_Y) / (double)getNumPic();
copy(reinterpret_cast<uint8_t *>(&dPsnr),
reinterpret_cast<uint8_t *>(&dPsnr) + sizeof(dPsnr),
reinterpret_cast<uint8_t *>(&xPsnr));
msg(e_msg_level, " %16" PRIx64 " ", xPsnr);
}
if (printSequenceMSE)
{
msg( e_msg_level, " %8.4lf\n", m_MSEyuvframe[COMPONENT_Y] / (double)getNumPic() );
......@@ -275,6 +293,11 @@ public:
#endif
msg( e_msg_level, "\tTotal Frames | " "Bitrate " "Y-PSNR" );
if (printHexPsnr)
{
msg(e_msg_level, "xY-PSNR ");
}
if (printSequenceMSE)
{
msg( e_msg_level, " Y-MSE\n" );
......@@ -293,6 +316,19 @@ public:
#endif
getPsnr(COMPONENT_Y) / (double)getNumPic() );
if (printHexPsnr)
{
double dPsnr;
uint64_t xPsnr;
dPsnr = getPsnr(COMPONENT_Y) / (double)getNumPic();
copy(reinterpret_cast<uint8_t *>(&dPsnr),
reinterpret_cast<uint8_t *>(&dPsnr) + sizeof(dPsnr),
reinterpret_cast<uint8_t *>(&xPsnr));
msg(e_msg_level, " %16" PRIx64 " ", xPsnr);
}
if (printSequenceMSE)
{
msg( e_msg_level, " %8.4lf\n", m_MSEyuvframe[COMPONENT_Y] / (double)getNumPic() );
......@@ -321,6 +357,11 @@ public:
#endif
msg( e_msg_level, " \tTotal Frames | " "Bitrate " "Y-PSNR " "U-PSNR " "V-PSNR " "YUV-PSNR " );
if (printHexPsnr)
{
msg(e_msg_level, "xY-PSNR " "xU-PSNR " "xV-PSNR ");
}
if (printSequenceMSE)
{
msg( e_msg_level, " Y-MSE " "U-MSE " "V-MSE " "YUV-MSE \n" );
......@@ -348,6 +389,21 @@ public:
getPsnr(COMPONENT_Cr) / (double)getNumPic(),
PSNRyuv );
if (printHexPsnr)
{
double dPsnr[MAX_NUM_COMPONENT];
uint64_t xPsnr[MAX_NUM_COMPONENT];
for (int i = 0; i < MAX_NUM_COMPONENT; i++)
{
dPsnr[i] = getPsnr((ComponentID)i) / (double)getNumPic();
copy(reinterpret_cast<uint8_t *>(&dPsnr[i]),
reinterpret_cast<uint8_t *>(&dPsnr[i]) + sizeof(dPsnr[i]),
reinterpret_cast<uint8_t *>(&xPsnr[i]));
}
msg(e_msg_level, " %16" PRIx64 " %16" PRIx64 " %16" PRIx64, xPsnr[COMPONENT_Y], xPsnr[COMPONENT_Cb], xPsnr[COMPONENT_Cr]);
}
if (printSequenceMSE)
{
msg( e_msg_level, " %8.4lf " "%8.4lf " "%8.4lf " "%8.4lf\n",
......@@ -381,6 +437,11 @@ public:
m_ext360.printHeader(e_msg_level);
#endif
if (printHexPsnr)
{
msg(e_msg_level, "xY-PSNR " "xU-PSNR " "xV-PSNR ");
}
if (printSequenceMSE)
{
msg( e_msg_level, " Y-MSE " "U-MSE " "V-MSE " "YUV-MSE \n" );
......@@ -408,6 +469,21 @@ public:
getPsnr(COMPONENT_Cr) / (double)getNumPic(),
PSNRyuv );
if (printHexPsnr)
{
double dPsnr[MAX_NUM_COMPONENT];
uint64_t xPsnr[MAX_NUM_COMPONENT];
for (int i = 0; i < MAX_NUM_COMPONENT; i++)
{
dPsnr[i] = getPsnr((ComponentID)i) / (double)getNumPic();
copy(reinterpret_cast<uint8_t *>(&dPsnr[i]),
reinterpret_cast<uint8_t *>(&dPsnr[i]) + sizeof(dPsnr[i]),
reinterpret_cast<uint8_t *>(&xPsnr[i]));
}
msg(e_msg_level, " %16" PRIx64 " %16" PRIx64 " %16" PRIx64 , xPsnr[COMPONENT_Y], xPsnr[COMPONENT_Cb], xPsnr[COMPONENT_Cr]);
}
#if EXTENSION_360_VIDEO
m_ext360.printPSNRs(getNumPic(), e_msg_level);
#endif
......@@ -435,7 +511,7 @@ public:
}
void printSummary(const ChromaFormat chFmt, const bool printSequenceMSE, const BitDepths &bitDepths, const std::string &sFilename)
void printSummary(const ChromaFormat chFmt, const bool printSequenceMSE, const bool printHexPsnr, const BitDepths &bitDepths, const std::string &sFilename)
{
FILE* pFile = fopen (sFilename.c_str(), "at");
......
......@@ -2802,7 +2802,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
}
void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const BitDepths &bitDepths)
void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const BitDepths &bitDepths)
{
#if ENABLE_QPA
const bool useWPSNR = m_pcEncLib->getUseWPSNR();
......@@ -2835,19 +2835,19 @@ void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool
msg( INFO, "\n" );
msg( DETAILS,"\nSUMMARY --------------------------------------------------------\n" );
#if ENABLE_QPA
m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths, useWPSNR);
m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths, useWPSNR);
#else
m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
m_gcAnalyzeAll.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths);
#endif
msg( DETAILS,"\n\nI Slices--------------------------------------------------------\n" );
m_gcAnalyzeI.printOut('i', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
m_gcAnalyzeI.printOut('i', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths);
msg( DETAILS,"\n\nP Slices--------------------------------------------------------\n" );
m_gcAnalyzeP.printOut('p', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
m_gcAnalyzeP.printOut('p', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths);
msg( DETAILS,"\n\nB Slices--------------------------------------------------------\n" );
m_gcAnalyzeB.printOut('b', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
m_gcAnalyzeB.printOut('b', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths);
#if WCG_WPSNR
if (useLumaWPSNR)
{
......@@ -2857,14 +2857,14 @@ void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool
#endif
if (!m_pcCfg->getSummaryOutFilename().empty())
{
m_gcAnalyzeAll.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryOutFilename());
m_gcAnalyzeAll.printSummary(chFmt, printSequenceMSE, printHexPsnr, bitDepths, m_pcCfg->getSummaryOutFilename());
}
if (!m_pcCfg->getSummaryPicFilenameBase().empty())
{
m_gcAnalyzeI.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryPicFilenameBase()+"I.txt");
m_gcAnalyzeP.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryPicFilenameBase()+"P.txt");
m_gcAnalyzeB.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryPicFilenameBase()+"B.txt");
m_gcAnalyzeI.printSummary(chFmt, printSequenceMSE, printHexPsnr, bitDepths, m_pcCfg->getSummaryPicFilenameBase()+"I.txt");
m_gcAnalyzeP.printSummary(chFmt, printSequenceMSE, printHexPsnr, bitDepths, m_pcCfg->getSummaryPicFilenameBase()+"P.txt");
m_gcAnalyzeB.printSummary(chFmt, printSequenceMSE, printHexPsnr, bitDepths, m_pcCfg->getSummaryPicFilenameBase()+"B.txt");
}
#if WCG_WPSNR
......@@ -2882,13 +2882,13 @@ void EncGOP::printOutSummary(uint32_t uiNumAllPicCoded, bool isField, const bool
msg( DETAILS,"\n\nSUMMARY INTERLACED ---------------------------------------------\n" );
#if ENABLE_QPA
m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths, useWPSNR);
m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths, useWPSNR);
#else
m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, bitDepths);
m_gcAnalyzeAll_in.printOut('a', chFmt, printMSEBasedSNR, printSequenceMSE, printHexPsnr, bitDepths);
#endif
if (!m_pcCfg->getSummaryOutFilename().empty())
{
m_gcAnalyzeAll_in.printSummary(chFmt, printSequenceMSE, bitDepths, m_pcCfg->getSummaryOutFilename());
m_gcAnalyzeAll_in.printSummary(chFmt, printSequenceMSE, printHexPsnr, bitDepths, m_pcCfg->getSummaryOutFilename());
#if WCG_WPSNR
if (useLumaWPSNR)
{
......
......@@ -210,7 +210,7 @@ public:
int getLastLTRefPoc() const { return m_lastLTRefPoc; }
#endif
void printOutSummary ( uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const BitDepths &bitDepths );
void printOutSummary ( uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const BitDepths &bitDepths );
#if W0038_DB_OPT
uint64_t preLoopFilterPicAndCalcDist( Picture* pcPic );
#endif
......
......@@ -269,7 +269,7 @@ public:
int& iNumEncoded, bool isTff );
void printSummary(bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_spsMap.getFirstPS()->getBitDepths()); }
void printSummary(bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_printHexPsnr, m_spsMap.getFirstPS()->getBitDepths()); }
};
......
Markdown is supported
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