History

avcodec/vvc/ctu: should use the width and height of the start component

This commit fixed decoding the DUAL_TREE_CHROMA palette coding unit

Wu Jianhua committed 1 year ago

Commit 77b9b941 parent 35ea4581 file · +18 −11Browse files

Unified · Split

libavcodec/vvc/ctu.c+18−11
@@ -1966,7 +1966,7 @@ static void palette_qp(VVCLocalContext *lc, VVCTreeType tree_type, const bool es · 1965 unmodified lines
1966 u16[off] = pix; \1966 u16[off] = pix; \
1967 } while (0)1967 } while (0)
1968 1968
1969#define PALETTE_INDEX(x, y) index[(y) * cu->cb_width + (x)]1969#define PALETTE_INDEX(x, y) index[(y) * width + (x)]
1970 1970
1971// 6.5.3 Horizontal and vertical traverse scan order array initialization process1971// 6.5.3 Horizontal and vertical traverse scan order array initialization process
1972// The hTravScan and vTravScan tables require approximately 576 KB of memory.1972// The hTravScan and vTravScan tables require approximately 576 KB of memory.
@@ -1984,12 +1984,15 @@ static int palette_subblock_data(VVCLocalContext *lc, · 11 unmodified lines
1984 const CodingUnit *cu = lc->cu;1984 const CodingUnit *cu = lc->cu;
1985 TransformUnit *tu = cu->tus.head;1985 TransformUnit *tu = cu->tus.head;
1986 const VVCSPS *sps = lc->fc->ps.sps;1986 const VVCSPS *sps = lc->fc->ps.sps;
1987 const int width = tu->tbs[0].tb_width;
1988 const int height = tu->tbs[0].tb_height;
1987 const int min_pos = subset_id << 4;1989 const int min_pos = subset_id << 4;
1988 const int max_pos = FFMIN(min_pos + 16, cu->cb_width * cu->cb_height);1990 const int max_pos = FFMIN(min_pos + 16, width * height);
1989 const int wmask = cu->cb_width - 1;1991 const int wmask = width - 1;
1990 const int hmask = cu->cb_height - 1;1992 const int hmask = height - 1;
1991 const int wlog2 = av_log2(cu->cb_width);1993 const int wlog2 = av_log2(width);
1992 const int hlog2 = av_log2(cu->cb_height);1994 const int hlog2 = av_log2(height);
1995 const int start_idx = tu->tbs[0].c_idx;
1993 const uint8_t esc = cu->plt[tu->tbs[0].c_idx].size;1996 const uint8_t esc = cu->plt[tu->tbs[0].c_idx].size;
1994 uint8_t run_copy[16] = { 0 };1997 uint8_t run_copy[16] = { 0 };
1995 1998
@@ -2040,10 +2043,11 @@ static int palette_subblock_data(VVCLocalContext *lc, · 44 unmodified lines
2040 2043
2041 for (int c = 0; c < tu->nb_tbs; c++) {2044 for (int c = 0; c < tu->nb_tbs; c++) {
2042 TransformBlock *tb = &tu->tbs[c];2045 TransformBlock *tb = &tu->tbs[c];
2043 const Palette *plt = cu->plt + tb->c_idx;2046 const int c_idx = tb->c_idx;
2047 const Palette *plt = &cu->plt[c_idx];
2044 const int scale = ff_vvc_palette_derive_scale(lc, tu, tb);2048 const int scale = ff_vvc_palette_derive_scale(lc, tu, tb);
2045 const int hs = sps->hshift[c];2049 const int hs = sps->hshift[c_idx] - sps->hshift[start_idx];
2046 const int vs = sps->vshift[c];2050 const int vs = sps->vshift[c_idx] - sps->vshift[start_idx];
2047 uint8_t *u8 = (uint8_t *)tb->coeffs;2051 uint8_t *u8 = (uint8_t *)tb->coeffs;
2048 uint16_t *u16 = (uint16_t *)tb->coeffs;2052 uint16_t *u16 = (uint16_t *)tb->coeffs;
2049 2053
@@ -2089,9 +2093,12 @@ static int hls_palette_coding(VVCLocalContext *lc, const VVCTreeType tree_type) · 39 unmodified lines
2089 uint8_t run_type[MAX_PALETTE_CU_SIZE * MAX_PALETTE_CU_SIZE];2093 uint8_t run_type[MAX_PALETTE_CU_SIZE * MAX_PALETTE_CU_SIZE];
2090 uint8_t index[MAX_PALETTE_CU_SIZE * MAX_PALETTE_CU_SIZE];2094 uint8_t index[MAX_PALETTE_CU_SIZE * MAX_PALETTE_CU_SIZE];
2091 2095
2096 TransformUnit *tu;
2097
2092 ff_vvc_channel_range(&start, &end, tree_type, sps->r->sps_chroma_format_idc);2098 ff_vvc_channel_range(&start, &end, tree_type, sps->r->sps_chroma_format_idc);
2093 2099
2094 if (!palette_add_tu(lc, start, end, tree_type))2100 tu = palette_add_tu(lc, start, end, tree_type);
2101 if (!tu)
2095 return AVERROR(ENOMEM);2102 return AVERROR(ENOMEM);
2096 2103
2097 predictor_size = pp[start].size;2104 predictor_size = pp[start].size;
@@ -2119,7 +2126,7 @@ static int hls_palette_coding(VVCLocalContext *lc, const VVCTreeType tree_type) · 21 unmodified lines
2119 palette_qp(lc, tree_type, escape_present);2126 palette_qp(lc, tree_type, escape_present);
2120 2127
2121 index[0] = 0;2128 index[0] = 0;
2122 for (int i = 0; i <= (cu->cb_width * cu->cb_height - 1) >> 4; i++) {2129 for (int i = 0; i <= (tu->tbs[0].tb_width * tu->tbs[0].tb_height - 1) >> 4; i++) {
2123 ret = palette_subblock_data(lc, max_index, i, transpose,2130 ret = palette_subblock_data(lc, max_index, i, transpose,
2124 run_type, index, &prev_run_pos, &adjust);2131 run_type, index, &prev_run_pos, &adjust);
2125 if (ret < 0)2132 if (ret < 0)

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