mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 09:40:51 +01:00
some naming changes and such to make hcs happy, hopefully didn't break anything
changed _noninterleaved functions to _int and changed related descriptions appropriately added an _int version of SDX2 and reverted to pre-322 behavior for normal deocder made the various get_high_nibble globals all be the same vgmstream->get_high_nibble for thread safety and code consolidation (this required some changes to make decode functions take VGMSTREAM rather than VGMSTREAMCHANNEL) git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@323 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
8a5d2b6429
commit
1eba859222
@ -80,7 +80,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/fsb.o \
|
||||
meta/rsd.o \
|
||||
meta/rwx.o \
|
||||
meta/xwb.o
|
||||
meta/xwb.o \
|
||||
meta/ea_old.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -11,7 +11,7 @@ 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_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_eacs_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_eacs_ima(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
|
||||
|
||||
void decode_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
|
||||
@ -25,25 +25,27 @@ 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_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_pcm16LE_int(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_noninterleaved(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_pcm8_int(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_invert_psx(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_xa(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
|
||||
void init_get_high_nibble(VGMSTREAM * vgmstream);
|
||||
|
||||
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);
|
||||
void decode_ea_adpcm(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
|
||||
|
||||
#ifdef VGM_USE_VORBIS
|
||||
void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
|
||||
#endif
|
||||
|
||||
void decode_sdx2(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_sdx2_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
|
||||
void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
|
||||
|
@ -14,8 +14,6 @@ long EA_TABLE[20]= { 0x00000000, 0x000000F0, 0x000001CC, 0x00000188,
|
||||
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) {
|
||||
uint8_t frame_info;
|
||||
int32_t sample_count;
|
||||
@ -74,35 +72,32 @@ void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
void decode_ea_adpcm(VGMSTREAM * vgmstream, 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;
|
||||
VGMSTREAMCHANNEL *stream = &(vgmstream->ch[channel]);
|
||||
off_t channel_offset=stream->channel_start_offset;
|
||||
|
||||
ea_adpcm_get_high_nibble=!ea_adpcm_get_high_nibble;
|
||||
vgmstream->get_high_nibble=!vgmstream->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];
|
||||
coef1 = EA_TABLE[(vgmstream->get_high_nibble? frame_info & 0x0F: frame_info >> 4)];
|
||||
coef2 = EA_TABLE[(vgmstream->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;
|
||||
shift = (vgmstream->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?
|
||||
int32_t sample = ((((vgmstream->get_high_nibble?
|
||||
sample_byte & 0x0F:
|
||||
sample_byte >> 4
|
||||
) << 0x1C) >> shift) +
|
||||
|
@ -27,8 +27,6 @@ const int IMA_IndexTable[16] =
|
||||
-1, -1, -1, -1, 2, 4, 6, 8
|
||||
};
|
||||
|
||||
static int get_eacs_high_nibble=1;
|
||||
|
||||
void decode_nds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
int i=first_sample;
|
||||
int32_t sample_count;
|
||||
@ -158,21 +156,19 @@ void decode_dvi_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspaci
|
||||
stream->adpcm_step_index=step_index;
|
||||
}
|
||||
|
||||
void init_eacs_high_nibble() {
|
||||
get_eacs_high_nibble=1;
|
||||
}
|
||||
|
||||
void decode_eacs_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
void decode_eacs_ima(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) {
|
||||
int i;
|
||||
VGMSTREAMCHANNEL * stream = &(vgmstream->ch[channel]);
|
||||
|
||||
int32_t sample_count=0;
|
||||
int32_t hist1=stream->adpcm_history1_32;
|
||||
int step_index = stream->adpcm_step_index;
|
||||
|
||||
get_eacs_high_nibble=!get_eacs_high_nibble;
|
||||
vgmstream->get_high_nibble=!vgmstream->get_high_nibble;
|
||||
|
||||
if((first_sample) && (channelspacing==1))
|
||||
get_eacs_high_nibble=!get_eacs_high_nibble;
|
||||
vgmstream->get_high_nibble=!vgmstream->get_high_nibble;
|
||||
|
||||
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
||||
int step = ADPCMTable[step_index];
|
||||
@ -183,7 +179,7 @@ void decode_eacs_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspac
|
||||
|
||||
sample_byte = read_8bit(stream->offset+i,stream->streamfile);
|
||||
/* old-style DVI takes high nibble first */
|
||||
sample_nibble = (sample_byte >> (get_eacs_high_nibble?0:4))&0xf;
|
||||
sample_nibble = (sample_byte >> (vgmstream->get_high_nibble?0:4))&0xf;
|
||||
|
||||
sample_decoded = hist1;
|
||||
delta = step >> 3;
|
||||
|
@ -28,7 +28,7 @@ void decode_pcm8(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
|
||||
}
|
||||
}
|
||||
|
||||
void decode_pcm8_noninterleaved(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
void decode_pcm8_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
|
||||
@ -37,7 +37,7 @@ void decode_pcm8_noninterleaved(VGMSTREAMCHANNEL * stream, sample * outbuf, int
|
||||
}
|
||||
}
|
||||
|
||||
void decode_pcm16LE_noninterleaved(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
void decode_pcm16LE_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
|
||||
|
@ -39,6 +39,25 @@ void decode_sdx2(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
|
||||
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);
|
||||
int16_t sample;
|
||||
|
||||
if (!(sample_byte & 1)) hist = 0;
|
||||
sample = hist + squares[sample_byte+128];
|
||||
|
||||
hist = outbuf[sample_count] = clamp16(sample);
|
||||
}
|
||||
stream->adpcm_history1_32=hist;
|
||||
}
|
||||
|
||||
void decode_sdx2_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
|
||||
int32_t hist = stream->adpcm_history1_32;
|
||||
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
|
||||
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*channelspacing,stream->streamfile);
|
||||
int16_t sample;
|
||||
|
@ -20,14 +20,13 @@ int CLAMP(int value, int Minim, int Maxim)
|
||||
return value;
|
||||
}
|
||||
|
||||
static int get_high_nibble = 1;
|
||||
|
||||
void init_get_high_nibble() {
|
||||
get_high_nibble=1;
|
||||
void init_get_high_nibble(VGMSTREAM *vgmstream) {
|
||||
vgmstream->get_high_nibble=1;
|
||||
}
|
||||
|
||||
void decode_xa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
void decode_xa(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) {
|
||||
|
||||
VGMSTREAMCHANNEL * stream = &(vgmstream->ch[channel]);
|
||||
int predict_nr, shift_factor, sample;
|
||||
int32_t hist1=stream->adpcm_history1_32;
|
||||
int32_t hist2=stream->adpcm_history2_32;
|
||||
@ -39,20 +38,21 @@ void decode_xa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, i
|
||||
|
||||
int framesin = first_sample / (56 / channelspacing);
|
||||
|
||||
|
||||
first_sample = first_sample % 28;
|
||||
|
||||
get_high_nibble=!get_high_nibble;
|
||||
vgmstream->get_high_nibble=!vgmstream->get_high_nibble;
|
||||
|
||||
if((first_sample) && (channelspacing==1))
|
||||
get_high_nibble=!get_high_nibble;
|
||||
vgmstream->get_high_nibble=!vgmstream->get_high_nibble;
|
||||
|
||||
predict_nr = read_8bit(stream->offset+HeadTable[framesin]+get_high_nibble,stream->streamfile) >> 4;
|
||||
shift_factor = read_8bit(stream->offset+HeadTable[framesin]+get_high_nibble,stream->streamfile) & 0xf;
|
||||
predict_nr = read_8bit(stream->offset+HeadTable[framesin]+vgmstream->get_high_nibble,stream->streamfile) >> 4;
|
||||
shift_factor = read_8bit(stream->offset+HeadTable[framesin]+vgmstream->get_high_nibble,stream->streamfile) & 0xf;
|
||||
|
||||
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
||||
short sample_byte = (short)read_8bit(stream->offset+16+framesin+(i*4),stream->streamfile);
|
||||
|
||||
scale = ((get_high_nibble ?
|
||||
scale = ((vgmstream->get_high_nibble ?
|
||||
sample_byte >> 4 :
|
||||
sample_byte & 0x0f)<<12);
|
||||
|
||||
|
@ -1,14 +1,12 @@
|
||||
#include "layout.h"
|
||||
#include "../coding/coding.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 */
|
||||
void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
int i;
|
||||
|
||||
init_ea_adpcm_nibble();
|
||||
init_get_high_nibble(vgmstream);
|
||||
|
||||
// Search for next SCDL or SCEl block ...
|
||||
do {
|
||||
@ -48,10 +46,10 @@ void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
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);
|
||||
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) {
|
||||
if(vgmstream->coding_type==coding_PCM16LE_int) {
|
||||
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);
|
||||
@ -108,7 +106,7 @@ void eacs_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
vgmstream->current_block_size=block_size-8;
|
||||
|
||||
if(vgmstream->coding_type==coding_EACS_IMA) {
|
||||
init_eacs_high_nibble();
|
||||
init_get_high_nibble(vgmstream);
|
||||
vgmstream->current_block_size=read_32bitLE(block_offset,vgmstream->ch[0].streamfile);
|
||||
|
||||
for(i=0;i<vgmstream->channels;i++) {
|
||||
@ -123,7 +121,7 @@ void eacs_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
} else {
|
||||
|
||||
for (i=0;i<vgmstream->channels;i++) {
|
||||
if(vgmstream->coding_type==coding_PCM16LE_NI)
|
||||
if(vgmstream->coding_type==coding_PCM16LE_int)
|
||||
vgmstream->ch[i].offset = block_offset+(i*2);
|
||||
else
|
||||
vgmstream->ch[i].offset = block_offset+i;
|
||||
@ -133,4 +131,4 @@ void eacs_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
}
|
||||
vgmstream->next_block_offset = vgmstream->current_block_offset +
|
||||
(off_t)block_size;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include "layout.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
extern void init_get_high_nibble();
|
||||
|
||||
/* set up for the block at the given offset */
|
||||
void xa_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
|
||||
@ -10,7 +9,7 @@ void xa_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
int8_t currentChannel=0;
|
||||
int8_t subAudio=0;
|
||||
|
||||
init_get_high_nibble();
|
||||
init_get_high_nibble(vgmstream);
|
||||
|
||||
if(vgmstream->samples_into_block!=0)
|
||||
// don't change this variable in the init process
|
||||
|
@ -4,6 +4,6 @@ AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
|
||||
AM_MAKEFLAGS=-f Makefile.unix
|
||||
|
||||
libmeta_la_LDFLAGS =
|
||||
libmeta_la_SOURCES = Cstr.c adx_header.c afc_header.c agsc.c ast.c brstm.c ea_header.c gcsw.c halpst.c nds_strm.c ngc_adpdtk.c ngc_caf.c ngc_dsp_std.c ps2_ads.c ps2_exst.c ps2_ild.c ps2_int.c ps2_mib.c ps2_mic.c ps2_npsf.c ps2_pnb.c ps2_rxw.c ps2_str.c ps2_svag.c ps2_vag.c ps2_vpk.c psx_cdxa.c raw.c rs03.c rsf.c rwsd.c psx_gms.c xbox_xwav.c xbox_wavm.c genh.c ogg_vorbis_file.c ps2_bmdx.c aifc.c str_snds.c ws_aud.c ahx.c ivb.c svs.c riff.c pos.c nwa.c ps2_rws.c ps2_hgc1.c xss.c ps2_sl3.c ps2_aus.c fsb.c rsd.c rwx.c xwb.c
|
||||
libmeta_la_SOURCES = Cstr.c adx_header.c afc_header.c agsc.c ast.c brstm.c ea_header.c gcsw.c halpst.c nds_strm.c ngc_adpdtk.c ngc_caf.c ngc_dsp_std.c ps2_ads.c ps2_exst.c ps2_ild.c ps2_int.c ps2_mib.c ps2_mic.c ps2_npsf.c ps2_pnb.c ps2_rxw.c ps2_str.c ps2_svag.c ps2_vag.c ps2_vpk.c psx_cdxa.c raw.c rs03.c rsf.c rwsd.c psx_gms.c xbox_xwav.c xbox_wavm.c genh.c ogg_vorbis_file.c ps2_bmdx.c aifc.c str_snds.c ws_aud.c ahx.c ivb.c svs.c riff.c pos.c nwa.c ps2_rws.c ps2_hgc1.c xss.c ps2_sl3.c ps2_aus.c fsb.c rsd.c rwx.c xwb.c ea_old.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../util.h"
|
||||
|
||||
// Platform constants
|
||||
@ -209,7 +210,7 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
|
||||
break;
|
||||
case EA_PCM_LE:
|
||||
vgmstream->meta_type=meta_EA_PCM;
|
||||
vgmstream->coding_type=coding_PCM16LE_NI;
|
||||
vgmstream->coding_type=coding_PCM16LE_int;
|
||||
vgmstream->layout_type=layout_ea_blocked;
|
||||
break;
|
||||
case EA_ADPCM:
|
||||
@ -249,7 +250,7 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
|
||||
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)
|
||||
else if (vgmstream->coding_type==coding_PCM16LE_int)
|
||||
vgmstream->num_samples+=(int32_t)vgmstream->current_block_size/vgmstream->channels;
|
||||
else
|
||||
vgmstream->num_samples+=(int32_t)vgmstream->current_block_size*28;
|
||||
@ -258,7 +259,7 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
|
||||
|
||||
ea_block_update(start_offset+header_length,vgmstream);
|
||||
|
||||
init_ea_adpcm_nibble();
|
||||
init_get_high_nibble(vgmstream);
|
||||
vgmstream->ch[0].adpcm_history1_32=0;
|
||||
vgmstream->ch[1].adpcm_history1_32=0;
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../util.h"
|
||||
|
||||
typedef struct
|
||||
@ -23,7 +25,7 @@ VGMSTREAM * init_vgmstream_eacs(STREAMFILE *streamFile) {
|
||||
int loop_flag;
|
||||
char little_endian=0;
|
||||
off_t start_offset;
|
||||
EACSHeader *ea_header;
|
||||
EACSHeader *ea_header = NULL;
|
||||
int32_t samples_count=0;
|
||||
int i;
|
||||
|
||||
@ -56,14 +58,14 @@ VGMSTREAM * init_vgmstream_eacs(STREAMFILE *streamFile) {
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
init_eacs_high_nibble();
|
||||
init_get_high_nibble(vgmstream);
|
||||
|
||||
vgmstream->sample_rate = ea_header->dwSampleRate;
|
||||
|
||||
if(ea_header->bCompression==0) {
|
||||
vgmstream->coding_type = coding_PCM16LE_NI;
|
||||
vgmstream->coding_type = coding_PCM16LE_int;
|
||||
if(ea_header->bBits==1)
|
||||
vgmstream->coding_type = coding_PCM8_NI;
|
||||
vgmstream->coding_type = coding_PCM8_int;
|
||||
}
|
||||
else
|
||||
vgmstream->coding_type = coding_EACS_IMA;
|
||||
|
@ -126,6 +126,10 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
if (channel_count > 1)
|
||||
{
|
||||
if (coding == coding_SDX2) {
|
||||
coding = coding_SDX2_int;
|
||||
vgmstream->coding_type = coding_SDX2_int;
|
||||
}
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
} else {
|
||||
vgmstream->layout_type = layout_none;
|
||||
@ -161,6 +165,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
|
||||
case coding_PCM16BE:
|
||||
case coding_PCM16LE:
|
||||
case coding_SDX2:
|
||||
case coding_SDX2_int:
|
||||
case coding_DVI_IMA:
|
||||
case coding_PCM8:
|
||||
if (vgmstream->layout_type == layout_interleave) {
|
||||
|
@ -92,8 +92,11 @@ VGMSTREAM * init_vgmstream_str_snds(STREAMFILE *streamFile) {
|
||||
vgmstream->sample_rate = read_32bitBE(SHDR_offset+0x1c,streamFile);
|
||||
switch (read_32bitBE(SHDR_offset+0x24,streamFile)) {
|
||||
case 0x53445832: /* SDX2 */
|
||||
vgmstream->coding_type = coding_SDX2;
|
||||
vgmstream->interleave_block_size = 1;
|
||||
if (channel_count > 1) {
|
||||
vgmstream->coding_type = coding_SDX2_int;
|
||||
vgmstream->interleave_block_size = 1;
|
||||
} else
|
||||
vgmstream->coding_type = coding_SDX2;
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
|
@ -341,10 +341,10 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
|
||||
case coding_NGC_DSP:
|
||||
return 14;
|
||||
case coding_PCM16LE:
|
||||
case coding_PCM16LE_NI:
|
||||
case coding_PCM16LE_int:
|
||||
case coding_PCM16BE:
|
||||
case coding_PCM8:
|
||||
case coding_PCM8_NI:
|
||||
case coding_PCM8_int:
|
||||
#ifdef VGM_USE_VORBIS
|
||||
case coding_ogg_vorbis:
|
||||
#endif
|
||||
@ -361,6 +361,7 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
|
||||
case coding_MPEG25_L3:
|
||||
#endif
|
||||
case coding_SDX2:
|
||||
case coding_SDX2_int:
|
||||
return 1;
|
||||
case coding_NDS_IMA:
|
||||
return (vgmstream->interleave_block_size-4)*2;
|
||||
@ -408,12 +409,13 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
|
||||
case coding_NGC_DSP:
|
||||
return 8;
|
||||
case coding_PCM16LE:
|
||||
case coding_PCM16LE_NI:
|
||||
case coding_PCM16LE_int:
|
||||
case coding_PCM16BE:
|
||||
return 2;
|
||||
case coding_PCM8:
|
||||
case coding_PCM8_NI:
|
||||
case coding_PCM8_int:
|
||||
case coding_SDX2:
|
||||
case coding_SDX2_int:
|
||||
return 1;
|
||||
case coding_NDS_IMA:
|
||||
return vgmstream->interleave_block_size;
|
||||
@ -494,9 +496,9 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_PCM16LE_NI:
|
||||
case coding_PCM16LE_int:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_pcm16LE_noninterleaved(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
decode_pcm16LE_int(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
}
|
||||
@ -515,9 +517,9 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_PCM8_NI:
|
||||
case coding_PCM8_int:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_pcm8_noninterleaved(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
decode_pcm8_int(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
}
|
||||
@ -573,9 +575,9 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
break;
|
||||
case coding_XA:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_xa(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
decode_xa(vgmstream,buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
samples_to_do,chan);
|
||||
}
|
||||
break;
|
||||
case coding_EAXA:
|
||||
@ -587,7 +589,7 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
break;
|
||||
case coding_EA_ADPCM:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_ea_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
decode_ea_adpcm(vgmstream,buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do,chan);
|
||||
}
|
||||
@ -605,6 +607,13 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_SDX2_int:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_sdx2_int(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_DVI_IMA:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
@ -615,9 +624,9 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
break;
|
||||
case coding_EACS_IMA:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_eacs_ima(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
decode_eacs_ima(vgmstream,buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
samples_to_do,chan);
|
||||
}
|
||||
break;
|
||||
case coding_IMA:
|
||||
@ -815,14 +824,14 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case coding_PCM16LE:
|
||||
snprintf(temp,TEMPSIZE,"Little Endian 16-bit PCM");
|
||||
break;
|
||||
case coding_PCM16LE_NI:
|
||||
snprintf(temp,TEMPSIZE,"Non Interleaved Little Endian 16-bit PCM");
|
||||
case coding_PCM16LE_int:
|
||||
snprintf(temp,TEMPSIZE,"Little Endian 16-bit PCM with 2 byte interleave");
|
||||
break;
|
||||
case coding_PCM8:
|
||||
snprintf(temp,TEMPSIZE,"8-bit PCM");
|
||||
break;
|
||||
case coding_PCM8_NI:
|
||||
snprintf(temp,TEMPSIZE,"Non Interleaved 8-bit PCM");
|
||||
case coding_PCM8_int:
|
||||
snprintf(temp,TEMPSIZE,"8-bit PCM with 1 byte interleave");
|
||||
break;
|
||||
case coding_NGC_DSP:
|
||||
snprintf(temp,TEMPSIZE,"Gamecube \"DSP\" 4-bit ADPCM");
|
||||
@ -868,6 +877,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case coding_SDX2:
|
||||
snprintf(temp,TEMPSIZE,"Squareroot-delta-exact (SDX2) 8-bit DPCM");
|
||||
break;
|
||||
case coding_SDX2_int:
|
||||
snprintf(temp,TEMPSIZE,"Squareroot-delta-exact (SDX2) 8-bit DPCM with 1 byte interleave");
|
||||
break;
|
||||
case coding_DVI_IMA:
|
||||
snprintf(temp,TEMPSIZE,"Intel DVI 4-bit IMA ADPCM");
|
||||
break;
|
||||
|
@ -26,11 +26,13 @@ typedef enum {
|
||||
/* 16-bit PCM */
|
||||
coding_PCM16BE, /* big endian 16-bit PCM */
|
||||
coding_PCM16LE, /* little endian 16-bit PCM */
|
||||
coding_PCM16LE_NI, /* little endian 16-bit non interleaved */
|
||||
coding_PCM16LE_int, /* little endian 16-bit PCM with sample-level
|
||||
interleave handled by the decoder */
|
||||
|
||||
/* 8-bit PCM */
|
||||
coding_PCM8, /* 8-bit PCM */
|
||||
coding_PCM8_NI, /* Signed 8-Bit PCM */
|
||||
coding_PCM8_int, /* 8-Bit PCM with sample-level interleave handled
|
||||
by the decoder */
|
||||
|
||||
/* 4-bit ADPCM */
|
||||
coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */
|
||||
@ -50,6 +52,9 @@ typedef enum {
|
||||
coding_ogg_vorbis, /* vorbis */
|
||||
#endif
|
||||
coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression */
|
||||
coding_SDX2_int, /* SDX2 2:1 Squareroot-Delta-Exact compression,
|
||||
with smaple-level interleave handled by the
|
||||
decoder */
|
||||
coding_DVI_IMA, /* DVI (bare IMA, high nibble first), aka ADP4 */
|
||||
coding_EACS_IMA,
|
||||
coding_IMA, /* bare IMA, low nibble first */
|
||||
@ -284,6 +289,7 @@ typedef struct {
|
||||
|
||||
uint8_t xa_channel; /* Selected XA Channel */
|
||||
int32_t xa_sector_length; /* XA block */
|
||||
int8_t get_high_nibble;
|
||||
|
||||
uint8_t ea_big_endian; /* Big Endian ? */
|
||||
uint8_t ea_compression_type;
|
||||
|
Loading…
Reference in New Issue
Block a user