| 4468 | } |
| 4469 | |
| 4470 | int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConfig* pLTRValue) { |
| 4471 | SWelsSvcCodingParam sConfig; |
| 4472 | int32_t iNumRefFrame = 1; |
| 4473 | int32_t iRet = 0; |
| 4474 | memcpy ((void*) &sConfig, (*ppCtx)->pSvcParam, sizeof (SWelsSvcCodingParam)); |
| 4475 | sConfig.bEnableLongTermReference = pLTRValue->bEnableLongTermReference; |
| 4476 | sConfig.iLTRRefNum = pLTRValue->iLTRRefNum; |
| 4477 | int32_t uiGopSize = 1 << (sConfig.iTemporalLayerNum - 1); |
| 4478 | if (sConfig.iUsageType == SCREEN_CONTENT_REAL_TIME) { |
| 4479 | if (sConfig.bEnableLongTermReference) { |
| 4480 | sConfig.iLTRRefNum = LONG_TERM_REF_NUM_SCREEN;//WELS_CLIP3 (sConfig.iLTRRefNum, 1, LONG_TERM_REF_NUM_SCREEN); |
| 4481 | iNumRefFrame = WELS_MAX (1, WELS_LOG2 (uiGopSize)) + sConfig.iLTRRefNum; |
| 4482 | } else { |
| 4483 | sConfig.iLTRRefNum = 0; |
| 4484 | iNumRefFrame = WELS_MAX (1, uiGopSize >> 1); |
| 4485 | } |
| 4486 | } else { |
| 4487 | if (sConfig.bEnableLongTermReference) { |
| 4488 | sConfig.iLTRRefNum = LONG_TERM_REF_NUM;//WELS_CLIP3 (sConfig.iLTRRefNum, 1, LONG_TERM_REF_NUM); |
| 4489 | } else { |
| 4490 | sConfig.iLTRRefNum = 0; |
| 4491 | } |
| 4492 | iNumRefFrame = ((uiGopSize >> 1) > 1) ? ((uiGopSize >> 1) + sConfig.iLTRRefNum) : (MIN_REF_PIC_COUNT + |
| 4493 | sConfig.iLTRRefNum); |
| 4494 | iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA); |
| 4495 | |
| 4496 | } |
| 4497 | if (iNumRefFrame > sConfig.iMaxNumRefFrame) { |
| 4498 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 4499 | " CWelsH264SVCEncoder::SetOption LTR flag = %d and number = %d: Required number of reference increased to %d and iMaxNumRefFrame is adjusted (from %d)", |
| 4500 | sConfig.bEnableLongTermReference, sConfig.iLTRRefNum, iNumRefFrame, sConfig.iMaxNumRefFrame); |
| 4501 | sConfig.iMaxNumRefFrame = iNumRefFrame; |
| 4502 | } |
| 4503 | |
| 4504 | if (sConfig.iNumRefFrame < iNumRefFrame) { |
| 4505 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 4506 | " CWelsH264SVCEncoder::SetOption LTR flag = %d and number = %d, Required number of reference increased from Old = %d to New = %d because of LTR setting", |
| 4507 | sConfig.bEnableLongTermReference, sConfig.iLTRRefNum, sConfig.iNumRefFrame, iNumRefFrame); |
| 4508 | sConfig.iNumRefFrame = iNumRefFrame; |
| 4509 | } |
| 4510 | WelsLog (pLogCtx, WELS_LOG_INFO, "CWelsH264SVCEncoder::SetOption enable LTR = %d,ltrnum = %d", |
| 4511 | sConfig.bEnableLongTermReference, sConfig.iLTRRefNum); |
| 4512 | iRet = WelsEncoderParamAdjust (ppCtx, &sConfig); |
| 4513 | return iRet; |
| 4514 | } |
| 4515 | |
| 4516 | int32_t DynSliceRealloc (sWelsEncCtx* pCtx, |
| 4517 | SFrameBSInfo* pFrameBsInfo, |
no test coverage detected