...
 
Commits (3)
......@@ -600,6 +600,9 @@ void DecApp::xCreateDecLib()
std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout;
m_cDecLib.setDecodedSEIMessageOutputStream(&os);
}
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
m_cDecLib.initScalingList();
#endif
}
void DecApp::xDestroyDecLib()
......
......@@ -942,16 +942,69 @@ void Quant::processScalingListEnc( int *coeff, int *quantcoeff, int quantScales,
}
}
/** set quantized matrix coefficient for decode
* \param coeff quantaized matrix address
* \param dequantcoeff quantaized matrix address
* \param invQuantScales IQ(QP%6))
* \param height height
* \param width width
* \param ratio ratio for upscale
* \param sizuNum matrix size
* \param dc dc parameter
*/
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
void Quant::processScalingListDec( const int *coeff, int *dequantcoeff, int invQuantScales, uint32_t height, uint32_t width, uint32_t ratio, int sizeNum, uint32_t dc)
{
if (height != width)
{
int ratioWH = (height > width ) ? (height / width ) : (width / height);
int ratioH = (height / sizeNum) ? (height / sizeNum) : (sizeNum / height);
int ratioW = (width / sizeNum) ? (width / sizeNum) : (sizeNum / width );
if (height > width)
{
for (uint32_t j = 0; j < height; j++)
{
int coeffLineSep = (j / ratioH) * sizeNum;
int dequantCoeffLineSep = j * width;
for (uint32_t i = 0; i < width; i++)
{
if (i >= JVET_C0024_ZERO_OUT_TH || j >= JVET_C0024_ZERO_OUT_TH)
{
dequantcoeff[dequantCoeffLineSep + i] = 0;
continue;
}
dequantcoeff[dequantCoeffLineSep + i] = invQuantScales * coeff[coeffLineSep + ((i * ratioWH) / ratioH)];
}
}
}
else //ratioH < ratioW
{
for (uint32_t j = 0; j < height; j++)
{
int coeffLineSep = ((j * ratioWH) / ratioW) * sizeNum;
int dequantCoeffLineSep = j * width;
for (uint32_t i = 0; i < width; i++)
{
if (i >= JVET_C0024_ZERO_OUT_TH || j >= JVET_C0024_ZERO_OUT_TH)
{
dequantcoeff[dequantCoeffLineSep + i] = 0;
continue;
}
dequantcoeff[dequantCoeffLineSep + i] = invQuantScales * coeff[coeffLineSep + (i / ratioW)];
}
}
}
int largeOne = (width > height) ? width : height;
if (largeOne > 8)
dequantcoeff[0] = invQuantScales * dc;
return;
}
for (uint32_t j = 0; j<height; j++)
{
int coeffLineSep = (j / ratio) * sizeNum;
int dequantCoeffLineSep = j * width;
for (uint32_t i = 0; i<width; i++)
{
dequantcoeff[dequantCoeffLineSep + i] = invQuantScales * coeff[coeffLineSep + i / ratio];
}
}
if (ratio > 1)
{
dequantcoeff[0] = invQuantScales * dc;
}
}
#else
void Quant::processScalingListDec( const int *coeff, int *dequantcoeff, int invQuantScales, uint32_t height, uint32_t width, uint32_t ratio, int sizuNum, uint32_t dc)
{
if (height != width)
......@@ -997,6 +1050,7 @@ void Quant::processScalingListDec( const int *coeff, int *dequantcoeff, int invQ
dequantcoeff[0] = invQuantScales * dc;
}
}
#endif
/** initialization process of scaling list array
*/
......
......@@ -53,6 +53,8 @@
#define JVET_P1038_ALF_PAD_RASTER_SLICE 1 // JVET-P1038, handle ALF padding in raster scan slice
#define JVET_P0257_SCALING_LISTS_SPEEDUP_DEC 1 // JVET-P0257: Decoder speed-up for handling scaling matrices
#define JVET_P2001_REMOVE_TRANSQUANT_BYPASS 1 // JVET-P2001: Remove transquant bypass - not supported in JVET-P2001 draft text
#define JVET_P2001_SYNTAX_ORDER_MISMATCHES 1 // JVET-P2001: Rearrange SPS/PPS syntax to match JVET-P2001 draft text
......
......@@ -388,6 +388,9 @@ DecLib::DecLib()
, m_cInterPred()
, m_cTrQuant()
, m_cSliceDecoder()
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
, m_cTrQuantScalingList()
#endif
, m_cCuDecoder()
, m_HLSReader()
, m_seiReader()
......@@ -422,6 +425,10 @@ DecLib::DecLib()
#if JVET_N0278_FIXES
, m_vps( nullptr )
#endif
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
, m_scalingListUpdateFlag(true)
, m_PreScalingListAPSId(-1)
#endif
{
#if ENABLE_SIMD_OPT_BUFFER
g_pelBufOP.initPelBufOpsX86();
......@@ -1177,7 +1184,11 @@ void DecLib::xActivateParameterSets()
{
m_cCuDecoder.initDecCuReshaper(&m_cReshaper, sps->getChromaFormatIdc());
}
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
m_cTrQuant.init(m_cTrQuantScalingList.getQuant(), sps->getMaxTbSize(), false, false, false, false);
#else
m_cTrQuant.init( nullptr, sps->getMaxTbSize(), false, false, false, false );
#endif
// RdCost
m_cRdCost.setCostMode ( COST_STANDARD_LOSSY ); // not used in decoder side RdCost stuff -> set to default
......@@ -1829,7 +1840,17 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
{
scalingList.setDefaultScalingList();
}
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
int scalingListAPSId = pcSlice->getPicHeader()->getScalingListAPSId();
if (getScalingListUpdateFlag() || (scalingListAPSId != getPreScalingListAPSId()))
{
quant->setScalingListDec(scalingList);
setScalingListUpdateFlag(false);
setPreScalingListAPSId(scalingListAPSId);
}
#else
quant->setScalingListDec( scalingList );
#endif
quant->setUseScalingList( true );
}
else
......@@ -2000,6 +2021,12 @@ void DecLib::xDecodeAPS(InputNALUnit& nalu)
aps->setLayerId( nalu.m_nuhLayerId );
m_parameterSetManager.checkAuApsContent( aps, m_accessUnitApsNals );
m_parameterSetManager.storeAPS(aps, nalu.getBitstream().getFifo());
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
if (aps->getAPSType() == SCALING_LIST_APS)
{
setScalingListUpdateFlag(true);
}
#endif
}
bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay)
{
......
......@@ -92,6 +92,9 @@ private:
InterPrediction m_cInterPred;
TrQuant m_cTrQuant;
DecSlice m_cSliceDecoder;
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
TrQuant m_cTrQuantScalingList;
#endif
DecCu m_cCuDecoder;
HLSyntaxReader m_HLSReader;
CABACDecoder m_CABACDecoder;
......@@ -140,6 +143,10 @@ private:
#if JVET_N0278_FIXES
VPS* m_vps;
#endif
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
bool m_scalingListUpdateFlag;
int m_PreScalingListAPSId;
#endif
public:
DecLib();
......@@ -191,6 +198,16 @@ public:
#if JVET_N0278_FIXES
const VPS* getVPS() { return m_vps; }
#endif
#if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC
void initScalingList()
{
m_cTrQuantScalingList.init(nullptr, MAX_TB_SIZEY, false, false, false, false);
}
bool getScalingListUpdateFlag() { return m_scalingListUpdateFlag; }
void setScalingListUpdateFlag(bool b) { m_scalingListUpdateFlag = b; }
int getPreScalingListAPSId() { return m_PreScalingListAPSId; }
void setPreScalingListAPSId(int id) { m_PreScalingListAPSId = id; }
#endif
protected:
void xUpdateRasInit(Slice* slice);
......