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
968 return val;968 return val;
969}969}
970 970
971// 9.3.3.7 Fixed-length binarization process
972static 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
971static av_always_inline982static av_always_inline
972void get_left_top(const VVCLocalContext *lc, uint8_t *left, uint8_t *top,983void 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
1012int ff_vvc_sao_band_position_decode(VVCLocalContext *lc)1023int 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
1021int ff_vvc_sao_offset_abs_decode(VVCLocalContext *lc)1028int 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
1036int ff_vvc_sao_eo_class_decode(VVCLocalContext *lc)1043int 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
1043int ff_vvc_alf_ctb_flag(VVCLocalContext *lc, const int rx, const int ry, const int c_idx)1048int 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
1480int ff_vvc_merge_gpm_partition_idx(VVCLocalContext *lc)1485int 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
1490int ff_vvc_merge_gpm_idx(VVCLocalContext *lc, const int idx)1490int 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