Unified · Split
| @@ -968,6 +968,17 @@ static int limited_kth_order_egk_decode(CABACContext *c, const int k, const int · 967 unmodified lines | |||
| 968 | return val; | 968 | return val; |
| 969 | } | 969 | } |
| 970 | 970 | ||
| 971 | // 9.3.3.7 Fixed-length binarization process | ||
| 972 | static int fixed_length_decode(CABACContext* c, const int len) | ||
| 973 | { | ||
| 974 | int value = 0; | ||
| 975 | |||
| 976 | for (int i = 0; i < len; i++) | ||
| 977 | value = (value << 1) | get_cabac_bypass(c); | ||
| 978 | |||
| 979 | return value; | ||
| 980 | } | ||
| 981 | |||
| 971 | static av_always_inline | 982 | static av_always_inline |
| 972 | void get_left_top(const VVCLocalContext *lc, uint8_t *left, uint8_t *top, | 983 | void get_left_top(const VVCLocalContext *lc, uint8_t *left, uint8_t *top, |
| 973 | const int x0, const int y0, const uint8_t *left_ctx, const uint8_t *top_ctx) | 984 | const int x0, const int y0, const uint8_t *left_ctx, const uint8_t *top_ctx) |
| @@ -1011,11 +1022,7 @@ int ff_vvc_sao_type_idx_decode(VVCLocalContext *lc) · 37 unmodified lines | |||
| 1011 | 1022 | ||
| 1012 | int ff_vvc_sao_band_position_decode(VVCLocalContext *lc) | 1023 | int ff_vvc_sao_band_position_decode(VVCLocalContext *lc) |
| 1013 | { | 1024 | { |
| 1014 | int value = get_cabac_bypass(&lc->ep->cc); | 1025 | return fixed_length_decode(&lc->ep->cc, 5); |
| 1015 | |||
| 1016 | for (int i = 0; i < 4; i++) | ||
| 1017 | value = (value << 1) | get_cabac_bypass(&lc->ep->cc); | ||
| 1018 | return value; | ||
| 1019 | } | 1026 | } |
| 1020 | 1027 | ||
| 1021 | int ff_vvc_sao_offset_abs_decode(VVCLocalContext *lc) | 1028 | int ff_vvc_sao_offset_abs_decode(VVCLocalContext *lc) |
| @@ -1035,9 +1042,7 @@ int ff_vvc_sao_offset_sign_decode(VVCLocalContext *lc) · 13 unmodified lines | |||
| 1035 | 1042 | ||
| 1036 | int ff_vvc_sao_eo_class_decode(VVCLocalContext *lc) | 1043 | int ff_vvc_sao_eo_class_decode(VVCLocalContext *lc) |
| 1037 | { | 1044 | { |
| 1038 | int ret = get_cabac_bypass(&lc->ep->cc) << 1; | 1045 | return (get_cabac_bypass(&lc->ep->cc) << 1) | get_cabac_bypass(&lc->ep->cc); |
| 1039 | ret |= get_cabac_bypass(&lc->ep->cc); | ||
| 1040 | return ret; | ||
| 1041 | } | 1046 | } |
| 1042 | 1047 | ||
| 1043 | int ff_vvc_alf_ctb_flag(VVCLocalContext *lc, const int rx, const int ry, const int c_idx) | 1048 | int ff_vvc_alf_ctb_flag(VVCLocalContext *lc, const int rx, const int ry, const int c_idx) |
| @@ -1479,12 +1484,7 @@ int ff_vvc_merge_idx(VVCLocalContext *lc) · 435 unmodified lines | |||
| 1479 | 1484 | ||
| 1480 | int ff_vvc_merge_gpm_partition_idx(VVCLocalContext *lc) | 1485 | int ff_vvc_merge_gpm_partition_idx(VVCLocalContext *lc) |
| 1481 | { | 1486 | { |
| 1482 | int i = 0; | 1487 | return fixed_length_decode(&lc->ep->cc, 6); |
| 1483 | |||
| 1484 | for (int j = 0; j < 6; j++) | ||
| 1485 | i = (i << 1) | get_cabac_bypass(&lc->ep->cc); | ||
| 1486 | |||
| 1487 | return i; | ||
| 1488 | } | 1488 | } |
| 1489 | 1489 | ||
| 1490 | int ff_vvc_merge_gpm_idx(VVCLocalContext *lc, const int idx) | 1490 | int ff_vvc_merge_gpm_idx(VVCLocalContext *lc, const int idx) |