mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-23 22:41:05 +01:00
update libcelt
- compiled with mingw-w64 GCC 12.2 - properly stripped and exports external API only - uses (symbol)_(version) renames for consistency
This commit is contained in:
parent
f5e4a952e2
commit
0c77e5bec4
@ -24,7 +24,7 @@ if(NOT WIN32 AND USE_CELT)
|
||||
set(CELT_0110_LINK_PATH ${CELT_0110_BIN}/libcelt/.libs/libcelt0.a)
|
||||
|
||||
configure_file(
|
||||
${VGM_SOURCE_DIR}/ext_libs/celt-0110/ecintrin.h
|
||||
${VGM_SOURCE_DIR}/ext_libs/builds/celt-0110/ecintrin.h
|
||||
${CELT_0110_PATH}/libcelt/ecintrin.h
|
||||
COPYONLY)
|
||||
|
||||
@ -100,11 +100,7 @@ if(NOT WIN32 AND USE_CELT)
|
||||
|
||||
foreach(ver 0061 0110)
|
||||
foreach(source ${CELT_CFLAGS})
|
||||
string(REGEX REPLACE "^([^_]+)" "\\1_${ver}" target ${source})
|
||||
if(source STREQUAL ${target})
|
||||
set(target "${source}_${ver}")
|
||||
endif()
|
||||
list(APPEND CELT_${ver}_CFLAGS "-D${source}=${target}")
|
||||
list(APPEND CELT_${ver}_CFLAGS "-D${source}=${source}_${ver}")
|
||||
endforeach()
|
||||
list(APPEND CELT_${ver}_CFLAGS "-fPIC")
|
||||
|
||||
|
@ -57,15 +57,15 @@
|
||||
/** State of the decoder. One decoder state is needed for each stream.
|
||||
It is initialised once at the beginning of the stream. Do *not*
|
||||
re-initialise the state for every frame */
|
||||
typedef struct CELT0061Decoder CELT0061Decoder;
|
||||
typedef struct CELT0110Decoder CELT0110Decoder;
|
||||
typedef struct CELTDecoder0061 CELTDecoder0061;
|
||||
typedef struct CELTDecoder CELTDecoder0110;
|
||||
|
||||
/** The mode contains all the information necessary to create an
|
||||
encoder. Both the encoder and decoder need to be initialised
|
||||
with exactly the same mode, otherwise the quality will be very
|
||||
bad */
|
||||
typedef struct CELT0061Mode CELT0061Mode;
|
||||
typedef struct CELT0110Mode CELT0110Mode;
|
||||
typedef struct CELTMode0061 CELTMode0061;
|
||||
typedef struct CELTMode0110 CELTMode0110;
|
||||
|
||||
|
||||
/* Mode calls */
|
||||
@ -80,19 +80,19 @@ typedef struct CELT0110Mode CELT0110Mode;
|
||||
@param error Returned error code (if NULL, no error will be returned)
|
||||
@return A newly created mode
|
||||
*/
|
||||
EXPORT CELT0061Mode *celt_0061_mode_create(celt_int32 Fs, int channels, int frame_size, int *error);
|
||||
EXPORT CELT0110Mode *celt_0110_mode_create(celt_int32 Fs, int frame_size, int *error);
|
||||
/*EXPORT*/ CELTMode0061 *celt_mode_create_0061(celt_int32 Fs, int channels, int frame_size, int *error);
|
||||
/*EXPORT*/ CELTMode0110 *celt_mode_create_0110(celt_int32 Fs, int frame_size, int *error);
|
||||
|
||||
/** Destroys a mode struct. Only call this after all encoders and
|
||||
decoders using this mode are destroyed as well.
|
||||
@param mode Mode to be destroyed
|
||||
*/
|
||||
EXPORT void celt_0061_mode_destroy(CELT0061Mode *mode);
|
||||
EXPORT void celt_0110_mode_destroy(CELT0110Mode *mode);
|
||||
/*EXPORT*/ void celt_mode_destroy_0061(CELTMode0061 *mode);
|
||||
/*EXPORT*/ void celt_mode_destroy_0110(CELTMode0110 *mode);
|
||||
|
||||
/** Query information from a mode */
|
||||
EXPORT int celt_0061_mode_info(const CELT0061Mode *mode, int request, celt_int32 *value);
|
||||
EXPORT int celt_0110_mode_info(const CELT0110Mode *mode, int request, celt_int32 *value);
|
||||
/*EXPORT*/ int celt_mode_info_0061(const CELTMode0061 *mode, int request, celt_int32 *value);
|
||||
/*EXPORT*/ int celt_mode_info_0110(const CELTMode0110 *mode, int request, celt_int32 *value);
|
||||
|
||||
|
||||
/* Decoder stuff */
|
||||
@ -105,14 +105,14 @@ EXPORT int celt_0110_mode_info(const CELT0110Mode *mode, int request, celt_int32
|
||||
@param error Returns an error code
|
||||
@return Newly created decoder state.
|
||||
*/
|
||||
EXPORT CELT0061Decoder *celt_0061_decoder_create(const CELT0061Mode *mode);
|
||||
EXPORT CELT0110Decoder *celt_0110_decoder_create_custom(const CELT0110Mode *mode, int channels, int *error);
|
||||
/*EXPORT*/ CELTDecoder0061 *celt_decoder_create_0061(const CELTMode0061 *mode);
|
||||
/*EXPORT*/ CELTDecoder0110 *celt_decoder_create_custom_0110(const CELTMode0110 *mode, int channels, int *error);
|
||||
|
||||
/** Destroys a a decoder state.
|
||||
@param st Decoder state to be destroyed
|
||||
*/
|
||||
EXPORT void celt_0061_decoder_destroy(CELT0061Decoder *st);
|
||||
EXPORT void celt_0110_decoder_destroy(CELT0110Decoder *st);
|
||||
/*EXPORT*/ void celt_decoder_destroy_0061(CELTDecoder0061 *st);
|
||||
/*EXPORT*/ void celt_decoder_destroy_0110(CELTDecoder0110 *st);
|
||||
|
||||
/** Decodes a frame of audio.
|
||||
@param st Decoder state
|
||||
@ -123,8 +123,8 @@ EXPORT void celt_0110_decoder_destroy(CELT0110Decoder *st);
|
||||
returned here in 16-bit PCM format (native endian).
|
||||
@return Error code.
|
||||
*/
|
||||
EXPORT int celt_0061_decode(CELT0061Decoder *st, const unsigned char *data, int len, celt_int16 *pcm);
|
||||
EXPORT int celt_0110_decode(CELT0110Decoder *st, const unsigned char *data, int len, celt_int16 *pcm, int frame_size);
|
||||
/*EXPORT*/ int celt_decode_0061(CELTDecoder0061 *st, const unsigned char *data, int len, celt_int16 *pcm);
|
||||
/*EXPORT*/ int celt_decode_0110(CELTDecoder0110 *st, const unsigned char *data, int len, celt_int16 *pcm, int frame_size);
|
||||
|
||||
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
LIBRARY libcelt-0061.dll
|
||||
EXPORTS
|
||||
celt_0061_decode
|
||||
celt_0061_decoder_create
|
||||
celt_0061_decoder_destroy
|
||||
celt_0061_mode_create
|
||||
celt_0061_mode_destroy
|
||||
celt_0061_mode_info
|
||||
celt_decode_0061
|
||||
celt_decoder_create_0061
|
||||
celt_decoder_destroy_0061
|
||||
celt_mode_create_0061
|
||||
celt_mode_destroy_0061
|
||||
celt_mode_info_0061
|
||||
; symbols not used by vgmstream were ommited
|
||||
|
Binary file not shown.
@ -1,8 +1,9 @@
|
||||
LIBRARY libcelt-0110.dll
|
||||
EXPORTS
|
||||
celt_0110_decode
|
||||
celt_0110_decoder_create_custom
|
||||
celt_0110_decoder_destroy
|
||||
celt_0110_mode_create
|
||||
celt_0110_mode_destroy
|
||||
celt_0110_mode_info
|
||||
celt_decode_0110
|
||||
celt_decoder_create_custom_0110
|
||||
celt_decoder_destroy_0110
|
||||
celt_mode_create_0110
|
||||
celt_mode_destroy_0110
|
||||
celt_mode_info_0110
|
||||
; symbols not used by vgmstream were ommited
|
||||
|
Binary file not shown.
@ -21,15 +21,15 @@ struct celt_codec_data {
|
||||
|
||||
int channel_mode;
|
||||
celt_lib_t version;
|
||||
void *mode_handle;
|
||||
void *decoder_handle;
|
||||
void* mode_handle;
|
||||
void* decoder_handle;
|
||||
};
|
||||
|
||||
|
||||
/* FSB CELT, frames with custom header and standard data (API info from FMOD DLLs).
|
||||
* FMOD used various libcelt versions, thus some tweaks are needed for them to coexist. */
|
||||
|
||||
celt_codec_data *init_celt_fsb(int channels, celt_lib_t version) {
|
||||
celt_codec_data* init_celt_fsb(int channels, celt_lib_t version) {
|
||||
int error = 0, lib_version = 0;
|
||||
celt_codec_data* data = NULL;
|
||||
|
||||
@ -42,24 +42,24 @@ celt_codec_data *init_celt_fsb(int channels, celt_lib_t version) {
|
||||
|
||||
switch(data->version) {
|
||||
case CELT_0_06_1: /* older FSB4 (FMOD ~4.33) */
|
||||
data->mode_handle = celt_0061_mode_create(FSB_CELT_INTERNAL_SAMPLE_RATE, data->channel_mode, FSB_CELT_SAMPLES_PER_FRAME, &error);
|
||||
data->mode_handle = celt_mode_create_0061(FSB_CELT_INTERNAL_SAMPLE_RATE, data->channel_mode, FSB_CELT_SAMPLES_PER_FRAME, &error);
|
||||
if (!data->mode_handle || error != CELT_OK) goto fail;
|
||||
|
||||
error = celt_0061_mode_info(data->mode_handle, CELT_GET_BITSTREAM_VERSION, &lib_version);
|
||||
error = celt_mode_info_0061(data->mode_handle, CELT_GET_BITSTREAM_VERSION, &lib_version);
|
||||
if (error != CELT_OK || lib_version != FSB_CELT_0_06_1_VERSION) goto fail;
|
||||
|
||||
data->decoder_handle = celt_0061_decoder_create(data->mode_handle);
|
||||
data->decoder_handle = celt_decoder_create_0061(data->mode_handle);
|
||||
if (!data->decoder_handle) goto fail;
|
||||
break;
|
||||
|
||||
case CELT_0_11_0: /* newer FSB4 (FMOD ~4.34), FSB5 */
|
||||
data->mode_handle = celt_0110_mode_create(FSB_CELT_INTERNAL_SAMPLE_RATE, FSB_CELT_SAMPLES_PER_FRAME, &error); /* "custom" and not ok? */
|
||||
data->mode_handle = celt_mode_create_0110(FSB_CELT_INTERNAL_SAMPLE_RATE, FSB_CELT_SAMPLES_PER_FRAME, &error); /* "custom" and not ok? */
|
||||
if (!data->mode_handle || error != CELT_OK) goto fail;
|
||||
|
||||
error = celt_0110_mode_info(data->mode_handle, CELT_GET_BITSTREAM_VERSION, &lib_version);
|
||||
error = celt_mode_info_0110(data->mode_handle, CELT_GET_BITSTREAM_VERSION, &lib_version);
|
||||
if (error != CELT_OK || lib_version != FSB_CELT_0_11_0_VERSION) goto fail;
|
||||
|
||||
data->decoder_handle = celt_0110_decoder_create_custom(data->mode_handle, data->channel_mode, &error);
|
||||
data->decoder_handle = celt_decoder_create_custom_0110(data->mode_handle, data->channel_mode, &error);
|
||||
if (!data->decoder_handle || error != CELT_OK) goto fail;
|
||||
break;
|
||||
|
||||
@ -136,11 +136,11 @@ void decode_celt_fsb(VGMSTREAM* vgmstream, sample_t* outbuf, int32_t samples_to_
|
||||
|
||||
switch(data->version) {
|
||||
case CELT_0_06_1:
|
||||
status = celt_0061_decode(data->decoder_handle, data_buffer,bytes, data->sample_buffer);
|
||||
status = celt_decode_0061(data->decoder_handle, data_buffer,bytes, data->sample_buffer);
|
||||
break;
|
||||
|
||||
case CELT_0_11_0:
|
||||
status = celt_0110_decode(data->decoder_handle, data_buffer,bytes, data->sample_buffer, FSB_CELT_SAMPLES_PER_FRAME);
|
||||
status = celt_decode_0110(data->decoder_handle, data_buffer,bytes, data->sample_buffer, FSB_CELT_SAMPLES_PER_FRAME);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -167,16 +167,16 @@ void reset_celt_fsb(celt_codec_data* data) {
|
||||
/* recreate decoder (mode should not change) */
|
||||
switch(data->version) {
|
||||
case CELT_0_06_1:
|
||||
if (data->decoder_handle) celt_0061_decoder_destroy(data->decoder_handle);
|
||||
if (data->decoder_handle) celt_decoder_destroy_0061(data->decoder_handle);
|
||||
|
||||
data->decoder_handle = celt_0061_decoder_create(data->mode_handle);
|
||||
data->decoder_handle = celt_decoder_create_0061(data->mode_handle);
|
||||
if (!data->decoder_handle) goto fail;
|
||||
break;
|
||||
|
||||
case CELT_0_11_0:
|
||||
if (data->decoder_handle) celt_0110_decoder_destroy(data->decoder_handle);
|
||||
if (data->decoder_handle) celt_decoder_destroy_0110(data->decoder_handle);
|
||||
|
||||
data->decoder_handle = celt_0110_decoder_create_custom(data->mode_handle, data->channel_mode, NULL);
|
||||
data->decoder_handle = celt_decoder_create_custom_0110(data->mode_handle, data->channel_mode, NULL);
|
||||
if (!data->decoder_handle) goto fail;
|
||||
break;
|
||||
|
||||
@ -211,13 +211,13 @@ void free_celt_fsb(celt_codec_data* data) {
|
||||
|
||||
switch(data->version) {
|
||||
case CELT_0_06_1:
|
||||
if (data->decoder_handle) celt_0061_decoder_destroy(data->decoder_handle);
|
||||
if (data->mode_handle) celt_0061_mode_destroy(data->mode_handle);
|
||||
if (data->decoder_handle) celt_decoder_destroy_0061(data->decoder_handle);
|
||||
if (data->mode_handle) celt_mode_destroy_0061(data->mode_handle);
|
||||
break;
|
||||
|
||||
case CELT_0_11_0:
|
||||
if (data->decoder_handle) celt_0110_decoder_destroy(data->decoder_handle);
|
||||
if (data->mode_handle) celt_0110_mode_destroy(data->mode_handle);
|
||||
if (data->decoder_handle) celt_decoder_destroy_0110(data->decoder_handle);
|
||||
if (data->mode_handle) celt_mode_destroy_0110(data->mode_handle);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user