diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-12 23:53:08 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2014-11-20 02:00:35 +0100 |
commit | 222236317bf4554bc49e7750ea35556bf902940e (patch) | |
tree | a815412bfed3d4e3ad74a4bc705db2bdd69848ff /libswscale | |
parent | 633a2a082fc1b1b50a70992a181ff48db7acdab4 (diff) | |
download | ffmpeg-222236317bf4554bc49e7750ea35556bf902940e.tar.gz |
swscale/utils: support bayer input + scaling, and bayer input + any supported output
Fixes Ticket4053
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2f6bb86f85886a7fb36e8a10e4dd8cc3a1849377)
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/utils.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index 01e056aef4..0c8a83aa81 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1228,6 +1228,31 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, } } + if (isBayer(srcFormat)) { + if (!unscaled || + (dstFormat != AV_PIX_FMT_RGB24 && dstFormat != AV_PIX_FMT_YUV420P)) { + enum AVPixelFormat tmpFormat = AV_PIX_FMT_RGB24; + + ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride, + srcW, srcH, tmpFormat, 64); + if (ret < 0) + return ret; + + c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat, + srcW, srcH, tmpFormat, + flags, srcFilter, NULL, c->param); + if (!c->cascaded_context[0]) + return -1; + + c->cascaded_context[1] = sws_getContext(srcW, srcH, tmpFormat, + dstW, dstH, dstFormat, + flags, NULL, dstFilter, c->param); + if (!c->cascaded_context[1]) + return -1; + return 0; + } + } + #define USE_MMAP (HAVE_MMAP && HAVE_MPROTECT && defined MAP_ANONYMOUS) /* precalculate horizontal scaler filter coefficients */ |