History

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

Michael Niedermayer committed 2 years ago

Commit 83264991 parent c314a681 file · +4 −4Browse files

Unified · Split

libavcodec/rangecoder.h+4−4
@@ -112,7 +112,6 @@ static inline void put_rac(RangeCoder *c, uint8_t *const state, int bit) · 111 unmodified lines
112 112
113static inline void refill(RangeCoder *c)113static inline void refill(RangeCoder *c)
114{114{
115 if (c->range < 0x100) {
116 c->range <<= 8;115 c->range <<= 8;
117 c->low <<= 8;116 c->low <<= 8;
118 if (c->bytestream < c->bytestream_end) {117 if (c->bytestream < c->bytestream_end) {
@@ -120,7 +119,6 @@ static inline void refill(RangeCoder *c) · 1 unmodified line
120 c->bytestream++;119 c->bytestream++;
121 } else120 } else
122 c->overread ++;121 c->overread ++;
123 }
124}122}
125 123
126static inline int get_rac(RangeCoder *c, uint8_t *const state)124static 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) · 3 unmodified lines
130 c->range -= range1;128 c->range -= range1;
131 if (c->low < c->range) {129 if (c->low < c->range) {
132 *state = c->zero_state[*state];130 *state = c->zero_state[*state];
133 refill(c);131 if (c->range < 0x100)
132 refill(c);
134 return 0;133 return 0;
135 } else {134 } else {
136 c->low -= c->range;135 c->low -= c->range;
137 *state = c->one_state[*state];136 *state = c->one_state[*state];
138 c->range = range1;137 c->range = range1;
139 refill(c);138 if (c->range < 0x100)
139 refill(c);
140 return 1;140 return 1;
141 }141 }
142}142}

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