2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
12 #ifndef AV1_COMMON_WARPED_MOTION_H_
13 #define AV1_COMMON_WARPED_MOTION_H_
21 #include "./aom_config.h"
22 #include "aom_ports/mem.h"
23 #include "aom_dsp/aom_dsp_common.h"
24 #include "av1/common/mv.h"
25 #include "av1/common/convolve.h"
27 #define MAX_PARAMDIM 9
28 #define LEAST_SQUARES_SAMPLES_MAX_BITS 3
29 #define LEAST_SQUARES_SAMPLES_MAX (1 << LEAST_SQUARES_SAMPLES_MAX_BITS)
31 #define WARPED_MOTION_DEBUG 0
33 #if CONFIG_EXT_WARPED_MOTION
34 // Search 1 row on the top and 1 column on the left, 1 upper-left block,
35 // 1 upper-right block. In worst case, the samples are (MAX_MIB_SIZE * 2 + 2).
36 // Here force number of samples within SAMPLES_MAX.
37 #define SAMPLES_MAX (LEAST_SQUARES_SAMPLES_MAX * 2)
38 #define SAMPLES_ARRAY_SIZE (SAMPLES_MAX * 2)
40 #define SAMPLES_ARRAY_SIZE (LEAST_SQUARES_SAMPLES_MAX * 2)
41 #endif // CONFIG_EXT_WARPED_MOTION
43 #define DEFAULT_WMTYPE AFFINE
45 extern const int16_t warped_filter
[WARPEDPIXEL_PREC_SHIFTS
* 3 + 1][8];
47 void project_points_affine(const int32_t *mat
, int *points
, int *proj
,
48 const int n
, const int stride_points
,
49 const int stride_proj
, const int subsampling_x
,
50 const int subsampling_y
);
52 // Returns the error between the result of applying motion 'wm' to the frame
53 // described by 'ref' and the frame described by 'dst'.
54 int64_t av1_warp_error(WarpedMotionParams
*wm
,
55 #if CONFIG_HIGHBITDEPTH
57 #endif // CONFIG_HIGHBITDEPTH
58 const uint8_t *ref
, int width
, int height
, int stride
,
59 uint8_t *dst
, int p_col
, int p_row
, int p_width
,
60 int p_height
, int p_stride
, int subsampling_x
,
61 int subsampling_y
, int64_t best_error
);
63 // Returns the error between the frame described by 'ref' and the frame
64 // described by 'dst'.
65 int64_t av1_frame_error(
66 #if CONFIG_HIGHBITDEPTH
68 #endif // CONFIG_HIGHBITDEPTH
69 const uint8_t *ref
, int stride
, uint8_t *dst
, int p_width
, int p_height
,
72 void av1_warp_plane(WarpedMotionParams
*wm
,
73 #if CONFIG_HIGHBITDEPTH
75 #endif // CONFIG_HIGHBITDEPTH
76 const uint8_t *ref
, int width
, int height
, int stride
,
77 uint8_t *pred
, int p_col
, int p_row
, int p_width
,
78 int p_height
, int p_stride
, int subsampling_x
,
79 int subsampling_y
, ConvolveParams
*conv_params
);
81 int find_projection(int np
, int *pts1
, int *pts2
, BLOCK_SIZE bsize
, int mvy
,
82 int mvx
, WarpedMotionParams
*wm_params
, int mi_row
,
85 int get_shear_params(WarpedMotionParams
*wm
);
86 #endif // AV1_COMMON_WARPED_MOTION_H_