FFmpeg
Macros | Functions | Variables
inter.c File Reference
#include "libavutil/frame.h"
#include "data.h"
#include "inter.h"
#include "mvs.h"
#include "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(lc, 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(lc, 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(lc, 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(lc, 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(lc, 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 void subpic_offset (int *x_off, int *y_off, const VVCSPS *sps, const VVCPPS *pps, const int subpic_idx, const int is_luma)
 
static void subpic_width_height (int *pic_width, int *pic_height, const VVCSPS *sps, const VVCPPS *pps, const int subpic_idx, const int is_luma)
 
static int emulated_edge (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 is_luma)
 
static void emulated_edge_dmvr (const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, int x_sb, int y_sb, int x_off, int y_off, const int block_w, const int block_h, const int is_luma)
 
static void emulated_edge_bilinear (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)
 
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 inter.c.

◆ EMULATED_EDGE_LUMA

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

Definition at line 146 of file inter.c.

◆ EMULATED_EDGE_CHROMA

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

Definition at line 149 of file 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(lc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 1)

Definition at line 152 of file 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(lc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 0)

Definition at line 155 of file inter.c.

◆ EMULATED_EDGE_BILINEAR

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

Definition at line 158 of file 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 495 of file inter.c.

◆ SAD_ARRAY_SIZE

#define SAD_ARRAY_SIZE   5

Definition at line 716 of file inter.c.

Function Documentation

◆ subpic_offset()

static void subpic_offset ( int x_off,
int y_off,
const VVCSPS sps,
const VVCPPS pps,
const int  subpic_idx,
const int  is_luma 
)
static

Definition at line 33 of file inter.c.

Referenced by emulated_edge(), emulated_edge_bilinear(), and emulated_edge_dmvr().

◆ subpic_width_height()

static void subpic_width_height ( int pic_width,
int pic_height,
const VVCSPS sps,
const VVCPPS pps,
const int  subpic_idx,
const int  is_luma 
)
static

Definition at line 40 of file inter.c.

Referenced by emulated_edge(), emulated_edge_bilinear(), and emulated_edge_dmvr().

◆ emulated_edge()

static int emulated_edge ( 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  is_luma 
)
static

Definition at line 47 of file inter.c.

◆ emulated_edge_dmvr()

static void emulated_edge_dmvr ( const VVCLocalContext lc,
uint8_t *  dst,
const uint8_t **  src,
ptrdiff_t *  src_stride,
int  x_sb,
int  y_sb,
int  x_off,
int  y_off,
const int  block_w,
const int  block_h,
const int  is_luma 
)
static

Definition at line 80 of file inter.c.

◆ emulated_edge_bilinear()

static void emulated_edge_bilinear ( 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 
)
static

Definition at line 118 of file 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 162 of file 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 182 of file 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 212 of file 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 233 of file 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 255 of file 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 286 of file 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 331 of file 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 363 of file 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 402 of file 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 440 of file 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 480 of file 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 499 of file 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 556 of file 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 578 of file 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 613 of file 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 675 of file 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 718 of file 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 783 of file 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 797 of file 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 815 of file 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 846 of file inter.c.

Referenced by pred_affine_blk().

◆ pred_affine_blk()

static void pred_affine_blk ( VVCLocalContext lc)
static

Definition at line 864 of file inter.c.

Referenced by predict_inter().

◆ predict_inter()

static void predict_inter ( VVCLocalContext lc)
static

Definition at line 911 of file inter.c.

Referenced by ff_vvc_predict_inter().

◆ has_inter_luma()

static int has_inter_luma ( const CodingUnit cu)
static

Definition at line 930 of file 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 935 of file 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 951 of file 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 inter.c.

Referenced by derive_weight().

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