2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
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 found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef VP9_COMMON_VP9_SCALE_H_
12 #define VP9_COMMON_VP9_SCALE_H_
14 #include "vp9/common/vp9_mv.h"
15 #include "vp9/common/vp9_convolve.h"
21 #define REF_SCALE_SHIFT 14
22 #define REF_NO_SCALE (1 << REF_SCALE_SHIFT)
23 #define REF_INVALID_SCALE -1
25 struct scale_factors {
26 int x_scale_fp; // horizontal fixed point scale factor
27 int y_scale_fp; // vertical fixed point scale factor
31 int (*scale_value_x)(int val, const struct scale_factors *sf);
32 int (*scale_value_y)(int val, const struct scale_factors *sf);
34 convolve_fn_t predict[2][2][2]; // horiz, vert, avg
37 MV32 vp9_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf);
39 void vp9_setup_scale_factors_for_frame(struct scale_factors *sf,
40 int other_w, int other_h,
41 int this_w, int this_h);
43 static INLINE int vp9_is_valid_scale(const struct scale_factors *sf) {
44 return sf->x_scale_fp != REF_INVALID_SCALE &&
45 sf->y_scale_fp != REF_INVALID_SCALE;
48 static INLINE int vp9_is_scaled(const struct scale_factors *sf) {
49 return sf->x_scale_fp != REF_NO_SCALE ||
50 sf->y_scale_fp != REF_NO_SCALE;
57 #endif // VP9_COMMON_VP9_SCALE_H_