hvirtual/mpeg2enc/motion.c File Reference

#include <limits.h>
#include <stdio.h>
#include "config.h"
#include "global.h"
#include "cpu_accel.h"
#include "simd.h"

Include dependency graph for motion.c:

Go to the source code of this file.

Data Structures

struct  _blockcrd
struct  mb_motion
struct  subsampled_mb

Defines

#define pipestep(o)   v = p1[o]-p2[o]; s+= abs(v);
#define pipestep(o)   diff = p1[o]-p2[o]; s += abs(diff)
#define pipestep(o)   diff = p1[o]-p2[o]; s += diff < 0 ? -diff : diff;

Typedefs

typedef struct _blockcrd blockxy
typedef struct mb_motion mb_motion_s
typedef struct subsampled_mb subsampled_mb_s

Functions

static void frame_ME (motion_engine_t *engine, pict_data_s *picture, motion_comp_s *mc, int mboffset, int i, int j, struct mbinfo *mbi)
static void field_ME (motion_engine_t *engine, pict_data_s *picture, motion_comp_s *mc, int mboffset, int i, int j, struct mbinfo *mbi, int secondfield, int ipflag)
static void frame_estimate (motion_engine_t *engine, uint8_t *org, uint8_t *ref, subsampled_mb_s *ssmb, int i, int j, int sx, int sy, mb_motion_s *bestfr, mb_motion_s *besttop, mb_motion_s *bestbot, int imins[2][2], int jmins[2][2])
static void field_estimate (motion_engine_t *engine, pict_data_s *picture, uint8_t *toporg, uint8_t *topref, uint8_t *botorg, uint8_t *botref, subsampled_mb_s *ssmb, int i, int j, int sx, int sy, int ipflag, mb_motion_s *bestfr, mb_motion_s *best8u, mb_motion_s *best8l, mb_motion_s *bestsp)
static void dpframe_estimate (motion_engine_t *engine, pict_data_s *picture, uint8_t *ref, subsampled_mb_s *ssmb, int i, int j, int iminf[2][2], int jminf[2][2], mb_motion_s *dpbest, int *imindmvp, int *jmindmvp, int *vmcp)
static void dpfield_estimate (motion_engine_t *engine, pict_data_s *picture, uint8_t *topref, uint8_t *botref, uint8_t *mb, int i, int j, int imins, int jmins, mb_motion_s *dpbest, int *vmcp)
static void fullsearch (motion_engine_t *engine, uint8_t *org, uint8_t *ref, subsampled_mb_s *ssblk, int lx, int i0, int j0, int sx, int sy, int h, int xmax, int ymax, mb_motion_s *motion)
static void find_best_one_pel (motion_engine_t *engine, uint8_t *org, uint8_t *blk, int searched_size, int i0, int j0, int ilow, int jlow, int xmax, int ymax, int lx, int h, mb_motion_s *res)
static int build_sub22_mcomps (motion_engine_t *engine, int i0, int j0, int ihigh, int jhigh, int null_mc_sad, uint8_t *s22org, uint8_t *s22blk, int flx, int fh, int searched_sub44_size)
static int unidir_pred_var (const mb_motion_s *motion, uint8_t *mb, int lx, int h)
static int bidir_pred_var (const mb_motion_s *motion_f, const mb_motion_s *motion_b, uint8_t *mb, int lx, int h)
static int bidir_pred_sad (const mb_motion_s *motion_f, const mb_motion_s *motion_b, uint8_t *mb, int lx, int h)
static int variance (uint8_t *mb, int size, int lx)
static int dist22 (uint8_t *blk1, uint8_t *blk2, int qlx, int qh)
static int dist44 (uint8_t *blk1, uint8_t *blk2, int flx, int fh)
static int dist2_22 (uint8_t *blk1, uint8_t *blk2, int lx, int h)
static int bdist2_22 (uint8_t *blk1f, uint8_t *blk1b, uint8_t *blk2, int lx, int h)
static int dist1_00 (uint8_t *blk1, uint8_t *blk2, int lx, int h, int distlim)
static int dist1_01 (uint8_t *blk1, uint8_t *blk2, int lx, int h)
static int dist1_10 (uint8_t *blk1, uint8_t *blk2, int lx, int h)
static int dist1_11 (uint8_t *blk1, uint8_t *blk2, int lx, int h)
static int dist2 (uint8_t *blk1, uint8_t *blk2, int lx, int hx, int hy, int h)
static int bdist2 (uint8_t *pf, uint8_t *pb, uint8_t *p2, int lx, int hxf, int hyf, int hxb, int hyb, int h)
static int bdist1 (uint8_t *pf, uint8_t *pb, uint8_t *p2, int lx, int hxf, int hyf, int hxb, int hyb, int h)
static int unidir_chrom_var_sum (mb_motion_s *lum_mc, uint8_t **ref, subsampled_mb_s *ssblk, int lx, int h)
int bidir_chrom_var_sum (mb_motion_s *lum_mc_f, mb_motion_s *lum_mc_b, uint8_t **ref_f, uint8_t **ref_b, subsampled_mb_s *ssblk, int lx, int h)
static int chrom_var_sum (subsampled_mb_s *ssblk, int h, int lx)
static void sub_mean_reduction (mc_result_s *matches, int len, int times, int *newlen_res, int *minweight_res)
static int build_sub44_mcomps (motion_engine_t *engine, int ilow, int jlow, int ihigh, int jhigh, int i0, int j0, int null_mc_sad, uint8_t *s44org, uint8_t *s44blk, int qlx, int qh)
void fast_motion_data (uint8_t *blk, int picture_struct)
void init_motion ()
void motion_engine_loop (motion_engine_t *engine)
void motion_estimation (pict_data_s *picture, motion_comp_s *mc_data, int secondfield, int ipflag)
void start_motion_engines ()
void stop_motion_engines ()

Variables

static void(* pfind_best_one_pel )(motion_engine_t *engine, uint8_t *org, uint8_t *blk, int searched_size, int i0, int j0, int ilow, int jlow, int xmax, int ymax, int lx, int h, mb_motion_s *res)
static int(* pbuild_sub22_mcomps )(motion_engine_t *engine, int i0, int j0, int ihigh, int jhigh, int null_mc_sad, uint8_t *s22org, uint8_t *s22blk, int flx, int fh, int searched_sub44_size)
static int(* pdist2_22 )(uint8_t *blk1, uint8_t *blk2, int lx, int h)
static int(* pbdist2_22 )(uint8_t *blk1f, uint8_t *blk1b, uint8_t *blk2, int lx, int h)
static int(* pdist22 )(uint8_t *blk1, uint8_t *blk2, int flx, int fh)
static int(* pdist44 )(uint8_t *blk1, uint8_t *blk2, int qlx, int qh)
static int(* pdist1_00 )(uint8_t *blk1, uint8_t *blk2, int lx, int h, int distlim)
static int(* pdist1_01 )(uint8_t *blk1, uint8_t *blk2, int lx, int h)
static int(* pdist1_10 )(uint8_t *blk1, uint8_t *blk2, int lx, int h)
static int(* pdist1_11 )(uint8_t *blk1, uint8_t *blk2, int lx, int h)
static int(* pdist2 )(uint8_t *blk1, uint8_t *blk2, int lx, int hx, int hy, int h)
static int(* pbdist2 )(uint8_t *pf, uint8_t *pb, uint8_t *p2, int lx, int hxf, int hyf, int hxb, int hyb, int h)
static int(* pbdist1 )(uint8_t *pf, uint8_t *pb, uint8_t *p2, int lx, int hxf, int hyf, int hxb, int hyb, int h)


Define Documentation

#define pipestep (  )     diff = p1[o]-p2[o]; s += diff < 0 ? -diff : diff;

#define pipestep (  )     diff = p1[o]-p2[o]; s += abs(diff)

#define pipestep (  )     v = p1[o]-p2[o]; s+= abs(v);

Referenced by dist1_00(), dist22(), and dist44().


Typedef Documentation

typedef struct _blockcrd blockxy

typedef struct mb_motion mb_motion_s

Definition at line 56 of file motion.c.

Definition at line 68 of file motion.c.


Function Documentation

static int bdist1 ( uint8_t *  pf,
uint8_t *  pb,
uint8_t *  p2,
int  lx,
int  hxf,
int  hyf,
int  hxb,
int  hyb,
int  h 
) [static]

Definition at line 2042 of file motion.c.

Referenced by init_motion().

static int bdist2 ( uint8_t *  pf,
uint8_t *  pb,
uint8_t *  p2,
int  lx,
int  hxf,
int  hyf,
int  hxb,
int  hyb,
int  h 
) [static]

Definition at line 2095 of file motion.c.

Referenced by init_motion().

static int bdist2_22 ( uint8_t *  blk1f,
uint8_t *  blk1b,
uint8_t *  blk2,
int  lx,
int  h 
) [static]

Definition at line 1932 of file motion.c.

Referenced by init_motion().

int bidir_chrom_var_sum ( mb_motion_s lum_mc_f,
mb_motion_s lum_mc_b,
uint8_t **  ref_f,
uint8_t **  ref_b,
subsampled_mb_s ssblk,
int  lx,
int  h 
)

static int bidir_pred_sad ( const mb_motion_s motion_f,
const mb_motion_s motion_b,
uint8_t *  mb,
int  lx,
int  h 
) [static]

Definition at line 2197 of file motion.c.

References mb_motion::blk, mb_motion::hx, mb_motion::hy, and pbdist1.

Referenced by field_ME().

static int bidir_pred_var ( const mb_motion_s motion_f,
const mb_motion_s motion_b,
uint8_t *  mb,
int  lx,
int  h 
) [static]

Definition at line 2181 of file motion.c.

References mb_motion::blk, mb_motion::hx, mb_motion::hy, and pbdist2.

Referenced by field_ME(), and frame_ME().

static int build_sub22_mcomps ( motion_engine_t engine,
int  i0,
int  j0,
int  ihigh,
int  jhigh,
int  null_mc_sad,
uint8_t *  s22org,
uint8_t *  s22blk,
int  flx,
int  fh,
int  searched_sub44_size 
) [static]

static int build_sub44_mcomps ( motion_engine_t engine,
int  ilow,
int  jlow,
int  ihigh,
int  jhigh,
int  i0,
int  j0,
int  null_mc_sad,
uint8_t *  s44org,
uint8_t *  s44blk,
int  qlx,
int  qh 
) [static]

Definition at line 987 of file motion.c.

References mc_44_red, s1, motion_engine_t::sub44_mcomps, motion_engine_t::sub44_num_mcomps, sub_mean_reduction(), mc_result::weight, mc_result::x, and mc_result::y.

Referenced by fullsearch().

Here is the call graph for this function:

static int chrom_var_sum ( subsampled_mb_s ssblk,
int  h,
int  lx 
) [static]

Definition at line 352 of file motion.c.

References subsampled_mb::umb, variance(), and subsampled_mb::vmb.

Referenced by frame_ME().

Here is the call graph for this function:

static int dist1_00 ( uint8_t *  blk1,
uint8_t *  blk2,
int  lx,
int  h,
int  distlim 
) [static]

Definition at line 1528 of file motion.c.

References pipestep.

Referenced by init_motion().

static int dist1_01 ( uint8_t *  blk1,
uint8_t *  blk2,
int  lx,
int  h 
) [static]

Definition at line 1558 of file motion.c.

Referenced by init_motion().

static int dist1_10 ( uint8_t *  blk1,
uint8_t *  blk2,
int  lx,
int  h 
) [static]

Definition at line 1586 of file motion.c.

Referenced by init_motion().

static int dist1_11 ( uint8_t *  blk1,
uint8_t *  blk2,
int  lx,
int  h 
) [static]

Definition at line 1613 of file motion.c.

Referenced by init_motion().

static int dist2 ( uint8_t *  blk1,
uint8_t *  blk2,
int  lx,
int  hx,
int  hy,
int  h 
) [static]

Definition at line 1962 of file motion.c.

Referenced by init_motion().

static int dist22 ( uint8_t *  blk1,
uint8_t *  blk2,
int  qlx,
int  qh 
) [static]

Definition at line 1838 of file motion.c.

References pipestep.

Referenced by init_motion().

static int dist2_22 ( uint8_t *  blk1,
uint8_t *  blk2,
int  lx,
int  h 
) [static]

Definition at line 1905 of file motion.c.

Referenced by init_motion().

static int dist44 ( uint8_t *  blk1,
uint8_t *  blk2,
int  flx,
int  fh 
) [static]

Definition at line 1871 of file motion.c.

References pipestep.

Referenced by init_motion().

static void dpfield_estimate ( motion_engine_t engine,
pict_data_s picture,
uint8_t *  topref,
uint8_t *  botref,
uint8_t *  mb,
int  i,
int  j,
int  imins,
int  jmins,
mb_motion_s dpbest,
int *  vmcp 
) [static]

static void dpframe_estimate ( motion_engine_t engine,
pict_data_s picture,
uint8_t *  ref,
subsampled_mb_s ssmb,
int  i,
int  j,
int  iminf[2][2],
int  jminf[2][2],
mb_motion_s dpbest,
int *  imindmvp,
int *  jmindmvp,
int *  vmcp 
) [static]

void fast_motion_data ( uint8_t *  blk,
int  picture_struct 
)

Definition at line 1690 of file motion.c.

References b, colsums_offset, FRAME_PICTURE, fsubsample_offset, height, nb, qsubsample_offset, rowsums_offset, and width.

Referenced by putseq().

static void field_estimate ( motion_engine_t engine,
pict_data_s picture,
uint8_t *  toporg,
uint8_t *  topref,
uint8_t *  botorg,
uint8_t *  botref,
subsampled_mb_s ssmb,
int  i,
int  j,
int  sx,
int  sy,
int  ipflag,
mb_motion_s bestfr,
mb_motion_s best8u,
mb_motion_s best8l,
mb_motion_s bestsp 
) [static]

static void field_ME ( motion_engine_t engine,
pict_data_s picture,
motion_comp_s mc,
int  mboffset,
int  i,
int  j,
struct mbinfo mbi,
int  secondfield,
int  ipflag 
) [static]

static void find_best_one_pel ( motion_engine_t engine,
uint8_t *  org,
uint8_t *  blk,
int  searched_size,
int  i0,
int  j0,
int  ilow,
int  jlow,
int  xmax,
int  ymax,
int  lx,
int  h,
mb_motion_s res 
) [static]

static void frame_estimate ( motion_engine_t engine,
uint8_t *  org,
uint8_t *  ref,
subsampled_mb_s ssmb,
int  i,
int  j,
int  sx,
int  sy,
mb_motion_s bestfr,
mb_motion_s besttop,
mb_motion_s bestbot,
int  imins[2][2],
int  jmins[2][2] 
) [static]

static void frame_ME ( motion_engine_t engine,
pict_data_s picture,
motion_comp_s mc,
int  mboffset,
int  i,
int  j,
struct mbinfo mbi 
) [static]

static void fullsearch ( motion_engine_t engine,
uint8_t *  org,
uint8_t *  ref,
subsampled_mb_s ssblk,
int  lx,
int  i0,
int  j0,
int  sx,
int  sy,
int  h,
int  xmax,
int  ymax,
mb_motion_s motion 
) [static]

void init_motion (  ) 

void motion_engine_loop ( motion_engine_t engine  ) 

void motion_estimation ( pict_data_s picture,
motion_comp_s mc_data,
int  secondfield,
int  ipflag 
)

void start_motion_engines (  ) 

Definition at line 3055 of file motion.c.

References motion_engine_t::done, motion_engine_t::end_row, height2, input_lock, motion_engine_loop(), motion_engines, output_lock, processors, and motion_engine_t::start_row.

Referenced by init().

Here is the call graph for this function:

void stop_motion_engines (  ) 

Definition at line 3084 of file motion.c.

References motion_engine_t::done, input_lock, motion_engines, output_lock, and processors.

Referenced by mpeg2enc().

static void sub_mean_reduction ( mc_result_s matches,
int  len,
int  times,
int *  newlen_res,
int *  minweight_res 
) [static]

Definition at line 910 of file motion.c.

References mc_result::weight.

Referenced by build_sub22_mcomps(), and build_sub44_mcomps().

static int unidir_chrom_var_sum ( mb_motion_s lum_mc,
uint8_t **  ref,
subsampled_mb_s ssblk,
int  lx,
int  h 
) [static]

static int unidir_pred_var ( const mb_motion_s motion,
uint8_t *  mb,
int  lx,
int  h 
) [static]

Definition at line 2167 of file motion.c.

References mb_motion::blk, mb_motion::hx, mb_motion::hy, and pdist2.

Referenced by field_ME().

static int variance ( uint8_t *  mb,
int  size,
int  lx 
) [static]

Definition at line 2142 of file motion.c.

References s2.

Referenced by chrom_var_sum(), field_ME(), and frame_ME().


Variable Documentation

int(* pbdist1)(uint8_t *pf, uint8_t *pb, uint8_t *p2, int lx, int hxf, int hyf, int hxb, int hyb, int h) [static]

Referenced by bidir_pred_sad(), and init_motion().

int(* pbdist2)(uint8_t *pf, uint8_t *pb, uint8_t *p2, int lx, int hxf, int hyf, int hxb, int hyb, int h) [static]

Referenced by bidir_pred_var(), and init_motion().

int(* pbdist2_22)(uint8_t *blk1f, uint8_t *blk1b, uint8_t *blk2, int lx, int h) [static]

Referenced by bidir_chrom_var_sum(), and init_motion().

int(* pbuild_sub22_mcomps)(motion_engine_t *engine, int i0, int j0, int ihigh, int jhigh, int null_mc_sad, uint8_t *s22org, uint8_t *s22blk, int flx, int fh, int searched_sub44_size) [static]

Referenced by init_motion().

int(* pdist1_00)(uint8_t *blk1, uint8_t *blk2, int lx, int h, int distlim) [static]

Referenced by init_motion().

int(* pdist1_01)(uint8_t *blk1, uint8_t *blk2, int lx, int h) [static]

Referenced by init_motion().

int(* pdist1_10)(uint8_t *blk1, uint8_t *blk2, int lx, int h) [static]

Referenced by init_motion().

int(* pdist1_11)(uint8_t *blk1, uint8_t *blk2, int lx, int h) [static]

Referenced by init_motion().

int(* pdist2)(uint8_t *blk1, uint8_t *blk2, int lx, int hx, int hy, int h) [static]

Referenced by init_motion(), and unidir_pred_var().

int(* pdist22)(uint8_t *blk1, uint8_t *blk2, int flx, int fh) [static]

Referenced by init_motion().

int(* pdist2_22)(uint8_t *blk1, uint8_t *blk2, int lx, int h) [static]

int(* pdist44)(uint8_t *blk1, uint8_t *blk2, int qlx, int qh) [static]

Referenced by init_motion().

void(* pfind_best_one_pel)(motion_engine_t *engine, uint8_t *org, uint8_t *blk, int searched_size, int i0, int j0, int ilow, int jlow, int xmax, int ymax, int lx, int h, mb_motion_s *res) [static]

Referenced by init_motion().


Generated on Mon Apr 28 14:00:01 2008 for Cinelerra by  doxygen 1.5.5