diff options
author | Christian König <[email protected]> | 2011-08-09 18:45:13 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-08-26 12:10:34 +0200 |
commit | 1d1d038c85ebb37f1da4540f092563e8ecab7dfb (patch) | |
tree | 6e3a55e43ddad1bfd70dad96756ecd166b646373 /src/gallium/state_trackers/vdpau/decode.c | |
parent | 6fb12bf031fdceadebc8a3d7b7756bc822fbf6e4 (diff) |
g3dvl: Rework the decoder interface part 1/5
First of all get ride of the decode_buffer structure, while still giving
the decoder the ability to organize it's buffers depending on the needs
of the state tracker.
Signed-off-by: Christian König <[email protected]>
Reviewed-by: Younes Manton <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/vdpau/decode.c')
-rw-r--r-- | src/gallium/state_trackers/vdpau/decode.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index 96542f874d9..3bf05bea21f 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -107,7 +107,7 @@ error_buffer: for (i = 0; i < VL_NUM_DECODE_BUFFERS; ++i) if (vldecoder->buffer[i]) - vldecoder->buffer[i]->destroy(vldecoder->buffer[i]); + vldecoder->decoder->destroy_buffer(vldecoder->decoder, vldecoder->buffer[i]); vldecoder->decoder->destroy(vldecoder->decoder); @@ -130,7 +130,7 @@ vlVdpDecoderDestroy(VdpDecoder decoder) for (i = 0; i < VL_NUM_DECODE_BUFFERS; ++i) if (vldecoder->buffer[i]) - vldecoder->buffer[i]->destroy(vldecoder->buffer[i]); + vldecoder->decoder->destroy_buffer(vldecoder->decoder, vldecoder->buffer[i]); vldecoder->decoder->destroy(vldecoder->decoder); @@ -162,8 +162,6 @@ vlVdpDecoderGetParameters(VdpDecoder decoder, static VdpStatus vlVdpDecoderRenderMpeg12(struct pipe_video_decoder *decoder, - struct pipe_video_decode_buffer *buffer, - struct pipe_video_buffer *target, VdpPictureInfoMPEG1Or2 *picture_info, uint32_t bitstream_buffer_count, VdpBitstreamBuffer const *bitstream_buffers) @@ -176,23 +174,25 @@ vlVdpDecoderRenderMpeg12(struct pipe_video_decoder *decoder, VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding MPEG2\n"); + i = 0; + /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */ - if (picture_info->forward_reference == VDP_INVALID_HANDLE) - ref_frames[0] = NULL; - else { - ref_frames[0] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer; - if (!ref_frames[0]) + if (picture_info->forward_reference != VDP_INVALID_HANDLE) { + ref_frames[i] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference))->video_buffer; + if (!ref_frames[i]) return VDP_STATUS_INVALID_HANDLE; + ++i; } - if (picture_info->backward_reference == VDP_INVALID_HANDLE) - ref_frames[1] = NULL; - else { - ref_frames[1] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer; - if (!ref_frames[1]) + if (picture_info->backward_reference != VDP_INVALID_HANDLE) { + ref_frames[i] = ((vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference))->video_buffer; + if (!ref_frames[i]) return VDP_STATUS_INVALID_HANDLE; + ++i; } + decoder->set_reference_frames(decoder, ref_frames, i); + memset(&picture, 0, sizeof(picture)); picture.base.profile = decoder->profile; picture.picture_coding_type = picture_info->picture_coding_type; @@ -207,19 +207,19 @@ vlVdpDecoderRenderMpeg12(struct pipe_video_decoder *decoder, picture.f_code[1][0] = picture_info->f_code[1][0] - 1; picture.f_code[1][1] = picture_info->f_code[1][1] - 1; - buffer->begin_frame(buffer); + decoder->set_picture_parameters(decoder, &picture.base); memcpy(intra_quantizer_matrix, picture_info->intra_quantizer_matrix, sizeof(intra_quantizer_matrix)); intra_quantizer_matrix[0] = 1 << (7 - picture_info->intra_dc_precision); - buffer->set_quant_matrix(buffer, intra_quantizer_matrix, picture_info->non_intra_quantizer_matrix); + decoder->set_quant_matrix(decoder, intra_quantizer_matrix, picture_info->non_intra_quantizer_matrix); - for (i = 0; i < bitstream_buffer_count; ++i) - buffer->decode_bitstream(buffer, bitstream_buffers[i].bitstream_bytes, - bitstream_buffers[i].bitstream, &picture.base, num_ycbcr_blocks); + decoder->begin_frame(decoder); - buffer->end_frame(buffer); + for (i = 0; i < bitstream_buffer_count; ++i) + decoder->decode_bitstream(decoder, bitstream_buffers[i].bitstream_bytes, + bitstream_buffers[i].bitstream, num_ycbcr_blocks); - decoder->flush_buffer(buffer, num_ycbcr_blocks, ref_frames, target); + decoder->end_frame(decoder, num_ycbcr_blocks); return VDP_STATUS_OK; } @@ -261,11 +261,12 @@ vlVdpDecoderRender(VdpDecoder decoder, case PIPE_VIDEO_PROFILE_MPEG2_MAIN: ++vldecoder->cur_buffer; vldecoder->cur_buffer %= VL_NUM_DECODE_BUFFERS; - return vlVdpDecoderRenderMpeg12(vldecoder->decoder, - vldecoder->buffer[vldecoder->cur_buffer], - vlsurf->video_buffer, - (VdpPictureInfoMPEG1Or2 *)picture_info, - bitstream_buffer_count,bitstream_buffers); + + vldecoder->decoder->set_decode_buffer(vldecoder->decoder, vldecoder->buffer[vldecoder->cur_buffer]); + vldecoder->decoder->set_decode_target(vldecoder->decoder, vlsurf->video_buffer); + + return vlVdpDecoderRenderMpeg12(vldecoder->decoder, (VdpPictureInfoMPEG1Or2 *)picture_info, + bitstream_buffer_count, bitstream_buffers); break; default: |