diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-10-16 21:08:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-12-02 03:14:46 +0100 |
commit | 70fa8bd38cdb62cf225471c2dbf6779c348f9b67 (patch) | |
tree | c8471e2a3b669d9d3105affd5bb14a69c8406984 /libavcodec/rangecoder.h | |
parent | 832649986c2bd20943e9983d452ff28c50e6a180 (diff) | |
download | ffmpeg-70fa8bd38cdb62cf225471c2dbf6779c348f9b67.tar.gz |
avcodec/rangecoder: Avoid checking for the first byte on every renormalization
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/rangecoder.h')
-rw-r--r-- | libavcodec/rangecoder.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/rangecoder.h b/libavcodec/rangecoder.h index da13c453ed..944ad492fd 100644 --- a/libavcodec/rangecoder.h +++ b/libavcodec/rangecoder.h @@ -62,10 +62,9 @@ void ff_build_rac_states(RangeCoder *c, int factor, int max_p); static inline void renorm_encoder(RangeCoder *c) { // FIXME: optimize - if (c->outstanding_byte < 0) { - c->outstanding_byte = c->low >> 8; - } else if (c->low <= 0xFF00) { - *c->bytestream++ = c->outstanding_byte; + if (c->low <= 0xFF00) { + *c->bytestream = c->outstanding_byte; + c->bytestream += c->outstanding_byte >= 0; for (; c->outstanding_count; c->outstanding_count--) *c->bytestream++ = 0xFF; c->outstanding_byte = c->low >> 8; |