[FFmpeg-devel] [PATCH]VDPAU patch for VC1 decoding, round 4
Kostya
kostya.shishkov
Fri Jan 9 18:59:56 CET 2009
On Thu, Jan 08, 2009 at 03:30:29AM +0100, Carl Eugen Hoyos wrote:
> Hi!
>
> Attached patch has an updated alignment.
>
> Please comment, Carl Eugen
[...]
> Index: libavcodec/Makefile
> ===================================================================
> --- libavcodec/Makefile (revision 16489)
> +++ libavcodec/Makefile (working copy)
> @@ -214,6 +214,7 @@
> OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
> OBJS-$(CONFIG_VB_DECODER) += vb.o
> OBJS-$(CONFIG_VC1_DECODER) += vc1.o vc1data.o vc1dsp.o msmpeg4data.o h263dec.o h263.o intrax8.o intrax8dsp.o error_resilience.o mpegvideo.o
> +OBJS-$(CONFIG_VC1_VDPAU_DECODER) += vdpauvideo.o
> OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o
> OBJS-$(CONFIG_VCR1_ENCODER) += vcr1.o
> OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdav.o
> @@ -237,6 +238,7 @@
> OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o msmpeg4.o msmpeg4data.o h263dec.o h263.o intrax8.o intrax8dsp.o mpeg12data.o mpegvideo.o error_resilience.o
> OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o msmpeg4.o msmpeg4data.o mpegvideo_enc.o motion_est.o ratecontrol.o h263.o mpeg12data.o mpegvideo.o error_resilience.o
> OBJS-$(CONFIG_WMV3_DECODER) += vc1.o vc1data.o vc1dsp.o msmpeg4data.o h263dec.o h263.o intrax8.o intrax8dsp.o error_resilience.o mpegvideo.o
> +OBJS-$(CONFIG_WMV3_VDPAU_DECODER) += vdpauvideo.o
are you sure that will work with VDPAU decoders enabled and native decoders disabled?
[...]
> + /* Presently, making these as 0 */
> + render->info.vc1.deblockEnable = 0;
> + render->info.vc1.pquant = 0;
pquant can be obtained from v->pq and v->halfpq
and deblockEnable may correspond to v->postproc
(just a guess)
[...]
> Index: libavcodec/vc1.c
> ===================================================================
> --- libavcodec/vc1.c (revision 16489)
> +++ libavcodec/vc1.c (working copy)
> @@ -34,6 +34,7 @@
> #include "msmpeg4data.h"
> #include "unary.h"
> #include "simple_idct.h"
> +#include "vdpau_internal.h"
>
> #undef NDEBUG
> #include <assert.h>
> @@ -3996,7 +3997,8 @@
>
> avctx->coded_width = avctx->width;
> avctx->coded_height = avctx->height;
> - if (avctx->codec_id == CODEC_ID_WMV3)
> + if (avctx->codec_id == CODEC_ID_WMV3
> + || avctx->codec_id == CODEC_ID_WMV3_VDPAU)
> {
> int count = 0;
>
> @@ -4111,6 +4113,7 @@
> MpegEncContext *s = &v->s;
> AVFrame *pict = data;
> uint8_t *buf2 = NULL;
> + const uint8_t *buf_vdpau = buf;
>
> /* no supplementary picture */
> if (buf_size == 0) {
> @@ -4132,8 +4135,17 @@
> s->current_picture_ptr= &s->picture[i];
> }
>
> + if (avctx->codec_id == CODEC_ID_VC1_VDPAU
> + || avctx->codec_id == CODEC_ID_WMV3_VDPAU){
> + if (v->profile < PROFILE_ADVANCED)
> + avctx->pix_fmt = PIX_FMT_VDPAU_VC1_MAIN;
> + else
> + avctx->pix_fmt = PIX_FMT_VDPAU_VC1_ADVANCED;
> + }
> +
> //for advanced profile we may need to parse and unescape data
> - if (avctx->codec_id == CODEC_ID_VC1) {
> + if (avctx->codec_id == CODEC_ID_VC1
> + || avctx->codec_id == CODEC_ID_VC1_VDPAU) {
> int buf_size2 = 0;
> buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
>
> @@ -4148,6 +4160,9 @@
> if(size <= 0) continue;
> switch(AV_RB32(start)){
> case VC1_CODE_FRAME:
> + if (avctx->codec_id == CODEC_ID_VC1_VDPAU
> + || avctx->codec_id == CODEC_ID_WMV3_VDPAU)
> + buf_vdpau = start;
> buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
> break;
> case VC1_CODE_ENTRYPOINT: /* it should be before frame data */
> @@ -4236,6 +4251,10 @@
> s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
> s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
>
> + if (ENABLE_H264_VDPAU_DECODER && (avctx->codec_id == CODEC_ID_VC1_VDPAU
> + || avctx->codec_id == CODEC_ID_WMV3_VDPAU))
> + ff_vdpau_vc1_decode_picture(s, buf_vdpau, (buf + buf_size) - buf_vdpau);
> + else {
> ff_er_frame_start(s);
>
> v->bits = buf_size * 8;
Does it use escaped data for decoding? If so, why not skip unescaping?
Alternatively I think you can move it into separate vc1_vpdau_decode_frame() with
only necessary parts left (most of the things there are useless for VPDAU anyway).
More information about the ffmpeg-devel
mailing list