History

avcodec/vvc/ctu: refact out intra_data

Wu Jianhua committed 1 year ago

Commit 3ecf8f81 parent d0f91511 file · +40 −24Browse files

Unified · Split

libavcodec/vvc/ctu.c+40−24
@@ -1805,6 +1805,37 @@ static int inter_data(VVCLocalContext *lc) · 1804 unmodified lines
18051805 return ret;
18061806 }
18071807
1808+static int intra_data(VVCLocalContext *lc)
1809+{
1810+ const VVCFrameContext *fc = lc->fc;
1811+ const VVCSPS *sps = lc->fc->ps.sps;
1812+ const CodingUnit *cu = lc->cu;
1813+ const VVCTreeType tree_type = cu->tree_type;
1814+ const bool pred_mode_plt_flag = cu->pred_mode == MODE_PLT;
1815+ int ret = 0;
1816+
1817+ if (tree_type == SINGLE_TREE || tree_type == DUAL_TREE_LUMA) {
1818+ if (pred_mode_plt_flag) {
1819+ avpriv_report_missing_feature(fc->log_ctx, "Palette");
1820+ return AVERROR_PATCHWELCOME;
1821+ } else {
1822+ intra_luma_pred_modes(lc);
1823+ ff_vvc_set_intra_mvf(lc, false, PF_INTRA, cu->ciip_flag);
1824+ }
1825+ }
1826+ if ((tree_type == SINGLE_TREE || tree_type == DUAL_TREE_CHROMA) && sps->r->sps_chroma_format_idc) {
1827+ if (pred_mode_plt_flag && tree_type == DUAL_TREE_CHROMA) {
1828+ avpriv_report_missing_feature(fc->log_ctx, "Palette");
1829+ return AVERROR_PATCHWELCOME;
1830+ } else if (!pred_mode_plt_flag) {
1831+ if (!cu->act_enabled_flag)
1832+ intra_chroma_pred_modes(lc);
1833+ }
1834+ }
1835+
1836+ return ret;
1837+}
1838+
18081839 static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, int cb_height,
18091840 int cqt_depth, const VVCTreeType tree_type, VVCModeType mode_type)
18101841 {
@@ -1815,7 +1846,7 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, in · 4 unmodified lines
18151846 const int vs = sps->vshift[CHROMA];
18161847 const int is_128 = cb_width > 64 || cb_height > 64;
18171848 int pred_mode_plt_flag = 0;
1818− int ret;
1849+ int ret = 0;
18191850
18201851 CodingUnit *cu = add_cu(lc, x0, y0, cb_width, cb_height, cqt_depth, tree_type);
18211852
@@ -1842,29 +1873,14 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, in · 20 unmodified lines
18421873 avpriv_report_missing_feature(fc->log_ctx, "Adaptive Color Transform");
18431874 return AVERROR_PATCHWELCOME;
18441875 }
1845− if (cu->pred_mode == MODE_INTRA || cu->pred_mode == MODE_PLT) {
1846− if (tree_type == SINGLE_TREE || tree_type == DUAL_TREE_LUMA) {
1847− if (pred_mode_plt_flag) {
1848− avpriv_report_missing_feature(fc->log_ctx, "Palette");
1849− return AVERROR_PATCHWELCOME;
1850− } else {
1851− intra_luma_pred_modes(lc);
1852− ff_vvc_set_intra_mvf(lc, false, PF_INTRA, cu->ciip_flag);
1853− }
1854− }
1855− if ((tree_type == SINGLE_TREE || tree_type == DUAL_TREE_CHROMA) && sps->r->sps_chroma_format_idc) {
1856− if (pred_mode_plt_flag && tree_type == DUAL_TREE_CHROMA) {
1857− avpriv_report_missing_feature(fc->log_ctx, "Palette");
1858− return AVERROR_PATCHWELCOME;
1859− } else if (!pred_mode_plt_flag) {
1860− if (!cu->act_enabled_flag)
1861− intra_chroma_pred_modes(lc);
1862− }
1863− }
1864− } else if (tree_type != DUAL_TREE_CHROMA) { /* MODE_INTER or MODE_IBC */
1865− if ((ret = inter_data(lc)) < 0)
1866− return ret;
1867− }
1876+ if (cu->pred_mode == MODE_INTRA || cu->pred_mode == MODE_PLT)
1877+ ret = intra_data(lc);
1878+ else if (tree_type != DUAL_TREE_CHROMA) /* MODE_INTER or MODE_IBC */
1879+ ret = inter_data(lc);
1880+
1881+ if (ret < 0)
1882+ return ret;
1883+
18681884 if (cu->pred_mode != MODE_INTRA && !pred_mode_plt_flag && !lc->cu->pu.general_merge_flag)
18691885 cu->coded_flag = ff_vvc_cu_coded_flag(lc);
18701886 else

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