HydrogenAudio

Lossy Audio Compression => Ogg Vorbis => Ogg Vorbis - Tech => Topic started by: QuantumKnot on 2004-02-03 02:48:58

Title: Testing for HF Boost in uncoupled stereo
Post by: QuantumKnot on 2004-02-03 02:48:58
I need some people to test out this special compile of oggenc where q 2 to 10 now all use uncoupled stereo.  There is a theory that point stereo is causing high frequency reverberations to concentrate toward the centre, leading to a distinct 'boost. 

Download the oggenc at http://www.hydrogenaudio.org/forums/index....ndpost&p=179808 (http://www.hydrogenaudio.org/forums/index.php?showtopic=18262&view=findpost&p=179808)

Test it on samples where you can distinctly hear the infamous high frequency boost in Vorbis, starting from q 2 and above, and compare with the official 1.0.1.  Report your results here, describing:

- whether the HF boost is still there or not
- whether it has changed in nature, behaviour, etc.
- is it higher or lower?
- any other types of noise?
etc.

Please note that this oggenc is purely for testing only and the vendor tag has the word 'uncoupled'.
Title: Testing for HF Boost in uncoupled stereo
Post by: sthayashi on 2004-02-03 06:48:14
Question:  Is this completely uncoupled, or is it losslessly coupled?

I was kicking around the idea in my head to create/compile a version of OggEnc that used lossless stereo coupling at much lower bitrates for 5.1 -> Stereo downmixes using Dolby Pro Logic II (DPLII)  The theory being that a DPLII decoder could upmix it with minimal surround problems, and would be ideal for reducing bitrate on OGMs while still preserving the 5.1 information.

It's an interesting idea that ought to be tested.  Is this a realization of my idea?
Title: Testing for HF Boost in uncoupled stereo
Post by: QuantumKnot on 2004-02-03 10:06:26
Quote
Question:  Is this completely uncoupled, or is it losslessly coupled?

I was kicking around the idea in my head to create/compile a version of OggEnc that used lossless stereo coupling at much lower bitrates for 5.1 -> Stereo downmixes using Dolby Pro Logic II (DPLII)  The theory being that a DPLII decoder could upmix it with minimal surround problems, and would be ideal for reducing bitrate on OGMs while still preserving the 5.1 information.

It's an interesting idea that ought to be tested.  Is this a realization of my idea?

To be honest, I am not entirely certain since I'm not totally familiar with the stereo settings.  What I have done is replicated the stereo mode in q 10 down to q 6, 5, 4, 3, and 2.

My guess is that it is totally uncoupled in q 9 and 10 and losslessly coupled in 6, 7 and 8.  I hope someone more knowledgeable can confirm this.  If so, then it wouldn't be hard to replicate these to lower quality rates for lossless coupling.
Title: Testing for HF Boost in uncoupled stereo
Post by: kjoonlee on 2004-02-04 00:08:37
No channels were coupled in the early betas, and all stereo channels were coupled since RC2. (Xiphophorus libVorbis I 20010813)

Before 1.0 (Xiph.Org libVorbis I 20020717), q5 and above used lossless coupling, and below that used lossy coupling.

Starting with 1.0, q6 and above used lossless coupling, and below that used a mix between lossy and lossless, depending on the input.

IANAVG, but I would assume that QuantumKnot's experimental encoder uses lossless coupling for q2~10.
Title: Testing for HF Boost in uncoupled stereo
Post by: QuantumKnot on 2004-02-04 00:16:16
I need to understand how the adj_stereo structure works

Code: [Select]
typedef struct {
int   pre[PACKETBLOBS];
int   post[PACKETBLOBS];
float kHz[PACKETBLOBS];
float lowpasskHz[PACKETBLOBS];
} adj_stereo;


The last two members seem self-explanatory.  But at q 9 and 10, pre[] and post[] are all zero.  From q 6 to 8, there are some values in post[] and the rest, incl. pre[] are zero.  At q 5 and below, we start to see some non-zero values in pre[].  I glanced at the stereo coupling code and didn't garner much from it.

I posted a question on vorbis-dev.  No answer yet.
Title: Testing for HF Boost in uncoupled stereo
Post by: nyaochi on 2004-02-04 01:51:45
I don't understand adj_stereo structure either, but I can probably disable channel coupling by forcing uncoupled mode. Current libvorbis seems to use uncoupled modes (i.e., setup_44u.h) when number of channels is greater than 2 by carefully looking at vorbisenc.c (around lines 636):
Code: [Select]
  while(setup_list[i]){
   if(setup_list[i]->coupling_restriction==-1 ||
      setup_list[i]->coupling_restriction==ch){
      ...
    }
 }

This code fragment means libvorbis tries coupled mode first (e.g., coupling_restriction==2), and then uses uncoupled mode (coupling_restriction==-1). So we can skip coupled mode even when ch==2 by changeing coupling_restriction value. Here's a patch.
Code: [Select]
--- 1.0.1-official/vorbis/lib/modes/setup_44.h    2002-07-11 04:57:30.000000000 +0900
+++ 1.0.1-uc/vorbis/lib/modes/setup_44.h    2004-02-04 10:01:29.845691200 +0900
@@ -76,7 +76,7 @@
  10,
  rate_mapping_44_stereo,
  quality_mapping_44,
-  2,
+  0,
  40000,
  50000,
 
@@ -127,7 +127,7 @@
  1,
  rate_mapping_44_stereo_low,
  quality_mapping_44_stereo_low,
-  2,
+  0,
  40000,
  50000,

And here's a Win32-binary:
http://homepage3.nifty.com/nyaochi/temp/oggencuc.zip (http://homepage3.nifty.com/nyaochi/temp/oggencuc.zip)

HF boost still exist in uncoupled -q4 (slightly better but not impressive). 
Title: Testing for HF Boost in uncoupled stereo
Post by: QuantumKnot on 2004-02-04 02:12:06
Ah well, so much for that theory.

btw.  Which sample do you think the high frequency boost is most obvious?
Title: Testing for HF Boost in uncoupled stereo
Post by: QuantumKnot on 2004-02-14 02:46:47
I've made a different modification to force lossless stereo coupling.

In psy.c, we have (line 1116)

Quote
if(l<sliding_lowpass){
     if((l>=limit && fabs(rM[l])<postpoint && fabs(rA[l])<postpoint) ||
        (fabs(rM[l])<prepoint && fabs(rA[l])<prepoint)){


       precomputed_couple_point(mag_memo[l],
           floorM[l],floorA[l],
           qM+l,qA+l);

       if(rint(qM[l])==0.f)acc+=qM[l]*qM[l];
     }else{
      couple_lossless(rM[l],rA[l],qM+l,qA+l);
     }


Essentially this is a mix of lossless and pont stereo where if the first condition is true, it uses the point coupling function, which at first glance, seems to set the angle to 0 (no diffuse information)

Quote
static void precomputed_couple_point(float premag,
         int floorA,int floorB,
         float *mag, float *ang){
 
  int test=(floorA>floorB)-1;
  int offset=31-abs(floorA-floorB);
  float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f;

  floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))];

  *mag=premag*floormag;
  *ang=0.f;
}


Anyway, what I've done in the first code snippet is comment out everything except the couple_lossless() function, so it should use lossless coupling every time.

I've uploaded a binary at http://www.hydrogenaudio.org/forums/index....ndpost&p=184474 (http://www.hydrogenaudio.org/forums/index.php?showtopic=18262&view=findpost&p=184474)

Not much noticeable change compared to my first modification.  Compared with the uncoupled/dual stereo version that nyaochi made, it seems (just from coding a few examples) lossless coupling only produces lower average bitrate than uncoupled at q > 4 but below 4, uncoupled stereo produces smaller files.  I guess lossless coupling isn't always the best for all q.

Anyway, the uncoupled and lossless vorbis binaries will be useful for the video people who want to preserve Dolby Prologic information.  Nyaochi's uncoupled vorbis seems to be the most scalable as my lossless version dies at q 0 and 1 for very obvious reasons (ie. other things I need to modify)