Commit 7cd5500c authored by Antti Hallapuro's avatar Antti Hallapuro
Browse files

Add support for pps_single_slice_per_subpic_flag in subpicMergeApp

parent 77c473d3
...@@ -535,25 +535,59 @@ void SubpicMergeApp::getTileDimensions(std::vector<int> &tileWidths, std::vector ...@@ -535,25 +535,59 @@ void SubpicMergeApp::getTileDimensions(std::vector<int> &tileWidths, std::vector
std::vector<int> tileX; std::vector<int> tileX;
std::vector<int> tileY; std::vector<int> tileY;
// Add subpicture boundaries as tile boundaries
for (auto &subpic : *m_subpics)
{
bool addTileXForCurrentSubpic = true;
bool addTileYForCurrentSubpic = true;
// Check if current subpic boundary need to be added as tile boundary
for (auto &subpicScan : *m_subpics)
{
if (subpic.topLeftCornerX >= subpicScan.topLeftCornerX && (subpic.topLeftCornerX + subpic.width) <= (subpicScan.topLeftCornerX + subpicScan.width) && subpic.width < subpicScan.width)
{
addTileXForCurrentSubpic = false;
}
if (subpic.topLeftCornerY >= subpicScan.topLeftCornerY && (subpic.topLeftCornerY + subpic.height) <= (subpicScan.topLeftCornerY + subpicScan.height) && subpic.height < subpicScan.height)
{
addTileYForCurrentSubpic = false;
}
}
if (addTileXForCurrentSubpic)
{
tileX.push_back(subpic.topLeftCornerX);
}
if (addTileYForCurrentSubpic)
{
tileY.push_back(subpic.topLeftCornerY);
}
}
// Add tile boundaries from tiles within subpictures
for (auto &subpic : *m_subpics) for (auto &subpic : *m_subpics)
{ {
tileX.push_back(subpic.topLeftCornerX);
tileY.push_back(subpic.topLeftCornerY);
const PPS &pps = *subpic.slices[0].getPPS(); const PPS &pps = *subpic.slices[0].getPPS();
if (!pps.getNoPicPartitionFlag()) if (!pps.getNoPicPartitionFlag())
{ {
int x = subpic.topLeftCornerX; if (pps.getNumTileColumns() > 1)
for (int i = 0; i < pps.getNumTileColumns(); i++)
{ {
x += pps.getTileColumnWidth(i) * pps.getCtuSize(); int x = subpic.topLeftCornerX;
tileX.push_back(x); for (int i = 0; i < pps.getNumTileColumns(); i++)
{
x += pps.getTileColumnWidth(i) * pps.getCtuSize();
tileX.push_back(x);
}
} }
int y = subpic.topLeftCornerY; if (pps.getNumTileRows() > 1)
for (int i = 0; i < pps.getNumTileRows(); i++)
{ {
y += pps.getTileRowHeight(i) * pps.getCtuSize(); int y = subpic.topLeftCornerY;
tileY.push_back(y); for (int i = 0; i < pps.getNumTileRows(); i++)
{
y += pps.getTileRowHeight(i) * pps.getCtuSize();
tileY.push_back(y);
}
} }
} }
} }
...@@ -642,52 +676,82 @@ void SubpicMergeApp::generateMergedStreamPPSes(ParameterSetManager &psManager, s ...@@ -642,52 +676,82 @@ void SubpicMergeApp::generateMergedStreamPPSes(ParameterSetManager &psManager, s
pps.setTileIdxDeltaPresentFlag(true); pps.setTileIdxDeltaPresentFlag(true);
pps.initRectSlices( ); pps.initRectSlices( );
unsigned int numTileColsInPic = pps.getNumTileColumns(); pps.setSingleSlicePerSubPicFlag(true);
unsigned int sliceIdx = 0;
for (auto &subpic : *m_subpics) for (auto &subpic : *m_subpics)
{ {
unsigned int tileIdxY = 0; const PPS &subpicPPS = *subpic.slices[0].getPPS();
for (unsigned int tileY = 0; tileY != subpic.topLeftCornerY && tileIdxY < tileHeights.size(); tileIdxY++) if (subpicPPS.getNumSlicesInPic() > 1)
{ {
tileY += tileHeights[tileIdxY]; pps.setSingleSlicePerSubPicFlag(false);
break;
} }
CHECK(tileIdxY == tileHeights.size(), "Could not find subpicture to tile border match"); }
if (!pps.getSingleSlicePerSubPicFlag())
{
unsigned int numTileColsInPic = pps.getNumTileColumns();
unsigned int tileIdxX = 0; unsigned int sliceIdx = 0;
for (unsigned int tileX = 0; tileX != subpic.topLeftCornerX && tileIdxX < tileWidths.size(); tileIdxX++) for (auto& subpic : *m_subpics)
{ {
tileX += tileWidths[tileIdxX]; unsigned int tileIdxY = 0;
} for (unsigned int tileY = 0; tileIdxY < tileHeights.size(); tileIdxY++)
CHECK(tileIdxX == tileWidths.size(), "Could not find subpicture to tile border match") {
if (tileY == subpic.topLeftCornerY || (tileY + tileHeights[tileIdxY]) == (subpic.topLeftCornerY + subpic.height) ||
(tileY < subpic.topLeftCornerY && (tileY + tileHeights[tileIdxY]) >(subpic.topLeftCornerY + subpic.height)))
{
break;
}
tileY += tileHeights[tileIdxY];
}
CHECK(tileIdxY == tileHeights.size(), "Could not find subpicture to tile mapping");
const PPS &subpicPPS = *subpic.slices[0].getPPS(); unsigned int tileIdxX = 0;
for (unsigned int tileX = 0; tileIdxX < tileWidths.size(); tileIdxX++)
{
if (tileX == subpic.topLeftCornerX || (tileX + tileWidths[tileIdxX]) == (subpic.topLeftCornerX + subpic.width) ||
(tileX < subpic.topLeftCornerX && (tileX + tileWidths[tileIdxX]) >(subpic.topLeftCornerX + subpic.width)))
{
break;
}
tileX += tileWidths[tileIdxX];
}
CHECK(tileIdxX == tileWidths.size(), "Could not find subpicture to tile mapping")
if (subpicPPS.getNumSlicesInPic() == 1) const PPS& subpicPPS = *subpic.slices[0].getPPS();
{
pps.setSliceWidthInTiles(sliceIdx, subpicPPS.getNumTileColumns()); if (subpicPPS.getNumSlicesInPic() == 1)
pps.setSliceHeightInTiles(sliceIdx, subpicPPS.getNumTileRows());
pps.setNumSlicesInTile(sliceIdx, 1);
unsigned int sliceTileIdx = tileIdxY * numTileColsInPic + tileIdxX;
pps.setSliceTileIdx(sliceIdx, sliceTileIdx);
pps.setSliceHeightInCtu(sliceIdx, subpicPPS.getPicHeightInCtu());
sliceIdx++;
}
else
{
for (int subpicSliceIdx = 0; subpicSliceIdx < subpicPPS.getNumSlicesInPic(); subpicSliceIdx++, sliceIdx++)
{ {
pps.setSliceWidthInTiles(sliceIdx, subpicPPS.getSliceWidthInTiles(subpicSliceIdx)); pps.setSliceWidthInTiles(sliceIdx, subpicPPS.getNumTileColumns());
pps.setSliceHeightInTiles(sliceIdx, subpicPPS.getSliceHeightInTiles(subpicSliceIdx)); pps.setSliceHeightInTiles(sliceIdx, subpicPPS.getNumTileRows());
pps.setNumSlicesInTile(sliceIdx, subpicPPS.getNumSlicesInTile(subpicSliceIdx)); pps.setNumSlicesInTile(sliceIdx, 1);
unsigned int sliceTileIdxSubpic = subpicPPS.getSliceTileIdx(subpicSliceIdx); unsigned int sliceTileIdx = tileIdxY * numTileColsInPic + tileIdxX;
unsigned int sliceTileIdx = (sliceTileIdxSubpic / subpicPPS.getNumTileColumns() + tileIdxY) * numTileColsInPic + tileIdxX + (sliceTileIdxSubpic % subpicPPS.getNumTileColumns());
pps.setSliceTileIdx(sliceIdx, sliceTileIdx); pps.setSliceTileIdx(sliceIdx, sliceTileIdx);
pps.setSliceHeightInCtu(sliceIdx, subpicPPS.getSliceHeightInCtu(subpicSliceIdx)); pps.setSliceHeightInCtu(sliceIdx, subpicPPS.getPicHeightInCtu());
sliceIdx++;
}
else
{
for (int subpicSliceIdx = 0; subpicSliceIdx < subpicPPS.getNumSlicesInPic(); subpicSliceIdx++, sliceIdx++)
{
pps.setSliceWidthInTiles(sliceIdx, subpicPPS.getSliceWidthInTiles(subpicSliceIdx));
pps.setSliceHeightInTiles(sliceIdx, subpicPPS.getSliceHeightInTiles(subpicSliceIdx));
pps.setNumSlicesInTile(sliceIdx, subpicPPS.getNumSlicesInTile(subpicSliceIdx));
unsigned int sliceTileIdxSubpic = subpicPPS.getSliceTileIdx(subpicSliceIdx);
unsigned int sliceTileIdx = (sliceTileIdxSubpic / subpicPPS.getNumTileColumns() + tileIdxY) * numTileColsInPic + tileIdxX + (sliceTileIdxSubpic % subpicPPS.getNumTileColumns());
pps.setSliceTileIdx(sliceIdx, sliceTileIdx);
pps.setSliceHeightInCtu(sliceIdx, subpicPPS.getSliceHeightInCtu(subpicSliceIdx));
}
} }
} }
} }
else
{
pps.setTileIdxDeltaPresentFlag(false);
}
pps.initRectSliceMap(&sps);
pps.setLoopFilterAcrossTilesEnabledFlag(false); pps.setLoopFilterAcrossTilesEnabledFlag(false);
pps.setLoopFilterAcrossSlicesEnabledFlag(false); pps.setLoopFilterAcrossSlicesEnabledFlag(false);
......
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