[FFmpeg-devel] [PATCH] mpeg12: reduce hwaccel-related code duplication.

Michael Niedermayer michaelni at gmx.at
Sun Feb 24 19:22:23 CET 2013


On Sun, Feb 24, 2013 at 07:16:32PM +0100, Reimar Döffinger wrote:
> On Sun, Feb 24, 2013 at 06:06:08PM +0100, Michael Niedermayer wrote:
> > On Sun, Feb 24, 2013 at 05:22:16PM +0100, Reimar Döffinger wrote:
> > > Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> > > ---
> > >  libavcodec/mpeg12.c |   17 ++++++-----------
> > >  1 file changed, 6 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
> > > index 2ef3360..85cf068 100644
> > > --- a/libavcodec/mpeg12.c
> > > +++ b/libavcodec/mpeg12.c
> > > @@ -1245,6 +1245,12 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
> > >          } else if (!avctx->xvmc_acceleration) {
> > >              avctx->xvmc_acceleration = 2;
> > >          }
> > > +        avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
> > > +        // until then pix_fmt may be changed right after codec init
> > > +        if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
> > > +            avctx->hwaccel || uses_vdpau(avctx))
> > > +            if (avctx->idct_algo == FF_IDCT_AUTO)
> > > +                avctx->idct_algo = FF_IDCT_SIMPLE;
> > >          return res;
> > >      } else if(s->chroma_format == 2)
> > >          return AV_PIX_FMT_YUV422P;
> > 
> > with that mpeg_get_pixelformat would do more than just getting the
> > pixel format (which is suggested by its name)
> 
> It does that already, it sets up avctx->xvmc_acceleration for example.
> Setting up that one inside and hwaccel outside seem inconsistent for no
> good reason.

> Though moving all to a setup_for_hwaccel function or similar probably
> should be fine just as much from my side.

ok

thanks

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130224/bb1bb28b/attachment.asc>


More information about the ffmpeg-devel mailing list