History

avcodec/vvc/ctu: fix derive_chroma_intra_pred_mode

See 8.4.3 Derivation process for chroma intra prediction mode

Wu Jianhua committed 1 year ago

Commit d00a2491 parent c58357e1 file · +30 −27Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/vvc/ctu.c+30−27
@@ -895,7 +895,7 @@ static void derive_chroma_intra_pred_mode(VVCLocalContext *lc, · 894 unmodified lines
895 enum IntraPredMode luma_intra_pred_mode = SAMPLE_CTB(fc->tab.ipm, x_cb, y_cb);895 enum IntraPredMode luma_intra_pred_mode = SAMPLE_CTB(fc->tab.ipm, x_cb, y_cb);
896 896
897 if (cu->tree_type == SINGLE_TREE && sps->r->sps_chroma_format_idc == CHROMA_FORMAT_444 &&897 if (cu->tree_type == SINGLE_TREE && sps->r->sps_chroma_format_idc == CHROMA_FORMAT_444 &&
898 intra_chroma_pred_mode == 4 && intra_mip_flag) {898 (intra_chroma_pred_mode == 4 || cu->act_enabled_flag) && intra_mip_flag) {
899 cu->mip_chroma_direct_flag = 1;899 cu->mip_chroma_direct_flag = 1;
900 cu->intra_pred_mode_c = luma_intra_pred_mode;900 cu->intra_pred_mode_c = luma_intra_pred_mode;
901 return;901 return;
@@ -1007,34 +1007,38 @@ static void intra_luma_pred_modes(VVCLocalContext *lc) · 105 unmodified lines
1007 1007
1008static void intra_chroma_pred_modes(VVCLocalContext *lc)1008static void intra_chroma_pred_modes(VVCLocalContext *lc)
1009{1009{
1010 const VVCSPS *sps = lc->fc->ps.sps;1010 const VVCSPS *sps = lc->fc->ps.sps;
1011 CodingUnit *cu = lc->cu;1011 CodingUnit *cu = lc->cu;
1012 const int hs = sps->hshift[CHROMA];1012 const int hs = sps->hshift[CHROMA];
1013 const int vs = sps->vshift[CHROMA];1013 const int vs = sps->vshift[CHROMA];
1014 int cclm_mode_flag = 0;
1015 int cclm_mode_idx = 0;
1016 int intra_chroma_pred_mode = 0;
1017
1018 if (!cu->act_enabled_flag) {
1019 cu->mip_chroma_direct_flag = 0;
1020 if (sps->r->sps_bdpcm_enabled_flag &&
1021 (cu->cb_width >> hs) <= sps->max_ts_size &&
1022 (cu->cb_height >> vs) <= sps->max_ts_size) {
1023 cu->bdpcm_flag[CB] = cu->bdpcm_flag[CR] = ff_vvc_intra_bdpcm_chroma_flag(lc);
1024 }
1025 if (cu->bdpcm_flag[CHROMA]) {
1026 cu->intra_pred_mode_c = ff_vvc_intra_bdpcm_chroma_dir_flag(lc) ? INTRA_VERT : INTRA_HORZ;
1027 } else {
1028 const int cclm_enabled = get_cclm_enabled(lc, cu->x0, cu->y0);
1014 1029
1015 cu->mip_chroma_direct_flag = 0;1030 if (cclm_enabled)
1016 if (sps->r->sps_bdpcm_enabled_flag &&1031 cclm_mode_flag = ff_vvc_cclm_mode_flag(lc);
1017 (cu->cb_width >> hs) <= sps->max_ts_size &&
1018 (cu->cb_height >> vs) <= sps->max_ts_size) {
1019 cu->bdpcm_flag[CB] = cu->bdpcm_flag[CR] = ff_vvc_intra_bdpcm_chroma_flag(lc);
1020 }
1021 if (cu->bdpcm_flag[CHROMA]) {
1022 cu->intra_pred_mode_c = ff_vvc_intra_bdpcm_chroma_dir_flag(lc) ? INTRA_VERT : INTRA_HORZ;
1023 } else {
1024 const int cclm_enabled = get_cclm_enabled(lc, cu->x0, cu->y0);
1025 int cclm_mode_flag = 0;
1026 int cclm_mode_idx = 0;
1027 int intra_chroma_pred_mode = 0;
1028 1032
1029 if (cclm_enabled)1033 if (cclm_mode_flag)
1030 cclm_mode_flag = ff_vvc_cclm_mode_flag(lc);1034 cclm_mode_idx = ff_vvc_cclm_mode_idx(lc);
1035 else
1036 intra_chroma_pred_mode = ff_vvc_intra_chroma_pred_mode(lc);
1037 }
1038 }
1031 1039
1032 if (cclm_mode_flag)1040 if (!cu->bdpcm_flag[CHROMA])
1033 cclm_mode_idx = ff_vvc_cclm_mode_idx(lc);
1034 else
1035 intra_chroma_pred_mode = ff_vvc_intra_chroma_pred_mode(lc);
1036 derive_chroma_intra_pred_mode(lc, cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode);1041 derive_chroma_intra_pred_mode(lc, cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode);
1037 }
1038}1042}
1039 1043
1040static PredMode pred_mode_decode(VVCLocalContext *lc,1044static PredMode pred_mode_decode(VVCLocalContext *lc,
@@ -2122,8 +2126,7 @@ static int intra_data(VVCLocalContext *lc) · 1081 unmodified lines
2122 if ((ret = hls_palette_coding(lc, tree_type)) < 0)2126 if ((ret = hls_palette_coding(lc, tree_type)) < 0)
2123 return ret;2127 return ret;
2124 } else if (!pred_mode_plt_flag) {2128 } else if (!pred_mode_plt_flag) {
2125 if (!cu->act_enabled_flag)2129 intra_chroma_pred_modes(lc);
2126 intra_chroma_pred_modes(lc);
2127 }2130 }
2128 }2131 }
2129 2132

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