[FFmpeg-cvslog] swscale/utils: split range override check into its own function

Jan Ekström git at videolan.org
Sun Oct 11 12:59:18 EEST 2020


ffmpeg | branch: master | Jan Ekström <jeebjp at gmail.com> | Sat Oct 10 01:29:18 2020 +0300| [3fe24fe23219d28edc12c5b78a19a075d948f997] | committer: Jan Ekström

swscale/utils: split range override check into its own function

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

 libswscale/utils.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 9ca378bd3b..832c9f873c 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -864,6 +864,11 @@ static void fill_xyztables(struct SwsContext *c)
     }
 }
 
+static int range_override_needed(enum AVPixelFormat format)
+{
+    return !isYUV(format) && !isGray(format);
+}
+
 int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
                              int srcRange, const int table[4], int dstRange,
                              int brightness, int contrast, int saturation)
@@ -876,9 +881,9 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
     desc_dst = av_pix_fmt_desc_get(c->dstFormat);
     desc_src = av_pix_fmt_desc_get(c->srcFormat);
 
-    if(!isYUV(c->dstFormat) && !isGray(c->dstFormat))
+    if(range_override_needed(c->dstFormat))
         dstRange = 0;
-    if(!isYUV(c->srcFormat) && !isGray(c->srcFormat))
+    if(range_override_needed(c->srcFormat))
         srcRange = 0;
 
     if (c->srcRange != srcRange ||



More information about the ffmpeg-cvslog mailing list