mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-12-01 01:27:20 +01:00
cleanup: misc
This commit is contained in:
parent
93374f3019
commit
bfd1d28745
@ -90,7 +90,7 @@ void decode_circus_adpcm(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channel
|
|||||||
|
|
||||||
|
|
||||||
for (i = first_sample; i < first_sample + samples_to_do; i++) {
|
for (i = first_sample; i < first_sample + samples_to_do; i++) {
|
||||||
int8_t code = read_8bit(frame_offset+i,stream->streamfile);
|
int8_t code = read_u8(frame_offset+i,stream->streamfile);
|
||||||
|
|
||||||
hist += code << scale;
|
hist += code << scale;
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
@ -102,6 +102,7 @@ void decode_circus_adpcm(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channel
|
|||||||
scale++;
|
scale++;
|
||||||
}
|
}
|
||||||
outbuf[sample_pos] = hist;
|
outbuf[sample_pos] = hist;
|
||||||
|
sample_pos += channelspacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream->adpcm_history1_32 = hist;
|
stream->adpcm_history1_32 = hist;
|
||||||
|
@ -67,7 +67,7 @@ static int init_ffmpeg_config(ffmpeg_codec_data* data, int target_subsong, int r
|
|||||||
/* ******************************************** */
|
/* ******************************************** */
|
||||||
|
|
||||||
/* Global FFmpeg init */
|
/* Global FFmpeg init */
|
||||||
static void g_init_ffmpeg() {
|
static void g_init_ffmpeg(void) {
|
||||||
if (g_ffmpeg_initialized == 1) {
|
if (g_ffmpeg_initialized == 1) {
|
||||||
while (g_ffmpeg_initialized < 2); /* active wait for lack of a better way */
|
while (g_ffmpeg_initialized < 2); /* active wait for lack of a better way */
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ fail:
|
|||||||
|
|
||||||
/* **************************************** */
|
/* **************************************** */
|
||||||
|
|
||||||
static void decode_vima1(STREAMFILE* sf, sbuf_t* sbuf, uint8_t* buf, size_t data_left, int block_num, uint16_t* adpcm_table) {
|
static void decode_vima1(sbuf_t* sbuf, uint8_t* buf, size_t data_left, int block_num, uint16_t* adpcm_table) {
|
||||||
int ch, i, j, s;
|
int ch, i, j, s;
|
||||||
int bitpos;
|
int bitpos;
|
||||||
int adpcm_history[MAX_CHANNELS] = {0};
|
int adpcm_history[MAX_CHANNELS] = {0};
|
||||||
@ -426,7 +426,7 @@ static int decode_block1(STREAMFILE* sf, imuse_codec_data* data, uint8_t* block,
|
|||||||
switch(data->block_table[block_num].flags) {
|
switch(data->block_table[block_num].flags) {
|
||||||
case 0x0D:
|
case 0x0D:
|
||||||
case 0x0F:
|
case 0x0F:
|
||||||
decode_vima1(sf, &data->sbuf, block, data_left, block_num, data->adpcm_table);
|
decode_vima1(&data->sbuf, block, data_left, block_num, data->adpcm_table);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@ -434,7 +434,7 @@ static int decode_block1(STREAMFILE* sf, imuse_codec_data* data, uint8_t* block,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void decode_data2(STREAMFILE* sf, sbuf_t* sbuf, uint8_t* buf, size_t data_left, int block_num) {
|
static void decode_data2(sbuf_t* sbuf, uint8_t* buf, size_t data_left, int block_num) {
|
||||||
int i, j;
|
int i, j;
|
||||||
int channels = sbuf->channels;
|
int channels = sbuf->channels;
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ static void decode_data2(STREAMFILE* sf, sbuf_t* sbuf, uint8_t* buf, size_t data
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void decode_vima2(STREAMFILE* sf, sbuf_t* sbuf, uint8_t* buf, size_t data_left, uint16_t* adpcm_table) {
|
static void decode_vima2(sbuf_t* sbuf, uint8_t* buf, size_t data_left, uint16_t* adpcm_table) {
|
||||||
int ch, i, s;
|
int ch, i, s;
|
||||||
int bitpos;
|
int bitpos;
|
||||||
int adpcm_history[MAX_CHANNELS] = {0};
|
int adpcm_history[MAX_CHANNELS] = {0};
|
||||||
@ -559,11 +559,11 @@ static int decode_block2(STREAMFILE* sf, imuse_codec_data* data, uint8_t* block,
|
|||||||
|
|
||||||
switch(data->block_table[block_num].flags) {
|
switch(data->block_table[block_num].flags) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
decode_data2(sf, &data->sbuf, block, data_left, block_num);
|
decode_data2(&data->sbuf, block, data_left, block_num);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x01:
|
case 0x01:
|
||||||
decode_vima2(sf, &data->sbuf, block, data_left, data->adpcm_table);
|
decode_vima2(&data->sbuf, block, data_left, data->adpcm_table);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -294,7 +294,7 @@ fail:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_ue4_msadpcm(VGMSTREAM* vgmstream, STREAMFILE* sf, riff_fmt_chunk* fmt, int fact_sample_count, off_t start_offset);
|
static int is_ue4_msadpcm(STREAMFILE* sf, riff_fmt_chunk* fmt, int fact_sample_count, off_t start_offset);
|
||||||
static size_t get_ue4_msadpcm_interleave(STREAMFILE* sf, riff_fmt_chunk* fmt, off_t start, size_t size);
|
static size_t get_ue4_msadpcm_interleave(STREAMFILE* sf, riff_fmt_chunk* fmt, off_t start, size_t size);
|
||||||
|
|
||||||
|
|
||||||
@ -795,7 +795,7 @@ VGMSTREAM* init_vgmstream_riff(STREAMFILE* sf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UE4 uses interleaved mono MSADPCM, try to autodetect without breaking normal MSADPCM */
|
/* UE4 uses interleaved mono MSADPCM, try to autodetect without breaking normal MSADPCM */
|
||||||
if (fmt.coding_type == coding_MSADPCM && is_ue4_msadpcm(vgmstream, sf, &fmt, fact_sample_count, start_offset)) {
|
if (fmt.coding_type == coding_MSADPCM && is_ue4_msadpcm(sf, &fmt, fact_sample_count, start_offset)) {
|
||||||
vgmstream->coding_type = coding_MSADPCM_int;
|
vgmstream->coding_type = coding_MSADPCM_int;
|
||||||
vgmstream->codec_config = 1; /* mark as UE4 MSADPCM */
|
vgmstream->codec_config = 1; /* mark as UE4 MSADPCM */
|
||||||
vgmstream->frame_size = fmt.block_size;
|
vgmstream->frame_size = fmt.block_size;
|
||||||
@ -870,7 +870,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UE4 MSADPCM is quite normal but has a few minor quirks we can use to detect it */
|
/* UE4 MSADPCM is quite normal but has a few minor quirks we can use to detect it */
|
||||||
static int is_ue4_msadpcm(VGMSTREAM* vgmstream, STREAMFILE* sf, riff_fmt_chunk* fmt, int fact_sample_count, off_t start) {
|
static int is_ue4_msadpcm(STREAMFILE* sf, riff_fmt_chunk* fmt, int fact_sample_count, off_t start) {
|
||||||
|
|
||||||
/* multichannel ok */
|
/* multichannel ok */
|
||||||
if (fmt->channel_count < 2)
|
if (fmt->channel_count < 2)
|
||||||
|
@ -599,7 +599,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VGMSTREAM* init_vgmstream_ubi_bao_silence(ubi_bao_header* bao, STREAMFILE* sf) {
|
static VGMSTREAM* init_vgmstream_ubi_bao_silence(ubi_bao_header* bao) {
|
||||||
VGMSTREAM* vgmstream = NULL;
|
VGMSTREAM* vgmstream = NULL;
|
||||||
int channels, sample_rate;
|
int channels, sample_rate;
|
||||||
int32_t num_samples;
|
int32_t num_samples;
|
||||||
@ -660,7 +660,7 @@ static VGMSTREAM* init_vgmstream_ubi_bao_header(ubi_bao_header* bao, STREAMFILE*
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case UBI_SILENCE:
|
case UBI_SILENCE:
|
||||||
vgmstream = init_vgmstream_ubi_bao_silence(bao, sf);
|
vgmstream = init_vgmstream_ubi_bao_silence(bao);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -990,7 +990,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* adjust some common values */
|
/* adjust some common values */
|
||||||
static int parse_values(ubi_bao_header* bao, STREAMFILE* sf) {
|
static int parse_values(ubi_bao_header* bao) {
|
||||||
|
|
||||||
if (bao->type == UBI_SEQUENCE || bao->type == UBI_SILENCE)
|
if (bao->type == UBI_SEQUENCE || bao->type == UBI_SILENCE)
|
||||||
return 1;
|
return 1;
|
||||||
@ -1228,7 +1228,7 @@ static int parse_header(ubi_bao_header* bao, STREAMFILE* sf, off_t offset) {
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parse_values(bao, sf))
|
if (!parse_values(bao))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!parse_offsets(bao, sf))
|
if (!parse_offsets(bao, sf))
|
||||||
|
Loading…
Reference in New Issue
Block a user