#define VL_BLOCK_WIDTH 8
#define VL_BLOCK_HEIGHT 8
-#define VL_MAX_PLANES 3
+#define VL_NUM_COMPONENTS 3
#define VL_MAX_REF_FRAMES 2
#endif
#include "vl_defines.h"
#include "vl_types.h"
-#define VL_MC_NUM_BLENDERS (1 << VL_MAX_PLANES)
+#define VL_MC_NUM_BLENDERS (1 << VL_NUM_COMPONENTS)
struct pipe_context;
if (!destination)
goto error_surface;
- for (i = 0; i < VL_MAX_PLANES; ++i)
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i)
if (!vl_zscan_init_buffer(i == 0 ? &dec->zscan_y : &dec->zscan_c,
&buffer->zscan[i], buffer->zscan_source, destination[i]))
goto error_plane;
assert(buffer);
- for (i = 0; i < VL_MAX_PLANES; ++i)
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i)
vl_zscan_cleanup_buffer(&buffer->zscan[i]);
pipe_sampler_view_reference(&buffer->zscan_source, NULL);
assert(buf);
- for (i = 0; i < VL_MAX_PLANES; ++i)
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i)
vl_mc_cleanup_buffer(&buf->mc[i]);
}
memset(non_intra_matrix, 0x10, sizeof(non_intra_matrix));
}
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
struct vl_zscan *zscan = i == 0 ? &dec->zscan_y : &dec->zscan_c;
vl_zscan_upload_quant(zscan, &buf->zscan[i], intra_matrix, true);
vl_zscan_upload_quant(zscan, &buf->zscan[i], non_intra_matrix, false);
buf->block_num = 0;
buf->texels = dec->base.context->transfer_map(dec->base.context, buf->tex_transfer);
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
buf->ycbcr_stream[i] = vl_vb_get_ycbcr_stream(&buf->vertex_stream, i);
buf->num_ycbcr_blocks[i] = 0;
}
buf->mv_stream[i] = vl_vb_get_mv_stream(&buf->vertex_stream, i);
if (dec->base.entrypoint >= PIPE_VIDEO_ENTRYPOINT_IDCT) {
- for (i = 0; i < VL_MAX_PLANES; ++i)
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i)
vl_zscan_set_layout(&buf->zscan[i], dec->zscan_linear);
}
}
buf = vl_mpeg12_get_decode_buffer(dec, target);
assert(buf);
- for (i = 0; i < VL_MAX_PLANES; ++i)
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i)
vl_zscan_set_layout(&buf->zscan[i], desc->alternate_scan ?
dec->zscan_alternate : dec->zscan_normal);
}
dec->base.context->bind_vertex_elements_state(dec->base.context, dec->ves_mv);
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
if (!target_surfaces[i]) continue;
vl_mc_set_surface(&buf->mc[i], target_surfaces[i]);
}
dec->base.context->bind_vertex_elements_state(dec->base.context, dec->ves_ycbcr);
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
if (!buf->num_ycbcr_blocks[i]) continue;
vb[1] = vl_vb_get_ycbcr(&buf->vertex_stream, i);
plane_order = vl_video_buffer_plane_order(target->buffer_format);
mc_source_sv = dec->mc_source->get_sampler_view_planes(dec->mc_source);
- for (i = 0, component = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0, component = 0; i < VL_NUM_COMPONENTS; ++i) {
if (!target_surfaces[i]) continue;
nr_components = util_format_get_nr_components(target_surfaces[i]->texture->format);
struct pipe_sampler_view *zscan_source;
struct vl_mpg12_bs bs;
- struct vl_zscan_buffer zscan[VL_MAX_PLANES];
- struct vl_idct_buffer idct[VL_MAX_PLANES];
- struct vl_mc_buffer mc[VL_MAX_PLANES];
+ struct vl_zscan_buffer zscan[VL_NUM_COMPONENTS];
+ struct vl_idct_buffer idct[VL_NUM_COMPONENTS];
+ struct vl_mc_buffer mc[VL_NUM_COMPONENTS];
struct pipe_transfer *tex_transfer;
short *texels;
- struct vl_ycbcr_block *ycbcr_stream[VL_MAX_PLANES];
+ struct vl_ycbcr_block *ycbcr_stream[VL_NUM_COMPONENTS];
struct vl_motionvector *mv_stream[VL_MAX_REF_FRAMES];
};
size = width * height;
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
buffer->ycbcr[i].resource = pipe_buffer_create
(
pipe->screen,
return true;
error_mv:
- for (i = 0; i < VL_MAX_PLANES; ++i)
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i)
pipe_resource_reference(&buffer->mv[i].resource, NULL);
error_ycbcr:
- for (i = 0; i < VL_MAX_PLANES; ++i)
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i)
pipe_resource_reference(&buffer->ycbcr[i].resource, NULL);
return false;
}
assert(buffer && pipe);
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
buffer->ycbcr[i].vertex_stream = pipe_buffer_map
(
pipe,
vl_vb_get_ycbcr_stream(struct vl_vertex_buffer *buffer, int component)
{
assert(buffer);
- assert(component < VL_MAX_PLANES);
+ assert(component < VL_NUM_COMPONENTS);
return buffer->ycbcr[component].vertex_stream;
}
assert(buffer && pipe);
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
pipe_buffer_unmap(pipe, buffer->ycbcr[i].transfer);
}
assert(buffer);
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
pipe_resource_reference(&buffer->ycbcr[i].resource, NULL);
}
struct pipe_resource *resource;
struct pipe_transfer *transfer;
struct vl_ycbcr_block *vertex_stream;
- } ycbcr[VL_MAX_PLANES];
+ } ycbcr[VL_NUM_COMPONENTS];
struct {
struct pipe_resource *resource;
if (!resource_formats)
return false;
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
if (!resource_formats[i])
continue;
assert(buf);
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL);
pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL);
pipe_resource_reference(&buf->resources[i], NULL);
}
- for (i = 0; i < VL_MAX_PLANES * 2; ++i)
+ for (i = 0; i < VL_NUM_COMPONENTS * 2; ++i)
pipe_surface_reference(&buf->surfaces[i], NULL);
vl_video_buffer_set_associated_data(buffer, NULL, NULL, NULL);
unsigned nr_components = util_format_get_nr_components(res->format);
for (j = 0; j < nr_components; ++j, ++component) {
- assert(component < VL_MAX_PLANES);
+ assert(component < VL_NUM_COMPONENTS);
if (!buf->sampler_view_components[component]) {
memset(&sv_templ, 0, sizeof(sv_templ));
return buf->sampler_view_components;
error:
- for (i = 0; i < VL_MAX_PLANES; ++i )
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i )
pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL);
return NULL;
depth = buffer->interlaced ? 2 : 1;
for (i = 0, surf = 0; i < depth; ++i ) {
- for (j = 0; j < VL_MAX_PLANES; ++j, ++surf) {
- assert(surf < (VL_MAX_PLANES * 2));
+ for (j = 0; j < VL_NUM_COMPONENTS; ++j, ++surf) {
+ assert(surf < (VL_NUM_COMPONENTS * 2));
if (!buf->resources[j]) {
pipe_surface_reference(&buf->surfaces[surf], NULL);
return buf->surfaces;
error:
- for (i = 0; i < (VL_MAX_PLANES * 2); ++i )
+ for (i = 0; i < (VL_NUM_COMPONENTS * 2); ++i )
pipe_surface_reference(&buf->surfaces[i], NULL);
return NULL;
struct pipe_video_buffer *
vl_video_buffer_create_ex(struct pipe_context *pipe,
const struct pipe_video_buffer *tmpl,
- const enum pipe_format resource_formats[VL_MAX_PLANES],
+ const enum pipe_format resource_formats[VL_NUM_COMPONENTS],
unsigned depth, unsigned usage)
{
struct pipe_resource res_tmpl;
- struct pipe_resource *resources[VL_MAX_PLANES];
+ struct pipe_resource *resources[VL_NUM_COMPONENTS];
unsigned i;
assert(pipe);
return vl_video_buffer_create_ex2(pipe, tmpl, resources);
error:
- for (i = 0; i < VL_MAX_PLANES; ++i)
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i)
pipe_resource_reference(&resources[i], NULL);
return NULL;
struct pipe_video_buffer *
vl_video_buffer_create_ex2(struct pipe_context *pipe,
const struct pipe_video_buffer *tmpl,
- struct pipe_resource *resources[VL_MAX_PLANES])
+ struct pipe_resource *resources[VL_NUM_COMPONENTS])
{
struct vl_video_buffer *buffer;
unsigned i;
buffer->base.get_surfaces = vl_video_buffer_surfaces;
buffer->num_planes = 0;
- for (i = 0; i < VL_MAX_PLANES; ++i) {
+ for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
buffer->resources[i] = resources[i];
if (resources[i])
buffer->num_planes++;
{
struct pipe_video_buffer base;
unsigned num_planes;
- struct pipe_resource *resources[VL_MAX_PLANES];
- struct pipe_sampler_view *sampler_view_planes[VL_MAX_PLANES];
- struct pipe_sampler_view *sampler_view_components[VL_MAX_PLANES];
- struct pipe_surface *surfaces[VL_MAX_PLANES * 2];
+ struct pipe_resource *resources[VL_NUM_COMPONENTS];
+ struct pipe_sampler_view *sampler_view_planes[VL_NUM_COMPONENTS];
+ struct pipe_sampler_view *sampler_view_components[VL_NUM_COMPONENTS];
+ struct pipe_surface *surfaces[VL_NUM_COMPONENTS * 2];
};
/**
struct pipe_video_buffer *
vl_video_buffer_create_ex(struct pipe_context *pipe,
const struct pipe_video_buffer *templat,
- const enum pipe_format resource_formats[VL_MAX_PLANES],
+ const enum pipe_format resource_formats[VL_NUM_COMPONENTS],
unsigned depth, unsigned usage);
/**
struct pipe_video_buffer *
vl_video_buffer_create_ex2(struct pipe_context *pipe,
const struct pipe_video_buffer *templat,
- struct pipe_resource *resources[VL_MAX_PLANES]);
+ struct pipe_resource *resources[VL_NUM_COMPONENTS]);
#endif /* vl_video_buffer_h */
unsigned nr_components = util_format_get_nr_components(buf->resources[i]->format);
for (j = 0; j < nr_components; ++j, ++component) {
- assert(component < VL_MAX_PLANES);
+ assert(component < VL_NUM_COMPONENTS);
if (!buf->sampler_view_components[component]) {
memset(&sv_templ, 0, sizeof(sv_templ));