[FFmpeg-devel] SWSCLAE: Colorspace conversion for small images

Pavel Pavlov pavel
Tue Jul 20 09:43:17 CEST 2010


I use libswscale. I had some problems when loading high quality jpegs and converting them to rgb565 (https://roundup.ffmpeg.org/issue2113 )
Other than that I had other problems related to swsacale.
First one is because of this code:
#if ARCH_X86
#define VOFW 5120
#else
#define VOFW 2048 // faster on PPC and not tested on others
#endif

I use swscale on mobile and there are pictures that wider than 2048. Actually, the problematic picture required me to match 5120 for mobile build as well ;)


The other problem is the opposite end. I have some image resources in the app and some of them can be something like 4x120 pixels (for tiled background for example). What's the way to load such images with libavcodec-avformat-libswscale? Today, swscale considers them insane (doesn't pass sanity check):

    /* sanity check */
    if (srcW<4 || srcH<1 || dstW<8 || dstH<1) { //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code
        av_log(NULL, AV_LOG_ERROR, "swScaler: %dx%d -> %dx%d is invalid scaling dimension\n",

Does it still need to do these checks if I simply want to do colorspace conversion without scaling? Is there any other routine that I should use to convert from YUV444 to rgb565?


In general ffmpeg is well written (for example compared to libjpeg or something like that) and usually performs quite well. I use OS facilities on windows to load images, but because some of them didn't load properly I decided to try to use ffmpeg to load images. As a result, I had big image problem, small image problem and on top of that I also tried to measure performance and it's also worse (maybe because I had to do csp conversion to rgb565 and it's not well optimized, I don't know)


thanks



More information about the ffmpeg-devel mailing list