1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-23 04:24:35 +02:00

avcodec/rangecoder: Move refill check out of refill() function

If the function is not inlined, this is more efficient. Also
it allows calling refill() without the check

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-10-16 14:53:57 +02:00
parent c314a68d04
commit 832649986c
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -112,7 +112,6 @@ static inline void put_rac(RangeCoder *c, uint8_t *const state, int bit)
static inline void refill(RangeCoder *c)
{
if (c->range < 0x100) {
c->range <<= 8;
c->low <<= 8;
if (c->bytestream < c->bytestream_end) {
@ -120,7 +119,6 @@ static inline void refill(RangeCoder *c)
c->bytestream++;
} else
c->overread ++;
}
}
static inline int get_rac(RangeCoder *c, uint8_t *const state)
@ -130,13 +128,15 @@ static inline int get_rac(RangeCoder *c, uint8_t *const state)
c->range -= range1;
if (c->low < c->range) {
*state = c->zero_state[*state];
refill(c);
if (c->range < 0x100)
refill(c);
return 0;
} else {
c->low -= c->range;
*state = c->one_state[*state];
c->range = range1;
refill(c);
if (c->range < 0x100)
refill(c);
return 1;
}
}