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
30#define PROF_TEMP_OFFSET (MAX_PB_SIZE + 32)30#define PROF_TEMP_OFFSET (MAX_PB_SIZE + 32)
31static const int bcw_w_lut[] = {4, 5, 3, 10, -2};31static const int bcw_w_lut[] = {4, 5, 3, 10, -2};
32 32
33static int emulated_edge(const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride,33static void subpic_offset(int *x_off, int *y_off,
34 const int x_off, const int y_off, const int block_w, const int block_h, const int is_luma)34 const VVCSPS *sps, const VVCPPS *pps, const int subpic_idx, const int is_luma)
35{35{
36 const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE;36 *x_off -= pps->subpic_x[subpic_idx] >> sps->hshift[!is_luma];
37 const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER;37 *y_off -= pps->subpic_y[subpic_idx] >> sps->vshift[!is_luma];
38 const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA;38}
39 const int pic_width = is_luma ? fc->ps.pps->width : (fc->ps.pps->width >> fc->ps.sps->hshift[1]);39
40 const int pic_height = is_luma ? fc->ps.pps->height : (fc->ps.pps->height >> fc->ps.sps->vshift[1]);40static 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
47static 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);
41 61
42 if (x_off < extra_before || y_off < extra_before ||62 if (x_off < extra_before || y_off < extra_before ||
43 x_off >= pic_width - block_w - extra_after ||63 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
57 return 0;77 return 0;
58}78}
59 79
60static void emulated_edge_dmvr(const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride,80static void emulated_edge_dmvr(const VVCLocalContext *lc, 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)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)
62{82{
63 const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE;83 const VVCFrameContext *fc = lc->fc;
64 const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER;84 const VVCSPS *sps = fc->ps.sps;
65 const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA;85 const VVCPPS *pps = fc->ps.pps;
66 const int pic_width = is_luma ? fc->ps.pps->width : (fc->ps.pps->width >> fc->ps.sps->hshift[1]);86 const int subpic_idx = lc->sc->sh.r->curr_subpic_idx;
67 const int pic_height = is_luma ? fc->ps.pps->height : (fc->ps.pps->height >> fc->ps.sps->vshift[1]);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);
68 95
69 if (x_off < extra_before || y_off < extra_before ||96 if (x_off < extra_before || y_off < extra_before ||
70 x_off >= pic_width - block_w - extra_after ||97 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
88 }115 }
89}116}
90 117
91static void emulated_edge_bilinear(const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride,118static void emulated_edge_bilinear(const VVCLocalContext *lc, 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)119 int x_off, int y_off, const int block_w, const int block_h)
93{120{
94 int pic_width = fc->ps.pps->width;121 const VVCFrameContext *fc = lc->fc;
95 int pic_height = fc->ps.pps->height;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);
96 129
97 if (x_off < BILINEAR_EXTRA_BEFORE || y_off < BILINEAR_EXTRA_BEFORE ||130 if (x_off < BILINEAR_EXTRA_BEFORE || y_off < BILINEAR_EXTRA_BEFORE ||
98 x_off >= pic_width - block_w - BILINEAR_EXTRA_AFTER ||131 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
111 144
112 145
113#define EMULATED_EDGE_LUMA(dst, src, src_stride, x_off, y_off) \146#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)
115 148
116#define EMULATED_EDGE_CHROMA(dst, src, src_stride, x_off, y_off) \149#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)
118 151
119#define EMULATED_EDGE_DMVR_LUMA(dst, src, src_stride, x_sb, y_sb, x_off, y_off) \152#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)
121 154
122#define EMULATED_EDGE_DMVR_CHROMA(dst, src, src_stride, x_sb, y_sb, x_off, y_off) \155#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)
124 157
125#define EMULATED_EDGE_BILINEAR(dst, src, src_stride, x_off, y_off) \158#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)
127 160
128// part of 8.5.6.6 Weighted sample prediction process161// part of 8.5.6.6 Weighted sample prediction process
129static int derive_weight_uni(int *denom, int *wx, int *ox,162static 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