History

avcodec/evc_parse: remove pow() and log2()

The use of float based functions is both unneeded and wrong due to unpredictable rounding

Michael Niedermayer committed 3 years ago

Commit d35eecd1 parent f2687a31 file · +6 −4Browse files

Unified · Split

libavcodec/evc_parse.c+6−4
@@ -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 } else190 } 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 else197 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 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t