| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef VP9_COMMON_VP9_SCALE_H_ | 11 #ifndef VP9_COMMON_VP9_SCALE_H_ |
| 12 #define VP9_COMMON_VP9_SCALE_H_ | 12 #define VP9_COMMON_VP9_SCALE_H_ |
| 13 | 13 |
| 14 #include "vp9/common/vp9_mv.h" | 14 #include "vp9/common/vp9_mv.h" |
| 15 #include "vp9/common/vp9_convolve.h" | 15 #include "vp9/common/vp9_convolve.h" |
| 16 | 16 |
| 17 #define REF_SCALE_SHIFT 14 | 17 #define REF_SCALE_SHIFT 14 |
| 18 #define REF_NO_SCALE (1 << REF_SCALE_SHIFT) | 18 #define REF_NO_SCALE (1 << REF_SCALE_SHIFT) |
| 19 #define REF_INVALID_SCALE -1 | 19 #define REF_INVALID_SCALE -1 |
| 20 | 20 |
| 21 struct scale_factors { | 21 struct scale_factors; |
| 22 struct scale_factors_common { |
| 22 int x_scale_fp; // horizontal fixed point scale factor | 23 int x_scale_fp; // horizontal fixed point scale factor |
| 23 int y_scale_fp; // vertical fixed point scale factor | 24 int y_scale_fp; // vertical fixed point scale factor |
| 24 int x_offset_q4; | |
| 25 int x_step_q4; | 25 int x_step_q4; |
| 26 int y_offset_q4; | |
| 27 int y_step_q4; | 26 int y_step_q4; |
| 28 | 27 |
| 29 int (*scale_value_x)(int val, const struct scale_factors *scale); | 28 int (*scale_value_x)(int val, const struct scale_factors_common *sfc); |
| 30 int (*scale_value_y)(int val, const struct scale_factors *scale); | 29 int (*scale_value_y)(int val, const struct scale_factors_common *sfc); |
| 31 void (*set_scaled_offsets)(struct scale_factors *scale, int row, int col); | 30 void (*set_scaled_offsets)(struct scale_factors *scale, int row, int col); |
| 32 MV32 (*scale_mv)(const MV *mv, const struct scale_factors *scale); | 31 MV32 (*scale_mv)(const MV *mv, const struct scale_factors *scale); |
| 33 | 32 |
| 34 convolve_fn_t predict[2][2][2]; // horiz, vert, avg | 33 convolve_fn_t predict[2][2][2]; // horiz, vert, avg |
| 35 }; | 34 }; |
| 36 | 35 |
| 36 struct scale_factors { |
| 37 int x_offset_q4; |
| 38 int y_offset_q4; |
| 39 const struct scale_factors_common *sfc; |
| 40 }; |
| 41 |
| 37 void vp9_setup_scale_factors_for_frame(struct scale_factors *scale, | 42 void vp9_setup_scale_factors_for_frame(struct scale_factors *scale, |
| 43 struct scale_factors_common *scale_comm, |
| 38 int other_w, int other_h, | 44 int other_w, int other_h, |
| 39 int this_w, int this_h); | 45 int this_w, int this_h); |
| 40 | 46 |
| 41 static int vp9_is_valid_scale(const struct scale_factors *sf) { | 47 static int vp9_is_valid_scale(const struct scale_factors_common *sfc) { |
| 42 return sf->x_scale_fp != REF_INVALID_SCALE && | 48 return sfc->x_scale_fp != REF_INVALID_SCALE && |
| 43 sf->y_scale_fp != REF_INVALID_SCALE; | 49 sfc->y_scale_fp != REF_INVALID_SCALE; |
| 44 } | 50 } |
| 45 | 51 |
| 46 static int vp9_is_scaled(const struct scale_factors *sf) { | 52 static int vp9_is_scaled(const struct scale_factors_common *sfc) { |
| 47 return sf->x_scale_fp != REF_NO_SCALE || | 53 return sfc->x_scale_fp != REF_NO_SCALE || |
| 48 sf->y_scale_fp != REF_NO_SCALE; | 54 sfc->y_scale_fp != REF_NO_SCALE; |
| 49 } | 55 } |
| 50 | 56 |
| 51 #endif // VP9_COMMON_VP9_SCALE_H_ | 57 #endif // VP9_COMMON_VP9_SCALE_H_ |
| OLD | NEW |