Commit b19169a1 authored by Karsten Suehring's avatar Karsten Suehring

Merge branch 'JVET-O0288' into 'master'

JVET-O0288: remove slice type dependency in ALF

See merge request jvet/VVCSoftware_VTM!663
parents fe65302c 1d805b83
Pipeline #1862 passed with stage
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
#include <assert.h> #include <assert.h>
#include <cassert> #include <cassert>
#define JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL 1 // JVET-O0288: remove slice type dependency in ALF
#define JVET_O0064_SIMP_ALF_CLIP_CODING 1 // JVET-O0047/O0058/O0064/O0067/O0290/O0301/O0430: use FLC for alf clipping indices, always signal alf clipping indices #define JVET_O0064_SIMP_ALF_CLIP_CODING 1 // JVET-O0047/O0058/O0064/O0067/O0290/O0301/O0430: use FLC for alf clipping indices, always signal alf clipping indices
#define JVET_O0669_REMOVE_ALF_COEFF_PRED 1 // JVET-O0425/O0427/O0669: remove prediction in ALF coefficients coding #define JVET_O0669_REMOVE_ALF_COEFF_PRED 1 // JVET-O0425/O0427/O0669: remove prediction in ALF coefficients coding
......
...@@ -1810,6 +1810,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para ...@@ -1810,6 +1810,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
int alfChromaIdc = 0; int alfChromaIdc = 0;
if (uiCode) if (uiCode)
{ {
#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL
xReadTruncBinCode(uiCode, ALF_CTB_MAX_NUM_APS + 1);
#else
if (pcSlice->isIntra()) if (pcSlice->isIntra())
{ {
READ_FLAG(uiCode, "tile_group_num_APS"); READ_FLAG(uiCode, "tile_group_num_APS");
...@@ -1818,6 +1821,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para ...@@ -1818,6 +1821,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
{ {
xReadTruncBinCode(uiCode, ALF_CTB_MAX_NUM_APS + 1); xReadTruncBinCode(uiCode, ALF_CTB_MAX_NUM_APS + 1);
} }
#endif
int numAps = uiCode; int numAps = uiCode;
pcSlice->setTileGroupNumAps(numAps); pcSlice->setTileGroupNumAps(numAps);
std::vector<int> apsId(numAps, -1); std::vector<int> apsId(numAps, -1);
...@@ -1832,6 +1836,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para ...@@ -1832,6 +1836,9 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
alfChromaIdc = truncatedUnaryEqProb(3); //alf_chroma_idc alfChromaIdc = truncatedUnaryEqProb(3); //alf_chroma_idc
if (alfChromaIdc) if (alfChromaIdc)
{ {
#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL
READ_CODE(5, uiCode, "tile_group_aps_id_chroma");
#else
if (pcSlice->isIntra() && pcSlice->getTileGroupNumAps() == 1) if (pcSlice->isIntra() && pcSlice->getTileGroupNumAps() == 1)
{ {
uiCode = apsId[0]; uiCode = apsId[0];
...@@ -1840,6 +1847,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para ...@@ -1840,6 +1847,7 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
{ {
READ_CODE(5, uiCode, "tile_group_aps_id_chroma"); READ_CODE(5, uiCode, "tile_group_aps_id_chroma");
} }
#endif
pcSlice->setTileGroupApsIdChroma(uiCode); pcSlice->setTileGroupApsIdChroma(uiCode);
} }
} }
......
...@@ -2758,7 +2758,11 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfSliceParam& a ...@@ -2758,7 +2758,11 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfSliceParam& a
curCost += costOff; curCost += costOff;
} }
} //for(ctbIdx) } //for(ctbIdx)
#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL
int tmpBits = bitsNewFilter + 5 * (numFilterSet - NUM_FIXED_FILTER_SETS) + getTBlength(numFilterSet - NUM_FIXED_FILTER_SETS, ALF_CTB_MAX_NUM_APS + 1);
#else
int tmpBits = bitsNewFilter + 5 * (numFilterSet - NUM_FIXED_FILTER_SETS) + (cs.slice->isIntra() ? 1 : getTBlength(numFilterSet - NUM_FIXED_FILTER_SETS, ALF_CTB_MAX_NUM_APS + 1)); int tmpBits = bitsNewFilter + 5 * (numFilterSet - NUM_FIXED_FILTER_SETS) + (cs.slice->isIntra() ? 1 : getTBlength(numFilterSet - NUM_FIXED_FILTER_SETS, ALF_CTB_MAX_NUM_APS + 1));
#endif
curCost += tmpBits * m_lambda[COMPONENT_Y]; curCost += tmpBits * m_lambda[COMPONENT_Y];
if (curCost < costMin) if (curCost < costMin)
{ {
...@@ -2863,7 +2867,11 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfSliceParam& a ...@@ -2863,7 +2867,11 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfSliceParam& a
continue; continue;
} }
APS* curAPS = m_apsMap->getPS((curApsId << NUM_APS_TYPE_LEN) + ALF_APS); APS* curAPS = m_apsMap->getPS((curApsId << NUM_APS_TYPE_LEN) + ALF_APS);
#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL
double curCost = m_lambda[CHANNEL_TYPE_CHROMA] * 5;
#else
double curCost = (cs.slice->isIntra() && cs.slice->getTileGroupNumAps() == 1) ? 0 : (m_lambda[CHANNEL_TYPE_CHROMA] * 5); double curCost = (cs.slice->isIntra() && cs.slice->getTileGroupNumAps() == 1) ? 0 : (m_lambda[CHANNEL_TYPE_CHROMA] * 5);
#endif
if (curApsId == newApsIdChroma) if (curApsId == newApsIdChroma)
{ {
m_alfSliceParamTemp = alfSliceParamNewFilters; m_alfSliceParamTemp = alfSliceParamNewFilters;
......
...@@ -1261,7 +1261,9 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) ...@@ -1261,7 +1261,9 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice )
if (alfEnabled) if (alfEnabled)
{ {
#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL
xWriteTruncBinCode(pcSlice->getTileGroupNumAps(), ALF_CTB_MAX_NUM_APS + 1);
#else
if (pcSlice->isIntra()) if (pcSlice->isIntra())
{ {
WRITE_FLAG(pcSlice->getTileGroupNumAps(), "tile_group_num_APS"); WRITE_FLAG(pcSlice->getTileGroupNumAps(), "tile_group_num_APS");
...@@ -1270,7 +1272,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) ...@@ -1270,7 +1272,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice )
{ {
xWriteTruncBinCode(pcSlice->getTileGroupNumAps(), ALF_CTB_MAX_NUM_APS + 1); xWriteTruncBinCode(pcSlice->getTileGroupNumAps(), ALF_CTB_MAX_NUM_APS + 1);
} }
#endif
const std::vector<int>& apsId = pcSlice->getTileGroupApsIdLuma(); const std::vector<int>& apsId = pcSlice->getTileGroupApsIdLuma();
for (int i = 0; i < pcSlice->getTileGroupNumAps(); i++) for (int i = 0; i < pcSlice->getTileGroupNumAps(); i++)
{ {
...@@ -1281,6 +1283,9 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) ...@@ -1281,6 +1283,9 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice )
truncatedUnaryEqProb(alfChromaIdc, 3); // alf_chroma_idc truncatedUnaryEqProb(alfChromaIdc, 3); // alf_chroma_idc
if (alfChromaIdc) if (alfChromaIdc)
{ {
#if JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL
WRITE_CODE(pcSlice->getTileGroupApsIdChroma(), 5, "tile_group_aps_id_chroma");
#else
if (pcSlice->isIntra()&& pcSlice->getTileGroupNumAps() == 1) if (pcSlice->isIntra()&& pcSlice->getTileGroupNumAps() == 1)
{ {
CHECK(pcSlice->getTileGroupApsIdChroma() != apsId[0], "wrong tile group chroma aps id"); CHECK(pcSlice->getTileGroupApsIdChroma() != apsId[0], "wrong tile group chroma aps id");
...@@ -1289,6 +1294,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice ) ...@@ -1289,6 +1294,7 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice )
{ {
WRITE_CODE(pcSlice->getTileGroupApsIdChroma(), 5, "tile_group_aps_id_chroma"); WRITE_CODE(pcSlice->getTileGroupApsIdChroma(), 5, "tile_group_aps_id_chroma");
} }
#endif
} }
} }
} }
......
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