[xiph-commits] r6958 - in branches/monty-vorbis-aotuv-branch:
xiphmont at dactyl.lonelymoon.com
xiphmont
Fri Jul 2 19:39:39 PDT 2004
examples lib
Message-ID: <20040703023939.AA8999AAAD at dactyl.lonelymoon.com>
Author: xiphmont
Date: Fri Jul 2 19:39:39 2004
New Revision: 6958
Modified:
branches/monty-vorbis-aotuv-branch/examples/encoder_example.c
branches/monty-vorbis-aotuv-branch/lib/mapping0.c
branches/monty-vorbis-aotuv-branch/lib/psy.c
branches/monty-vorbis-aotuv-branch/lib/psy.h
branches/monty-vorbis-aotuv-branch/lib/scales.h
Log:
Second half of M1 code by Aoyumi appears highly suspect; it will not
trigger at all depending on exact compiler optimizations in use. When
it does trigger, its results are dependent directly on the absolute
signal level of the input, and that is clearly wrong. It's hard to
tell what the intent was of the code (although it was clear that it
should have triggered in the spectral vicinity of strong pure tones),
and if it was being at all meaningfully triggered/tested, so it's
removed for now.
When it did trigger, it had the effect of compressing the area of the
spectrum around a pure tone inward toward -57dBA.
Modified: branches/monty-vorbis-aotuv-branch/examples/encoder_example.c
===================================================================
--- branches/monty-vorbis-aotuv-branch/examples/encoder_example.c 2004-07-03 02:20:56 UTC (rev 6957)
+++ branches/monty-vorbis-aotuv-branch/examples/encoder_example.c 2004-07-03 02:39:38 UTC (rev 6958)
@@ -126,7 +126,7 @@
*********************************************************************/
- ret=vorbis_encode_init_vbr(&vi,2,44100,.5);
+ ret=vorbis_encode_init_vbr(&vi,2,44100,.4);
/* do not continue if setup failed; this can happen if we ask for a
mode that libVorbis does not support (eg, too low a bitrate, etc,
Modified: branches/monty-vorbis-aotuv-branch/lib/mapping0.c
===================================================================
--- branches/monty-vorbis-aotuv-branch/lib/mapping0.c 2004-07-03 02:20:56 UTC (rev 6957)
+++ branches/monty-vorbis-aotuv-branch/lib/mapping0.c 2004-07-03 02:39:38 UTC (rev 6958)
@@ -157,7 +157,7 @@
#include "psy.h"
#include "scales.h"
-#if 0
+//#if 0
static long seq=0;
static ogg_int64_t total=0;
static float FLOOR1_fromdB_LOOKUP[256]={
@@ -227,7 +227,7 @@
0.82788260F, 0.88168307F, 0.9389798F, 1.F,
};
-#endif
+//#endif
extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor *look,
const float *logmdct, /* in */
@@ -313,11 +313,13 @@
if(local_ampmax[i]>global_ampmax)global_ampmax=local_ampmax[i];
#if 0
- if(vi->channels==2)
- if(i==0)
+ if(vi->channels==2){
+ if(i==0){
_analysis_output("fftL",seq,logfft,n/2,1,0,0);
- else
+ }else{
_analysis_output("fftR",seq,logfft,n/2,1,0,0);
+ }
+ }
#endif
}
@@ -347,7 +349,7 @@
for(j=0;j<n/2;j++)
logmdct[j]=todB(mdct+j);
-#if 0
+ //#if 0
if(vi->channels==2){
if(i==0)
_analysis_output("mdctL",seq,logmdct,n/2,1,0,0);
@@ -356,7 +358,7 @@
}else{
_analysis_output("mdct",seq,logmdct,n/2,1,0,0);
}
-#endif
+ //#endif
/* first step; noise masking. Not only does 'noise masking'
give us curves from which we can decide how much resolution
@@ -368,14 +370,14 @@
logmdct,
noise); /* noise does not have by-frequency offset
bias applied yet */
-#if 0
+ //#if 0
if(vi->channels==2){
if(i==0)
_analysis_output("noiseL",seq,noise,n/2,1,0,0);
else
_analysis_output("noiseR",seq,noise,n/2,1,0,0);
}
-#endif
+ //#endif
/* second step: 'all the other crap'; all the stuff that isn't
computed/fit for bitrate management goes in the second psy
@@ -387,36 +389,51 @@
global_ampmax,
local_ampmax[i]);
-#if 0
+ //#if 0
if(vi->channels==2){
if(i==0)
_analysis_output("toneL",seq,tone,n/2,1,0,0);
else
_analysis_output("toneR",seq,tone,n/2,1,0,0);
}
-#endif
+ //#endif
/* third step; we offset the noise vectors, overlay tone
masking. We then do a floor1-specific line fit. If we're
performing bitrate management, the line fit is performed
multiple times for up/down tweakage on demand. */
-
- _vp_offset_and_mix(psy_look,
- noise,
- tone,
- 1,
- logmask,
- mdct,
- logmdct);
+ {
+ float aotuvadj[psy_look->n];
-#if 0
+ _vp_offset_and_mix(psy_look,
+ noise,
+ tone,
+ 1,
+ logmask,
+ mdct,
+ logmdct,
+ aotuvadj);
+
+ if(vi->channels==2){
+ if(i==0){
+ _analysis_output("adjL",seq,aotuvadj,psy_look->n,1,1,0);
+ _analysis_output("adjmdctL",seq,mdct,n/2,1,1,0);
+ }else{
+ _analysis_output("adjR",seq,aotuvadj,psy_look->n,1,1,0);
+ _analysis_output("adjmdctR",seq,mdct,n/2,1,1,0);
+ }
+ }
+ }
+
+
+ //#if 0
if(vi->channels==2){
if(i==0)
_analysis_output("mask1L",seq,logmask,n/2,1,0,0);
else
_analysis_output("mask1R",seq,logmask,n/2,1,0,0);
}
-#endif
+ //#endif
/* this algorithm is hardwired to floor 1 for now; abort out if
we're *not* floor1. This won't happen unless someone has
@@ -439,7 +456,7 @@
2,
logmask,
mdct,
- logmdct);
+ logmdct,NULL);
#if 0
if(vi->channels==2){
@@ -462,7 +479,7 @@
0,
logmask,
mdct,
- logmdct);
+ logmdct,NULL);
#if 0
if(vi->channels==2)
@@ -651,10 +668,10 @@
}
-#if 0
+ //#if 0
seq++;
total+=ci->blocksizes[vb->W]/4+ci->blocksizes[vb->nW]/4;
-#endif
+ //#endif
return(0);
}
Modified: branches/monty-vorbis-aotuv-branch/lib/psy.c
===================================================================
--- branches/monty-vorbis-aotuv-branch/lib/psy.c 2004-07-03 02:20:56 UTC (rev 6957)
+++ branches/monty-vorbis-aotuv-branch/lib/psy.c 2004-07-03 02:39:38 UTC (rev 6958)
@@ -854,7 +854,8 @@
int offset_select,
float *logmask,
float *mdct,
- float *logmdct){
+ float *logmdct,
+ float *adj){
int i,n=p->n;
float de, coeffi, cx=1.0, cy=1.0; /* AoTuV */
float toneatt=p->vi->tone_masteratt[offset_select];
@@ -876,30 +877,34 @@
However, this code is not perfect and all noise problems cannot be solved.
by Aoyumi @ 2004/04/18
*/
- if(logmask[i] != (tone[i]+toneatt)){
- // partial masking value is used here.
- coeffi = -17.2*cy;
- val = val - logmdct[i];
+
+ {
+ coeffi = -17.2*cy; /* coeffi is a -17.2dB threshold */
+ val = val - logmdct[i]; /* val == mdct line value relative to floor in dB */
+
if(val > coeffi){
+ /* mdct value is > -17.2 dB below floor */
+
de = 1.0-((val-coeffi)*0.005*cx);
- if(de < 0) de = 0.0001;
- }else
- de = 1.0-((val-coeffi)*0.0003*cx);
+ /* pro-rated attenuation:
+ -0.00 dB boost if mdct value is -17.2dB (relative to floor)
+ -0.77 dB boost if mdct value is 0dB (relative to floor)
+ -1.64 dB boost if mdct value is +17.2dB (relative to floor)
+ etc... */
- mdct[i] *= de;
- }else{
- // A masking value is used here.
- coeffi = -57*cy;
- val = logmask[i];
- if(val > coeffi){
- de = 1.0-((val-coeffi)*0.005*cx);
if(de < 0) de = 0.0001;
- }else
+ }else
+ /* mdct value is <= -17.2 dB below floor */
+
de = 1.0-((val-coeffi)*0.0003*cx);
+ /* pro-rated attenuation:
+ +0.00 dB atten if mdct value is -17.2dB (relative to floor)
+ +0.45 dB atten if mdct value is -34.4dB (relative to floor)
+ etc... */
mdct[i] *= de;
+ if(adj)adj[i]=de;
}
-
}
}
@@ -1156,7 +1161,7 @@
/* The threshold of a stereo is changed with the size of n */
if(n > 1000)
- postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]]; // XXXX
+ postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]];
for(j=0;j<p->n;j+=partition){
float acc=0.f;
@@ -1209,13 +1214,13 @@
vorbis_info_mapping0 *vi,
float **mdct){
- int i,j,n=p->n, de=0.3*p->m_val;
- int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
- int start=p->vi->normal_start;
-
- for(i=0; i<vi->coupling_steps; i++){
- for(j=start; j<limit; j++){} // ???
- for(; j<n; j++)
- mdct[i][j] *= (1.0 - de*((float)(j-limit) / (float)(n-limit)));
- }
+ int i,j,n=p->n, de=0.3*p->m_val;
+ int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
+ int start=p->vi->normal_start;
+
+ for(i=0; i<vi->coupling_steps; i++){
+ for(j=start; j<limit; j++){} // ???
+ for(; j<n; j++)
+ mdct[i][j] *= (1.0 - de*((float)(j-limit) / (float)(n-limit)));
+ }
}
Modified: branches/monty-vorbis-aotuv-branch/lib/psy.h
===================================================================
--- branches/monty-vorbis-aotuv-branch/lib/psy.h 2004-07-03 02:20:56 UTC (rev 6957)
+++ branches/monty-vorbis-aotuv-branch/lib/psy.h 2004-07-03 02:39:38 UTC (rev 6958)
@@ -144,7 +144,8 @@
int offset_select,
float *logmask,
float *mdct,
- float *logmdct);
+ float *logmdct,
+ float *diag);
extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
Modified: branches/monty-vorbis-aotuv-branch/lib/scales.h
===================================================================
--- branches/monty-vorbis-aotuv-branch/lib/scales.h 2004-07-03 02:20:56 UTC (rev 6957)
+++ branches/monty-vorbis-aotuv-branch/lib/scales.h 2004-07-03 02:39:38 UTC (rev 6958)
@@ -22,7 +22,7 @@
#include "os.h"
/* 20log10(x) */
-//#define VORBIS_IEEE_FLOAT32 1
+#define VORBIS_IEEE_FLOAT32 1
#ifdef VORBIS_IEEE_FLOAT32
static float unitnorm(float x){
More information about the commits
mailing list