mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-24 05:49:58 +00:00
Decode VAG samples in one shot, not two.
This commit is contained in:
parent
40877cf813
commit
e8be3d8da2
@ -66,14 +66,9 @@ void VagDecoder::DecodeBlock(u8 *&readp) {
|
||||
for (int i = 0; i < 28; i += 2) {
|
||||
int d = *readp++;
|
||||
int s = (short)((d & 0xf) << 12);
|
||||
samples[i] = s >> shift_factor;
|
||||
DecodeSample(i, s >> shift_factor, predict_nr);
|
||||
s = (short)((d & 0xf0) << 8);
|
||||
samples[i + 1] = s >> shift_factor;
|
||||
}
|
||||
for (int i = 0; i < 28; i++) {
|
||||
samples[i] = (int) (samples[i] + ((s_1 * f[predict_nr][0] + s_2 * f[predict_nr][1]) >> 6));
|
||||
s_2 = s_1;
|
||||
s_1 = samples[i];
|
||||
DecodeSample(i + 1, s >> shift_factor, predict_nr);
|
||||
}
|
||||
curSample = 0;
|
||||
curBlock_++;
|
||||
@ -82,6 +77,12 @@ void VagDecoder::DecodeBlock(u8 *&readp) {
|
||||
}
|
||||
}
|
||||
|
||||
inline void VagDecoder::DecodeSample(int i, int sample, int predict_nr) {
|
||||
samples[i] = (int) (sample + ((s_1 * f[predict_nr][0] + s_2 * f[predict_nr][1]) >> 6));
|
||||
s_2 = s_1;
|
||||
s_1 = samples[i];
|
||||
}
|
||||
|
||||
void VagDecoder::GetSamples(s16 *outSamples, int numSamples) {
|
||||
if (end_) {
|
||||
memset(outSamples, 0, numSamples * sizeof(s16));
|
||||
|
@ -86,6 +86,7 @@ public:
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
private:
|
||||
void DecodeSample(int i, int sample, int predict_nr);
|
||||
int samples[28];
|
||||
int curSample;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user