FFmpeg
|
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include "avcodec.h"
#include "mathops.h"
#include "motion_est.h"
#include "mpegutils.h"
#include "mpegvideoenc.h"
#include "motion_est_template.c"
Go to the source code of this file.
Data Structures | |
struct | Minima |
Macros | |
#define | P_LEFT P[1] |
#define | P_TOP P[2] |
#define | P_TOPRIGHT P[3] |
#define | P_MEDIAN P[4] |
#define | P_MV1 P[9] |
#define | ME_MAP_SHIFT 3 |
#define | ME_MAP_MV_BITS 11 |
#define | FLAG_QPEL 1 |
#define | FLAG_CHROMA 2 |
#define | FLAG_DIRECT 4 |
#define | CHECK_SAD_HALF_MV(suffix, x, y) |
#define | HASH(fx, fy, bx, by) ((fx)+17*(fy)+63*(bx)+117*(by)) |
#define | HASH8(fx, fy, bx, by) ((uint8_t)HASH(fx,fy,bx,by)) |
#define | CHECK_BIDIR(fx, fy, bx, by) |
#define | CHECK_BIDIR2(a, b, c, d) |
Functions | |
static int | sad_hpel_motion_search (MpegEncContext *s, int *mx_ptr, int *my_ptr, int dmin, int src_index, int ref_index, int size, int h) |
static unsigned | update_map_generation (MotionEstContext *c) |
static int | minima_cmp (const void *a, const void *b) |
static void | init_ref (MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index) |
static int | get_flags (MotionEstContext *c, int direct, int chroma) |
static av_always_inline int | cmp_direct_inline (MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel) |
static av_always_inline int | cmp_inline (MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel, int chroma) |
static int | cmp_simple (MpegEncContext *s, const int x, const int y, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func) |
static int | cmp_fpel_internal (MpegEncContext *s, const int x, const int y, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags) |
static int | cmp_internal (MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags) |
static av_always_inline int | cmp (MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags) |
compares a block (either a full macroblock or a partition thereof) against a proposed motion-compensated prediction of that block More... | |
static int | cmp_hpel (MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags) |
static int | cmp_qpel (MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags) |
static int | zero_cmp (MpegEncContext *s, uint8_t *a, uint8_t *b, ptrdiff_t stride, int h) |
static void | zero_hpel (uint8_t *a, const uint8_t *b, ptrdiff_t stride, int h) |
int | ff_init_me (MpegEncContext *s) |
static void | set_p_mv_tables (MpegEncContext *s, int mx, int my, int mv4) |
static void | get_limits (MpegEncContext *s, int x, int y) |
get fullpel ME search limits. More... | |
static void | init_mv4_ref (MotionEstContext *c) |
static int | h263_mv4_search (MpegEncContext *s, int mx, int my, int shift) |
static void | init_interlaced_ref (MpegEncContext *s, int ref_index) |
static int | interlaced_search (MpegEncContext *s, int ref_index, int16_t(*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select) |
static int | get_penalty_factor (int lambda, int lambda2, int type) |
void | ff_estimate_p_frame_motion (MpegEncContext *s, int mb_x, int mb_y) |
int | ff_pre_estimate_p_frame_motion (MpegEncContext *s, int mb_x, int mb_y) |
static int | estimate_motion_b (MpegEncContext *s, int mb_x, int mb_y, int16_t(*mv_table)[2], int ref_index, int f_code) |
static int | check_bidir_mv (MpegEncContext *s, int motion_fx, int motion_fy, int motion_bx, int motion_by, int pred_fx, int pred_fy, int pred_bx, int pred_by, int size, int h) |
static int | bidir_refine (MpegEncContext *s, int mb_x, int mb_y) |
static int | direct_search (MpegEncContext *s, int mb_x, int mb_y) |
void | ff_estimate_b_frame_motion (MpegEncContext *s, int mb_x, int mb_y) |
int | ff_get_best_fcode (MpegEncContext *s, const int16_t(*mv_table)[2], int type) |
void | ff_fix_long_p_mvs (MpegEncContext *s, int type) |
void | ff_fix_long_mvs (MpegEncContext *s, uint8_t *field_select_table, int field_select, int16_t(*mv_table)[2], int f_code, int type, int truncate) |
Motion estimation.
Definition in file motion_est.c.
#define P_LEFT P[1] |
Definition at line 40 of file motion_est.c.
#define P_TOP P[2] |
Definition at line 41 of file motion_est.c.
#define P_TOPRIGHT P[3] |
Definition at line 42 of file motion_est.c.
#define P_MEDIAN P[4] |
Definition at line 43 of file motion_est.c.
#define P_MV1 P[9] |
Definition at line 44 of file motion_est.c.
#define ME_MAP_SHIFT 3 |
Definition at line 46 of file motion_est.c.
#define ME_MAP_MV_BITS 11 |
Definition at line 47 of file motion_est.c.
#define FLAG_QPEL 1 |
Definition at line 78 of file motion_est.c.
#define FLAG_CHROMA 2 |
Definition at line 79 of file motion_est.c.
#define FLAG_DIRECT 4 |
Definition at line 80 of file motion_est.c.
#define CHECK_SAD_HALF_MV | ( | suffix, | |
x, | |||
y | |||
) |
Definition at line 384 of file motion_est.c.
#define HASH | ( | fx, | |
fy, | |||
bx, | |||
by | |||
) | ((fx)+17*(fy)+63*(bx)+117*(by)) |
#define HASH8 | ( | fx, | |
fy, | |||
bx, | |||
by | |||
) | ((uint8_t)HASH(fx,fy,bx,by)) |
#define CHECK_BIDIR | ( | fx, | |
fy, | |||
bx, | |||
by | |||
) |
|
static |
Definition at line 391 of file motion_est.c.
Referenced by ff_init_me().
|
inlinestatic |
Definition at line 54 of file motion_est.c.
Referenced by epzs_motion_search2(), and epzs_motion_search_internal().
|
static |
Definition at line 71 of file motion_est.c.
Referenced by sab_diamond_search().
|
inlinestatic |
Definition at line 82 of file motion_est.c.
Referenced by encode_q_branch(), ff_estimate_b_frame_motion(), ff_estimate_p_frame_motion(), and ff_pre_estimate_p_frame_motion().
|
static |
Definition at line 100 of file motion_est.c.
Referenced by ff_init_me().
|
static |
Definition at line 106 of file motion_est.c.
Referenced by cmp_fpel_internal(), cmp_hpel(), cmp_internal(), and cmp_qpel().
|
static |
Definition at line 178 of file motion_est.c.
Referenced by cmp_fpel_internal(), cmp_hpel(), cmp_internal(), cmp_qpel(), and cmp_simple().
|
static |
Definition at line 230 of file motion_est.c.
Referenced by cmp().
|
static |
Definition at line 236 of file motion_est.c.
Referenced by cmp().
|
static |
Definition at line 246 of file motion_est.c.
Referenced by cmp().
|
static |
compares a block (either a full macroblock or a partition thereof) against a proposed motion-compensated prediction of that block
Definition at line 259 of file motion_est.c.
Referenced by deband_16_coupling_c(), deband_8_coupling_c(), decode_tonal_components(), epzs_motion_search_internal(), ff_huff_build_tree(), ff_mpeg12_find_best_frame_rate(), ff_set_cmp(), get_func(), get_mb_score(), hpel_motion_search(), qpel_motion_search(), and small_diamond_search().
|
static |
Definition at line 274 of file motion_est.c.
|
static |
Definition at line 284 of file motion_est.c.
|
static |
Definition at line 296 of file motion_est.c.
Referenced by ff_init_me().
|
static |
Definition at line 302 of file motion_est.c.
Referenced by ff_init_me().
int ff_init_me | ( | MpegEncContext * | s | ) |
Definition at line 305 of file motion_est.c.
Referenced by encode_frame(), encode_picture(), and svq1_encode_plane().
|
inlinestatic |
Definition at line 496 of file motion_est.c.
Referenced by ff_estimate_p_frame_motion().
|
inlinestatic |
get fullpel ME search limits.
Definition at line 523 of file motion_est.c.
Referenced by direct_search(), estimate_motion_b(), ff_estimate_b_frame_motion(), ff_estimate_p_frame_motion(), and ff_pre_estimate_p_frame_motion().
|
inlinestatic |
Definition at line 559 of file motion_est.c.
Referenced by h263_mv4_search().
|
inlinestatic |
Definition at line 570 of file motion_est.c.
Referenced by ff_estimate_p_frame_motion().
|
inlinestatic |
Definition at line 724 of file motion_est.c.
Referenced by interlaced_search().
|
static |
Definition at line 737 of file motion_est.c.
Referenced by ff_estimate_b_frame_motion(), and ff_estimate_p_frame_motion().
Definition at line 859 of file motion_est.c.
Referenced by estimate_motion_b(), ff_estimate_p_frame_motion(), and ff_pre_estimate_p_frame_motion().
void ff_estimate_p_frame_motion | ( | MpegEncContext * | s, |
int | mb_x, | ||
int | mb_y | ||
) |
< the variance of the block (sum of squared (p[y][x]-average))
< sum of squared differences with the estimated motion vector
Definition at line 884 of file motion_est.c.
Referenced by estimate_motion_thread(), and svq1_encode_plane().
int ff_pre_estimate_p_frame_motion | ( | MpegEncContext * | s, |
int | mb_x, | ||
int | mb_y | ||
) |
Definition at line 1060 of file motion_est.c.
Referenced by pre_estimate_motion_thread().
|
static |
Definition at line 1113 of file motion_est.c.
Referenced by ff_estimate_b_frame_motion().
|
inlinestatic |
Definition at line 1175 of file motion_est.c.
Referenced by bidir_refine().
|
inlinestatic |
Definition at line 1240 of file motion_est.c.
Referenced by ff_estimate_b_frame_motion().
|
inlinestatic |
Definition at line 1387 of file motion_est.c.
Referenced by ff_estimate_b_frame_motion().
void ff_estimate_b_frame_motion | ( | MpegEncContext * | s, |
int | mb_x, | ||
int | mb_y | ||
) |
Definition at line 1489 of file motion_est.c.
Referenced by estimate_motion_thread().
int ff_get_best_fcode | ( | MpegEncContext * | s, |
const int16_t(*) | mv_table[2], | ||
int | type | ||
) |
Definition at line 1597 of file motion_est.c.
Referenced by encode_picture().
void ff_fix_long_p_mvs | ( | MpegEncContext * | s, |
int | type | ||
) |
Definition at line 1649 of file motion_est.c.
Referenced by encode_picture(), and svq1_encode_plane().
void ff_fix_long_mvs | ( | MpegEncContext * | s, |
uint8_t * | field_select_table, | ||
int | field_select, | ||
int16_t(*) | mv_table[2], | ||
int | f_code, | ||
int | type, | ||
int | truncate | ||
) |
truncate | 1 for truncation, 0 for using intra |
Definition at line 1698 of file motion_est.c.
Referenced by encode_picture(), and svq1_encode_plane().