diff options
author | NVIDIA Corporation <> | 2009-01-20 09:28:36 +0000 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2009-01-20 09:28:36 +0000 |
commit | c5b42f4a80b6668cb10d87b065f4e95bea6311c0 (patch) | |
tree | a9d43915c23959cef8fa7898affc6088df9b3d7c /libavcodec/vdpauvideo.c | |
parent | 15a4e8b85a89b398be27decca61455f5b839c6c6 (diff) | |
download | ffmpeg-c5b42f4a80b6668cb10d87b065f4e95bea6311c0.tar.gz |
Add VDPAU hardware accelerated decoding for WMV3 and VC1 which can
be used by video players.
Original patch by NVIDIA corporation.
Originally committed as revision 16699 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vdpauvideo.c')
-rw-r--r-- | libavcodec/vdpauvideo.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/libavcodec/vdpauvideo.c b/libavcodec/vdpauvideo.c index a7c604d1e2..8eb806a1a0 100644 --- a/libavcodec/vdpauvideo.c +++ b/libavcodec/vdpauvideo.c @@ -24,6 +24,7 @@ #include <limits.h> #include "avcodec.h" #include "h264.h" +#include "vc1.h" #undef NDEBUG #include <assert.h> @@ -232,4 +233,73 @@ void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, render->bitstream_buffers_used = 0; } +void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, + int buf_size) +{ + VC1Context *v = s->avctx->priv_data; + struct vdpau_render_state * render, * last, * next; + + render = (struct vdpau_render_state*)s->current_picture.data[0]; + assert(render); + + /* fill LvPictureInfoVC1 struct */ + render->info.vc1.frame_coding_mode = v->fcm; + render->info.vc1.postprocflag = v->postprocflag; + render->info.vc1.pulldown = v->broadcast; + render->info.vc1.interlace = v->interlace; + render->info.vc1.tfcntrflag = v->tfcntrflag; + render->info.vc1.finterpflag = v->finterpflag; + render->info.vc1.psf = v->psf; + render->info.vc1.dquant = v->dquant; + render->info.vc1.panscan_flag = v->panscanflag; + render->info.vc1.refdist_flag = v->refdist_flag; + render->info.vc1.quantizer = v->quantizer_mode; + render->info.vc1.extended_mv = v->extended_mv; + render->info.vc1.extended_dmv = v->extended_dmv; + render->info.vc1.overlap = v->overlap; + render->info.vc1.vstransform = v->vstransform; + render->info.vc1.loopfilter = v->s.loop_filter; + render->info.vc1.fastuvmc = v->fastuvmc; + render->info.vc1.range_mapy_flag = v->range_mapy_flag; + render->info.vc1.range_mapy = v->range_mapy; + render->info.vc1.range_mapuv_flag = v->range_mapuv_flag; + render->info.vc1.range_mapuv = v->range_mapuv; + /* Specific to simple/main profile only */ + render->info.vc1.multires = v->multires; + render->info.vc1.syncmarker = v->s.resync_marker; + render->info.vc1.rangered = v->rangered; + render->info.vc1.maxbframes = v->s.max_b_frames; + + render->info.vc1.deblockEnable = v->postprocflag & 1; + render->info.vc1.pquant = v->pq; + + render->info.vc1.forward_reference = VDP_INVALID_HANDLE; + render->info.vc1.backward_reference = VDP_INVALID_HANDLE; + + if (v->bi_type) + render->info.vc1.picture_type = 4; + else + render->info.vc1.picture_type = s->pict_type - 1 + s->pict_type / 3; + + switch(s->pict_type){ + case FF_B_TYPE: + next = (struct vdpau_render_state*)s->next_picture.data[0]; + assert(next); + render->info.vc1.backward_reference = next->surface; + // no break here, going to set forward prediction + case FF_P_TYPE: + last = (struct vdpau_render_state*)s->last_picture.data[0]; + if (!last) // FIXME: Does this test make sense? + last = render; // predict second field from the first + render->info.vc1.forward_reference = last->surface; + } + + ff_vdpau_add_data_chunk(s, buf, buf_size); + + render->info.vc1.slice_count = 1; + + ff_draw_horiz_band(s, 0, s->avctx->height); + render->bitstream_buffers_used = 0; +} + /* @}*/ |