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