aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2021-10-22 19:24:28 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2021-10-22 19:24:28 +0300
commit0168b9e49b69c90d9e2b5b8f4ab3e3f102d806a9 (patch)
treecb52a457d33e703f72fa99a7533e8274edba5b04 /test
parent0c027d2ea17751f31c86a19583dfd72f86df75da (diff)
downloadlibpqf-0168b9e49b69c90d9e2b5b8f4ab3e3f102d806a9.tar.gz
Change implementation for a bit more clear
Diffstat (limited to 'test')
-rw-r--r--test/common.c14
-rw-r--r--test/common.h6
-rw-r--r--test/ut.c154
-rw-r--r--test/ut_dca_pr.c636
-rw-r--r--test/ut_dca_pr.h19
-rw-r--r--test/ut_dca_pr_long.c638
-rw-r--r--test/ut_dca_pr_long.h19
7 files changed, 1486 insertions, 0 deletions
diff --git a/test/common.c b/test/common.c
new file mode 100644
index 0000000..2d644c4
--- /dev/null
+++ b/test/common.c
@@ -0,0 +1,14 @@
+#include "common.h"
+#include <math.h>
+
+void dct4(float* out, const float* x, int N, float scale) {
+ for (int k = 0; k < N; k++) {
+ double sum = 0;
+ for (int n = 0; n < N; n++) {
+ sum += x[n] * cos((M_PI/N) * ((double)n + 0.5) * ((double)k + 0.5));
+ }
+ out[N - 1 - k] = sum * scale;
+ }
+}
+
+
diff --git a/test/common.h b/test/common.h
new file mode 100644
index 0000000..ad42ccf
--- /dev/null
+++ b/test/common.h
@@ -0,0 +1,6 @@
+#ifndef UT_COMMON_H
+#define UT_COMMON_H
+
+void dct4(float* out, const float* x, int N, float scale);
+
+#endif
diff --git a/test/ut.c b/test/ut.c
new file mode 100644
index 0000000..f099b70
--- /dev/null
+++ b/test/ut.c
@@ -0,0 +1,154 @@
+#include <3rd/fctx/fct.h>
+
+#include "ut_dca_pr.h"
+#include "ut_dca_pr_long.h"
+
+#include "libpqf.h"
+
+#include <stdio.h>
+#include <tgmath.h>
+
+////////////////////////////////////////////////////////////////////////////////
+
+static float* create_chirp(int sz)
+{
+ int i = 0;
+ float* buf = malloc(sizeof(float) * sz);
+ static int done = 0;
+ for(i = 0; i < sz; i++) {
+ float t = i;
+ buf[i] = sinf((t + t * t * 0.5 / 2.0) * 2.0 * M_PI/(float)sz);
+ }
+ return buf;
+}
+
+#define check_reconstruction(a, b, sz) \
+ do { \
+ uint16_t i = 0; \
+ int scale = 1 << 18; \
+ for (i = 0; i < sz; i ++) { \
+ fct_chk((abs((int)round((a)[i] * scale) - (int)round((b)[i] * scale))) < 2); \
+ } \
+ } while (0) \
+
+#define PQF_TEST_COVER(module) \
+ FCT_SUITE_BGN(module) \
+ { \
+ uint16_t sb_sz = module.get_subband_sz(); \
+ uint16_t sb_num = module.get_subbands_num(); \
+ uint16_t proto_sz = module.get_proto_sz(); \
+ const float* proto = module.get_proto(); \
+ const float* dummy = calloc(sb_sz * sb_num, sizeof(float)); \
+ FCT_TEST_BGN(module-IMP) \
+ { \
+ int k;\
+ pqf_a_ctx_t ctx; \
+ int status = pqf_create_a_ctx(sb_sz, sb_num, proto_sz, proto, &ctx); \
+ fct_chk_eq_int(status, PQF_SUCCESS); \
+ float* in_buf1 = calloc(sb_sz * sb_num, sizeof(float)); \
+ in_buf1[500] = 1.0; \
+ float* out_buf = malloc(sizeof(float) * sb_sz * sb_num); \
+ float* synth_buf = malloc(sizeof(float) * sb_sz * sb_num * 2); \
+ void* dec_ctx = module.create_ctx(); \
+ pqf_do_analyse(ctx, in_buf1, out_buf); \
+ module.synth_filter(out_buf, synth_buf, dec_ctx); \
+ pqf_do_analyse(ctx, dummy, out_buf); \
+ module.synth_filter(out_buf, synth_buf + sb_sz * sb_num, dec_ctx); \
+\
+ check_reconstruction(in_buf1, synth_buf + proto_sz, sb_sz * sb_num); \
+\
+ module.free_ctx(dec_ctx); \
+ free(synth_buf); \
+ free(out_buf); \
+ free(in_buf1); \
+ } \
+ FCT_TEST_END(); \
+ FCT_TEST_BGN(module-DC) \
+ { \
+ int k; \
+ pqf_a_ctx_t ctx; \
+ uint16_t i = 0; \
+ int status = pqf_create_a_ctx(sb_sz, sb_num, proto_sz, proto, &ctx); \
+ fct_chk_eq_int(status, PQF_SUCCESS); \
+ float* in_buf1 = calloc(sb_sz * sb_num, sizeof(float)); \
+ for (i = 0; i < sb_sz * sb_num; i++) \
+ in_buf1[i] = 1.0; \
+ float* out_buf = malloc(sizeof(float) * sb_sz * sb_num); \
+ float* synth_buf = malloc(sizeof(float) * sb_sz * sb_num * 2); \
+ void* dec_ctx = module.create_ctx(); \
+ pqf_do_analyse(ctx, in_buf1, out_buf); \
+ module.synth_filter(out_buf, synth_buf, dec_ctx); \
+ pqf_do_analyse(ctx, in_buf1, out_buf); \
+ module.synth_filter(out_buf, synth_buf + sb_sz * sb_num, dec_ctx); \
+\
+ check_reconstruction(in_buf1, synth_buf + proto_sz, sb_sz * sb_num); \
+\
+ module.free_ctx(dec_ctx); \
+ free(synth_buf); \
+ free(out_buf); \
+ free(in_buf1); \
+ } \
+ FCT_TEST_END(); \
+ FCT_TEST_BGN(module-CHIRP-SHORT) \
+ { \
+ pqf_a_ctx_t ctx; \
+ int status = pqf_create_a_ctx(sb_sz, sb_num, proto_sz, proto, &ctx); \
+ uint16_t i = 0; \
+ float* chirp = create_chirp(sb_sz * sb_num); \
+ float* out_buf = malloc(sizeof(float) * sb_sz * sb_num); \
+ float* synth_buf = malloc(sizeof(float) * sb_sz * sb_num * 2); \
+ fct_chk_eq_int(status, PQF_SUCCESS); \
+ void* dec_ctx = module.create_ctx(); \
+ pqf_do_analyse(ctx, chirp, out_buf); \
+ module.synth_filter(out_buf, synth_buf, dec_ctx); \
+ pqf_do_analyse(ctx, dummy, out_buf); \
+ module.synth_filter(out_buf, synth_buf + sb_sz * sb_num, dec_ctx); \
+\
+ check_reconstruction(chirp, synth_buf + proto_sz, sb_sz * sb_num); \
+\
+ module.free_ctx(dec_ctx); \
+ free(synth_buf); \
+ free(out_buf); \
+ free(chirp); \
+ } \
+ FCT_TEST_END(); \
+ FCT_TEST_BGN(module-CHIRP-LONG) \
+ { \
+ pqf_a_ctx_t ctx; \
+ int status = pqf_create_a_ctx(sb_sz, sb_num, proto_sz, proto, &ctx); \
+ uint16_t i = 0; \
+ float* chirp = create_chirp(16384); \
+ float* out_buf = malloc(sizeof(float) * sb_sz * sb_num); \
+ float* synth_buf = malloc(sizeof(float) * 16384 + sb_sz * sb_num); \
+ fct_chk_eq_int(status, PQF_SUCCESS); \
+ void* dec_ctx = module.create_ctx(); \
+ pqf_do_analyse(ctx, chirp, out_buf); \
+ module.synth_filter(out_buf, synth_buf, dec_ctx); \
+ for (i = sb_sz * sb_num; i < 16384; i += sb_sz * sb_num) { \
+ pqf_do_analyse(ctx, chirp + i, out_buf); \
+ module.synth_filter(out_buf, synth_buf + i, dec_ctx); \
+ } \
+ pqf_do_analyse(ctx, dummy, out_buf); \
+ module.synth_filter(out_buf, synth_buf + 16384, dec_ctx); \
+\
+ check_reconstruction(chirp, synth_buf + proto_sz, 16384); \
+\
+ module.free_ctx(dec_ctx); \
+ free(synth_buf); \
+ free(out_buf); \
+ free(chirp); \
+ } \
+ FCT_TEST_END(); \
+ free((void*)dummy); \
+ } \
+ FCT_SUITE_END(); \
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+FCT_BGN()
+{
+ PQF_TEST_COVER(ut_dca_pr)
+ PQF_TEST_COVER(ut_dca_pr_long)
+}
+FCT_END();
diff --git a/test/ut_dca_pr.c b/test/ut_dca_pr.c
new file mode 100644
index 0000000..f91caec
--- /dev/null
+++ b/test/ut_dca_pr.c
@@ -0,0 +1,636 @@
+#include "ut_dca_pr.h"
+#include "common.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#define SUBBAND_SZ 16;
+#define SUBBANDS_NUM 32;
+#define PROTO_SZ 512
+
+static const float fir[PROTO_SZ] = {
+ +1.135985195E-010,
+ +7.018770981E-011,
+ -1.608403011E-008,
+ -5.083275667E-008,
+ -1.543309907E-007,
+ -3.961981463E-007,
+ -7.342250683E-007,
+ -3.970030775E-007,
+ -4.741137047E-007,
+ -6.022448247E-007,
+ -6.628192182E-007,
+ -6.982898526E-007,
+ -7.020648809E-007,
+ -6.767839409E-007,
+ -6.262345096E-007,
+ -5.564140224E-007,
+ +7.003467317E-007,
+ +8.419976893E-007,
+ +9.742954035E-007,
+ +1.085227950E-006,
+ +1.162929266E-006,
+ +1.194632091E-006,
+ +1.179182050E-006,
+ +1.033426656E-006,
+ +9.451737242E-007,
+ +1.975324267E-006,
+ +1.190443072E-006,
+ +5.234479659E-007,
+ +2.014677420E-007,
+ +7.834767501E-008,
+ -6.702406963E-010,
+ -1.613285505E-009,
+ -2.682709610E-009,
+ -3.399493131E-009,
+ +1.314406006E-008,
+ +7.506701927E-009,
+ +2.788728892E-008,
+ +1.444918922E-007,
+ +3.132386439E-007,
+ +1.399798180E-006,
+ +2.032118118E-006,
+ +2.715013807E-006,
+ +3.453840463E-006,
+ +4.195037945E-006,
+ +4.896494374E-006,
+ +5.516381407E-006,
+ +6.015239251E-006,
+ +6.361419310E-006,
+ +8.006985809E-006,
+ +8.087732567E-006,
+ +7.941360309E-006,
+ +7.568834008E-006,
+ +6.986399967E-006,
+ +6.225028756E-006,
+ +5.315936960E-006,
+ +4.429412002E-006,
+ +3.332600045E-006,
+ +8.427224429E-007,
+ +4.341498823E-007,
+ +9.458596395E-008,
+ +2.975164826E-008,
+ +6.402664354E-008,
+ -3.246264413E-008,
+ -3.809887872E-008,
+ +8.434094667E-008,
+ +6.437721822E-008,
+ +1.189317118E-006,
+ +2.497214155E-006,
+ +3.617151151E-006,
+ +3.157242645E-006,
+ +2.319611212E-006,
+ +7.869333785E-006,
+ +9.826449968E-006,
+ +1.177108606E-005,
+ +1.379448349E-005,
+ +1.571428584E-005,
+ +1.743183020E-005,
+ +1.884208177E-005,
+ +1.987093310E-005,
+ +2.042970118E-005,
+ -3.144468428E-005,
+ -3.334947178E-005,
+ -3.460439257E-005,
+ -3.515914432E-005,
+ -3.495384954E-005,
+ -3.397853652E-005,
+ -3.225446198E-005,
+ -2.978993689E-005,
+ -2.677291741E-005,
+ -1.806914770E-005,
+ -1.776598037E-005,
+ -1.661818715E-005,
+ -1.207003334E-005,
+ -6.993315310E-006,
+ -5.633860383E-007,
+ -9.984935332E-007,
+ -1.470520488E-006,
+ -1.853591357E-006,
+ +7.198007665E-007,
+ +3.086857760E-006,
+ +6.084746474E-006,
+ +9.561075785E-006,
+ +1.309637537E-005,
+ +2.263354872E-005,
+ +2.847247197E-005,
+ +3.415624451E-005,
+ +3.946387005E-005,
+ +4.425736552E-005,
+ +4.839275425E-005,
+ +5.176846025E-005,
+ +5.429694284E-005,
+ +5.595519906E-005,
+ +4.916387297E-006,
+ +9.299508747E-006,
+ +1.356193479E-005,
+ +1.751866148E-005,
+ +2.093936746E-005,
+ +2.362549276E-005,
+ +2.537086584E-005,
+ +2.618136386E-005,
+ +2.554462844E-005,
+ +3.018750249E-005,
+ +2.570833203E-005,
+ +1.985177369E-005,
+ +1.191342653E-005,
+ +2.525620175E-006,
+ -1.521241393E-005,
+ -1.617751332E-005,
+ +1.992636317E-005,
+ +1.774702469E-005,
+ +4.624524081E-005,
+ +5.610509834E-005,
+ +6.568001118E-005,
+ +7.513730816E-005,
+ +8.413690375E-005,
+ +8.757545584E-005,
+ +9.517164290E-005,
+ +1.020687996E-004,
+ +1.084438481E-004,
+ +1.140582463E-004,
+ +1.187910311E-004,
+ +1.224978914E-004,
+ +1.250260248E-004,
+ +1.262027217E-004,
+ +1.226499153E-004,
+ +1.213575742E-004,
+ +1.180980107E-004,
+ +1.126275165E-004,
+ +1.047207043E-004,
+ +9.417100227E-005,
+ +8.078388782E-005,
+ +6.447290798E-005,
+ +4.491530854E-005,
+ +2.470704203E-005,
+ -1.714242217E-006,
+ -3.193307566E-005,
+ -6.541742187E-005,
+ -1.024175072E-004,
+ -1.312203676E-004,
+ -1.774113771E-004,
+ -2.233728592E-004,
+ -2.682086197E-004,
+ -3.347633174E-004,
+ -3.906481725E-004,
+ -4.490280990E-004,
+ -5.099929986E-004,
+ -5.729619297E-004,
+ -6.358824321E-004,
+ -7.021900383E-004,
+ -7.698345580E-004,
+ -8.385353722E-004,
+ -9.078957955E-004,
+ -9.775133803E-004,
+ -1.046945457E-003,
+ -1.115717343E-003,
+ -1.183370827E-003,
+ -1.252829796E-003,
+ -1.316190348E-003,
+ -1.376571832E-003,
+ -1.433344092E-003,
+ -1.485876855E-003,
+ -1.533520175E-003,
+ -1.575609902E-003,
+ -1.611457788E-003,
+ -1.640390139E-003,
+ -1.661288203E-003,
+ -1.674512983E-003,
+ -1.678415807E-003,
+ -1.672798418E-003,
+ -1.656501088E-003,
+ -1.633993932E-003,
+ -1.593449386E-003,
+ +1.542080659E-003,
+ +1.479332102E-003,
+ +1.395521569E-003,
+ +1.303116791E-003,
+ +1.196175464E-003,
+ +1.073757303E-003,
+ +9.358961834E-004,
+ +7.817269652E-004,
+ +6.114174030E-004,
+ +4.244441516E-004,
+ +2.206075296E-004,
+ -2.719412748E-007,
+ -2.382978710E-004,
+ -4.935106263E-004,
+ -7.658848190E-004,
+ -1.055365428E-003,
+ -1.361547387E-003,
+ -1.684492454E-003,
+ -2.023874084E-003,
+ -2.379294252E-003,
+ -2.750317100E-003,
+ -3.136433195E-003,
+ -3.537061159E-003,
+ -3.951539751E-003,
+ -4.379155114E-003,
+ -4.819062538E-003,
+ -5.270531867E-003,
+ -5.732392892E-003,
+ -6.203945260E-003,
+ -6.683901884E-003,
+ -7.170005701E-003,
+ -7.664063945E-003,
+ -8.162760176E-003,
+ -8.665001951E-003,
+ -9.170533158E-003,
+ -9.676489048E-003,
+ -1.018219907E-002,
+ -1.068630442E-002,
+ -1.118756086E-002,
+ -1.168460958E-002,
+ -1.217562053E-002,
+ -1.265939046E-002,
+ -1.313448418E-002,
+ -1.359948888E-002,
+ -1.405300573E-002,
+ -1.449365262E-002,
+ -1.492007636E-002,
+ -1.533095632E-002,
+ -1.572482102E-002,
+ -1.610082202E-002,
+ -1.645756140E-002,
+ -1.679391414E-002,
+ -1.710879989E-002,
+ -1.740120351E-002,
+ -1.767017506E-002,
+ -1.791484281E-002,
+ -1.813439466E-002,
+ -1.832821220E-002,
+ -1.849545911E-002,
+ -1.863567345E-002,
+ -1.874836907E-002,
+ -1.883326657E-002,
+ -1.889026538E-002,
+ -1.891860925E-002,
+ +1.891860925E-002,
+ +1.889026538E-002,
+ +1.883326657E-002,
+ +1.874836907E-002,
+ +1.863567345E-002,
+ +1.849545911E-002,
+ +1.832821220E-002,
+ +1.813439466E-002,
+ +1.791484281E-002,
+ +1.767017506E-002,
+ +1.740120351E-002,
+ +1.710879989E-002,
+ +1.679391414E-002,
+ +1.645756140E-002,
+ +1.610082202E-002,
+ +1.572482102E-002,
+ +1.533095632E-002,
+ +1.492007636E-002,
+ +1.449365262E-002,
+ +1.405300573E-002,
+ +1.359948888E-002,
+ +1.313448418E-002,
+ +1.265939046E-002,
+ +1.217562053E-002,
+ +1.168460958E-002,
+ +1.118756086E-002,
+ +1.068630442E-002,
+ +1.018219907E-002,
+ +9.676489048E-003,
+ +9.170533158E-003,
+ +8.665001951E-003,
+ +8.162760176E-003,
+ +7.664063945E-003,
+ +7.170005701E-003,
+ +6.683901884E-003,
+ +6.203945260E-003,
+ +5.732392892E-003,
+ +5.270531867E-003,
+ +4.819062538E-003,
+ +4.379155114E-003,
+ +3.951539751E-003,
+ +3.537061159E-003,
+ +3.136433195E-003,
+ +2.750317100E-003,
+ +2.379294252E-003,
+ +2.023874084E-003,
+ +1.684492454E-003,
+ +1.361547387E-003,
+ +1.055365428E-003,
+ +7.658848190E-004,
+ +4.935106263E-004,
+ +2.382978710E-004,
+ +2.719412748E-007,
+ -2.206075296E-004,
+ -4.244441516E-004,
+ -6.114174030E-004,
+ -7.817269652E-004,
+ -9.358961834E-004,
+ -1.073757303E-003,
+ -1.196175464E-003,
+ -1.303116791E-003,
+ -1.395521569E-003,
+ -1.479332102E-003,
+ -1.542080659E-003,
+ +1.593449386E-003,
+ +1.633993932E-003,
+ +1.656501088E-003,
+ +1.672798418E-003,
+ +1.678415807E-003,
+ +1.674512983E-003,
+ +1.661288203E-003,
+ +1.640390139E-003,
+ +1.611457788E-003,
+ +1.575609902E-003,
+ +1.533520175E-003,
+ +1.485876855E-003,
+ +1.433344092E-003,
+ +1.376571832E-003,
+ +1.316190348E-003,
+ +1.252829796E-003,
+ +1.183370827E-003,
+ +1.115717343E-003,
+ +1.046945457E-003,
+ +9.775133803E-004,
+ +9.078957955E-004,
+ +8.385353722E-004,
+ +7.698345580E-004,
+ +7.021900383E-004,
+ +6.358824321E-004,
+ +5.729619297E-004,
+ +5.099929986E-004,
+ +4.490280990E-004,
+ +3.906481725E-004,
+ +3.347633174E-004,
+ +2.682086197E-004,
+ +2.233728592E-004,
+ +1.774113771E-004,
+ +1.312203676E-004,
+ +1.024175072E-004,
+ +6.541742187E-005,
+ +3.193307566E-005,
+ +1.714242217E-006,
+ -2.470704203E-005,
+ -4.491530854E-005,
+ -6.447290798E-005,
+ -8.078388782E-005,
+ -9.417100227E-005,
+ -1.047207043E-004,
+ -1.126275165E-004,
+ -1.180980107E-004,
+ -1.213575742E-004,
+ -1.226499153E-004,
+ -1.262027217E-004,
+ -1.250260248E-004,
+ -1.224978914E-004,
+ -1.187910311E-004,
+ -1.140582463E-004,
+ -1.084438481E-004,
+ -1.020687996E-004,
+ -9.517164290E-005,
+ -8.757545584E-005,
+ -8.413690375E-005,
+ -7.513730816E-005,
+ -6.568001118E-005,
+ -5.610509834E-005,
+ -4.624524081E-005,
+ -1.774702469E-005,
+ -1.992636317E-005,
+ +1.617751332E-005,
+ +1.521241393E-005,
+ -2.525620175E-006,
+ -1.191342653E-005,
+ -1.985177369E-005,
+ -2.570833203E-005,
+ -3.018750249E-005,
+ -2.554462844E-005,
+ -2.618136386E-005,
+ -2.537086584E-005,
+ -2.362549276E-005,
+ -2.093936746E-005,
+ -1.751866148E-005,
+ -1.356193479E-005,
+ -9.299508747E-006,
+ -4.916387297E-006,
+ -5.595519906E-005,
+ -5.429694284E-005,
+ -5.176846025E-005,
+ -4.839275425E-005,
+ -4.425736552E-005,
+ -3.946387005E-005,
+ -3.415624451E-005,
+ -2.847247197E-005,
+ -2.263354872E-005,
+ -1.309637537E-005,
+ -9.561075785E-006,
+ -6.084746474E-006,
+ -3.086857760E-006,
+ -7.198007665E-007,
+ +1.853591357E-006,
+ +1.470520488E-006,
+ +9.984935332E-007,
+ +5.633860383E-007,
+ +6.993315310E-006,
+ +1.207003334E-005,
+ +1.661818715E-005,
+ +1.776598037E-005,
+ +1.806914770E-005,
+ +2.677291741E-005,
+ +2.978993689E-005,
+ +3.225446198E-005,
+ +3.397853652E-005,
+ +3.495384954E-005,
+ +3.515914432E-005,
+ +3.460439257E-005,
+ +3.334947178E-005,
+ +3.144468428E-005,
+ -2.042970118E-005,
+ -1.987093310E-005,
+ -1.884208177E-005,
+ -1.743183020E-005,
+ -1.571428584E-005,
+ -1.379448349E-005,
+ -1.177108606E-005,
+ -9.826449968E-006,
+ -7.869333785E-006,
+ -2.319611212E-006,
+ -3.157242645E-006,
+ -3.617151151E-006,
+ -2.497214155E-006,
+ -1.189317118E-006,
+ -6.437721822E-008,
+ -8.434094667E-008,
+ +3.809887872E-008,
+ +3.246264413E-008,
+ -6.402664354E-008,
+ -2.975164826E-008,
+ -9.458596395E-008,
+ -4.341498823E-007,
+ -8.427224429E-007,
+ -3.332600045E-006,
+ -4.429412002E-006,
+ -5.315936960E-006,
+ -6.225028756E-006,
+ -6.986399967E-006,
+ -7.568834008E-006,
+ -7.941360309E-006,
+ -8.087732567E-006,
+ -8.006985809E-006,
+ -6.361419310E-006,
+ -6.015239251E-006,
+ -5.516381407E-006,
+ -4.896494374E-006,
+ -4.195037945E-006,
+ -3.453840463E-006,
+ -2.715013807E-006,
+ -2.032118118E-006,
+ -1.399798180E-006,
+ -3.132386439E-007,
+ -1.444918922E-007,
+ -2.788728892E-008,
+ -7.506701927E-009,
+ -1.314406006E-008,
+ +3.399493131E-009,
+ +2.682709610E-009,
+ +1.613285505E-009,
+ +6.702406963E-010,
+ -7.834767501E-008,
+ -2.014677420E-007,
+ -5.234479659E-007,
+ -1.190443072E-006,
+ -1.975324267E-006,
+ -9.451737242E-007,
+ -1.033426656E-006,
+ -1.179182050E-006,
+ -1.194632091E-006,
+ -1.162929266E-006,
+ -1.085227950E-006,
+ -9.742954035E-007,
+ -8.419976893E-007,
+ -7.003467317E-007,
+ +5.564140224E-007,
+ +6.262345096E-007,
+ +6.767839409E-007,
+ +7.020648809E-007,
+ +6.982898526E-007,
+ +6.628192182E-007,
+ +6.022448247E-007,
+ +4.741137047E-007,
+ +3.970030775E-007,
+ +7.342250683E-007,
+ +3.961981463E-007,
+ +1.543309907E-007,
+ +5.083275667E-008,
+ +1.608403011E-008,
+ -7.018770981E-011,
+ -1.135985195E-010
+};
+
+static uint16_t get_subband_sz(void)
+{
+ return SUBBAND_SZ;
+}
+
+static uint16_t get_subbands_num(void)
+{
+ return SUBBANDS_NUM;
+}
+
+static uint16_t get_proto_sz(void)
+{
+ return PROTO_SZ;
+}
+
+static const float* get_proto(void)
+{
+ int i = 0;
+ static float buf[PROTO_SZ];
+ for (i = 0; i < PROTO_SZ; i++) {
+ float sign = i & (1 << 6) ? -1.0 : 1.0;
+ buf[i] = fir[i] * sign;
+ }
+ return buf;
+}
+
+struct synth_ctx {
+ float hist1[1024];
+ float hist2[64];
+ int offset;
+};
+
+static void* create_ctx(void)
+{
+ struct synth_ctx* ctx = calloc(sizeof(struct synth_ctx), 1);
+ return ctx;
+}
+
+static void free_ctx(void* ctx)
+{
+ free(ctx);
+}
+
+static void synth_filter_float(float *synth_buf_ptr, int *synth_buf_offset,
+ float synth_buf2[32], const float window[512],
+ float out[32], const float in[32], float scale)
+{
+ float *synth_buf = synth_buf_ptr + *synth_buf_offset;
+ int i, j;
+
+ dct4(synth_buf, in, 32, sqrt(2.0/32.0));
+
+ for (i = 0; i < 16; i++) {
+ float a = synth_buf2[i ];
+ float b = synth_buf2[i + 16];
+ float c = 0;
+ float d = 0;
+ for (j = 0; j < 512 - *synth_buf_offset; j += 64) {
+ a += window[i + j ] * (-synth_buf[15 - i + j ]);
+ b += window[i + j + 16] * ( synth_buf[ i + j ]);
+ c += window[i + j + 32] * ( synth_buf[16 + i + j ]);
+ d += window[i + j + 48] * ( synth_buf[31 - i + j ]);
+ }
+ for ( ; j < 512; j += 64) {
+ a += window[i + j ] * (-synth_buf[15 - i + j - 512]);
+ b += window[i + j + 16] * ( synth_buf[ i + j - 512]);
+ c += window[i + j + 32] * ( synth_buf[16 + i + j - 512]);
+ d += window[i + j + 48] * ( synth_buf[31 - i + j - 512]);
+ }
+ out[i ] = a * scale;
+ out[i + 16] = b * scale;
+ synth_buf2[i ] = c;
+ synth_buf2[i + 16] = d;
+ }
+
+ *synth_buf_offset = (*synth_buf_offset - 32) & 511;
+}
+
+static void synth_filter(const float* in, float* out, void* c)
+{
+ int i, j;
+ float buf[32];
+
+ struct synth_ctx* ctx = (struct synth_ctx*)c;
+
+ for (j = 0; j < 16; j++) {
+ for (i = 0; i < 32; i++) {
+ if ((i - 1) & 2) {
+ buf[i] = -in[i * 16 + j];
+ } else {
+ buf[i] = in[i * 16 + j];
+ }
+ }
+
+ synth_filter_float(ctx->hist1, &ctx->offset, ctx->hist2, fir, out, buf, (float)(1u << 9));
+
+ out+=32;
+ }
+}
+
+struct ut_dca_pr_t ut_dca_pr =
+{
+ get_subband_sz,
+ get_subbands_num,
+ get_proto_sz,
+ get_proto,
+ create_ctx,
+ free_ctx,
+ synth_filter,
+};
diff --git a/test/ut_dca_pr.h b/test/ut_dca_pr.h
new file mode 100644
index 0000000..b6c0622
--- /dev/null
+++ b/test/ut_dca_pr.h
@@ -0,0 +1,19 @@
+#include <stdint.h>
+
+#ifndef UT_DCA_PR_H
+#define UT_DCA_PR_H
+
+struct ut_dca_pr_t
+{
+ uint16_t (* get_subband_sz)(void);
+ uint16_t (* get_subbands_num)(void);
+ uint16_t (* get_proto_sz)(void);
+ const float* (* get_proto)(void);
+ void* (* create_ctx)(void);
+ void (* free_ctx)(void* ctx);
+ void (* synth_filter)(const float* in, float* out, void* dec_ctx);
+};
+
+extern struct ut_dca_pr_t ut_dca_pr;
+
+#endif
diff --git a/test/ut_dca_pr_long.c b/test/ut_dca_pr_long.c
new file mode 100644
index 0000000..3d47f4f
--- /dev/null
+++ b/test/ut_dca_pr_long.c
@@ -0,0 +1,638 @@
+#include "ut_dca_pr_long.h"
+#include "common.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#define SUBBAND_SZ 64
+#define SUBBANDS_NUM 32
+#define PROTO_SZ 512
+
+static const float fir[PROTO_SZ] = {
+ +1.135985195E-010,
+ +7.018770981E-011,
+ -1.608403011E-008,
+ -5.083275667E-008,
+ -1.543309907E-007,
+ -3.961981463E-007,
+ -7.342250683E-007,
+ -3.970030775E-007,
+ -4.741137047E-007,
+ -6.022448247E-007,
+ -6.628192182E-007,
+ -6.982898526E-007,
+ -7.020648809E-007,
+ -6.767839409E-007,
+ -6.262345096E-007,
+ -5.564140224E-007,
+ +7.003467317E-007,
+ +8.419976893E-007,
+ +9.742954035E-007,
+ +1.085227950E-006,
+ +1.162929266E-006,
+ +1.194632091E-006,
+ +1.179182050E-006,
+ +1.033426656E-006,
+ +9.451737242E-007,
+ +1.975324267E-006,
+ +1.190443072E-006,
+ +5.234479659E-007,
+ +2.014677420E-007,
+ +7.834767501E-008,
+ -6.702406963E-010,
+ -1.613285505E-009,
+ -2.682709610E-009,
+ -3.399493131E-009,
+ +1.314406006E-008,
+ +7.506701927E-009,
+ +2.788728892E-008,
+ +1.444918922E-007,
+ +3.132386439E-007,
+ +1.399798180E-006,
+ +2.032118118E-006,
+ +2.715013807E-006,
+ +3.453840463E-006,
+ +4.195037945E-006,
+ +4.896494374E-006,
+ +5.516381407E-006,
+ +6.015239251E-006,
+ +6.361419310E-006,
+ +8.006985809E-006,
+ +8.087732567E-006,
+ +7.941360309E-006,
+ +7.568834008E-006,
+ +6.986399967E-006,
+ +6.225028756E-006,
+ +5.315936960E-006,
+ +4.429412002E-006,
+ +3.332600045E-006,
+ +8.427224429E-007,
+ +4.341498823E-007,
+ +9.458596395E-008,
+ +2.975164826E-008,
+ +6.402664354E-008,
+ -3.246264413E-008,
+ -3.809887872E-008,
+ +8.434094667E-008,
+ +6.437721822E-008,
+ +1.189317118E-006,
+ +2.497214155E-006,
+ +3.617151151E-006,
+ +3.157242645E-006,
+ +2.319611212E-006,
+ +7.869333785E-006,
+ +9.826449968E-006,
+ +1.177108606E-005,
+ +1.379448349E-005,
+ +1.571428584E-005,
+ +1.743183020E-005,
+ +1.884208177E-005,
+ +1.987093310E-005,
+ +2.042970118E-005,
+ -3.144468428E-005,
+ -3.334947178E-005,
+ -3.460439257E-005,
+ -3.515914432E-005,
+ -3.495384954E-005,
+ -3.397853652E-005,
+ -3.225446198E-005,
+ -2.978993689E-005,
+ -2.677291741E-005,
+ -1.806914770E-005,
+ -1.776598037E-005,
+ -1.661818715E-005,
+ -1.207003334E-005,
+ -6.993315310E-006,
+ -5.633860383E-007,
+ -9.984935332E-007,
+ -1.470520488E-006,
+ -1.853591357E-006,
+ +7.198007665E-007,
+ +3.086857760E-006,
+ +6.084746474E-006,
+ +9.561075785E-006,
+ +1.309637537E-005,
+ +2.263354872E-005,
+ +2.847247197E-005,
+ +3.415624451E-005,
+ +3.946387005E-005,
+ +4.425736552E-005,
+ +4.839275425E-005,
+ +5.176846025E-005,
+ +5.429694284E-005,
+ +5.595519906E-005,
+ +4.916387297E-006,
+ +9.299508747E-006,
+ +1.356193479E-005,
+ +1.751866148E-005,
+ +2.093936746E-005,
+ +2.362549276E-005,
+ +2.537086584E-005,
+ +2.618136386E-005,
+ +2.554462844E-005,
+ +3.018750249E-005,
+ +2.570833203E-005,
+ +1.985177369E-005,
+ +1.191342653E-005,
+ +2.525620175E-006,
+ -1.521241393E-005,
+ -1.617751332E-005,
+ +1.992636317E-005,
+ +1.774702469E-005,
+ +4.624524081E-005,
+ +5.610509834E-005,
+ +6.568001118E-005,
+ +7.513730816E-005,
+ +8.413690375E-005,
+ +8.757545584E-005,
+ +9.517164290E-005,
+ +1.020687996E-004,
+ +1.084438481E-004,
+ +1.140582463E-004,
+ +1.187910311E-004,
+ +1.224978914E-004,
+ +1.250260248E-004,
+ +1.262027217E-004,
+ +1.226499153E-004,
+ +1.213575742E-004,
+ +1.180980107E-004,
+ +1.126275165E-004,
+ +1.047207043E-004,
+ +9.417100227E-005,
+ +8.078388782E-005,
+ +6.447290798E-005,
+ +4.491530854E-005,
+ +2.470704203E-005,
+ -1.714242217E-006,
+ -3.193307566E-005,
+ -6.541742187E-005,
+ -1.024175072E-004,
+ -1.312203676E-004,
+ -1.774113771E-004,
+ -2.233728592E-004,
+ -2.682086197E-004,
+ -3.347633174E-004,
+ -3.906481725E-004,
+ -4.490280990E-004,
+ -5.099929986E-004,
+ -5.729619297E-004,
+ -6.358824321E-004,
+ -7.021900383E-004,
+ -7.698345580E-004,
+ -8.385353722E-004,
+ -9.078957955E-004,
+ -9.775133803E-004,
+ -1.046945457E-003,
+ -1.115717343E-003,
+ -1.183370827E-003,
+ -1.252829796E-003,
+ -1.316190348E-003,
+ -1.376571832E-003,
+ -1.433344092E-003,
+ -1.485876855E-003,
+ -1.533520175E-003,
+ -1.575609902E-003,
+ -1.611457788E-003,
+ -1.640390139E-003,
+ -1.661288203E-003,
+ -1.674512983E-003,
+ -1.678415807E-003,
+ -1.672798418E-003,
+ -1.656501088E-003,
+ -1.633993932E-003,
+ -1.593449386E-003,
+ +1.542080659E-003,
+ +1.479332102E-003,
+ +1.395521569E-003,
+ +1.303116791E-003,
+ +1.196175464E-003,
+ +1.073757303E-003,
+ +9.358961834E-004,
+ +7.817269652E-004,
+ +6.114174030E-004,
+ +4.244441516E-004,
+ +2.206075296E-004,
+ -2.719412748E-007,
+ -2.382978710E-004,
+ -4.935106263E-004,
+ -7.658848190E-004,
+ -1.055365428E-003,
+ -1.361547387E-003,
+ -1.684492454E-003,
+ -2.023874084E-003,
+ -2.379294252E-003,
+ -2.750317100E-003,
+ -3.136433195E-003,
+ -3.537061159E-003,
+ -3.951539751E-003,
+ -4.379155114E-003,
+ -4.819062538E-003,
+ -5.270531867E-003,
+ -5.732392892E-003,
+ -6.203945260E-003,
+ -6.683901884E-003,
+ -7.170005701E-003,
+ -7.664063945E-003,
+ -8.162760176E-003,
+ -8.665001951E-003,
+ -9.170533158E-003,
+ -9.676489048E-003,
+ -1.018219907E-002,
+ -1.068630442E-002,
+ -1.118756086E-002,
+ -1.168460958E-002,
+ -1.217562053E-002,
+ -1.265939046E-002,
+ -1.313448418E-002,
+ -1.359948888E-002,
+ -1.405300573E-002,
+ -1.449365262E-002,
+ -1.492007636E-002,
+ -1.533095632E-002,
+ -1.572482102E-002,
+ -1.610082202E-002,
+ -1.645756140E-002,
+ -1.679391414E-002,
+ -1.710879989E-002,
+ -1.740120351E-002,
+ -1.767017506E-002,
+ -1.791484281E-002,
+ -1.813439466E-002,
+ -1.832821220E-002,
+ -1.849545911E-002,
+ -1.863567345E-002,
+ -1.874836907E-002,
+ -1.883326657E-002,
+ -1.889026538E-002,
+ -1.891860925E-002,
+ +1.891860925E-002,
+ +1.889026538E-002,
+ +1.883326657E-002,
+ +1.874836907E-002,
+ +1.863567345E-002,
+ +1.849545911E-002,
+ +1.832821220E-002,
+ +1.813439466E-002,
+ +1.791484281E-002,
+ +1.767017506E-002,
+ +1.740120351E-002,
+ +1.710879989E-002,
+ +1.679391414E-002,
+ +1.645756140E-002,
+ +1.610082202E-002,
+ +1.572482102E-002,
+ +1.533095632E-002,
+ +1.492007636E-002,
+ +1.449365262E-002,
+ +1.405300573E-002,
+ +1.359948888E-002,
+ +1.313448418E-002,
+ +1.265939046E-002,
+ +1.217562053E-002,
+ +1.168460958E-002,
+ +1.118756086E-002,
+ +1.068630442E-002,
+ +1.018219907E-002,
+ +9.676489048E-003,
+ +9.170533158E-003,
+ +8.665001951E-003,
+ +8.162760176E-003,
+ +7.664063945E-003,
+ +7.170005701E-003,
+ +6.683901884E-003,
+ +6.203945260E-003,
+ +5.732392892E-003,
+ +5.270531867E-003,
+ +4.819062538E-003,
+ +4.379155114E-003,
+ +3.951539751E-003,
+ +3.537061159E-003,
+ +3.136433195E-003,
+ +2.750317100E-003,
+ +2.379294252E-003,
+ +2.023874084E-003,
+ +1.684492454E-003,
+ +1.361547387E-003,
+ +1.055365428E-003,
+ +7.658848190E-004,
+ +4.935106263E-004,
+ +2.382978710E-004,
+ +2.719412748E-007,
+ -2.206075296E-004,
+ -4.244441516E-004,
+ -6.114174030E-004,
+ -7.817269652E-004,
+ -9.358961834E-004,
+ -1.073757303E-003,
+ -1.196175464E-003,
+ -1.303116791E-003,
+ -1.395521569E-003,
+ -1.479332102E-003,
+ -1.542080659E-003,
+ +1.593449386E-003,
+ +1.633993932E-003,
+ +1.656501088E-003,
+ +1.672798418E-003,
+ +1.678415807E-003,
+ +1.674512983E-003,
+ +1.661288203E-003,
+ +1.640390139E-003,
+ +1.611457788E-003,
+ +1.575609902E-003,
+ +1.533520175E-003,
+ +1.485876855E-003,
+ +1.433344092E-003,
+ +1.376571832E-003,
+ +1.316190348E-003,
+ +1.252829796E-003,
+ +1.183370827E-003,
+ +1.115717343E-003,
+ +1.046945457E-003,
+ +9.775133803E-004,
+ +9.078957955E-004,
+ +8.385353722E-004,
+ +7.698345580E-004,
+ +7.021900383E-004,
+ +6.358824321E-004,
+ +5.729619297E-004,
+ +5.099929986E-004,
+ +4.490280990E-004,
+ +3.906481725E-004,
+ +3.347633174E-004,
+ +2.682086197E-004,
+ +2.233728592E-004,
+ +1.774113771E-004,
+ +1.312203676E-004,
+ +1.024175072E-004,
+ +6.541742187E-005,
+ +3.193307566E-005,
+ +1.714242217E-006,
+ -2.470704203E-005,
+ -4.491530854E-005,
+ -6.447290798E-005,
+ -8.078388782E-005,
+ -9.417100227E-005,
+ -1.047207043E-004,
+ -1.126275165E-004,
+ -1.180980107E-004,
+ -1.213575742E-004,
+ -1.226499153E-004,
+ -1.262027217E-004,
+ -1.250260248E-004,
+ -1.224978914E-004,
+ -1.187910311E-004,
+ -1.140582463E-004,
+ -1.084438481E-004,
+ -1.020687996E-004,
+ -9.517164290E-005,
+ -8.757545584E-005,
+ -8.413690375E-005,
+ -7.513730816E-005,
+ -6.568001118E-005,
+ -5.610509834E-005,
+ -4.624524081E-005,
+ -1.774702469E-005,
+ -1.992636317E-005,
+ +1.617751332E-005,
+ +1.521241393E-005,
+ -2.525620175E-006,
+ -1.191342653E-005,
+ -1.985177369E-005,
+ -2.570833203E-005,
+ -3.018750249E-005,
+ -2.554462844E-005,
+ -2.618136386E-005,
+ -2.537086584E-005,
+ -2.362549276E-005,
+ -2.093936746E-005,
+ -1.751866148E-005,
+ -1.356193479E-005,
+ -9.299508747E-006,
+ -4.916387297E-006,
+ -5.595519906E-005,
+ -5.429694284E-005,
+ -5.176846025E-005,
+ -4.839275425E-005,
+ -4.425736552E-005,
+ -3.946387005E-005,
+ -3.415624451E-005,
+ -2.847247197E-005,
+ -2.263354872E-005,
+ -1.309637537E-005,
+ -9.561075785E-006,
+ -6.084746474E-006,
+ -3.086857760E-006,
+ -7.198007665E-007,
+ +1.853591357E-006,
+ +1.470520488E-006,
+ +9.984935332E-007,
+ +5.633860383E-007,
+ +6.993315310E-006,
+ +1.207003334E-005,
+ +1.661818715E-005,
+ +1.776598037E-005,
+ +1.806914770E-005,
+ +2.677291741E-005,
+ +2.978993689E-005,
+ +3.225446198E-005,
+ +3.397853652E-005,
+ +3.495384954E-005,
+ +3.515914432E-005,
+ +3.460439257E-005,
+ +3.334947178E-005,
+ +3.144468428E-005,
+ -2.042970118E-005,
+ -1.987093310E-005,
+ -1.884208177E-005,
+ -1.743183020E-005,
+ -1.571428584E-005,
+ -1.379448349E-005,
+ -1.177108606E-005,
+ -9.826449968E-006,
+ -7.869333785E-006,
+ -2.319611212E-006,
+ -3.157242645E-006,
+ -3.617151151E-006,
+ -2.497214155E-006,
+ -1.189317118E-006,
+ -6.437721822E-008,
+ -8.434094667E-008,
+ +3.809887872E-008,
+ +3.246264413E-008,
+ -6.402664354E-008,
+ -2.975164826E-008,
+ -9.458596395E-008,
+ -4.341498823E-007,
+ -8.427224429E-007,
+ -3.332600045E-006,
+ -4.429412002E-006,
+ -5.315936960E-006,
+ -6.225028756E-006,
+ -6.986399967E-006,
+ -7.568834008E-006,
+ -7.941360309E-006,
+ -8.087732567E-006,
+ -8.006985809E-006,
+ -6.361419310E-006,
+ -6.015239251E-006,
+ -5.516381407E-006,
+ -4.896494374E-006,
+ -4.195037945E-006,
+ -3.453840463E-006,
+ -2.715013807E-006,
+ -2.032118118E-006,
+ -1.399798180E-006,
+ -3.132386439E-007,
+ -1.444918922E-007,
+ -2.788728892E-008,
+ -7.506701927E-009,
+ -1.314406006E-008,
+ +3.399493131E-009,
+ +2.682709610E-009,
+ +1.613285505E-009,
+ +6.702406963E-010,
+ -7.834767501E-008,
+ -2.014677420E-007,
+ -5.234479659E-007,
+ -1.190443072E-006,
+ -1.975324267E-006,
+ -9.451737242E-007,
+ -1.033426656E-006,
+ -1.179182050E-006,
+ -1.194632091E-006,
+ -1.162929266E-006,
+ -1.085227950E-006,
+ -9.742954035E-007,
+ -8.419976893E-007,
+ -7.003467317E-007,
+ +5.564140224E-007,
+ +6.262345096E-007,
+ +6.767839409E-007,
+ +7.020648809E-007,
+ +6.982898526E-007,
+ +6.628192182E-007,
+ +6.022448247E-007,
+ +4.741137047E-007,
+ +3.970030775E-007,
+ +7.342250683E-007,
+ +3.961981463E-007,
+ +1.543309907E-007,
+ +5.083275667E-008,
+ +1.608403011E-008,
+ -7.018770981E-011,
+ -1.135985195E-010
+};
+
+static uint16_t get_subband_sz(void)
+{
+ return SUBBAND_SZ;
+}
+
+static uint16_t get_subbands_num(void)
+{
+ return SUBBANDS_NUM;
+}
+
+static uint16_t get_proto_sz(void)
+{
+ return PROTO_SZ;
+}
+
+static const float* get_proto(void)
+{
+ int i = 0;
+ static float buf[PROTO_SZ];
+ for (i = 0; i < PROTO_SZ; i++) {
+ float sign = i & (1 << 6) ? -1.0 : 1.0;
+ buf[i] = fir[i] * sign;
+ }
+ return buf;
+}
+
+struct synth_ctx {
+ float hist1[1024];
+ float hist2[64];
+ int offset;
+};
+
+static void* create_ctx(void)
+{
+ struct synth_ctx* ctx = calloc(sizeof(struct synth_ctx), 1);
+ return ctx;
+}
+
+static void free_ctx(void* ctx)
+{
+ free(ctx);
+}
+
+static void synth_filter_float(float *synth_buf_ptr, int *synth_buf_offset,
+ float synth_buf2[32], const float window[512],
+ float out[32], const float in[32], float scale)
+{
+ float *synth_buf = synth_buf_ptr + *synth_buf_offset;
+ int i, j;
+
+ dct4(synth_buf, in, 32, sqrt(2.0/32.0));
+
+ for (i = 0; i < 16; i++) {
+ float a = synth_buf2[i ];
+ float b = synth_buf2[i + 16];
+ float c = 0;
+ float d = 0;
+ for (j = 0; j < 512 - *synth_buf_offset; j += 64) {
+ a += window[i + j ] * (-synth_buf[15 - i + j ]);
+ b += window[i + j + 16] * ( synth_buf[ i + j ]);
+ c += window[i + j + 32] * ( synth_buf[16 + i + j ]);
+ d += window[i + j + 48] * ( synth_buf[31 - i + j ]);
+ }
+ for ( ; j < 512; j += 64) {
+ a += window[i + j ] * (-synth_buf[15 - i + j - 512]);
+ b += window[i + j + 16] * ( synth_buf[ i + j - 512]);
+ c += window[i + j + 32] * ( synth_buf[16 + i + j - 512]);
+ d += window[i + j + 48] * ( synth_buf[31 - i + j - 512]);
+ }
+ out[i ] = a * scale;
+ out[i + 16] = b * scale;
+ synth_buf2[i ] = c;
+ synth_buf2[i + 16] = d;
+ }
+
+ *synth_buf_offset = (*synth_buf_offset - 32) & 511;
+}
+
+static void synth_filter(const float* in, float* out, void* c)
+{
+ int i, j;
+ float buf[32];
+
+ float* yyy = out;
+
+ struct synth_ctx* ctx = (struct synth_ctx*)c;
+
+ for (j = 0; j < SUBBAND_SZ; j++) {
+ for (i = 0; i < 32; i++) {
+ if ((i - 1) & 2) {
+ buf[i] = -in[i * SUBBAND_SZ + j];
+ } else {
+ buf[i] = in[i * SUBBAND_SZ + j];
+ }
+ }
+
+ synth_filter_float(ctx->hist1, &ctx->offset, ctx->hist2, fir, out, buf, (float)(1u << 9));
+
+ out+=32;
+ }
+}
+
+struct ut_dca_pr_long_t ut_dca_pr_long =
+{
+ get_subband_sz,
+ get_subbands_num,
+ get_proto_sz,
+ get_proto,
+ create_ctx,
+ free_ctx,
+ synth_filter,
+};
diff --git a/test/ut_dca_pr_long.h b/test/ut_dca_pr_long.h
new file mode 100644
index 0000000..c346618
--- /dev/null
+++ b/test/ut_dca_pr_long.h
@@ -0,0 +1,19 @@
+#include <stdint.h>
+
+#ifndef UT_DCA_PR_LONG_H
+#define UT_DCA_PR_LONG_H
+
+struct ut_dca_pr_long_t
+{
+ uint16_t (* get_subband_sz)(void);
+ uint16_t (* get_subbands_num)(void);
+ uint16_t (* get_proto_sz)(void);
+ const float* (* get_proto)(void);
+ void* (* create_ctx)(void);
+ void (* free_ctx)(void* ctx);
+ void (* synth_filter)(const float* in, float* out, void* dec_ctx);
+};
+
+extern struct ut_dca_pr_long_t ut_dca_pr_long;
+
+#endif