cleanup: fix minor compiler warnings

This commit is contained in:
bnnm 2024-08-07 23:13:12 +02:00
parent 9b485ac735
commit e987ef2d47
18 changed files with 197 additions and 182 deletions

View File

@ -13,7 +13,7 @@
static void describe_get_time(int32_t samples, int sample_rate, double* p_time_mm, double* p_time_ss) {
double seconds = (double)samples / sample_rate;
*p_time_mm = (int)(seconds / 60.0);
*p_time_ss = seconds - *p_time_mm * 60.0f;
*p_time_ss = seconds - *p_time_mm * 60.0;
if (*p_time_ss >= 59.999) /* avoid round up to 60.0 when printing to %06.3f */
*p_time_ss = 59.999;
}

View File

@ -12,7 +12,7 @@ static inline float get_fade_gain_curve(char shape, float index) {
return index;
}
//TODO optimizations: interleave calcs, maybe use cosf, powf, etc? (with extra defines)
//TODO optimizations: interleave calcs
/* (curve math mostly from SoX/FFmpeg) */
switch(shape) {
@ -20,17 +20,17 @@ static inline float get_fade_gain_curve(char shape, float index) {
* (alt calculations with 'exp' from FFmpeg use (factor)*ln(0.1) = -NN.N... */
case 'E': /* exponential (for fade-outs, closer to natural decay of sound) */
//gain = pow(0.1f, (1.0f - index) * 2.5f);
gain = exp(-5.75646273248511f * (1.0f - index));
//gain = powf(0.1f, (1.0f - index) * 2.5f);
gain = expf(-5.75646273248511f * (1.0f - index));
break;
case 'L': /* logarithmic (inverse of the above, maybe for crossfades) */
//gain = 1 - pow(0.1f, (index) * 2.5f);
gain = 1 - exp(-5.75646273248511f * (index));
//gain = 1 - powf(0.1f, (index) * 2.5f);
gain = 1 - expf(-5.75646273248511f * (index));
break;
case 'H': /* raised sine wave or cosine wave (for more musical crossfades) */
gain = (1.0f - cos(index * MIXING_PI)) / 2.0f;
gain = (1.0f - cosf(index * MIXING_PI)) / 2.0f;
break;
case 'Q': /* quarter of sine wave (for musical fades) */
@ -38,7 +38,7 @@ static inline float get_fade_gain_curve(char shape, float index) {
break;
case 'p': /* parabola (maybe for crossfades) */
gain = 1.0f - sqrt(1.0f - index);
gain = 1.0f - sqrtf(1.0f - index);
break;
case 'P': /* inverted parabola (maybe for fades) */
@ -154,7 +154,7 @@ bool mixer_op_fade_is_active(mixer_t* mixer, int32_t current_start, int32_t curr
/* check is current range falls within a fade
* (assuming fades were already optimized on add) */
if (mix->time_pre < 0 && vol_start == 1.0) {
if (mix->time_pre < 0 && vol_start == 1.0f) {
fade_start = mix->time_start; /* ignore unused */
}
else {

View File

@ -90,7 +90,7 @@ void decode_adx(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing,
stream->adpcm_history2_32 = hist2;
if ((coding_type == coding_CRI_ADX_enc_8 || coding_type == coding_CRI_ADX_enc_9) && !(i % 32)) {
for (i =0; i < stream->adx_channels; i++) {
for (i = 0; i < channelspacing; i++) {
adx_next_key(stream);
}
}

View File

@ -772,19 +772,29 @@ static void copy_samples(ffmpeg_codec_data* data, sample_t* outbuf, int samples_
switch (data->codecCtx->sample_fmt) {
/* unused? */
case AV_SAMPLE_FMT_U8P: if (is_planar) { samples_u8p_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed); break; }
// fall through
case AV_SAMPLE_FMT_U8: samples_u8_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed); break;
/* common */
case AV_SAMPLE_FMT_S16P: if (is_planar) { samples_s16p_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed); break; }
// fall through
case AV_SAMPLE_FMT_S16: samples_s16_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed); break;
/* possibly FLAC and other lossless codecs */
case AV_SAMPLE_FMT_S32P: if (is_planar) { samples_s32p_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed); break; }
// fall through
case AV_SAMPLE_FMT_S32: samples_s32_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed); break;
/* mainly MDCT-like codecs (Ogg, AAC, etc) */
case AV_SAMPLE_FMT_FLTP: if (is_planar) { samples_fltp_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed, data->invert_floats_set); break; }
// fall through
case AV_SAMPLE_FMT_FLT: samples_flt_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed, data->invert_floats_set); break;
/* possibly PCM64 only (not enabled) */
case AV_SAMPLE_FMT_DBLP: if (is_planar) { samples_dblp_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed); break; }
// fall through
case AV_SAMPLE_FMT_DBL: samples_dbl_to_s16(outbuf, ibuf, channels, samples_to_do, data->samples_consumed); break;
default:
break;
}

View File

@ -1,13 +1,15 @@
#include "coding.h"
#include "../util.h"
/* AKA iShiftVal__8snd_strm */
static const int32_t l5_scales[32] = {
0x00001000, 0x0000144E, 0x000019C5, 0x000020B4, 0x00002981, 0x000034AC, 0x000042D9, 0x000054D6,
0x00006BAB, 0x000088A4, 0x0000AD69, 0x0000DC13, 0x0001174C, 0x00016275, 0x0001C1D8, 0x00023AE5,
0x0002D486, 0x0003977E, 0x00048EEE, 0x0005C8F3, 0x00075779, 0x0009513E, 0x000BD31C, 0x000F01B5,
0x00130B82, 0x00182B83, 0x001EAC92, 0x0026EDB2, 0x00316777, 0x003EB2E6, 0x004F9232, 0x0064FBD1
0x00130B82, 0x00182B83, 0x001EAC92, 0x0026EDB2, 0x00316777, 0x003EB2E6, 0x004F9232, 0x0064FBD1,
};
/* reverse engineered from exe (SLPM_624.90's DecAdpcm__8snd_strmFRQ28snd_strm10SOUND_HEADiPsPUci / SLUS_212.07's @258D70)*/
void decode_l5_555(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
uint8_t frame[0x12] = {0};
off_t frame_offset;
@ -31,7 +33,7 @@ void decode_l5_555(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacin
/* parse frame header */
frame_offset = stream->offset + bytes_per_frame * frames_in;
read_streamfile(frame, frame_offset, bytes_per_frame, stream->streamfile); /* ignore EOF errors */
header = get_u32le(frame);
header = get_u16le(frame);
coef_index = (header >> 10) & 0x1f;
pos_scale = l5_scales[(header >> 5) & 0x1f];
neg_scale = l5_scales[(header >> 0) & 0x1f];
@ -41,18 +43,19 @@ void decode_l5_555(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacin
coef3 = stream->adpcm_coef_3by32[coef_index * 3 + 2];
for (i = first_sample; i < first_sample + samples_to_do; i++) {
int32_t prediction, sample = 0;
/* sample is 64b in PS2 registers, though encoder probably won't let it get too high */
int32_t prediction, sample;
uint8_t nibbles = frame[0x02 + i/2];
sample = (i&1) ?
get_low_nibble_signed(nibbles):
get_high_nibble_signed(nibbles);
prediction = -(hist1 * coef1 + hist2 * coef2 + hist3 * coef3);
prediction = (hist1 * coef1 + hist2 * coef2 + hist3 * coef3);
if (sample >= 0)
sample = (prediction + sample * pos_scale) >> 12;
sample = (sample * pos_scale - prediction) >> 12;
else
sample = (prediction + sample * neg_scale) >> 12;
sample = (sample * neg_scale - prediction) >> 12;
sample = clamp16(sample);
outbuf[sample_count] = sample;

View File

@ -858,17 +858,17 @@ void TCompressWaveData_SetVolume(TCompressWaveData* self, float vol, float fade)
aaa = vol;
//set volume threshold
if (aaa > 1.0) aaa = 1.0;
if (aaa < 0.0) aaa = 0.0;
if (aaa > 1.0f) aaa = 1.0f;
if (aaa < 0.0f) aaa = 0.0f;
//calc volume increse
if (fade < 0.01) { //with fade value
if (fade < 0.01f) { //with fade value
self->Ffade = 0;
self->FVolume = round(aaa * (double)PW_MAXVOLUME);
self->FVolume = (int32_t)round((double)aaa * (double)PW_MAXVOLUME);
self->FSetVolume = self->FVolume;
}
else { //without fade value
self->Ffade = round((double)PW_MAXVOLUME / fade / 44100);
self->FSetVolume = round(aaa * (double)PW_MAXVOLUME);
self->Ffade = (int32_t)round((double)PW_MAXVOLUME / (double)fade / 44100);
self->FSetVolume = (int32_t)round((double)aaa * (double)PW_MAXVOLUME);
}
}

View File

@ -1072,7 +1072,7 @@ static int unpack_frame(int bit_rate, const uint8_t* data, int frame_size, /*int
if (test_errors) {
int max_pad_bytes = 0x8; /* usually 0x04 and rarely ~0x08 */
int bits_left = 8 * expected_frame_size - bitpos;
int i, endpos, test_bits;
int endpos, test_bits;
if (bits_left > 0) {

View File

@ -1252,9 +1252,9 @@ int tac_decode_frame(tac_handle_t* handle, const uint8_t* block) {
static inline int16_t clamp16f(float sample) {
if (sample > 32767.0)
if (sample > 32767.0f)
return 32767;
else if (sample < -32768.0)
else if (sample < -32768.0f)
return -32768;
return (int16_t)sample;
}

View File

@ -20,134 +20,134 @@
/* ADPCM table */
static const float hevag_coefs_f[128][4] = {
{-0.0, -0.0, -0.0, -0.0 },
{ 0.9375, -0.0, -0.0, -0.0 },
{ 1.796875, -0.8125, -0.0, -0.0 },
{ 1.53125, -0.859375, -0.0, -0.0 },
{ 1.90625, -0.9375, -0.0, -0.0 },
{ 1.7982178, -0.86169434, -0.0, -0.0 },
{ 1.770874, -0.89916992, -0.0, -0.0 },
{ 1.6992188, -0.91821289, -0.0, -0.0 },
{ 1.6031494, -0.9375, -0.0, -0.0 },
{ 1.4682617, -0.9375, -0.0, -0.0 },
{ 1.3139648, -0.9375, -0.0, -0.0 },
{ 1.1424561, -0.9375, -0.0, -0.0 },
{ 0.95605469, -0.9375, -0.0, -0.0 },
{ 0.75695801, -0.9375, -0.0, -0.0 },
{ 0.54785156, -0.9375, -0.0, -0.0 },
{ 0.33166504, -0.9375, -0.0, -0.0 },
{ 0.11108398, -0.9375, -0.0, -0.0 },
{-0.11108398, -0.9375, -0.0, -0.0 },
{-0.33166504, -0.9375, -0.0, -0.0 },
{-0.54785156, -0.9375, -0.0, -0.0 },
{-0.75695801, -0.9375, -0.0, -0.0 },
{-0.95605469, -0.9375, -0.0, -0.0 },
{-1.1424561, -0.9375, -0.0, -0.0 },
{-1.3139648, -0.9375, -0.0, -0.0 },
{-1.4682617, -0.9375, -0.0, -0.0 },
{-1.6031494, -0.9375, -0.0, -0.0 },
{-1.6992188, -0.91821289, -0.0, -0.0 },
{-1.770874, -0.89916992, -0.0, -0.0 },
{-1.7982178, -0.86169434, -0.0, -0.0 },
{ 0.65625, -1.125, 0.40625, -0.375 },
{-0.78125, -0.875, -0.40625, -0.28125 },
{-1.28125, -0.90625, -0.4375, -0.125 },
{-0.020385742, -0.33227539, -0.060302734, -0.066040039 },
{-0.90698242, -0.27111816, -0.28051758, 0.051757812 },
{-0.97668457, -0.38647461, -0.34350586, 0.03527832 },
{ 0.73461914, -0.57983398, 0.32336426, -0.15844727 },
{ 0.46362305, -0.84790039, 0.47302246, -0.1484375 },
{-1.0054932, -0.31689453, -0.25280762, 0.027709961 },
{ 1.1229248, 0.24194336, -0.16870117, -0.28271484 },
{ 1.5894775, -0.37158203, -0.46289062, 0.15466309 },
{ 1.6005859, -0.54772949, -0.2746582, 0.20324707 },
{-0.20361328, -0.45703125, -0.78808594, 0.10253906 },
{ 0.95446777, -0.52832031, 0.25769043, -0.061767578 },
{ 1.168335, -0.16308594, -0.092407227, 0.059448242 },
{ 1.2246094, -0.31274414, 0.036621094, 0.024291992 },
{-0.57922363, -0.50317383, -0.66967773, -0.18225098 },
{-0.71972656, 0.2902832, -0.58435059, -0.84802246 },
{-0.14562988, -1.112915, -0.15100098, -0.38012695 },
{ 0.33972168, -0.86767578, -0.19226074, -0.17663574 },
{-0.89526367, -0.25170898, -0.27001953, 0.054443359 },
{ 0.7479248, -0.3145752, -0.038452148, -0.0021972656 },
{ 1.1544189, -0.22680664, 0.012451172, 0.031494141 },
{ 0.96142578, -0.54724121, 0.25952148, -0.065673828 },
{-0.87548828, -0.21911621, -0.25256348, 0.058837891 },
{-0.89819336, -0.2565918, -0.27258301, 0.053710938 },
{-1.1193848, -0.42834473, -0.32641602, -0.047729492 },
{-0.32202148, -0.32312012, -0.23547363, -0.1998291 },
{ 0.2286377, 1.1209717, 0.22705078, -0.70141602 },
{ 1.1247559, 0.22692871, -0.13720703, -0.29626465 },
{ 1.6118164, -0.36767578, -0.50524902, 0.16723633 },
{ 1.5181885, -0.58496094, -0.03125, 0.075927734 },
{-0.32385254, -0.13964844, -0.38842773, -0.83959961 },
{ 1.1390381, -0.12792969, -0.10107422, 0.061889648 },
{ 0.20043945, -0.075683594, -0.11547852, -0.51623535 },
{ 0.51831055, -0.92590332, -0.065063477, -0.27575684 },
{-1.097168, -0.47497559, -0.34265137, 0.0053710938 },
{-0.31274414, -0.3338623, -0.21118164, -0.23181152 },
{ 0.38842773, -0.058959961, -0.087158203, -0.17346191 },
{ 0.96887207, -0.46923828, 0.34436035, -0.12438965 },
{ 1.229126, -0.31848145, 0.038330078, 0.023803711 },
{ 1.0253906, -0.40246582, 0.18933105, -0.018920898 },
{-1.0411377, -0.33874512, -0.296875, -0.041015625 },
{ 1.1568604, -0.22973633, 0.013183594, 0.03125 },
{ 0.0091552734, -0.27355957, -0.036376953, -0.84680176 },
{-1.1160889, -0.5078125, -0.36169434, 0.00061035156 },
{-0.88745117, -0.23901367, -0.26318359, 0.056152344 },
{-0.33447266, 0.45715332, 0.72460938, -0.13293457 },
{ 1.0977783, 0.23779297, -0.083374023, -0.33007812 },
{ 1.5992432, -0.34606934, -0.47045898, 0.12878418 },
{ 1.164917, -0.23937988, 0.015869141, 0.030517578 },
{ 0.64355469, -0.52124023, 0.38134766, -0.38537598 },
{-0.93945312, -0.41296387, -0.3548584, -0.055664062 },
{ 0.89221191, 0.3079834, 0.052978516, -0.30041504 },
{ 1.2542725, -0.34997559, 0.047729492, 0.020996094 },
{ 1.3354492, -0.45422363, 0.081176758, 0.01184082 },
{ 0.0029296875, -0.037841797, -0.15405273, 0.0390625 },
{-0.99145508, -0.29431152, -0.28210449, -0.033081055 },
{-1.0389404, -0.37438965, -0.28527832, 0.019897461 },
{ 0.039794922, -0.46948242, 0.051147461, -0.1138916 },
{ 1.0858154, 0.26782227, -0.066040039, -0.3515625 },
{ 1.4737549, -0.22900391, -0.24621582, -0.073364258 },
{ 1.0655518, -0.41784668, 0.2043457, -0.020629883 },
{ 1.5808105, -0.46960449, -0.36706543, 0.23754883 },
{ 1.2253418, -0.3137207, 0.036865234, 0.024169922 },
{ 1.1456299, -0.33654785, 0.12304688, 0.0050048828 },
{-0.57617188, -0.61108398, -0.34814453, -0.14172363 },
{ 0.96057129, -0.52807617, 0.26062012, -0.061157227 },
{ 0.29907227, -1.0494385, 0.15856934, -0.33935547 },
{ 1.2441406, -0.33728027, 0.043945312, 0.022094727 },
{ 1.3809814, -0.51428223, 0.10168457, 0.0064697266 },
{ 1.239502, -0.33154297, 0.042114258, 0.022583008 },
{ 1.1765137, -0.17297363, -0.08996582, 0.058837891 },
{ 0.47045898, -0.5559082, 0.3470459, -0.41467285 },
{ 0.81774902, -0.6907959, 0.27453613, -0.13110352 },
{ 1.3527832, -0.47705078, 0.088867188, 0.009765625 },
{-0.12524414, -1.1975098, -0.098266602, -0.42260742 },
{ 1.269043, -0.45727539, 0.16687012, -0.01171875 },
{ 1.2557373, 0.12060547, -0.23376465, -0.17541504 },
{ 0.9708252, 0.47338867, -0.093261719, -0.39831543 },
{ 1.5489502, -0.4119873, -0.40942383, 0.25378418 },
{ 0.81066895, 0.38647461, 0.028198242, -0.25500488 },
{-0.28662109, -0.89770508, -0.23730469, -0.50317383 },
{ 1.1340332, -0.49304199, 0.23010254, -0.030029297 },
{ 0.56555176, -0.78161621, 0.21337891, -0.19763184 },
{ 1.3729248, -0.50354004, 0.097900391, 0.0074462891 },
{ 1.1971436, -0.27880859, 0.026733398, 0.027099609 },
{ 1.1884766, -0.1875, -0.086181641, 0.057739258 },
{ 1.0302734, -0.41943359, 0.19067383, -0.021484375 },
{ 1.1361084, -0.12463379, -0.10192871, 0.062133789 },
{ 0.20727539, -1.1016846, 0.083984375, -0.37072754 },
{ 1.2468262, -0.34069824, 0.044921875, 0.021850586 },
{ 1.0241699, 0.39648438, -0.092529297, -0.36486816 },
{ 0.87902832, 0.40478516, 0.0056152344, -0.3190918 },
{-0.010742188, -0.95324707, -0.065673828, -0.5579834 },
{ 0.75598145, -0.63342285, 0.33691406, -0.15197754 },
{ 1.5045166, -0.1574707, -0.40087891, 0.030883789 },
{ 1.5947266, -0.49743652, -0.34472656, 0.22912598 },
{ 0.65100098, 0.36608887, 0.094604492, -0.13818359 },
{-0.0f, -0.0f, -0.0f, -0.0f },
{ 0.9375f, -0.0f, -0.0f, -0.0f },
{ 1.796875f, -0.8125f, -0.0f, -0.0f },
{ 1.53125f, -0.859375f, -0.0f, -0.0f },
{ 1.90625f, -0.9375f, -0.0f, -0.0f },
{ 1.7982178f, -0.86169434f, -0.0f, -0.0f },
{ 1.770874f, -0.89916992f, -0.0f, -0.0f },
{ 1.6992188f, -0.91821289f, -0.0f, -0.0f },
{ 1.6031494f, -0.9375f, -0.0f, -0.0f },
{ 1.4682617f, -0.9375f, -0.0f, -0.0f },
{ 1.3139648f, -0.9375f, -0.0f, -0.0f },
{ 1.1424561f, -0.9375f, -0.0f, -0.0f },
{ 0.95605469f, -0.9375f, -0.0f, -0.0f },
{ 0.75695801f, -0.9375f, -0.0f, -0.0f },
{ 0.54785156f, -0.9375f, -0.0f, -0.0f },
{ 0.33166504f, -0.9375f, -0.0f, -0.0f },
{ 0.11108398f, -0.9375f, -0.0f, -0.0f },
{-0.11108398f, -0.9375f, -0.0f, -0.0f },
{-0.33166504f, -0.9375f, -0.0f, -0.0f },
{-0.54785156f, -0.9375f, -0.0f, -0.0f },
{-0.75695801f, -0.9375f, -0.0f, -0.0f },
{-0.95605469f, -0.9375f, -0.0f, -0.0f },
{-1.1424561f, -0.9375f, -0.0f, -0.0f },
{-1.3139648f, -0.9375f, -0.0f, -0.0f },
{-1.4682617f, -0.9375f, -0.0f, -0.0f },
{-1.6031494f, -0.9375f, -0.0f, -0.0f },
{-1.6992188f, -0.91821289f, -0.0f, -0.0f },
{-1.770874f, -0.89916992f, -0.0f, -0.0f },
{-1.7982178f, -0.86169434f, -0.0f, -0.0f },
{ 0.65625f, -1.125f, 0.40625f, -0.375f },
{-0.78125f, -0.875f, -0.40625f, -0.28125f },
{-1.28125f, -0.90625f, -0.4375f, -0.125f },
{-0.020385742f, -0.33227539f, -0.060302734f, -0.066040039f },
{-0.90698242f, -0.27111816f, -0.28051758f, 0.051757812f },
{-0.97668457f, -0.38647461f, -0.34350586f, 0.03527832f },
{ 0.73461914f, -0.57983398f, 0.32336426f, -0.15844727f },
{ 0.46362305f, -0.84790039f, 0.47302246f, -0.1484375f },
{-1.0054932f, -0.31689453f, -0.25280762f, 0.027709961f },
{ 1.1229248f, 0.24194336f, -0.16870117f, -0.28271484f },
{ 1.5894775f, -0.37158203f, -0.46289062f, 0.15466309f },
{ 1.6005859f, -0.54772949f, -0.2746582f, 0.20324707f },
{-0.20361328f, -0.45703125f, -0.78808594f, 0.10253906f },
{ 0.95446777f, -0.52832031f, 0.25769043f, -0.061767578f },
{ 1.168335f, -0.16308594f, -0.092407227f, 0.059448242f },
{ 1.2246094f, -0.31274414f, 0.036621094f, 0.024291992f },
{-0.57922363f, -0.50317383f, -0.66967773f, -0.18225098f },
{-0.71972656f, 0.2902832f, -0.58435059f, -0.84802246f },
{-0.14562988f, -1.112915f, -0.15100098f, -0.38012695f },
{ 0.33972168f, -0.86767578f, -0.19226074f, -0.17663574f },
{-0.89526367f, -0.25170898f, -0.27001953f, 0.054443359f },
{ 0.7479248f, -0.3145752f, -0.038452148f, -0.0021972656f },
{ 1.1544189f, -0.22680664f, 0.012451172f, 0.031494141f },
{ 0.96142578f, -0.54724121f, 0.25952148f, -0.065673828f },
{-0.87548828f, -0.21911621f, -0.25256348f, 0.058837891f },
{-0.89819336f, -0.2565918f, -0.27258301f, 0.053710938f },
{-1.1193848f, -0.42834473f, -0.32641602f, -0.047729492f },
{-0.32202148f, -0.32312012f, -0.23547363f, -0.1998291f },
{ 0.2286377f, 1.1209717f, 0.22705078f, -0.70141602f },
{ 1.1247559f, 0.22692871f, -0.13720703f, -0.29626465f },
{ 1.6118164f, -0.36767578f, -0.50524902f, 0.16723633f },
{ 1.5181885f, -0.58496094f, -0.03125f, 0.075927734f },
{-0.32385254f, -0.13964844f, -0.38842773f, -0.83959961f },
{ 1.1390381f, -0.12792969f, -0.10107422f, 0.061889648f },
{ 0.20043945f, -0.075683594f, -0.11547852f, -0.51623535f },
{ 0.51831055f, -0.92590332f, -0.065063477f, -0.27575684f },
{-1.097168f, -0.47497559f, -0.34265137f, 0.0053710938f },
{-0.31274414f, -0.3338623f, -0.21118164f, -0.23181152f },
{ 0.38842773f, -0.058959961f, -0.087158203f, -0.17346191f },
{ 0.96887207f, -0.46923828f, 0.34436035f, -0.12438965f },
{ 1.229126f, -0.31848145f, 0.038330078f, 0.023803711f },
{ 1.0253906f, -0.40246582f, 0.18933105f, -0.018920898f },
{-1.0411377f, -0.33874512f, -0.296875f, -0.041015625f },
{ 1.1568604f, -0.22973633f, 0.013183594f, 0.03125f },
{ 0.0091552734f, -0.27355957f, -0.036376953f, -0.84680176f },
{-1.1160889f, -0.5078125f, -0.36169434f, 0.00061035156f },
{-0.88745117f, -0.23901367f, -0.26318359f, 0.056152344f },
{-0.33447266f, 0.45715332f, 0.72460938f, -0.13293457f },
{ 1.0977783f, 0.23779297f, -0.083374023f, -0.33007812f },
{ 1.5992432f, -0.34606934f, -0.47045898f, 0.12878418f },
{ 1.164917f, -0.23937988f, 0.015869141f, 0.030517578f },
{ 0.64355469f, -0.52124023f, 0.38134766f, -0.38537598f },
{-0.93945312f, -0.41296387f, -0.3548584f, -0.055664062f },
{ 0.89221191f, 0.3079834f, 0.052978516f, -0.30041504f },
{ 1.2542725f, -0.34997559f, 0.047729492f, 0.020996094f },
{ 1.3354492f, -0.45422363f, 0.081176758f, 0.01184082f },
{ 0.0029296875f, -0.037841797f, -0.15405273f, 0.0390625f },
{-0.99145508f, -0.29431152f, -0.28210449f, -0.033081055f },
{-1.0389404f, -0.37438965f, -0.28527832f, 0.019897461f },
{ 0.039794922f, -0.46948242f, 0.051147461f, -0.1138916f },
{ 1.0858154f, 0.26782227f, -0.066040039f, -0.3515625f },
{ 1.4737549f, -0.22900391f, -0.24621582f, -0.073364258f },
{ 1.0655518f, -0.41784668f, 0.2043457f, -0.020629883f },
{ 1.5808105f, -0.46960449f, -0.36706543f, 0.23754883f },
{ 1.2253418f, -0.3137207f, 0.036865234f, 0.024169922f },
{ 1.1456299f, -0.33654785f, 0.12304688f, 0.0050048828f },
{-0.57617188f, -0.61108398f, -0.34814453f, -0.14172363f },
{ 0.96057129f, -0.52807617f, 0.26062012f, -0.061157227f },
{ 0.29907227f, -1.0494385f, 0.15856934f, -0.33935547f },
{ 1.2441406f, -0.33728027f, 0.043945312f, 0.022094727f },
{ 1.3809814f, -0.51428223f, 0.10168457f, 0.0064697266f },
{ 1.239502f, -0.33154297f, 0.042114258f, 0.022583008f },
{ 1.1765137f, -0.17297363f, -0.08996582f, 0.058837891f },
{ 0.47045898f, -0.5559082f, 0.3470459f, -0.41467285f },
{ 0.81774902f, -0.6907959f, 0.27453613f, -0.13110352f },
{ 1.3527832f, -0.47705078f, 0.088867188f, 0.009765625f },
{-0.12524414f, -1.1975098f, -0.098266602f, -0.42260742f },
{ 1.269043f, -0.45727539f, 0.16687012f, -0.01171875f },
{ 1.2557373f, 0.12060547f, -0.23376465f, -0.17541504f },
{ 0.9708252f, 0.47338867f, -0.093261719f, -0.39831543f },
{ 1.5489502f, -0.4119873f, -0.40942383f, 0.25378418f },
{ 0.81066895f, 0.38647461f, 0.028198242f, -0.25500488f },
{-0.28662109f, -0.89770508f, -0.23730469f, -0.50317383f },
{ 1.1340332f, -0.49304199f, 0.23010254f, -0.030029297f },
{ 0.56555176f, -0.78161621f, 0.21337891f, -0.19763184f },
{ 1.3729248f, -0.50354004f, 0.097900391f, 0.0074462891f },
{ 1.1971436f, -0.27880859f, 0.026733398f, 0.027099609f },
{ 1.1884766f, -0.1875f, -0.086181641f, 0.057739258f },
{ 1.0302734f, -0.41943359f, 0.19067383f, -0.021484375f },
{ 1.1361084f, -0.12463379f, -0.10192871f, 0.062133789f },
{ 0.20727539f, -1.1016846f, 0.083984375f, -0.37072754f },
{ 1.2468262f, -0.34069824f, 0.044921875f, 0.021850586f },
{ 1.0241699f, 0.39648438f, -0.092529297f, -0.36486816f },
{ 0.87902832f, 0.40478516f, 0.0056152344f, -0.3190918f },
{-0.010742188f, -0.95324707f, -0.065673828f, -0.5579834f },
{ 0.75598145f, -0.63342285f, 0.33691406f, -0.15197754f },
{ 1.5045166f, -0.1574707f, -0.40087891f, 0.030883789f },
{ 1.5947266f, -0.49743652f, -0.34472656f, 0.22912598f },
{ 0.65100098f, 0.36608887f, 0.094604492f, -0.13818359f },
};
#if 0

View File

@ -3,23 +3,23 @@
/* PS-ADPCM table, defined as rational numbers (as in the spec) */
static const float ps_adpcm_coefs_f[16][2] = {
{ 0.0 , 0.0 }, //{ 0.0 , 0.0 },
{ 0.9375 , 0.0 }, //{ 60.0 / 64.0 , 0.0 },
{ 1.796875 , -0.8125 }, //{ 115.0 / 64.0 , -52.0 / 64.0 },
{ 1.53125 , -0.859375 }, //{ 98.0 / 64.0 , -55.0 / 64.0 },
{ 1.90625 , -0.9375 }, //{ 122.0 / 64.0 , -60.0 / 64.0 },
{ 0.0f , 0.0f }, //{ 0.0 , 0.0 },
{ 0.9375f , 0.0f }, //{ 60.0 / 64.0 , 0.0 },
{ 1.796875f , -0.8125f }, //{ 115.0 / 64.0 , -52.0 / 64.0 },
{ 1.53125f , -0.859375f }, //{ 98.0 / 64.0 , -55.0 / 64.0 },
{ 1.90625f , -0.9375f }, //{ 122.0 / 64.0 , -60.0 / 64.0 },
/* extended table used in few PS3 games, found in ELFs */
{ 0.46875 , -0.0 }, //{ 30.0 / 64.0 , -0.0 / 64.0 },
{ 0.8984375 , -0.40625 }, //{ 57.5 / 64.0 , -26.0 / 64.0 },
{ 0.765625 , -0.4296875 }, //{ 49.0 / 64.0 , -27.5 / 64.0 },
{ 0.953125 , -0.46875 }, //{ 61.0 / 64.0 , -30.0 / 64.0 },
{ 0.234375 , -0.0 }, //{ 15.0 / 64.0 , -0.0 / 64.0 },
{ 0.44921875, -0.203125 }, //{ 28.75/ 64.0 , -13.0 / 64.0 },
{ 0.3828125 , -0.21484375}, //{ 24.5 / 64.0 , -13.75/ 64.0 },
{ 0.4765625 , -0.234375 }, //{ 30.5 / 64.0 , -15.0 / 64.0 },
{ 0.5 , -0.9375 }, //{ 32.0 / 64.0 , -60.0 / 64.0 },
{ 0.234375 , -0.9375 }, //{ 15.0 / 64.0 , -60.0 / 64.0 },
{ 0.109375 , -0.9375 }, //{ 7.0 / 64.0 , -60.0 / 64.0 },
{ 0.46875f , -0.0f }, //{ 30.0 / 64.0 , -0.0 / 64.0 },
{ 0.8984375f, -0.40625f }, //{ 57.5 / 64.0 , -26.0 / 64.0 },
{ 0.765625f , -0.4296875f }, //{ 49.0 / 64.0 , -27.5 / 64.0 },
{ 0.953125f , -0.46875f }, //{ 61.0 / 64.0 , -30.0 / 64.0 },
{ 0.234375f , -0.0f }, //{ 15.0 / 64.0 , -0.0 / 64.0 },
{ 0.44921875f,-0.203125f }, //{ 28.75/ 64.0 , -13.0 / 64.0 },
{ 0.3828125f, -0.21484375f}, //{ 24.5 / 64.0 , -13.75/ 64.0 },
{ 0.4765625f, -0.234375f }, //{ 30.5 / 64.0 , -15.0 / 64.0 },
{ 0.5f , -0.9375f }, //{ 32.0 / 64.0 , -60.0 / 64.0 },
{ 0.234375f , -0.9375f }, //{ 15.0 / 64.0 , -60.0 / 64.0 },
{ 0.109375f , -0.9375f }, //{ 7.0 / 64.0 , -60.0 / 64.0 },
};
/* PS-ADPCM table, defined as spec_coef*64 (for int implementations) */

View File

@ -148,8 +148,8 @@ VGMSTREAM* init_vgmstream_bkhd(STREAMFILE* sf) {
vgmstream = init_vgmstream_adm3(temp_sf);
if (!vgmstream) goto fail;
}
else if (read_f32(subfile_offset + 0x02, temp_sf) >= 30.0 &&
read_f32(subfile_offset + 0x02, temp_sf) <= 250.0) {
else if (read_f32(subfile_offset + 0x02, temp_sf) >= 30.0f &&
read_f32(subfile_offset + 0x02, temp_sf) <= 250.0f) {
is_wmid = 1;
/* ignore Wwise's custom .wmid (similar to a regular midi but with simplified
* chunks and custom fields: 0x00=MThd's division, 0x02: bpm (new), etc) */

View File

@ -71,7 +71,7 @@ typedef struct {
uint32_t header_size;
} eaac_header_t;
static VGMSTREAM* init_vgmstream_eaaudiocore_main(eaac_header_t* eaac, STREAMFILE* sf_head, STREAMFILE* sf_data, off_t header_offset, off_t start_offset, meta_t meta_type, bool standalone);
static VGMSTREAM* init_vgmstream_eaaudiocore_main(eaac_header_t* eaac, STREAMFILE* sf_head, STREAMFILE* sf_data, off_t header_offset, meta_t meta_type, bool standalone);
/* EA newest header from RwAudioCore (RenderWare?) / EAAudioCore library (still generated by sx.exe).
@ -244,7 +244,7 @@ static VGMSTREAM* init_vgmstream_eaaudiocore_header(STREAMFILE* sf_head, STREAMF
}
/* header done, setup decoding */
return init_vgmstream_eaaudiocore_main(&eaac, sf_head, sf_data, header_offset, start_offset, meta_type, standalone);
return init_vgmstream_eaaudiocore_main(&eaac, sf_head, sf_data, header_offset, meta_type, standalone);
fail:
return NULL;
}
@ -255,7 +255,7 @@ static STREAMFILE* setup_eaac_streamfile(eaac_header_t* ea, STREAMFILE* sf_head,
static size_t calculate_eaac_size(STREAMFILE* sf, eaac_header_t* ea, uint32_t num_samples, off_t start_offset, int is_ram);
static VGMSTREAM* init_vgmstream_eaaudiocore_main(eaac_header_t* eaac, STREAMFILE* sf_head, STREAMFILE* sf_data, off_t header_offset, off_t _start_offset, meta_t meta_type, bool standalone) {
static VGMSTREAM* init_vgmstream_eaaudiocore_main(eaac_header_t* eaac, STREAMFILE* sf_head, STREAMFILE* sf_data, off_t header_offset, meta_t meta_type, bool standalone) {
VGMSTREAM* vgmstream = NULL;
STREAMFILE *temp_sf = NULL, *sf = NULL, *sf_sns = NULL;

View File

@ -54,7 +54,7 @@ VGMSTREAM* init_vgmstream_mul(STREAMFILE* sf) {
{
float check1 = read_f32(0x38,sf);
float check2 = read_f32(0x3c,sf);
if (!(check1 >= 1.0 && check1 <= 3000.0) && check2 != 1.0)
if (!(check1 >= 1.0f && check1 <= 3000.0f) && check2 != 1.0f)
goto fail;
}

View File

@ -823,7 +823,7 @@ static int parse_psb(STREAMFILE* sf, psb_header_t* psb) {
/* enforced by M2 code */
version = psb_node_get_float(&nroot, "version");
if (version < 1.02f || version > 1.02f) {
vgm_logi("PSB: unsupported version %f (report)\n", version);
vgm_logi("PSB: unsupported version %f (report)\n", (double)version);
goto fail;
}

View File

@ -990,7 +990,7 @@ static int parse_type_silence(ubi_bao_header* bao, off_t offset, STREAMFILE* sf)
bao->duration = read_f32(h_offset + bao->cfg.silence_duration_float, sf);
if (bao->duration <= 0.0f) {
VGM_LOG("UBI BAO: bad duration %f at %x\n", bao->duration, (uint32_t)offset);
VGM_LOG("UBI BAO: bad duration %f at %x\n", (double)bao->duration, (uint32_t)offset);
goto fail;
}

View File

@ -2494,6 +2494,8 @@ static int parse_header(ubi_sb_header* sb, STREAMFILE* sf, off_t offset, int ind
sb->duration = 1.0f;
break;
}
// fall through
default:
VGM_LOG("UBI SB: unknown header type %x at %x\n", sb->header_type, (uint32_t)offset);
goto fail;

View File

@ -156,8 +156,8 @@ static int lz4mg_decompress(lz4mg_stream_t* strm) {
} while (next_len == LZ4MG_VARLEN_CONTINUE);
ctx->state = SET_MATCH;
//break; // Falthrough for MSVC
//break; // for MSVC (jump threading optimization compiler bug, fixed in ~2023-12)
// fall through
case SET_MATCH:
ctx->match_len += LZ4MG_MIN_MATCH_LEN;
@ -166,8 +166,8 @@ static int lz4mg_decompress(lz4mg_stream_t* strm) {
ctx->match_pos = LZ4MG_WINDOW_SIZE + ctx->match_pos;
ctx->state = COPY_MATCH;
//break; // Fallthrough for MSVC
//break; // for MSVC (jump threading optimization compiler bug, fixed in ~2023-12)
// fall through
case COPY_MATCH:
while (ctx->match_len > 0) {
if (dst_pos >= dst_size)

View File

@ -812,7 +812,7 @@ static void print_internal(psb_node_t* curr, int depth) {
break;
case PSB_TYPE_FLOAT:
printf("%f,\n", res.flt);
printf("%f,\n", (double)res.flt);
break;
case PSB_TYPE_STRING: