blob: d9574017b9725bc4b68056aeca980a8b9a147354 [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
2 * Copyright (c) 2016 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be
7 * found in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Yaowu Xuf883b422016-08-30 14:01:10 -070011#ifndef AV1_COMMON_WARPED_MOTION_H
12#define AV1_COMMON_WARPED_MOTION_H
Yaowu Xuc27fc142016-08-22 16:08:15 -070013
14#include <stdio.h>
15#include <stdlib.h>
16#include <memory.h>
17#include <math.h>
18#include <assert.h>
19
Yaowu Xuf883b422016-08-30 14:01:10 -070020#include "./aom_config.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070021#include "aom_ports/mem.h"
Yaowu Xuf883b422016-08-30 14:01:10 -070022#include "aom_dsp/aom_dsp_common.h"
Sarah Parkere5299862016-08-16 14:57:37 -070023#include "av1/common/mv.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070024
25// Bits of precision used for the model
26#define WARPEDMODEL_PREC_BITS 8
27#define WARPEDMODEL_ROW3HOMO_PREC_BITS 12
28
29// Bits of subpel precision for warped interpolation
30#define WARPEDPIXEL_PREC_BITS 6
31#define WARPEDPIXEL_PREC_SHIFTS (1 << WARPEDPIXEL_PREC_BITS)
32
33// Taps for ntap filter
34#define WARPEDPIXEL_FILTER_TAPS 6
35
36// Precision of filter taps
37#define WARPEDPIXEL_FILTER_BITS 7
38
39#define WARPEDDIFF_PREC_BITS (WARPEDMODEL_PREC_BITS - WARPEDPIXEL_PREC_BITS)
40
Sarah Parkere5299862016-08-16 14:57:37 -070041typedef void (*ProjectPointsType)(int16_t *mat, int *points, int *proj,
42 const int n, const int stride_points,
Yaowu Xuc27fc142016-08-22 16:08:15 -070043 const int stride_proj,
44 const int subsampling_x,
45 const int subsampling_y);
Sarah Parkere5299862016-08-16 14:57:37 -070046
47void projectPointsHomography(int16_t *mat, int *points, int *proj, const int n,
Yaowu Xuc27fc142016-08-22 16:08:15 -070048 const int stride_points, const int stride_proj,
49 const int subsampling_x, const int subsampling_y);
Sarah Parkere5299862016-08-16 14:57:37 -070050
51void projectPointsAffine(int16_t *mat, int *points, int *proj, const int n,
Yaowu Xuc27fc142016-08-22 16:08:15 -070052 const int stride_points, const int stride_proj,
53 const int subsampling_x, const int subsampling_y);
Sarah Parkere5299862016-08-16 14:57:37 -070054
55void projectPointsRotZoom(int16_t *mat, int *points, int *proj, const int n,
Yaowu Xuc27fc142016-08-22 16:08:15 -070056 const int stride_points, const int stride_proj,
57 const int subsampling_x, const int subsampling_y);
Sarah Parkere5299862016-08-16 14:57:37 -070058
59void projectPointsTranslation(int16_t *mat, int *points, int *proj, const int n,
Yaowu Xuc27fc142016-08-22 16:08:15 -070060 const int stride_points, const int stride_proj,
61 const int subsampling_x, const int subsampling_y);
62
Yaowu Xuf883b422016-08-30 14:01:10 -070063double av1_warp_erroradv(WarpedMotionParams *wm,
Sarah Parkere5299862016-08-16 14:57:37 -070064#if CONFIG_VP9_HIGHBITDEPTH
65 int use_hbd, int bd,
66#endif // CONFIG_VP9_HIGHBITDEPTH
67 uint8_t *ref, int width, int height, int stride,
68 uint8_t *dst, int p_col, int p_row, int p_width,
69 int p_height, int p_stride, int subsampling_x,
70 int subsampling_y, int x_scale, int y_scale);
Yaowu Xuc27fc142016-08-22 16:08:15 -070071
Yaowu Xuf883b422016-08-30 14:01:10 -070072void av1_warp_plane(WarpedMotionParams *wm,
73#if CONFIG_AOM_HIGHBITDEPTH
74 int use_hbd, int bd,
75#endif // CONFIG_AOM_HIGHBITDEPTH
76 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, int x_scale, int y_scale);
Yaowu Xuc27fc142016-08-22 16:08:15 -070080
81// Integerize model into the WarpedMotionParams structure
Yaowu Xuf883b422016-08-30 14:01:10 -070082void av1_integerize_model(const double *model, TransformationType wmtype,
83 WarpedMotionParams *wm);
84#endif // AV1_COMMON_WARPED_MOTION_H