30#define PROF_TEMP_OFFSET (MAX_PB_SIZE + 32)
33#define HIGHBD_MULTIPLIER(bd) (((bd) + 2) >> 3)
39 const int hs =
sps->hshift[is_chroma];
40 const int vs =
sps->vshift[is_chroma];
42 r->l =
pps->subpic_x[subpic_idx] >> hs;
43 r->t =
pps->subpic_y[subpic_idx] >> vs;
44 r->r =
r->l + (
pps->subpic_width[subpic_idx] >> hs);
45 r->b =
r->t + (
pps->subpic_height[subpic_idx] >> vs);
51 const int l = dmvr_clip ?
FFMIN(
FFMAX(subpic->
l, sb->
l), subpic->
r - 1) : subpic->
l;
52 const int t = dmvr_clip ?
FFMIN(
FFMAX(subpic->
t, sb->
t), subpic->
b - 1) : subpic->
t;
53 const int r = dmvr_clip ?
FFMAX(
FFMIN(subpic->
r, sb->
r), subpic->
l + 1) : subpic->
r;
54 const int b = dmvr_clip ?
FFMAX(
FFMIN(subpic->
b, sb->
b), subpic->
t + 1) : subpic->
b;
63 const uint8_t **
src, ptrdiff_t *src_stride,
64 int x_off,
int y_off,
const int block_w,
const int block_h,
65 const int extra_before,
const int extra_after,
69 const int extra = extra_before + extra_after;
70 int pic_width, pic_height;
72 *
src += y_off * *src_stride + (x_off * (1 <<
fc->ps.sps->pixel_shift));
74 clip_to_subpic(&x_off, &y_off, &pic_width, &pic_height, subpic, sb, dmvr_clip);
76 if (dmvr_clip || x_off < extra_before || y_off < extra_before ||
77 x_off >= pic_width - block_w - extra_after ||
78 y_off >= pic_height - block_h - extra_after) {
79 const int ps =
fc->ps.sps->pixel_shift;
81 const int offset = extra_before * *src_stride + (extra_before << ps);
82 const int buf_offset = extra_before * edge_emu_stride + (extra_before << ps);
84 fc->vdsp.emulated_edge_mc(
dst, *
src -
offset, edge_emu_stride, *src_stride,
85 block_w + extra, block_h + extra, x_off - extra_before, y_off - extra_before,
86 pic_width, pic_height);
89 *src_stride = edge_emu_stride;
94 const uint8_t *
src,
const ptrdiff_t src_stride,
const int ps,
95 int x_off,
int y_off,
const int block_w,
const int block_h,
99 int pic_width, pic_height;
101 src += y_off * src_stride + x_off * (1 << ps);
103 clip_to_subpic(&x_off, &y_off, &pic_width, &pic_height, subpic, half_sb, dmvr_clip);
105 fc->vdsp.emulated_edge_mc(
dst,
src, dst_stride, src_stride,
106 block_w, block_h, x_off, y_off, pic_width, pic_height);
121 const uint8_t **
src, ptrdiff_t *src_stride,
const VVCFrame *src_frame,
122 int x_sb,
int y_sb,
int x_off,
int y_off,
int block_w,
int block_h,
const int wrap_enabled,
123 const int is_chroma,
const int extra_before,
const int extra_after)
127 const int ps =
sps->pixel_shift;
129 const int extra = extra_before + extra_after;
130 const int dmvr_clip = x_sb != x_off || y_sb != y_off;
131 const int dmvr_left =
FFMAX(x_off, x_sb) - extra_before;
132 const int dmvr_right =
FFMIN(x_off, x_sb) + block_w + extra_after;
133 const int left = x_off - extra_before;
134 const int top = y_off - extra_before;
135 const int pic_width =
pps->width >>
sps->hshift[is_chroma];
136 const int wrap =
pps->ref_wraparound_offset << (
sps->min_cb_log2_size_y -
sps->hshift[is_chroma]);
138 VVCRect sb = { x_sb - extra_before, y_sb - extra_before, x_sb + block_w + extra_after, y_sb + block_h + extra_after };
143 if (!wrap_enabled || (dmvr_left >= 0 && dmvr_right <= pic_width)) {
145 x_off, y_off, block_w, block_h, extra_before, extra_after, &subpic, &sb, dmvr_clip);
148 if (dmvr_right <= 0) {
151 x_off +
wrap, y_off, block_w, block_h, extra_before, extra_after, &subpic, &sb, dmvr_clip);
154 if (dmvr_left >= pic_width) {
157 x_off -
wrap, y_off, block_w, block_h, extra_before, extra_after, &subpic, &sb, dmvr_clip);
165 if (dmvr_left < 0 ) {
169 left +
wrap, top,
w, block_h, &subpic, &half_sb, dmvr_clip);
173 0, top, block_w -
w, block_h, &subpic, &half_sb, dmvr_clip);
175 const int w = pic_width -
left;
176 VVCRect half_sb = { sb.
l, sb.
t, pic_width, sb.
b };
178 left, top,
w, block_h, &subpic, &half_sb, dmvr_clip);
182 pic_width -
wrap , top, block_w -
w, block_h, &subpic, &half_sb, dmvr_clip);
185 *
src =
dst + extra_before * dst_stride + (extra_before << ps);
186 *src_stride = dst_stride;
189#define MC_EMULATED_EDGE(dst, src, src_stride, x_off, y_off) \
190 emulated_edge(lc, dst, src, src_stride, ref, x_off, y_off, x_off, y_off, block_w, block_h, wrap_enabled, is_chroma, \
191 is_chroma ? CHROMA_EXTRA_BEFORE : LUMA_EXTRA_BEFORE, is_chroma ? CHROMA_EXTRA_AFTER : LUMA_EXTRA_AFTER)
193#define MC_EMULATED_EDGE_DMVR(dst, src, src_stride, x_sb, y_sb, x_off, y_off) \
194 emulated_edge(lc, dst, src, src_stride, ref, x_sb, y_sb, x_off, y_off, block_w, block_h, wrap_enabled, is_chroma, \
195 is_chroma ? CHROMA_EXTRA_BEFORE : LUMA_EXTRA_BEFORE, is_chroma ? CHROMA_EXTRA_AFTER : LUMA_EXTRA_AFTER)
197#define MC_EMULATED_EDGE_BILINEAR(dst, src, src_stride, x_off, y_off) \
198 emulated_edge(lc, dst, src, src_stride, ref, x_off, y_off, x_off, y_off, pred_w, pred_h, wrap_enabled, 0, \
199 BILINEAR_EXTRA_BEFORE, BILINEAR_EXTRA_AFTER)
208 const int weight_flag = (
IS_P(sh->
r) &&
pps->r->pps_weighted_pred_flag) ||
209 (
IS_B(sh->
r) &&
pps->r->pps_weighted_bipred_flag);
214 *denom =
w->log2_denom[c_idx > 0];
215 *wx =
w->weight[lx][c_idx][mvf->
ref_idx[lx]];
216 *ox =
w->offset[lx][c_idx][mvf->
ref_idx[lx]];
229 const int bcw_idx = mvf->
bcw_idx;
231 const int weight_flag =
pps->r->pps_weighted_bipred_flag && !dmvr_flag;
232 if ((!weight_flag && !bcw_idx) || (bcw_idx && lc->
cu->
ciip_flag)) {
237 int denom, w0, w1, o;
246 denom =
w->log2_denom[c_idx > 0];
255#define INTER_FILTER(t, frac) (is_chroma ? ff_vvc_inter_chroma_filters[t][frac] : ff_vvc_inter_luma_filters[t][frac])
258 int x_off,
int y_off,
const int block_w,
const int block_h,
const int c_idx)
262 const uint8_t *
src =
ref->frame->data[c_idx];
263 ptrdiff_t src_stride =
ref->frame->linesize[c_idx];
264 const int is_chroma = !!c_idx;
265 const int hs =
fc->ps.sps->hshift[c_idx];
266 const int vs =
fc->ps.sps->vshift[c_idx];
267 const int idx =
av_log2(block_w) - 1;
273 const int wrap_enabled =
fc->ps.pps->r->pps_ref_wraparound_enabled_flag;
275 x_off +=
mv->x >> (4 + hs);
276 y_off +=
mv->y >> (4 + vs);
279 fc->vvcdsp.inter.put[is_chroma][idx][!!
my][!!
mx](
dst,
src, src_stride, block_h,
hf,
vf, block_w);
283 const VVCFrame *
ref,
const MvField *mvf,
int x_off,
int y_off,
const int block_w,
const int block_h,
288 const uint8_t *
src =
ref->frame->data[c_idx];
289 ptrdiff_t src_stride =
ref->frame->linesize[c_idx];
291 const int hs =
fc->ps.sps->hshift[c_idx];
292 const int vs =
fc->ps.sps->vshift[c_idx];
293 const int idx =
av_log2(block_w) - 1;
294 const Mv *
mv = &mvf->
mv[lx];
295 const int is_chroma = !!c_idx;
301 const int wrap_enabled =
fc->ps.pps->r->pps_ref_wraparound_enabled_flag;
304 x_off +=
mv->x >> (4 + hs);
305 y_off +=
mv->y >> (4 + vs);
309 fc->vvcdsp.inter.put_uni_w[is_chroma][idx][!!
my][!!
mx](
dst, dst_stride,
src, src_stride,
310 block_h, denom, wx, ox,
hf,
vf, block_w);
312 fc->vvcdsp.inter.put_uni[is_chroma][idx][!!
my][!!
mx](
dst, dst_stride,
src, src_stride,
313 block_h,
hf,
vf, block_w);
319 const int x_off,
const int y_off,
const int block_w,
const int block_h,
const int c_idx,
320 const int sb_bdof_flag)
324 const int hs =
fc->ps.sps->hshift[c_idx];
325 const int vs =
fc->ps.sps->vshift[c_idx];
326 const int idx =
av_log2(block_w) - 1;
328 const VVCFrame *refs[] = { ref0, ref1 };
330 const int is_chroma = !!c_idx;
333 for (
int i =
L0;
i <=
L1;
i++) {
337 const int ox = x_off + (
mv->x >> (4 + hs));
338 const int oy = y_off + (
mv->y >> (4 + vs));
340 ptrdiff_t src_stride =
ref->frame->linesize[c_idx];
341 const uint8_t *
src =
ref->frame->data[c_idx];
344 const int wrap_enabled =
fc->ps.pps->r->pps_ref_wraparound_enabled_flag;
347 const int x_sb = x_off + (orig_mv->
mv[
i].
x >> (4 + hs));
348 const int y_sb = y_off + (orig_mv->
mv[
i].
y >> (4 + vs));
354 fc->vvcdsp.inter.put[is_chroma][idx][!!
my][!!
mx](
tmp[
i],
src, src_stride, block_h,
hf,
vf, block_w);
356 fc->vvcdsp.inter.bdof_fetch_samples(
tmp[
i],
src, src_stride,
mx,
my, block_w, block_h);
359 fc->vvcdsp.inter.apply_bdof(
dst, dst_stride,
tmp[
L0],
tmp[
L1], block_w, block_h);
367#define SCALE_THRESHOLD_1 20480
368#define SCALE_THRESHOLD_2 28672
380#define INTER_FILTER_SCALED(scale) inter_filter_scaled(scale, is_chroma, is_affine)
382#define SCALED_CHROMA_ADDIN(scale, collocated_flag) (is_chroma ? (collocated_flag ? 0 : 8 * (scale - (1 << 14))) : 0)
384#define SCALED_REF_SB(off, scaling_off, ref_mv, scale, add, shift) (((((int64_t)(off) << (4 + shift)) - (scaling_off) * (1 << 4)) + ref_mv) * scale + add)
385#define SCALED_REF(ref_sb, offset, shift) (FFSIGN(ref_sb) * ((FFABS(ref_sb) + (128 << shift)) >> (8 + shift)) + (offset * (1 << (10 - shift))) + (32 >> is_chroma))
386#define SCALED_STEP(scale) ((scale + 8) >> 4)
389 int *x,
int *y,
int *dx,
int *dy)
393 const int is_chroma = !!c_idx;
394 const int hs =
sps->hshift[c_idx];
395 const int vs =
sps->vshift[c_idx];
396 const int left_offset =
fc->ref->scaling_win.left_offset;
397 const int top_offset =
fc->ref->scaling_win.top_offset;
410 const VVCFrame *
ref,
const int x,
const int y,
const int dx,
const int dy,
const int w,
const int h,
const int is_chroma)
418 const int block_w = x_end - x_off + (x_end == x_last);
419 const int block_h = *src_height = y_end - y_off + (y_end == y_last);
420 const int wrap_enabled = 0;
426 int x_off,
int y_off,
const int block_w,
const int block_h,
const int c_idx)
433 const int is_chroma = !!c_idx;
434 const int idx =
av_log2(block_w) - 1;
437 int x, y, dx, dy, src_height;
440 emulated_edge_scaled(lc, &
src, &src_stride, &src_height, refp->
ref, x, y, dx, dy, block_w, block_h, is_chroma);
441 fc->vvcdsp.inter.put_scaled[is_chroma][idx](
dst,
src, src_stride, src_height, x, y, dx, dy, block_h,
hf,
vf,
446 const MvField *mvf,
const int x_off,
const int y_off,
const int block_w,
const int block_h,
const int c_idx)
453 const Mv *
mv = &mvf->
mv[lx];
455 const int is_chroma = !!c_idx;
456 const int idx =
av_log2(block_w) - 1;
459 int denom, wx, ox, x, y, dx, dy, src_height;
462 emulated_edge_scaled(lc, &
src, &src_stride, &src_height, refp->
ref, x, y, dx, dy, block_w, block_h, is_chroma);
465 fc->vvcdsp.inter.put_uni_w_scaled[is_chroma][idx](
dst, dst_stride,
src, src_stride, src_height,
466 x, y, dx, dy, block_h, denom, wx, ox,
hf,
vf, block_w, lc->
pred.
scaled_tmp);
468 fc->vvcdsp.inter.put_uni_scaled[is_chroma][idx](
dst, dst_stride,
src, src_stride, src_height,
475 const int x_off,
const int y_off,
const int block_w,
const int block_h,
const int c_idx)
477 const VVCRefPic *refps[] = { refp0, refp1 };
480 for (
int i =
L0;
i <=
L1;
i++) {
485 mc_scaled(lc,
tmp[
i], refp,
mv, x_off, y_off, block_w, block_h, c_idx);
487 mc(lc,
tmp[
i], refp->
ref,
mv, x_off, y_off, block_w, block_h, c_idx);
494 const VVCFrame *
ref,
const MvField *mvf,
int x_off,
int y_off,
const int block_w,
const int block_h,
495 const int cb_prof_flag,
const int16_t *diff_mv_x,
const int16_t *diff_mv_y)
499 ptrdiff_t src_stride =
ref->frame->linesize[
LUMA];
501 const int idx =
av_log2(block_w) - 1;
503 const Mv *
mv = mvf->
mv + lx;
504 const int mx =
mv->x & 0xf;
505 const int my =
mv->y & 0xf;
510 const int wrap_enabled =
fc->ps.pps->r->pps_ref_wraparound_enabled_flag;
511 const int is_chroma = 0;
519 fc->vvcdsp.inter.fetch_samples(prof_tmp,
src, src_stride,
mx,
my);
521 fc->vvcdsp.inter.apply_prof_uni(
dst, dst_stride, prof_tmp, diff_mv_x, diff_mv_y);
523 fc->vvcdsp.inter.apply_prof_uni_w(
dst, dst_stride, prof_tmp, diff_mv_x, diff_mv_y, denom, wx, ox);
526 fc->vvcdsp.inter.put_uni[
LUMA][idx][!!
my][!!
mx](
dst, dst_stride,
src, src_stride, block_h,
hf,
vf, block_w);
528 fc->vvcdsp.inter.put_uni_w[
LUMA][idx][!!
my][!!
mx](
dst, dst_stride,
src, src_stride, block_h, denom, wx, ox,
hf,
vf, block_w);
533 const Mv *
mv ,
const int x_off,
const int y_off,
const int block_w,
const int block_h,
const int lx)
537 const int mx =
mv->x & 0xf;
538 const int my =
mv->y & 0xf;
539 const int ox = x_off + (
mv->x >> 4);
540 const int oy = y_off + (
mv->y >> 4);
541 const int idx =
av_log2(block_w) - 1;
542 const int is_chroma = 0;
544 ptrdiff_t src_stride =
ref->frame->linesize[
LUMA];
548 const int wrap_enabled =
fc->ps.pps->r->pps_ref_wraparound_enabled_flag;
555 fc->vvcdsp.inter.fetch_samples(prof_tmp,
src, src_stride,
mx,
my);
562 const int block_w,
const int block_h)
564 const VVCRefPic *refps[] = { ref0, ref1 };
567 for (
int i =
L0;
i <=
L1;
i++) {
585 if (
mv->pred_flag &
mask) {
587 refp[lx] = rpl[lx].
refs +
mv->ref_idx[lx];
595#define POS(c_idx, x, y) \
596 &fc->frame->data[c_idx][((y) >> fc->ps.sps->vshift[c_idx]) * fc->frame->linesize[c_idx] + \
597 (((x) >> fc->ps.sps->hshift[c_idx]) << fc->ps.sps->pixel_shift)]
614 const int c_end =
fc->ps.sps->r->sps_chroma_format_idc ? 3 : 1;
618 for (
int c_idx = 0; c_idx < c_end; c_idx++) {
619 const int hs =
fc->ps.sps->hshift[c_idx];
620 const int vs =
fc->ps.sps->vshift[c_idx];
621 const int x = lc->
cu->
x0 >> hs;
622 const int y = lc->
cu->
y0 >> vs;
626 ptrdiff_t dst_stride =
fc->frame->linesize[c_idx];
628 int step_x = 1 << hs;
632 }
else if (mirror_type == 1) {
640 for (
int i = 0;
i < 2;
i++) {
642 const int lx =
mv->pred_flag -
PF_L0;
666 const int min_pu_width =
fc->ps.pps->min_pu_width;
679 const int x0,
const int y0,
const int sbw,
const int sbh,
const int sb_bdof_flag,
const int c_start)
682 const int c_end =
fc->ps.sps->r->sps_chroma_format_idc ?
CR :
LUMA;
688 for (
int c_idx = c_start; c_idx <= c_end; c_idx++) {
689 uint8_t *
dst =
POS(c_idx, x0, y0);
690 const ptrdiff_t dst_stride =
fc->frame->linesize[c_idx];
691 const int hs =
fc->ps.sps->hshift[c_idx];
692 const int vs =
fc->ps.sps->vshift[c_idx];
693 const int x = x0 >> hs;
694 const int y = y0 >> vs;
695 const int w = sbw >> hs;
696 const int h = sbh >> vs;
697 const int is_luma = !c_idx;
698 const int do_ciip = lc->
cu->
ciip_flag && (is_luma || (
w > 2));
700 const ptrdiff_t inter_stride = do_ciip ? (
MAX_PB_SIZE *
sizeof(uint16_t)) : dst_stride;
701 const int do_bdof = is_luma && sb_bdof_flag;
706 if (refp[lx]->is_scaled) {
710 mc_uni(lc, inter, inter_stride, refp[lx]->
ref, mvf,
714 if (refp[
L0]->is_scaled || refp[
L1]->is_scaled) {
718 mc_bi(lc, inter, inter_stride, refp[
L0]->
ref, refp[
L1]->
ref, mvf, orig_mvf,
719 x, y,
w,
h, c_idx, do_bdof);
724 fc->vvcdsp.intra.intra_pred(lc, x0, y0, sbw, sbh, c_idx);
726 fc->vvcdsp.lmcs.filter(inter, inter_stride,
w,
h, &
fc->ps.lmcs.fwd_lut);
727 fc->vvcdsp.inter.put_ciip(
dst, dst_stride,
w,
h, inter, inter_stride, intra_weight);
735 const int sad_minus = sad[-
stride];
736 const int sad_center = sad[0];
737 const int sad_plus = sad[
stride];
739 int denom = (( sad_minus + sad_plus) - (sad_center << 1 ) ) << 3;
743 if (sad_minus == sad_center)
745 else if (sad_plus == sad_center)
748 int num = ( sad_minus - sad_plus ) * (1 << 4);
756 while (counter > 0) {
757 counter = counter - 1;
758 quotient = quotient << 1;
759 if (
num >= denom ) {
761 quotient = quotient + 1;
763 denom = (denom >> 1);
774#define SAD_ARRAY_SIZE 5
777 const VVCFrame *ref0,
const VVCFrame *ref1,
const int x_off,
const int y_off,
const int block_w,
const int block_h)
780 const int sr_range = 2;
781 const VVCFrame *refs[] = { ref0, ref1 };
784 int min_dx, min_dy, min_sad, dx, dy;
787 min_dx = min_dy = dx = dy = 2;
789 for (
int i =
L0;
i <=
L1;
i++) {
790 const int pred_w = block_w + 2 * sr_range;
791 const int pred_h = block_h + 2 * sr_range;
793 const int mx =
mv->x & 0xf;
794 const int my =
mv->y & 0xf;
795 const int ox = x_off + (
mv->x >> 4) - sr_range;
796 const int oy = y_off + (
mv->y >> 4) - sr_range;
798 ptrdiff_t src_stride =
ref->frame->linesize[
LUMA];
800 const int wrap_enabled =
fc->ps.pps->r->pps_ref_wraparound_enabled_flag;
806 min_sad =
fc->vvcdsp.inter.sad(
tmp[
L0],
tmp[
L1], dx, dy, block_w, block_h);
807 min_sad -= min_sad >> 2;
808 sad[dy][dx] = min_sad;
810 if (min_sad >= block_w * block_h) {
815 if (dx != sr_range || dy != sr_range) {
816 sad[dy][dx] =
fc->vvcdsp.inter.sad(lc->
pred.
tmp, lc->
pred.
tmp1, dx, dy, block_w, block_h);
817 if (sad[dy][dx] < min_sad) {
818 min_sad = sad[dy][dx];
825 dmv[0] = (min_dx - sr_range) * (1 << 4);
826 dmv[1] = (min_dy - sr_range) * (1 << 4);
827 if (min_dx != 0 && min_dx != 4 && min_dy != 0 && min_dy != 4) {
832 for (
int i =
L0;
i <=
L1;
i++) {
834 mv->x += (1 - 2 *
i) * dmv[0];
835 mv->y += (1 - 2 *
i) * dmv[1];
839 if (min_sad < 2 * block_w * block_h) {
853 fc->ref->tab_dmvr_mvf[idx] = *mvf;
859 const int x0,
const int y0,
const int sbw,
const int sbh)
882 int sbw, sbh, sb_bdof_flag = 0;
890 for (
int sby = 0; sby <
mi->num_sb_y; sby++) {
891 for (
int sbx = 0; sbx <
mi->num_sb_x; sbx++) {
892 const int x0 = cu->
x0 + sbx * sbw;
893 const int y0 = cu->
y0 + sby * sbh;
905 const int x0,
const int y0,
const int sbw,
const int sbh)
907 const int hs =
fc->ps.sps->hshift[1];
908 const int vs =
fc->ps.sps->vshift[1];
914 mvc->
mv[0].
x += (
unsigned int)mv2->
mv[0].
x;
915 mvc->
mv[0].
y += (
unsigned int)mv2->
mv[0].
y;
916 mvc->
mv[1].
x += (
unsigned int)mv2->
mv[1].
x;
917 mvc->
mv[1].
y += (
unsigned int)mv2->
mv[1].
y;
928 const int x0 = cu->
x0;
929 const int y0 = cu->
y0;
932 const int hs =
fc->ps.sps->hshift[1];
933 const int vs =
fc->ps.sps->vshift[1];
934 const int dst_stride =
fc->frame->linesize[
LUMA];
936 for (
int sby = 0; sby <
mi->num_sb_y; sby++) {
937 for (
int sbx = 0; sbx <
mi->num_sb_x; sbx++) {
938 const int x = x0 + sbx * sbw;
939 const int y = y0 + sby * sbh;
941 uint8_t *dst0 =
POS(0, x, y);
949 const int lx =
mi->pred_flag -
PF_L0;
950 if (refp[lx]->is_scaled) {
960 if (
fc->ps.sps->r->sps_chroma_format_idc) {
987 uint8_t* dst0 =
POS(0, cu->
x0, cu->
y0);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t my
uint8_t ptrdiff_t const uint8_t ptrdiff_t int const int8_t const int8_t * vf
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t mx
uint8_t ptrdiff_t const uint8_t ptrdiff_t int const int8_t * hf
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
#define i(width, name, range_min, range_max)
static int FUNC sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
void ff_vvc_set_neighbour_available(VVCLocalContext *lc, const int x0, const int y0, const int w, const int h)
#define AFFINE_MIN_BLOCK_SIZE
static const uint16_t fc[]
reference-counted frame API
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static const int weights[]
#define EDGE_EMU_BUFFER_STRIDE
static av_always_inline void scale(vec_s32 res[4], vec_s16 res_packed[2], const int shift)
#define HIGHBD_MULTIPLIER(bd)
static void dmvr_mv_refine(VVCLocalContext *lc, MvField *mvf, MvField *orig_mv, int *sb_bdof_flag, const VVCFrame *ref0, const VVCFrame *ref1, const int x_off, const int y_off, const int block_w, const int block_h)
#define SCALED_CHROMA_ADDIN(scale, collocated_flag)
#define MC_EMULATED_EDGE_BILINEAR(dst, src, src_stride, x_off, y_off)
static void luma_prof_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const VVCFrame *ref, const MvField *mvf, int x_off, int y_off, const int block_w, const int block_h, const int cb_prof_flag, const int16_t *diff_mv_x, const int16_t *diff_mv_y)
static void derive_sb_mv(VVCLocalContext *lc, MvField *mv, MvField *orig_mv, int *sb_bdof_flag, const int x0, const int y0, const int sbw, const int sbh)
static int has_inter_luma(const CodingUnit *cu)
static void emulated_half(const VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const uint8_t *src, const ptrdiff_t src_stride, const int ps, int x_off, int y_off, const int block_w, const int block_h, const VVCRect *subpic, const VVCRect *half_sb, const int dmvr_clip)
static void set_dmvr_info(VVCFrameContext *fc, const int x0, const int y0, const int width, const int height, const MvField *mvf)
static int pred_get_refs(const VVCLocalContext *lc, VVCRefPic *refp[2], const MvField *mv)
static void luma_prof(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref, const Mv *mv, const int x_off, const int y_off, const int block_w, const int block_h, const int lx)
static void mc_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const VVCFrame *ref0, const VVCFrame *ref1, const MvField *mvf, const MvField *orig_mv, const int x_off, const int y_off, const int block_w, const int block_h, const int c_idx, const int sb_bdof_flag)
#define SCALE_THRESHOLD_1
static const int bcw_w_lut[]
#define SCALE_THRESHOLD_2
#define SCALED_STEP(scale)
static int ciip_derive_intra_weight(const VVCLocalContext *lc, const int x0, const int y0, const int width, const int height)
void ff_vvc_predict_ciip(VVCLocalContext *lc)
CIIP(Combined Inter-Intra Prediction) for a coding block.
static void emulated_edge(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, const VVCFrame *src_frame, int x_sb, int y_sb, int x_off, int y_off, int block_w, int block_h, const int wrap_enabled, const int is_chroma, const int extra_before, const int extra_after)
static void apply_averaging(uint8_t *dst, const ptrdiff_t dst_stride, const int16_t *src0, const int16_t *src1, int width, int height, const VVCLocalContext *lc, const MvField *mvf, const int c_idx, const int dmvr_flag)
static void scaled_ref_pos_and_step(const VVCLocalContext *lc, const VVCRefPic *refp, const Mv *mv, const int x_off, const int y_off, const int c_idx, int *x, int *y, int *dx, int *dy)
static void mc_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const VVCFrame *ref, const MvField *mvf, int x_off, int y_off, const int block_w, const int block_h, const int c_idx)
static void luma_prof_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const VVCRefPic *ref0, const VVCRefPic *ref1, const MvField *mvf, const int x_off, const int y_off, const int block_w, const int block_h)
static void subpic_get_rect(VVCRect *r, const VVCFrame *src_frame, const int subpic_idx, const int is_chroma)
static void derive_affine_mvc(MvField *mvc, const VVCFrameContext *fc, const MvField *mv, const int x0, const int y0, const int sbw, const int sbh)
#define MC_EMULATED_EDGE_DMVR(dst, src, src_stride, x_sb, y_sb, x_off, y_off)
static int parametric_mv_refine(const int *sad, const int stride)
static void pred_affine_blk(VVCLocalContext *lc)
#define SCALED_REF(ref_sb, offset, shift)
static void clip_to_subpic(int *x_off, int *y_off, int *pic_width, int *pic_height, const VVCRect *subpic, const VVCRect *sb, const int dmvr_clip)
static void sb_wrap(VVCRect *sb, const int wrap)
static void sb_set_lr(VVCRect *sb, const int l, const int r)
static void mc_uni_scaled(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const VVCRefPic *refp, const MvField *mvf, const int x_off, const int y_off, const int block_w, const int block_h, const int c_idx)
static const int8_t * inter_filter_scaled(const int scale, const int is_chroma, const int is_affine)
#define INTER_FILTER(t, frac)
static void emulated_edge_no_wrap(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, int x_off, int y_off, const int block_w, const int block_h, const int extra_before, const int extra_after, const VVCRect *subpic, const VVCRect *sb, const int dmvr_clip)
static void pred_regular(VVCLocalContext *lc, const MvField *mvf, const MvField *orig_mvf, const int x0, const int y0, const int sbw, const int sbh, const int sb_bdof_flag, const int c_start)
int ff_vvc_predict_inter(VVCLocalContext *lc, const int rs)
Loop entire CTU to predict all inter coding blocks.
static void pred_regular_blk(VVCLocalContext *lc, const int skip_ciip)
static int derive_weight_uni(int *denom, int *wx, int *ox, const VVCLocalContext *lc, const MvField *mvf, const int c_idx)
#define SCALED_REF_SB(off, scaling_off, ref_mv, scale, add, shift)
static void mc_bi_scaled(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const VVCRefPic *refp0, const VVCRefPic *refp1, const MvField *mvf, const int x_off, const int y_off, const int block_w, const int block_h, const int c_idx)
static void emulated_edge_scaled(VVCLocalContext *lc, const uint8_t **src, ptrdiff_t *src_stride, int *src_height, const VVCFrame *ref, const int x, const int y, const int dx, const int dy, const int w, const int h, const int is_chroma)
#define INTER_FILTER_SCALED(scale)
static void predict_inter(VVCLocalContext *lc)
static void mc_scaled(VVCLocalContext *lc, int16_t *dst, const VVCRefPic *refp, const Mv *mv, int x_off, int y_off, const int block_w, const int block_h, const int c_idx)
static void pred_gpm_blk(VVCLocalContext *lc)
#define MC_EMULATED_EDGE(dst, src, src_stride, x_off, y_off)
static void FUNC pred_h(uint8_t *_src, const uint8_t *_left, const int w, const int h, const ptrdiff_t stride)
static const int8_t mv[256][2]
static int16_t mult(Float11 *f1, Float11 *f2)
static const uint16_t mask[17]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
enum PredMode pred_mode
PredMode.
struct CodingUnit * next
RefStruct reference.
uint8_t hpel_if_idx
hpelIfIdx
int8_t ref_idx[2]
refIdxL0, refIdxL1
int16_t x
horizontal component of motion vector
int16_t y
vertical component of motion vector
uint8_t inter_affine_flag
int16_t diff_mv_y[2][AFFINE_MIN_BLOCK_SIZE *AFFINE_MIN_BLOCK_SIZE]
diffMvLX
uint8_t gpm_partition_idx
int16_t diff_mv_x[2][AFFINE_MIN_BLOCK_SIZE *AFFINE_MIN_BLOCK_SIZE]
diffMvLX
VVCRefPic refs[VVC_MAX_REF_ENTRIES]
VVCWindow scaling_win
pps_scaling_win_left_offset * SubWithC, pps_scaling_win_right_offset * SubWithC, pps_scaling_win_top_...
const VVCPPS * pps
RefStruct reference.
const VVCSPS * sps
RefStruct reference.
uint8_t ciip_tmp[MAX_PB_SIZE *MAX_PB_SIZE *2]
struct VVCLocalContext::@341344066320375062105147172263124117020342060326::@073072245072044000206134265330343062236310026066 pred
only accessed in ff_vvc_predict_inter() and ff_vvc_predict_ciip() during the inter and reconstruction...
uint8_t edge_emu_buffer[EDGE_EMU_BUFFER_STRIDE *EDGE_EMU_BUFFER_STRIDE *2]
int16_t tmp[MAX_PB_SIZE *MAX_PB_SIZE *2]
int16_t prof_tmp[MAX_PB_SIZE *MAX_PB_SIZE *2]
int16_t tmp1[MAX_PB_SIZE *MAX_PB_SIZE *2]
uint8_t scaled_tmp[EDGE_EMU_BUFFER_STRIDE *MAX_PB_SIZE *sizeof(int)]
int scale[2]
RefPicScale[].
int is_scaled
RprConstraintsActiveFlag.
const H266RawSliceHeader * r
RefStruct reference.
static int ref[MAX_W *MAX_W]
const uint8_t ff_vvc_gpm_angle_to_mirror[VVC_GPM_NUM_ANGLES]
const uint8_t ff_vvc_gpm_weights_offset_y[VVC_GPM_NUM_PARTITION][4][4]
const uint8_t ff_vvc_gpm_angle_idx[VVC_GPM_NUM_PARTITION]
const uint8_t ff_vvc_gpm_angle_to_weights_idx[VVC_GPM_NUM_ANGLES]
const uint8_t ff_vvc_gpm_weights_offset_x[VVC_GPM_NUM_PARTITION][4][4]
const int8_t ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPES][VVC_INTER_LUMA_FACTS][VVC_INTER_LUMA_TAPS]
const uint8_t ff_vvc_gpm_weights[6][VVC_GPM_WEIGHT_SIZE *VVC_GPM_WEIGHT_SIZE]
const int8_t ff_vvc_inter_chroma_filters[VVC_INTER_CHROMA_FILTER_TYPES][VVC_INTER_CHROMA_FACTS][VVC_INTER_CHROMA_TAPS]
#define VVC_INTER_LUMA_FILTER_TYPE_AFFINE
#define VVC_GPM_WEIGHT_SIZE
void ff_vvc_round_mv(Mv *mv, const int lshift, const int rshift)
MvField * ff_vvc_get_mvf(const VVCFrameContext *fc, const int x0, const int y0)
void ff_vvc_clip_mv(Mv *mv)