History

avcodec/rangecoder: only perform renorm check/loop for callers that need it

Michael Niedermayer committed 2 years ago

Commit d147b3d1 parent 67adb301 file · +2 −3Browse files

Unified · Split

libavcodec/rangecoder.h+2−3
@@ -62,7 +62,6 @@ void ff_build_rac_states(RangeCoder *c, int factor, int max_p); · 61 unmodified lines
62static inline void renorm_encoder(RangeCoder *c)62static inline void renorm_encoder(RangeCoder *c)
63{63{
64 // FIXME: optimize64 // FIXME: optimize
65 while (c->range < 0x100) {
66 if (c->outstanding_byte < 0) {65 if (c->outstanding_byte < 0) {
67 c->outstanding_byte = c->low >> 8;66 c->outstanding_byte = c->low >> 8;
68 } else if (c->low <= 0xFF00) {67 } else if (c->low <= 0xFF00) {
@@ -81,7 +80,6 @@ static inline void renorm_encoder(RangeCoder *c) · 12 unmodified lines
81 80
82 c->low = (c->low & 0xFF) << 8;81 c->low = (c->low & 0xFF) << 8;
83 c->range <<= 8;82 c->range <<= 8;
84 }
85}83}
86 84
87static inline int get_rac_count(RangeCoder *c)85static inline int get_rac_count(RangeCoder *c)
@@ -108,7 +106,8 @@ static inline void put_rac(RangeCoder *c, uint8_t *const state, int bit) · 20 unmodified lines
108 *state = c->one_state[*state];106 *state = c->one_state[*state];
109 }107 }
110 108
111 renorm_encoder(c);109 while (c->range < 0x100)
110 renorm_encoder(c);
112}111}
113 112
114static inline void refill(RangeCoder *c)113static inline void refill(RangeCoder *c)

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