diff options
-rw-r--r-- | examples/encoder_example.c | 4 | ||||
-rw-r--r-- | lib/mapping0.c | 5 | ||||
-rw-r--r-- | lib/modes/psych_44.h | 14 | ||||
-rw-r--r-- | lib/modes/setup_32.h | 4 | ||||
-rw-r--r-- | lib/psy.c | 32 | ||||
-rw-r--r-- | lib/psy.h | 3 |
6 files changed, 41 insertions, 21 deletions
diff --git a/examples/encoder_example.c b/examples/encoder_example.c index 00bc0a81..2c0f1c84 100644 --- a/examples/encoder_example.c +++ b/examples/encoder_example.c @@ -11,7 +11,7 @@ ******************************************************************** function: simple example encoder - last mod: $Id: encoder_example.c,v 1.48 2002/07/12 15:07:52 giles Exp $ + last mod: $Id: encoder_example.c,v 1.49 2002/07/13 06:12:45 xiphmont Exp $ ********************************************************************/ @@ -126,7 +126,7 @@ int main(){ *********************************************************************/ - ret=vorbis_encode_init_vbr(&vi,2,44100,.3); + ret=vorbis_encode_init_vbr(&vi,2,44100,.5); /* 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, diff --git a/lib/mapping0.c b/lib/mapping0.c index fc862c02..0e491b9e 100644 --- a/lib/mapping0.c +++ b/lib/mapping0.c @@ -11,7 +11,7 @@ ******************************************************************** function: channel mapping 0 implementation - last mod: $Id: mapping0.c,v 1.52 2002/07/01 11:20:11 xiphmont Exp $ + last mod: $Id: mapping0.c,v 1.53 2002/07/13 06:12:46 xiphmont Exp $ ********************************************************************/ @@ -513,8 +513,9 @@ static int mapping0_forward(vorbis_block *vb){ if(info->coupling_steps){ mag_memo=_vp_quantize_couple_memo(vb, + &ci->psy_g_param, psy_look, - info, + info, gmdct); mag_sort=_vp_quantize_couple_sort(vb, diff --git a/lib/modes/psych_44.h b/lib/modes/psych_44.h index 83485cf8..9705d96f 100644 --- a/lib/modes/psych_44.h +++ b/lib/modes/psych_44.h @@ -11,7 +11,7 @@ ******************************************************************** 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 $ ********************************************************************/ @@ -139,18 +139,18 @@ static vp_adjblock _vp_tonemask_adj_otherblock[11]={ 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 */ @@ -287,7 +287,7 @@ static noise3 _psy_noisebias_impulse[11]={ {-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}, @@ -295,11 +295,11 @@ static noise3 _psy_noisebias_impulse[11]={ {-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}}}, }; diff --git a/lib/modes/setup_32.h b/lib/modes/setup_32.h index 7d40196d..dfdf3f47 100644 --- a/lib/modes/setup_32.h +++ b/lib/modes/setup_32.h @@ -11,7 +11,7 @@ ******************************************************************** function: toplevel settings for 32kHz - last mod: $Id: setup_32.h,v 1.3 2002/07/11 06:41:04 xiphmont Exp $ + last mod: $Id: setup_32.h,v 1.4 2002/07/13 06:12:49 xiphmont Exp $ ********************************************************************/ @@ -26,7 +26,7 @@ static double rate_mapping_32_un[11]={ }; static double rate_mapping_32_low[2]={ - 18000.,28000. + 20000.,28000. }; static double rate_mapping_32_un_low[2]={ @@ -11,7 +11,7 @@ ******************************************************************** 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 $ ********************************************************************/ @@ -903,7 +903,7 @@ static void precomputed_couple_point(float premag, /* 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); @@ -913,21 +913,36 @@ static float cardoid_hypot(float a, float 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); @@ -940,9 +955,9 @@ static int apsort(const void *a, const void *b){ } 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){ @@ -1085,9 +1100,12 @@ void _vp_couple(int blobno, 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); @@ -11,7 +11,7 @@ ******************************************************************** function: random psychoacoustics (not including preecho) - last mod: $Id: psy.h,v 1.31 2002/07/11 06:40:49 xiphmont Exp $ + last mod: $Id: psy.h,v 1.32 2002/07/13 06:12:47 xiphmont Exp $ ********************************************************************/ @@ -144,6 +144,7 @@ extern void _vp_offset_and_mix(vorbis_look_psy *p, extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd); extern float **_vp_quantize_couple_memo(vorbis_block *vb, + vorbis_info_psy_global *g, vorbis_look_psy *p, vorbis_info_mapping0 *vi, float **mdct); |