Showing the changes to codec/encoder/core/src/wels_preprocess.cpp (1 of 7 files). Show all
Unified · Split
| @@ -1195,43 +1195,45 @@ void CWelsPreProcess::WelsExchangeSpatialPictures (SPicture** ppPic1, SPicture** · 1194 unmodified lines | |||
| 1195 | *ppPic2 = tmp; | 1195 | *ppPic2 = tmp; |
| 1196 | } | 1196 | } |
| 1197 | 1197 | ||
| 1198 | void CWelsPreProcess::UpdateSrcListLosslessScreenRefSelectionWithLtr (SPicture* pCurPicture, const int32_t kiCurDid, const int32_t kuiMarkLongTermPicIdx, SPicture** pLongRefList) { | 1198 | void CWelsPreProcess::UpdateSrcListLosslessScreenRefSelectionWithLtr (SPicture* pCurPicture, const int32_t kiCurDid, |
| 1199 | const int32_t kuiMarkLongTermPicIdx, SPicture** pLongRefList) { | ||
| 1199 | SPicture** pLongRefSrcList = &m_pSpatialPic[kiCurDid][0]; | 1200 | SPicture** pLongRefSrcList = &m_pSpatialPic[kiCurDid][0]; |
| 1200 | for (int32_t i = 0; i < MAX_REF_PIC_COUNT; ++i) { | 1201 | for (int32_t i = 0; i < MAX_REF_PIC_COUNT; ++i) { |
| 1201 | if (NULL == pLongRefSrcList[i + 1] || (NULL != pLongRefList[i] && pLongRefList[i]->bUsedAsRef | 1202 | if (NULL == pLongRefSrcList[i + 1] || (NULL != pLongRefList[i] && pLongRefList[i]->bUsedAsRef |
| 1202 | && pLongRefList[i]->bIsLongRef)) { | 1203 | && pLongRefList[i]->bIsLongRef)) { |
| 1203 | continue; | 1204 | continue; |
| 1204 | } else { | 1205 | } else { |
| 1205 | pLongRefSrcList[i + 1]->SetUnref (); | 1206 | pLongRefSrcList[i + 1]->SetUnref(); |
| 1206 | } | 1207 | } |
| 1207 | } | 1208 | } |
| 1208 | WelsExchangeSpatialPictures (&m_pSpatialPic[kiCurDid][0], | 1209 | WelsExchangeSpatialPictures (&m_pSpatialPic[kiCurDid][0], |
| 1209 | &m_pSpatialPic[kiCurDid][1 + kuiMarkLongTermPicIdx]); | 1210 | &m_pSpatialPic[kiCurDid][1 + kuiMarkLongTermPicIdx]); |
| 1210 | m_iAvaliableRefInSpatialPicList = MAX_REF_PIC_COUNT; | 1211 | m_iAvaliableRefInSpatialPicList = MAX_REF_PIC_COUNT; |
| 1211 | (GetCurrentFrameFromOrigList(kiCurDid))->SetUnref (); | 1212 | (GetCurrentFrameFromOrigList (kiCurDid))->SetUnref(); |
| 1212 | } | 1213 | } |
| 1213 | void CWelsPreProcess::UpdateSrcList (SPicture* pCurPicture, const int32_t kiCurDid, SPicture** pShortRefList, const uint32_t kuiShortRefCount) { | 1214 | void CWelsPreProcess::UpdateSrcList (SPicture* pCurPicture, const int32_t kiCurDid, SPicture** pShortRefList, |
| 1215 | const uint32_t kuiShortRefCount) { | ||
| 1214 | SPicture** pRefSrcList = &m_pSpatialPic[kiCurDid][0]; | 1216 | SPicture** pRefSrcList = &m_pSpatialPic[kiCurDid][0]; |
| 1215 | 1217 | ||
| 1216 | //pRefSrcList[0] is for current frame | 1218 | //pRefSrcList[0] is for current frame |
| 1217 | if (pCurPicture->bUsedAsRef || pCurPicture->bIsLongRef) { | 1219 | if (pCurPicture->bUsedAsRef || pCurPicture->bIsLongRef) { |
| 1218 | if (pCurPicture->iPictureType == P_SLICE && pCurPicture->uiTemporalId != 0 ) { | 1220 | if (pCurPicture->iPictureType == P_SLICE && pCurPicture->uiTemporalId != 0) { |
| 1219 | for (int iRefIdx = kuiShortRefCount - 1; iRefIdx >= 0; --iRefIdx) { | 1221 | for (int iRefIdx = kuiShortRefCount - 1; iRefIdx >= 0; --iRefIdx) { |
| 1220 | WelsExchangeSpatialPictures (&pRefSrcList[iRefIdx + 1], | 1222 | WelsExchangeSpatialPictures (&pRefSrcList[iRefIdx + 1], |
| 1221 | &pRefSrcList[iRefIdx]); | 1223 | &pRefSrcList[iRefIdx]); |
| 1222 | } | 1224 | } |
| 1223 | m_iAvaliableRefInSpatialPicList = kuiShortRefCount; | 1225 | m_iAvaliableRefInSpatialPicList = kuiShortRefCount; |
| 1224 | } else { | 1226 | } else { |
| 1225 | WelsExchangeSpatialPictures (&pRefSrcList[0], &pRefSrcList[1]); | 1227 | WelsExchangeSpatialPictures (&pRefSrcList[0], &pRefSrcList[1]); |
| 1226 | for (int32_t i = MAX_SHORT_REF_COUNT - 1; i > 0 ; --i) { | 1228 | for (int32_t i = MAX_SHORT_REF_COUNT - 1; i > 0 ; --i) { |
| 1227 | if (pRefSrcList[i + 1] != NULL) { | 1229 | if (pRefSrcList[i + 1] != NULL) { |
| 1228 | pRefSrcList[i + 1]->SetUnref (); | 1230 | pRefSrcList[i + 1]->SetUnref(); |
| 1229 | } | 1231 | } |
| 1230 | } | 1232 | } |
| 1231 | m_iAvaliableRefInSpatialPicList = 1; | 1233 | m_iAvaliableRefInSpatialPicList = 1; |
| 1232 | } | 1234 | } |
| 1233 | } | 1235 | } |
| 1234 | (GetCurrentFrameFromOrigList(kiCurDid))->SetUnref (); | 1236 | (GetCurrentFrameFromOrigList (kiCurDid))->SetUnref(); |
| 1235 | } | 1237 | } |
| 1236 | 1238 | ||
| 1237 | //TODO: may opti later | 1239 | //TODO: may opti later |