}
static void
-cleanup_source(struct vl_idct *idct, struct vl_idct_buffer *buffer)
+cleanup_source(struct vl_idct_buffer *buffer)
{
- assert(idct && buffer);
+ assert(buffer);
pipe_surface_reference(&buffer->fb_state_mismatch.cbufs[0], NULL);
}
static void
-cleanup_intermediate(struct vl_idct *idct, struct vl_idct_buffer *buffer)
+cleanup_intermediate(struct vl_idct_buffer *buffer)
{
unsigned i;
- assert(idct && buffer);
+ assert(buffer);
- for(i = 0; i < idct->nr_of_render_targets; ++i)
+ for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i)
pipe_surface_reference(&buffer->fb_state.cbufs[i], NULL);
pipe_sampler_view_reference(&buffer->sampler_views.individual.intermediate, NULL);
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);
{
assert(buffer);
- cleanup_source(buffer->idct, buffer);
- cleanup_intermediate(buffer->idct, buffer);
+ cleanup_source(buffer);
+ cleanup_intermediate(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_buffer *buffer, unsigned num_instances)
+vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_instances)
{
- 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_buffer *buffer)
+vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer)
{
assert(buffer);
/* second stage */
- 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]);
+ 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]);
}
/* 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;
/* flush the buffer and start rendering, vertex buffers needs to be setup before calling this */
void
-vl_idct_flush(struct vl_idct_buffer *buffer, unsigned num_verts);
+vl_idct_flush(struct vl_idct *idct, struct vl_idct_buffer *buffer, unsigned num_verts);
void
-vl_idct_prepare_stage2(struct vl_idct_buffer *buffer);
+vl_idct_prepare_stage2(struct vl_idct *idct, struct vl_idct_buffer *buffer);
#endif
{
assert(renderer && buffer);
- buffer->renderer = renderer;
-
buffer->viewport.scale[2] = 1;
buffer->viewport.scale[3] = 1;
buffer->viewport.translate[0] = 0;
}
static void
-prepare_pipe_4_rendering(struct vl_mc_buffer *buffer, unsigned mask)
+prepare_pipe_4_rendering(struct vl_mc *renderer, struct vl_mc_buffer *buffer, unsigned mask)
{
- struct vl_mc *renderer;
-
assert(buffer);
- renderer = buffer->renderer;
renderer->pipe->bind_rasterizer_state(renderer->pipe, renderer->rs_state);
if (buffer->surface_cleared)
}
void
-vl_mc_render_ref(struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref)
+vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref)
{
- struct vl_mc *renderer;
-
assert(buffer && ref);
- prepare_pipe_4_rendering(buffer, PIPE_MASK_R | PIPE_MASK_G | PIPE_MASK_B);
-
- renderer = buffer->renderer;
+ prepare_pipe_4_rendering(renderer, buffer, PIPE_MASK_R | PIPE_MASK_G | PIPE_MASK_B);
renderer->pipe->bind_vs_state(renderer->pipe, renderer->vs_ref);
renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ref);
}
void
-vl_mc_render_ycbcr(struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances)
+vl_mc_render_ycbcr(struct vl_mc *renderer, struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances)
{
- struct vl_mc *renderer;
unsigned mask = 1 << component;
assert(buffer);
if (num_instances == 0)
return;
- prepare_pipe_4_rendering(buffer, mask);
-
- renderer = buffer->renderer;
+ prepare_pipe_4_rendering(renderer, buffer, mask);
renderer->pipe->bind_vs_state(renderer->pipe, renderer->vs_ycbcr);
renderer->pipe->bind_fs_state(renderer->pipe, renderer->fs_ycbcr);
struct vl_mc_buffer
{
- struct vl_mc *renderer;
-
bool surface_cleared;
struct pipe_viewport_state viewport;
void vl_mc_set_surface(struct vl_mc_buffer *buffer, struct pipe_surface *surface);
-void vl_mc_render_ref(struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref);
+void vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref);
-void vl_mc_render_ycbcr(struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances);
+void vl_mc_render_ycbcr(struct vl_mc *renderer, struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances);
#endif /* vl_mc_h */
dec->intra_matrix[0] = 1 << (7 - dec->picture_desc.intra_dc_precision);
for (i = 0; i < VL_MAX_PLANES; ++i) {
- vl_zscan_upload_quant(&buf->zscan[i], dec->intra_matrix, true);
- vl_zscan_upload_quant(&buf->zscan[i], dec->non_intra_matrix, false);
+ struct vl_zscan *zscan = i == 0 ? &dec->zscan_y : &dec->zscan_c;
+ vl_zscan_upload_quant(zscan, &buf->zscan[i], dec->intra_matrix, true);
+ vl_zscan_upload_quant(zscan, &buf->zscan[i], dec->non_intra_matrix, false);
}
vl_vb_map(&buf->vertex_stream, dec->base.context);
vb[2] = vl_vb_get_mv(&buf->vertex_stream, j);;
dec->base.context->set_vertex_buffers(dec->base.context, 3, vb);
- vl_mc_render_ref(&buf->mc[i], dec->ref_frames[j][i]);
+ vl_mc_render_ref(i ? &dec->mc_c : &dec->mc_y, &buf->mc[i], dec->ref_frames[j][i]);
}
}
vb[1] = vl_vb_get_ycbcr(&buf->vertex_stream, i);
dec->base.context->set_vertex_buffers(dec->base.context, 2, vb);
- vl_zscan_render(&buf->zscan[i] , buf->num_ycbcr_blocks[i]);
+ vl_zscan_render(i ? &dec->zscan_c : & dec->zscan_y, &buf->zscan[i] , buf->num_ycbcr_blocks[i]);
if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
- vl_idct_flush(&buf->idct[i], buf->num_ycbcr_blocks[i]);
+ vl_idct_flush(i ? &dec->idct_c : &dec->idct_y, &buf->idct[i], buf->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, 2, vb);
if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
- vl_idct_prepare_stage2(&buf->idct[component]);
+ vl_idct_prepare_stage2(i ? &dec->idct_c : &dec->idct_y, &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);
}
- vl_mc_render_ycbcr(&buf->mc[i], j, buf->num_ycbcr_blocks[component]);
+ vl_mc_render_ycbcr(i ? &dec->mc_c : &dec->mc_y, &buf->mc[i], j, buf->num_ycbcr_blocks[component]);
}
}
}
memset(buffer, 0, sizeof(struct vl_zscan_buffer));
- buffer->zscan = zscan;
-
pipe_sampler_view_reference(&buffer->src, src);
buffer->viewport.scale[0] = dst->width;
}
void
-vl_zscan_upload_quant(struct vl_zscan_buffer *buffer, const uint8_t matrix[64], bool intra)
+vl_zscan_upload_quant(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
+ const uint8_t matrix[64], bool intra)
{
struct pipe_context *pipe;
struct pipe_transfer *buf_transfer;
assert(buffer);
assert(matrix);
- pipe = buffer->zscan->pipe;
+ pipe = zscan->pipe;
- rect.width *= buffer->zscan->blocks_per_line;
+ rect.width *= zscan->blocks_per_line;
buf_transfer = pipe->get_transfer
(
if (!data)
goto error_map;
- for (i = 0; i < buffer->zscan->blocks_per_line; ++i)
+ for (i = 0; i < zscan->blocks_per_line; ++i)
for (y = 0; y < BLOCK_HEIGHT; ++y)
for (x = 0; x < BLOCK_WIDTH; ++x)
data[i * BLOCK_WIDTH + y * pitch + x] = matrix[x + y * BLOCK_WIDTH];
}
void
-vl_zscan_render(struct vl_zscan_buffer *buffer, unsigned num_instances)
+vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned num_instances)
{
- struct vl_zscan *zscan;
-
assert(buffer);
- zscan = buffer->zscan;
-
zscan->pipe->bind_rasterizer_state(zscan->pipe, zscan->rs_state);
zscan->pipe->bind_blend_state(zscan->pipe, zscan->blend);
zscan->pipe->bind_fragment_sampler_states(zscan->pipe, 3, zscan->samplers);
struct vl_zscan_buffer
{
- struct vl_zscan *zscan;
-
struct pipe_viewport_state viewport;
struct pipe_framebuffer_state fb_state;
vl_zscan_set_layout(struct vl_zscan_buffer *buffer, struct pipe_sampler_view *layout);
void
-vl_zscan_upload_quant(struct vl_zscan_buffer *buffer, const uint8_t matrix[64], bool intra);
+vl_zscan_upload_quant(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
+ const uint8_t matrix[64], bool intra);
void
-vl_zscan_render(struct vl_zscan_buffer *buffer, unsigned num_instances);
+vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned num_instances);
#endif