[FFmpeg-cvslog] avcodec/rangecoder: only perform renorm check/loop for callers that need it
Michael Niedermayer
git at videolan.org
Thu Feb 27 19:07:51 EET 2025
ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Wed Oct 16 14:39:20 2024 +0200| [d1ea5ab8248c6091dcb0b01764fe7ab5c98f2feb] | committer: Michael Niedermayer
avcodec/rangecoder: only perform renorm check/loop for callers that need it
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit d147b3d7ecba2bd40cb45284f920238da97a95ee)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1ea5ab8248c6091dcb0b01764fe7ab5c98f2feb
---
libavcodec/rangecoder.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libavcodec/rangecoder.h b/libavcodec/rangecoder.h
index 4d4ca4d526..b6f56b5737 100644
--- a/libavcodec/rangecoder.h
+++ b/libavcodec/rangecoder.h
@@ -71,7 +71,6 @@ void ff_build_rac_states(RangeCoder *c, int factor, int max_p);
static inline void renorm_encoder(RangeCoder *c)
{
// FIXME: optimize
- while (c->range < 0x100) {
if (c->outstanding_byte < 0) {
c->outstanding_byte = c->low >> 8;
} else if (c->low <= 0xFF00) {
@@ -90,7 +89,6 @@ static inline void renorm_encoder(RangeCoder *c)
c->low = (c->low & 0xFF) << 8;
c->range <<= 8;
- }
}
static inline int get_rac_count(RangeCoder *c)
@@ -117,7 +115,8 @@ static inline void put_rac(RangeCoder *c, uint8_t *const state, int bit)
*state = c->one_state[*state];
}
- renorm_encoder(c);
+ while (c->range < 0x100)
+ renorm_encoder(c);
}
static inline void refill(RangeCoder *c)
More information about the ffmpeg-cvslog
mailing list