## schromotion schromotion |

## Synopsis

                        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);
    void                schro_motion_render_cuda            (SchroMotion *motion,
                                                             SchroFrame *dest);
    void                schro_motion_render_ref             (SchroMotion *motion,
                                                             SchroFrame *dest);
    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

### SchroMotion

    typedef struct {
      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;
    } SchroMotion;

### SCHRO_MOTION_GET_BLOCK()

    #define             SCHRO_MOTION_GET_BLOCK(motion,x,y)

`motion` : |
`x` : |
`y` : |

### schro_motion_dc_prediction ()

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

`motion` : |
`x` : |
`y` : |
`pred` : |

### schro_motion_vector_prediction ()

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

`motion` : |
`x` : |
`y` : |
`pred_x` : |
`pred_y` : |
`mode` : |

### schro_motion_split_prediction ()

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

`motion` : |
`x` : |
`y` : |
Returns : |

### schro_motion_get_mode_prediction ()

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

`motion` : |
`x` : |
`y` : |
Returns : |

### schro_motion_block_estimate_entropy ()

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

`motion` : |
`i` : |
`j` : |
Returns : |

### schro_motion_copy_from ()

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

`motion` : |
`i` : |
`j` : |
`block` : |

### schro_motion_copy_to ()

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

`motion` : |
`i` : |
`j` : |
`block` : |

### schro_motion_estimate_entropy ()

    int                 schro_motion_estimate_entropy       (SchroMotion *motion);

`motion` : |
Returns : |

### schro_motion_field_lshift ()

    void                schro_motion_field_lshift           (SchroMotionField *mf,
                                                             int n);

`mf` : |
`n` : |

### schro_motion_free ()

    void                schro_motion_free                   (SchroMotion *motion);

`motion` : |

### schro_motion_get_global_prediction ()

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

`motion` : |
`x` : |
`y` : |
Returns : |

### schro_motion_new ()

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

`params` : |
`ref1` : |
`ref2` : |
Returns : |

### schro_motion_render ()

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

`motion` : |
`dest` : |

### schro_motion_render_cuda ()

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

`motion` : |
`dest` : |

### schro_motion_render_ref ()

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

`motion` : |
`dest` : |

### schro_motion_superblock_estimate_entropy ()

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

`motion` : |
`i` : |
`j` : |
Returns : |

### schro_motion_superblock_try_estimate_entropy ()

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

`motion` : |
`i` : |
`j` : |
`block` : |
Returns : |

### schro_motion_vector_is_equal ()

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

`mv1` : |
`mv2` : |
Returns : |

### schro_motion_field_new ()

    SchroMotionField *  schro_motion_field_new              (int x_num_blocks,
                                                             int y_num_blocks);

`x_num_blocks` : |
`y_num_blocks` : |
Returns : |

### schro_motion_field_free ()

    void                schro_motion_field_free             (SchroMotionField *field);

`field` : |

### schro_motion_field_scan ()

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

`field` : |
`params` : |
`frame` : |
`ref` : |
`dist` : |

### schro_motion_field_inherit ()

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

`field` : |
`parent` : |

### schro_motion_field_copy ()

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

`field` : |
`parent` : |

### schro_motion_verify ()

    int                 schro_motion_verify                 (SchroMotion *mf);

`mf` : |
Returns : |