#include <tgsi/tgsi_ureg.h>
#include "vl_types.h"
-#define NR_RENDER_TARGETS 4
-
enum VS_OUTPUT
{
VS_O_VPOS,
ureg_MUL(shader, ureg_writemask(t_tex, TGSI_WRITEMASK_XY), ureg_src(t_tex), scale);
ureg_MUL(shader, ureg_writemask(t_tex, TGSI_WRITEMASK_Z),
ureg_scalar(vrect, TGSI_SWIZZLE_X),
- ureg_imm1f(shader, BLOCK_WIDTH / NR_RENDER_TARGETS));
+ ureg_imm1f(shader, BLOCK_WIDTH / idct->nr_of_render_targets));
ureg_MOV(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_XY), ureg_src(t_tex));
struct ureg_src l_addr[2], r_addr[2];
struct ureg_dst l[4][2], r[2];
- struct ureg_dst fragment[NR_RENDER_TARGETS];
+ struct ureg_dst fragment[idct->nr_of_render_targets];
unsigned i, j;
r_addr[0] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_R_ADDR0, TGSI_INTERPOLATE_LINEAR);
r_addr[1] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_R_ADDR1, TGSI_INTERPOLATE_LINEAR);
- for (i = 0; i < NR_RENDER_TARGETS; ++i)
+ for (i = 0; i < idct->nr_of_render_targets; ++i)
fragment[i] = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, i);
for (i = 0; i < 4; ++i) {
fetch_four(shader, l[i], s_addr, ureg_DECL_sampler(shader, 1));
}
- for (i = 0; i < NR_RENDER_TARGETS; ++i) {
+ for (i = 0; i < idct->nr_of_render_targets; ++i) {
if(i > 0)
increment_addr(shader, r, r_addr, true, true, i, BLOCK_HEIGHT);
buffer->fb_state[0].width = tex->width0;
buffer->fb_state[0].height = tex->height0;
- buffer->fb_state[0].nr_cbufs = NR_RENDER_TARGETS;
- for(i = 0; i < NR_RENDER_TARGETS; ++i) {
+ buffer->fb_state[0].nr_cbufs = idct->nr_of_render_targets;
+ for(i = 0; i < idct->nr_of_render_targets; ++i) {
memset(&surf_templ, 0, sizeof(surf_templ));
surf_templ.format = tex->format;
surf_templ.u.tex.first_layer = i;
return true;
error_surfaces:
- for(i = 0; i < NR_RENDER_TARGETS; ++i)
+ for(i = 0; i < idct->nr_of_render_targets; ++i)
pipe_surface_reference(&buffer->fb_state[0].cbufs[i], NULL);
return false;
assert(idct && buffer);
- for(i = 0; i < NR_RENDER_TARGETS; ++i)
+ for(i = 0; i < idct->nr_of_render_targets; ++i)
pipe_surface_reference(&buffer->fb_state[0].cbufs[i], NULL);
pipe_sampler_view_reference(&buffer->sampler_views.individual.intermediate, NULL);
bool vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe,
unsigned buffer_width, unsigned buffer_height,
unsigned blocks_x, unsigned blocks_y,
+ unsigned nr_of_render_targets,
struct pipe_sampler_view *matrix)
{
assert(idct && pipe && matrix);
idct->buffer_height = buffer_height;
idct->blocks_x = blocks_x;
idct->blocks_y = blocks_y;
+ idct->nr_of_render_targets = nr_of_render_targets;
pipe_sampler_view_reference(&idct->matrix, matrix);
if(!init_shaders(idct))
assert(idct && buffer);
- for(i = 0; i < NR_RENDER_TARGETS; ++i)
+ for(i = 0; i < idct->nr_of_render_targets; ++i)
pipe_surface_reference(&buffer->fb_state[0].cbufs[i], NULL);
pipe_surface_reference(&buffer->fb_state[1].cbufs[0], NULL);
goto error_idct_source;
buffer->idct_intermediate = vl_video_buffer_init(dec->base.context, dec->pipe,
- dec->base.width / 4, dec->base.height / 4, 4,
+ dec->base.width / dec->nr_of_idct_render_targets,
+ dec->base.height / 4, dec->nr_of_idct_render_targets,
dec->base.chroma_format, 3,
idct_source_formats,
PIPE_USAGE_STATIC);
unsigned chroma_width, chroma_height, chroma_blocks_x, chroma_blocks_y;
struct pipe_sampler_view *idct_matrix;
+ dec->nr_of_idct_render_targets = 4;
+
if (!(idct_matrix = vl_idct_upload_matrix(dec->pipe, sqrt(SCALE_FACTOR_16_TO_9))))
goto error_idct_matrix;
if (!vl_idct_init(&dec->idct_y, dec->pipe, buffer_width, buffer_height,
- 2, 2, idct_matrix))
+ 2, 2, dec->nr_of_idct_render_targets, idct_matrix))
goto error_idct_y;
if (dec->base.chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) {
}
if(!vl_idct_init(&dec->idct_c, dec->pipe, chroma_width, chroma_height,
- chroma_blocks_x, chroma_blocks_y, idct_matrix))
+ chroma_blocks_x, chroma_blocks_y,
+ dec->nr_of_idct_render_targets, idct_matrix))
goto error_idct_c;
pipe_sampler_view_reference(&idct_matrix, NULL);