[FFmpeg-devel] Droping old scaler

Robert Swain robert.swain
Fri Sep 5 14:47:11 CEST 2008

2008/9/5 Michael Niedermayer <michaelni at gmx.at>:
> On Fri, Sep 05, 2008 at 07:10:05AM +0300, Kostya wrote:
>> What are architectural drawbacks of it anyway?
> imgconvert has no architectur it just is a bunch of convert a to b
> functions.
> imgconvert does not scale the image, imgresample supports only yuv420
> imgconvert has no SIMD optimzations
> imgconvert upscales chroma when needed with nearest neighbor scaling only
> swscale allows any linear rescaling function to be used, bilinear, bicubic
> lanczos, spline, windowed sinc, ...
> can apply a user specified convolutional filter
> (sharpen/blur/shift/contrast/...)
> many conversion pathes especially the common ones are highly optimized.
> imgconvert supports only 2 yuv colorpspaces, swscale supports all in
> case of yuv->rgb but sadly only 1 in the yuv->yuv & rgb->yuv cases.
> Though swscale has the API in place to support all in all convertion
> since ages, it just lacks the implementation.
> (this is the jpeg colorspace bug above)
> The biggest issue with swscale after the jpeg colorspace is that it
> expects the internal colorspace to have chroma horizontally subsampled
> by half. This leads to slightly lower quality when both source and
> destination have more chroma, though one has to keep in mind that
> imgresample even requires yuv420 so this isnt worse except when no
> scaling is done.

Why does it have this behaviour? I would assume it can be 'fixed'.

> Fixing imgresample/convert is equivalent to a complete rewrite, fixing swscale
> just needs a yuv444 internal path, the jpeg colorspace and the regression
> tests to be fixed, where the first is IMHO not really blocking the switch
> because the current system isnt really better.

There is also 64-bit accurate rounding that is broken. See issue222.

> swscale also is in need of simple code factorization, spliting in files
> a nicer internal API for SIMD, ... patches here are welcome.

The public API seems somewhat prone to errors as well and could
probably be better/more clearly documented. Simple, isolated example
code for use cases such as resizing, converting colour space and
cropping would be welcome. Disseminating such from ffplay.c and
ffmpeg.c isn't the nicest thing in the world to do. :)

When converting HandBrake from using imgconvert to swscale, even after
reading the relevant documentation from the headers I was left poking
the code until it worked.

That was an interesting summary e-mail of the old and the new by the
way. Thanks. :)


More information about the ffmpeg-devel mailing list