Showing the changes to codec/encoder/core/src/wels_preprocess.cpp (1 of 3 files). Show all
Unified · Split
| @@ -305,8 +305,7 @@ void CWelsPreProcess::FreeSpatialPictures (sWelsEncCtx* pCtx) { · 304 unmodified lines | |||
| 305 | } | 305 | } |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePicture** kppSrcPicList, | 308 | int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePicture* kpSrcPic) { |
| 309 | const int32_t kiConfiguredLayerNum) { | ||
| 310 | SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam; | 309 | SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam; |
| 311 | int32_t iNumDependencyLayer = (int32_t)pSvcParam->iSpatialLayerNum; | 310 | int32_t iNumDependencyLayer = (int32_t)pSvcParam->iSpatialLayerNum; |
| 312 | int32_t iSpatialNum = 0; | 311 | int32_t iSpatialNum = 0; |
| @@ -317,17 +316,11 @@ int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePi · 4 unmodified lines | |||
| 317 | if (WelsPreprocessReset (pCtx) != 0) | 316 | if (WelsPreprocessReset (pCtx) != 0) |
| 318 | return -1; | 317 | return -1; |
| 319 | 318 | ||
| 320 | m_bOfficialBranch = (iNumDependencyLayer != kiConfiguredLayerNum); | 319 | m_bOfficialBranch = (iNumDependencyLayer != 1); |
| 321 | if (!m_bOfficialBranch && (iNumDependencyLayer == 1)) { | 320 | if ( iNumDependencyLayer == 1 ) { |
| 322 | // check the input source uiSize to decide if need switch to official branch | 321 | if (pSvcParam->sDependencyLayers[0].iFrameWidth != kpSrcPic->iPicWidth || |
| 323 | // NOTICE: the layernum=1 case is confused in official/non-official cases! | 322 | pSvcParam->sDependencyLayers[0].iFrameHeight != kpSrcPic->iPicHeight) { |
| 324 | SSourcePicture** pic_queue = (SSourcePicture**)kppSrcPicList; | 323 | m_bOfficialBranch = true; |
| 325 | for (int32_t i = 0; i < iNumDependencyLayer; i++) { | ||
| 326 | if (pSvcParam->sDependencyLayers[i].iFrameWidth != pic_queue[i]->iPicWidth || | ||
| 327 | pSvcParam->sDependencyLayers[i].iFrameHeight != pic_queue[i]->iPicHeight) { | ||
| 328 | m_bOfficialBranch = true; | ||
| 329 | break; | ||
| 330 | } | ||
| 331 | } | 324 | } |
| 332 | } | 325 | } |
| 333 | m_bInitDone = true; | 326 | m_bInitDone = true; |
| @@ -336,19 +329,15 @@ int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePi · 2 unmodified lines | |||
| 336 | if (m_pInterfaceVp == NULL) | 329 | if (m_pInterfaceVp == NULL) |
| 337 | return -1; | 330 | return -1; |
| 338 | 331 | ||
| 339 | if (kiConfiguredLayerNum <= 0) | ||
| 340 | return -1; | ||
| 341 | |||
| 342 | pCtx->pVaa->bSceneChangeFlag = pCtx->pVaa->bIdrPeriodFlag = false; | 332 | pCtx->pVaa->bSceneChangeFlag = pCtx->pVaa->bIdrPeriodFlag = false; |
| 343 | if (pSvcParam->uiIntraPeriod) | 333 | if (pSvcParam->uiIntraPeriod) |
| 344 | pCtx->pVaa->bIdrPeriodFlag = (1 + pCtx->iFrameIndex >= (int32_t)pSvcParam->uiIntraPeriod) ? true : false; | 334 | pCtx->pVaa->bIdrPeriodFlag = (1 + pCtx->iFrameIndex >= (int32_t)pSvcParam->uiIntraPeriod) ? true : false; |
| 345 | 335 | ||
| 346 | if (m_bOfficialBranch) { // Perform Down Sampling potentially due to application | 336 | if (m_bOfficialBranch) { // Perform Down Sampling potentially due to application |
| 347 | assert (kiConfiguredLayerNum == 1); | 337 | iSpatialNum = SingleLayerPreprocess (pCtx, kpSrcPic, &m_sScaledPicture); |
| 348 | iSpatialNum = SingleLayerPreprocess (pCtx, kppSrcPicList[0], &m_sScaledPicture); | ||
| 349 | } else { // for console each spatial pictures are available there | 338 | } else { // for console each spatial pictures are available there |
| 350 | iSpatialNum = kiConfiguredLayerNum; | 339 | iSpatialNum = 1; |
| 351 | MultiLayerPreprocess (pCtx, kppSrcPicList, iSpatialNum); | 340 | MultiLayerPreprocess (pCtx, &kpSrcPic, iSpatialNum); |
| 352 | } | 341 | } |
| 353 | 342 | ||
| 354 | return iSpatialNum; | 343 | return iSpatialNum; |