update psx decoder to use double value

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@583 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2009-03-05 16:05:25 +00:00
parent 12ee4b3687
commit ea3c289d30

View File

@ -3,10 +3,11 @@
#include "../util.h"
double VAG_f[5][2] = { { 0.0 , 0.0 },
{ 60.0 / 64.0 , 0.0 },
{ 60.0/64.0 , 0.0 },
{ 115.0 / 64.0 , -52.0 / 64.0 },
{ 98.0 / 64.0 , -55.0 / 64.0 } ,
{ 122.0 / 64.0 , -60.0 / 64.0 } } ;
long VAG_coefs[5][2] = { { 0 , 0 },
{ 60 , 0 },
{ 115 , -52 },
@ -15,9 +16,10 @@ long VAG_coefs[5][2] = { { 0 , 0 },
void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int predict_nr, shift_factor, sample;
int32_t hist1=stream->adpcm_history1_32;
int32_t hist2=stream->adpcm_history2_32;
int predict_nr, shift_factor;
double sample;
double hist1=stream->adpcm_history1_double;
double hist2=stream->adpcm_history2_double;
short scale;
int i;
@ -44,15 +46,15 @@ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
sample_byte >> 4 :
sample_byte & 0x0f)<<12);
sample=(int)((scale >> shift_factor)+hist1*VAG_f[predict_nr][0]+hist2*VAG_f[predict_nr][1]);
sample=(double)(scale >> shift_factor)+hist1*VAG_f[predict_nr][0]+hist2*VAG_f[predict_nr][1];
}
outbuf[sample_count] = clamp16(sample);
hist2=hist1;
hist1=sample;
}
stream->adpcm_history1_32=hist1;
stream->adpcm_history2_32=hist2;
stream->adpcm_history1_double=hist1;
stream->adpcm_history2_double=hist2;
}
void decode_invert_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {