2 * Copyright © 2010 Intel Corporation
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:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
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.
25 * Xiang Haihao <haihao.xiang@intel.com>
29 #ifndef __I965_POST_PROCESSING_H__
30 #define __I965_POST_PROCESSING_H__
32 #define MAX_PP_SURFACES 48
34 #define I965_PP_FLAG_TOP_FIELD 1
35 #define I965_PP_FLAG_BOTTOM_FIELD 2
37 #define I965_PP_FLAG_AVS 4
38 #define I965_PP_FLAG_DEINTERLACING 8
43 PP_NV12_LOAD_SAVE_N12,
44 PP_NV12_LOAD_SAVE_PL3,
54 struct pp_load_save_context
60 struct pp_scaling_context
62 int dest_x; /* in pixel */
63 int dest_y; /* in pixel */
72 int dest_x; /* in pixel */
73 int dest_y; /* in pixel */
82 struct pp_dndi_context
96 struct i965_kernel kernel;
99 VAStatus (*initialize)(VADriverContextP ctx, struct i965_post_processing_context *pp_context,
100 const struct i965_surface *src_surface,
101 const VARectangle *src_rect,
102 struct i965_surface *dst_surface,
103 const VARectangle *dst_rect,
107 struct pp_static_parameter
111 float procamp_constant_c0;
113 /* Load and Same r1.1 */
114 unsigned int source_packed_y_offset:8;
115 unsigned int source_packed_u_offset:8;
116 unsigned int source_packed_v_offset:8;
120 /* Load and Save r1.2 */
122 unsigned int destination_packed_y_offset:8;
123 unsigned int destination_packed_u_offset:8;
124 unsigned int destination_packed_v_offset:8;
130 unsigned int destination_rgb_format:8;
131 unsigned int pad0:24;
136 float procamp_constant_c1;
139 float procamp_constant_c2;
142 unsigned int statistics_surface_picth:16; /* Devided by 2 */
143 unsigned int pad1:16;
148 unsigned int pad0:24;
149 unsigned int top_field_first:8;
152 /* AVS/Scaling r1.6 */
153 float normalized_video_y_scaling_step;
157 float procamp_constant_c5;
162 float procamp_constant_c3;
168 float wg_csc_constant_c4;
171 float wg_csc_constant_c8;
174 float procamp_constant_c4;
183 float wg_csc_constant_c9;
188 float wg_csc_constant_c0;
191 float scaling_step_ratio;
194 float normalized_alpha_y_scaling;
197 float wg_csc_constant_c4;
200 float wg_csc_constant_c1;
203 int horizontal_origin_offset:16;
204 int vertical_origin_offset:16;
209 unsigned int color_pixel;
212 float wg_csc_constant_c2;
216 float wg_csc_constant_c3;
221 float wg_csc_constant_c6;
223 /* ALL r4.1 MBZ ???*/
230 unsigned int pad1:15;
232 unsigned int pad2:16;
237 unsigned int motion_history_coefficient_m2:8;
238 unsigned int motion_history_coefficient_m1:8;
239 unsigned int pad0:16;
244 float wg_csc_constant_c7;
247 float wg_csc_constant_c10;
250 float source_video_frame_normalized_horizontal_origin;
256 float wg_csc_constant_c11;
260 struct pp_inline_parameter
264 int destination_block_horizontal_origin:16;
265 int destination_block_vertical_origin:16;
270 float source_surface_block_normalized_horizontal_origin;
274 unsigned int variance_surface_vertical_origin:16;
275 unsigned int pad0:16;
279 /* AVS/Scaling r5.2 */
280 float source_surface_block_normalized_vertical_origin;
283 float alpha_surface_block_normalized_horizontal_origin;
286 float alpha_surface_block_normalized_vertical_origin;
289 unsigned int alpha_mask_x:16;
290 unsigned int alpha_mask_y:8;
291 unsigned int block_count_x:8;
294 unsigned int block_horizontal_mask:16;
295 unsigned int block_vertical_mask:8;
296 unsigned int number_blocks:8;
298 /* AVS/Scaling r5.7 */
299 float normalized_video_x_scaling_step;
304 float video_step_delta;
307 unsigned int padx[7];
311 struct gen7_pp_static_parameter
315 unsigned int padx[6];
317 unsigned int di_statistics_surface_pitch_div2:16;
318 unsigned int di_statistics_surface_height_div4:16;
320 unsigned int di_top_field_first:8;
321 unsigned int pad0:16;
322 unsigned int pointer_to_inline_parameter:8; /* value: 7 */
327 unsigned int padx[7];
329 unsigned int di_destination_packed_y_component_offset:8;
330 unsigned int di_destination_packed_u_component_offset:8;
331 unsigned int di_destination_packed_v_component_offset:8;
336 float sampler_load_horizontal_scaling_step_ratio;
337 unsigned int padx[7];
341 float sampler_load_vertical_scaling_step;
343 unsigned int di_hoffset_svf_from_dvf:16;
344 unsigned int di_voffset_svf_from_dvf:16;
345 unsigned int padx[5];
349 float sampler_load_vertical_frame_origin;
350 unsigned int padx[7];
354 float sampler_load_horizontal_frame_origin;
355 unsigned int padx[7];
359 struct gen7_pp_inline_parameter
363 unsigned int destination_block_horizontal_origin:16;
364 unsigned int destination_block_vertical_origin:16;
365 /* r7.1: 0xffffffff */
366 unsigned int constant_0;
372 float sampler_load_main_video_x_scaling_step;
375 /* r7.6: must be zero */
376 unsigned int avs_vertical_block_number;
378 unsigned int group_id_number;
382 unsigned int padx[8];
386 struct i965_post_processing_context
389 struct pp_module pp_modules[NUM_PP_MODULES];
390 void *pp_static_parameter;
391 void *pp_inline_parameter;
395 } surface_state_binding_table;
403 int num_interface_descriptors;
414 } sampler_state_table;
419 unsigned int vfe_start;
420 unsigned int cs_start;
422 unsigned int num_vfe_entries;
423 unsigned int num_cs_entries;
425 unsigned int size_vfe_entry;
426 unsigned int size_cs_entry;
434 struct pp_load_save_context pp_load_save_context;
435 struct pp_scaling_context pp_scaling_context;
436 struct pp_avs_context pp_avs_context;
437 struct pp_dndi_context pp_dndi_context;
438 struct pp_dn_context pp_dn_context;
441 int (*pp_x_steps)(void *private_context);
442 int (*pp_y_steps)(void *private_context);
443 int (*pp_set_block_parameter)(struct i965_post_processing_context *pp_context, int x, int y);
444 struct intel_batchbuffer *batch;
446 /* video process based on hsw vebox */
447 struct intel_vebox_context *pp_vebox_context;
451 i965_post_processing(
452 VADriverContextP ctx,
454 const VARectangle *src_rect,
455 const VARectangle *dst_rect,
457 int *has_done_scaling
461 i965_image_processing(VADriverContextP ctx,
462 const struct i965_surface *src_surface,
463 const VARectangle *src_rect,
464 struct i965_surface *dst_surface,
465 const VARectangle *dst_rect);
468 i965_post_processing_terminate(VADriverContextP ctx);
470 i965_post_processing_init(VADriverContextP ctx);
472 #endif /* __I965_POST_PROCESSING_H__ */