dec->quads = vl_vb_upload_quads(dec->pipe, 2, 2);
for (i = 0; i < VL_MAX_PLANES; ++i)
- dec->ves_eb[i] = vl_vb_get_elems_state(dec->pipe, i, 0);
+ dec->ves_eb[i] = vl_vb_get_ves_eb(dec->pipe, i);
for (i = 0; i < 2; ++i)
- dec->ves_mv[i] = vl_vb_get_elems_state(dec->pipe, 0, i);
+ dec->ves_mv[i] = vl_vb_get_ves_mv(dec->pipe, i);
dec->base.width = align(width, MACROBLOCK_WIDTH);
dec->base.height = align(height, MACROBLOCK_HEIGHT);
}
void *
-vl_vb_get_elems_state(struct pipe_context *pipe, int component, int motionvector)
+vl_vb_get_ves_eb(struct pipe_context *pipe, int component)
{
struct pipe_vertex_element vertex_elems[NUM_VS_INPUTS];
+ assert(pipe);
+
memset(&vertex_elems, 0, sizeof(vertex_elems));
vertex_elems[VS_I_RECT] = vl_vb_get_quad_vertex_element();
vertex_elems[VS_I_FLAGS].src_format = PIPE_FORMAT_R8G8B8A8_USCALED;
/* empty block element of selected component */
- vertex_elems[VS_I_EB].src_offset = 8 + component * 4;
+ vertex_elems[VS_I_EB].src_offset = offsetof(struct vl_vertex_stream, eb[component]);
vertex_elems[VS_I_EB].src_format = PIPE_FORMAT_R8G8B8A8_USCALED;
+ vl_vb_element_helper(&vertex_elems[VS_I_VPOS], NUM_VS_INPUTS - 1, 1);
+
+ return pipe->create_vertex_elements_state(pipe, NUM_VS_INPUTS, vertex_elems);
+}
+
+void *
+vl_vb_get_ves_mv(struct pipe_context *pipe, int motionvector)
+{
+ struct pipe_vertex_element vertex_elems[NUM_VS_INPUTS];
+
+ memset(&vertex_elems, 0, sizeof(vertex_elems));
+ vertex_elems[VS_I_RECT] = vl_vb_get_quad_vertex_element();
+
+ assert(pipe);
+
+ /* Position element */
+ vertex_elems[VS_I_VPOS].src_format = PIPE_FORMAT_R16G16_SSCALED;
+
/* motion vector TOP element */
- vertex_elems[VS_I_MV_TOP].src_offset = 20 + motionvector * 16;
+ vertex_elems[VS_I_MV_TOP].src_offset = offsetof(struct vl_vertex_stream, mv[motionvector * 2]);
vertex_elems[VS_I_MV_TOP].src_format = PIPE_FORMAT_R16G16B16A16_SSCALED;
/* motion vector BOTTOM element */
{
VS_I_RECT,
VS_I_VPOS,
+
VS_I_FLAGS,
VS_I_EB,
- VS_I_MV_TOP,
- VS_I_MV_BOTTOM,
+
+ VS_I_MV_TOP = VS_I_FLAGS,
+ VS_I_MV_BOTTOM = VS_I_EB,
NUM_VS_INPUTS
};
struct pipe_vertex_buffer vl_vb_upload_quads(struct pipe_context *pipe,
unsigned blocks_x, unsigned blocks_y);
-void *vl_vb_get_elems_state(struct pipe_context *pipe, int component, int motionvector);
+void *vl_vb_get_ves_eb(struct pipe_context *pipe, int component);
+
+void *vl_vb_get_ves_mv(struct pipe_context *pipe, int motionvector);
struct pipe_vertex_buffer vl_vb_init(struct vl_vertex_buffer *buffer,
struct pipe_context *pipe,