mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 09:40:51 +01:00
cleanup: remove tabs
This commit is contained in:
parent
333b7097c9
commit
abb9acaf4f
@ -1015,21 +1015,21 @@ size_t aac_get_samples(STREAMFILE* sf, off_t start_offset, size_t bytes) {
|
|||||||
|
|
||||||
/* variable-sized var reader */
|
/* variable-sized var reader */
|
||||||
static int mpc_get_size(uint8_t* header, int header_size, int pos, int32_t* p_size) {
|
static int mpc_get_size(uint8_t* header, int header_size, int pos, int32_t* p_size) {
|
||||||
uint8_t tmp;
|
uint8_t tmp;
|
||||||
int32_t size = 0;
|
int32_t size = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (pos >= header_size)
|
if (pos >= header_size)
|
||||||
return pos;
|
return pos;
|
||||||
|
|
||||||
tmp = header[pos];
|
tmp = header[pos];
|
||||||
size = (size << 7) | (tmp & 0x7F);
|
size = (size << 7) | (tmp & 0x7F);
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
while((tmp & 0x80));
|
while((tmp & 0x80));
|
||||||
|
|
||||||
*p_size = size;
|
*p_size = size;
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mpc_get_samples(STREAMFILE* sf, off_t offset, int32_t* p_samples, int32_t* p_delay) {
|
int mpc_get_samples(STREAMFILE* sf, off_t offset, int32_t* p_samples, int32_t* p_delay) {
|
||||||
|
@ -115,9 +115,9 @@ void decode_ea_mt(VGMSTREAM* vgmstream, sample_t* outbuf, int channelspacing, in
|
|||||||
* notify the decoder when a new substream begins (even with looping disabled). */
|
* notify the decoder when a new substream begins (even with looping disabled). */
|
||||||
if (ch_data->loop_sample > 0 && ch_data->samples_done == ch_data->loop_sample) {
|
if (ch_data->loop_sample > 0 && ch_data->samples_done == ch_data->loop_sample) {
|
||||||
ch_data->samples_filled = 0;
|
ch_data->samples_filled = 0;
|
||||||
ch_data->samples_discard = 0;
|
ch_data->samples_discard = 0;
|
||||||
|
|
||||||
/* offset is usually at loop_offset here, but not always (ex. loop_sample < 432) */
|
/* offset is usually at loop_offset here, but not always (ex. loop_sample < 432) */
|
||||||
ch_data->offset = ch_data->loop_offset;
|
ch_data->offset = ch_data->loop_offset;
|
||||||
utk_set_ptr(ctx, 0, 0); /* reset the buffer reader */
|
utk_set_ptr(ctx, 0, 0); /* reset the buffer reader */
|
||||||
utk_reset(ctx); /* decoder init (all fields must be reset, for some edge cases) */
|
utk_reset(ctx); /* decoder init (all fields must be reset, for some edge cases) */
|
||||||
|
@ -72,7 +72,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void decode_hca(hca_codec_data* data, sample_t* outbuf, int32_t samples_to_do) {
|
void decode_hca(hca_codec_data* data, sample_t* outbuf, int32_t samples_to_do) {
|
||||||
int samples_done = 0;
|
int samples_done = 0;
|
||||||
const unsigned int channels = data->info.channelCount;
|
const unsigned int channels = data->info.channelCount;
|
||||||
const unsigned int blockSize = data->info.blockSize;
|
const unsigned int blockSize = data->info.blockSize;
|
||||||
|
|
||||||
|
@ -30,25 +30,25 @@ void clHCA_delete(clHCA *);
|
|||||||
int clHCA_DecodeHeader(clHCA *, const void *data, unsigned int size);
|
int clHCA_DecodeHeader(clHCA *, const void *data, unsigned int size);
|
||||||
|
|
||||||
typedef struct clHCA_stInfo {
|
typedef struct clHCA_stInfo {
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
unsigned int headerSize;
|
unsigned int headerSize;
|
||||||
unsigned int samplingRate;
|
unsigned int samplingRate;
|
||||||
unsigned int channelCount;
|
unsigned int channelCount;
|
||||||
unsigned int blockSize;
|
unsigned int blockSize;
|
||||||
unsigned int blockCount;
|
unsigned int blockCount;
|
||||||
unsigned int encoderDelay; /* samples appended to the beginning */
|
unsigned int encoderDelay; /* samples appended to the beginning */
|
||||||
unsigned int encoderPadding; /* samples appended to the end */
|
unsigned int encoderPadding; /* samples appended to the end */
|
||||||
unsigned int loopEnabled;
|
unsigned int loopEnabled;
|
||||||
unsigned int loopStartBlock;
|
unsigned int loopStartBlock;
|
||||||
unsigned int loopEndBlock;
|
unsigned int loopEndBlock;
|
||||||
unsigned int loopStartDelay; /* samples in block before loop starts */
|
unsigned int loopStartDelay; /* samples in block before loop starts */
|
||||||
unsigned int loopEndPadding; /* samples in block after loop ends */
|
unsigned int loopEndPadding; /* samples in block after loop ends */
|
||||||
unsigned int samplesPerBlock; /* should be 1024 */
|
unsigned int samplesPerBlock; /* should be 1024 */
|
||||||
const char *comment;
|
const char *comment;
|
||||||
unsigned int encryptionEnabled; /* requires keycode */
|
unsigned int encryptionEnabled; /* requires keycode */
|
||||||
|
|
||||||
/* Derived sample formulas:
|
/* Derived sample formulas:
|
||||||
* - sample count: blockCount*samplesPerBlock - encoderDelay - encoderPadding;
|
* - sample count: blockCount*samplesPerBlock - encoderDelay - encoderPadding;
|
||||||
* - loop start sample = loopStartBlock*samplesPerBlock - encoderDelay + loopStartDelay
|
* - loop start sample = loopStartBlock*samplesPerBlock - encoderDelay + loopStartDelay
|
||||||
* - loop end sample = loopEndBlock*samplesPerBlock - encoderDelay + (samplesPerBlock - info.loopEndPadding)
|
* - loop end sample = loopEndBlock*samplesPerBlock - encoderDelay + (samplesPerBlock - info.loopEndPadding)
|
||||||
*/
|
*/
|
||||||
|
@ -289,8 +289,8 @@ imuse_codec_data* init_imuse(STREAMFILE* sf, int channels) {
|
|||||||
while (counter > 0) {
|
while (counter > 0) {
|
||||||
if (counter & i)
|
if (counter & i)
|
||||||
value += step;
|
value += step;
|
||||||
step >>= 1;
|
step >>= 1;
|
||||||
counter >>= 1;
|
counter >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->adpcm_table[i + j * 64] = value; /* non sequential: all 64 [0]s, [1]s ... [88]s */
|
data->adpcm_table[i + j * 64] = value; /* non sequential: all 64 [0]s, [1]s ... [88]s */
|
||||||
|
@ -250,11 +250,11 @@ static void decode_mpeg_standard(VGMSTREAMCHANNEL* stream, mpeg_codec_data* data
|
|||||||
data->bytes_in_buffer = read_streamfile(data->buffer,stream->offset,data->buffer_size,stream->streamfile);
|
data->bytes_in_buffer = read_streamfile(data->buffer,stream->offset,data->buffer_size,stream->streamfile);
|
||||||
|
|
||||||
/* end of stream, fill rest with 0s */
|
/* end of stream, fill rest with 0s */
|
||||||
if (data->bytes_in_buffer <= 0) {
|
if (data->bytes_in_buffer <= 0) {
|
||||||
VGM_ASSERT(samples_to_do < samples_done, "MPEG: end of stream, filling %i\n", (samples_to_do - samples_done));
|
VGM_ASSERT(samples_to_do < samples_done, "MPEG: end of stream, filling %i\n", (samples_to_do - samples_done));
|
||||||
memset(outbuf + samples_done * channels, 0, (samples_to_do - samples_done) * channels * sizeof(sample));
|
memset(outbuf + samples_done * channels, 0, (samples_to_do - samples_done) * channels * sizeof(sample));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->buffer_full = 1;
|
data->buffer_full = 1;
|
||||||
data->buffer_used = 0;
|
data->buffer_used = 0;
|
||||||
|
@ -26,8 +26,8 @@ extern void fft(int n, float* xRe, float* xIm, float* yRe, float* yIm);
|
|||||||
#define RELIC_MAX_SIZE RELIC_SIZE_HIGH
|
#define RELIC_MAX_SIZE RELIC_SIZE_HIGH
|
||||||
#define RELIC_MAX_FREQ (RELIC_MAX_SIZE / 2)
|
#define RELIC_MAX_FREQ (RELIC_MAX_SIZE / 2)
|
||||||
#define RELIC_MAX_FFT (RELIC_MAX_SIZE / 4)
|
#define RELIC_MAX_FFT (RELIC_MAX_SIZE / 4)
|
||||||
#define RELIC_MIN_BITRATE 256
|
#define RELIC_MIN_BITRATE 256
|
||||||
#define RELIC_MAX_BITRATE 2048
|
#define RELIC_MAX_BITRATE 2048
|
||||||
//#define RELIC_MAX_FRAME_SIZE ((RELIC_MAX_BITRATE / 8) + 0x04) /* extra 0x04 for the bitreader */
|
//#define RELIC_MAX_FRAME_SIZE ((RELIC_MAX_BITRATE / 8) + 0x04) /* extra 0x04 for the bitreader */
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,24 +6,22 @@
|
|||||||
|
|
||||||
/* Based on Valery V. Anisimovsky's WS-AUD.txt */
|
/* Based on Valery V. Anisimovsky's WS-AUD.txt */
|
||||||
|
|
||||||
static char WSTable2bit[4]={-2,-1,0,1};
|
static char WSTable2bit[4] = { -2,-1,0,1 };
|
||||||
static char WSTable4bit[16]={-9,-8,-6,-5,-4,-3,-2,-1,
|
static char WSTable4bit[16] = { -9,-8,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5 ,6, 8 };
|
||||||
0, 1, 2, 3, 4, 5 ,6, 8};
|
|
||||||
|
|
||||||
/* We pass in the VGMSTREAM here, unlike in other codings, because
|
/* We pass in the VGMSTREAM here, unlike in other codings, because
|
||||||
the decoder has to know about the block structure. */
|
the decoder has to know about the block structure. */
|
||||||
void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channelspacing, int32_t first_sample,
|
void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channelspacing, int32_t first_sample,
|
||||||
int32_t samples_to_do) {
|
int32_t samples_to_do) {
|
||||||
|
|
||||||
VGMSTREAMCHANNEL * stream = &(vgmstream->ch[channel]);
|
VGMSTREAMCHANNEL * stream = &(vgmstream->ch[channel]);
|
||||||
int16_t hist = stream->adpcm_history1_16;
|
int16_t hist = stream->adpcm_history1_16;
|
||||||
off_t offset = stream->offset;
|
off_t offset = stream->offset;
|
||||||
int samples_left_in_frame = stream->samples_left_in_frame;
|
int samples_left_in_frame = stream->samples_left_in_frame;
|
||||||
off_t header_off = stream->frame_header_offset;
|
off_t header_off = stream->frame_header_offset;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int32_t sample_count;
|
int32_t sample_count;
|
||||||
|
|
||||||
if (vgmstream->ws_output_size == vgmstream->current_block_size) {
|
if (vgmstream->ws_output_size == vgmstream->current_block_size) {
|
||||||
/* uncompressed, we just need to convert to 16-bit */
|
/* uncompressed, we just need to convert to 16-bit */
|
||||||
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing,offset++) {
|
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing,offset++) {
|
||||||
|
@ -855,7 +855,7 @@ static const coding_info coding_info_list[] = {
|
|||||||
{coding_FFmpeg, "FFmpeg"},
|
{coding_FFmpeg, "FFmpeg"},
|
||||||
#endif
|
#endif
|
||||||
#ifdef VGM_USE_FDKAAC
|
#ifdef VGM_USE_FDKAAC
|
||||||
{coding_MP4_AAC, "MPEG-4 AAC"},
|
{coding_MP4_AAC, "MPEG-4 AAC"},
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ void blocked_count_samples(VGMSTREAM* vgmstream, STREAMFILE* sf, off_t offset) {
|
|||||||
case coding_PCM8_U_int: block_samples = pcm8_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
case coding_PCM8_U_int: block_samples = pcm8_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
||||||
case coding_XBOX_IMA: block_samples = xbox_ima_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
case coding_XBOX_IMA: block_samples = xbox_ima_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
||||||
case coding_NGC_DSP: block_samples = dsp_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
case coding_NGC_DSP: block_samples = dsp_bytes_to_samples(vgmstream->current_block_size, 1); break;
|
||||||
case coding_PSX: block_samples = ps_bytes_to_samples(vgmstream->current_block_size,1); break;
|
case coding_PSX: block_samples = ps_bytes_to_samples(vgmstream->current_block_size,1); break;
|
||||||
default:
|
default:
|
||||||
VGM_LOG("BLOCKED: missing codec\n");
|
VGM_LOG("BLOCKED: missing codec\n");
|
||||||
return;
|
return;
|
||||||
|
@ -5,7 +5,7 @@ VGMSTREAM* init_vgmstream_adp_bos(STREAMFILE* sf) {
|
|||||||
VGMSTREAM* vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
off_t start_offset;
|
off_t start_offset;
|
||||||
int loop_flag = 0;
|
int loop_flag = 0;
|
||||||
int channels;
|
int channels;
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
if (!check_extensions(sf,"adp"))
|
if (!check_extensions(sf,"adp"))
|
||||||
@ -19,7 +19,7 @@ VGMSTREAM* init_vgmstream_adp_bos(STREAMFILE* sf) {
|
|||||||
start_offset = 0x18;
|
start_offset = 0x18;
|
||||||
|
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ static void load_awb_name(STREAMFILE* sf, STREAMFILE* sf_acb, VGMSTREAM* vgmstre
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* probably loaded */
|
/* probably loaded */
|
||||||
load_acb_wave_name(sf_acb, vgmstream, waveid, port, is_memory);
|
load_acb_wave_name(sf_acb, vgmstream, waveid, port, is_memory);
|
||||||
|
|
||||||
close_streamfile(sf_acb);
|
close_streamfile(sf_acb);
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
#define COLUMN_BITMASK_TYPE 0x0f
|
#define COLUMN_BITMASK_TYPE 0x0f
|
||||||
|
|
||||||
enum columna_flag_t {
|
enum columna_flag_t {
|
||||||
COLUMN_FLAG_NAME = 0x10,
|
COLUMN_FLAG_NAME = 0x10,
|
||||||
COLUMN_FLAG_DEFAULT = 0x20,
|
COLUMN_FLAG_DEFAULT = 0x20,
|
||||||
COLUMN_FLAG_ROW = 0x40,
|
COLUMN_FLAG_ROW = 0x40,
|
||||||
COLUMN_FLAG_UNDEFINED = 0x80 /* shouldn't exist */
|
COLUMN_FLAG_UNDEFINED = 0x80 /* shouldn't exist */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum column_type_t {
|
enum column_type_t {
|
||||||
|
@ -2,49 +2,47 @@
|
|||||||
#include "../coding/coding.h"
|
#include "../coding/coding.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
/* .ADX - from Xenoblade 3D */
|
/* .ADX - from Xenoblade 3D (3DS) */
|
||||||
/* Xenoblade Chronicles 3D uses an adx extension as with
|
VGMSTREAM* init_vgmstream_dsp_adx(STREAMFILE *sf) {
|
||||||
* the Wii version, but it's actually DSP ADPCM. */
|
VGMSTREAM* vgmstream = NULL;
|
||||||
VGMSTREAM * init_vgmstream_dsp_adx(STREAMFILE *streamFile) {
|
int loop_flag, channels;
|
||||||
VGMSTREAM * vgmstream = NULL;
|
|
||||||
int loop_flag, channel_count;
|
|
||||||
int channel_header_spacing = 0x34;
|
int channel_header_spacing = 0x34;
|
||||||
|
|
||||||
/* check extension, case insensitive */
|
|
||||||
if (!check_extensions(streamFile,"adx")) goto fail;
|
|
||||||
|
|
||||||
/* check header */
|
/* checks */
|
||||||
if (read_32bitBE(0,streamFile)!=0x02000000) goto fail;
|
if (!check_extensions(sf,"adx"))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
channel_count = read_32bitLE(0, streamFile);
|
if (read_u32be(0x00,sf) != 0x02000000)
|
||||||
loop_flag = read_16bitLE(0x6e, streamFile);
|
goto fail;
|
||||||
|
|
||||||
if (channel_count > 2 || channel_count < 0) goto fail;
|
channels = read_32bitLE(0, sf);
|
||||||
|
loop_flag = read_16bitLE(0x6e, sf);
|
||||||
|
|
||||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
if (channels > 2 || channels < 0) goto fail;
|
||||||
|
|
||||||
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
vgmstream->coding_type = coding_NGC_DSP;
|
vgmstream->coding_type = coding_NGC_DSP;
|
||||||
vgmstream->layout_type = layout_none;
|
vgmstream->layout_type = layout_none;
|
||||||
vgmstream->meta_type = meta_XB3D_ADX;
|
vgmstream->meta_type = meta_XB3D_ADX;
|
||||||
vgmstream->sample_rate = read_32bitLE(0x70,streamFile);
|
vgmstream->sample_rate = read_32bitLE(0x70,sf);
|
||||||
vgmstream->num_samples = read_32bitLE(0x74, streamFile);
|
vgmstream->num_samples = read_32bitLE(0x74, sf);
|
||||||
vgmstream->loop_start_sample = read_32bitLE(0x78, streamFile);
|
vgmstream->loop_start_sample = read_32bitLE(0x78, sf);
|
||||||
vgmstream->loop_end_sample = read_32bitLE(0x7c, streamFile);
|
vgmstream->loop_end_sample = read_32bitLE(0x7c, sf);
|
||||||
|
|
||||||
dsp_read_coefs_le(vgmstream,streamFile, 0x4, channel_header_spacing);
|
|
||||||
|
|
||||||
|
dsp_read_coefs_le(vgmstream,sf, 0x4, channel_header_spacing);
|
||||||
|
|
||||||
/* semi-interleave: manually open streams at offset */
|
/* semi-interleave: manually open streams at offset */
|
||||||
{
|
{
|
||||||
char filename[PATH_LIMIT];
|
char filename[PATH_LIMIT];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
sf->get_name(sf,filename,sizeof(filename));
|
||||||
for (i = 0; i<channel_count; i++) {
|
for (i = 0; i<channels; i++) {
|
||||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile, filename, STREAMFILE_DEFAULT_BUFFER_SIZE);
|
vgmstream->ch[i].streamfile = sf->open(sf, filename, STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||||
vgmstream->ch[i].channel_start_offset =
|
vgmstream->ch[i].channel_start_offset =
|
||||||
vgmstream->ch[i].offset = read_32bitLE(0x34+i*channel_header_spacing, streamFile);
|
vgmstream->ch[i].offset = read_32bitLE(0x34+i*channel_header_spacing, sf);
|
||||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ VGMSTREAM* init_vgmstream_fsb5_fev_bank(STREAMFILE* sf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//;VGM_LOG("FSB5 FEV: offset=%lx, size=%x\n", subfile_offset,subfile_size);
|
//;VGM_LOG("FSB5 FEV: offset=%lx, size=%x\n", subfile_offset,subfile_size);
|
||||||
|
|
||||||
temp_sf = setup_subfile_streamfile(sf, subfile_offset,subfile_size, "fsb");
|
temp_sf = setup_subfile_streamfile(sf, subfile_offset,subfile_size, "fsb");
|
||||||
if (!temp_sf) goto fail;
|
if (!temp_sf) goto fail;
|
||||||
|
@ -8,7 +8,7 @@ VGMSTREAM* init_vgmstream_wii_bns(STREAMFILE* sf) {
|
|||||||
off_t bns_offset;
|
off_t bns_offset;
|
||||||
uint32_t info_offset = 0, data_offset = 0;
|
uint32_t info_offset = 0, data_offset = 0;
|
||||||
uint32_t channel_info_offset_list_offset;
|
uint32_t channel_info_offset_list_offset;
|
||||||
int channels, loop_flag, sample_rate;
|
int channels, loop_flag, sample_rate;
|
||||||
uint32_t sample_count, loop_start;
|
uint32_t sample_count, loop_start;
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
@ -106,7 +106,7 @@ VGMSTREAM* init_vgmstream_wii_bns(STREAMFILE* sf) {
|
|||||||
channel_info_offset_list_offset = info_offset + read_u32be(info_offset+0x10,sf);
|
channel_info_offset_list_offset = info_offset + read_u32be(info_offset+0x10,sf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* build the VGMSTREAM */
|
/* build the VGMSTREAM */
|
||||||
vgmstream = allocate_vgmstream(channels, loop_flag);
|
vgmstream = allocate_vgmstream(channels, loop_flag);
|
||||||
if (!vgmstream) goto fail;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ VGMSTREAM* init_vgmstream_wwise(STREAMFILE* sf) {
|
|||||||
if (ww.bits_per_sample != 16) goto fail;
|
if (ww.bits_per_sample != 16) goto fail;
|
||||||
|
|
||||||
/* original data_size doesn't look related to samples or anything */
|
/* original data_size doesn't look related to samples or anything */
|
||||||
ww.data_size = ww.file_size - ww.data_offset;
|
ww.data_size = ww.file_size - ww.data_offset;
|
||||||
|
|
||||||
vgmstream->codec_data = init_ffmpeg_offset(sf, ww.data_offset, ww.data_size);
|
vgmstream->codec_data = init_ffmpeg_offset(sf, ww.data_offset, ww.data_size);
|
||||||
if (!vgmstream->codec_data) goto fail;
|
if (!vgmstream->codec_data) goto fail;
|
||||||
@ -682,7 +682,7 @@ static int is_dsp_full_interleave(STREAMFILE* sf, wwise_header* ww, off_t coef_o
|
|||||||
* - .bnk would be memory banks = full
|
* - .bnk would be memory banks = full
|
||||||
* - otherwise small-ish sizes, stereo, with initial predictors for the
|
* - otherwise small-ish sizes, stereo, with initial predictors for the
|
||||||
* second channel matching half size = full
|
* second channel matching half size = full
|
||||||
* some files aren't detectable like this though, when predictors are 0
|
* some files aren't detectable like this though, when predictors are 0
|
||||||
* (but since memory wem aren't that used this shouldn't be too common) */
|
* (but since memory wem aren't that used this shouldn't be too common) */
|
||||||
|
|
||||||
if (ww->truncated)
|
if (ww->truncated)
|
||||||
@ -960,7 +960,7 @@ fail:
|
|||||||
0x14 (4): LoopInfo.dwLoopEndPacketOffset?
|
0x14 (4): LoopInfo.dwLoopEndPacketOffset?
|
||||||
0x18 (4): dwSeekTableSize (0 = no seek table)
|
0x18 (4): dwSeekTableSize (0 = no seek table)
|
||||||
0x1c (4): dwVorbisDataOffset (offset within data)
|
0x1c (4): dwVorbisDataOffset (offset within data)
|
||||||
0x20 (2): uMaxPacketSize (not including header)
|
0x20 (2): uMaxPacketSize (not including header)
|
||||||
0x22 (2): uLastGranuleExtra (0..~0x100)
|
0x22 (2): uLastGranuleExtra (0..~0x100)
|
||||||
0x24 (4): dwDecodeAllocSize (0~0x5000)
|
0x24 (4): dwDecodeAllocSize (0~0x5000)
|
||||||
0x28 (4): dwDecodeX64AllocSize (mid, 0~0x5000)
|
0x28 (4): dwDecodeX64AllocSize (mid, 0~0x5000)
|
||||||
@ -976,7 +976,7 @@ fail:
|
|||||||
0x0c (2): ? (small, 0..~0x400) [(4) when size is 0x2C]
|
0x0c (2): ? (small, 0..~0x400) [(4) when size is 0x2C]
|
||||||
0x10 (4): dwSeekTableSize (0 = no seek table)
|
0x10 (4): dwSeekTableSize (0 = no seek table)
|
||||||
0x14 (4): dwVorbisDataOffset (offset within data)
|
0x14 (4): dwVorbisDataOffset (offset within data)
|
||||||
0x18 (2): uMaxPacketSize (not including header)
|
0x18 (2): uMaxPacketSize (not including header)
|
||||||
0x1a (2): uLastGranuleExtra (0..~0x100) [(4) when size is 0x2C]
|
0x1a (2): uLastGranuleExtra (0..~0x100) [(4) when size is 0x2C]
|
||||||
0x1c (4): dwDecodeAllocSize (0~0x5000)
|
0x1c (4): dwDecodeAllocSize (0~0x5000)
|
||||||
0x20 (4): dwDecodeX64AllocSize (0~0x5000)
|
0x20 (4): dwDecodeX64AllocSize (0~0x5000)
|
||||||
@ -993,7 +993,7 @@ fail:
|
|||||||
0x26 (2): LoopInfo.uLoopEndExtra (extra samples after seek?)
|
0x26 (2): LoopInfo.uLoopEndExtra (extra samples after seek?)
|
||||||
0x28 (4): dwSeekTableSize (0 = no seek table)
|
0x28 (4): dwSeekTableSize (0 = no seek table)
|
||||||
0x2c (4): dwVorbisDataOffset (offset within data)
|
0x2c (4): dwVorbisDataOffset (offset within data)
|
||||||
0x30 (2): uMaxPacketSize (not including header)
|
0x30 (2): uMaxPacketSize (not including header)
|
||||||
0x32 (2): uLastGranuleExtra (small, 0..~0x100)
|
0x32 (2): uLastGranuleExtra (small, 0..~0x100)
|
||||||
0x34 (4): dwDecodeAllocSize (mid, 0~0x5000)
|
0x34 (4): dwDecodeAllocSize (mid, 0~0x5000)
|
||||||
0x38 (4): dwDecodeX64AllocSize (mid, 0~0x5000)
|
0x38 (4): dwDecodeX64AllocSize (mid, 0~0x5000)
|
||||||
|
@ -190,7 +190,7 @@ static int lz4mg_decompress(lz4mg_stream_t* strm) {
|
|||||||
default:
|
default:
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_end:
|
buffer_end:
|
||||||
strm->next_out += dst_pos;
|
strm->next_out += dst_pos;
|
||||||
@ -208,16 +208,16 @@ fail:
|
|||||||
#if 0
|
#if 0
|
||||||
/* non-streamed form for reference, assumes buffers are big enough */
|
/* non-streamed form for reference, assumes buffers are big enough */
|
||||||
static void decompress_lz4mg(uint8_t* dst, size_t dst_size, const uint8_t* src, size_t src_size) {
|
static void decompress_lz4mg(uint8_t* dst, size_t dst_size, const uint8_t* src, size_t src_size) {
|
||||||
size_t src_pos = 0;
|
size_t src_pos = 0;
|
||||||
size_t dst_pos = 0;
|
size_t dst_pos = 0;
|
||||||
uint8_t token;
|
uint8_t token;
|
||||||
int literal_len, match_len, next_len;
|
int literal_len, match_len, next_len;
|
||||||
int match_pos, match_offset;
|
int match_pos, match_offset;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while (src_pos < src_size && dst_pos < dst_size) {
|
while (src_pos < src_size && dst_pos < dst_size) {
|
||||||
|
|
||||||
token = src[src_pos++];
|
token = src[src_pos++];
|
||||||
if (src_pos > src_size)
|
if (src_pos > src_size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ static void decompress_lz4mg(uint8_t* dst, size_t dst_size, const uint8_t* src,
|
|||||||
for(i = 0; i < match_len; i++) {
|
for(i = 0; i < match_len; i++) {
|
||||||
dst[dst_pos++] = dst[match_pos++]; /* note RLE with short offsets */
|
dst[dst_pos++] = dst[match_pos++]; /* note RLE with short offsets */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ typedef struct {
|
|||||||
off_t stream_offset;
|
off_t stream_offset;
|
||||||
} xvag_header;
|
} xvag_header;
|
||||||
|
|
||||||
static int init_xvag_atrac9(STREAMFILE* sf, VGMSTREAM* vgmstream, xvag_header * xvag, off_t chunk_offset);
|
static int init_xvag_atrac9(STREAMFILE* sf, VGMSTREAM* vgmstream, xvag_header* xvag, off_t chunk_offset);
|
||||||
static layered_layout_data* build_layered_xvag(STREAMFILE* sf, xvag_header * xvag, off_t chunk_offset, off_t start_offset);
|
static layered_layout_data* build_layered_xvag(STREAMFILE* sf, xvag_header* xvag, off_t chunk_offset, off_t start_offset);
|
||||||
|
|
||||||
/* XVAG - Sony's Scream Tool/Stream Creator format (God of War III, Ratchet & Clank Future, The Last of Us, Uncharted) */
|
/* XVAG - Sony's Scream Tool/Stream Creator format (God of War III, Ratchet & Clank Future, The Last of Us, Uncharted) */
|
||||||
VGMSTREAM* init_vgmstream_xvag(STREAMFILE* sf) {
|
VGMSTREAM* init_vgmstream_xvag(STREAMFILE* sf) {
|
||||||
@ -42,7 +42,7 @@ VGMSTREAM* init_vgmstream_xvag(STREAMFILE* sf) {
|
|||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
/* .xvag: standard
|
/* .xvag: standard
|
||||||
* (extensionless): The Last Of Us (PS3) speech files */
|
* (extensionless): The Last of Us (PS3) speech files */
|
||||||
if (!check_extensions(sf,"xvag,"))
|
if (!check_extensions(sf,"xvag,"))
|
||||||
goto fail;
|
goto fail;
|
||||||
if (!is_id32be(0x00,sf, "XVAG"))
|
if (!is_id32be(0x00,sf, "XVAG"))
|
||||||
@ -254,7 +254,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VGM_USE_ATRAC9
|
#ifdef VGM_USE_ATRAC9
|
||||||
static int init_xvag_atrac9(STREAMFILE* sf, VGMSTREAM* vgmstream, xvag_header * xvag, off_t chunk_offset) {
|
static int init_xvag_atrac9(STREAMFILE* sf, VGMSTREAM* vgmstream, xvag_header* xvag, off_t chunk_offset) {
|
||||||
int32_t (*read_32bit)(off_t,STREAMFILE*) = xvag->big_endian ? read_32bitBE : read_32bitLE;
|
int32_t (*read_32bit)(off_t,STREAMFILE*) = xvag->big_endian ? read_32bitBE : read_32bitLE;
|
||||||
atrac9_config cfg = {0};
|
atrac9_config cfg = {0};
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ static int init_xvag_atrac9(STREAMFILE* sf, VGMSTREAM* vgmstream, xvag_header *
|
|||||||
/* 0x08: data size (layer only) */
|
/* 0x08: data size (layer only) */
|
||||||
/* 0x10: decoder delay? */
|
/* 0x10: decoder delay? */
|
||||||
cfg.encoder_delay = read_32bit(chunk_offset+0x14,sf);
|
cfg.encoder_delay = read_32bit(chunk_offset+0x14,sf);
|
||||||
/* sometimes ATRAC9 data starts with a fake RIFF, that has total channels rather than layer channels */
|
/* sometimes ATRAC9 data starts with a fake RIFF, that has total channels rather than layer channels */
|
||||||
|
|
||||||
vgmstream->codec_data = init_atrac9(&cfg);
|
vgmstream->codec_data = init_atrac9(&cfg);
|
||||||
if (!vgmstream->codec_data) goto fail;
|
if (!vgmstream->codec_data) goto fail;
|
||||||
@ -278,7 +278,7 @@ fail:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static layered_layout_data* build_layered_xvag(STREAMFILE* sf, xvag_header * xvag, off_t chunk_offset, off_t start_offset) {
|
static layered_layout_data* build_layered_xvag(STREAMFILE* sf, xvag_header* xvag, off_t chunk_offset, off_t start_offset) {
|
||||||
layered_layout_data* data = NULL;
|
layered_layout_data* data = NULL;
|
||||||
STREAMFILE* temp_sf = NULL;
|
STREAMFILE* temp_sf = NULL;
|
||||||
int32_t (*read_32bit)(off_t,STREAMFILE*) = xvag->big_endian ? read_32bitBE : read_32bitLE;
|
int32_t (*read_32bit)(off_t,STREAMFILE*) = xvag->big_endian ? read_32bitBE : read_32bitLE;
|
||||||
@ -309,7 +309,7 @@ static layered_layout_data* build_layered_xvag(STREAMFILE* sf, xvag_header * xva
|
|||||||
if (!init_xvag_atrac9(sf, data->layers[i], xvag, chunk_offset))
|
if (!init_xvag_atrac9(sf, data->layers[i], xvag, chunk_offset))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* interleaves N layers for custom multichannel, may rarely use subsongs [Days Gone (PS4) multilayer test]
|
/* interleaves N layers for custom multichannel, may rarely use subsongs [Days Gone (PS4) multilayer test]
|
||||||
* ex. 2 layers, 1 subsong : [L1][L2][L1][L2]
|
* ex. 2 layers, 1 subsong : [L1][L2][L1][L2]
|
||||||
* ex. 2 layers, 2 subsongs: [L1S1][L2S1][L1S2][L2S2] (assumed, could be [L1S1][L1S2][L2S1][L2S2]) */
|
* ex. 2 layers, 2 subsongs: [L1S1][L2S1][L1S2][L2S2] (assumed, could be [L1S1][L1S2][L2S1][L2S2]) */
|
||||||
chunk = i + xvag->subsongs * (xvag->target_subsong - 1); /* [L1S1][L2S1][L1S2][L2S2] */
|
chunk = i + xvag->subsongs * (xvag->target_subsong - 1); /* [L1S1][L2S1][L1S2][L2S2] */
|
||||||
|
Loading…
Reference in New Issue
Block a user