Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st March 2006, 17:50   #101  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
No progress. I make many test, but there are unpredictable peaks in sudden volume changes and are clipped with normaliced curves.

After a DRC film standard (with a theoretic max output -20 dB) is sure amplify +10 dB, but some sources go to 0 dB and others remains at -10 dB or less.

For ac3 decode, this problem (Normalize don't work after a DRC based in Sox filter), and don't now Dialog Normalization and DRC recommended in ac3 stream, make unusable this function.

If we need DRC decoding ac3 we can use ffdshow (with DirectShowSource). The output is equivalent to BeSweet-azid settings: -azid( -n1 -c normal)
After we can use Normalize without problems.
tebasuna51 is offline   Reply With Quote
Old 1st March 2006, 17:52   #102  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
@tebasuna51
brrr... seems like i realy misunderstood... maybe i need to read theoretical materials?
or i need step-by step explanation in easy english
dimzon is offline   Reply With Quote
Old 1st March 2006, 18:10   #103  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by dimzon
brrr... seems like i realy misunderstood... maybe i need to read theoretical materials?
or i need step-by step explanation in easy english
About peak problems or about correct method to apply DRC?
tebasuna51 is offline   Reply With Quote
Old 1st March 2006, 18:15   #104  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
Quote:
Originally Posted by tebasuna51
About peak problems or about correct method to apply DRC?
About DRC itself. Sorry, I'm really far from DSP, and I even have very superfictial knowledge what is dB itself... I'm very confused, sorry..
Can you comment this post: http://forum.doom9.org/showthread.ph...680#post792680
dimzon is offline   Reply With Quote
Old 1st March 2006, 19:15   #105  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by dimzon
Yes is something like this. But:
"This transformation will increase volume for low-volume samples and keep volume untoched for hi-value samples."
is not exact, can be:
Low-volume increased, certain mid-range untouched and hi-volume decreased.

The Dolby defined curves are these.

These curves are implemented in my initial post and can be used. But there are problems:

- The mid-range untouched is defined by Dialog Normalization in ac3 header:
the input audio (x-axis) must be attenuated before by 31 - (DialNorm) dB. For instance if DialNorm = -27 dB we need apply a Amplify(-4 dB) before use the appropriate curve.

- We don't know the appropriate curve. In ac3 stream each audio block have the needed amplify (+ or -) or donīt have nothing because this audio stream don't need DRC (option None in encoder).

- The theoretic max output is -20 dB (10% maxint, music & film standard), too low for standard audio equipments. And Normalize don't work after compand Sox function.

My first attempt to do "normalized" curves is similar to your curve: 100% (0 dB) input -> 100% output, "untouched for hi-value samples". Then I get another problem: "unpredictable peaks in sudden volume changes are clipped with normaliced curves".

To explain this problem a need a image. Maybe in other post.

Last edited by tebasuna51; 1st March 2006 at 19:19.
tebasuna51 is offline   Reply With Quote
Old 1st March 2006, 19:24   #106  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
Quote:
Originally Posted by tebasuna51
Yes is something like this. But:
"This transformation will increase volume for low-volume samples and keep volume untoched for hi-value samples."
is not exact, can be:
Low-volume increased, certain mid-range untouched and hi-volume decreased.

The Dolby defined curves are these.
Hmm. Shifting this curves up we will transfer from "Low-volume increased, certain mid-range untouched and hi-volume decreased." to "Low-volume increased more, certain mid-range increased less and hi-volume untouched"...

Quote:
Originally Posted by tebasuna51
These curves are implemented in my initial post with and can be used. But there are problems:

- The mid-range untouched is defined by Dialog Normalization in ac3 header:
the input audio (x-axis) must be attenuated before by 31 - (DialNorm) dB. For instance if DialNorm = -27 dB we need apply a Amplify(-4 dB) before use the appropriate curve.

- We don't know the appropriate curve. In ac3 stream each audio block have the needed amplify (+ or -) or donīt have nothing because this audio stream don't need DRC (option None in encoder).

- The theoretic max output is -20 dB (10% maxint, music & film standard), too low for standard audio equipments. And Normalize don't work after compand Sox function.
Brrr... Does I understand you right - you need actual mid-range magic value from AC3 header bcz this is not actual middle sound value == Int16.MaxValue/2 for Normalized audio but some another value?

Quote:
Originally Posted by tebasuna51
To explain this problem a need a image. Maybe in other post.
Yes, picture, please!!!
dimzon is offline   Reply With Quote
Old 1st March 2006, 19:37   #107  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
Quote:
Originally Posted by tebasuna51
- The theoretic max output is -20 dB (10% maxint, music & film standard), too low for standard audio equipments. And Normalize don't work after compand Sox function.
Just one stupid question. Dosn't theoretic max output is -20 dB become actual max output is -20 dB when we using normalized audio as input? In this case (predictable max output) we doesn't need normalize AFTER, we must just Amplify to transfer actual max output is -20 dB to good value (i doesn't know wich value is equal to maxint for 16bit audio)
dimzon is offline   Reply With Quote
Old 1st March 2006, 20:18   #108  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by dimzon
Brrr... Does I understand you right - you need actual mid-range magic value from AC3 header bcz this is not actual middle sound value == Int16.MaxValue/2 for Normalized audio but some another value?
You can see in the picture. The mid-range is the linear part (1:1) in the curve and we need know DialNorm to apply the linear part to dialog values.

Imagine you have the dialog at -10 dB and apply the curve directly (20:1 near horizontal line), then the dialog are distorted. If you apply before -21 dB the dialog go to linear part and is not distorted (output at -31 dB).

Well, I don't like this obsolete Dolby system based in normalize the audio dialog at -31 dB, but ... work so.
The goal is maintain constant the volume across any source, but don't work because cheap audio equipment don't support this wide dynamic range and other sources (mp3, CD Audio, commercials in TV, ...) works with narrow dynamic range near the 0 dB.
tebasuna51 is offline   Reply With Quote
Old 1st March 2006, 20:22   #109  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by dimzon
Just one stupid question. Dosn't theoretic max output is -20 dB become actual max output is -20 dB when we using normalized audio as input? In this case (predictable max output) we doesn't need normalize AFTER, we must just Amplify to transfer actual max output is -20 dB to good value (i doesn't know wich value is equal to maxint for 16bit audio)
I say:

"After a DRC film standard (with a theoretic max output -20 dB) is sure amplify +10 dB, but some sources go to 0 dB and others remains at -10 dB or less."

This is the peaks problem, be patient.
tebasuna51 is offline   Reply With Quote
Old 1st March 2006, 21:30   #110  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
Quote:
Originally Posted by tebasuna51
After a DRC film standard (with a theoretic max output -20 dB) is sure amplify +10 dB, but some sources go to 0 dB and others remains at -10 dB or less.
Does it mean
Code:
Normalize()
DrcFilmStandard()
can go to 0 dB
dimzon is offline   Reply With Quote
Old 2nd March 2006, 02:26   #111  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
"After amplify +10 dB"

For instance, my test_channels.ac3 (only voice) after
Normalize()
DrcFilmStandard()
Amplify(10 dB)

go to 0 dB (can't accept further amplify without clipping)
tebasuna51 is offline   Reply With Quote
Old 2nd March 2006, 08:05   #112  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
@tebasuna51
ok, i realize the problem, seems like i need to perform modification of NicAc3Source in order to implement build-in DRC control...
Shit, I hate C/C++ and I have not enought knowledge about AC3...
Will You help me with theory/math ?

Edit: Will try to asc Nic first: http://forum.doom9.org/showthread.php?t=108066

Last edited by dimzon; 2nd March 2006 at 10:01.
dimzon is offline   Reply With Quote
Old 2nd March 2006, 13:48   #113  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by dimzon
ok, i realize the problem, seems like i need to perform modification of NicAc3Source in order to implement build-in DRC control...
I think this is the correct way.

Maybe is easy modify NicAudio.dll:

From a52dec-0.7.4/doc/liba52.txt
Code:
Dynamic range compression
-------------------------

void a52_dynrng (a52_state_t * state,
                 sample_t (* call) (sample_t, void *), void * data);

This function is purely optional. If you dont call it, liba52 will
provide the default behaviour, which is to apply the full dynamic
range compression as specified in the A/52 stream. This basically
makes the loud sounds softer, and the soft sounds louder, so you can
more easily listen to the stream in a noisy environment without
disturbing anyone.

If you do call this function and set a NULL callback, this will
totally disable the dynamic range compression and provide a playback
more adapted to a movie theater or a listening room.

If you call this function and specify a callback function, this
callback might be called up to once for each block, with two
arguments: the compression factor 'c' recommended by the bitstream,
and the private data pointer you specified in a52_dynrng(). The
callback will then return the amount of compression to actually use -
typically pow(c,x) where x is somewhere between 0 and 1. More
elaborate compression functions might want to use a different value
for 'x' depending wether c>1 or c<1 - or even something more complex
if this is what you want.
From NicAudio/m2_audio_ac3.cpp
Code:
bool m2AudioAC3Source::DecodeFrame() {
...
        // Dynamic range compression
        a52_dynrng(State, 0, 0);
AFAIK NicAudio cancel the default Dynamic range compression from liba52.
For test pourpose, only if you comment the a52_dynrng line and compile NicAudio.dll, I can test if default DRC from liba52 works ok.

After we can add a new parameter to NicAc3Source call, like DRC true/false and use:
if (!DRC) { a52_dynrng(State, 0, 0) };
tebasuna51 is offline   Reply With Quote
Old 2nd March 2006, 14:10   #114  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
try http://www.mytempdir.com/487451
dimzon is offline   Reply With Quote
Old 2nd March 2006, 14:41   #115  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
btw
now I have perfect sample how to write AviSynth input audio plugins... Maybe I can join yet another MPASource into nicaudio and even add somethig like faadSource
dimzon is offline   Reply With Quote
Old 2nd March 2006, 16:40   #116  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by dimzon
Work!

Wait for complete test ...
tebasuna51 is offline   Reply With Quote
Old 2nd March 2006, 16:59   #117  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
btw
there are
Code:
	// Dynamic range compression
	dts_dynrng(State, 0, 0);
in m2audio_dts.cpp

what does you know about DRC for DTS ?
dimzon is offline   Reply With Quote
Old 2nd March 2006, 17:56   #118  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by dimzon
what does you know about DRC for DTS ?
Sorry, I don't know DTS format.

First test with new NicAc3Source: the DRC info in ac3 stream is applied, now work exactly like BeSweet -azid( -c normal )

Seems OK.
tebasuna51 is offline   Reply With Quote
Old 2nd March 2006, 19:23   #119  |  Link
dimzon
BeHappy/MeGUI developer
 
dimzon's Avatar
 
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
Quote:
Originally Posted by tebasuna51
Sorry, I don't know DTS format.
Ok

Quote:
Originally Posted by tebasuna51
First test with new NicAc3Source: the DRC info in ac3 stream is applied, now work exactly like BeSweet -azid( -c normal )

Seems OK.
Very well. Any idea how to implement other DRC modes?
dimzon is offline   Reply With Quote
Old 2nd March 2006, 21:26   #120  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by dimzon
Very well. Any idea how to implement other DRC modes?
AFAIK liba52 only apply the attenuation found in ac3 stream, don't have any algorithm to do DRC, remember (previous post):
"If you call this function and specify a callback function, this callback might be called up to once for each block, with two arguments ..."

But I think is not necesary, now work like ffdshow, Cyberlink PowerDVD 6, ...
tebasuna51 is offline   Reply With Quote
Reply

Tags
behappy

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:50.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.