History

Don't check for scene changes on forced IDR frames

For the first encoded frame, is bEncCurFrmAsIdrFlag true while bIdrPeriodFlag is false. Previously, the scene detection code unnecessarily checked for a scene change in the first encoded frame (where the reference frame was an uninitialized frame), triggering valgrind warnings about using uninitialized memory.

Martin Storsjö committed 12 years ago

Commit 3eda5a81 parent 5d616711 file · +2 −1Browse files

Showing the changes to codec/encoder/core/src/wels_preprocess.cpp (1 of 1 file). Show all

Unified · Split

codec/encoder/core/src/wels_preprocess.cpp+2−1
@@ -410,6 +410,7 @@ int32_t CWelsPreProcess::SingleLayerPreprocess (void* pCtx, const SSourcePicture · 409 unmodified lines
410410 DownsamplePadding (pSrcPic, pDstPic, iSrcWidth, iSrcHeight, iShrinkWidth, iShrinkHeight, iTargetWidth, iTargetHeight);
411411
412412 if (pSvcParam->bEnableSceneChangeDetect && !pEncCtx->pVaa->bIdrPeriodFlag
413+ && !pEncCtx->bEncCurFrmAsIdrFlag
413414 && ! (pEncCtx->iCodingIndex & (pSvcParam->uiGopSize - 1))) {
414415 SPicture* pRefPic = pEncCtx->pLtr[iDependencyId].bReceivedT0LostFlag ?
415416 pEncCtx->pSpatialPic[iDependencyId][pEncCtx->uiSpatialLayersInTemporal[iDependencyId] +
@@ -510,7 +511,7 @@ int32_t CWelsPreProcess::MultiLayerPreprocess (void* pCtx, const SSourcePicture* · 94 unmodified lines
510511 } while (i < kiSpatialNum);
511512
512513 if (pSvcParam->bEnableSceneChangeDetect && (kiSpatialNum == pSvcParam->iNumDependencyLayer)
513− && !pEncCtx->pVaa->bIdrPeriodFlag) {
514+ && !pEncCtx->pVaa->bIdrPeriodFlag && !pEncCtx->bEncCurFrmAsIdrFlag) {
514515 SPicture* pRef = pEncCtx->pLtr[0].bReceivedT0LostFlag ?
515516 pEncCtx->pSpatialPic[0][pEncCtx->uiSpatialLayersInTemporal[0] + pEncCtx->pVaa->uiValidLongTermPicIdx] :
516517 m_pLastSpatialPicture[0][0];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t