History

ffv1enc_vulkan: minor EC optimizations

Lynne committed 1 year ago

Commit 52595021 parent 7c0a8c01 file · +6 −13Browse files

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

Unified · Split

libavcodec/vulkan/rangecoder.comp+6−13
@@ -109,14 +109,10 @@ void put_rac_direct(inout RangeCoder c, inout uint8_t state, bool bit) · 108 unmodified lines
109109 #endif
110110
111111 int diff = c.range - range1;
112− if (bit) {
113− c.low += diff;
114− c.range = range1;
115− } else {
116− c.range = diff;
117− }
112+ c.low += bit ? diff : 0;
113+ c.range = bit ? range1 : diff;
118114
119− if (c.range < 0x100)
115+ if (expectEXT(c.range < 0x100, false))
120116 renorm_encoder(c);
121117
122118 state = zero_one_state[(uint(bit) << 8) + state];
@@ -139,12 +135,9 @@ void put_rac_equi(inout RangeCoder c, bool bit) · 16 unmodified lines
139135 debugPrintfEXT("Error: range1 <= 0");
140136 #endif
141137
142− if (bit) {
143− c.low += c.range - range1;
144− c.range = range1;
145− } else {
146− c.range -= range1;
147− }
138+ int diff = c.range - range1;
139+ c.low += bit ? diff : 0;
140+ c.range = bit ? range1 : diff;
148141
149142 if (expectEXT(c.range < 0x100, false))
150143 renorm_encoder(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