1 #ifndef vl_mpeg12_mc_renderer_h
2 #define vl_mpeg12_mc_renderer_h
4 #include <pipe/p_compiler.h>
5 #include <pipe/p_state.h>
6 #include <pipe/p_video_state.h>
9 struct pipe_video_surface
;
10 struct pipe_macroblock
;
12 /* A slice is video-width (rounded up to a multiple of macroblock width) x macroblock height */
13 enum VL_MPEG12_MC_RENDERER_BUFFER_MODE
15 VL_MPEG12_MC_RENDERER_BUFFER_SLICE
, /* Saves memory at the cost of smaller batches */
16 VL_MPEG12_MC_RENDERER_BUFFER_PICTURE
/* Larger batches, more memory */
19 enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK
21 VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL
, /* Waste of memory bandwidth */
22 VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE
, /* Can only do point-filtering when interpolating subsampled chroma channels */
23 VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE
/* Needs conditional texel fetch! */
26 struct vl_mpeg12_mc_renderer
28 struct pipe_context
*pipe
;
29 unsigned picture_width
;
30 unsigned picture_height
;
31 enum pipe_video_chroma_format chroma_format
;
32 enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode
;
33 enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling
;
35 unsigned macroblocks_per_batch
;
37 struct pipe_viewport_state viewport
;
38 struct pipe_constant_buffer vs_const_buf
;
39 struct pipe_constant_buffer fs_const_buf
;
40 struct pipe_framebuffer_state fb_state
;
41 struct pipe_vertex_element vertex_elems
[8];
46 struct { void *y
, *cb
, *cr
, *ref
[2]; } individual
;
49 void *i_vs
, *p_vs
[2], *b_vs
[2];
50 void *i_fs
, *p_fs
[2], *b_fs
[2];
54 struct pipe_texture
*all
[5];
55 struct { struct pipe_texture
*y
, *cb
, *cr
, *ref
[2]; } individual
;
60 struct pipe_vertex_buffer all
[3];
61 struct { struct pipe_vertex_buffer ycbcr
, ref
[2]; } individual
;
64 struct pipe_texture
*surface
, *past
, *future
;
65 struct pipe_fence_handle
**fence
;
66 unsigned num_macroblocks
;
67 struct pipe_mpeg12_macroblock
*macroblock_buf
;
68 struct pipe_transfer
*tex_transfer
[3];
70 struct { float x
, y
; } surface_tex_inv_size
;
71 struct { float x
, y
; } zero_block
[3];
74 bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer
*renderer
,
75 struct pipe_context
*pipe
,
76 unsigned picture_width
,
77 unsigned picture_height
,
78 enum pipe_video_chroma_format chroma_format
,
79 enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode
,
80 enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling
,
83 void vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer
*renderer
);
85 void vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer
*renderer
,
86 struct pipe_texture
*surface
,
87 struct pipe_texture
*past
,
88 struct pipe_texture
*future
,
89 unsigned num_macroblocks
,
90 struct pipe_mpeg12_macroblock
*mpeg12_macroblocks
,
91 struct pipe_fence_handle
**fence
);
93 #endif /* vl_mpeg12_mc_renderer_h */