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,12 +535,42 @@ void SubpicMergeApp::getTileDimensions(std::vector<int> &tileWidths, std::vector
std::vector<int> tileX;
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)
{
const PPS &pps = *subpic.slices[0].getPPS();
if (!pps.getNoPicPartitionFlag())
{
if (pps.getNumTileColumns() > 1)
{
int x = subpic.topLeftCornerX;
for (int i = 0; i < pps.getNumTileColumns(); i++)
......@@ -548,7 +578,10 @@ void SubpicMergeApp::getTileDimensions(std::vector<int> &tileWidths, std::vector
x += pps.getTileColumnWidth(i) * pps.getCtuSize();
tileX.push_back(x);
}
}
if (pps.getNumTileRows() > 1)
{
int y = subpic.topLeftCornerY;
for (int i = 0; i < pps.getNumTileRows(); i++)
{
......@@ -557,6 +590,7 @@ void SubpicMergeApp::getTileDimensions(std::vector<int> &tileWidths, std::vector
}
}
}
}
tileX.push_back(m_picWidth);
tileY.push_back(m_picHeight);
......@@ -642,26 +676,49 @@ void SubpicMergeApp::generateMergedStreamPPSes(ParameterSetManager &psManager, s
pps.setTileIdxDeltaPresentFlag(true);
pps.initRectSlices( );
pps.setSingleSlicePerSubPicFlag(true);
for (auto &subpic : *m_subpics)
{
const PPS &subpicPPS = *subpic.slices[0].getPPS();
if (subpicPPS.getNumSlicesInPic() > 1)
{
pps.setSingleSlicePerSubPicFlag(false);
break;
}
}
if (!pps.getSingleSlicePerSubPicFlag())
{
unsigned int numTileColsInPic = pps.getNumTileColumns();
unsigned int sliceIdx = 0;
for (auto &subpic : *m_subpics)
for (auto& subpic : *m_subpics)
{
unsigned int tileIdxY = 0;
for (unsigned int tileY = 0; tileY != subpic.topLeftCornerY && tileIdxY < tileHeights.size(); tileIdxY++)
for (unsigned int tileY = 0; tileIdxY < tileHeights.size(); tileIdxY++)
{
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 border match");
CHECK(tileIdxY == tileHeights.size(), "Could not find subpicture to tile mapping");
unsigned int tileIdxX = 0;
for (unsigned int tileX = 0; tileX != subpic.topLeftCornerX && tileIdxX < tileWidths.size(); tileIdxX++)
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 border match")
CHECK(tileIdxX == tileWidths.size(), "Could not find subpicture to tile mapping")
const PPS &subpicPPS = *subpic.slices[0].getPPS();
const PPS& subpicPPS = *subpic.slices[0].getPPS();
if (subpicPPS.getNumSlicesInPic() == 1)
{
......@@ -688,6 +745,13 @@ void SubpicMergeApp::generateMergedStreamPPSes(ParameterSetManager &psManager, s
}
}
}
}
else
{
pps.setTileIdxDeltaPresentFlag(false);
}
pps.initRectSliceMap(&sps);
pps.setLoopFilterAcrossTilesEnabledFlag(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