From 1f8851863813c6a94cd1d6e2ca5fb108cd6ed61f Mon Sep 17 00:00:00 2001 From: lucabe Date: Sun, 17 Sep 2006 15:02:13 +0000 Subject: [PATCH] Use PIX_FMT_* instead of IMGFMT_* when calling sws_getContext() git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19876 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_sab.c | 3 ++- libmpcodecs/vf_scale.c | 18 +++++++++++++----- libmpcodecs/vf_smartblur.c | 3 ++- spudec.c | 3 ++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/libmpcodecs/vf_sab.c b/libmpcodecs/vf_sab.c index df84cc03e2..7bf2783be1 100644 --- a/libmpcodecs/vf_sab.c +++ b/libmpcodecs/vf_sab.c @@ -29,6 +29,7 @@ #include #endif +#include "avutil.h" #include "img_format.h" #include "mp_image.h" #include "vf.h" @@ -100,7 +101,7 @@ static int allocStuff(FilterParam *f, int width, int height){ swsF.lumH= swsF.lumV= vec; swsF.chrH= swsF.chrV= NULL; f->preFilterContext= sws_getContext( - width, height, IMGFMT_Y8, width, height, IMGFMT_Y8, get_sws_cpuflags(), &swsF, NULL, NULL); + width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, get_sws_cpuflags(), &swsF, NULL, NULL); sws_freeVec(vec); vec = sws_getGaussianVec(f->strength, 5.0); diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index 84aa0006ca..c824cd870a 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -10,6 +10,7 @@ #include "img_format.h" #include "mp_image.h" #include "vf.h" +#include "fmt-conversion.h" #include "libvo/fastmemcpy.h" #include "libswscale/swscale.h" @@ -116,11 +117,14 @@ static int config(struct vf_instance_s* vf, int int_sws_flags=0; int round_w=0, round_h=0; SwsFilter *srcFilter, *dstFilter; + enum PixelFormat dfmt, sfmt; if(!best){ mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n"); return 0; } + sfmt = imgfmt2pixfmt(outfmt); + dfmt = imgfmt2pixfmt(best); vo_flags=vf->next->query_format(vf->next,best); @@ -222,15 +226,15 @@ static int config(struct vf_instance_s* vf, int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT; int_sws_flags|= vf->priv->accurate_rnd * SWS_ACCURATE_RND; vf->priv->ctx=sws_getContext(width, height >> vf->priv->interlaced, - outfmt, + sfmt, vf->priv->w, vf->priv->h >> vf->priv->interlaced, - best, + dfmt, int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); if(vf->priv->interlaced){ vf->priv->ctx2=sws_getContext(width, height >> 1, - outfmt, + sfmt, vf->priv->w, vf->priv->h >> 1, - best, + dfmt, int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); } if(!vf->priv->ctx){ @@ -559,9 +563,13 @@ struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, { int flags; SwsFilter *dstFilterParam, *srcFilterParam; + enum PixelFormat dfmt, sfmt; + + dfmt = imgfmt2pixfmt(dstFormat); + sfmt = imgfmt2pixfmt(srcFormat); sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam); - return sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL); + return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL); } /// An example of presets usage diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c index 5de9040367..ba9b5a19bb 100644 --- a/libmpcodecs/vf_smartblur.c +++ b/libmpcodecs/vf_smartblur.c @@ -29,6 +29,7 @@ #include #endif +#include "avutil.h" #include "img_format.h" #include "mp_image.h" #include "vf.h" @@ -91,7 +92,7 @@ static int allocStuff(FilterParam *f, int width, int height){ swsF.lumH= swsF.lumV= vec; swsF.chrH= swsF.chrV= NULL; f->filterContext= sws_getContext( - width, height, IMGFMT_Y8, width, height, IMGFMT_Y8, get_sws_cpuflags(), &swsF, NULL, NULL); + width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, get_sws_cpuflags(), &swsF, NULL, NULL); sws_freeVec(vec); diff --git a/spudec.c b/spudec.c index 0b0327e4e5..f5eb20f786 100644 --- a/spudec.c +++ b/spudec.c @@ -23,6 +23,7 @@ #include #include "libvo/video_out.h" #include "spudec.h" +#include "avutil.h" #include "libswscale/swscale.h" #define MIN(a, b) ((a)<(b)?(a):(b)) @@ -754,7 +755,7 @@ void sws_spu_image(unsigned char *d1, unsigned char *d2, int dw, int dh, int ds, oldvar = spu_gaussvar; } - ctx=sws_getContext(sw, sh, IMGFMT_Y800, dw, dh, IMGFMT_Y800, SWS_GAUSS, &filter, NULL, NULL); + ctx=sws_getContext(sw, sh, PIX_FMT_GRAY8, dw, dh, PIX_FMT_GRAY8, SWS_GAUSS, &filter, NULL, NULL); sws_scale(ctx,&s1,&ss,0,sh,&d1,&ds); for (i=ss*sh-1; i>=0; i--) if (!s2[i]) s2[i] = 255; //else s2[i] = 1; sws_scale(ctx,&s2,&ss,0,sh,&d2,&ds);