[x265] [PATCH 2 of 2] Removing older code which initalizes RPS
shazeb at multicorewareinc.com
shazeb at multicorewareinc.com
Thu Aug 22 14:54:42 CEST 2013
# HG changeset patch
# User Shazeb N Khan
# Date 1377173199 -19800
# Thu Aug 22 17:36:39 2013 +0530
# Node ID fae72778182c554fe25ff5a949b0249afd5b2525
# Parent 34c63b8389c6f688cec7ac869943df32577fb28e
Removing older code which initalizes RPS
diff -r 34c63b8389c6 -r fae72778182c source/encoder/dpb.cpp
--- a/source/encoder/dpb.cpp Thu Aug 22 17:34:01 2013 +0530
+++ b/source/encoder/dpb.cpp Thu Aug 22 17:36:39 2013 +0530
@@ -644,229 +644,6 @@
_param->lookaheadDepth = m_gopSize;
}
- bool verifiedGOP = false;
- bool errorGOP = false;
- int checkGOP = 1;
- int numRefs = 1;
-
- int refList[MAX_NUM_REF_PICS + 1];
- refList[0] = 0;
- bool isOK[MAX_GOP];
- for (Int i = 0; i < MAX_GOP; i++)
- {
- isOK[i] = false;
- }
-
- int numOK = 0;
- if (_param->bOpenGOP == false)
- CONFIRM(_param->keyframeMax % m_gopSize != 0, "Intra period must be a multiple of GOPSize");
-
- m_extraRPSs = 0;
- // start looping through frames in coding order until we can verify that the GOP structure is correct.
- while (!verifiedGOP && !errorGOP)
- {
- Int curGOP = (checkGOP - 1) % m_gopSize;
- Int curPOC = ((checkGOP - 1) / m_gopSize) * m_gopSize + m_gopList[curGOP].m_POC;
- if (m_gopList[curGOP].m_POC < 0)
- {
- printf("\nError: found fewer Reference Picture Sets than GOPSize\n");
- errorGOP = true;
- }
- else
- {
- //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
- Bool beforeI = false;
- for (Int i = 0; i < m_gopList[curGOP].m_numRefPics; i++)
- {
- Int absPOC = curPOC + m_gopList[curGOP].m_referencePics[i];
- if (absPOC < 0)
- {
- beforeI = true;
- }
- else
- {
- Bool found = false;
- for (Int j = 0; j < numRefs; j++)
- {
- if (refList[j] == absPOC)
- {
- found = true;
- for (Int k = 0; k < m_gopSize; k++)
- {
- if (absPOC % m_gopSize == m_gopList[k].m_POC % m_gopSize)
- {
- m_gopList[k].m_refPic = true;
- m_gopList[curGOP].m_usedByCurrPic[i] = 1;
- }
- }
- }
- }
-
- if (!found)
- {
- printf("\nError: ref pic %d is not available for GOP frame %d\n", m_gopList[curGOP].m_referencePics[i], curGOP + 1);
- errorGOP = true;
- }
- }
- }
-
- if (!beforeI && !errorGOP)
- {
- //all ref frames were present
- if (!isOK[curGOP])
- {
- numOK++;
- isOK[curGOP] = true;
- if (numOK == m_gopSize)
- {
- verifiedGOP = true;
- }
- }
- }
- else
- {
- //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
- m_gopList[m_gopSize + m_extraRPSs] = m_gopList[curGOP];
- Int newRefs = 0;
- for (Int i = 0; i < m_gopList[curGOP].m_numRefPics; i++)
- {
- Int absPOC = curPOC + m_gopList[curGOP].m_referencePics[i];
- if (absPOC >= 0)
- {
- m_gopList[m_gopSize + m_extraRPSs].m_referencePics[newRefs] = m_gopList[curGOP].m_referencePics[i];
- m_gopList[m_gopSize + m_extraRPSs].m_usedByCurrPic[newRefs] = m_gopList[curGOP].m_usedByCurrPic[i];
- newRefs++;
- }
- }
-
- Int numPrefRefs = m_gopList[curGOP].m_numRefPicsActive;
-
- for (Int offset = -1; offset > -checkGOP; offset--)
- {
- //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0.
- Int offGOP = (checkGOP - 1 + offset) % m_gopSize;
- Int offPOC = ((checkGOP - 1 + offset) / m_gopSize) * m_gopSize + m_gopList[offGOP].m_POC;
- if (offPOC >= 0)
- {
- Bool newRef = false;
- for (Int i = 0; i < numRefs; i++)
- {
- if (refList[i] == offPOC)
- {
- newRef = true;
- }
- }
-
- for (Int i = 0; i < newRefs; i++)
- {
- if (m_gopList[m_gopSize + m_extraRPSs].m_referencePics[i] == offPOC - curPOC)
- {
- newRef = false;
- }
- }
-
- if (newRef)
- {
- Int insertPoint = newRefs;
- //this picture can be added, find appropriate place in list and insert it.
- m_gopList[offGOP].m_refPic = true;
- for (Int j = 0; j < newRefs; j++)
- {
- if (m_gopList[m_gopSize + m_extraRPSs].m_referencePics[j] < offPOC - curPOC || m_gopList[m_gopSize + m_extraRPSs].m_referencePics[j] > 0)
- {
- insertPoint = j;
- break;
- }
- }
-
- Int prev = offPOC - curPOC;
- Int prevUsed = 1;
- for (Int j = insertPoint; j < newRefs + 1; j++)
- {
- Int newPrev = m_gopList[m_gopSize + m_extraRPSs].m_referencePics[j];
- Int newUsed = m_gopList[m_gopSize + m_extraRPSs].m_usedByCurrPic[j];
- m_gopList[m_gopSize + m_extraRPSs].m_referencePics[j] = prev;
- m_gopList[m_gopSize + m_extraRPSs].m_usedByCurrPic[j] = prevUsed;
- prevUsed = newUsed;
- prev = newPrev;
- }
-
- newRefs++;
- }
- }
- if (newRefs >= numPrefRefs)
- {
- break;
- }
- }
-
- m_gopList[m_gopSize + m_extraRPSs].m_numRefPics = newRefs;
- m_gopList[m_gopSize + m_extraRPSs].m_POC = curPOC;
- if (m_extraRPSs == 0)
- {
- m_gopList[m_gopSize + m_extraRPSs].m_interRPSPrediction = 0;
- m_gopList[m_gopSize + m_extraRPSs].m_numRefIdc = 0;
- }
- else
- {
- Int rIdx = m_gopSize + m_extraRPSs - 1;
- Int refPOC = m_gopList[rIdx].m_POC;
- Int refPics = m_gopList[rIdx].m_numRefPics;
- Int newIdc = 0;
- for (Int i = 0; i <= refPics; i++)
- {
- Int deltaPOC = ((i != refPics) ? m_gopList[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0
- Int absPOCref = refPOC + deltaPOC;
- Int refIdc = 0;
- for (Int j = 0; j < m_gopList[m_gopSize + m_extraRPSs].m_numRefPics; j++)
- {
- if ((absPOCref - curPOC) == m_gopList[m_gopSize + m_extraRPSs].m_referencePics[j])
- {
- if (m_gopList[m_gopSize + m_extraRPSs].m_usedByCurrPic[j])
- {
- refIdc = 1;
- }
- else
- {
- refIdc = 2;
- }
- }
- }
-
- m_gopList[m_gopSize + m_extraRPSs].m_refIdc[newIdc] = refIdc;
- newIdc++;
- }
-
- m_gopList[m_gopSize + m_extraRPSs].m_interRPSPrediction = 1;
- m_gopList[m_gopSize + m_extraRPSs].m_numRefIdc = newIdc;
- m_gopList[m_gopSize + m_extraRPSs].m_deltaRPS = refPOC - m_gopList[m_gopSize + m_extraRPSs].m_POC;
- }
- curGOP = m_gopSize + m_extraRPSs;
- m_extraRPSs++;
- }
- numRefs = 0;
- for (Int i = 0; i < m_gopList[curGOP].m_numRefPics; i++)
- {
- Int absPOC = curPOC + m_gopList[curGOP].m_referencePics[i];
- if (absPOC >= 0)
- {
- refList[numRefs] = absPOC;
- numRefs++;
- }
- }
-
- refList[numRefs] = curPOC;
- numRefs++;
- }
- checkGOP++;
- }
-
- CONFIRM(errorGOP, "Invalid GOP structure given");
- for (Int i = 0; i < m_gopSize; i++)
- {
- CONFIRM(m_gopList[i].m_sliceType != 'B' && m_gopList[i].m_sliceType != 'P', "Slice type must be equal to B or P");
- }
-
for (Int i = 0; i < MAX_TLAYER; i++)
{
m_numReorderPics[i] = 0;
diff -r 34c63b8389c6 -r fae72778182c source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Thu Aug 22 17:34:01 2013 +0530
+++ b/source/encoder/frameencoder.cpp Thu Aug 22 17:36:39 2013 +0530
@@ -109,7 +109,6 @@
m_pps.setSPS(&m_sps);
top->xInitPPS(&m_pps);
- top->xInitRPS(&m_sps);
m_sps.setNumLongTermRefPicSPS(0);
if (m_cfg->getPictureTimingSEIEnabled() || m_cfg->getDecodingUnitInfoSEIEnabled())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265-2.patch
Type: text/x-patch
Size: 10560 bytes
Desc: not available
URL: <https://mailman.videolan.org/private/x265-devel/attachments/20130822/f720c900/attachment-0001.bin>
More information about the x265-devel
mailing list