From 1d72cf6986168a49fbadfa31e9d719ed0222836f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Thu, 17 Mar 2011 20:13:51 +0100 Subject: [PATCH] move empty block mask into mpeg12 context --- src/gallium/auxiliary/vl/vl_mpeg12_context.c | 16 +++++++++++++--- src/gallium/auxiliary/vl/vl_mpeg12_context.h | 1 + src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 10 ---------- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h | 1 - 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.c b/src/gallium/auxiliary/vl/vl_mpeg12_context.c index 947db1c22be..fb0418c5a47 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_context.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.c @@ -40,6 +40,12 @@ #define NUM_BUFFERS 2 +static const unsigned const_empty_block_mask_420[3][2][2] = { + { { 0x20, 0x10 }, { 0x08, 0x04 } }, + { { 0x02, 0x02 }, { 0x02, 0x02 } }, + { { 0x01, 0x01 }, { 0x01, 0x01 } } +}; + static void flush_buffer(struct vl_mpeg12_context *ctx) { @@ -161,7 +167,7 @@ upload_buffer(struct vl_mpeg12_context *ctx, for (y = 0; y < 2; ++y) { for (x = 0; x < 2; ++x, ++tb) { - if (mb->cbp & (*ctx->mc_renderer.empty_block_mask)[0][y][x]) { + if (mb->cbp & (*ctx->empty_block_mask)[0][y][x]) { vl_idct_add_block(&buffer->idct_y, mb->mbx * 2 + x, mb->mby * 2 + y, blocks); blocks += BLOCK_WIDTH * BLOCK_HEIGHT; } @@ -172,7 +178,7 @@ upload_buffer(struct vl_mpeg12_context *ctx, assert(ctx->base.chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420); for (tb = 1; tb < 3; ++tb) { - if (mb->cbp & (*ctx->mc_renderer.empty_block_mask)[tb][0][0]) { + if (mb->cbp & (*ctx->empty_block_mask)[tb][0][0]) { if(tb == 1) vl_idct_add_block(&buffer->idct_cb, mb->mbx, mb->mby, blocks); else @@ -289,7 +295,7 @@ vl_mpeg12_decode_macroblocks(struct pipe_video_context *vpipe, for ( i = 0; i < num_macroblocks; ++i ) { vl_vb_add_block(&ctx->cur_buffer->vertex_stream, &mpeg12_macroblocks[i], - ctx->mc_renderer.empty_block_mask); + ctx->empty_block_mask); upload_buffer(ctx, ctx->cur_buffer, &mpeg12_macroblocks[i]); } @@ -664,6 +670,10 @@ vl_create_mpeg12_context(struct pipe_context *pipe, return NULL; } + /* TODO: Implement 422, 444 */ + assert(chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420); + ctx->empty_block_mask = &const_empty_block_mask_420; + if (!(idct_matrix = vl_idct_upload_matrix(ctx->pipe))) return false; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.h b/src/gallium/auxiliary/vl/vl_mpeg12_context.h index 6ad734c9fda..6c964fbe92a 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_context.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.h @@ -41,6 +41,7 @@ struct vl_mpeg12_context struct pipe_video_context base; struct pipe_context *pipe; struct pipe_surface *decode_target; + const unsigned (*empty_block_mask)[3][2][2]; struct pipe_vertex_buffer quads; unsigned vertex_buffer_size; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index df3373ebd88..0e5a21c18b6 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -56,12 +56,6 @@ enum VS_OUTPUT VS_O_MV3 }; -static const unsigned const_empty_block_mask_420[3][2][2] = { - { { 0x20, 0x10 }, { 0x08, 0x04 } }, - { { 0x02, 0x02 }, { 0x02, 0x02 } }, - { { 0x01, 0x01 }, { 0x01, 0x01 } } -}; - static void * create_vert_shader(struct vl_mpeg12_mc_renderer *r) { @@ -537,10 +531,6 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, renderer->buffer_height = buffer_height; renderer->chroma_format = chroma_format; - /* TODO: Implement 422, 444 */ - assert(chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420); - renderer->empty_block_mask = &const_empty_block_mask_420; - renderer->texview_map = util_new_keymap(sizeof(struct pipe_surface*), -1, texview_map_delete); if (!renderer->texview_map) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h index 805fec530b0..b761961b219 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h @@ -43,7 +43,6 @@ struct vl_mpeg12_mc_renderer unsigned buffer_width; unsigned buffer_height; enum pipe_video_chroma_format chroma_format; - const unsigned (*empty_block_mask)[3][2][2]; struct pipe_viewport_state viewport; struct pipe_framebuffer_state fb_state; -- 2.30.2