warped_motion.h 4.19 KB
Newer Older
1
/*
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3
 *
4 5 6 7 8 9
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10 11
 */

12 13
#ifndef AV1_COMMON_WARPED_MOTION_H_
#define AV1_COMMON_WARPED_MOTION_H_
14 15 16 17 18 19 20

#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <math.h>
#include <assert.h>

Yaowu Xu's avatar
Yaowu Xu committed
21
#include "./aom_config.h"
22
#include "aom_ports/mem.h"
Yaowu Xu's avatar
Yaowu Xu committed
23
#include "aom_dsp/aom_dsp_common.h"
24
#include "av1/common/mv.h"
25

26
#define MAX_PARAMDIM 9
Yue Chen's avatar
Yue Chen committed
27
#if CONFIG_WARPED_MOTION
28 29
#define SAMPLES_PER_NEIGHBOR 4
#define SAMPLES_ARRAY_SIZE ((2 * MAX_MIB_SIZE + 2) * SAMPLES_PER_NEIGHBOR * 2)
30
#define DEFAULT_WMTYPE AFFINE
Yue Chen's avatar
Yue Chen committed
31
#endif  // CONFIG_WARPED_MOTION
32

33 34
const int16_t warped_filter[WARPEDPIXEL_PREC_SHIFTS * 3][8];

35
typedef void (*ProjectPointsFunc)(int32_t *mat, int *points, int *proj,
36
                                  const int n, const int stride_points,
37 38 39
                                  const int stride_proj,
                                  const int subsampling_x,
                                  const int subsampling_y);
40

41
void project_points_translation(int32_t *mat, int *points, int *proj,
42 43 44
                                const int n, const int stride_points,
                                const int stride_proj, const int subsampling_x,
                                const int subsampling_y);
45

46
void project_points_rotzoom(int32_t *mat, int *points, int *proj, const int n,
47 48
                            const int stride_points, const int stride_proj,
                            const int subsampling_x, const int subsampling_y);
49

50
void project_points_affine(int32_t *mat, int *points, int *proj, const int n,
51 52
                           const int stride_points, const int stride_proj,
                           const int subsampling_x, const int subsampling_y);
53

54 55 56 57 58 59 60 61
void project_points_hortrapezoid(int32_t *mat, int *points, int *proj,
                                 const int n, const int stride_points,
                                 const int stride_proj, const int subsampling_x,
                                 const int subsampling_y);
void project_points_vertrapezoid(int32_t *mat, int *points, int *proj,
                                 const int n, const int stride_points,
                                 const int stride_proj, const int subsampling_x,
                                 const int subsampling_y);
62
void project_points_homography(int32_t *mat, int *points, int *proj,
63 64 65
                               const int n, const int stride_points,
                               const int stride_proj, const int subsampling_x,
                               const int subsampling_y);
66

Yue Chen's avatar
Yue Chen committed
67 68 69 70
void project_points(WarpedMotionParams *wm_params, int *points, int *proj,
                    const int n, const int stride_points, const int stride_proj,
                    const int subsampling_x, const int subsampling_y);

Yaowu Xu's avatar
Yaowu Xu committed
71
double av1_warp_erroradv(WarpedMotionParams *wm,
72 73 74 75 76 77 78
#if CONFIG_AOM_HIGHBITDEPTH
                         int use_hbd, int bd,
#endif  // CONFIG_AOM_HIGHBITDEPTH
                         uint8_t *ref, int width, int height, int stride,
                         uint8_t *dst, int p_col, int p_row, int p_width,
                         int p_height, int p_stride, int subsampling_x,
                         int subsampling_y, int x_scale, int y_scale);
79

Yaowu Xu's avatar
Yaowu Xu committed
80 81 82 83 84 85 86
void av1_warp_plane(WarpedMotionParams *wm,
#if CONFIG_AOM_HIGHBITDEPTH
                    int use_hbd, int bd,
#endif  // CONFIG_AOM_HIGHBITDEPTH
                    uint8_t *ref, int width, int height, int stride,
                    uint8_t *pred, int p_col, int p_row, int p_width,
                    int p_height, int p_stride, int subsampling_x,
87
                    int subsampling_y, int x_scale, int y_scale, int ref_frm);
88

89
int find_projection(const int np, int *pts1, int *pts2,
90
                    WarpedMotionParams *wm_params, int mi_row, int mi_col);
91
#endif  // AV1_COMMON_WARPED_MOTION_H_