History

vulkan_ffv1: optimize symbol reader

This was the fastest variant tested.

Lynne committed 1 year ago

Commit fc960da1 parent defebd71 file · +5 −7Browse files

Unified · Split

libavcodec/vulkan/ffv1_dec.comp+5−7
@@ -78,13 +78,11 @@ int get_isymbol(inout RangeCoder c, uint64_t state) · 77 unmodified lines
7878
7979 state += 21;
8080
81− int a = 1 << e;
82− int i;
83− for (i = e - 1; i >= 9; i--)
84− a |= int(get_rac(c, state + 9)) << i; // 22..31
85−
86− for (; i >= 0; i--)
87− a |= int(get_rac(c, state + i)) << i; // 22..31
81+ int a = 1;
82+ for (int i = e - 1; i >= 0; i--) {
83+ a <<= 1;
84+ a |= int(get_rac(c, state + min(i, 9))); // 22..31
85+ }
8886
8987 return get_rac(c, state - 11 + min(e, 10)) ? -a : a;
9088 }

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