1 /**************************************************************************
3 * Copyright 2009 Younes Manton.
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 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.
26 **************************************************************************/
28 #ifndef vl_mpeg12_mc_renderer_h
29 #define vl_mpeg12_mc_renderer_h
31 #include <pipe/p_compiler.h>
32 #include <pipe/p_state.h>
33 #include <pipe/p_video_state.h>
36 #include "vl_vertex_buffers.h"
39 struct pipe_macroblock
;
42 struct vl_mpeg12_mc_renderer
44 struct pipe_context
*pipe
;
45 unsigned buffer_width
;
46 unsigned buffer_height
;
47 enum pipe_video_chroma_format chroma_format
;
48 const unsigned (*empty_block_mask
)[3][2][2];
50 struct pipe_viewport_state viewport
;
51 struct pipe_framebuffer_state fb_state
;
53 struct vl_idct idct_y
, idct_cr
, idct_cb
;
62 struct { void *y
, *cb
, *cr
, *ref
[2]; } individual
;
65 struct keymap
*texview_map
;
68 struct vl_mpeg12_mc_buffer
70 struct vl_idct_buffer idct_y
, idct_cb
, idct_cr
;
74 struct pipe_sampler_view
*all
[5];
75 struct { struct pipe_sampler_view
*y
, *cb
, *cr
, *ref
[2]; } individual
;
80 struct pipe_resource
*all
[3];
81 struct { struct pipe_resource
*y
, *cb
, *cr
; } individual
;
84 struct pipe_surface
*surface
, *past
, *future
;
85 struct pipe_fence_handle
**fence
;
88 bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer
*renderer
,
89 struct pipe_context
*pipe
,
90 unsigned picture_width
,
91 unsigned picture_height
,
92 enum pipe_video_chroma_format chroma_format
);
94 void vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer
*renderer
);
96 bool vl_mpeg12_mc_init_buffer(struct vl_mpeg12_mc_renderer
*renderer
, struct vl_mpeg12_mc_buffer
*buffer
);
98 void vl_mpeg12_mc_cleanup_buffer(struct vl_mpeg12_mc_renderer
*renderer
, struct vl_mpeg12_mc_buffer
*buffer
);
100 void vl_mpeg12_mc_map_buffer(struct vl_mpeg12_mc_renderer
*renderer
, struct vl_mpeg12_mc_buffer
*buffer
);
102 void vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer
*renderer
,
103 struct vl_mpeg12_mc_buffer
*buffer
,
104 struct pipe_surface
*surface
,
105 struct pipe_surface
*past
,
106 struct pipe_surface
*future
,
107 unsigned num_macroblocks
,
108 struct pipe_mpeg12_macroblock
*mpeg12_macroblocks
,
109 struct pipe_fence_handle
**fence
);
111 void vl_mpeg12_mc_unmap_buffer(struct vl_mpeg12_mc_renderer
*renderer
, struct vl_mpeg12_mc_buffer
*buffer
);
113 void vl_mpeg12_mc_renderer_flush(struct vl_mpeg12_mc_renderer
*renderer
, struct vl_mpeg12_mc_buffer
*buffer
,
114 unsigned not_empty_start_instance
, unsigned not_empty_num_instances
,
115 unsigned empty_start_instance
, unsigned empty_num_instances
);
117 #endif /* vl_mpeg12_mc_renderer_h */