mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
Modified to support fdk-aac sample sizes larger than 16 bits
This commit is contained in:
parent
4d5d838327
commit
b651b0884f
@ -1,5 +1,15 @@
|
||||
#include "../vgmstream.h"
|
||||
|
||||
static void convert_samples(INT_PCM * src, sample * dest, int32_t count) {
|
||||
int32_t i;
|
||||
for ( i = 0; i < count; i++ ) {
|
||||
INT_PCM sample = *src++;
|
||||
sample >>= SAMPLE_BITS - 16;
|
||||
if ( ( sample + 0x8000 ) & 0xFFFF0000 ) sample = 0x7FFF ^ ( sample >> 31 );
|
||||
*dest++ = sample;
|
||||
}
|
||||
}
|
||||
|
||||
void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels) {
|
||||
int samples_done = 0;
|
||||
|
||||
@ -25,7 +35,7 @@ void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_
|
||||
|
||||
if ( samples_remain > samples_to_do ) samples_remain = samples_to_do;
|
||||
|
||||
memcpy( outbuf, data->sample_buffer + data->sample_ptr * stream_info->numChannels, samples_remain * stream_info->numChannels * sizeof(short) );
|
||||
convert_samples( data->sample_buffer + data->sample_ptr * stream_info->numChannels, outbuf, samples_remain * stream_info->numChannels );
|
||||
|
||||
outbuf += samples_remain * stream_info->numChannels;
|
||||
|
||||
@ -61,7 +71,7 @@ void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_
|
||||
}
|
||||
}
|
||||
if ( samples_remain > samples_to_do - samples_done ) samples_remain = samples_to_do - samples_done;
|
||||
memcpy( outbuf, data->sample_buffer + data->sample_ptr * stream_info->numChannels, samples_remain * stream_info->numChannels * sizeof(short) );
|
||||
convert_samples( data->sample_buffer + data->sample_ptr * stream_info->numChannels, outbuf, samples_remain * stream_info->numChannels );
|
||||
samples_done += samples_remain;
|
||||
outbuf += samples_remain * stream_info->numChannels;
|
||||
data->sample_ptr = samples_remain;
|
||||
|
Loading…
Reference in New Issue
Block a user