Clean up resource files 84/300384/3
authorJaechul Lee <jcsing.lee@samsung.com>
Mon, 23 Oct 2023 08:41:12 +0000 (17:41 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Tue, 24 Oct 2023 08:21:28 +0000 (17:21 +0900)
[Version] 0.0.16
[Issue Type] Update

Change-Id: Iad26a4bc19ee488baa195bb8de2b7b6d26a5dd3a
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
20 files changed:
meson.build
packaging/libaudio-effect.spec
test/aec_speex_test.c
test/aec_webrtc_test.c
test/agc_speex_test.c
test/amplify_test.c
test/meson.build
test/ns_rnnoise_test.c
test/ns_srid_test.c
test/refcopy_test.c
test/resources/airport_48k.raw [deleted file]
test/resources/airport_48k_2ch.raw [deleted file]
test/resources/noise_48k.raw [new file with mode: 0644]
test/resources/noise_48k_2ch.raw [new file with mode: 0644]
test/resources/obama.raw [deleted file]
test/resources/obama_2ch.raw [deleted file]
test/resources/obama_48k_2ch.raw [deleted file]
test/resources/speech.raw [new file with mode: 0644]
test/resources/speech_2ch.raw [new file with mode: 0644]
test/resources/speech_48k_2ch.raw [new file with mode: 0644]

index e6bfa5af3a872fe9fbf82e117b5d8d774926bdc9..8dc5442cd724d90d12bb434941e55f452f1adaf9 100644 (file)
@@ -138,15 +138,6 @@ pkg.generate(
 # --- test include ---
 if get_option('testsuite').enabled()
   subdir('test')
-  configure_file(input: './test/resources/obama.raw',  output: 'obama.raw',  copy: true)
-  configure_file(input: './test/resources/rec.raw',  output: 'rec.raw',  copy: true)
-  configure_file(input: './test/resources/ref.raw',  output: 'ref.raw',  copy: true)
-  configure_file(input: './test/resources/rec_refcopy_5ch.raw',  output: 'rec_refcopy.raw',  copy: true)
-  configure_file(input: './test/resources/airport_48k.raw',  output: 'airport_48k.raw',  copy: true)
-  configure_file(input: './test/resources/airport_48k_2ch.raw',  output: 'airport_48k_2ch.raw',  copy: true)
-  configure_file(input: './test/resources/obama.raw',  output: 'agc_speex_in.raw',  copy: true)
-  configure_file(input: './test/resources/obama_2ch.raw',  output: 'agc_speex_in_2ch.raw',  copy: true)
-  configure_file(input: './test/resources/obama_48k_2ch.raw',  output: 'agc_speex_in_48k_2ch.raw',  copy: true)
 endif
 
 # --- install pkg-config ---
index b51e26deb0259d7623b3fefd6d7bab8d68ba768d..18edb1165e5f443feadd3951311985b20e8f10e1 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libaudio-effect
 Summary:    audio effect library
-Version:    0.0.15
+Version:    0.0.16
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 8a98acba59a1805a0f9893a486c621b8ba5f00c0..278ec894098476713ed60285c1dddad21719342d 100644 (file)
@@ -4,12 +4,11 @@
 #include <sys/stat.h>
 
 #include "audio_effect.h"
+#include "resources.h"
 
 #define FRAME_SIZE 160
 
-#define RECORDING_FILE "rec.raw"
-#define REFERENCE_FILE "obama.raw"
-#define OUTPUT_FILE "aec_speex_out.raw"
+#define OUTPUT_FILE "output_aec_speex.raw"
 #define MIN(a, b) (a > b ? b : a)
 
 int main(void)
@@ -34,19 +33,19 @@ int main(void)
 
        printf("--- aec speex test start ---\n");
 
-       stat(RECORDING_FILE, &st);
+       stat(AEC_RECORDING_FILE_NAME, &st);
        rec_size = st.st_size;
 
-       stat(REFERENCE_FILE, &st);
+       stat(AEC_REFERENCE_FILE_NAME, &st);
        ref_size = st.st_size;
 
-       f_rec = fopen(RECORDING_FILE, "r");
+       f_rec = fopen(AEC_RECORDING_FILE_NAME, "r");
        if (!f_rec) {
                printf("failed to find rec.raw\n");
                exit(-1);
        }
 
-       f_ref = fopen(REFERENCE_FILE, "r");
+       f_ref = fopen(AEC_REFERENCE_FILE_NAME, "r");
        if (!f_ref) {
                printf("failed to find ref.raw\n");
                exit(-1);
index 858f6d0d83d5118145950a099d2cbf3383c61194..3f12b33092497f218f9b933b23dd878ba5a6f346 100644 (file)
@@ -4,12 +4,11 @@
 #include <sys/stat.h>
 
 #include "audio_effect.h"
+#include "resources.h"
 
 #define FRAME_SIZE 160
 
-#define RECORDING_FILE "rec.raw"
-#define REFERENCE_FILE "ref.raw"
-#define OUTPUT_FILE "aec_webrtc_out.raw"
+#define OUTPUT_FILE "output_aec_webrtc.raw"
 #define MIN(a, b) (a > b ? b : a)
 
 int main(void)
@@ -34,19 +33,19 @@ int main(void)
 
        printf("--- aec webrtc test start ---\n");
 
-       stat(RECORDING_FILE, &st);
+       stat(AEC_RECORDING_FILE_NAME, &st);
        rec_size = st.st_size;
 
-       stat(REFERENCE_FILE, &st);
+       stat(AEC_REFERENCE_FILE_NAME, &st);
        ref_size = st.st_size;
 
-       f_rec = fopen(RECORDING_FILE, "r");
+       f_rec = fopen(AEC_RECORDING_FILE_NAME, "r");
        if (!f_rec) {
                printf("failed to find rec.raw\n");
                exit(-1);
        }
 
-       f_ref = fopen(REFERENCE_FILE, "r");
+       f_ref = fopen(AEC_REFERENCE_FILE_NAME, "r");
        if (!f_ref) {
                printf("failed to find ref.raw\n");
                exit(-1);
index 95dd532125b3b9722fc993e3df0981d14c1d1046..13357a741bb6713d4e7dfcb8842a784406d01a87 100644 (file)
@@ -3,9 +3,14 @@
 #include <assert.h>
 
 #include "audio_effect.h"
+#include "resources.h"
 
 #define FORMAT_SIZE    2
 
+#define OUTPUT_FILE_NAME               "output_agc_speex.raw"
+#define OUTPUT_STEREO_FILE_NAME        "output_agc_speex_2ch.raw"
+#define OUTPUT_48K_STEREO_FILE_NAME    "output_agc_speex_48k_2ch.raw"
+
 int main(void)
 {
        audio_effect_s *ae;
@@ -14,8 +19,8 @@ int main(void)
        int i;
        int n = 0;
 
-       char *input_file[] = { "agc_speex_in.raw", "agc_speex_in_2ch.raw", "agc_speex_in_48k_2ch.raw" };
-       char *output_file[] = { "agc_speex_out.raw", "agc_speex_out_2ch.raw", "agc_speex_out_48k_2ch.raw" };
+       char *input_file[] = { SPEECH_FILE_NAME, SPEECH_STEREO_FILE_NAME, SPEECH_48K_STEREO_FILE_NAME };
+       char *output_file[] = { OUTPUT_FILE_NAME, OUTPUT_STEREO_FILE_NAME, OUTPUT_48K_STEREO_FILE_NAME };
 
        char *in;
        char *out;
index b92ca860a58f972c4b8a7ea0175b47ea44699feb..90231a2ee7e13534759c4403b6e8b76b2b22eee6 100644 (file)
@@ -3,8 +3,10 @@
 #include <assert.h>
 
 #include "audio_effect.h"
+#include "resources.h"
 
 #define FRAME_SIZE 160
+#define OUTPUT_FILE_NAME "output_amplify.raw"
 
 int main(void)
 {
@@ -19,13 +21,13 @@ int main(void)
 
        printf("--- amplify start ---\n");
 
-       fin = fopen("obama.raw", "r");
+       fin = fopen(SPEECH_FILE_NAME, "r");
        if (!fin) {
-               printf("failed to find obama.raw\n");
+               printf("failed to find %s\n", SPEECH_FILE_NAME);
                exit(-1);
        }
 
-       fout = fopen("amplify_out.raw", "wb");
+       fout = fopen(OUTPUT_FILE_NAME, "wb");
        if (!fout) {
                printf("failed to open raw\n");
                exit(-1);
index 7c7e918ed697a3f73b00d6e786e8402d7e2f0d0f..f54f9af90fa9d141fcbc03f4b584a4c0d97f9ea8 100644 (file)
@@ -1,5 +1,21 @@
 # meson test -C build/
 
+resource_file_list = [ [ 'SPEECH_FILE_NAME', 'speech.raw' ],
+                        [ 'SPEECH_STEREO_FILE_NAME', 'speech_2ch.raw' ],
+                        [ 'SPEECH_48K_STEREO_FILE_NAME', 'speech_48k_2ch.raw' ],
+                        [ 'NOISE_48K_FILE_NAME', 'noise_48k.raw' ],
+                        [ 'NOISE_48K_STEREO_FILE_NAME', 'noise_48k_2ch.raw' ],
+                        [ 'AEC_REFERENCE_FILE_NAME', 'rec.raw' ],
+                        [ 'AEC_RECORDING_FILE_NAME', 'ref.raw' ],
+                        [ 'AEC_REFERENCE_COPY_5CH_FILE_NAME', 'rec_refcopy_5ch.raw' ] ]
+
+cdata = configuration_data()
+foreach r : resource_file_list
+  configure_file(input: join_paths('resources/', r[1]), output: r[1], copy: false)
+  cdata.set_quoted(r[0], r[1])
+endforeach
+configure_file(output : 'resources.h', configuration : cdata)
+
 test_list = []
 
 if get_option('amplify').enabled()
@@ -31,7 +47,8 @@ if get_option('agc-speex').enabled()
 endif
 
 testsuite_env = environment()
-testsuite_env.set('LD_LIBRARY_PATH', './')
+testsuite_env.set('LD_LIBRARY_PATH', meson.build_root())
+testdir = meson.current_build_dir()
 
 foreach c : test_list
   name = c[0]
@@ -39,10 +56,11 @@ foreach c : test_list
 
   e = executable(name, sources,
     link_with: [audio_effect_shared],
-    include_directories: audio_effect_include_dir,
+    include_directories: [ audio_effect_include_dir, include_directories('./') ],
     install: true,
   )
 
-  test(name, e, env: testsuite_env)
+  test(name, e, env: testsuite_env, workdir: testdir)
 
 endforeach
+
index 1a76f66f7e7440c5adc28861549d74c53ca6a7ea..cf4120079ad751d675d63de7c3cae441dd73d13c 100644 (file)
@@ -3,11 +3,15 @@
 #include <assert.h>
 
 #include "audio_effect.h"
+#include "resources.h"
 
 #define MAX_CHANNELS 2
 #define FIXED_FRAME_SIZE 480
 #define FRAME_SIZE FIXED_FRAME_SIZE * MAX_CHANNELS
 
+#define OUTPUT_FILE_NAME               "output_rnnoise.raw"
+#define OUTPUT_STEREO_FILE_NAME        "output_rnnoise_2ch.raw"
+
 int main(void)
 {
        audio_effect_s *ae;
@@ -21,8 +25,8 @@ int main(void)
        int n = 0;
 
        int channels[MAX_CHANNELS] = { 1, 2 };
-       char *test_file[] = { "airport_48k.raw", "airport_48k_2ch.raw" };
-       char *out_file[] = { "rnnoise_out.raw", "rnnoise_2ch_out.raw" };
+       char *test_file[] = { NOISE_48K_FILE_NAME, NOISE_48K_STEREO_FILE_NAME };
+       char *out_file[] = { OUTPUT_FILE_NAME, OUTPUT_STEREO_FILE_NAME };
 
        printf("--- rnnoise start ---\n");
 
index 7284f28cfba124d9413bdb46d711ef2b654c123a..8f751385041adbb23c094021917263db8747a529 100644 (file)
@@ -3,9 +3,13 @@
 #include <assert.h>
 
 #include "audio_effect.h"
+#include "resources.h"
 
 #define FRAME_SIZE (1024) /* 48KHz:960, 16KHz:320 */
 
+#define OUTPUT_48K_FILE_NAME           "output_srid_48k.raw"
+#define OUTPUT_FILE_NAME               "output_srid.raw"
+
 int main(void)
 {
        audio_effect_s *ae;
@@ -17,8 +21,8 @@ int main(void)
 
        int i, n = 0;
 
-       const char *source_file[] = { "airport_48k.raw", "obama.raw" };
-       const char *output_file[] = { "srid_out_48k.raw", "srid_out_16k.raw" };
+       const char *source_file[] = { NOISE_48K_FILE_NAME, SPEECH_FILE_NAME };
+       const char *output_file[] = { OUTPUT_48K_FILE_NAME, OUTPUT_FILE_NAME };
 
        int loop = sizeof(source_file) / sizeof(char *);
        const int rate[] = { 48000, 16000 };
index 6b9238faeaf8c9b632977923d86551fc54266342..8f428a9d2c3d3f7c33268a72b3d96c8980267c6c 100644 (file)
@@ -4,13 +4,12 @@
 #include <sys/stat.h>
 
 #include "audio_effect.h"
+#include "resources.h"
 
 #define FRAME_SIZE 160
 #define CHANNELS 5
 
-#define RECORDING_FILE "rec_refcopy.raw"
-#define REFERENCE_FILE "obama.raw"
-#define OUTPUT_FILE "refcopy_out.raw"
+#define OUTPUT_FILE "output_refcopy_out.raw"
 #define MIN(a, b) (a > b ? b : a)
 
 int main(void)
@@ -35,19 +34,19 @@ int main(void)
 
        printf("--- refcopy test start ---\n");
 
-       stat(RECORDING_FILE, &st);
+       stat(AEC_REFERENCE_COPY_5CH_FILE_NAME, &st);
        rec_size = st.st_size;
 
-       stat(REFERENCE_FILE, &st);
+       stat(SPEECH_FILE_NAME, &st);
        ref_size = st.st_size;
 
-       f_rec = fopen(RECORDING_FILE, "r");
+       f_rec = fopen(AEC_REFERENCE_COPY_5CH_FILE_NAME, "r");
        if (!f_rec) {
                printf("failed to find rec.raw\n");
                exit(-1);
        }
 
-       f_ref = fopen(REFERENCE_FILE, "r");
+       f_ref = fopen(SPEECH_FILE_NAME, "r");
        if (!f_ref) {
                printf("failed to find ref.raw\n");
                exit(-1);
diff --git a/test/resources/airport_48k.raw b/test/resources/airport_48k.raw
deleted file mode 100644 (file)
index 790f343..0000000
Binary files a/test/resources/airport_48k.raw and /dev/null differ
diff --git a/test/resources/airport_48k_2ch.raw b/test/resources/airport_48k_2ch.raw
deleted file mode 100644 (file)
index f2bab8a..0000000
Binary files a/test/resources/airport_48k_2ch.raw and /dev/null differ
diff --git a/test/resources/noise_48k.raw b/test/resources/noise_48k.raw
new file mode 100644 (file)
index 0000000..790f343
Binary files /dev/null and b/test/resources/noise_48k.raw differ
diff --git a/test/resources/noise_48k_2ch.raw b/test/resources/noise_48k_2ch.raw
new file mode 100644 (file)
index 0000000..f2bab8a
Binary files /dev/null and b/test/resources/noise_48k_2ch.raw differ
diff --git a/test/resources/obama.raw b/test/resources/obama.raw
deleted file mode 100644 (file)
index 7220142..0000000
Binary files a/test/resources/obama.raw and /dev/null differ
diff --git a/test/resources/obama_2ch.raw b/test/resources/obama_2ch.raw
deleted file mode 100644 (file)
index fccae1f..0000000
Binary files a/test/resources/obama_2ch.raw and /dev/null differ
diff --git a/test/resources/obama_48k_2ch.raw b/test/resources/obama_48k_2ch.raw
deleted file mode 100644 (file)
index 8e71b1e..0000000
Binary files a/test/resources/obama_48k_2ch.raw and /dev/null differ
diff --git a/test/resources/speech.raw b/test/resources/speech.raw
new file mode 100644 (file)
index 0000000..7220142
Binary files /dev/null and b/test/resources/speech.raw differ
diff --git a/test/resources/speech_2ch.raw b/test/resources/speech_2ch.raw
new file mode 100644 (file)
index 0000000..fccae1f
Binary files /dev/null and b/test/resources/speech_2ch.raw differ
diff --git a/test/resources/speech_48k_2ch.raw b/test/resources/speech_48k_2ch.raw
new file mode 100644 (file)
index 0000000..8e71b1e
Binary files /dev/null and b/test/resources/speech_48k_2ch.raw differ