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

aeseldyrx aeseldyrx at gmail.com
Thu Mar 21 14:47:26 CET 2013


Hi,

I've recently been testing image decoding and scaling with FFmpeg (compiled
with mingw as dlls on Windows 7 x64),
and everything has been working smoothly with the exception of two problems.

Both problems are seemingly related to down-scaling of large images.
As mentioned in the subject, I experienced these issues while testing bmp
files.

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?


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?


Oh! And one very interesting note: Both issues were resolved, when I used
FFmpeg dlls compiled with the MSVC toolchain (same config). Hmm...

I will happily provide additional information if required (build
configuration etc).
Thanks for your help, and for FFmpeg.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130321/c023db56/attachment.html>


More information about the Libav-user mailing list