| 670 | |
| 671 | |
| 672 | void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam) { |
| 673 | SSpatialLayerInternal* pLayerParamInternal; |
| 674 | SSpatialLayerConfig* pLayerParam; |
| 675 | const float kfEpsn = 0.000001f; |
| 676 | const int32_t kiNumLayer = pParam->iSpatialLayerNum; |
| 677 | int32_t i; |
| 678 | const float kfMaxFrameRate = pParam->fMaxFrameRate; |
| 679 | float fRatio; |
| 680 | float fTargetOutputFrameRate; |
| 681 | |
| 682 | //set input frame rate to each layer |
| 683 | for (i = 0; i < kiNumLayer; i++) { |
| 684 | pLayerParamInternal = & (pParam->sDependencyLayers[i]); |
| 685 | pLayerParam = & (pParam->sSpatialLayers[i]); |
| 686 | fRatio = pLayerParamInternal->fOutputFrameRate / pLayerParamInternal->fInputFrameRate; |
| 687 | if ((kfMaxFrameRate - pLayerParamInternal->fInputFrameRate) > kfEpsn |
| 688 | || (kfMaxFrameRate - pLayerParamInternal->fInputFrameRate) < -kfEpsn) { |
| 689 | pLayerParamInternal->fInputFrameRate = kfMaxFrameRate; |
| 690 | fTargetOutputFrameRate = kfMaxFrameRate * fRatio; |
| 691 | pLayerParamInternal->fOutputFrameRate = (fTargetOutputFrameRate >= 6) ? fTargetOutputFrameRate : |
| 692 | (pLayerParamInternal->fInputFrameRate); |
| 693 | pLayerParam->fFrameRate = pLayerParamInternal->fOutputFrameRate; |
| 694 | //TODO:{Sijia} from design, there is no sense to have temporal layer when under 6fps even with such setting? |
| 695 | } |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | int32_t WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int iLayer) { |
| 700 | //TODO (Sijia): this is a temporary solution which keep the ratio between layers |