FFmpeg
Macros | Functions | Variables
vvc_inter.c File Reference
#include "libavutil/frame.h"
#include "vvc_data.h"
#include "vvc_inter.h"
#include "vvc_mvs.h"
#include "vvc_refs.h"

Go to the source code of this file.

Macros

#define PROF_TEMP_OFFSET   (MAX_PB_SIZE + 32)
 
#define EMULATED_EDGE_LUMA(dst, src, src_stride, x_off, y_off)   emulated_edge(fc, dst, src, src_stride, x_off, y_off, block_w, block_h, 1)
 
#define EMULATED_EDGE_CHROMA(dst, src, src_stride, x_off, y_off)   emulated_edge(fc, dst, src, src_stride, x_off, y_off, block_w, block_h, 0)
 
#define EMULATED_EDGE_DMVR_LUMA(dst, src, src_stride, x_sb, y_sb, x_off, y_off)   emulated_edge_dmvr(fc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 1)
 
#define EMULATED_EDGE_DMVR_CHROMA(dst, src, src_stride, x_sb, y_sb, x_off, y_off)   emulated_edge_dmvr(fc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 0)
 
#define EMULATED_EDGE_BILINEAR(dst, src, src_stride, x_off, y_off)   emulated_edge_bilinear(fc, dst, src, src_stride, x_off, y_off, pred_w, pred_h)
 
#define POS(c_idx, x, y)
 
#define SAD_ARRAY_SIZE   5
 

Functions

static int emulated_edge (const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, const int x_off, const int y_off, const int block_w, const int block_h, const int is_luma)
 
static void emulated_edge_dmvr (const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, 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)
 
static void emulated_edge_bilinear (const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, const int x_off, const int y_off, const int block_w, const int block_h)
 
static int derive_weight_uni (int *denom, int *wx, int *ox, const VVCLocalContext *lc, const MvField *mvf, const int c_idx)
 
static int derive_weight (int *denom, int *w0, int *w1, int *o0, int *o1, const VVCLocalContext *lc, const MvField *mvf, const int c_idx, const int dmvr_flag)
 
static void luma_mc (VVCLocalContext *lc, int16_t *dst, const AVFrame *ref, const Mv *mv, int x_off, int y_off, const int block_w, const int block_h)
 
static void chroma_mc (VVCLocalContext *lc, int16_t *dst, const AVFrame *ref, const Mv *mv, int x_off, int y_off, const int block_w, const int block_h, const int c_idx)
 
static void luma_mc_uni (VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const AVFrame *ref, const MvField *mvf, int x_off, int y_off, const int block_w, const int block_h, const int hf_idx, const int vf_idx)
 
static void luma_mc_bi (VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const AVFrame *ref0, const Mv *mv0, const int x_off, const int y_off, const int block_w, const int block_h, const AVFrame *ref1, const Mv *mv1, const MvField *mvf, const int hf_idx, const int vf_idx, const MvField *orig_mv, const int sb_bdof_flag)
 
static void chroma_mc_uni (VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const uint8_t *src, ptrdiff_t src_stride, int x_off, int y_off, const int block_w, const int block_h, const MvField *mvf, const int c_idx, const int hf_idx, const int vf_idx)
 
static void chroma_mc_bi (VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const AVFrame *ref0, const AVFrame *ref1, const int x_off, const int y_off, const int block_w, const int block_h, const MvField *mvf, const int c_idx, const int hf_idx, const int vf_idx, const MvField *orig_mv, const int dmvr_flag, const int ciip_flag)
 
static void luma_prof_uni (VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const AVFrame *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 luma_prof_bi (VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const AVFrame *ref0, const AVFrame *ref1, const MvField *mvf, const int x_off, const int y_off, const int block_w, const int block_h)
 
static int pred_get_refs (const VVCLocalContext *lc, VVCFrame *ref[2], const MvField *mv)
 
static void pred_gpm_blk (VVCLocalContext *lc)
 
static int ciip_derive_intra_weight (const VVCLocalContext *lc, const int x0, const int y0, const int width, const int height)
 
static void pred_regular_luma (VVCLocalContext *lc, const int hf_idx, const int vf_idx, const MvField *mv, const int x0, const int y0, const int sbw, const int sbh, const MvField *orig_mv, const int sb_bdof_flag)
 
static void pred_regular_chroma (VVCLocalContext *lc, const MvField *mv, const int x0, const int y0, const int sbw, const int sbh, const MvField *orig_mv, const int dmvr_flag)
 
static int parametric_mv_refine (const int *sad, const int stride)
 
static void dmvr_mv_refine (VVCLocalContext *lc, MvField *mvf, MvField *orig_mv, int *sb_bdof_flag, const AVFrame *ref0, const AVFrame *ref1, const int x_off, const int y_off, const int block_w, const int block_h)
 
static void set_dmvr_info (VVCFrameContext *fc, const int x0, const int y0, const int width, const int height, const MvField *mvf)
 
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 void pred_regular_blk (VVCLocalContext *lc, const int skip_ciip)
 
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)
 
static void pred_affine_blk (VVCLocalContext *lc)
 
static void predict_inter (VVCLocalContext *lc)
 
static int has_inter_luma (const CodingUnit *cu)
 
int ff_vvc_predict_inter (VVCLocalContext *lc, const int rs)
 Loop entire CTU to predict all inter coding blocks. More...
 
void ff_vvc_predict_ciip (VVCLocalContext *lc)
 CIIP(Combined Inter-Intra Prediction) for a coding block. More...
 

Variables

static const int bcw_w_lut [] = {4, 5, 3, 10, -2}
 

Macro Definition Documentation

◆ PROF_TEMP_OFFSET

#define PROF_TEMP_OFFSET   (MAX_PB_SIZE + 32)

Definition at line 30 of file vvc_inter.c.

◆ EMULATED_EDGE_LUMA

#define EMULATED_EDGE_LUMA (   dst,
  src,
  src_stride,
  x_off,
  y_off 
)    emulated_edge(fc, dst, src, src_stride, x_off, y_off, block_w, block_h, 1)

Definition at line 113 of file vvc_inter.c.

◆ EMULATED_EDGE_CHROMA

#define EMULATED_EDGE_CHROMA (   dst,
  src,
  src_stride,
  x_off,
  y_off 
)    emulated_edge(fc, dst, src, src_stride, x_off, y_off, block_w, block_h, 0)

Definition at line 116 of file vvc_inter.c.

◆ EMULATED_EDGE_DMVR_LUMA

#define EMULATED_EDGE_DMVR_LUMA (   dst,
  src,
  src_stride,
  x_sb,
  y_sb,
  x_off,
  y_off 
)    emulated_edge_dmvr(fc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 1)

Definition at line 119 of file vvc_inter.c.

◆ EMULATED_EDGE_DMVR_CHROMA

#define EMULATED_EDGE_DMVR_CHROMA (   dst,
  src,
  src_stride,
  x_sb,
  y_sb,
  x_off,
  y_off 
)    emulated_edge_dmvr(fc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 0)

Definition at line 122 of file vvc_inter.c.

◆ EMULATED_EDGE_BILINEAR

#define EMULATED_EDGE_BILINEAR (   dst,
  src,
  src_stride,
  x_off,
  y_off 
)    emulated_edge_bilinear(fc, dst, src, src_stride, x_off, y_off, pred_w, pred_h)

Definition at line 125 of file vvc_inter.c.

◆ POS

#define POS (   c_idx,
  x,
 
)
Value:
&fc->frame->data[c_idx][((y) >> fc->ps.sps->vshift[c_idx]) * fc->frame->linesize[c_idx] + \
(((x) >> fc->ps.sps->hshift[c_idx]) << fc->ps.sps->pixel_shift)]

Definition at line 462 of file vvc_inter.c.

◆ SAD_ARRAY_SIZE

#define SAD_ARRAY_SIZE   5

Definition at line 683 of file vvc_inter.c.

Function Documentation

◆ emulated_edge()

static int emulated_edge ( const VVCFrameContext fc,
uint8_t *  dst,
const uint8_t **  src,
ptrdiff_t *  src_stride,
const int  x_off,
const int  y_off,
const int  block_w,
const int  block_h,
const int  is_luma 
)
static

Definition at line 33 of file vvc_inter.c.

◆ emulated_edge_dmvr()

static void emulated_edge_dmvr ( const VVCFrameContext fc,
uint8_t *  dst,
const uint8_t **  src,
ptrdiff_t *  src_stride,
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 
)
static

Definition at line 60 of file vvc_inter.c.

◆ emulated_edge_bilinear()

static void emulated_edge_bilinear ( const VVCFrameContext fc,
uint8_t *  dst,
const uint8_t **  src,
ptrdiff_t *  src_stride,
const int  x_off,
const int  y_off,
const int  block_w,
const int  block_h 
)
static

Definition at line 91 of file vvc_inter.c.

◆ derive_weight_uni()

static int derive_weight_uni ( int denom,
int wx,
int ox,
const VVCLocalContext lc,
const MvField mvf,
const int  c_idx 
)
static

Definition at line 129 of file vvc_inter.c.

Referenced by chroma_mc_uni(), luma_mc_uni(), and luma_prof_uni().

◆ derive_weight()

static int derive_weight ( int denom,
int w0,
int w1,
int o0,
int o1,
const VVCLocalContext lc,
const MvField mvf,
const int  c_idx,
const int  dmvr_flag 
)
static

Definition at line 149 of file vvc_inter.c.

Referenced by chroma_mc_bi(), luma_mc_bi(), and luma_prof_bi().

◆ luma_mc()

static void luma_mc ( VVCLocalContext lc,
int16_t *  dst,
const AVFrame ref,
const Mv mv,
int  x_off,
int  y_off,
const int  block_w,
const int  block_h 
)
static

Definition at line 179 of file vvc_inter.c.

Referenced by pred_gpm_blk().

◆ chroma_mc()

static void chroma_mc ( VVCLocalContext lc,
int16_t *  dst,
const AVFrame ref,
const Mv mv,
int  x_off,
int  y_off,
const int  block_w,
const int  block_h,
const int  c_idx 
)
static

Definition at line 200 of file vvc_inter.c.

Referenced by pred_gpm_blk().

◆ luma_mc_uni()

static void luma_mc_uni ( VVCLocalContext lc,
uint8_t *  dst,
const ptrdiff_t  dst_stride,
const AVFrame ref,
const MvField mvf,
int  x_off,
int  y_off,
const int  block_w,
const int  block_h,
const int  hf_idx,
const int  vf_idx 
)
static

Definition at line 222 of file vvc_inter.c.

Referenced by pred_regular_luma().

◆ luma_mc_bi()

static void luma_mc_bi ( VVCLocalContext lc,
uint8_t *  dst,
const ptrdiff_t  dst_stride,
const AVFrame ref0,
const Mv mv0,
const int  x_off,
const int  y_off,
const int  block_w,
const int  block_h,
const AVFrame ref1,
const Mv mv1,
const MvField mvf,
const int  hf_idx,
const int  vf_idx,
const MvField orig_mv,
const int  sb_bdof_flag 
)
static

Definition at line 253 of file vvc_inter.c.

Referenced by pred_regular_luma().

◆ chroma_mc_uni()

static void chroma_mc_uni ( VVCLocalContext lc,
uint8_t *  dst,
const ptrdiff_t  dst_stride,
const uint8_t *  src,
ptrdiff_t  src_stride,
int  x_off,
int  y_off,
const int  block_w,
const int  block_h,
const MvField mvf,
const int  c_idx,
const int  hf_idx,
const int  vf_idx 
)
static

Definition at line 298 of file vvc_inter.c.

Referenced by pred_regular_chroma().

◆ chroma_mc_bi()

static void chroma_mc_bi ( VVCLocalContext lc,
uint8_t *  dst,
const ptrdiff_t  dst_stride,
const AVFrame ref0,
const AVFrame ref1,
const int  x_off,
const int  y_off,
const int  block_w,
const int  block_h,
const MvField mvf,
const int  c_idx,
const int  hf_idx,
const int  vf_idx,
const MvField orig_mv,
const int  dmvr_flag,
const int  ciip_flag 
)
static

Definition at line 330 of file vvc_inter.c.

Referenced by pred_regular_chroma().

◆ luma_prof_uni()

static void luma_prof_uni ( VVCLocalContext lc,
uint8_t *  dst,
const ptrdiff_t  dst_stride,
const AVFrame 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

Definition at line 369 of file vvc_inter.c.

Referenced by pred_affine_blk().

◆ luma_prof_bi()

static void luma_prof_bi ( VVCLocalContext lc,
uint8_t *  dst,
const ptrdiff_t  dst_stride,
const AVFrame ref0,
const AVFrame ref1,
const MvField mvf,
const int  x_off,
const int  y_off,
const int  block_w,
const int  block_h 
)
static

Definition at line 407 of file vvc_inter.c.

Referenced by pred_affine_blk().

◆ pred_get_refs()

static int pred_get_refs ( const VVCLocalContext lc,
VVCFrame ref[2],
const MvField mv 
)
static

Definition at line 447 of file vvc_inter.c.

Referenced by derive_sb_mv(), pred_affine_blk(), pred_regular_chroma(), and pred_regular_luma().

◆ pred_gpm_blk()

static void pred_gpm_blk ( VVCLocalContext lc)
static

Definition at line 466 of file vvc_inter.c.

Referenced by predict_inter().

◆ ciip_derive_intra_weight()

static int ciip_derive_intra_weight ( const VVCLocalContext lc,
const int  x0,
const int  y0,
const int  width,
const int  height 
)
static

Definition at line 523 of file vvc_inter.c.

Referenced by pred_regular_chroma(), and pred_regular_luma().

◆ pred_regular_luma()

static void pred_regular_luma ( VVCLocalContext lc,
const int  hf_idx,
const int  vf_idx,
const MvField mv,
const int  x0,
const int  y0,
const int  sbw,
const int  sbh,
const MvField orig_mv,
const int  sb_bdof_flag 
)
static

Definition at line 545 of file vvc_inter.c.

Referenced by pred_regular_blk().

◆ pred_regular_chroma()

static void pred_regular_chroma ( VVCLocalContext lc,
const MvField mv,
const int  x0,
const int  y0,
const int  sbw,
const int  sbh,
const MvField orig_mv,
const int  dmvr_flag 
)
static

Definition at line 580 of file vvc_inter.c.

Referenced by pred_affine_blk(), and pred_regular_blk().

◆ parametric_mv_refine()

static int parametric_mv_refine ( const int sad,
const int  stride 
)
static

Definition at line 642 of file vvc_inter.c.

Referenced by dmvr_mv_refine().

◆ dmvr_mv_refine()

static void dmvr_mv_refine ( VVCLocalContext lc,
MvField mvf,
MvField orig_mv,
int sb_bdof_flag,
const AVFrame ref0,
const AVFrame ref1,
const int  x_off,
const int  y_off,
const int  block_w,
const int  block_h 
)
static

Definition at line 685 of file vvc_inter.c.

Referenced by derive_sb_mv().

◆ set_dmvr_info()

static void set_dmvr_info ( VVCFrameContext fc,
const int  x0,
const int  y0,
const int  width,
const int  height,
const MvField mvf 
)
static

Definition at line 750 of file vvc_inter.c.

Referenced by derive_sb_mv().

◆ derive_sb_mv()

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

Definition at line 764 of file vvc_inter.c.

Referenced by pred_regular_blk().

◆ pred_regular_blk()

static void pred_regular_blk ( VVCLocalContext lc,
const int  skip_ciip 
)
static

Definition at line 782 of file vvc_inter.c.

Referenced by ff_vvc_predict_ciip(), and predict_inter().

◆ derive_affine_mvc()

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 
)
static

Definition at line 813 of file vvc_inter.c.

Referenced by pred_affine_blk().

◆ pred_affine_blk()

static void pred_affine_blk ( VVCLocalContext lc)
static

Definition at line 831 of file vvc_inter.c.

Referenced by predict_inter().

◆ predict_inter()

static void predict_inter ( VVCLocalContext lc)
static

Definition at line 878 of file vvc_inter.c.

Referenced by ff_vvc_predict_inter().

◆ has_inter_luma()

static int has_inter_luma ( const CodingUnit cu)
static

Definition at line 897 of file vvc_inter.c.

Referenced by ff_vvc_predict_inter().

◆ ff_vvc_predict_inter()

int ff_vvc_predict_inter ( VVCLocalContext lc,
int  rs 
)

Loop entire CTU to predict all inter coding blocks.

Parameters
lclocal context for CTU
rsraster order for the CTU
Returns
AVERROR

Definition at line 902 of file vvc_inter.c.

Referenced by run_inter().

◆ ff_vvc_predict_ciip()

void ff_vvc_predict_ciip ( VVCLocalContext lc)

CIIP(Combined Inter-Intra Prediction) for a coding block.

Parameters
lclocal context for CTU

Definition at line 918 of file vvc_inter.c.

Referenced by ff_vvc_reconstruct().

Variable Documentation

◆ bcw_w_lut

const int bcw_w_lut[] = {4, 5, 3, 10, -2}
static

Definition at line 31 of file vvc_inter.c.

Referenced by derive_weight().

fc
#define fc(width, name, range_min, range_max)
Definition: cbs_av1.c:472