Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -928,6 +928,27 @@ static int truncated_binary_decode(VVCLocalContext *lc, const int c_max) · 927 unmodified lines | ||
| 928 | 928 | return v; |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | +// 9.3.3.5 k-th order Exp - Golomb binarization process | |
| 932 | +static int kth_order_egk_decode(CABACContext *c, int k) | |
| 933 | +{ | |
| 934 | + int bit = 1; | |
| 935 | + int value = 0; | |
| 936 | + int symbol = 0; | |
| 937 | + | |
| 938 | + while (bit) { | |
| 939 | + bit = get_cabac_bypass(c); | |
| 940 | + value += bit << k++; | |
| 941 | + } | |
| 942 | + | |
| 943 | + if (--k) { | |
| 944 | + for (int i = 0; i < k; i++) | |
| 945 | + symbol = (symbol << 1) | get_cabac_bypass(c); | |
| 946 | + value += symbol; | |
| 947 | + } | |
| 948 | + | |
| 949 | + return value; | |
| 950 | +} | |
| 951 | + | |
| 931 | 952 | // 9.3.3.6 Limited k-th order Exp-Golomb binarization process |
| 932 | 953 | static int limited_kth_order_egk_decode(CABACContext *c, const int k, const int max_pre_ext_len, const int trunc_suffix_len) |
| 933 | 954 | { |