[Libav-user] Help with a couple of bitmap scaling issues

Nicolas George nicolas.george at normalesup.org
Thu Mar 21 15:01:35 CET 2013

Le primidi 1er germinal, an CCXXI, aeseldyrx a écrit :
> 1. The first issue happens, when I try down-scaling a large bitmap
> (4608x3328) to a much smaller size (e.g. 256x185).
> The resulting image resembles the original, however all colours have become
> slightly more green during the scaling.
> Basically the output looks as if it has gotten a green tint/overlay.
> Initial testing was done with sws_scale via a small test application I've
> written. The conversion was from BGR24 to BGR24.
> After noticing the problem, I consequently tried to reproduce the issue
> with FFmpeg.exe (Zeranoe's build), and the results were identical.
> To reproduce:
> Get a large bitmap such as this:
> http://wa8lmf.net/MapCaptureTool/Google-Terrain-SoCal-Zoom-12.htm
> Use FFmpeg.exe with the following command: ffmpeg.exe -i path\to\image -s
> 256x185 path\to\output.bmp
> To see a properly coloured output, change the output extension to .jpg
> instead.
> Am I doing something wrong here, or could this be an sws_scale bgr2bgr
> error?

I am seeing the same greenish tint with BMP output and not with PNG output
using ffmpeg built with gcc for Linux.

Note: the green tint happens with "format=rgba,scale=256x185" but not with
"scale=256x185,format=rgba", so the problem is when rgba is the output

> 2. The second issue has to do with extreme down-scaling. If we use the
> linked image from above as an example.
> If I were to scale it down to something as small as 64x46, I would get an
> error telling me to increase the MAX_FILTER_SIZE,
> to accomplish such extreme scaling.
> Now, if I increase the MAX_FILTER_SIZE, the extreme scaling works, but the
> output is corrupt, and normal scaling of other images
> results in a crash.
> I simply doubled the size of  MAX_FILTER_SIZE, to keep the format. Perhaps
> that was the wrong action?
> Would it be better to simply perform consecutively smaller down-scale
> operations on the image until the destination size has been reached?

IMHO, lsws driving code should detect this kind of extreme scaling and split
it automatically into manageable steps. I have no idea what would be the
more efficient / aesthetic way of downscaling: 1/72 = 1/8 × 1/9? 1/2 × 1/36?
1/36 × 1/2? People who know the scaling algorithms better than me can


  Nicolas George
-------------- 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/libav-user/attachments/20130321/be787488/attachment.asc>

More information about the Libav-user mailing list