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