diff options
author | NVIDIA Corporation <> | 2009-11-10 18:52:39 +0000 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2009-11-10 18:52:39 +0000 |
commit | 70e0c871eb2546355063b455b2db4c8247c94a5d (patch) | |
tree | 9cb96ce213fcdb919aaa1859a4b1c2f11730f07e /libavcodec/vdpau.c | |
parent | 00962abaa03a4ac6acb3501ec2ef89ac746b2473 (diff) | |
download | ffmpeg-70e0c871eb2546355063b455b2db4c8247c94a5d.tar.gz |
Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
by video players.
Original patch by NVIDIA corporation.
Originally committed as revision 20502 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vdpau.c')
-rw-r--r-- | libavcodec/vdpau.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 4a7c86c0a8..7cc8ad1ca7 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -305,4 +305,54 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, render->bitstream_buffers_used = 0; } +void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, + int buf_size) +{ + struct vdpau_render_state *render, *last, *next; + int i; + + if (!s->current_picture_ptr) return; + + render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; + assert(render); + + /* fill VdpPictureInfoMPEG4Part2 struct */ + render->info.mpeg4.vop_time_increment_resolution = s->avctx->time_base.den; + render->info.mpeg4.vop_coding_type = 0; + render->info.mpeg4.vop_fcode_forward = s->f_code; + render->info.mpeg4.vop_fcode_backward = s->b_code; + render->info.mpeg4.resync_marker_disable = !s->resync_marker; + render->info.mpeg4.interlaced = !s->progressive_sequence; + render->info.mpeg4.quant_type = s->mpeg_quant; + render->info.mpeg4.quarter_sample = s->quarter_sample; + render->info.mpeg4.short_video_header = s->avctx->codec->id == CODEC_ID_H263; + render->info.mpeg4.rounding_control = s->no_rounding; + render->info.mpeg4.alternate_vertical_scan_flag = s->alternate_scan; + render->info.mpeg4.top_field_first = s->top_field_first; + for (i = 0; i < 64; ++i) { + render->info.mpeg4.intra_quantizer_matrix[i] = s->intra_matrix[i]; + render->info.mpeg4.non_intra_quantizer_matrix[i] = s->inter_matrix[i]; + } + render->info.mpeg4.forward_reference = VDP_INVALID_HANDLE; + render->info.mpeg4.backward_reference = VDP_INVALID_HANDLE; + + switch (s->pict_type) { + case FF_B_TYPE: + next = (struct vdpau_render_state *)s->next_picture.data[0]; + assert(next); + render->info.mpeg4.backward_reference = next->surface; + render->info.mpeg4.vop_coding_type = 2; + // no break here, going to set forward prediction + case FF_P_TYPE: + last = (struct vdpau_render_state *)s->last_picture.data[0]; + assert(last); + render->info.mpeg4.forward_reference = last->surface; + } + + ff_vdpau_add_data_chunk(s, buf, buf_size); + + ff_draw_horiz_band(s, 0, s->avctx->height); + render->bitstream_buffers_used = 0; +} + /* @}*/ |