********************************************************************
function: key psychoacoustic settings for 44.1/48kHz
- last mod: $Id: psych_44.h,v 1.25 2002/07/11 08:57:29 xiphmont Exp $
+ last mod: $Id: psych_44.h,v 1.26 2002/07/13 06:12:49 xiphmont Exp $
********************************************************************/
static noise3 _psy_noisebias_trans_low[2]={
/* 63 125 250 500 1k 2k 4k 8k 16k*/
/* 0 */
- {{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 8, 10, 12, 20},
+ {{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 10, 12, 14, 20},
{-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2, 2, 2, 4, 8, 8, 15},
{-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
/* 1 */
- {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 10},
+ {{{-15,-15,-15,-15,-15,-10, -5, 0, 2, 2, 6, 6, 6, 8, 10, 12, 15},
{-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, 0, 0, 0, 2, 4, 10},
{-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4, -2}}},
};
static noise3 _psy_noisebias_long_low[2]={
/*63 125 250 500 1k 2k 4k 8k 16k*/
/* 0 */
- {{{-10,-10,-10,-10,-10, -4, 0, 0, 0, 6, 6, 6, 6, 10, 10, 10, 20},
+ {{{-10,-10,-10,-10,-10, -4, 0, 0, 0, 6, 6, 6, 6, 10, 10, 12, 20},
{-20,-20,-20,-20,-20,-20,-10, -2, 0, 0, 0, 0, 0, 2, 4, 6, 15},
{-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
/* 1 */
{-34,-34,-34,-34,-34,-30,-26,-20,-16,-15,-15,-15,-15,-15,-13,-12, -8}}},
/* 7 */
{{{-22,-22,-22,-22,-22,-20,-14,-10, -6, 0, 0, 0, 0, 4, 4, 6, 11},
- {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
+ {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10,-10},
{-34,-34,-34,-34,-32,-32,-30,-24,-20,-19,-19,-19,-19,-19,-17,-16,-12}}},
/* 8 */
{{{-24,-24,-24,-24,-24,-22,-14,-10, -6, -1, -1, -1, -1, 3, 3, 5, 10},
{-36,-36,-36,-36,-36,-34,-28,-24,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
/* 9 */
{{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2, 2},
- {-36,-36,-36,-36,-34,-32,-32,-30,-26,-26,-26,-26,-26,-22,-20,-20,-16},
+ {-36,-36,-36,-36,-34,-32,-32,-30,-26,-26,-26,-26,-26,-22,-20,-20,-18},
{-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
/* 10 */
{{{-30,-30,-30,-30,-30,-26,-24,-24,-24,-20,-16,-16,-16,-16,-16,-14,-12},
- {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-30,-30,-30,-30,-30,-30,-20},
+ {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-30,-30,-30,-30,-30,-30,-26},
{-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
};
********************************************************************
function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.72 2002/07/11 06:40:49 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.73 2002/07/13 06:12:46 xiphmont Exp $
********************************************************************/
/* doing the real circular magnitude calculation is audibly superior
to (A+B)/sqrt(2) */
-static float cardoid_hypot(float a, float b){
+static float dipole_hypot(float a, float b){
if(a>0.){
if(b>0.)return sqrt(a*a+b*b);
if(a>-b)return sqrt(a*a-b*b);
if(-a>b)return -sqrt(a*a-b*b);
return sqrt(b*b-a*a);
}
+static float round_hypot(float a, float b){
+ if(a>0.){
+ if(b>0.)return sqrt(a*a+b*b);
+ if(a>-b)return sqrt(a*a+b*b);
+ return -sqrt(b*b+a*a);
+ }
+ if(b<0.)return -sqrt(a*a+b*b);
+ if(-a>b)return -sqrt(a*a+b*b);
+ return sqrt(b*b+a*a);
+}
+/* revert to round hypot for now */
float **_vp_quantize_couple_memo(vorbis_block *vb,
+ vorbis_info_psy_global *g,
vorbis_look_psy *p,
vorbis_info_mapping0 *vi,
float **mdct){
int i,j,n=p->n;
float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
+ int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
for(i=0;i<vi->coupling_steps;i++){
float *mdctM=mdct[vi->coupling_mag[i]];
float *mdctA=mdct[vi->coupling_ang[i]];
ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
- for(j=0;j<n;j++)
- ret[i][j]=cardoid_hypot(mdctM[j],mdctA[j]);
+ for(j=0;j<limit;j++)
+ ret[i][j]=dipole_hypot(mdctM[j],mdctA[j]);
+ for(;j<n;j++)
+ ret[i][j]=round_hypot(mdctM[j],mdctA[j]);
}
return(ret);
}
int **_vp_quantize_couple_sort(vorbis_block *vb,
- vorbis_look_psy *p,
- vorbis_info_mapping0 *vi,
- float **mags){
+ vorbis_look_psy *p,
+ vorbis_info_mapping0 *vi,
+ float **mags){
if(p->vi->normal_point_p){
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[i][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);