memset(buffer, 0, sizeof(struct vl_idct_buffer));
+ buffer->idct = idct;
+
pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, idct->matrix);
pipe_sampler_view_reference(&buffer->sampler_views.individual.source, source);
pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, idct->transpose);
}
void
-vl_idct_cleanup_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer)
+vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer)
{
- assert(idct && buffer);
+ assert(buffer);
- cleanup_source(idct, buffer);
- cleanup_intermediate(idct, buffer);
+ cleanup_source(buffer->idct, buffer);
+ cleanup_intermediate(buffer->idct, buffer);
pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, NULL);
pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, NULL);
}
void
-vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_instances)
+vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_instances)
{
- assert(idct);
+ struct vl_idct *idct;
assert(buffer);
+
+ idct = buffer->idct;
idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
idct->pipe->bind_blend_state(idct->pipe, idct->blend);
}
void
-vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer)
+vl_idct_prepare_stage2(struct vl_idct_buffer *buffer)
{
- assert(idct);
assert(buffer);
/* second stage */
- idct->pipe->bind_rasterizer_state(idct->pipe, idct->rs_state);
- idct->pipe->bind_fragment_sampler_states(idct->pipe, 2, idct->samplers);
- idct->pipe->set_fragment_sampler_views(idct->pipe, 2, buffer->sampler_views.stage[1]);
+ buffer->idct->pipe->bind_rasterizer_state(buffer->idct->pipe, buffer->idct->rs_state);
+ buffer->idct->pipe->bind_fragment_sampler_states(buffer->idct->pipe, 2, buffer->idct->samplers);
+ buffer->idct->pipe->set_fragment_sampler_views(buffer->idct->pipe, 2, buffer->sampler_views.stage[1]);
}
/* a set of buffers to work with */
struct vl_idct_buffer
{
+ struct vl_idct *idct;
+
struct pipe_viewport_state viewport_mismatch;
struct pipe_viewport_state viewport;
/* cleanup a buffer of an idct instance */
void
-vl_idct_cleanup_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer);
+vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer);
/* flush the buffer and start rendering, vertex buffers needs to be setup before calling this */
void
-vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_verts);
+vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_verts);
void
-vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer);
+vl_idct_prepare_stage2(struct vl_idct_buffer *buffer);
#endif
error_plane:
for (; i > 0; --i)
- vl_idct_cleanup_buffer(i == 1 ? &dec->idct_c : &dec->idct_y, &buffer->idct[i - 1]);
+ vl_idct_cleanup_buffer(&buffer->idct[i - 1]);
error_mc_source_sv:
error_source_sv:
cleanup_idct_buffer(struct vl_mpeg12_buffer *buf)
{
struct vl_mpeg12_decoder *dec;
+ unsigned i;
+
assert(buf);
dec = (struct vl_mpeg12_decoder*)buf->base.decoder;
assert(dec);
- vl_idct_cleanup_buffer(&dec->idct_y, &buf->idct[0]);
- vl_idct_cleanup_buffer(&dec->idct_c, &buf->idct[1]);
- vl_idct_cleanup_buffer(&dec->idct_c, &buf->idct[2]);
+ for (i = 0; i < 3; ++i)
+ vl_idct_cleanup_buffer(&buf->idct[0]);
}
static bool
vl_zscan_render(&buf->zscan[i] , num_ycbcr_blocks[i]);
if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
- vl_idct_flush(i == 0 ? &dec->idct_y : &dec->idct_c, &buf->idct[i], num_ycbcr_blocks[i]);
+ vl_idct_flush(&buf->idct[i], num_ycbcr_blocks[i]);
}
mc_source_sv = dec->mc_source->get_sampler_view_planes(dec->mc_source);
dec->base.context->set_vertex_buffers(dec->base.context, 3, vb);
if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
- vl_idct_prepare_stage2(component == 0 ? &dec->idct_y : &dec->idct_c, &buf->idct[component]);
+ vl_idct_prepare_stage2(&buf->idct[component]);
else {
dec->base.context->set_fragment_sampler_views(dec->base.context, 1, &mc_source_sv[component]);
dec->base.context->bind_fragment_sampler_states(dec->base.context, 1, &dec->sampler_ycbcr);