aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-04-14 23:46:15 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-15 00:40:39 +0200
commit4959a4fcf76e7c595dbb23c4e3bf59abf2e60ea4 (patch)
tree30d213443edf80ef25ad63098f794bedcf7410d5 /libswscale/utils.c
parentfa98885be4e7316891839172f66b402ca4dace2a (diff)
downloadffmpeg-4959a4fcf76e7c595dbb23c4e3bf59abf2e60ea4.tar.gz
swscale/utils: fix changing src/dst range after initializing the context
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r--libswscale/utils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index c8db860d52..28de7b6e81 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -983,6 +983,7 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
{
const AVPixFmtDescriptor *desc_dst;
const AVPixFmtDescriptor *desc_src;
+ int need_reinit = 0;
memmove(c->srcColorspaceTable, inv_table, sizeof(int) * 4);
memmove(c->dstColorspaceTable, table, sizeof(int) * 4);
@@ -998,9 +999,14 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
c->brightness = brightness;
c->contrast = contrast;
c->saturation = saturation;
+ if (c->srcRange != srcRange || c->dstRange != dstRange)
+ need_reinit = 1;
c->srcRange = srcRange;
c->dstRange = dstRange;
+ if (need_reinit && c->srcBpc == 8)
+ ff_sws_init_range_convert(c);
+
if ((isYUV(c->dstFormat) || isGray(c->dstFormat)) && (isYUV(c->srcFormat) || isGray(c->srcFormat)))
return -1;