[FFmpeg-cvslog] sws: rgb has no range, avoid random results if the user tries to mess with it anyway.

Michael Niedermayer git at videolan.org
Sun Oct 28 02:56:12 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Oct 28 02:46:56 2012 +0200| [8edf9b1fa44dbcc807e9298ce97791a12df85956] | committer: Michael Niedermayer

sws: rgb has no range, avoid random results if the user tries to mess with it anyway.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8edf9b1fa44dbcc807e9298ce97791a12df85956
---

 libswscale/utils.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index e300cae..21fd718 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;
 



More information about the ffmpeg-cvslog mailing list