[FFmpeg-devel] [PATCH]VDPAU support for MPEG-4 ASP

Michael Niedermayer michaelni
Thu Sep 10 13:48:43 CEST 2009


On Sat, Sep 05, 2009 at 12:16:14PM +0200, Carl Eugen Hoyos wrote:
> On Saturday 05 September 2009 10:17:08 Reimar D?ffinger wrote:
> > On Sat, Sep 05, 2009 at 01:08:46AM +0200, Carl Eugen Hoyos wrote:
> > > Attached patch adds support for decoding MPEG-4 ASP on Nvidia's latest
> > > VDPAU hardware.
> >
> > This brings again up the same question: why do we have an extra codec
> > for these formats when the acceleration could just be selected via
> > pixfmt?
> 
> How would this work when ffmpeg will support hardware accelerated decoding (I 
> mean the resulting pix_fmt would then be the same for software decoding and 
> hardware decoding)?

i think it could work like MMX*/SSE*


[...]
> > > +        render->info.mpeg4.trd[1] = (s->time - s->pb_time + s->pp_time
> > > +                                       + (s->pb_time >> 1))/s->pb_time
> > > +               - (s->time - s->pb_time + (s->pb_time >> 1))/s->pb_time;
> > > +        render->info.mpeg4.trb[1] = (s->time + (s->pb_time >>
> > > 1))/s->pb_time +                     - (s->time - s->pb_time +
> > > (s->pb_time >> 1))/s->pb_time;
> >
> > Is it really necessary to round and divide twice?
> > At least this needs an explaining comment.
> 
> Nvidia's original version looks like this:
>         cur_time = s->time;
>         fwd_time = cur_time - s->pb_time;
>         bwd_time = fwd_time +  s->pp_time;
>         frame_time = cur_time - fwd_time;
> 
>         trd[0] =  s->pp_time;
>         trb[0] =  s->pb_time;
>         d = gcd(trb[0], trd[0]);

why is the gcd needed?

[...]

> @@ -582,6 +583,26 @@
>          goto retry;
>      }
>  
> +    if (   CONFIG_MPEG4_VDPAU_DECODER
> +        && (avctx->pix_fmt == PIX_FMT_NONE)
> +        && (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) {
> +        if (s->divx_version >= 500)
> +            avctx->codec->pix_fmts = (enum PixelFormat[]){PIX_FMT_VDPAU_DIVX5, PIX_FMT_NONE};
> +        else if (s->divx_version >= 400)
> +            avctx->codec->pix_fmts = (enum PixelFormat[]){PIX_FMT_VDPAU_DIVX4, PIX_FMT_NONE};
> +        else
> +            avctx->codec->pix_fmts = (enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE};

i dont belive the formats passed to the card really differ enough to justify
having 3 pixel formats


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090910/5d11b0a8/attachment.pgp>



More information about the ffmpeg-devel mailing list