a lot of ea new formats supported

fixed stereo sdr2 decoder

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@322 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2008-07-14 19:21:45 +00:00
parent fa8254e49f
commit 8a5d2b6429
17 changed files with 699 additions and 209 deletions

View File

@ -11,6 +11,8 @@ void g72x_init_state(struct g72x_state *state_ptr);
void decode_nds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_nds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_xbox_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); void decode_xbox_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);
void decode_dvi_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_dvi_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_eacs_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_ngc_afc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_ngc_afc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
@ -23,8 +25,10 @@ int32_t dsp_nibbles_to_samples(int32_t nibbles);
void decode_ngc_dtk(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_ngc_dtk(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
void decode_pcm16LE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm16LE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_pcm16LE_noninterleaved(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_pcm16BE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm16BE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_pcm8(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm8(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_pcm8_noninterleaved(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
@ -33,6 +37,7 @@ void decode_invert_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelsp
void decode_xa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_xa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);
void decode_ea_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels); void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);

View File

@ -8,6 +8,14 @@ long EA_XA_TABLE[28] = {0,0,240,0,460,-208,0x0188,-220,
-208,-1,-220,-1, -208,-1,-220,-1,
0x0000,0x0000,0x0000,0x3F70}; 0x0000,0x0000,0x0000,0x3F70};
long EA_TABLE[20]= { 0x00000000, 0x000000F0, 0x000001CC, 0x00000188,
0x00000000, 0x00000000, 0xFFFFFF30, 0xFFFFFF24,
0x00000000, 0x00000001, 0x00000003, 0x00000004,
0x00000007, 0x00000008, 0x0000000A, 0x0000000B,
0x00000000, 0xFFFFFFFF, 0xFFFFFFFD, 0xFFFFFFFC};
static int ea_adpcm_get_high_nibble=1;
void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) { void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) {
uint8_t frame_info; uint8_t frame_info;
int32_t sample_count; int32_t sample_count;
@ -64,3 +72,51 @@ void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
stream->channel_start_offset+=0x0F; stream->channel_start_offset+=0x0F;
} }
} }
void init_ea_adpcm_nibble() {
ea_adpcm_get_high_nibble=1;
}
void decode_ea_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) {
uint8_t frame_info;
int32_t sample_count;
long coef1,coef2;
int i,shift;
off_t channel_offset=stream->channel_start_offset;
ea_adpcm_get_high_nibble=!ea_adpcm_get_high_nibble;
first_sample = first_sample%28;
frame_info = read_8bit(stream->offset+channel_offset,stream->streamfile);
coef1 = EA_TABLE[(ea_adpcm_get_high_nibble? frame_info & 0x0F: frame_info >> 4)];
coef2 = EA_TABLE[(ea_adpcm_get_high_nibble? frame_info & 0x0F: frame_info >> 4) + 4];
channel_offset++;
frame_info = read_8bit(stream->offset+channel_offset,stream->streamfile);
shift = (ea_adpcm_get_high_nibble? frame_info & 0x0F : frame_info >> 4)+8;
channel_offset++;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
uint8_t sample_byte = (uint8_t)read_8bit(stream->offset+channel_offset+i,stream->streamfile);
int32_t sample = ((((ea_adpcm_get_high_nibble?
sample_byte & 0x0F:
sample_byte >> 4
) << 0x1C) >> shift) +
(coef1 * stream->adpcm_history1_32) + (coef2 * stream->adpcm_history2_32) + 0x80) >> 8;
outbuf[sample_count] = clamp16(sample);
stream->adpcm_history2_32 = stream->adpcm_history1_32;
stream->adpcm_history1_32 = sample;
}
channel_offset+=i;
// Only increment offset on complete frame
if(channel_offset-stream->channel_start_offset==0x1E)
stream->channel_start_offset+=0x1E;
}

View File

@ -1,197 +1,249 @@
#include "../util.h" #include "../util.h"
#include "coding.h" #include "coding.h"
const int32_t ADPCMTable[89] = const int32_t ADPCMTable[89] =
{ {
7, 8, 9, 10, 11, 12, 13, 14, 7, 8, 9, 10, 11, 12, 13, 14,
16, 17, 19, 21, 23, 25, 28, 31, 16, 17, 19, 21, 23, 25, 28, 31,
34, 37, 41, 45, 50, 55, 60, 66, 34, 37, 41, 45, 50, 55, 60, 66,
73, 80, 88, 97, 107, 118, 130, 143, 73, 80, 88, 97, 107, 118, 130, 143,
157, 173, 190, 209, 230, 253, 279, 307, 157, 173, 190, 209, 230, 253, 279, 307,
337, 371, 408, 449, 494, 544, 598, 658, 337, 371, 408, 449, 494, 544, 598, 658,
724, 796, 876, 963, 1060, 1166, 1282, 1411, 724, 796, 876, 963, 1060, 1166, 1282, 1411,
1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024,
3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484,
7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794,
32767 32767
}; };
const int IMA_IndexTable[16] = const int IMA_IndexTable[16] =
{ {
-1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8,
-1, -1, -1, -1, 2, 4, 6, 8 -1, -1, -1, -1, 2, 4, 6, 8
}; };
void decode_nds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { static int get_eacs_high_nibble=1;
int i=first_sample;
int32_t sample_count; void decode_nds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int32_t hist1 = stream->adpcm_history1_16; int i=first_sample;
int step_index = stream->adpcm_step_index; int32_t sample_count;
int32_t hist1 = stream->adpcm_history1_16;
if (first_sample==0) { int step_index = stream->adpcm_step_index;
hist1 = read_16bitLE(stream->offset,stream->streamfile);
step_index = read_16bitLE(stream->offset+2,stream->streamfile); if (first_sample==0) {
} hist1 = read_16bitLE(stream->offset,stream->streamfile);
step_index = read_16bitLE(stream->offset+2,stream->streamfile);
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) { }
int sample_nibble =
(read_8bit(stream->offset+4+i/2,stream->streamfile) >> (i&1?4:0))&0xf; for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
int delta; int sample_nibble =
int step = ADPCMTable[step_index]; (read_8bit(stream->offset+4+i/2,stream->streamfile) >> (i&1?4:0))&0xf;
int delta;
delta = step >> 3; int step = ADPCMTable[step_index];
if (sample_nibble & 1) delta += step >> 2;
if (sample_nibble & 2) delta += step >> 1; delta = step >> 3;
if (sample_nibble & 4) delta += step; if (sample_nibble & 1) delta += step >> 2;
if (sample_nibble & 8) if (sample_nibble & 2) delta += step >> 1;
outbuf[sample_count] = clamp16(hist1 - delta); if (sample_nibble & 4) delta += step;
else if (sample_nibble & 8)
outbuf[sample_count] = clamp16(hist1 + delta); outbuf[sample_count] = clamp16(hist1 - delta);
else
step_index += IMA_IndexTable[sample_nibble]; outbuf[sample_count] = clamp16(hist1 + delta);
if (step_index < 0) step_index=0;
if (step_index > 88) step_index=88; step_index += IMA_IndexTable[sample_nibble];
if (step_index < 0) step_index=0;
hist1 = outbuf[sample_count]; if (step_index > 88) step_index=88;
}
hist1 = outbuf[sample_count];
stream->adpcm_history1_16 = hist1; }
stream->adpcm_step_index = step_index;
} stream->adpcm_history1_16 = hist1;
stream->adpcm_step_index = step_index;
void decode_xbox_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) { }
int i=first_sample;
int sample_nibble; void decode_xbox_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) {
int sample_decoded; int i=first_sample;
int delta; int sample_nibble;
int sample_decoded;
int32_t sample_count=0; int delta;
int32_t hist1=stream->adpcm_history1_32;
int step_index = stream->adpcm_step_index; int32_t sample_count=0;
off_t offset=stream->offset; int32_t hist1=stream->adpcm_history1_32;
int step_index = stream->adpcm_step_index;
first_sample = first_sample % 64; off_t offset=stream->offset;
if (first_sample == 0) { first_sample = first_sample % 64;
hist1 = read_16bitLE(offset+channel*4,stream->streamfile);
step_index = read_16bitLE(offset+channel*4+2,stream->streamfile); if (first_sample == 0) {
if (step_index < 0) step_index=0; hist1 = read_16bitLE(offset+channel*4,stream->streamfile);
if (step_index > 88) step_index=88; step_index = read_16bitLE(offset+channel*4+2,stream->streamfile);
} if (step_index < 0) step_index=0;
if (step_index > 88) step_index=88;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) { }
int step = ADPCMTable[step_index];
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
offset = stream->offset + 4*channelspacing + (i/8*4*channelspacing+(i%8)/2+4*channel); int step = ADPCMTable[step_index];
sample_nibble = (read_8bit(offset,stream->streamfile) >> (i&1?4:0))&0xf; offset = stream->offset + 4*channelspacing + (i/8*4*channelspacing+(i%8)/2+4*channel);
sample_decoded=hist1; sample_nibble = (read_8bit(offset,stream->streamfile) >> (i&1?4:0))&0xf;
delta = step >> 3; sample_decoded=hist1;
if (sample_nibble & 1) delta += step >> 2;
if (sample_nibble & 2) delta += step >> 1; delta = step >> 3;
if (sample_nibble & 4) delta += step; if (sample_nibble & 1) delta += step >> 2;
if (sample_nibble & 8) if (sample_nibble & 2) delta += step >> 1;
sample_decoded -= delta; if (sample_nibble & 4) delta += step;
else if (sample_nibble & 8)
sample_decoded += delta; sample_decoded -= delta;
else
hist1=clamp16(sample_decoded); sample_decoded += delta;
step_index += IMA_IndexTable[sample_nibble]; hist1=clamp16(sample_decoded);
if (step_index < 0) step_index=0;
if (step_index > 88) step_index=88; step_index += IMA_IndexTable[sample_nibble];
if (step_index < 0) step_index=0;
outbuf[sample_count]=(short)(hist1); if (step_index > 88) step_index=88;
}
outbuf[sample_count]=(short)(hist1);
stream->adpcm_history1_32=hist1; }
stream->adpcm_step_index=step_index;
} stream->adpcm_history1_32=hist1;
stream->adpcm_step_index=step_index;
void decode_dvi_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { }
int i;
void decode_dvi_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int32_t sample_count=0; int i;
int32_t hist1=stream->adpcm_history1_32;
int step_index = stream->adpcm_step_index; int32_t sample_count=0;
int32_t hist1=stream->adpcm_history1_32;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) { int step_index = stream->adpcm_step_index;
int step = ADPCMTable[step_index];
uint8_t sample_byte; for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
int sample_nibble; int step = ADPCMTable[step_index];
int sample_decoded; uint8_t sample_byte;
int delta; int sample_nibble;
int sample_decoded;
sample_byte = read_8bit(stream->offset+i/2,stream->streamfile); int delta;
/* old-style DVI takes high nibble first */
sample_nibble = (sample_byte >> (i&1?0:4))&0xf; sample_byte = read_8bit(stream->offset+i/2,stream->streamfile);
/* old-style DVI takes high nibble first */
sample_decoded = hist1; sample_nibble = (sample_byte >> (i&1?0:4))&0xf;
delta = step >> 3;
if (sample_nibble & 1) delta += step >> 2; sample_decoded = hist1;
if (sample_nibble & 2) delta += step >> 1; delta = step >> 3;
if (sample_nibble & 4) delta += step; if (sample_nibble & 1) delta += step >> 2;
if (sample_nibble & 8) if (sample_nibble & 2) delta += step >> 1;
sample_decoded -= delta; if (sample_nibble & 4) delta += step;
else if (sample_nibble & 8)
sample_decoded += delta; sample_decoded -= delta;
else
hist1=clamp16(sample_decoded); sample_decoded += delta;
step_index += IMA_IndexTable[sample_nibble&0x7]; hist1=clamp16(sample_decoded);
if (step_index < 0) step_index=0;
if (step_index > 88) step_index=88; step_index += IMA_IndexTable[sample_nibble&0x7];
if (step_index < 0) step_index=0;
outbuf[sample_count]=(short)(hist1); if (step_index > 88) step_index=88;
}
outbuf[sample_count]=(short)(hist1);
stream->adpcm_history1_32=hist1; }
stream->adpcm_step_index=step_index;
} stream->adpcm_history1_32=hist1;
stream->adpcm_step_index=step_index;
void decode_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { }
int i;
void init_eacs_high_nibble() {
int32_t sample_count=0; get_eacs_high_nibble=1;
int32_t hist1=stream->adpcm_history1_32; }
int step_index = stream->adpcm_step_index;
void decode_eacs_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) { int i;
int step = ADPCMTable[step_index];
uint8_t sample_byte; int32_t sample_count=0;
int sample_nibble; int32_t hist1=stream->adpcm_history1_32;
int sample_decoded; int step_index = stream->adpcm_step_index;
int delta;
get_eacs_high_nibble=!get_eacs_high_nibble;
sample_byte = read_8bit(stream->offset+i/2,stream->streamfile);
sample_nibble = (sample_byte >> (i&1?4:0))&0xf; if((first_sample) && (channelspacing==1))
get_eacs_high_nibble=!get_eacs_high_nibble;
sample_decoded = hist1;
delta = step >> 3; for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
if (sample_nibble & 1) delta += step >> 2; int step = ADPCMTable[step_index];
if (sample_nibble & 2) delta += step >> 1; uint8_t sample_byte;
if (sample_nibble & 4) delta += step; int sample_nibble;
if (sample_nibble & 8) int sample_decoded;
sample_decoded -= delta; int delta;
else
sample_decoded += delta; sample_byte = read_8bit(stream->offset+i,stream->streamfile);
/* old-style DVI takes high nibble first */
hist1=clamp16(sample_decoded); sample_nibble = (sample_byte >> (get_eacs_high_nibble?0:4))&0xf;
step_index += IMA_IndexTable[sample_nibble&0x7]; sample_decoded = hist1;
if (step_index < 0) step_index=0; delta = step >> 3;
if (step_index > 88) step_index=88; if (sample_nibble & 1) delta += step >> 2;
if (sample_nibble & 2) delta += step >> 1;
outbuf[sample_count]=(short)(hist1); if (sample_nibble & 4) delta += step;
} if (sample_nibble & 8)
sample_decoded -= delta;
stream->adpcm_history1_32=hist1; else
stream->adpcm_step_index=step_index; sample_decoded += delta;
}
hist1=clamp16(sample_decoded);
step_index += IMA_IndexTable[sample_nibble&0x7];
if (step_index < 0) step_index=0;
if (step_index > 88) step_index=88;
outbuf[sample_count]=(short)(hist1);
}
stream->adpcm_history1_32=hist1;
stream->adpcm_step_index=step_index;
}
void decode_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int i;
int32_t sample_count=0;
int32_t hist1=stream->adpcm_history1_32;
int step_index = stream->adpcm_step_index;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
int step = ADPCMTable[step_index];
uint8_t sample_byte;
int sample_nibble;
int sample_decoded;
int delta;
sample_byte = read_8bit(stream->offset+i/2,stream->streamfile);
sample_nibble = (sample_byte >> (i&1?4:0))&0xf;
sample_decoded = hist1;
delta = step >> 3;
if (sample_nibble & 1) delta += step >> 2;
if (sample_nibble & 2) delta += step >> 1;
if (sample_nibble & 4) delta += step;
if (sample_nibble & 8)
sample_decoded -= delta;
else
sample_decoded += delta;
hist1=clamp16(sample_decoded);
step_index += IMA_IndexTable[sample_nibble&0x7];
if (step_index < 0) step_index=0;
if (step_index > 88) step_index=88;
outbuf[sample_count]=(short)(hist1);
}
stream->adpcm_history1_32=hist1;
stream->adpcm_step_index=step_index;
}

View File

@ -27,3 +27,21 @@ void decode_pcm8(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
outbuf[sample_count]=read_8bit(stream->offset+i,stream->streamfile)*0x100; outbuf[sample_count]=read_8bit(stream->offset+i,stream->streamfile)*0x100;
} }
} }
void decode_pcm8_noninterleaved(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int i;
int32_t sample_count;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
outbuf[sample_count]=read_8bit(stream->offset+i*channelspacing,stream->streamfile)*0x100;
}
}
void decode_pcm16LE_noninterleaved(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int i;
int32_t sample_count;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
outbuf[sample_count]=read_16bitLE(stream->offset+i*2*channelspacing,stream->streamfile);
}
}

View File

@ -40,7 +40,7 @@ void decode_sdx2(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
int32_t sample_count; int32_t sample_count;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) { for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
int8_t sample_byte = read_8bit(stream->offset+i,stream->streamfile); int8_t sample_byte = read_8bit(stream->offset+i*channelspacing,stream->streamfile);
int16_t sample; int16_t sample;
if (!(sample_byte & 1)) hist = 0; if (!(sample_byte & 1)) hist = 0;

View File

@ -64,6 +64,9 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
case layout_ea_blocked: case layout_ea_blocked:
ea_block_update(vgmstream->next_block_offset,vgmstream); ea_block_update(vgmstream->next_block_offset,vgmstream);
break; break;
case layout_eacs_blocked:
eacs_block_update(vgmstream->next_block_offset,vgmstream);
break;
case layout_caf_blocked: case layout_caf_blocked:
caf_block_update(vgmstream->next_block_offset,vgmstream); caf_block_update(vgmstream->next_block_offset,vgmstream);
break; break;
@ -76,7 +79,7 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
case layout_ws_aud_blocked: case layout_ws_aud_blocked:
ws_aud_block_update(vgmstream->next_block_offset,vgmstream); ws_aud_block_update(vgmstream->next_block_offset,vgmstream);
break; break;
default: default:
break; break;
} }

View File

@ -1,10 +1,15 @@
#include "layout.h" #include "layout.h"
#include "../vgmstream.h" #include "../vgmstream.h"
extern void init_eacs_high_nibble();
extern void init_ea_adpcm_nibble();
/* set up for the block at the given offset */ /* set up for the block at the given offset */
void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream) { void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
int i; int i;
init_ea_adpcm_nibble();
// Search for next SCDL or SCEl block ... // Search for next SCDL or SCEl block ...
do { do {
block_offset+=4; block_offset+=4;
@ -37,16 +42,35 @@ void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
vgmstream->current_block_size=read_32bitLE(block_offset+0x04,vgmstream->ch[0].streamfile)-0x10; vgmstream->current_block_size=read_32bitLE(block_offset+0x04,vgmstream->ch[0].streamfile)-0x10;
vgmstream->current_block_size/=vgmstream->channels; vgmstream->current_block_size/=vgmstream->channels;
} else { } else {
vgmstream->current_block_size = read_32bitLE(block_offset+8,vgmstream->ch[0].streamfile);
for(i=0;i<vgmstream->channels;i++) { if(vgmstream->coding_type==coding_EA_ADPCM) {
vgmstream->ch[i].offset=read_32bitLE(block_offset+0x0C+(i*4),vgmstream->ch[0].streamfile)+(4*vgmstream->channels); vgmstream->current_block_size = read_32bitLE(block_offset+4,vgmstream->ch[0].streamfile);
vgmstream->ch[i].offset+=vgmstream->current_block_offset+0x0C; for(i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset=vgmstream->current_block_offset+0x0C+(4*vgmstream->channels);
vgmstream->ch[i].adpcm_history1_32=(uint32_t)read_16bitLE(vgmstream->current_block_offset+0x0c+(i*4),vgmstream->ch[0].streamfile);
vgmstream->ch[i].adpcm_history2_32=(uint32_t)read_16bitLE(vgmstream->current_block_offset+0x0e+(i*4),vgmstream->ch[0].streamfile);
}
} else {
if(vgmstream->coding_type==coding_PCM16LE_NI) {
vgmstream->current_block_size = read_32bitLE(block_offset+4,vgmstream->ch[0].streamfile)-0x0C;
for(i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset=block_offset+0x0C+(i*2);
}
vgmstream->current_block_size/=2;
vgmstream->current_block_size-=2;
} else {
vgmstream->current_block_size = read_32bitLE(block_offset+8,vgmstream->ch[0].streamfile);
for(i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset=read_32bitLE(block_offset+0x0C+(i*4),vgmstream->ch[0].streamfile)+(4*vgmstream->channels);
vgmstream->ch[i].offset+=vgmstream->current_block_offset+0x0C;
}
vgmstream->current_block_size /= 28;
}
} }
vgmstream->current_block_size /= 28;
} }
} }
if((vgmstream->ea_compression_version<3) && (vgmstream->coding_type!=coding_PSX)) { if((vgmstream->ea_compression_version<3) && (vgmstream->coding_type!=coding_PSX) && (vgmstream->coding_type!=coding_EA_ADPCM)) {
for(i=0;i<vgmstream->channels;i++) { for(i=0;i<vgmstream->channels;i++) {
if(vgmstream->ea_big_endian) { if(vgmstream->ea_big_endian) {
vgmstream->ch[i].adpcm_history1_32=read_16bitBE(vgmstream->ch[i].offset,vgmstream->ch[0].streamfile); vgmstream->ch[i].adpcm_history1_32=read_16bitBE(vgmstream->ch[i].offset,vgmstream->ch[0].streamfile);
@ -59,3 +83,54 @@ void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
} }
} }
} }
void eacs_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
int i;
off_t block_size=vgmstream->current_block_size;
if(read_32bitBE(block_offset,vgmstream->ch[0].streamfile)==0x31534E6C) {
block_offset+=0x0C;
}
vgmstream->current_block_offset = block_offset;
if(read_32bitBE(block_offset,vgmstream->ch[0].streamfile)==0x31534E64) { /* 1Snd */
block_offset+=4;
if(vgmstream->ea_platform==0)
block_size=read_32bitLE(vgmstream->current_block_offset+0x04,
vgmstream->ch[0].streamfile);
else
block_size=read_32bitBE(vgmstream->current_block_offset+0x04,
vgmstream->ch[0].streamfile);
block_offset+=4;
}
vgmstream->current_block_size=block_size-8;
if(vgmstream->coding_type==coding_EACS_IMA) {
init_eacs_high_nibble();
vgmstream->current_block_size=read_32bitLE(block_offset,vgmstream->ch[0].streamfile);
for(i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].adpcm_step_index = read_32bitLE(block_offset+0x04+i*4,vgmstream->ch[0].streamfile);
vgmstream->ch[i].adpcm_history1_32 = read_32bitLE(block_offset+0x04+i*4+(4*vgmstream->channels),vgmstream->ch[0].streamfile);
vgmstream->ch[i].offset = block_offset+0x14;
}
} else {
if(vgmstream->coding_type==coding_PSX) {
for (i=0;i<vgmstream->channels;i++)
vgmstream->ch[i].offset = vgmstream->current_block_offset+8+(i*(vgmstream->current_block_size/2));
} else {
for (i=0;i<vgmstream->channels;i++) {
if(vgmstream->coding_type==coding_PCM16LE_NI)
vgmstream->ch[i].offset = block_offset+(i*2);
else
vgmstream->ch[i].offset = block_offset+i;
}
}
vgmstream->current_block_size/=vgmstream->channels;
}
vgmstream->next_block_offset = vgmstream->current_block_offset +
(off_t)block_size;
}

View File

@ -14,6 +14,8 @@ void xa_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream); void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void eacs_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void caf_block_update(off_t block_offset, VGMSTREAM * vgmstream); void caf_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void wsi_block_update(off_t block_offset, VGMSTREAM * vgmstream); void wsi_block_update(off_t block_offset, VGMSTREAM * vgmstream);

View File

@ -43,7 +43,7 @@ void str_snds_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
vgmstream->current_block_offset = SSMP_offset; vgmstream->current_block_offset = SSMP_offset;
vgmstream->current_block_size = (read_32bitBE( vgmstream->current_block_size = (read_32bitBE(
vgmstream->current_block_offset+4, vgmstream->current_block_offset+4,
vgmstream->ch[0].streamfile) - 0x18) * vgmstream->channels; vgmstream->ch[0].streamfile) - 0x18) / vgmstream->channels;
vgmstream->next_block_offset = vgmstream->current_block_offset + vgmstream->next_block_offset = vgmstream->current_block_offset +
read_32bitBE(vgmstream->current_block_offset+4, read_32bitBE(vgmstream->current_block_offset+4,
vgmstream->ch[0].streamfile); vgmstream->ch[0].streamfile);

View File

@ -230,6 +230,10 @@
RelativePath=".\meta\ea_header.c" RelativePath=".\meta\ea_header.c"
> >
</File> </File>
<File
RelativePath=".\meta\ea_old.c"
>
</File>
<File <File
RelativePath=".\meta\fsb.c" RelativePath=".\meta\fsb.c"
> >

View File

@ -16,8 +16,11 @@
#define EAXA_R3 0x03 #define EAXA_R3 0x03
// Compression Type // Compression Type
#define EA_VAG 0x01 #define EA_VAG 0x01
#define EA_EAXA 0x0A #define EA_EAXA 0x0A
#define EA_ADPCM 0x30
#define EA_PCM_BE 0x07
#define EA_PCM_LE 0x08
typedef struct { typedef struct {
int32_t num_samples; int32_t num_samples;
@ -52,7 +55,7 @@ void Parse_Header(STREAMFILE* streamFile,EA_STRUCT* ea, off_t offset, int length
// default value ... // default value ...
ea->channels=1; ea->channels=1;
ea->compression_type=EA_EAXA; ea->compression_type=0;
ea->compression_version=0x01; ea->compression_version=0x01;
ea->platform=EA_GC; ea->platform=EA_GC;
@ -85,6 +88,7 @@ void Parse_Header(STREAMFILE* streamFile,EA_STRUCT* ea, off_t offset, int length
break; break;
case 0x83: // compression type case 0x83: // compression type
ea->compression_type = (uint8_t)readPatch(streamFile, &offset); ea->compression_type = (uint8_t)readPatch(streamFile, &offset);
if(ea->compression_type==0x07) ea->compression_type=0x30;
break; break;
case 0x84: // sample frequency case 0x84: // sample frequency
ea->sample_rate = readPatch(streamFile,&offset); ea->sample_rate = readPatch(streamFile,&offset);
@ -92,6 +96,10 @@ void Parse_Header(STREAMFILE* streamFile,EA_STRUCT* ea, off_t offset, int length
case 0x85: // samples count case 0x85: // samples count
ea->num_samples = readPatch(streamFile, &offset); ea->num_samples = readPatch(streamFile, &offset);
break; break;
case 0x8A:
offset+=4;
if(ea->compression_type==0) ea->compression_type=EA_PCM_LE;
break;
case 0x86: case 0x86:
case 0x87: case 0x87:
case 0x8C: case 0x8C:
@ -111,6 +119,8 @@ void Parse_Header(STREAMFILE* streamFile,EA_STRUCT* ea, off_t offset, int length
if(ea->platform==EA_PSX) if(ea->platform==EA_PSX)
ea->compression_type=EA_VAG; ea->compression_type=EA_VAG;
if(ea->compression_type==0)
ea->compression_type=EA_EAXA;
} }
VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
@ -197,6 +207,16 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
vgmstream->coding_type=coding_PSX; vgmstream->coding_type=coding_PSX;
vgmstream->layout_type=layout_ea_blocked; vgmstream->layout_type=layout_ea_blocked;
break; break;
case EA_PCM_LE:
vgmstream->meta_type=meta_EA_PCM;
vgmstream->coding_type=coding_PCM16LE_NI;
vgmstream->layout_type=layout_ea_blocked;
break;
case EA_ADPCM:
vgmstream->meta_type=meta_EA_ADPCM;
vgmstream->coding_type=coding_EA_ADPCM;
vgmstream->layout_type=layout_ea_blocked;
break;
} }
@ -227,6 +247,10 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
ea_block_update(vgmstream->next_block_offset,vgmstream); ea_block_update(vgmstream->next_block_offset,vgmstream);
if(vgmstream->coding_type==coding_PSX) if(vgmstream->coding_type==coding_PSX)
vgmstream->num_samples+=(int32_t)vgmstream->current_block_size/16*28; vgmstream->num_samples+=(int32_t)vgmstream->current_block_size/16*28;
else if (vgmstream->coding_type==coding_EA_ADPCM)
vgmstream->num_samples+=(int32_t)vgmstream->current_block_size;
else if (vgmstream->coding_type==coding_PCM16LE_NI)
vgmstream->num_samples+=(int32_t)vgmstream->current_block_size/vgmstream->channels;
else else
vgmstream->num_samples+=(int32_t)vgmstream->current_block_size*28; vgmstream->num_samples+=(int32_t)vgmstream->current_block_size*28;
} while(vgmstream->next_block_offset<(off_t)(file_length-block_length)); } while(vgmstream->next_block_offset<(off_t)(file_length-block_length));
@ -234,6 +258,10 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
ea_block_update(start_offset+header_length,vgmstream); ea_block_update(start_offset+header_length,vgmstream);
init_ea_adpcm_nibble();
vgmstream->ch[0].adpcm_history1_32=0;
vgmstream->ch[1].adpcm_history1_32=0;
return vgmstream; return vgmstream;
/* clean up anything we may have opened */ /* clean up anything we may have opened */

160
src/meta/ea_old.c Normal file
View File

@ -0,0 +1,160 @@
#include "meta.h"
#include "../util.h"
typedef struct
{
char szID[4];
int dwSampleRate;
char bBits;
char bChannels;
char bCompression;
char bType;
int dwNumSamples;
int dwLoopStart;
int dwLoopLength;
int dwDataStart;
int dwUnknown;
} EACSHeader;
VGMSTREAM * init_vgmstream_eacs(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
int channel_count;
int loop_flag;
char little_endian=0;
off_t start_offset;
EACSHeader *ea_header;
int32_t samples_count=0;
int i;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("cnk",filename_extension(filename)) &&
strcasecmp("as4",filename_extension(filename)) &&
strcasecmp("asf",filename_extension(filename))) goto fail;
ea_header=(EACSHeader *)malloc(sizeof(EACSHeader));
/* check header */
if ((uint32_t)read_32bitBE(0,streamFile)!=0x31534E68) /* "1SNh" */
goto fail;
/* check if we are little or big endian */
if ((uint32_t)read_32bitBE(4,streamFile)<0x40)
little_endian=1;
/* check type details */
start_offset = read_32bitLE(0x04,streamFile);
if((uint32_t)read_32bitBE(0x08,streamFile)==0x45414353) { /* EACS */
read_streamfile((uint8_t*)ea_header,0x08,sizeof(EACSHeader),streamFile);
loop_flag = 0; //(ea_header->dwLoopStart!=0);
channel_count = (ea_header->bChannels);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,0);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
init_eacs_high_nibble();
vgmstream->sample_rate = ea_header->dwSampleRate;
if(ea_header->bCompression==0) {
vgmstream->coding_type = coding_PCM16LE_NI;
if(ea_header->bBits==1)
vgmstream->coding_type = coding_PCM8_NI;
}
else
vgmstream->coding_type = coding_EACS_IMA;
vgmstream->layout_type = layout_eacs_blocked;
vgmstream->meta_type = meta_EACS_PC;
if(little_endian)
vgmstream->meta_type = meta_EACS_SAT;
} else {
channel_count=read_32bitLE(0x20,streamFile);
vgmstream = allocate_vgmstream(channel_count,0);
if (!vgmstream) goto fail;
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type=layout_eacs_blocked;
vgmstream->meta_type=meta_EACS_PSX;
}
vgmstream->ea_platform=little_endian;
/* open the file for reading by each channel */
{
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
if (!vgmstream->ch[i].streamfile) goto fail;
}
}
// calc the samples length ...
if(little_endian)
vgmstream->next_block_offset=read_32bitBE(0x04,streamFile);
else
vgmstream->next_block_offset=read_32bitLE(0x04,streamFile);
if(vgmstream->next_block_offset>0x30) {
vgmstream->current_block_size=vgmstream->next_block_offset-sizeof(EACSHeader);
samples_count=(int32_t)vgmstream->current_block_size/get_vgmstream_frame_size(vgmstream)*get_vgmstream_samples_per_frame(vgmstream);
samples_count/=vgmstream->channels;
}
do {
if(read_32bitBE(vgmstream->next_block_offset,vgmstream->ch[0].streamfile)==0x31534E6C) {
ea_header->dwLoopStart=read_32bitLE(vgmstream->next_block_offset+0x08,vgmstream->ch[0].streamfile);
vgmstream->next_block_offset+=0x0C;
}
if(read_32bitBE(vgmstream->next_block_offset,vgmstream->ch[0].streamfile)==0x31534E65)
break;
eacs_block_update(vgmstream->next_block_offset,vgmstream);
samples_count+=vgmstream->current_block_size/get_vgmstream_frame_size(vgmstream)*get_vgmstream_samples_per_frame(vgmstream);
} while(vgmstream->next_block_offset<get_streamfile_size(streamFile)-8);
// Reset values ...
// setting up the first header by calling the eacs_block_update sub
if(little_endian)
vgmstream->next_block_offset=read_32bitBE(0x04,streamFile);
else
vgmstream->next_block_offset=read_32bitLE(0x04,streamFile);
vgmstream->current_block_size=vgmstream->next_block_offset-sizeof(EACSHeader);
if(vgmstream->coding_type!=coding_PSX)
vgmstream->current_block_size-=8;
if(vgmstream->coding_type==coding_PSX)
eacs_block_update(0x2C,vgmstream);
else
eacs_block_update(0x28,vgmstream);
// re-allocate the sample count
vgmstream->num_samples=samples_count;
if(loop_flag) {
vgmstream->loop_start_sample = ea_header->dwLoopStart;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
if(ea_header)
free(ea_header);
return vgmstream;
/* clean up anything we may have opened */
fail:
if(ea_header)
free(ea_header);
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -113,6 +113,8 @@ VGMSTREAM * init_vgmstream_pos(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_nwa(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_nwa(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_eacs(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_xss(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_xss(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_sl3(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_sl3(STREAMFILE * streamFile);

View File

@ -87,6 +87,8 @@ VGMSTREAM * init_vgmstream_str_snds(STREAMFILE *streamFile) {
* 0x10; * 0x10;
} }
vgmstream->num_samples/=vgmstream->channels;
vgmstream->sample_rate = read_32bitBE(SHDR_offset+0x1c,streamFile); vgmstream->sample_rate = read_32bitBE(SHDR_offset+0x1c,streamFile);
switch (read_32bitBE(SHDR_offset+0x24,streamFile)) { switch (read_32bitBE(SHDR_offset+0x24,streamFile)) {
case 0x53445832: /* SDX2 */ case 0x53445832: /* SDX2 */

View File

@ -72,6 +72,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_riff, init_vgmstream_riff,
init_vgmstream_pos, init_vgmstream_pos,
init_vgmstream_nwa, init_vgmstream_nwa,
init_vgmstream_eacs,
init_vgmstream_xss, init_vgmstream_xss,
init_vgmstream_sl3, init_vgmstream_sl3,
init_vgmstream_hgc1, init_vgmstream_hgc1,
@ -320,6 +321,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_halpst_blocked: case layout_halpst_blocked:
case layout_xa_blocked: case layout_xa_blocked:
case layout_ea_blocked: case layout_ea_blocked:
case layout_eacs_blocked:
case layout_caf_blocked: case layout_caf_blocked:
case layout_wsi_blocked: case layout_wsi_blocked:
case layout_str_snds_blocked: case layout_str_snds_blocked:
@ -339,8 +341,10 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
case coding_NGC_DSP: case coding_NGC_DSP:
return 14; return 14;
case coding_PCM16LE: case coding_PCM16LE:
case coding_PCM16LE_NI:
case coding_PCM16BE: case coding_PCM16BE:
case coding_PCM8: case coding_PCM8:
case coding_PCM8_NI:
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
case coding_ogg_vorbis: case coding_ogg_vorbis:
#endif #endif
@ -364,6 +368,7 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
return 28; return 28;
case coding_G721: case coding_G721:
case coding_DVI_IMA: case coding_DVI_IMA:
case coding_EACS_IMA:
case coding_IMA: case coding_IMA:
return 1; return 1;
case coding_NGC_AFC: case coding_NGC_AFC:
@ -376,6 +381,8 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
return 64; return 64;
case coding_EAXA: case coding_EAXA:
return 28; return 28;
case coding_EA_ADPCM:
return 14*vgmstream->channels;
case coding_WS: case coding_WS:
/* only works if output sample size is 8 bit, which is always /* only works if output sample size is 8 bit, which is always
is for WS ADPCM */ is for WS ADPCM */
@ -401,15 +408,19 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
case coding_NGC_DSP: case coding_NGC_DSP:
return 8; return 8;
case coding_PCM16LE: case coding_PCM16LE:
case coding_PCM16LE_NI:
case coding_PCM16BE: case coding_PCM16BE:
return 2; return 2;
case coding_PCM8: case coding_PCM8:
case coding_PCM8_NI:
case coding_SDX2: case coding_SDX2:
return 1; return 1;
case coding_NDS_IMA: case coding_NDS_IMA:
return vgmstream->interleave_block_size; return vgmstream->interleave_block_size;
case coding_NGC_DTK: case coding_NGC_DTK:
return 32; return 32;
case coding_EACS_IMA:
return 1;
case coding_DVI_IMA: case coding_DVI_IMA:
case coding_IMA: case coding_IMA:
case coding_G721: case coding_G721:
@ -423,6 +434,8 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
return 14*vgmstream->channels; return 14*vgmstream->channels;
case coding_XBOX: case coding_XBOX:
return 36; return 36;
case coding_EA_ADPCM:
return 30;
case coding_EAXA: case coding_EAXA:
return 1; // the frame is variant in size return 1; // the frame is variant in size
case coding_WS: case coding_WS:
@ -481,6 +494,13 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
samples_to_do); samples_to_do);
} }
break; break;
case coding_PCM16LE_NI:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_pcm16LE_noninterleaved(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do);
}
break;
case coding_PCM16BE: case coding_PCM16BE:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
decode_pcm16BE(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, decode_pcm16BE(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
@ -495,6 +515,13 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
samples_to_do); samples_to_do);
} }
break; break;
case coding_PCM8_NI:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_pcm8_noninterleaved(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do);
}
break;
case coding_NDS_IMA: case coding_NDS_IMA:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
decode_nds_ima(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, decode_nds_ima(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
@ -558,6 +585,13 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
samples_to_do,chan); samples_to_do,chan);
} }
break; break;
case coding_EA_ADPCM:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_ea_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do,chan);
}
break;
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
case coding_ogg_vorbis: case coding_ogg_vorbis:
decode_ogg_vorbis(vgmstream->codec_data, decode_ogg_vorbis(vgmstream->codec_data,
@ -578,6 +612,13 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
vgmstream->channels,vgmstream->samples_into_block, vgmstream->channels,vgmstream->samples_into_block,
samples_to_do); samples_to_do);
} }
break;
case coding_EACS_IMA:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_eacs_ima(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do);
}
break; break;
case coding_IMA: case coding_IMA:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
@ -774,9 +815,15 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case coding_PCM16LE: case coding_PCM16LE:
snprintf(temp,TEMPSIZE,"Little Endian 16-bit PCM"); snprintf(temp,TEMPSIZE,"Little Endian 16-bit PCM");
break; break;
case coding_PCM16LE_NI:
snprintf(temp,TEMPSIZE,"Non Interleaved Little Endian 16-bit PCM");
break;
case coding_PCM8: case coding_PCM8:
snprintf(temp,TEMPSIZE,"8-bit PCM"); snprintf(temp,TEMPSIZE,"8-bit PCM");
break; break;
case coding_PCM8_NI:
snprintf(temp,TEMPSIZE,"Non Interleaved 8-bit PCM");
break;
case coding_NGC_DSP: case coding_NGC_DSP:
snprintf(temp,TEMPSIZE,"Gamecube \"DSP\" 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"Gamecube \"DSP\" 4-bit ADPCM");
break; break;
@ -810,6 +857,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case coding_EAXA: case coding_EAXA:
snprintf(temp,TEMPSIZE,"Electronic Arts XA Based 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"Electronic Arts XA Based 4-bit ADPCM");
break; break;
case coding_EA_ADPCM:
snprintf(temp,TEMPSIZE,"Electronic Arts XA Based (R1) 4-bit ADPCM");
break;
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
case coding_ogg_vorbis: case coding_ogg_vorbis:
snprintf(temp,TEMPSIZE,"Vorbis"); snprintf(temp,TEMPSIZE,"Vorbis");
@ -820,6 +870,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break; break;
case coding_DVI_IMA: case coding_DVI_IMA:
snprintf(temp,TEMPSIZE,"Intel DVI 4-bit IMA ADPCM"); snprintf(temp,TEMPSIZE,"Intel DVI 4-bit IMA ADPCM");
break;
case coding_EACS_IMA:
snprintf(temp,TEMPSIZE,"EACS 4-bit IMA ADPCM");
break; break;
case coding_IMA: case coding_IMA:
snprintf(temp,TEMPSIZE,"4-bit IMA ADPCM"); snprintf(temp,TEMPSIZE,"4-bit IMA ADPCM");
@ -894,6 +947,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break; break;
case layout_ea_blocked: case layout_ea_blocked:
snprintf(temp,TEMPSIZE,"Electronic Arts Audio Blocks"); snprintf(temp,TEMPSIZE,"Electronic Arts Audio Blocks");
break;
case layout_eacs_blocked:
snprintf(temp,TEMPSIZE,"Electronic Arts (Old Version) Audio Blocks");
break; break;
case layout_caf_blocked: case layout_caf_blocked:
snprintf(temp,TEMPSIZE,"CAF blocked"); snprintf(temp,TEMPSIZE,"CAF blocked");
@ -1085,9 +1141,15 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break; break;
case meta_EAXA_R3: case meta_EAXA_R3:
snprintf(temp,TEMPSIZE,"Electronic Arts XA R3"); snprintf(temp,TEMPSIZE,"Electronic Arts XA R3");
break;
case meta_EA_ADPCM:
snprintf(temp,TEMPSIZE,"Electronic Arts XA R1");
break; break;
case meta_EAXA_PSX: case meta_EAXA_PSX:
snprintf(temp,TEMPSIZE,"Electronic Arts With PSX ADPCM"); snprintf(temp,TEMPSIZE,"Electronic Arts With PSX ADPCM");
break;
case meta_EA_PCM:
snprintf(temp,TEMPSIZE,"Electronic Arts With PCM");
break; break;
case meta_CFN: case meta_CFN:
snprintf(temp,TEMPSIZE,"Namco CAF Header"); snprintf(temp,TEMPSIZE,"Namco CAF Header");
@ -1164,6 +1226,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break; break;
case meta_RWS: case meta_RWS:
snprintf(temp,TEMPSIZE,"RWS Header"); snprintf(temp,TEMPSIZE,"RWS Header");
break;
case meta_EACS_PC:
snprintf(temp,TEMPSIZE,"EACS Header (PC)");
break;
case meta_EACS_PSX:
snprintf(temp,TEMPSIZE,"EACS Header (PSX)");
break; break;
case meta_RSD: case meta_RSD:
snprintf(temp,TEMPSIZE,"RSD4 or RSD6 Header"); snprintf(temp,TEMPSIZE,"RSD4 or RSD6 Header");

View File

@ -26,8 +26,12 @@ typedef enum {
/* 16-bit PCM */ /* 16-bit PCM */
coding_PCM16BE, /* big endian 16-bit PCM */ coding_PCM16BE, /* big endian 16-bit PCM */
coding_PCM16LE, /* little endian 16-bit PCM */ coding_PCM16LE, /* little endian 16-bit PCM */
coding_PCM16LE_NI, /* little endian 16-bit non interleaved */
/* 8-bit PCM */ /* 8-bit PCM */
coding_PCM8, /* 8-bit PCM */ coding_PCM8, /* 8-bit PCM */
coding_PCM8_NI, /* Signed 8-Bit PCM */
/* 4-bit ADPCM */ /* 4-bit ADPCM */
coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */ coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */
coding_CRI_ADX, /* CRI ADX */ coding_CRI_ADX, /* CRI ADX */
@ -40,11 +44,14 @@ typedef enum {
coding_XA, /* PSX CD-XA */ coding_XA, /* PSX CD-XA */
coding_XBOX, /* XBOX IMA */ coding_XBOX, /* XBOX IMA */
coding_EAXA, /* EA/XA ADPCM */ coding_EAXA, /* EA/XA ADPCM */
coding_EA_ADPCM, /* EA ADPCM */
#ifdef VGM_USE_VORBIS #ifdef VGM_USE_VORBIS
coding_ogg_vorbis, /* vorbis */ coding_ogg_vorbis, /* vorbis */
#endif #endif
coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression */ coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression */
coding_DVI_IMA, /* DVI (bare IMA, high nibble first), aka ADP4 */ coding_DVI_IMA, /* DVI (bare IMA, high nibble first), aka ADP4 */
coding_EACS_IMA,
coding_IMA, /* bare IMA, low nibble first */ coding_IMA, /* bare IMA, low nibble first */
coding_WS, /* Westwood Studios' custom VBR ADPCM */ coding_WS, /* Westwood Studios' custom VBR ADPCM */
#ifdef VGM_USE_MPEG #ifdef VGM_USE_MPEG
@ -77,6 +84,7 @@ typedef enum {
layout_halpst_blocked, /* blocks with HALPST-format header */ layout_halpst_blocked, /* blocks with HALPST-format header */
layout_xa_blocked, layout_xa_blocked,
layout_ea_blocked, layout_ea_blocked,
layout_eacs_blocked,
layout_caf_blocked, layout_caf_blocked,
layout_wsi_blocked, layout_wsi_blocked,
layout_str_snds_blocked, layout_str_snds_blocked,
@ -172,6 +180,11 @@ typedef enum {
meta_EAXA_R2, /* EA XA Release 2 */ meta_EAXA_R2, /* EA XA Release 2 */
meta_EAXA_R3, /* EA XA Release 3 */ meta_EAXA_R3, /* EA XA Release 3 */
meta_EAXA_PSX, /* EA with PSX ADPCM */ meta_EAXA_PSX, /* EA with PSX ADPCM */
meta_EACS_PC, /* EACS PC */
meta_EACS_PSX, /* EACS PSX */
meta_EACS_SAT, /* EACS SATURN */
meta_EA_ADPCM, /* EA XA ADPCM */
meta_EA_PCM, /* EA PCM */
meta_RAW, /* RAW PCM file */ meta_RAW, /* RAW PCM file */

View File

@ -127,6 +127,8 @@ char * extension_list[] = {
"svs\0SVS Audio File (*.SVS)\0", "svs\0SVS Audio File (*.SVS)\0",
"pos\0POS Audio File (*.POS)\0", "pos\0POS Audio File (*.POS)\0",
"nwa\0NWA Audio File (*.NWA)\0", "nwa\0NWA Audio File (*.NWA)\0",
"cnk\0CNK Audio File (*.CNK)\0",
"as4\0AS4 Audio File (*.AS4)\0",
"xss\0XSS Audio File (*.XSS)\0", "xss\0XSS Audio File (*.XSS)\0",
"sl3\0SL3 Audio File (*.SL3)\0", "sl3\0SL3 Audio File (*.SL3)\0",
"hgc1\0HGC1 Audio File (*.HGC1)\0", "hgc1\0HGC1 Audio File (*.HGC1)\0",