2 * i965_vpp_avs.h - Adaptive Video Scaler (AVS) block
4 * Copyright (C) 2014 Intel Corporation
5 * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #ifndef I965_VPP_AVS_H
29 #define I965_VPP_AVS_H
34 /** Maximum number of phases for the sharp filter */
35 #define AVS_MAX_PHASES 32
37 /** Maximum number of coefficients for luma samples */
38 #define AVS_MAX_LUMA_COEFFS 8
40 /** Maximum number of coefficients for chroma samples */
41 #define AVS_MAX_CHROMA_COEFFS 4
43 typedef struct avs_coeffs AVSCoeffs;
44 typedef struct avs_coeffs_range AVSCoeffsRange;
45 typedef struct avs_config AVSConfig;
46 typedef struct avs_state AVSState;
48 /** AVS coefficients for one phase */
50 /** Coefficients for luma samples on the X-axis (horizontal) */
51 float y_k_h[AVS_MAX_LUMA_COEFFS];
52 /** Coefficients for luma samples on the Y-axis (vertical) */
53 float y_k_v[AVS_MAX_LUMA_COEFFS];
54 /** Coefficients for chroma samples on the X-axis (horizontal) */
55 float uv_k_h[AVS_MAX_CHROMA_COEFFS];
56 /** Coefficients for chroma samples on the Y-axis (vertical) */
57 float uv_k_v[AVS_MAX_CHROMA_COEFFS];
60 /** AVS coefficients range used for validation */
61 struct avs_coeffs_range {
62 /** Lower bound for all coefficients */
63 AVSCoeffs lower_bound;
64 /** Upper bound for all coefficients */
65 AVSCoeffs upper_bound;
68 /** Static configuration (per-generation) */
70 /** Number of bits used for the fractional part of a coefficient */
72 /** The smallest float that could be represented as a coefficient */
74 /** Coefficients range */
75 AVSCoeffsRange coeff_range;
76 /** Number of phases for the sharp filter */
78 /** Number of coefficients for luma samples */
80 /** Number of coefficients for chroma samples */
81 int num_chroma_coeffs;
84 /** AVS block state */
86 /** Per-generation configuration parameters */
87 const AVSConfig *config;
90 /** Scaling factor on the X-axis (horizontal) */
92 /** Scaling factor on the Y-axis (vertical) */
94 /** Coefficients for the polyphase scaler */
95 AVSCoeffs coeffs[AVS_MAX_PHASES + 1];
98 /** Initializes AVS state with the supplied configuration */
100 avs_init_state(AVSState *avs, const AVSConfig *config);
102 /** Updates AVS coefficients for the supplied factors and quality level */
104 avs_update_coefficients(AVSState *avs, float sx, float sy, uint32_t flags);
106 /** Checks whether AVS is needed, e.g. if high-quality scaling is requested */
108 avs_is_needed(uint32_t flags)
110 return ((flags & VA_FILTER_SCALING_MASK) >= VA_FILTER_SCALING_HQ);
113 #endif /* I965_VPP_AVS_H */