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 | poc->PicOrderCntVal = 0; | 172 | poc->PicOrderCntVal = 0; |
| 173 | poc->DocOffset = -1; | 173 | poc->DocOffset = -1; |
| 174 | } else { | 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 | if (tid == 0) { | 177 | if (tid == 0) { |
| 177 | poc->PicOrderCntVal = poc->prevPicOrderCntVal + SubGopLength; | 178 | poc->PicOrderCntVal = poc->prevPicOrderCntVal + SubGopLength; |
| 178 | poc->DocOffset = 0; | 179 | poc->DocOffset = 0; |
| @@ -187,15 +188,16 @@ int ff_evc_derive_poc(const EVCParamSets *ps, const EVCParserSliceHeader *sh, · 8 unmodified lines | |||
| 187 | poc->prevPicOrderCntVal += SubGopLength; | 188 | poc->prevPicOrderCntVal += SubGopLength; |
| 188 | ExpectedTemporalId = 0; | 189 | ExpectedTemporalId = 0; |
| 189 | } else | 190 | } else |
| 190 | ExpectedTemporalId = 1 + (int)log2(poc->DocOffset); | 191 | ExpectedTemporalId = 1 + av_log2(poc->DocOffset); |
| 192 | |||
| 191 | while (tid != ExpectedTemporalId) { | 193 | while (tid != ExpectedTemporalId) { |
| 192 | poc->DocOffset = (poc->DocOffset + 1) % SubGopLength; | 194 | poc->DocOffset = (poc->DocOffset + 1) % SubGopLength; |
| 193 | if (poc->DocOffset == 0) | 195 | if (poc->DocOffset == 0) |
| 194 | ExpectedTemporalId = 0; | 196 | ExpectedTemporalId = 0; |
| 195 | else | 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 | poc->PicOrderCntVal = poc->prevPicOrderCntVal + PocOffset; | 201 | poc->PicOrderCntVal = poc->prevPicOrderCntVal + PocOffset; |
| 200 | } | 202 | } |
| 201 | } | 203 | } |