Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5563 | serge | 1 | /************************************************************************** |
2 | * |
||
3 | * Copyright 2010 Christian König |
||
4 | * All Rights Reserved. |
||
5 | * |
||
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: |
||
13 | * |
||
14 | * The above copyright notice and this permission notice (including the |
||
15 | * next paragraph) shall be included in all copies or substantial portions |
||
16 | * of the Software. |
||
17 | * |
||
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 TUNGSTEN GRAPHICS 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. |
||
25 | * |
||
26 | **************************************************************************/ |
||
27 | #ifndef vl_vertex_buffers_h |
||
28 | #define vl_vertex_buffers_h |
||
29 | |||
30 | #include "pipe/p_state.h" |
||
31 | #include "pipe/p_video_state.h" |
||
32 | |||
33 | #include "vl_defines.h" |
||
34 | #include "vl_types.h" |
||
35 | |||
36 | /* vertex buffers act as a todo list |
||
37 | * uploading all the usefull informations to video ram |
||
38 | * so a vertex shader can work with them |
||
39 | */ |
||
40 | |||
41 | /* inputs to the vertex shaders */ |
||
42 | enum VS_INPUT |
||
43 | { |
||
44 | VS_I_RECT = 0, |
||
45 | VS_I_VPOS = 1, |
||
46 | |||
47 | VS_I_BLOCK_NUM = 2, |
||
48 | |||
49 | VS_I_MV_TOP = 2, |
||
50 | VS_I_MV_BOTTOM = 3, |
||
51 | |||
52 | NUM_VS_INPUTS = 4 |
||
53 | }; |
||
54 | |||
55 | enum vl_mv_weight |
||
56 | { |
||
57 | PIPE_VIDEO_MV_WEIGHT_MIN = 0, |
||
58 | PIPE_VIDEO_MV_WEIGHT_HALF = 128, |
||
59 | PIPE_VIDEO_MV_WEIGHT_MAX = 256 |
||
60 | }; |
||
61 | |||
62 | enum vl_field_select |
||
63 | { |
||
64 | PIPE_VIDEO_FRAME = 0, |
||
65 | PIPE_VIDEO_TOP_FIELD = 1, |
||
66 | PIPE_VIDEO_BOTTOM_FIELD = 3, |
||
67 | |||
68 | /* TODO |
||
69 | PIPE_VIDEO_DUALPRIME |
||
70 | PIPE_VIDEO_16x8 |
||
71 | */ |
||
72 | }; |
||
73 | |||
74 | struct vl_motionvector |
||
75 | { |
||
76 | struct { |
||
77 | int16_t x, y; |
||
78 | int16_t field_select; /**< enum pipe_video_field_select */ |
||
79 | int16_t weight; /**< enum pipe_video_mv_weight */ |
||
80 | } top, bottom; |
||
81 | }; |
||
82 | |||
83 | struct vl_ycbcr_block |
||
84 | { |
||
85 | uint8_t x, y; |
||
86 | uint8_t intra; |
||
87 | uint8_t coding; |
||
88 | float block_num; |
||
89 | }; |
||
90 | |||
91 | struct vl_vertex_buffer |
||
92 | { |
||
93 | unsigned width, height; |
||
94 | |||
95 | struct { |
||
96 | struct pipe_resource *resource; |
||
97 | struct pipe_transfer *transfer; |
||
98 | struct vl_ycbcr_block *vertex_stream; |
||
99 | } ycbcr[VL_NUM_COMPONENTS]; |
||
100 | |||
101 | struct { |
||
102 | struct pipe_resource *resource; |
||
103 | struct pipe_transfer *transfer; |
||
104 | struct vl_motionvector *vertex_stream; |
||
105 | } mv[VL_MAX_REF_FRAMES]; |
||
106 | }; |
||
107 | |||
108 | struct pipe_vertex_buffer vl_vb_upload_quads(struct pipe_context *pipe); |
||
109 | |||
110 | struct pipe_vertex_buffer vl_vb_upload_pos(struct pipe_context *pipe, unsigned width, unsigned height); |
||
111 | |||
112 | void *vl_vb_get_ves_ycbcr(struct pipe_context *pipe); |
||
113 | |||
114 | void *vl_vb_get_ves_mv(struct pipe_context *pipe); |
||
115 | |||
116 | bool vl_vb_init(struct vl_vertex_buffer *buffer, |
||
117 | struct pipe_context *pipe, |
||
118 | unsigned width, unsigned height); |
||
119 | |||
120 | unsigned vl_vb_attributes_per_plock(struct vl_vertex_buffer *buffer); |
||
121 | |||
122 | void vl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe); |
||
123 | |||
124 | struct pipe_vertex_buffer vl_vb_get_ycbcr(struct vl_vertex_buffer *buffer, int component); |
||
125 | |||
126 | struct vl_ycbcr_block *vl_vb_get_ycbcr_stream(struct vl_vertex_buffer *buffer, int component); |
||
127 | |||
128 | struct pipe_vertex_buffer vl_vb_get_mv(struct vl_vertex_buffer *buffer, int ref_frame); |
||
129 | |||
130 | unsigned vl_vb_get_mv_stream_stride(struct vl_vertex_buffer *buffer); |
||
131 | |||
132 | struct vl_motionvector *vl_vb_get_mv_stream(struct vl_vertex_buffer *buffer, int ref_frame); |
||
133 | |||
134 | void vl_vb_unmap(struct vl_vertex_buffer *buffer, struct pipe_context *pipe); |
||
135 | |||
136 | void vl_vb_cleanup(struct vl_vertex_buffer *buffer); |
||
137 | |||
138 | #endif /* vl_vertex_buffers_h */>> |