1 /**************************************************************************
3 * Copyright 2011 Christian König
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
31 #include "pipe/p_compiler.h"
32 #include "pipe/p_state.h"
35 * shader based zscan and quantification
36 * expect usage of vl_vertex_buffers as a todo list
40 struct pipe_context
*pipe
;
42 unsigned buffer_width
;
43 unsigned buffer_height
;
45 unsigned num_channels
;
47 unsigned blocks_per_line
;
48 unsigned blocks_total
;
58 struct vl_zscan_buffer
60 struct pipe_viewport_state viewport
;
61 struct pipe_framebuffer_state fb_state
;
63 struct pipe_sampler_view
*src
, *layout
, *quant
;
64 struct pipe_surface
*dst
;
67 extern const int vl_zscan_normal_16
[];
68 extern const int vl_zscan_linear
[];
69 extern const int vl_zscan_normal
[];
70 extern const int vl_zscan_alternate
[];
71 extern const int vl_zscan_h265_up_right_diagonal_16
[];
72 extern const int vl_zscan_h265_up_right_diagonal
[];
74 struct pipe_sampler_view
*
75 vl_zscan_layout(struct pipe_context
*pipe
, const int layout
[64], unsigned blocks_per_line
);
78 vl_zscan_init(struct vl_zscan
*zscan
, struct pipe_context
*pipe
,
79 unsigned buffer_width
, unsigned buffer_height
,
80 unsigned blocks_per_line
, unsigned blocks_total
,
81 unsigned num_channels
);
84 vl_zscan_cleanup(struct vl_zscan
*zscan
);
87 vl_zscan_init_buffer(struct vl_zscan
*zscan
, struct vl_zscan_buffer
*buffer
,
88 struct pipe_sampler_view
*src
, struct pipe_surface
*dst
);
91 vl_zscan_cleanup_buffer(struct vl_zscan_buffer
*buffer
);
94 vl_zscan_set_layout(struct vl_zscan_buffer
*buffer
, struct pipe_sampler_view
*layout
);
97 vl_zscan_upload_quant(struct vl_zscan
*zscan
, struct vl_zscan_buffer
*buffer
,
98 const uint8_t matrix
[64], bool intra
);
101 vl_zscan_render(struct vl_zscan
*zscan
, struct vl_zscan_buffer
*buffer
, unsigned num_instances
);