[FFmpeg-devel] [PATCH] Move param initialization and colorspace details from sws_getContext() to sws_init_context().

Michael Niedermayer michaelni
Wed Sep 29 19:25:28 CEST 2010


On Wed, Sep 29, 2010 at 06:00:27PM +0200, Stefano Sabatini wrote:
> Allow to automatically set the default parameters without explicitely
> set them, also simplify conversion to the new sws_init_context() API.
> ---
>  utils.c |   18 +++++++-----------
>  1 files changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/utils.c b/utils.c
> index 938af9e..bee5a3a 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -761,10 +761,17 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
>      int dstW= c->dstW;
>      int dstH= c->dstH;
>      int flags;
> +    c->srcRange = handle_jpeg(&c->srcFormat);
> +    c->dstRange = handle_jpeg(&c->dstFormat);

that breaks user setted *Range


>      enum PixelFormat srcFormat= c->srcFormat;
>      enum PixelFormat dstFormat= c->dstFormat;
>  
>      flags= c->flags = update_flags_cpu(c->flags);
> +    if (!c->param[0]) c->param[0] = SWS_PARAM_DEFAULT;
> +    if (!c->param[1]) c->param[1] = SWS_PARAM_DEFAULT;

that breaks setting the params to 0


> +
> +    sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, c->dstRange, 0, 1<<16, 1<<16);
> +
>  #if ARCH_X86
>      if (flags & SWS_CPU_CAPS_MMX)
>          __asm__ volatile("emms\n\t"::: "memory");

doing that before emms sounds like a really stupid idea, are you sure theres
no float code in there and never will be ...

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100929/5cf55e9a/attachment.pgp>



More information about the ffmpeg-devel mailing list