[Ffmpeg-devel] [RFC, PATCH] import libswscale
Michael Niedermayer
michaelni
Tue Mar 21 20:40:52 CET 2006
Hi
On Tue, Mar 21, 2006 at 12:17:23PM +0100, Luca Abeni wrote:
> Hi all,
>
> Here is a first candidate for importing swscale in the ffmpeg tree.
>
> Get ffmpeg from CVS, apply my cropping/padding/rescaling patchset, untar
> the attached libswscale.tgz into the ffmpeg directory, and apply the
> attached sws-internal.diff.
> Then, you can configure with "--enable-swscaler --enable-gpl"
> As usual, I did some tests with rescaling, cropping, padding, and pixel
> format conversion, and everything seems to work.
>
> Some notes/questions:
[...]
>
> 2) Which interface do we want to use for libswscale? I think we should
> access it through ffmpeg's "img_resample*()" and similar functions (this
> implies that swscale.h will become a private header). Is this ok?
hmm, iam not sure, but its ok for the moment we can change this later
[...]
>
> 4) There still are many details that should be improved, but I think the
> important thing is to import libswscale in CVS in a short time.
> After that, things can be fixed/improved with small incremental patches.
> For example, right now libswscale depends on libavcodec (for av_malloc,
> av_free, av_log, and similar), but libavcodec depends on libswscale for
> rescaling images. I do not like this kind of "loop dependencies", so
> maybe swscale_glue.c should be moved to libswscale. But I think this can
> be done in a second time.
> Is this acceptable?
yes
[...]
[build system changes left for the build system maintainer]
> Index: ffmpeg/libavcodec/swscaler_glue.c
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ ffmpeg/libavcodec/swscaler_glue.c 2006-03-21 10:04:02.676980744 +0100
> @@ -0,0 +1,149 @@
> +#include "avcodec.h"
> +
> +#include "swscale.h"
> +
> +struct glue_context {
> + struct SwsContext *ctx;
> + int h, w;
> + int topBand, leftBand, topPad, leftPad;
> + int src_shift[3], dst_shift[3];
> +};
> +
> +/* Choose one of the following:
> + SWS_FAST_BILINEAR
> + SWS_BILINEAR
> + SWS_BICUBIC
> + SWS_X
> + SWS_POINT
> + SWS_AREA
> + SWS_BICUBLIN
> + SWS_GAUSS
> + SWS_SINC
> + SWS_LANCZOS
> + SWS_SPLINE
> +*/
> +int sws_flags = SWS_BICUBIC;
uhm, globals ...
> +
> +
> +int img_convert(AVPicture *dst, int dfmt,
> + const AVPicture *src, int sfmt,
> + int src_width, int src_height)
> +{
> + int i;
> + struct SwsContext *ctx;
> + uint8_t *s[3];
> + uint8_t *d[3];
> + int ss[3], ds[3];
please use a little bit more descriptive variable names, single letters suck
> +
> + ctx = NULL;
> +
> + ctx = sws_getContext(src_width, src_height, sfmt, src_width, src_height, dfmt, sws_flags, NULL, NULL, NULL);
setting ctx twice?
[...]
--
Michael
More information about the ffmpeg-devel
mailing list