FFmpeg
Macros | Functions
h264_mvpred.h File Reference
#include "h264dec.h"
#include "mpegutils.h"
#include "rectangle.h"
#include "libavutil/avassert.h"
#include "libavutil/mem_internal.h"

Go to the source code of this file.

Macros

#define SET_DIAG_MV(MV_OP, REF_OP, XY, Y4)
 
#define FIX_MV_MBAFF(type, refn, mvn, idx)
 
#define MAP_MVS
 
#define MAP_F2F(idx, mb_type)
 
#define MAP_F2F(idx, mb_type)
 

Functions

static av_always_inline int pred_intra_mode (const H264Context *h, H264SliceContext *sl, int n)
 Get the predicted intra4x4 prediction mode. More...
 
static av_always_inline void write_back_intra_pred_mode (const H264Context *h, H264SliceContext *sl)
 
static av_always_inline void write_back_non_zero_count (const H264Context *h, H264SliceContext *sl)
 
static av_always_inline void write_back_motion_list (const H264Context *h, H264SliceContext *sl, int b_stride, int b_xy, int b8_xy, int mb_type, int list)
 
static av_always_inline void write_back_motion (const H264Context *h, H264SliceContext *sl, int mb_type)
 
static av_always_inline int get_dct8x8_allowed (const H264Context *h, H264SliceContext *sl)
 
static av_always_inline int fetch_diagonal_mv (const H264Context *h, H264SliceContext *sl, const int16_t **C, int i, int list, int part_width)
 
static av_always_inline void pred_motion (const H264Context *const h, H264SliceContext *sl, int n, int part_width, int list, int ref, int *const mx, int *const my)
 Get the predicted MV. More...
 
static av_always_inline void pred_16x8_motion (const H264Context *const h, H264SliceContext *sl, int n, int list, int ref, int *const mx, int *const my)
 Get the directionally predicted 16x8 MV. More...
 
static av_always_inline void pred_8x16_motion (const H264Context *const h, H264SliceContext *sl, int n, int list, int ref, int *const mx, int *const my)
 Get the directionally predicted 8x16 MV. More...
 
static av_always_inline void pred_pskip_motion (const H264Context *const h, H264SliceContext *sl)
 
static void fill_decode_neighbors (const H264Context *h, H264SliceContext *sl, int mb_type)
 
static void fill_decode_caches (const H264Context *h, H264SliceContext *sl, int mb_type)
 
static void av_unused decode_mb_skip (const H264Context *h, H264SliceContext *sl)
 decodes a P_SKIP or B_SKIP macroblock More...
 

Detailed Description

H.264 / AVC / MPEG-4 part10 motion vector prediction.

Author
Michael Niedermayer micha.nosp@m.elni.nosp@m.@gmx..nosp@m.at

Definition in file h264_mvpred.h.

Macro Definition Documentation

◆ SET_DIAG_MV

#define SET_DIAG_MV (   MV_OP,
  REF_OP,
  XY,
  Y4 
)
Value:
const int xy = XY, y4 = Y4; \
const int mb_type = mb_types[xy + (y4 >> 2) * h->mb_stride]; \
if (!USES_LIST(mb_type, list)) \
return LIST_NOT_USED; \
mv = h->cur_pic_ptr->motion_val[list][h->mb2b_xy[xy] + 3 + y4 * h->b_stride]; \
sl->mv_cache[list][scan8[0] - 2][0] = mv[0]; \
sl->mv_cache[list][scan8[0] - 2][1] = mv[1] MV_OP; \
return h->cur_pic_ptr->ref_index[list][4 * xy + 1 + (y4 & ~1)] REF_OP;

◆ FIX_MV_MBAFF

#define FIX_MV_MBAFF (   type,
  refn,
  mvn,
  idx 
)
Value:
if (FRAME_MBAFF(h)) { \
if (MB_FIELD(sl)) { \
if (!IS_INTERLACED(type)) { \
refn <<= 1; \
AV_COPY32(mvbuf[idx], mvn); \
mvbuf[idx][1] /= 2; \
mvn = mvbuf[idx]; \
} \
} else { \
if (IS_INTERLACED(type)) { \
refn >>= 1; \
AV_COPY32(mvbuf[idx], mvn); \
mvbuf[idx][1] *= 2; \
mvn = mvbuf[idx]; \
} \
} \
}

Definition at line 369 of file h264_mvpred.h.

◆ MAP_MVS

#define MAP_MVS
Value:
MAP_F2F(scan8[0] - 1 - 1 * 8, topleft_type) \
MAP_F2F(scan8[0] + 0 - 1 * 8, top_type) \
MAP_F2F(scan8[0] + 1 - 1 * 8, top_type) \
MAP_F2F(scan8[0] + 2 - 1 * 8, top_type) \
MAP_F2F(scan8[0] + 3 - 1 * 8, top_type) \
MAP_F2F(scan8[0] + 4 - 1 * 8, topright_type) \
MAP_F2F(scan8[0] - 1 + 0 * 8, left_type[LTOP]) \
MAP_F2F(scan8[0] - 1 + 1 * 8, left_type[LTOP]) \
MAP_F2F(scan8[0] - 1 + 2 * 8, left_type[LBOT]) \
MAP_F2F(scan8[0] - 1 + 3 * 8, left_type[LBOT])

◆ MAP_F2F [1/2]

#define MAP_F2F (   idx,
  mb_type 
)
Value:
if (!IS_INTERLACED(mb_type) && sl->ref_cache[list][idx] >= 0) { \
sl->ref_cache[list][idx] *= 2; \
sl->mv_cache[list][idx][1] /= 2; \
sl->mvd_cache[list][idx][1] >>= 1; \
}

◆ MAP_F2F [2/2]

#define MAP_F2F (   idx,
  mb_type 
)
Value:
if (IS_INTERLACED(mb_type) && sl->ref_cache[list][idx] >= 0) { \
sl->ref_cache[list][idx] >>= 1; \
sl->mv_cache[list][idx][1] *= 2; \
sl->mvd_cache[list][idx][1] <<= 1; \
}

Function Documentation

◆ pred_intra_mode()

static av_always_inline int pred_intra_mode ( const H264Context h,
H264SliceContext sl,
int  n 
)
static

Get the predicted intra4x4 prediction mode.

Definition at line 42 of file h264_mvpred.h.

Referenced by ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

◆ write_back_intra_pred_mode()

static av_always_inline void write_back_intra_pred_mode ( const H264Context h,
H264SliceContext sl 
)
static

Definition at line 58 of file h264_mvpred.h.

Referenced by ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

◆ write_back_non_zero_count()

static av_always_inline void write_back_non_zero_count ( const H264Context h,
H264SliceContext sl 
)
static

Definition at line 70 of file h264_mvpred.h.

Referenced by ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

◆ write_back_motion_list()

static av_always_inline void write_back_motion_list ( const H264Context h,
H264SliceContext sl,
int  b_stride,
int  b_xy,
int  b8_xy,
int  mb_type,
int  list 
)
static

Definition at line 94 of file h264_mvpred.h.

Referenced by write_back_motion().

◆ write_back_motion()

static av_always_inline void write_back_motion ( const H264Context h,
H264SliceContext sl,
int  mb_type 
)
static

Definition at line 130 of file h264_mvpred.h.

Referenced by decode_mb_skip(), ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

◆ get_dct8x8_allowed()

static av_always_inline int get_dct8x8_allowed ( const H264Context h,
H264SliceContext sl 
)
static

Definition at line 157 of file h264_mvpred.h.

Referenced by ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

◆ fetch_diagonal_mv()

static av_always_inline int fetch_diagonal_mv ( const H264Context h,
H264SliceContext sl,
const int16_t **  C,
int  i,
int  list,
int  part_width 
)
static

Definition at line 169 of file h264_mvpred.h.

Referenced by pred_8x16_motion(), and pred_motion().

◆ pred_motion()

static av_always_inline void pred_motion ( const H264Context *const  h,
H264SliceContext sl,
int  n,
int  part_width,
int  list,
int  ref,
int *const  mx,
int *const  my 
)
static

Get the predicted MV.

Parameters
nthe block index
part_widththe width of the partition (4, 8,16) -> (1, 2, 4)
mxthe x component of the predicted motion vector
mythe y component of the predicted motion vector

Definition at line 226 of file h264_mvpred.h.

Referenced by ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), pred_16x8_motion(), and pred_8x16_motion().

◆ pred_16x8_motion()

static av_always_inline void pred_16x8_motion ( const H264Context *const  h,
H264SliceContext sl,
int  n,
int  list,
int  ref,
int *const  mx,
int *const  my 
)
static

Get the directionally predicted 16x8 MV.

Parameters
nthe block index
mxthe x component of the predicted motion vector
mythe y component of the predicted motion vector

Definition at line 291 of file h264_mvpred.h.

Referenced by ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

◆ pred_8x16_motion()

static av_always_inline void pred_8x16_motion ( const H264Context *const  h,
H264SliceContext sl,
int  n,
int  list,
int  ref,
int *const  mx,
int *const  my 
)
static

Get the directionally predicted 8x16 MV.

Parameters
nthe block index
mxthe x component of the predicted motion vector
mythe y component of the predicted motion vector

Definition at line 332 of file h264_mvpred.h.

Referenced by ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

◆ pred_pskip_motion()

static av_always_inline void pred_pskip_motion ( const H264Context *const  h,
H264SliceContext sl 
)
static

Definition at line 388 of file h264_mvpred.h.

Referenced by decode_mb_skip().

◆ fill_decode_neighbors()

static void fill_decode_neighbors ( const H264Context h,
H264SliceContext sl,
int  mb_type 
)
static

Definition at line 487 of file h264_mvpred.h.

Referenced by decode_mb_skip(), ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

◆ fill_decode_caches()

static void fill_decode_caches ( const H264Context h,
H264SliceContext sl,
int  mb_type 
)
static

Definition at line 576 of file h264_mvpred.h.

Referenced by decode_mb_skip(), ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

◆ decode_mb_skip()

static void av_unused decode_mb_skip ( const H264Context h,
H264SliceContext sl 
)
static

decodes a P_SKIP or B_SKIP macroblock

Definition at line 934 of file h264_mvpred.h.

Referenced by ff_h264_decode_mb_cabac(), and ff_h264_decode_mb_cavlc().

mv
static const int8_t mv[256][2]
Definition: 4xm.c:80
MB_FIELD
#define MB_FIELD(sl)
Definition: h264dec.h:65
USES_LIST
#define USES_LIST(a, list)
Definition: mpegutils.h:92
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
scan8
static const uint8_t scan8[16 *3+3]
Definition: h264_parse.h:40
MAP_F2F
#define MAP_F2F(idx, mb_type)
if
if(ret)
Definition: filter_design.txt:179
list
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
Definition: filter_design.txt:25
IS_INTERLACED
#define IS_INTERLACED(a)
Definition: mpegutils.h:76
FRAME_MBAFF
#define FRAME_MBAFF(h)
Definition: h264dec.h:66
LIST_NOT_USED
#define LIST_NOT_USED
Definition: h264dec.h:391
LBOT
#define LBOT
Definition: h264dec.h:70
LTOP
#define LTOP
Definition: h264dec.h:69
h
h
Definition: vp9dsp_template.c:2038