1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libvpx/vp9/common/vp9_scale.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +/* 1.5 + * Copyright (c) 2013 The WebM project authors. All Rights Reserved. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license 1.8 + * that can be found in the LICENSE file in the root of the source 1.9 + * tree. An additional intellectual property rights grant can be found 1.10 + * in the file PATENTS. All contributing project authors may 1.11 + * be found in the AUTHORS file in the root of the source tree. 1.12 + */ 1.13 + 1.14 +#ifndef VP9_COMMON_VP9_SCALE_H_ 1.15 +#define VP9_COMMON_VP9_SCALE_H_ 1.16 + 1.17 +#include "vp9/common/vp9_mv.h" 1.18 +#include "vp9/common/vp9_convolve.h" 1.19 + 1.20 +#define REF_SCALE_SHIFT 14 1.21 +#define REF_NO_SCALE (1 << REF_SCALE_SHIFT) 1.22 +#define REF_INVALID_SCALE -1 1.23 + 1.24 +struct scale_factors; 1.25 +struct scale_factors_common { 1.26 + int x_scale_fp; // horizontal fixed point scale factor 1.27 + int y_scale_fp; // vertical fixed point scale factor 1.28 + int x_step_q4; 1.29 + int y_step_q4; 1.30 + 1.31 + int (*scale_value_x)(int val, const struct scale_factors_common *sfc); 1.32 + int (*scale_value_y)(int val, const struct scale_factors_common *sfc); 1.33 + void (*set_scaled_offsets)(struct scale_factors *scale, int row, int col); 1.34 + MV32 (*scale_mv)(const MV *mv, const struct scale_factors *scale); 1.35 + 1.36 + convolve_fn_t predict[2][2][2]; // horiz, vert, avg 1.37 +}; 1.38 + 1.39 +struct scale_factors { 1.40 + int x_offset_q4; 1.41 + int y_offset_q4; 1.42 + const struct scale_factors_common *sfc; 1.43 +}; 1.44 + 1.45 +void vp9_setup_scale_factors_for_frame(struct scale_factors *scale, 1.46 + struct scale_factors_common *scale_comm, 1.47 + int other_w, int other_h, 1.48 + int this_w, int this_h); 1.49 + 1.50 +static int vp9_is_valid_scale(const struct scale_factors_common *sfc) { 1.51 + return sfc->x_scale_fp != REF_INVALID_SCALE && 1.52 + sfc->y_scale_fp != REF_INVALID_SCALE; 1.53 +} 1.54 + 1.55 +static int vp9_is_scaled(const struct scale_factors_common *sfc) { 1.56 + return sfc->x_scale_fp != REF_NO_SCALE || 1.57 + sfc->y_scale_fp != REF_NO_SCALE; 1.58 +} 1.59 + 1.60 +#endif // VP9_COMMON_VP9_SCALE_H_