Namespace exported symbols.

This commit is contained in:
2021-10-30 21:58:10 +01:00
parent 49f0ea6c33
commit 37e8a8b4c7
9 changed files with 102 additions and 104 deletions

8
adc.c
View File

@@ -37,10 +37,10 @@ FORCE_INLINE int GetOffset(uint8_t chunk[])
}
}
AARU_EXPORT int32_t AARU_CALL adc_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size)
AARU_EXPORT int32_t AARU_CALL AARU_adc_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size)
{
int inputPosition = 0;
int chunkSize;

View File

@@ -24,10 +24,10 @@
#include "library.h"
#include "apple_rle.h"
AARU_EXPORT int32_t AARU_CALL apple_rle_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size)
AARU_EXPORT int32_t AARU_CALL AARU_apple_rle_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size)
{
static int32_t count = 0;
static bool nextA = true; // true if A, false if B

38
flac.c
View File

@@ -21,10 +21,10 @@ static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder*
static void
error_callback(const FLAC__StreamDecoder* decoder, FLAC__StreamDecoderErrorStatus status, void* client_data);
AARU_EXPORT size_t AARU_CALL flac_decode_redbook_buffer(uint8_t* dst_buffer,
size_t dst_size,
const uint8_t* src_buffer,
size_t src_size)
AARU_EXPORT size_t AARU_CALL AARU_flac_decode_redbook_buffer(uint8_t* dst_buffer,
size_t dst_size,
const uint8_t* src_buffer,
size_t src_size)
{
FLAC__StreamDecoder* decoder;
FLAC__StreamDecoderInitStatus init_status;
@@ -135,21 +135,21 @@ static FLAC__StreamEncoderWriteStatus encoder_write_callback(const FLAC__StreamE
uint32_t current_frame,
void* client_data);
AARU_EXPORT size_t AARU_CALL flac_encode_redbook_buffer(uint8_t* dst_buffer,
size_t dst_size,
const uint8_t* src_buffer,
size_t src_size,
uint32_t blocksize,
int32_t do_mid_side_stereo,
int32_t loose_mid_side_stereo,
const char* apodization,
uint32_t qlp_coeff_precision,
int32_t do_qlp_coeff_prec_search,
int32_t do_exhaustive_model_search,
uint32_t min_residual_partition_order,
uint32_t max_residual_partition_order,
const char* application_id,
uint32_t application_id_len)
AARU_EXPORT size_t AARU_CALL AARU_flac_encode_redbook_buffer(uint8_t* dst_buffer,
size_t dst_size,
const uint8_t* src_buffer,
size_t src_size,
uint32_t blocksize,
int32_t do_mid_side_stereo,
int32_t loose_mid_side_stereo,
const char* apodization,
uint32_t qlp_coeff_precision,
int32_t do_qlp_coeff_prec_search,
int32_t do_exhaustive_model_search,
uint32_t min_residual_partition_order,
uint32_t max_residual_partition_order,
const char* application_id,
uint32_t application_id_len)
{
FLAC__StreamEncoder* encoder;
aaru_flac_ctx* ctx = (aaru_flac_ctx*)malloc(sizeof(aaru_flac_ctx));

View File

@@ -54,47 +54,47 @@
#define FORCE_INLINE static inline __attribute__((always_inline))
#endif
AARU_EXPORT int32_t AARU_CALL adc_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size);
AARU_EXPORT int32_t AARU_CALL AARU_adc_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size);
AARU_EXPORT int32_t AARU_CALL apple_rle_decode_buffer(uint8_t* dst_buffer,
AARU_EXPORT int32_t AARU_CALL AARU_apple_rle_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size);
AARU_EXPORT size_t AARU_CALL AARU_flac_decode_redbook_buffer(uint8_t* dst_buffer,
size_t dst_size,
const uint8_t* src_buffer,
size_t src_size);
AARU_EXPORT size_t AARU_CALL AARU_flac_encode_redbook_buffer(uint8_t* dst_buffer,
size_t dst_size,
const uint8_t* src_buffer,
size_t src_size,
uint32_t blocksize,
int32_t do_mid_side_stereo,
int32_t loose_mid_side_stereo,
const char* apodization,
uint32_t qlp_coeff_precision,
int32_t do_qlp_coeff_prec_search,
int32_t do_exhaustive_model_search,
uint32_t min_residual_partition_order,
uint32_t max_residual_partition_order,
const char* application_id,
uint32_t application_id_len);
AARU_EXPORT int32_t AARU_CALL AARU_lzip_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size);
AARU_EXPORT size_t AARU_CALL flac_decode_redbook_buffer(uint8_t* dst_buffer,
size_t dst_size,
const uint8_t* src_buffer,
size_t src_size);
AARU_EXPORT size_t AARU_CALL flac_encode_redbook_buffer(uint8_t* dst_buffer,
size_t dst_size,
const uint8_t* src_buffer,
size_t src_size,
uint32_t blocksize,
int32_t do_mid_side_stereo,
int32_t loose_mid_side_stereo,
const char* apodization,
uint32_t qlp_coeff_precision,
int32_t do_qlp_coeff_prec_search,
int32_t do_exhaustive_model_search,
uint32_t min_residual_partition_order,
uint32_t max_residual_partition_order,
const char* application_id,
uint32_t application_id_len);
AARU_EXPORT int32_t AARU_CALL lzip_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size);
AARU_EXPORT int32_t AARU_CALL lzip_encode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size,
int32_t dictionary_size,
int32_t match_len_limit);
AARU_EXPORT int32_t AARU_CALL AARU_lzip_encode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size,
int32_t dictionary_size,
int32_t match_len_limit);
#endif // AARU_COMPRESSION_NATIVE_LIBRARY_H

20
lzip.c
View File

@@ -23,10 +23,10 @@
#include "library.h"
#include "3rdparty/lzlib-1.12/lzlib.h"
AARU_EXPORT int32_t AARU_CALL lzip_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size)
AARU_EXPORT int32_t AARU_CALL AARU_lzip_decode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size)
{
int max_in_size;
void* ctx;
@@ -83,12 +83,12 @@ AARU_EXPORT int32_t AARU_CALL lzip_decode_buffer(uint8_t* dst_buffer,
return out_pos;
}
AARU_EXPORT int32_t AARU_CALL lzip_encode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size,
int32_t dictionary_size,
int32_t match_len_limit)
AARU_EXPORT int32_t AARU_CALL AARU_lzip_encode_buffer(uint8_t* dst_buffer,
int32_t dst_size,
const uint8_t* src_buffer,
int32_t src_size,
int32_t dictionary_size,
int32_t match_len_limit)
{
int max_in_size;
void* ctx;

View File

@@ -20,8 +20,8 @@
#include <cstdint>
#include <cstring>
#include "../library.h"
#include "../adc.h"
#include "../library.h"
#include "crc32.h"
#include "gtest/gtest.h"
@@ -67,7 +67,7 @@ TEST_F(adcFixture, adc)
{
auto* outBuf = (uint8_t*)malloc(327680);
auto decoded = adc_decode_buffer(outBuf, 327680, buffer, 34367);
auto decoded = AARU_adc_decode_buffer(outBuf, 327680, buffer, 34367);
EXPECT_EQ(decoded, 262144);

View File

@@ -20,8 +20,8 @@
#include <cstdint>
#include <cstring>
#include "../library.h"
#include "../apple_rle.h"
#include "../library.h"
#include "crc32.h"
#include "gtest/gtest.h"
@@ -53,9 +53,7 @@ class apple_rleFixture : public ::testing::Test
fclose(file);
}
void TearDown() {
free((void*)buffer);
}
void TearDown() { free((void*)buffer); }
~apple_rleFixture()
{
@@ -67,9 +65,9 @@ class apple_rleFixture : public ::testing::Test
TEST_F(apple_rleFixture, apple_rle)
{
auto *outBuf = (uint8_t*)malloc(32768);
auto* outBuf = (uint8_t*)malloc(32768);
auto decoded = apple_rle_decode_buffer(outBuf, 32768, buffer, 1102);
auto decoded = AARU_apple_rle_decode_buffer(outBuf, 32768, buffer, 1102);
EXPECT_EQ(decoded, 20960);

View File

@@ -20,8 +20,8 @@
#include <cstddef>
#include <cstdint>
#include "../library.h"
#include "../flac.h"
#include "../library.h"
#include "crc32.h"
#include "gtest/gtest.h"
@@ -67,7 +67,7 @@ TEST_F(flacFixture, flac)
{
auto* outBuf = (uint8_t*)malloc(9633792);
auto decoded = flac_decode_redbook_buffer(outBuf, 9633792, buffer, 6534197);
auto decoded = AARU_flac_decode_redbook_buffer(outBuf, 9633792, buffer, 6534197);
EXPECT_EQ(decoded, 9633792);
@@ -109,25 +109,25 @@ TEST_F(flacFixture, flacCompress)
original_crc = crc32_data(original, original_len);
// Compress
newSize = flac_encode_redbook_buffer(cmp_buffer,
cmp_len,
original,
original_len,
4608,
1,
0,
"partial_tukey(0/1.0/1.0)",
0,
1,
false,
0,
8,
"Aaru.Compression.Native.Tests",
strlen("Aaru.Compression.Native.Tests"));
newSize = AARU_flac_encode_redbook_buffer(cmp_buffer,
cmp_len,
original,
original_len,
4608,
1,
0,
"partial_tukey(0/1.0/1.0)",
0,
1,
false,
0,
8,
"Aaru.Compression.Native.Tests",
strlen("Aaru.Compression.Native.Tests"));
cmp_len = newSize;
// Decompress
newSize = flac_decode_redbook_buffer(decmp_buffer, decmp_len, cmp_buffer, cmp_len);
newSize = AARU_flac_decode_redbook_buffer(decmp_buffer, decmp_len, cmp_buffer, cmp_len);
decmp_len = newSize;
EXPECT_EQ(decmp_len, original_len);

View File

@@ -17,10 +17,10 @@
*/
#include <climits>
#include <cstddef>
#include <cstdint>
#include "../library.h"
#include "../lzip.h"
#include "crc32.h"
#include "gtest/gtest.h"
@@ -66,7 +66,7 @@ TEST_F(lzipFixture, lzip)
{
auto* outBuf = (uint8_t*)malloc(1048576);
auto decoded = lzip_decode_buffer(outBuf, 1048576, buffer, 1062874);
auto decoded = AARU_lzip_decode_buffer(outBuf, 1048576, buffer, 1062874);
EXPECT_EQ(decoded, 1048576);
@@ -108,11 +108,11 @@ TEST_F(lzipFixture, lzipCompress)
original_crc = crc32_data(original, original_len);
// Compress
newSize = lzip_encode_buffer(cmp_buffer, cmp_len, original, original_len, 1048576, 273);
newSize = AARU_lzip_encode_buffer(cmp_buffer, cmp_len, original, original_len, 1048576, 273);
cmp_len = newSize;
// Decompress
newSize = lzip_decode_buffer(decmp_buffer, decmp_len, cmp_buffer, cmp_len);
newSize = AARU_lzip_decode_buffer(decmp_buffer, decmp_len, cmp_buffer, cmp_len);
decmp_len = newSize;
EXPECT_EQ(decmp_len, original_len);