RC calculation error caused by floating->int
I found that there is calculation error in line 674 of ratectl.cpp. Before Dong's modification:
- const int32_t kiOutputBits = WELS_ROUND (pWelsSvcRc->dBitsPerFrame); After Dong's modification:
- const int32_t kiOutputBits = WELS_DIV_ROUND(pWelsSvcRc->iBitsPerFrame, INT_MULTIPLY);
take iBitsPerFrame=4266.666666 for example, before Dong's modification, kiOutputBits is 4267 but after Dong's modification, it's 43, which will cause skip judge error.
I doubt it's error to use INT_MULTIPLY to do div round. Dong, could you double check it, please? Thanks very much.
The pWelsSvcRc->iBitsPerFrame already Multiply INT_MULTIPLY. See follows: int32_t input_iBitsPerFrame = WELS_ROUND(pDLayerParam->iSpatialBitrate * INT_MULTIPLY / pDLayerParam->fInputFrameRate); pWelsSvcRc->iBitsPerFrame = input_iBitsPerFrame; You can update the whole code, then do the test. If any problem, you can open the issue again.