Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default

2015-04-14 Thread Wiebe Cazemier
- Original Message -
 From: Wiebe Cazemier wi...@halfgaar.net
 To: Michael Niedermayer michae...@gmx.at
 Cc: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org, 
 madshi mad...@gmail.com
 Sent: Monday, 6 April, 2015 7:25:16 AM
 Subject: Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression 
 (drc_scale) is now 0 by default
 
  
  has someone contacted justin ?
  
  
 
 I did now.
 
 Sorry, I was still kind of spacing out on what to do next...

As of yet no response. Do we take the other decision making route?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default

2015-03-30 Thread Wiebe Cazemier
- Original Message -
 From: Kieran Kunhya kier...@obe.tv
 To: Wiebe Cazemier wi...@halfgaar.net
 Sent: Monday, 30 March, 2015 3:43:42 AM
 Subject: Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression 
 (drc_scale) is now 0 by default
 
  It's in the spec as an *option*, to cater to those who have bad sound
  systems. If ffmpeg already applies DRC, and software using ffmpeg doesn't
  set 'drc_scale', it's no longer an option, it becomes mandatory. That's
  the issue.
 
 It is not an option and I quote ETSI 102 366:
 
 Therefore, the AC-3 decoder shall, by default, implement the
 compression characteristic indicated by the dynrng values in the data
 stream. AC-3 decoders may optionally allow listener control over the
 use of the dynrng values, so that the listener may select full or
 partial dynamic range reproduction.
 
 If an application doesn't want to expose drc settings then that's
 their problem. FFmpeg does the right thing and lets you turn it off if
 you wish.
 
 Kieran
 

(can you reply-all, so that your reply goes to the list?)

If you say it's not an option, that's putting it harder than the spec say. 
Dolby engineers never meant AC3 audio to be played compressed everywhere, and 
that's what we're seeing happening. 

Also, I feel that the word 'decoder' in your quote is written in a time where 
it had a different context and that quote has to be interpreted that way. Open 
source software libraries weren't available at that point, and a decoder was a 
piece of hardware, or a chip embedded in something. Sure, you don't have to 
allow the user to control it when you embed an AC3 decoder in your budget TV so 
ATSC demanding that you do would be silly here, but all high end receivers I 
know, do allow you to set the option. Now that we do have a library that people 
can use, an honest mistake to forget to implement it turns into something that 
they probably didn't intend. As proven by the Kodi developer denying that they 
applied DRC.

I think we have to consider user experience, and it's great when they can 
control it, but we're getting the situation where everybody gets it (yet only 
for AC3), whether they want to or not. That automatically crosses off Kodi and 
VLC (for example) for use in high quality sound reproduction. And the bad thing 
is, they may not even know it...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default

2015-03-30 Thread Wiebe Cazemier
- Original Message -
 From: Kieran Kunhya kier...@obe.tv
 To: Wiebe Cazemier wi...@halfgaar.net
 Sent: Monday, 30 March, 2015 10:47:49 AM
 Subject: Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression 
 (drc_scale) is now 0 by default
 
  It is not an option and I quote ETSI 102 366:
 
  Therefore, the AC-3 decoder shall, by default, implement the
  compression characteristic indicated by the dynrng values in the data
  stream. AC-3 decoders may optionally allow listener control over the
  use of the dynrng values, so that the listener may select full or
  partial dynamic range reproduction.
 
  If an application doesn't want to expose drc settings then that's
  their problem. FFmpeg does the right thing and lets you turn it off if
  you wish.
 
  Kieran
 
 
  (can you reply-all, so that your reply goes to the list?)
 
  If you say it's not an option, that's putting it harder than the spec
  say. Dolby engineers never meant AC3 audio to be played compressed
  everywhere, and that's what we're seeing happening.
 
  Also, I feel that the word 'decoder' in your quote is written in a time
  where it had a different context and that quote has to be interpreted that
  way. Open source software libraries weren't available at that point, and a
  decoder was a piece of hardware, or a chip embedded in something. Sure,
  you don't have to allow the user to control it when you embed an AC3
  decoder in your budget TV so ATSC demanding that you do would be silly
  here, but all high end receivers I know, do allow you to set the option.
  Now that we do have a library that people can use, an honest mistake to
  forget to implement it turns into something that they probably didn't
  intend. As proven by the Kodi developer denying that they applied DRC.
 
  I think we have to consider user experience, and it's great when they can
  control it, but we're getting the situation where everybody gets it (yet
  only for AC3), whether they want to or not. That automatically crosses off
  Kodi and VLC (for example) for use in high quality sound reproduction. And
  the bad thing is, they may not even know it...
 
 It's the complete opposite - most people are watching on laptop
 speakers without the dynamic range you have in your setup. FFmpeg lets
 you turn it off and it's the fault of the player for not exposing
 that.

What about those people playing AAC, which is the majority currently.

In any case, I made my point. How do we proceed? I have no idea who is in 
charge of what, and how the decision making process goes in ffmpeg development.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default

2015-03-29 Thread Wiebe Cazemier
Signed-off-by: Wiebe Cazemier wi...@halfgaar.net
---
 Changelog | 1 +
 doc/decoders.texi | 2 +-
 libavcodec/ac3dec_fixed.c | 2 +-
 libavcodec/ac3dec_float.c | 2 +-
 libavutil/version.h   | 2 +-
 5 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index 109a1b8..0bd9875 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,7 @@ version next:
 - nvenc H265 encoder
 - Detelecine filter
 - Intel QSV-accelerated H.264 encoding
+- Dolby Digital dynamic range compression disabled by default
 
 
 version 2.6:
diff --git a/doc/decoders.texi b/doc/decoders.texi
index 01fca9f..ba78a31 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -72,7 +72,7 @@ from the AC-3 stream. This factor is applied exponentially.
 There are 3 notable scale factor ranges:
 @table @option
 @item drc_scale == 0
-DRC disabled. Produces full range audio.
+DRC disabled. Produces full range audio. Default value.
 @item 0  drc_scale = 1
 DRC enabled.  Applies a fraction of the stream DRC value.
 Audio reproduction is between full range and full compression.
diff --git a/libavcodec/ac3dec_fixed.c b/libavcodec/ac3dec_fixed.c
index b4beee6..e3c8ce8 100644
--- a/libavcodec/ac3dec_fixed.c
+++ b/libavcodec/ac3dec_fixed.c
@@ -168,7 +168,7 @@ static void ac3_downmix_c_fixed16(int16_t **samples, 
int16_t (*matrix)[2],
 #include ac3dec.c
 
 static const AVOption options[] = {
-{ drc_scale, percentage of dynamic range compression to apply, 
OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR },
+{ drc_scale, percentage of dynamic range compression to apply, 
OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 6.0, PAR },
 { heavy_compr, heavy dynamic range compression enabled, 
OFFSET(heavy_compression), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, PAR },
 { NULL},
 };
diff --git a/libavcodec/ac3dec_float.c b/libavcodec/ac3dec_float.c
index d74a0df..5c45c49 100644
--- a/libavcodec/ac3dec_float.c
+++ b/libavcodec/ac3dec_float.c
@@ -32,7 +32,7 @@
 #include ac3dec.c
 
 static const AVOption options[] = {
-{ drc_scale, percentage of dynamic range compression to apply, 
OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR },
+{ drc_scale, percentage of dynamic range compression to apply, 
OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 6.0, PAR },
 { heavy_compr, heavy dynamic range compression enabled, 
OFFSET(heavy_compression), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, PAR },
 { target_level, target level in -dBFS (0 not applied), 
OFFSET(target_level), AV_OPT_TYPE_INT, {.i64 = 0 }, -31, 0, PAR },
 
diff --git a/libavutil/version.h b/libavutil/version.h
index 897384a..0d8c065 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -57,7 +57,7 @@
 
 #define LIBAVUTIL_VERSION_MAJOR  54
 #define LIBAVUTIL_VERSION_MINOR  20
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MICRO 102
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
-- 
1.9.1

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


Re: [FFmpeg-devel] Default dynamic range compression on AC3

2015-03-29 Thread Wiebe Cazemier
- Original Message -
 From: Michael Niedermayer michae...@gmx.at
 To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org
 Sent: Thursday, 26 March, 2015 12:40:45 PM
 Subject: Re: [FFmpeg-devel] Default dynamic range compression on AC3
 
 and yes, please post a patch, this also should bump the version number
 and add a note in the Changelog file
 
 

Patch posted.

Perhaps I should have added a code comment saying that even though the ATSC 
standard says DRC should be applied by default, allowing users it to be off, 
ffmpeg, being a back-end library, should have it off by default, because if 
developers don't know about the DRC meta data, DRC will be applied without the 
ability to turn it off, as is the case with Kodi and VLC.

I'm (somewhat) OK with it if writers/manufacturers of media players include it 
and enable it by default, but by doing so, they are aware of what they're 
doing, and will very likely include it as a user option.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default

2015-03-29 Thread Wiebe Cazemier
- Original Message -
 From: Kieran Kunhya kier...@obe.tv
 To: Wiebe Cazemier wi...@halfgaar.net
 Cc: Kieran Kunhya kier...@obe.tv
 Sent: Sunday, 29 March, 2015 10:03:05 PM
 Subject: Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression 
 (drc_scale) is now 0 by default
 
  There was another thread about it (discussed with Michael Niedermayer,
  among others). In short, developers don't seem to know about or don't
  implement the feature. Kodi developers denied that it applied DRC on AC3,
  not knowing that ffmpeg did it. This meant that DRC couldn't be turned
  off. VLC also lacks the option, but does apply it.
 
  If applications want DRC, they should set the drc_scale option. Having
  ffmpeg do it creates mystery behavior.
 
 DRC is in the spec, if you want to violate the spec, then turn it off
 yourself. 

How?

It's in the spec as an *option*, to cater to those who have bad sound systems. 
If ffmpeg already applies DRC, and software using ffmpeg doesn't set 
'drc_scale', it's no longer an option, it becomes mandatory. That's the issue. 

Madshi's explanation is spot on.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Default dynamic range compression on AC3

2015-03-26 Thread Wiebe Cazemier
- Original Message -
 From: Michael Niedermayer michae...@gmx.at
 To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org
 Sent: Thursday, 26 March, 2015 12:40:45 PM
 Subject: Re: [FFmpeg-devel] Default dynamic range compression on AC3
 
 can you provide a sample (short/small one preferred) that shows that
 a real world sample sounds better with a changed default ?

I already did in my first post:

http://forum.kodi.tv/showthread.php?tid=219228pid=1958799#pid1958799

 
 not critical but does someone have a list of titles which sound better
 with one or the other default ?

I will take 'better' as having a higher dynamic range. I always use Terminator 
2 as my test DVD, but I have also experienced it with Star Wars 2 (space ship 
with Amidala blow up scene), U571 and actually a lot more. The meta data is 
virtually always present, so all you need to have is a title that you know so 
you have reference material.

 
 and yes, please post a patch, this also should bump the version number
 and add a note in the Changelog file

Alright, will work on that.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Default dynamic range compression on AC3

2015-03-26 Thread Wiebe Cazemier
- Original Message -
 From: Michael Niedermayer michae...@gmx.at
 To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org
 Sent: Thursday, 26 March, 2015 2:36:22 PM
 Subject: Re: [FFmpeg-devel] Default dynamic range compression on AC3
 
 i meant the ac3 stream before decoding
 but yes i can confirm its better with DRC disabled

I need to figure out how to do that then, extract the AC3 from a DVD. I will 
look into it. Or, if someone knows how?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Default dynamic range compression on AC3

2015-03-26 Thread Wiebe Cazemier
- Original Message -
 From: Michael Niedermayer michae...@gmx.at
 To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org
 Sent: Thursday, 26 March, 2015 12:40:45 PM
 Subject: Re: [FFmpeg-devel] Default dynamic range compression on AC3
 
 can you provide a sample (short/small one preferred) that shows that
 a real world sample sounds better with a changed default ?

Here's the intro from Terminator two:

http://www.halfgaar.net/tmp/t2-intro.ac3

I don't know how to edit out the start. Just go the end, after Sarah Connor 
says it's just a question of which one of them would reach him first. It's 
the same bit as those screenshots and PCM captures I posted.

play with:

mplayer --a52drc=0 t2-intro.ac3
mplayer --a52drc=1 t2-intro.ac3 

drc=1 is also the default in mplayer, probably because it uses ffmpeg or libav.

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


Re: [FFmpeg-devel] Default dynamic range compression on AC3

2015-03-26 Thread Wiebe Cazemier
- Original Message -
 From: Zach Swena zcybercomput...@gmail.com
 To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org
 Sent: Thursday, 26 March, 2015 3:34:22 PM
 Subject: Re: [FFmpeg-devel] Default dynamic range compression on AC3
 
 Something to keep in mind, AC3 is a broadcast format, so it makes sense to
 have range compression built in because many listeners are viewing on TV
 sets with limited range capabilities.  I wasn't aware of this option, but
 will probably end up using it for a program I am making.  I don't care
 about the default value, as long as I can change it and the feature and
 default value get proper documentation.  That is just a bit of background
 on why the AC3 spec has this feature.  Theoretically it should be turned
 off at the decoder if connected to proper speakers though.

This was brought up in the Kodi discussion as well. I haven't answered there 
(yet), but it has been my experience that TV networks already apply a whole 
bunch of compression on the stream itself, outside of the meta data. Disabling 
DRC doesn't help in preventing horrible compressed sound quality.

In any case, the use of AC3 for broadcasting shouldn't mean that DRC is on by 
default. Settop etc boxes that want this should turn it on themselves, not rely 
on a library that performs it with the developer using ffmpeg not even knowing 
about the existence of it. And the developers that do know, will simply set 
drc_scale.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Default dynamic range compression on AC3

2015-03-25 Thread Wiebe Cazemier
Hi,

What started as a question at the Kodi (XMBC) forum ([1]) on how to turn off 
Dolby Digital (AC3) dynamic range compression, turned into a patch and then a 
discussion on Github [2] about the default value for the AC3 dynamic range 
compression.

Kodi, using ffmpeg, didn't set the 'drc_scale' option to avcodec, resulting in 
the DRC meta data embedded in AC3 streams being applied, to arrive at a 
compressed output. On virtually every hardware and software decoder I've seen, 
DRC has been on by default (currently trying to write a patch to VLC, having 
the same issue). This has led me to the hypothesis that this is why people 
think DTS and AAC sound better than AC3. It does for most people, but it 
doesn't have to. AC3 is given an unfair disadvantage because as far as I know, 
it's the only codec with this meta data embedded and for some reason, 
developers/manufacturers have chosen to enable it by default, even in high-end 
receivers. 

See this [2] particular post with recordings and waveform screenshots of the 
difference with DRC on and off.

So I was wondering if the default of 1 for drc_scale was chosen purposefully or 
not. I feel very strongly that it should be 0 by default, because I don't see 
why streams with AC3 (as opposed to DTS, AAC, PCM, whatever) as audio should be 
treated differently if the user didn't ask for it. 

Regards,

Wiebe


[1] http://forum.kodi.tv/showthread.php?tid=219228
[2] https://github.com/xbmc/xbmc/pull/6820
[3] http://forum.kodi.tv/showthread.php?tid=219228pid=1958799#pid1958799
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel