back out double in psx decoder (r583)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@586 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
halleyscometsw 2009-03-05 20:10:24 +00:00
parent b204aa0aab
commit 713b70ae6d

View File

@ -3,11 +3,10 @@
#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 },
@ -16,10 +15,9 @@ 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;
double sample;
double hist1=stream->adpcm_history1_double;
double hist2=stream->adpcm_history2_double;
int predict_nr, shift_factor, sample;
int32_t hist1=stream->adpcm_history1_32;
int32_t hist2=stream->adpcm_history2_32;
short scale;
int i;
@ -46,15 +44,15 @@ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
sample_byte >> 4 :
sample_byte & 0x0f)<<12);
sample=(double)(scale >> shift_factor)+hist1*VAG_f[predict_nr][0]+hist2*VAG_f[predict_nr][1];
sample=(int)((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_double=hist1;
stream->adpcm_history2_double=hist2;
stream->adpcm_history1_32=hist1;
stream->adpcm_history2_32=hist2;
}
void decode_invert_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {