Re: [FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-08 Thread wm4
On Fri, 8 May 2015 10:30:34 + (UTC)
Carl Eugen Hoyos ceho...@ag.or.at wrote:

 wm4 nfxjfg at googlemail.com writes:
 
 I believe this is slightly misleading: gray8 and 
 gray16 are interpreted as full-range by default 
 since years.

Really? Where?
   
   In the software scaler.
  
  Doesn't matter much from the API user point of view. 
  Not everyone uses libswscale.
 
 As said, I had no objections against your patch (on 
 the contrary) but I wonder why you want to set a field 
 that is mostly useful when using libswscale if you 
 don't use libswscale.

Uh, what?

Do you think libswscale is the only thing that processes video?

  There is the (unwritten?) convention that YUV is 
  limited range, and RGB is full range. GRAY is 
  somewhat both, but at least the pixdesc tables
  do not mark it as RGB.
 
 I don't think the issue is related to (current) 
 pixdesc but I may miss something.
 
  What is your opinion about this?
 
 I committed part of the change making gray full range...
 
 Whoever wants to use frame-data[0] should use it;-)

What do you even mean?

So what is the API user supposed to do? Special-case by codec? Just
what is it?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-08 Thread Carl Eugen Hoyos
wm4 nfxjfg at googlemail.com writes:

I believe this is slightly misleading: gray8 and 
gray16 are interpreted as full-range by default 
since years.
   
   Really? Where?
  
  In the software scaler.
 
 Doesn't matter much from the API user point of view. 
 Not everyone uses libswscale.

As said, I had no objections against your patch (on 
the contrary) but I wonder why you want to set a field 
that is mostly useful when using libswscale if you 
don't use libswscale.

 There is the (unwritten?) convention that YUV is 
 limited range, and RGB is full range. GRAY is 
 somewhat both, but at least the pixdesc tables
 do not mark it as RGB.

I don't think the issue is related to (current) 
pixdesc but I may miss something.

 What is your opinion about this?

I committed part of the change making gray full range...

Whoever wants to use frame-data[0] should use it;-)

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-08 Thread wm4
On Fri, 8 May 2015 11:29:18 + (UTC)
Carl Eugen Hoyos ceho...@ag.or.at wrote:

 wm4 nfxjfg at googlemail.com writes:
 
   As said, I had no objections against your patch (on 
   the contrary) but I wonder why you want to set a field 
   that is mostly useful when using libswscale if you 
   don't use libswscale.
  
  Uh, what?
  
  Do you think libswscale is the only thing that 
  processes video?
 
 No, but it seemed to me that this is what your commit 
 message implied.
 
What is your opinion about this?
   
   I committed part of the change making gray full range...
   
   Whoever wants to use frame-data[0] should use it
  
  What do you even mean?
 
 I thought your question was Do you agree that gray 
 should be full-range? Some people need the yuv - 

In what context? Yes, png outputs full range gray, but that doesn't
mean other codecs outputting gray do this.

 gray conversion not to change the values, and I 
 always wonder why they call libswscale in the 
 beginning, instead of simply using the Y plane.

What does this have to do with anything? This sounds like a libswscale
or ffmpeg.c problem at best.

  So what is the API user supposed to do? Special-case 
  by codec? Just what is it?
 
 How is this codec-related / when is gray not full-scale 
 (and FFmpeg can know it)?

I just want to know how to get non-broken data from lavc?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-08 Thread Carl Eugen Hoyos
wm4 nfxjfg at googlemail.com writes:

  I thought your question was Do you agree that gray 
  should be full-range?
 
 In what context?

In all contexts that we can distinguish?

 Yes, png outputs full range gray, but that doesn't
 mean other codecs outputting gray do this.

Which codec?

Note that I am also interested in this, and 
so far I wasn't able to find an exception 
except that users have their own requirements 
that aren't codec-related.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-08 Thread Carl Eugen Hoyos
wm4 nfxjfg at googlemail.com writes:

  As said, I had no objections against your patch (on 
  the contrary) but I wonder why you want to set a field 
  that is mostly useful when using libswscale if you 
  don't use libswscale.
 
 Uh, what?
 
 Do you think libswscale is the only thing that 
 processes video?

No, but it seemed to me that this is what your commit 
message implied.

   What is your opinion about this?
  
  I committed part of the change making gray full range...
  
  Whoever wants to use frame-data[0] should use it
 
 What do you even mean?

I thought your question was Do you agree that gray 
should be full-range? Some people need the yuv - 
gray conversion not to change the values, and I 
always wonder why they call libswscale in the 
beginning, instead of simply using the Y plane.

 So what is the API user supposed to do? Special-case 
 by codec? Just what is it?

How is this codec-related / when is gray not full-scale 
(and FFmpeg can know it)?

Carl Eugen

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


[FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-07 Thread wm4
AV_PIX_FMT_GRAY8/16 are considered YUV formats, and the color_range is
not set - so the API user will have to assume limitted range. (Unless
the API user adds a special-case for the PNG decoder.)

Just export the correct range - full range.
---
 libavcodec/pngdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 1f8a77b..72d75fb 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -633,6 +633,8 @@ static int decode_idat_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 return AVERROR_INVALIDDATA;
 }
 
+avctx-color_range = AVCOL_RANGE_JPEG;
+
 if ((ret = ff_thread_get_buffer(avctx, s-picture, 
AV_GET_BUFFER_FLAG_REF))  0)
 return ret;
 ff_thread_finish_setup(avctx);
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-07 Thread Carl Eugen Hoyos
wm4 nfxjfg at googlemail.com writes:

 AV_PIX_FMT_GRAY8/16 are considered YUV formats, 
 and the color_range is not set - so the API user 
 will have to assume limitted range. (Unless the 
 API user adds a special-case for the PNG decoder.)

I believe this is slightly misleading: gray8 and 
gray16 are interpreted as full-range by default 
since years.

This should of course not affect your patch.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-07 Thread wm4
On Thu, 7 May 2015 22:00:32 + (UTC)
Carl Eugen Hoyos ceho...@ag.or.at wrote:

 wm4 nfxjfg at googlemail.com writes:
 
   I believe this is slightly misleading: gray8 and 
   gray16 are interpreted as full-range by default 
   since years.
  
  Really? Where?
 
 In the software scaler.

Doesn't matter much from the API user point of view. Not everyone uses
libswscale.

There is the (unwritten?) convention that YUV is limited range, and RGB
is full range. GRAY is somewhat both, but at least the pixdesc tables
do not mark it as RGB.

What is your opinion about this?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-07 Thread Michael Niedermayer
On Thu, May 07, 2015 at 11:37:18PM +0200, wm4 wrote:
 AV_PIX_FMT_GRAY8/16 are considered YUV formats, and the color_range is
 not set - so the API user will have to assume limitted range. (Unless
 the API user adds a special-case for the PNG decoder.)
 
 Just export the correct range - full range.
 ---
  libavcodec/pngdec.c | 2 ++
  1 file changed, 2 insertions(+)

applied

thanks

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

What does censorship reveal? It reveals fear. -- Julian Assange


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


Re: [FFmpeg-devel] [PATCH] pngdec: set correct range

2015-05-07 Thread Carl Eugen Hoyos
wm4 nfxjfg at googlemail.com writes:

  I believe this is slightly misleading: gray8 and 
  gray16 are interpreted as full-range by default 
  since years.
 
 Really? Where?

In the software scaler.

Carl Eugen

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