History

avcodec/vvc/cabac: add 9.3.3.7 Fixed-length binarization process

Wu Jianhua committed 1 year ago

Commit a7320ef1 parent 02fe29f1 file · +14 −14Browse files

Unified · Split

libavcodec/vvc/cabac.c+14−14
@@ -968,6 +968,17 @@ static int limited_kth_order_egk_decode(CABACContext *c, const int k, const int · 967 unmodified lines
968968 return val;
969969 }
970970
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+
971982 static av_always_inline
972983 void get_left_top(const VVCLocalContext *lc, uint8_t *left, uint8_t *top,
973984 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
10111022
10121023 int ff_vvc_sao_band_position_decode(VVCLocalContext *lc)
10131024 {
1014− int value = get_cabac_bypass(&lc->ep->cc);
1015−
1016− for (int i = 0; i < 4; i++)
1017− value = (value << 1) | get_cabac_bypass(&lc->ep->cc);
1018− return value;
1025+ return fixed_length_decode(&lc->ep->cc, 5);
10191026 }
10201027
10211028 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
10351042
10361043 int ff_vvc_sao_eo_class_decode(VVCLocalContext *lc)
10371044 {
1038− int ret = get_cabac_bypass(&lc->ep->cc) << 1;
1039− ret |= get_cabac_bypass(&lc->ep->cc);
1040− return ret;
1045+ return (get_cabac_bypass(&lc->ep->cc) << 1) | get_cabac_bypass(&lc->ep->cc);
10411046 }
10421047
10431048 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
14791484
14801485 int ff_vvc_merge_gpm_partition_idx(VVCLocalContext *lc)
14811486 {
1482− int i = 0;
1483−
1484− for (int j = 0; j < 6; j++)
1485− i = (i << 1) | get_cabac_bypass(&lc->ep->cc);
1486−
1487− return i;
1487+ return fixed_length_decode(&lc->ep->cc, 6);
14881488 }
14891489
14901490 int ff_vvc_merge_gpm_idx(VVCLocalContext *lc, const int idx)

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