aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-04-14 23:32:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-14 23:32:41 +0200
commitfa98885be4e7316891839172f66b402ca4dace2a (patch)
treef4b37bbe08d6f9c8eaccb283410951508f0c4836 /libswscale/utils.c
parenta2f088c0f93c6942fa9756803b99cb7746994d0d (diff)
downloadffmpeg-fa98885be4e7316891839172f66b402ca4dace2a.tar.gz
swscale/utils: move handling of unscaled case to the end of init function
This way all context fields get initialized and can be used without needing to reinit the context Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r--libswscale/utils.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index b3e117f70e..c8db860d52 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1334,20 +1334,6 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail);
- /* unscaled special cases */
- if (unscaled && !usesHFilter && !usesVFilter &&
- (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) {
- ff_get_unscaled_swscale(c);
-
- if (c->swscale) {
- if (flags & SWS_PRINT_INFO)
- av_log(c, AV_LOG_INFO,
- "using unscaled %s -> %s special converter\n",
- av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat));
- return 0;
- }
- }
-
c->srcBpc = 1 + desc_src->comp[0].depth_minus1;
if (c->srcBpc < 8)
c->srcBpc = 8;
@@ -1643,6 +1629,20 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
c->chrXInc, c->chrYInc);
}
+ /* unscaled special cases */
+ if (unscaled && !usesHFilter && !usesVFilter &&
+ (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) {
+ ff_get_unscaled_swscale(c);
+
+ if (c->swscale) {
+ if (flags & SWS_PRINT_INFO)
+ av_log(c, AV_LOG_INFO,
+ "using unscaled %s -> %s special converter\n",
+ av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat));
+ return 0;
+ }
+ }
+
c->swscale = ff_getSwsFunc(c);
return 0;
fail: // FIXME replace things by appropriate error codes