vsp_VPP.h revision 3f1e626a9ae2610e00e47b2da0b43212b1c13ddf
1/*
2 * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 *    Binglin Chen <binglin.chen@intel.com>
26 *
27 */
28
29#ifndef _VSP_VPP_H_
30#define _VSP_VPP_H_
31
32#include "psb_drv_video.h"
33#include <linux/vsp_fw.h>
34
35#define CONTEXT_VPP_ID 0
36#define CONTEXT_VP8_ID 0
37
38struct context_VPP_s {
39	object_context_p obj_context; /* back reference */
40
41	uint32_t profile; // ENTDEC BE_PROFILE & FE_PROFILE
42	uint32_t profile_idc; // BE_PROFILEIDC
43
44	struct psb_buffer_s *context_buf;
45
46	VABufferID *filters;
47	unsigned int num_filters;
48
49	enum vsp_format format;
50
51	object_buffer_p filter_buf[VssProcPipelineMaxNumFilters];
52	object_buffer_p frc_buf;
53
54	unsigned int param_sz;
55	unsigned int pic_param_sz;
56	unsigned int pic_param_offset;
57	unsigned int end_param_sz;
58	unsigned int end_param_offset;
59	unsigned int pipeline_param_sz;
60	unsigned int pipeline_param_offset;
61	unsigned int denoise_param_sz;
62	unsigned int denoise_param_offset;
63	unsigned int enhancer_param_sz;
64	unsigned int enhancer_param_offset;
65	unsigned int sharpen_param_sz;
66	unsigned int sharpen_param_offset;
67	unsigned int frc_param_sz;
68	unsigned int frc_param_offset;
69	unsigned int seq_param_sz;
70	unsigned int seq_param_offset;
71	struct VssProcDenoiseParameterBuffer denoise_deblock_param;
72	struct VssProcColorEnhancementParameterBuffer enhancer_param;
73	struct VssProcSharpenParameterBuffer sharpen_param;
74	//used for vp8 only
75	unsigned int frame_width;
76	unsigned int frame_height;
77    unsigned int frame_rate;
78	unsigned int rc_mode;
79    unsigned int initial_qp;
80    unsigned int min_qp;
81    unsigned int bits_per_second;
82    unsigned int max_frame_size;
83    unsigned int cyclic_intra_refresh;
84	unsigned int vp8_seq_cmd_send;
85    unsigned int re_send_seq_params;
86    struct VssVp8encSequenceParameterBuffer vp8_seq_param;
87};
88
89typedef struct context_VPP_s *context_VPP_p;
90
91extern struct format_vtable_s vsp_VPP_vtable;
92
93/**
94 * Queries video processing filters.
95 *
96 * This function returns the list of video processing filters supported
97 * by the driver. The filters array is allocated by the user and
98 * num_filters shall be initialized to the number of allocated
99 * elements in that array. Upon successful return, the actual number
100 * of filters will be overwritten into num_filters. Otherwise,
101 * VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and num_filters
102 * is adjusted to the number of elements that would be returned if enough
103 * space was available.
104 *
105 * The list of video processing filters supported by the driver shall
106 * be ordered in the way they can be iteratively applied. This is needed
107 * for both correctness, i.e. some filters would not mean anything if
108 * applied at the beginning of the pipeline; but also for performance
109 * since some filters can be applied in a single pass (e.g. noise
110 * reduction + deinterlacing).
111 *
112 */
113VAStatus vsp_QueryVideoProcFilters(
114        VADriverContextP    ctx,
115        VAContextID         context,
116        VAProcFilterType   *filters,
117        unsigned int       *num_filters
118	);
119
120/**
121 * Queries video filter capabilities.
122 *
123 * This function returns the list of capabilities supported by the driver
124 * for a specific video filter. The filter_caps array is allocated by
125 * the user and num_filter_caps shall be initialized to the number
126 * of allocated elements in that array. Upon successful return, the
127 * actual number of filters will be overwritten into num_filter_caps.
128 * Otherwise, VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and
129 * num_filter_caps is adjusted to the number of elements that would be
130 * returned if enough space was available.
131 *
132 */
133VAStatus vsp_QueryVideoProcFilterCaps(
134        VADriverContextP    ctx,
135        VAContextID         context,
136        VAProcFilterType    type,
137        void               *filter_caps,
138        unsigned int       *num_filter_caps
139	);
140
141/**
142 * Queries video processing pipeline capabilities.
143 *
144 * This function returns the video processing pipeline capabilities. The
145 * filters array defines the video processing pipeline and is an array
146 * of buffers holding filter parameters.
147 *
148 * Note: the VAProcPipelineCaps structure contains user-provided arrays.
149 * If non-NULL, the corresponding num_* fields shall be filled in on
150 * input with the number of elements allocated. Upon successful return,
151 * the actual number of elements will be overwritten into the num_*
152 * fields. Otherwise, VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned
153 * and num_* fields are adjusted to the number of elements that would
154 * be returned if enough space was available.
155 *
156 */
157VAStatus vsp_QueryVideoProcPipelineCaps(
158	VADriverContextP    ctx,
159        VAContextID         context,
160        VABufferID         *filters,
161        unsigned int        num_filters,
162        VAProcPipelineCaps *pipeline_caps
163    );
164
165#endif /* _VSS_VPP_H_ */
166