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

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

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
6262 static inline void renorm_encoder(RangeCoder *c)
6363 {
6464 // FIXME: optimize
65− while (c->range < 0x100) {
6665 if (c->outstanding_byte < 0) {
6766 c->outstanding_byte = c->low >> 8;
6867 } else if (c->low <= 0xFF00) {
@@ -81,7 +80,6 @@ static inline void renorm_encoder(RangeCoder *c) · 12 unmodified lines
8180
8281 c->low = (c->low & 0xFF) << 8;
8382 c->range <<= 8;
84− }
8583 }
8684
8785 static 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
108106 *state = c->one_state[*state];
109107 }
110108
111− renorm_encoder(c);
109+ while (c->range < 0x100)
110+ renorm_encoder(c);
112111 }
113112
114113 static 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