diff mbox series

[FFmpeg-devel,1/2] swscale/utils: split range override check into its own function

Message ID 20201010002029.6837-1-jeebjp@gmail.com
State Accepted
Commit 3fe24fe23219d28edc12c5b78a19a075d948f997
Headers show
Series [FFmpeg-devel,1/2] swscale/utils: split range override check into its own function
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Jan Ekström Oct. 10, 2020, 12:20 a.m. UTC
---
 libswscale/utils.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Oct. 10, 2020, 9:28 p.m. UTC | #1
On Sat, Oct 10, 2020 at 03:20:28AM +0300, Jan Ekström wrote:
> ---
>  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)

patch 1+2 probably ok

thx

[...]
Jan Ekström Oct. 11, 2020, 10 a.m. UTC | #2
On Sun, Oct 11, 2020 at 12:28 AM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> On Sat, Oct 10, 2020 at 03:20:28AM +0300, Jan Ekström wrote:
> > ---
> >  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)
>
> patch 1+2 probably ok
>
> thx
>

Thanks, applied as 3fe24fe23219d28edc12c5b78a19a075d948f997 and
7ea4bcff7b038774b404bad2b9c7112a7855a088.

Jan
diff mbox series

Patch

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 ||