History

vulkan_ffv1: slightly optimize the range decoder

GPUs have cmovs as standard.

Lynne committed 1 year ago

Commit defebd71 parent d7772da1 file · +4 −5Browse files

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

Unified · Split

libavcodec/vulkan/rangecoder.comp+4−5
@@ -219,7 +219,7 @@ void refill(inout RangeCoder c) · 218 unmodified lines
219219 c.range <<= 8;
220220 c.low <<= 8;
221221 if (c.bytestream < c.bytestream_end) {
222− c.low += u8buf(c.bytestream).v;
222+ c.low |= u8buf(c.bytestream).v;
223223 c.bytestream++;
224224 } else {
225225 overread++;
@@ -234,11 +234,10 @@ bool get_rac(inout RangeCoder c, uint64_t state) · 8 unmodified lines
234234 int ranged = c.range + range1;
235235
236236 bool bit = c.low >= ranged;
237− int bv = bit ? 0xFFFFFFFF : 0;
238− sb.v = zero_one_state[(bv & 0x100) + val];
237+ sb.v = zero_one_state[val + (bit ? 256 : 0)];
239238
240− c.low = c.low - (bv & ranged);
241− c.range = (ranged & ~bv) - (range1 & bv);
239+ c.low = c.low - (bit ? ranged : 0);
240+ c.range = (bit ? 0 : ranged) - (bit ? range1 : 0);
242241
243242 if (c.range < 0x100)
244243 refill(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