Add integration test 92/315192/4 accepted/tizen/unified/20240731.160114 accepted/tizen/unified/dev/20240805.054424 accepted/tizen/unified/toolchain/20240812.131742 accepted/tizen/unified/x/20240801.044121 accepted/tizen/unified/x/asan/20240813.230016
authorJaechul Lee <jcsing.lee@samsung.com>
Mon, 15 Apr 2024 04:52:49 +0000 (13:52 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Wed, 31 Jul 2024 01:28:46 +0000 (10:28 +0900)
[Version] 0.0.25
[Issue Type] Update

Change-Id: I9e74b6b33fd5d1d634d10870240a135e8922405d
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
packaging/libaudio-effect.spec
test/integration_test.c [new file with mode: 0644]
test/meson.build

index a199de1f2ea0f57755b0e4d79d4335e5b1d4dfe6..46c54748b2e6dc69ff512e503baf84cb08e1ab24 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libaudio-effect
 Summary:    audio effect library
-Version:    0.0.24
+Version:    0.0.25
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
diff --git a/test/integration_test.c b/test/integration_test.c
new file mode 100644 (file)
index 0000000..6b3c00a
--- /dev/null
@@ -0,0 +1,81 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/stat.h>
+
+#include "audio_effect.h"
+#include "resources.h"
+
+#define SAMPLERATE 16000
+#define CHANNELS 1
+
+#define FIXED_FRAME_SIZE 160
+#define FRAME_SIZE (FIXED_FRAME_SIZE * CHANNELS * 2)
+
+#define OUTPUT_FILE_NAME "output_integration.raw"
+#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
+#define FRAME_SIZE_IN_BYTES(size) (sizeof(short) * CHANNELS * size)
+
+static short in[FRAME_SIZE];
+static short ns_out[FRAME_SIZE];
+static short aec_out[FRAME_SIZE];
+static short out[FRAME_SIZE];
+static short ref[FRAME_SIZE];
+
+int main(void)
+{
+       audio_effect_s *ae[3] = { NULL, };
+       FILE *fin = NULL;
+       FILE *fref = NULL;
+       FILE *fout = NULL;
+       size_t framesize = FRAME_SIZE;
+       struct stat st;
+       off_t input_file_size;
+       audio_effect_method_e methods[3] = { AUDIO_EFFECT_METHOD_NS_RNNOISE,
+                                               AUDIO_EFFECT_METHOD_AEC_WEBRTC,
+                                               AUDIO_EFFECT_METHOD_AGC_SPEEX };
+       int i;
+
+       assert(!stat(AEC_RECORDING_16K_1CH_FILE_NAME, &st));
+       input_file_size = st.st_size;
+
+       fin = fopen(AEC_RECORDING_16K_1CH_FILE_NAME, "r");
+       assert(fin);
+
+       fref = fopen(AEC_REFERENCE_16K_1CH_FILE_NAME, "r");
+       assert(fref);
+
+       fout = fopen(OUTPUT_FILE_NAME, "wb");
+       assert(fout);
+
+       for (i=0; i<ARRAY_SIZE(ae); i++)
+               assert((ae[i] = audio_effect_create(methods[i], SAMPLERATE, CHANNELS, AUDIO_EFFECT_FORMAT_S16, FIXED_FRAME_SIZE)));
+
+       framesize = audio_effect_get_process_framesize(ae[0]);
+       printf("frame size %zu\n", framesize);
+
+       assert(input_file_size > framesize);
+
+       input_file_size /= framesize;
+       input_file_size *= framesize;
+
+       for (i=0; i<(int)input_file_size; i+=FRAME_SIZE_IN_BYTES(framesize)) {
+               assert(fread(in, FRAME_SIZE_IN_BYTES(framesize), 1, fin));
+               assert(!audio_effect_process(ae[0], in, ns_out));
+               assert(fread(ref, FRAME_SIZE_IN_BYTES(framesize), 1, fref) > 0);
+               assert(audio_effect_process_reference(ae[1], ns_out, ref, aec_out) >= 0);
+               assert(!audio_effect_process(ae[2], aec_out, out));
+               assert(fwrite(out, FRAME_SIZE_IN_BYTES(framesize), 1, fout) > 0);
+       }
+
+       for (i=0; i<ARRAY_SIZE(ae); i++)
+               audio_effect_destroy(ae[i]);
+
+       fclose(fin);
+       fclose(fref);
+       fclose(fout);
+
+       printf("--- integration test end ---\n");
+
+       return 0;
+}
index 9870ba0654336b7286d6137c336ec63e016ae845..c9e0ba26c1262425a3030c0f92c438efd766853c 100644 (file)
@@ -49,6 +49,10 @@ if get_option('agc-speex').enabled()
   test_list += [[ 'agc_speex_test', 'agc_speex_test.c' ]]
 endif
 
+if get_option('ns-rnnoise').enabled() and get_option('aec-webrtc').enabled() and get_option('agc-speex').enabled()
+  test_list += [[ 'integration_test', 'integration_test.c' ]]
+endif
+
 testsuite_env = environment()
 testsuite_env.set('LD_LIBRARY_PATH', meson.build_root())
 testdir = meson.current_build_dir()