## schromotion

schromotion

## Synopsis

    struct              SchroMotion;
    #define             SCHRO_MOTION_GET_BLOCK              (motion,
                                                             x,
                                                             y)
    void                schro_motion_dc_prediction          (SchroMotion *motion,
                                                             int x,
                                                             int y,
                                                             int *pred);
    void                schro_motion_vector_prediction      (SchroMotion *motion,
                                                             int x,
                                                             int y,
                                                             int *pred_x,
                                                             int *pred_y,
                                                             int mode);
    int                 schro_motion_split_prediction       (SchroMotion *motion,
                                                             int x,
                                                             int y);
    int                 schro_motion_get_mode_prediction    (SchroMotion *motion,
                                                             int x,
                                                             int y);
    int                 schro_motion_block_estimate_entropy (SchroMotion *motion,
                                                             int i,
                                                             int j);
    void                schro_motion_copy_from              (SchroMotion *motion,
                                                             int i,
                                                             int j,
                                                             SchroBlock *block);
    void                schro_motion_copy_to                (SchroMotion *motion,
                                                             int i,
                                                             int j,
                                                             SchroBlock *block);
    int                 schro_motion_estimate_entropy       (SchroMotion *motion);
    void                schro_motion_field_lshift           (SchroMotionField *mf,
                                                             int n);
    void                schro_motion_free                   (SchroMotion *motion);
    int                 schro_motion_get_global_prediction  (SchroMotion *motion,
                                                             int x,
                                                             int y);
    SchroMotion *       schro_motion_new                    (SchroParams *params,
                                                             SchroUpsampledFrame *ref1,
                                                             SchroUpsampledFrame *ref2);
    void                schro_motion_render                 (SchroMotion *motion,
                                                             SchroFrame *dest,
                                                             SchroFrame *addframe,
                                                             int add,
                                                             SchroFrame *output_frame);
    void                schro_motion_render_cuda            (SchroMotion *motion,
                                                             SchroFrame *dest);
    void                schro_motion_render_ref             (SchroMotion *motion,
                                                             SchroFrame *dest,
                                                             SchroFrame *addframe,
                                                             int add,
                                                             SchroFrame *output_frame);
    int                 schro_motion_superblock_estimate_entropy
                                                            (SchroMotion *motion,
                                                             int i,
                                                             int j);
    int                 schro_motion_superblock_try_estimate_entropy
                                                            (SchroMotion *motion,
                                                             int i,
                                                             int j,
                                                             SchroBlock *block);
    int                 schro_motion_vector_is_equal        (SchroMotionVector *mv1,
                                                             SchroMotionVector *mv2);
    SchroMotionField *  schro_motion_field_new              (int x_num_blocks,
                                                             int y_num_blocks);
    void                schro_motion_field_free             (SchroMotionField *field);
    void                schro_motion_field_scan             (SchroMotionField *field,
                                                             SchroParams *params,
                                                             SchroFrame *frame,
                                                             SchroFrame *ref,
                                                             int dist);
    void                schro_motion_field_inherit          (SchroMotionField *field,
                                                             SchroMotionField *parent);
    void                schro_motion_field_copy             (SchroMotionField *field,
                                                             SchroMotionField *parent);
    int                 schro_motion_verify                 (SchroMotion *mf);

## Description

## Details

### struct SchroMotion

    struct SchroMotion {
      SchroUpsampledFrame *src1;
      SchroUpsampledFrame *src2;
      SchroMotionVector *motion_vectors;
      SchroParams *params;

      uint8_t *tmpdata;

      int ref_weight_precision;
      int ref1_weight;
      int ref2_weight;
      int mv_precision;
      int xoffset;
      int yoffset;
      int xbsep;
      int ybsep;
      int xblen;
      int yblen;

      SchroFrameData block;
      SchroFrameData alloc_block;
      SchroFrameData obmc_weight;

      SchroFrameData alloc_block_ref[2];
      SchroFrameData block_ref[2];

      int weight_x[SCHRO_LIMIT_BLOCK_SIZE];
      int weight_y[SCHRO_LIMIT_BLOCK_SIZE];
      int width;
      int height;
      int max_fast_x;
      int max_fast_y;

      schro_bool simple_weight;
      schro_bool oneref_noscale;
    };

### SCHRO_MOTION_GET_BLOCK()

    #define             SCHRO_MOTION_GET_BLOCK(motion,x,y)

### schro_motion_dc_prediction ()

    void                schro_motion_dc_prediction          (SchroMotion *motion,
                                                             int x,
                                                             int y,
                                                             int *pred);

### schro_motion_vector_prediction ()

    void                schro_motion_vector_prediction      (SchroMotion *motion,
                                                             int x,
                                                             int y,
                                                             int *pred_x,
                                                             int *pred_y,
                                                             int mode);

### schro_motion_split_prediction ()

    int                 schro_motion_split_prediction       (SchroMotion *motion,
                                                             int x,
                                                             int y);

### schro_motion_get_mode_prediction ()

    int                 schro_motion_get_mode_prediction    (SchroMotion *motion,
                                                             int x,
                                                             int y);

### schro_motion_block_estimate_entropy ()

    int                 schro_motion_block_estimate_entropy (SchroMotion *motion,
                                                             int i,
                                                             int j);

### schro_motion_copy_from ()

    void                schro_motion_copy_from              (SchroMotion *motion,
                                                             int i,
                                                             int j,
                                                             SchroBlock *block);

### schro_motion_copy_to ()

    void                schro_motion_copy_to                (SchroMotion *motion,
                                                             int i,
                                                             int j,
                                                             SchroBlock *block);

### schro_motion_estimate_entropy ()

    int                 schro_motion_estimate_entropy       (SchroMotion *motion);

### schro_motion_field_lshift ()

    void                schro_motion_field_lshift           (SchroMotionField *mf,
                                                             int n);

### schro_motion_free ()

    void                schro_motion_free                   (SchroMotion *motion);

### schro_motion_get_global_prediction ()

    int                 schro_motion_get_global_prediction  (SchroMotion *motion,
                                                             int x,
                                                             int y);

### schro_motion_new ()

    SchroMotion *       schro_motion_new                    (SchroParams *params,
                                                             SchroUpsampledFrame *ref1,
                                                             SchroUpsampledFrame *ref2);

### schro_motion_render ()

    void                schro_motion_render                 (SchroMotion *motion,
                                                             SchroFrame *dest,
                                                             SchroFrame *addframe,
                                                             int add,
                                                             SchroFrame *output_frame);

### schro_motion_render_cuda ()

    void                schro_motion_render_cuda            (SchroMotion *motion,
                                                             SchroFrame *dest);

### schro_motion_render_ref ()

    void                schro_motion_render_ref             (SchroMotion *motion,
                                                             SchroFrame *dest,
                                                             SchroFrame *addframe,
                                                             int add,
                                                             SchroFrame *output_frame);

### schro_motion_superblock_estimate_entropy ()

    int                 schro_motion_superblock_estimate_entropy
                                                            (SchroMotion *motion,
                                                             int i,
                                                             int j);

### schro_motion_superblock_try_estimate_entropy ()

    int                 schro_motion_superblock_try_estimate_entropy
                                                            (SchroMotion *motion,
                                                             int i,
                                                             int j,
                                                             SchroBlock *block);

### schro_motion_vector_is_equal ()

    int                 schro_motion_vector_is_equal        (SchroMotionVector *mv1,
                                                             SchroMotionVector *mv2);

### schro_motion_field_new ()

    SchroMotionField *  schro_motion_field_new              (int x_num_blocks,
                                                             int y_num_blocks);

### schro_motion_field_free ()

    void                schro_motion_field_free             (SchroMotionField *field);

### schro_motion_field_scan ()

    void                schro_motion_field_scan             (SchroMotionField *field,
                                                             SchroParams *params,
                                                             SchroFrame *frame,
                                                             SchroFrame *ref,
                                                             int dist);

### schro_motion_field_inherit ()

    void                schro_motion_field_inherit          (SchroMotionField *field,
                                                             SchroMotionField *parent);

### schro_motion_field_copy ()

    void                schro_motion_field_copy             (SchroMotionField *field,
                                                             SchroMotionField *parent);

### schro_motion_verify ()

    int                 schro_motion_verify                 (SchroMotion *mf);