History

avcodec/vvcdec: inter prediction, support subpicture

passed files: LMCS_B_Dolby_2.bit CodingToolsSets_E_Tencent_1.bit SUBPIC_A_HUAWEI_3.bit SUBPIC_B_HUAWEI_3.bit SUBPIC_C_ERICSSON_1.bit SUBPIC_D_ERICSSON_1.bit SUBPIC_E_MediaTek_1.bit passed dvb conformance files (https://dvb.org/specifications/verification-validation/vvc-test-content): VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_mosaic.bit VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_PiP.bit

Nuo Mi committed 2 years ago

Commit 238bb651 parent 9bc3f3e1 file · +56 −23Browse files

Unified · Split

libavcodec/vvc/vvc_inter.c+56−23
@@ -30,14 +30,34 @@ · 29 unmodified lines
3030 #define PROF_TEMP_OFFSET (MAX_PB_SIZE + 32)
3131 static const int bcw_w_lut[] = {4, 5, 3, 10, -2};
3232
33−static int emulated_edge(const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride,
34− const int x_off, const int y_off, const int block_w, const int block_h, const int is_luma)
33+static void subpic_offset(int *x_off, int *y_off,
34+ const VVCSPS *sps, const VVCPPS *pps, const int subpic_idx, const int is_luma)
3535 {
36− const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE;
37− const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER;
38− const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA;
39− const int pic_width = is_luma ? fc->ps.pps->width : (fc->ps.pps->width >> fc->ps.sps->hshift[1]);
40− const int pic_height = is_luma ? fc->ps.pps->height : (fc->ps.pps->height >> fc->ps.sps->vshift[1]);
36+ *x_off -= pps->subpic_x[subpic_idx] >> sps->hshift[!is_luma];
37+ *y_off -= pps->subpic_y[subpic_idx] >> sps->vshift[!is_luma];
38+}
39+
40+static void subpic_width_height(int *pic_width, int *pic_height,
41+ const VVCSPS *sps, const VVCPPS *pps, const int subpic_idx, const int is_luma)
42+{
43+ *pic_width = pps->subpic_width[subpic_idx] >> sps->hshift[!is_luma];
44+ *pic_height = pps->subpic_height[subpic_idx] >> sps->vshift[!is_luma];
45+}
46+
47+static int emulated_edge(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride,
48+ int x_off, int y_off, const int block_w, const int block_h, const int is_luma)
49+{
50+ const VVCFrameContext *fc = lc->fc;
51+ const VVCSPS *sps = fc->ps.sps;
52+ const VVCPPS *pps = fc->ps.pps;
53+ const int subpic_idx = lc->sc->sh.r->curr_subpic_idx;
54+ const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE;
55+ const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER;
56+ const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA;
57+ int pic_width, pic_height;
58+
59+ subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, is_luma);
60+ subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, is_luma);
4161
4262 if (x_off < extra_before || y_off < extra_before ||
4363 x_off >= pic_width - block_w - extra_after ||
@@ -57,14 +77,21 @@ static int emulated_edge(const VVCFrameContext *fc, uint8_t *dst, const uint8_t · 13 unmodified lines
5777 return 0;
5878 }
5979
60−static void emulated_edge_dmvr(const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride,
61− const int x_sb, const int y_sb, const int x_off, const int y_off, const int block_w, const int block_h, const int is_luma)
80+static void emulated_edge_dmvr(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride,
81+ int x_sb, int y_sb, int x_off, int y_off, const int block_w, const int block_h, const int is_luma)
6282 {
63− const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE;
64− const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER;
65− const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA;
66− const int pic_width = is_luma ? fc->ps.pps->width : (fc->ps.pps->width >> fc->ps.sps->hshift[1]);
67− const int pic_height = is_luma ? fc->ps.pps->height : (fc->ps.pps->height >> fc->ps.sps->vshift[1]);
83+ const VVCFrameContext *fc = lc->fc;
84+ const VVCSPS *sps = fc->ps.sps;
85+ const VVCPPS *pps = fc->ps.pps;
86+ const int subpic_idx = lc->sc->sh.r->curr_subpic_idx;
87+ const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE;
88+ const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER;
89+ const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA;
90+ int pic_width, pic_height;
91+
92+ subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, is_luma);
93+ subpic_offset(&x_sb, &y_sb, sps, pps, subpic_idx, is_luma);
94+ subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, is_luma);
6895
6996 if (x_off < extra_before || y_off < extra_before ||
7097 x_off >= pic_width - block_w - extra_after ||
@@ -88,11 +115,17 @@ static void emulated_edge_dmvr(const VVCFrameContext *fc, uint8_t *dst, const ui · 17 unmodified lines
88115 }
89116 }
90117
91−static void emulated_edge_bilinear(const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride,
92− const int x_off, const int y_off, const int block_w, const int block_h)
118+static void emulated_edge_bilinear(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride,
119+ int x_off, int y_off, const int block_w, const int block_h)
93120 {
94− int pic_width = fc->ps.pps->width;
95− int pic_height = fc->ps.pps->height;
121+ const VVCFrameContext *fc = lc->fc;
122+ const VVCSPS *sps = fc->ps.sps;
123+ const VVCPPS *pps = fc->ps.pps;
124+ const int subpic_idx = lc->sc->sh.r->curr_subpic_idx;
125+ int pic_width, pic_height;
126+
127+ subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, 1);
128+ subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, 1);
96129
97130 if (x_off < BILINEAR_EXTRA_BEFORE || y_off < BILINEAR_EXTRA_BEFORE ||
98131 x_off >= pic_width - block_w - BILINEAR_EXTRA_AFTER ||
@@ -111,19 +144,19 @@ static void emulated_edge_bilinear(const VVCFrameContext *fc, uint8_t *dst, cons · 12 unmodified lines
111144
112145
113146 #define EMULATED_EDGE_LUMA(dst, src, src_stride, x_off, y_off) \
114− emulated_edge(fc, dst, src, src_stride, x_off, y_off, block_w, block_h, 1)
147+ emulated_edge(lc, dst, src, src_stride, x_off, y_off, block_w, block_h, 1)
115148
116149 #define EMULATED_EDGE_CHROMA(dst, src, src_stride, x_off, y_off) \
117− emulated_edge(fc, dst, src, src_stride, x_off, y_off, block_w, block_h, 0)
150+ emulated_edge(lc, dst, src, src_stride, x_off, y_off, block_w, block_h, 0)
118151
119152 #define EMULATED_EDGE_DMVR_LUMA(dst, src, src_stride, x_sb, y_sb, x_off, y_off) \
120− emulated_edge_dmvr(fc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 1)
153+ emulated_edge_dmvr(lc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 1)
121154
122155 #define EMULATED_EDGE_DMVR_CHROMA(dst, src, src_stride, x_sb, y_sb, x_off, y_off) \
123− emulated_edge_dmvr(fc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 0)
156+ emulated_edge_dmvr(lc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 0)
124157
125158 #define EMULATED_EDGE_BILINEAR(dst, src, src_stride, x_off, y_off) \
126− emulated_edge_bilinear(fc, dst, src, src_stride, x_off, y_off, pred_w, pred_h)
159+ emulated_edge_bilinear(lc, dst, src, src_stride, x_off, y_off, pred_w, pred_h)
127160
128161 // part of 8.5.6.6 Weighted sample prediction process
129162 static int derive_weight_uni(int *denom, int *wx, int *ox,

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