Skip to content

Commit

Permalink
swscale/utils: support bayer input + scaling, and bayer input + any s…
Browse files Browse the repository at this point in the history
…upported output

Fixes Ticket4053

Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Nov 12, 2014
1 parent 173d51c commit 2f6bb86
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions libswscale/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,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 */
Expand Down

0 comments on commit 2f6bb86

Please sign in to comment.