Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-04-03 Thread Michael Niedermayer
On Tue, Apr 03, 2018 at 01:30:32AM +0200, Michael Niedermayer wrote:
> On Mon, Apr 02, 2018 at 11:52:42AM +0200, Vittorio Giovara wrote:
> > On 3/20/18, Michael Niedermayer  > > wrote:
> > >* Signed-off-by: Michael Niedermayer  > >>
> > *>* ---
> > *>*  libavfilter/vf_scale.c | 7 ++-
> > *>*  1 file changed, 6 insertions(+), 1 deletion(-)
> > *>>* diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > *>* index 9f45032e85..2f6fa4791d 100644
> > *>* --- a/libavfilter/vf_scale.c
> > *>* +++ b/libavfilter/vf_scale.c
> > *>* @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame 
> > *in)
> > *>*  AVFilterLink *outlink = link->dst->outputs[0];
> > *>*  AVFrame *out;
> > *>*  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
> > *>* +const AVPixFmtDescriptor *out_desc =
> > *>* av_pix_fmt_desc_get(outlink->format);
> > *>*  char buf[32];
> > *>*  int in_range;
> > *>>* @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link, 
> > AVFrame
> > *>* *in)
> > *>*   table, out_full,
> > *>*   brightness, contrast, saturation);
> > *>>* -out->color_range = out_full ? AVCOL_RANGE_JPEG : 
> > AVCOL_RANGE_MPEG;
> > *>* +// color_range describes YUV, it is undefined for RGB
> > *>* +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
> > *>* out_desc->nb_components != 1) {
> > *>* +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> > *>* +} else
> > *>* +out->color_range = out_full ? AVCOL_RANGE_JPEG :
> > *>* AVCOL_RANGE_MPEG;
> > *>*  }
> > *>>*  av_reduce(>sample_aspect_ratio.num,
> > >sample_aspect_ratio.den,
> > *>* --
> > *>* 2.16.2
> > *
> > 
> > shouldn't color_range be always set to FULL when outputting RGB? This would
> > simplify conversions towards YUV (which assumes UNSPEC == LIMITED) and
> > something that other libraries already assume (ie zimg).
> 
> ill need to test but if FULL simplifies things, it could be used instead
> yes

will post a patch that does this

thx


[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-04-02 Thread Michael Niedermayer
On Mon, Apr 02, 2018 at 11:52:42AM +0200, Vittorio Giovara wrote:
> On 3/20/18, Michael Niedermayer  > wrote:
> >* Signed-off-by: Michael Niedermayer  >>
> *>* ---
> *>*  libavfilter/vf_scale.c | 7 ++-
> *>*  1 file changed, 6 insertions(+), 1 deletion(-)
> *>>* diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> *>* index 9f45032e85..2f6fa4791d 100644
> *>* --- a/libavfilter/vf_scale.c
> *>* +++ b/libavfilter/vf_scale.c
> *>* @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame 
> *in)
> *>*  AVFilterLink *outlink = link->dst->outputs[0];
> *>*  AVFrame *out;
> *>*  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
> *>* +const AVPixFmtDescriptor *out_desc =
> *>* av_pix_fmt_desc_get(outlink->format);
> *>*  char buf[32];
> *>*  int in_range;
> *>>* @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link, AVFrame
> *>* *in)
> *>*   table, out_full,
> *>*   brightness, contrast, saturation);
> *>>* -out->color_range = out_full ? AVCOL_RANGE_JPEG : 
> AVCOL_RANGE_MPEG;
> *>* +// color_range describes YUV, it is undefined for RGB
> *>* +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
> *>* out_desc->nb_components != 1) {
> *>* +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> *>* +} else
> *>* +out->color_range = out_full ? AVCOL_RANGE_JPEG :
> *>* AVCOL_RANGE_MPEG;
> *>*  }
> *>>*  av_reduce(>sample_aspect_ratio.num,
> >sample_aspect_ratio.den,
> *>* --
> *>* 2.16.2
> *
> 
> shouldn't color_range be always set to FULL when outputting RGB? This would
> simplify conversions towards YUV (which assumes UNSPEC == LIMITED) and
> something that other libraries already assume (ie zimg).

ill need to test but if FULL simplifies things, it could be used instead
yes

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-04-02 Thread Vittorio Giovara
On 3/20/18, Michael Niedermayer http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>> wrote:
>* Signed-off-by: Michael Niedermayer >
*>* ---
*>*  libavfilter/vf_scale.c | 7 ++-
*>*  1 file changed, 6 insertions(+), 1 deletion(-)
*>>* diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
*>* index 9f45032e85..2f6fa4791d 100644
*>* --- a/libavfilter/vf_scale.c
*>* +++ b/libavfilter/vf_scale.c
*>* @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
*>*  AVFilterLink *outlink = link->dst->outputs[0];
*>*  AVFrame *out;
*>*  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
*>* +const AVPixFmtDescriptor *out_desc =
*>* av_pix_fmt_desc_get(outlink->format);
*>*  char buf[32];
*>*  int in_range;
*>>* @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link, AVFrame
*>* *in)
*>*   table, out_full,
*>*   brightness, contrast, saturation);
*>>* -out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
*>* +// color_range describes YUV, it is undefined for RGB
*>* +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
*>* out_desc->nb_components != 1) {
*>* +out->color_range = AVCOL_RANGE_UNSPECIFIED;
*>* +} else
*>* +out->color_range = out_full ? AVCOL_RANGE_JPEG :
*>* AVCOL_RANGE_MPEG;
*>*  }
*>>*  av_reduce(>sample_aspect_ratio.num,
>sample_aspect_ratio.den,
*>* --
*>* 2.16.2
*

shouldn't color_range be always set to FULL when outputting RGB? This would
simplify conversions towards YUV (which assumes UNSPEC == LIMITED) and
something that other libraries already assume (ie zimg).
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-27 Thread wm4
On Tue, 27 Mar 2018 12:14:55 +0200
Michael Niedermayer  wrote:

> On Mon, Mar 26, 2018 at 10:56:47PM +0100, Mark Thompson wrote:
> > On 26/03/18 22:44, Michael Niedermayer wrote:  
> > > On Mon, Mar 26, 2018 at 08:34:06AM +0200, Paul B Mahol wrote:  
> > >> On 3/26/18, Michael Niedermayer  wrote:  
> > >>> On Wed, Mar 21, 2018 at 09:18:21AM +0100, Paul B Mahol wrote:  
> >  On 3/20/18, Michael Niedermayer  wrote:  
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavfilter/vf_scale.c | 7 ++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > > index 9f45032e85..2f6fa4791d 100644
> > > --- a/libavfilter/vf_scale.c
> > > +++ b/libavfilter/vf_scale.c
> > > @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, 
> > > AVFrame
> > > *in)
> > >  AVFilterLink *outlink = link->dst->outputs[0];
> > >  AVFrame *out;
> > >  const AVPixFmtDescriptor *desc =
> > > av_pix_fmt_desc_get(link->format);
> > > +const AVPixFmtDescriptor *out_desc =
> > > av_pix_fmt_desc_get(outlink->format);
> > >  char buf[32];
> > >  int in_range;
> > >
> > > @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link,
> > > AVFrame
> > > *in)
> > >   table, out_full,
> > >   brightness, contrast,
> > > saturation);
> > >
> > > -out->color_range = out_full ? AVCOL_RANGE_JPEG :
> > > AVCOL_RANGE_MPEG;
> > > +// color_range describes YUV, it is undefined for RGB
> > > +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
> > > out_desc->nb_components != 1) {
> > > +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> > > +} else
> > > +out->color_range = out_full ? AVCOL_RANGE_JPEG :
> > > AVCOL_RANGE_MPEG;
> > >  }
> > >
> > >  av_reduce(>sample_aspect_ratio.num,
> > > >sample_aspect_ratio.den,
> > > --
> > > 2.16.2
> > >  
> > 
> >  This is not optimal, as full color_range should remain full when not
> >  changed.  
> > >>>
> > >>> there is no range for rgb formats. The range is specific to YUV based
> > >>> formats.
> > >>> Thats, if iam guessing correctly what you meant. You did not really say
> > >>> which case you meant here. So maybe there is an issue and i 
> > >>> misunderstand
> > >>> what you refer to  
> > >>
> > >> Maybe not for swscale here but does exist otherwise.  
> > > 
> > > It has no meaning for RGB. There is no limited range RGB
> > > also, the API defines it only for YUV. So if it had meaning for RGB its 
> > > not defined
> > > what meaning that would be. The ranges for luma and chroma differ so its 
> > > not
> > > natural or obvious how to extend it to RGB.
> > > Iam also not aware of any specification that defines limited range RGB  
> > See HDMI, HD-SDI, CEA-861, pretty much anything related to sending RGB over 
> > wires in a non-PC context.
> > 
> > (No comment on whether it is useful to include it, but dismissing limited 
> > range RGB as not a thing is probably not a good idea.  I would kindof 
> > expect things like DeckLink to be using limited-range RGB everywhere, but 
> > I'm not familiar with the details there.)  
> 
> Is this used just over wires or also in software ?

Yes, it can happen that you "need" to output limited RGB for consumer
burning trash fire hardware.

> aka should we update our enum to also cover this and 
> If yes then we also probably should add support for this
> to swscale


I tried to use it once and considered it a libswscale bug and reported
it, but was overruled or something.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-27 Thread Michael Niedermayer
On Mon, Mar 26, 2018 at 10:56:47PM +0100, Mark Thompson wrote:
> On 26/03/18 22:44, Michael Niedermayer wrote:
> > On Mon, Mar 26, 2018 at 08:34:06AM +0200, Paul B Mahol wrote:
> >> On 3/26/18, Michael Niedermayer  wrote:
> >>> On Wed, Mar 21, 2018 at 09:18:21AM +0100, Paul B Mahol wrote:
>  On 3/20/18, Michael Niedermayer  wrote:
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavfilter/vf_scale.c | 7 ++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > index 9f45032e85..2f6fa4791d 100644
> > --- a/libavfilter/vf_scale.c
> > +++ b/libavfilter/vf_scale.c
> > @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame
> > *in)
> >  AVFilterLink *outlink = link->dst->outputs[0];
> >  AVFrame *out;
> >  const AVPixFmtDescriptor *desc =
> > av_pix_fmt_desc_get(link->format);
> > +const AVPixFmtDescriptor *out_desc =
> > av_pix_fmt_desc_get(outlink->format);
> >  char buf[32];
> >  int in_range;
> >
> > @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link,
> > AVFrame
> > *in)
> >   table, out_full,
> >   brightness, contrast,
> > saturation);
> >
> > -out->color_range = out_full ? AVCOL_RANGE_JPEG :
> > AVCOL_RANGE_MPEG;
> > +// color_range describes YUV, it is undefined for RGB
> > +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
> > out_desc->nb_components != 1) {
> > +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> > +} else
> > +out->color_range = out_full ? AVCOL_RANGE_JPEG :
> > AVCOL_RANGE_MPEG;
> >  }
> >
> >  av_reduce(>sample_aspect_ratio.num,
> > >sample_aspect_ratio.den,
> > --
> > 2.16.2
> >
> 
>  This is not optimal, as full color_range should remain full when not
>  changed.
> >>>
> >>> there is no range for rgb formats. The range is specific to YUV based
> >>> formats.
> >>> Thats, if iam guessing correctly what you meant. You did not really say
> >>> which case you meant here. So maybe there is an issue and i misunderstand
> >>> what you refer to
> >>
> >> Maybe not for swscale here but does exist otherwise.
> > 
> > It has no meaning for RGB. There is no limited range RGB
> > also, the API defines it only for YUV. So if it had meaning for RGB its not 
> > defined
> > what meaning that would be. The ranges for luma and chroma differ so its not
> > natural or obvious how to extend it to RGB.
> > Iam also not aware of any specification that defines limited range RGB
> See HDMI, HD-SDI, CEA-861, pretty much anything related to sending RGB over 
> wires in a non-PC context.
> 
> (No comment on whether it is useful to include it, but dismissing limited 
> range RGB as not a thing is probably not a good idea.  I would kindof expect 
> things like DeckLink to be using limited-range RGB everywhere, but I'm not 
> familiar with the details there.)

Is this used just over wires or also in software ?
aka should we update our enum to also cover this and 
If yes then we also probably should add support for this
to swscale

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-26 Thread Michael Niedermayer
On Mon, Mar 26, 2018 at 10:56:47PM +0100, Mark Thompson wrote:
> On 26/03/18 22:44, Michael Niedermayer wrote:
> > On Mon, Mar 26, 2018 at 08:34:06AM +0200, Paul B Mahol wrote:
> >> On 3/26/18, Michael Niedermayer  wrote:
> >>> On Wed, Mar 21, 2018 at 09:18:21AM +0100, Paul B Mahol wrote:
>  On 3/20/18, Michael Niedermayer  wrote:
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavfilter/vf_scale.c | 7 ++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > index 9f45032e85..2f6fa4791d 100644
> > --- a/libavfilter/vf_scale.c
> > +++ b/libavfilter/vf_scale.c
> > @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame
> > *in)
> >  AVFilterLink *outlink = link->dst->outputs[0];
> >  AVFrame *out;
> >  const AVPixFmtDescriptor *desc =
> > av_pix_fmt_desc_get(link->format);
> > +const AVPixFmtDescriptor *out_desc =
> > av_pix_fmt_desc_get(outlink->format);
> >  char buf[32];
> >  int in_range;
> >
> > @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link,
> > AVFrame
> > *in)
> >   table, out_full,
> >   brightness, contrast,
> > saturation);
> >
> > -out->color_range = out_full ? AVCOL_RANGE_JPEG :
> > AVCOL_RANGE_MPEG;
> > +// color_range describes YUV, it is undefined for RGB
> > +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
> > out_desc->nb_components != 1) {
> > +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> > +} else
> > +out->color_range = out_full ? AVCOL_RANGE_JPEG :
> > AVCOL_RANGE_MPEG;
> >  }
> >
> >  av_reduce(>sample_aspect_ratio.num,
> > >sample_aspect_ratio.den,
> > --
> > 2.16.2
> >
> 
>  This is not optimal, as full color_range should remain full when not
>  changed.
> >>>
> >>> there is no range for rgb formats. The range is specific to YUV based
> >>> formats.
> >>> Thats, if iam guessing correctly what you meant. You did not really say
> >>> which case you meant here. So maybe there is an issue and i misunderstand
> >>> what you refer to
> >>
> >> Maybe not for swscale here but does exist otherwise.
> > 
> > It has no meaning for RGB. There is no limited range RGB
> > also, the API defines it only for YUV. So if it had meaning for RGB its not 
> > defined
> > what meaning that would be. The ranges for luma and chroma differ so its not
> > natural or obvious how to extend it to RGB.
> > Iam also not aware of any specification that defines limited range RGB
> See HDMI, HD-SDI, CEA-861, pretty much anything related to sending RGB over 
> wires in a non-PC context.
> 
> (No comment on whether it is useful to include it, but dismissing limited 
> range RGB as not a thing is probably not a good idea.  I would kindof expect 
> things like DeckLink to be using limited-range RGB everywhere, but I'm not 
> familiar with the details there.)

interresting, i was unaware of this
are these specs publically available ? i could find CEA-861 but not the others
quickly

thx


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-26 Thread Mark Thompson
On 26/03/18 22:44, Michael Niedermayer wrote:
> On Mon, Mar 26, 2018 at 08:34:06AM +0200, Paul B Mahol wrote:
>> On 3/26/18, Michael Niedermayer  wrote:
>>> On Wed, Mar 21, 2018 at 09:18:21AM +0100, Paul B Mahol wrote:
 On 3/20/18, Michael Niedermayer  wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavfilter/vf_scale.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index 9f45032e85..2f6fa4791d 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame
> *in)
>  AVFilterLink *outlink = link->dst->outputs[0];
>  AVFrame *out;
>  const AVPixFmtDescriptor *desc =
> av_pix_fmt_desc_get(link->format);
> +const AVPixFmtDescriptor *out_desc =
> av_pix_fmt_desc_get(outlink->format);
>  char buf[32];
>  int in_range;
>
> @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link,
> AVFrame
> *in)
>   table, out_full,
>   brightness, contrast,
> saturation);
>
> -out->color_range = out_full ? AVCOL_RANGE_JPEG :
> AVCOL_RANGE_MPEG;
> +// color_range describes YUV, it is undefined for RGB
> +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
> out_desc->nb_components != 1) {
> +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> +} else
> +out->color_range = out_full ? AVCOL_RANGE_JPEG :
> AVCOL_RANGE_MPEG;
>  }
>
>  av_reduce(>sample_aspect_ratio.num,
> >sample_aspect_ratio.den,
> --
> 2.16.2
>

 This is not optimal, as full color_range should remain full when not
 changed.
>>>
>>> there is no range for rgb formats. The range is specific to YUV based
>>> formats.
>>> Thats, if iam guessing correctly what you meant. You did not really say
>>> which case you meant here. So maybe there is an issue and i misunderstand
>>> what you refer to
>>
>> Maybe not for swscale here but does exist otherwise.
> 
> It has no meaning for RGB. There is no limited range RGB
> also, the API defines it only for YUV. So if it had meaning for RGB its not 
> defined
> what meaning that would be. The ranges for luma and chroma differ so its not
> natural or obvious how to extend it to RGB.
> Iam also not aware of any specification that defines limited range RGB
See HDMI, HD-SDI, CEA-861, pretty much anything related to sending RGB over 
wires in a non-PC context.

(No comment on whether it is useful to include it, but dismissing limited range 
RGB as not a thing is probably not a good idea.  I would kindof expect things 
like DeckLink to be using limited-range RGB everywhere, but I'm not familiar 
with the details there.)

- Mark
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-26 Thread Michael Niedermayer
On Mon, Mar 26, 2018 at 12:50:41PM +0200, Paul B Mahol wrote:
> On 3/26/18, Martin Vignali  wrote:
> >> >> This is not optimal, as full color_range should remain full when not
> >> >> changed.
> >> >
> >> > there is no range for rgb formats. The range is specific to YUV based
> >> > formats.
> >> > Thats, if iam guessing correctly what you meant. You did not really say
> >> > which case you meant here. So maybe there is an issue and i
> >> > misunderstand
> >> > what you refer to
> >>
> >> Maybe not for swscale here but does exist otherwise.
> >>
> >> What software use limited for rgb ?
> >
> > I understand for gray (it can be gray of yuv data (limited or full) or gray
> > for RGB data)),
> > but for RGB/RGBA, never see limited (and doesn't see the interest :-)
> >
> > Martin
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 

> OK then, just apply patch.

ok, will apply

thanks!

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-26 Thread Michael Niedermayer
On Mon, Mar 26, 2018 at 08:34:06AM +0200, Paul B Mahol wrote:
> On 3/26/18, Michael Niedermayer  wrote:
> > On Wed, Mar 21, 2018 at 09:18:21AM +0100, Paul B Mahol wrote:
> >> On 3/20/18, Michael Niedermayer  wrote:
> >> > Signed-off-by: Michael Niedermayer 
> >> > ---
> >> >  libavfilter/vf_scale.c | 7 ++-
> >> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> >> > index 9f45032e85..2f6fa4791d 100644
> >> > --- a/libavfilter/vf_scale.c
> >> > +++ b/libavfilter/vf_scale.c
> >> > @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame
> >> > *in)
> >> >  AVFilterLink *outlink = link->dst->outputs[0];
> >> >  AVFrame *out;
> >> >  const AVPixFmtDescriptor *desc =
> >> > av_pix_fmt_desc_get(link->format);
> >> > +const AVPixFmtDescriptor *out_desc =
> >> > av_pix_fmt_desc_get(outlink->format);
> >> >  char buf[32];
> >> >  int in_range;
> >> >
> >> > @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link,
> >> > AVFrame
> >> > *in)
> >> >   table, out_full,
> >> >   brightness, contrast,
> >> > saturation);
> >> >
> >> > -out->color_range = out_full ? AVCOL_RANGE_JPEG :
> >> > AVCOL_RANGE_MPEG;
> >> > +// color_range describes YUV, it is undefined for RGB
> >> > +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
> >> > out_desc->nb_components != 1) {
> >> > +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> >> > +} else
> >> > +out->color_range = out_full ? AVCOL_RANGE_JPEG :
> >> > AVCOL_RANGE_MPEG;
> >> >  }
> >> >
> >> >  av_reduce(>sample_aspect_ratio.num,
> >> > >sample_aspect_ratio.den,
> >> > --
> >> > 2.16.2
> >> >
> >> > ___
> >> > ffmpeg-devel mailing list
> >> > ffmpeg-devel@ffmpeg.org
> >> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >> >
> >>
> >> This is not optimal, as full color_range should remain full when not
> >> changed.
> >
> > there is no range for rgb formats. The range is specific to YUV based
> > formats.
> > Thats, if iam guessing correctly what you meant. You did not really say
> > which case you meant here. So maybe there is an issue and i misunderstand
> > what you refer to
> 
> Maybe not for swscale here but does exist otherwise.

It has no meaning for RGB. There is no limited range RGB
also, the API defines it only for YUV. So if it had meaning for RGB its not 
defined
what meaning that would be. The ranges for luma and chroma differ so its not
natural or obvious how to extend it to RGB.
Iam also not aware of any specification that defines limited range RGB

also please be a little more verbose about what you speak of. That should
speed up resolving this

/**
 * MPEG vs JPEG YUV range.
 */
enum AVColorRange {
AVCOL_RANGE_UNSPECIFIED = 0,
AVCOL_RANGE_MPEG= 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
AVCOL_RANGE_JPEG= 2, ///< the normal 2^n-1   "JPEG" YUV ranges
AVCOL_RANGE_NB   ///< Not part of ABI


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-26 Thread Paul B Mahol
On 3/26/18, Martin Vignali  wrote:
>> >> This is not optimal, as full color_range should remain full when not
>> >> changed.
>> >
>> > there is no range for rgb formats. The range is specific to YUV based
>> > formats.
>> > Thats, if iam guessing correctly what you meant. You did not really say
>> > which case you meant here. So maybe there is an issue and i
>> > misunderstand
>> > what you refer to
>>
>> Maybe not for swscale here but does exist otherwise.
>>
>> What software use limited for rgb ?
>
> I understand for gray (it can be gray of yuv data (limited or full) or gray
> for RGB data)),
> but for RGB/RGBA, never see limited (and doesn't see the interest :-)
>
> Martin
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

OK then, just apply patch.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-26 Thread Martin Vignali
> >> This is not optimal, as full color_range should remain full when not
> >> changed.
> >
> > there is no range for rgb formats. The range is specific to YUV based
> > formats.
> > Thats, if iam guessing correctly what you meant. You did not really say
> > which case you meant here. So maybe there is an issue and i misunderstand
> > what you refer to
>
> Maybe not for swscale here but does exist otherwise.
>
> What software use limited for rgb ?

I understand for gray (it can be gray of yuv data (limited or full) or gray
for RGB data)),
but for RGB/RGBA, never see limited (and doesn't see the interest :-)

Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-26 Thread Paul B Mahol
On 3/26/18, Michael Niedermayer  wrote:
> On Wed, Mar 21, 2018 at 09:18:21AM +0100, Paul B Mahol wrote:
>> On 3/20/18, Michael Niedermayer  wrote:
>> > Signed-off-by: Michael Niedermayer 
>> > ---
>> >  libavfilter/vf_scale.c | 7 ++-
>> >  1 file changed, 6 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
>> > index 9f45032e85..2f6fa4791d 100644
>> > --- a/libavfilter/vf_scale.c
>> > +++ b/libavfilter/vf_scale.c
>> > @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame
>> > *in)
>> >  AVFilterLink *outlink = link->dst->outputs[0];
>> >  AVFrame *out;
>> >  const AVPixFmtDescriptor *desc =
>> > av_pix_fmt_desc_get(link->format);
>> > +const AVPixFmtDescriptor *out_desc =
>> > av_pix_fmt_desc_get(outlink->format);
>> >  char buf[32];
>> >  int in_range;
>> >
>> > @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link,
>> > AVFrame
>> > *in)
>> >   table, out_full,
>> >   brightness, contrast,
>> > saturation);
>> >
>> > -out->color_range = out_full ? AVCOL_RANGE_JPEG :
>> > AVCOL_RANGE_MPEG;
>> > +// color_range describes YUV, it is undefined for RGB
>> > +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
>> > out_desc->nb_components != 1) {
>> > +out->color_range = AVCOL_RANGE_UNSPECIFIED;
>> > +} else
>> > +out->color_range = out_full ? AVCOL_RANGE_JPEG :
>> > AVCOL_RANGE_MPEG;
>> >  }
>> >
>> >  av_reduce(>sample_aspect_ratio.num,
>> > >sample_aspect_ratio.den,
>> > --
>> > 2.16.2
>> >
>> > ___
>> > ffmpeg-devel mailing list
>> > ffmpeg-devel@ffmpeg.org
>> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> >
>>
>> This is not optimal, as full color_range should remain full when not
>> changed.
>
> there is no range for rgb formats. The range is specific to YUV based
> formats.
> Thats, if iam guessing correctly what you meant. You did not really say
> which case you meant here. So maybe there is an issue and i misunderstand
> what you refer to

Maybe not for swscale here but does exist otherwise.

>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Many things microsoft did are stupid, but not doing something just because
> microsoft did it is even more stupid. If everything ms did were stupid they
> would be bankrupt already.
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-25 Thread Michael Niedermayer
On Wed, Mar 21, 2018 at 09:18:21AM +0100, Paul B Mahol wrote:
> On 3/20/18, Michael Niedermayer  wrote:
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavfilter/vf_scale.c | 7 ++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > index 9f45032e85..2f6fa4791d 100644
> > --- a/libavfilter/vf_scale.c
> > +++ b/libavfilter/vf_scale.c
> > @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
> >  AVFilterLink *outlink = link->dst->outputs[0];
> >  AVFrame *out;
> >  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
> > +const AVPixFmtDescriptor *out_desc =
> > av_pix_fmt_desc_get(outlink->format);
> >  char buf[32];
> >  int in_range;
> >
> > @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link, AVFrame
> > *in)
> >   table, out_full,
> >   brightness, contrast, saturation);
> >
> > -out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
> > +// color_range describes YUV, it is undefined for RGB
> > +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
> > out_desc->nb_components != 1) {
> > +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> > +} else
> > +out->color_range = out_full ? AVCOL_RANGE_JPEG :
> > AVCOL_RANGE_MPEG;
> >  }
> >
> >  av_reduce(>sample_aspect_ratio.num, >sample_aspect_ratio.den,
> > --
> > 2.16.2
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> This is not optimal, as full color_range should remain full when not changed.

there is no range for rgb formats. The range is specific to YUV based
formats. 
Thats, if iam guessing correctly what you meant. You did not really say
which case you meant here. So maybe there is an issue and i misunderstand
what you refer to

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-25 Thread Michael Niedermayer
On Wed, Mar 21, 2018 at 03:04:35PM +0100, wm4 wrote:
> On Tue, 20 Mar 2018 23:59:46 +0100
> Michael Niedermayer  wrote:
> 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavfilter/vf_scale.c | 7 ++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > index 9f45032e85..2f6fa4791d 100644
> > --- a/libavfilter/vf_scale.c
> > +++ b/libavfilter/vf_scale.c
> > @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
> >  AVFilterLink *outlink = link->dst->outputs[0];
> >  AVFrame *out;
> >  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
> > +const AVPixFmtDescriptor *out_desc = 
> > av_pix_fmt_desc_get(outlink->format);
> >  char buf[32];
> >  int in_range;
> >  
> > @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link, AVFrame 
> > *in)
> >   table, out_full,
> >   brightness, contrast, saturation);
> >  
> > -out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
> > +// color_range describes YUV, it is undefined for RGB
> > +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) && 
> > out_desc->nb_components != 1) {
> > +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> > +} else
> > +out->color_range = out_full ? AVCOL_RANGE_JPEG : 
> > AVCOL_RANGE_MPEG;
> >  }
> >  
> >  av_reduce(>sample_aspect_ratio.num, >sample_aspect_ratio.den,
> 
> Why is it not setting full range for gray? PNGs can use this for
> grayscale images, so they would be affected by this too.

I do not understand what you describe here. Please describe the issue
clearer and or provide a testcase.

there is no unique gray pixel format.
gray8 is not a AV_PIX_FMT_FLAG_RGB format, thus its treated the same as
before this patch



[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-21 Thread wm4
On Tue, 20 Mar 2018 23:59:46 +0100
Michael Niedermayer  wrote:

> Signed-off-by: Michael Niedermayer 
> ---
>  libavfilter/vf_scale.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index 9f45032e85..2f6fa4791d 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
>  AVFilterLink *outlink = link->dst->outputs[0];
>  AVFrame *out;
>  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
> +const AVPixFmtDescriptor *out_desc = 
> av_pix_fmt_desc_get(outlink->format);
>  char buf[32];
>  int in_range;
>  
> @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
>   table, out_full,
>   brightness, contrast, saturation);
>  
> -out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
> +// color_range describes YUV, it is undefined for RGB
> +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) && 
> out_desc->nb_components != 1) {
> +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> +} else
> +out->color_range = out_full ? AVCOL_RANGE_JPEG : 
> AVCOL_RANGE_MPEG;
>  }
>  
>  av_reduce(>sample_aspect_ratio.num, >sample_aspect_ratio.den,

Why is it not setting full range for gray? PNGs can use this for
grayscale images, so they would be affected by this too.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_scale: Do not set YUV color range for RGB formats

2018-03-21 Thread Paul B Mahol
On 3/20/18, Michael Niedermayer  wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavfilter/vf_scale.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index 9f45032e85..2f6fa4791d 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -407,6 +407,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
>  AVFilterLink *outlink = link->dst->outputs[0];
>  AVFrame *out;
>  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
> +const AVPixFmtDescriptor *out_desc =
> av_pix_fmt_desc_get(outlink->format);
>  char buf[32];
>  int in_range;
>
> @@ -497,7 +498,11 @@ static int filter_frame(AVFilterLink *link, AVFrame
> *in)
>   table, out_full,
>   brightness, contrast, saturation);
>
> -out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
> +// color_range describes YUV, it is undefined for RGB
> +if ((out_desc->flags & AV_PIX_FMT_FLAG_RGB) &&
> out_desc->nb_components != 1) {
> +out->color_range = AVCOL_RANGE_UNSPECIFIED;
> +} else
> +out->color_range = out_full ? AVCOL_RANGE_JPEG :
> AVCOL_RANGE_MPEG;
>  }
>
>  av_reduce(>sample_aspect_ratio.num, >sample_aspect_ratio.den,
> --
> 2.16.2
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

This is not optimal, as full color_range should remain full when not changed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel