diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-28 04:46:56 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-28 04:46:56 +0400 |
commit | 8edf9b1fa44dbcc807e9298ce97791a12df85956 (patch) | |
tree | 2e02a8067836fd64ba20a8f4087a4064c36b8014 /libswscale/utils.c | |
parent | d23e8f53ad01fde6d0dd96644c2a594f8dd7537e (diff) |
sws: rgb has no range, avoid random results if the user tries to mess with it anyway.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r-- | libswscale/utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index e300cae6f5..21fd718e4c 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -789,11 +789,17 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], memcpy(c->srcColorspaceTable, inv_table, sizeof(int) * 4); memcpy(c->dstColorspaceTable, table, sizeof(int) * 4); + if(!isYUV(c->dstFormat) && !isGray(c->dstFormat)) + dstRange = 0; + if(!isYUV(c->srcFormat) && !isGray(c->srcFormat)) + srcRange = 0; + c->brightness = brightness; c->contrast = contrast; c->saturation = saturation; c->srcRange = srcRange; c->dstRange = dstRange; + if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1; |