The use of float based functions is both unneeded and wrong due to unpredictable rounding
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -172,7 +172,8 @@ int ff_evc_derive_poc(const EVCParamSets *ps, const EVCParserSliceHeader *sh, · 171 unmodified lines | ||
| 172 | 172 | poc->PicOrderCntVal = 0; |
| 173 | 173 | poc->DocOffset = -1; |
| 174 | 174 | } else { |
| 175 | − int SubGopLength = (int)pow(2.0, sps->log2_sub_gop_length); | |
| 175 | + int SubGopLength = 1 << sps->log2_sub_gop_length; | |
| 176 | + | |
| 176 | 177 | if (tid == 0) { |
| 177 | 178 | poc->PicOrderCntVal = poc->prevPicOrderCntVal + SubGopLength; |
| 178 | 179 | poc->DocOffset = 0; |
| @@ -187,15 +188,16 @@ int ff_evc_derive_poc(const EVCParamSets *ps, const EVCParserSliceHeader *sh, · 8 unmodified lines | ||
| 187 | 188 | poc->prevPicOrderCntVal += SubGopLength; |
| 188 | 189 | ExpectedTemporalId = 0; |
| 189 | 190 | } else |
| 190 | − ExpectedTemporalId = 1 + (int)log2(poc->DocOffset); | |
| 191 | + ExpectedTemporalId = 1 + av_log2(poc->DocOffset); | |
| 192 | + | |
| 191 | 193 | while (tid != ExpectedTemporalId) { |
| 192 | 194 | poc->DocOffset = (poc->DocOffset + 1) % SubGopLength; |
| 193 | 195 | if (poc->DocOffset == 0) |
| 194 | 196 | ExpectedTemporalId = 0; |
| 195 | 197 | else |
| 196 | − ExpectedTemporalId = 1 + (int)log2(poc->DocOffset); | |
| 198 | + ExpectedTemporalId = 1 + av_log2(poc->DocOffset); | |
| 197 | 199 | } |
| 198 | − PocOffset = (int)(SubGopLength * ((2.0 * poc->DocOffset + 1) / (int)pow(2.0, tid) - 2)); | |
| 200 | + PocOffset = (int)(SubGopLength * ((2.0 * poc->DocOffset + 1) / (1 << tid) - 2)); | |
| 199 | 201 | poc->PicOrderCntVal = poc->prevPicOrderCntVal + PocOffset; |
| 200 | 202 | } |
| 201 | 203 | } |