Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 5 files). Show all
Unified · Split
| @@ -157,6 +157,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 156 unmodified lines | |||
| 157 | } | 157 | } |
| 158 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { | 158 | for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) { |
| 159 | SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i]; | 159 | SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i]; |
| 160 | SSpatialLayerConfig* pConfig = &pCfg->sSpatialLayers[i]; | ||
| 160 | if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn | 161 | if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn |
| 161 | && fDlp->fInputFrameRate <= fEpsn) | 162 | && fDlp->fInputFrameRate <= fEpsn) |
| 162 | || (fDlp->fOutputFrameRate >= -fEpsn && fDlp->fOutputFrameRate <= fEpsn)) { | 163 | || (fDlp->fOutputFrameRate >= -fEpsn && fDlp->fOutputFrameRate <= fEpsn)) { |
| @@ -170,6 +171,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 7 unmodified lines | |||
| 170 | "AUTO CORRECT: Invalid settings in input frame rate(%.6f) and output frame rate(%.6f) of layer #%d config file: iResult of output frame rate divided by input frame rate should be power of 2(i.e,in/pOut=2^n). \n Auto correcting Output Framerate to Input Framerate %f!\n", | 171 | "AUTO CORRECT: Invalid settings in input frame rate(%.6f) and output frame rate(%.6f) of layer #%d config file: iResult of output frame rate divided by input frame rate should be power of 2(i.e,in/pOut=2^n). \n Auto correcting Output Framerate to Input Framerate %f!\n", |
| 171 | fDlp->fInputFrameRate, fDlp->fOutputFrameRate, i, fDlp->fInputFrameRate); | 172 | fDlp->fInputFrameRate, fDlp->fOutputFrameRate, i, fDlp->fInputFrameRate); |
| 172 | fDlp->fOutputFrameRate = fDlp->fInputFrameRate; | 173 | fDlp->fOutputFrameRate = fDlp->fInputFrameRate; |
| 174 | pConfig->fFrameRate = fDlp->fOutputFrameRate; | ||
| 173 | } | 175 | } |
| 174 | } | 176 | } |
| 175 | 177 | ||
| @@ -483,7 +485,8 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 307 unmodified lines | |||
| 483 | 485 | ||
| 484 | 486 | ||
| 485 | void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam) { | 487 | void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam) { |
| 486 | SSpatialLayerInternal* pLayerParam; | 488 | SSpatialLayerInternal* pLayerParamInternal; |
| 489 | SSpatialLayerConfig* pLayerParam; | ||
| 487 | const float kfEpsn = 0.000001f; | 490 | const float kfEpsn = 0.000001f; |
| 488 | const int32_t kiNumLayer = pParam->iSpatialLayerNum; | 491 | const int32_t kiNumLayer = pParam->iSpatialLayerNum; |
| 489 | int32_t i; | 492 | int32_t i; |
| @@ -493,14 +496,15 @@ void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam) { · 3 unmodified lines | |||
| 493 | 496 | ||
| 494 | //set input frame rate to each layer | 497 | //set input frame rate to each layer |
| 495 | for (i = 0; i < kiNumLayer; i++) { | 498 | for (i = 0; i < kiNumLayer; i++) { |
| 496 | pLayerParam = & (pParam->sDependencyLayers[i]); | 499 | pLayerParamInternal = & (pParam->sDependencyLayers[i]); |
| 497 | 500 | pLayerParam = & (pParam->sSpatialLayers[i]); | |
| 498 | fRatio = pLayerParam->fOutputFrameRate / pLayerParam->fInputFrameRate; | 501 | fRatio = pLayerParamInternal->fOutputFrameRate / pLayerParamInternal->fInputFrameRate; |
| 499 | if ((kfMaxFrameRate - pLayerParam->fInputFrameRate) > kfEpsn | 502 | if ((kfMaxFrameRate - pLayerParamInternal->fInputFrameRate) > kfEpsn |
| 500 | || (kfMaxFrameRate - pLayerParam->fInputFrameRate) < -kfEpsn) { | 503 | || (kfMaxFrameRate - pLayerParamInternal->fInputFrameRate) < -kfEpsn) { |
| 501 | pLayerParam->fInputFrameRate = kfMaxFrameRate; | 504 | pLayerParamInternal->fInputFrameRate = kfMaxFrameRate; |
| 502 | fTargetOutputFrameRate = kfMaxFrameRate * fRatio; | 505 | fTargetOutputFrameRate = kfMaxFrameRate * fRatio; |
| 503 | pLayerParam->fOutputFrameRate = (fTargetOutputFrameRate >= 6) ? fTargetOutputFrameRate : (pLayerParam->fInputFrameRate); | 506 | pLayerParamInternal->fOutputFrameRate = (fTargetOutputFrameRate >= 6) ? fTargetOutputFrameRate : (pLayerParamInternal->fInputFrameRate); |
| 507 | pLayerParam->fFrameRate = pLayerParamInternal->fOutputFrameRate; | ||
| 504 | //TODO:{Sijia} from design, there is no sense to have temporal layer when under 6fps even with such setting? | 508 | //TODO:{Sijia} from design, there is no sense to have temporal layer when under 6fps even with such setting? |
| 505 | } | 509 | } |
| 506 | } | 510 | } |