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

Showing the changes to libavcodec (1 of 1 file). Show all

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
112112
113113 static inline void refill(RangeCoder *c)
114114 {
115− if (c->range < 0x100) {
116115 c->range <<= 8;
117116 c->low <<= 8;
118117 if (c->bytestream < c->bytestream_end) {
@@ -120,7 +119,6 @@ static inline void refill(RangeCoder *c) · 1 unmodified line
120119 c->bytestream++;
121120 } else
122121 c->overread ++;
123− }
124122 }
125123
126124 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) · 3 unmodified lines
130128 c->range -= range1;
131129 if (c->low < c->range) {
132130 *state = c->zero_state[*state];
133− refill(c);
131+ if (c->range < 0x100)
132+ refill(c);
134133 return 0;
135134 } else {
136135 c->low -= c->range;
137136 *state = c->one_state[*state];
138137 c->range = range1;
139− refill(c);
138+ if (c->range < 0x100)
139+ refill(c);
140140 return 1;
141141 }
142142 }

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