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 |
(...skipping 28 matching lines...) Expand all Loading... |
39 void vp9_setup_scale_factors_for_frame(struct scale_factors *sf, | 39 void vp9_setup_scale_factors_for_frame(struct scale_factors *sf, |
40 int other_w, int other_h, | 40 int other_w, int other_h, |
41 int this_w, int this_h); | 41 int this_w, int this_h); |
42 | 42 |
43 static INLINE int vp9_is_valid_scale(const struct scale_factors *sf) { | 43 static INLINE int vp9_is_valid_scale(const struct scale_factors *sf) { |
44 return sf->x_scale_fp != REF_INVALID_SCALE && | 44 return sf->x_scale_fp != REF_INVALID_SCALE && |
45 sf->y_scale_fp != REF_INVALID_SCALE; | 45 sf->y_scale_fp != REF_INVALID_SCALE; |
46 } | 46 } |
47 | 47 |
48 static INLINE int vp9_is_scaled(const struct scale_factors *sf) { | 48 static INLINE int vp9_is_scaled(const struct scale_factors *sf) { |
49 return sf->x_scale_fp != REF_NO_SCALE || | 49 return vp9_is_valid_scale(sf) && |
50 sf->y_scale_fp != REF_NO_SCALE; | 50 (sf->x_scale_fp != REF_NO_SCALE || sf->y_scale_fp != REF_NO_SCALE); |
| 51 } |
| 52 |
| 53 static INLINE int valid_ref_frame_size(int ref_width, int ref_height, |
| 54 int this_width, int this_height) { |
| 55 return 2 * this_width >= ref_width && |
| 56 2 * this_height >= ref_height && |
| 57 this_width <= 16 * ref_width && |
| 58 this_height <= 16 * ref_height; |
51 } | 59 } |
52 | 60 |
53 #ifdef __cplusplus | 61 #ifdef __cplusplus |
54 } // extern "C" | 62 } // extern "C" |
55 #endif | 63 #endif |
56 | 64 |
57 #endif // VP9_COMMON_VP9_SCALE_H_ | 65 #endif // VP9_COMMON_VP9_SCALE_H_ |
OLD | NEW |