diff options
author | Christian König <[email protected]> | 2013-07-15 01:50:24 -0600 |
---|---|---|
committer | Christian König <[email protected]> | 2013-08-19 10:21:14 +0200 |
commit | 53e20b8b418cc85e13d70f41ce160e17847a5096 (patch) | |
tree | fab98050b72995f12e7126c3df148d5aaab77415 /src/gallium/auxiliary/vl | |
parent | d13003f544417db6de44c65a0c118bd2b189458a (diff) |
vl: use a template for create_video_decoder
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/vl')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_decoder.c | 23 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_decoder.h | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 24 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_decoder.h | 7 |
4 files changed, 19 insertions, 41 deletions
diff --git a/src/gallium/auxiliary/vl/vl_decoder.c b/src/gallium/auxiliary/vl/vl_decoder.c index 16f09b501e6..dcbb77c9bfd 100644 --- a/src/gallium/auxiliary/vl/vl_decoder.c +++ b/src/gallium/auxiliary/vl/vl_decoder.c @@ -61,13 +61,10 @@ vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile) struct pipe_video_decoder * vl_create_decoder(struct pipe_context *pipe, - enum pipe_video_profile profile, - enum pipe_video_entrypoint entrypoint, - enum pipe_video_chroma_format chroma_format, - unsigned width, unsigned height, unsigned max_references, - bool expect_chunked_decode) + const struct pipe_video_decoder *templat) { - unsigned buffer_width, buffer_height; + unsigned width = templat->width, height = templat->height; + struct pipe_video_decoder temp; bool pot_buffers; assert(pipe); @@ -76,18 +73,18 @@ vl_create_decoder(struct pipe_context *pipe, pot_buffers = !pipe->screen->get_video_param ( pipe->screen, - profile, + templat->profile, PIPE_VIDEO_CAP_NPOT_TEXTURES ); - buffer_width = pot_buffers ? util_next_power_of_two(width) : align(width, VL_MACROBLOCK_WIDTH); - buffer_height = pot_buffers ? util_next_power_of_two(height) : align(height, VL_MACROBLOCK_HEIGHT); + temp = *templat; + temp.width = pot_buffers ? util_next_power_of_two(width) : align(width, VL_MACROBLOCK_WIDTH); + temp.height = pot_buffers ? util_next_power_of_two(height) : align(height, VL_MACROBLOCK_HEIGHT); - switch (u_reduce_video_profile(profile)) { + switch (u_reduce_video_profile(temp.profile)) { case PIPE_VIDEO_CODEC_MPEG12: - return vl_create_mpeg12_decoder(pipe, profile, entrypoint, chroma_format, - buffer_width, buffer_height, max_references, - expect_chunked_decode); + return vl_create_mpeg12_decoder(pipe, &temp); + default: return NULL; } diff --git a/src/gallium/auxiliary/vl/vl_decoder.h b/src/gallium/auxiliary/vl/vl_decoder.h index b0b4161d4ec..64a1b14df6f 100644 --- a/src/gallium/auxiliary/vl/vl_decoder.h +++ b/src/gallium/auxiliary/vl/vl_decoder.h @@ -48,10 +48,6 @@ vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile); */ struct pipe_video_decoder * vl_create_decoder(struct pipe_context *pipe, - enum pipe_video_profile profile, - enum pipe_video_entrypoint entrypoint, - enum pipe_video_chroma_format chroma_format, - unsigned width, unsigned height, unsigned max_references, - bool expect_chunked_decode); + const struct pipe_video_decoder *templat); #endif /* vl_decoder_h */ diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 1eb970888b6..48661cf589c 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -480,7 +480,7 @@ vl_mpeg12_get_decode_buffer(struct vl_mpeg12_decoder *dec, struct pipe_video_buf if (dec->base.entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM) vl_mpg12_bs_init(&buffer->bs, &dec->base); - if (dec->expect_chunked_decode) + if (dec->base.expect_chunked_decode) vl_video_buffer_set_associated_data(target, &dec->base, buffer, vl_mpeg12_destroy_buffer); else @@ -1018,30 +1018,21 @@ mc_frag_shader_callback(void *priv, struct vl_mc *mc, struct pipe_video_decoder * vl_create_mpeg12_decoder(struct pipe_context *context, - enum pipe_video_profile profile, - enum pipe_video_entrypoint entrypoint, - enum pipe_video_chroma_format chroma_format, - unsigned width, unsigned height, unsigned max_references, - bool expect_chunked_decode) + const struct pipe_video_decoder *templat) { const unsigned block_size_pixels = VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT; const struct format_config *format_config; struct vl_mpeg12_decoder *dec; - assert(u_reduce_video_profile(profile) == PIPE_VIDEO_CODEC_MPEG12); + assert(u_reduce_video_profile(templat->profile) == PIPE_VIDEO_CODEC_MPEG12); dec = CALLOC_STRUCT(vl_mpeg12_decoder); if (!dec) return NULL; + dec->base = *templat; dec->base.context = context; - dec->base.profile = profile; - dec->base.entrypoint = entrypoint; - dec->base.chroma_format = chroma_format; - dec->base.width = width; - dec->base.height = height; - dec->base.max_references = max_references; dec->base.destroy = vl_mpeg12_destroy; dec->base.begin_frame = vl_mpeg12_begin_frame; @@ -1053,7 +1044,6 @@ vl_create_mpeg12_decoder(struct pipe_context *context, dec->blocks_per_line = MAX2(util_next_power_of_two(dec->base.width) / block_size_pixels, 4); dec->num_blocks = (dec->base.width * dec->base.height) / block_size_pixels; dec->width_in_macroblocks = align(dec->base.width, VL_MACROBLOCK_WIDTH) / VL_MACROBLOCK_WIDTH; - dec->expect_chunked_decode = expect_chunked_decode; /* TODO: Implement 422, 444 */ assert(dec->base.chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420); @@ -1082,7 +1072,7 @@ vl_create_mpeg12_decoder(struct pipe_context *context, dec->ves_ycbcr = vl_vb_get_ves_ycbcr(dec->base.context); dec->ves_mv = vl_vb_get_ves_mv(dec->base.context); - switch (entrypoint) { + switch (templat->entrypoint) { case PIPE_VIDEO_ENTRYPOINT_BITSTREAM: format_config = find_format_config(dec, bitstream_format_config, num_bitstream_format_configs); break; @@ -1109,7 +1099,7 @@ vl_create_mpeg12_decoder(struct pipe_context *context, if (!init_zscan(dec, format_config)) goto error_zscan; - if (entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT) { + if (templat->entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT) { if (!init_idct(dec, format_config)) goto error_sources; } else { @@ -1140,7 +1130,7 @@ error_mc_c: vl_mc_cleanup(&dec->mc_y); error_mc_y: - if (entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT) { + if (templat->entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT) { vl_idct_cleanup(&dec->idct_y); vl_idct_cleanup(&dec->idct_c); dec->idct_source->destroy(dec->idct_source); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h index 3b2d5f9dba5..dd284ee6531 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.h @@ -50,7 +50,6 @@ struct vl_mpeg12_decoder unsigned blocks_per_line; unsigned num_blocks; unsigned width_in_macroblocks; - bool expect_chunked_decode; enum pipe_format zscan_source_format; @@ -105,10 +104,6 @@ struct vl_mpeg12_buffer */ struct pipe_video_decoder * vl_create_mpeg12_decoder(struct pipe_context *pipe, - enum pipe_video_profile profile, - enum pipe_video_entrypoint entrypoint, - enum pipe_video_chroma_format chroma_format, - unsigned width, unsigned height, unsigned max_references, - bool expect_chunked_decode); + const struct pipe_video_decoder *templat); #endif /* vl_mpeg12_decoder_h */ |