[Sound-open-firmware] [PATCH 1/4] SRC: Add checks for number of channels when initializing from params
This patch prevents SRCs init to loop past PLATFORM_MAX_CHANNELS.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com --- src/audio/src.c | 5 +++-- src/audio/src_core.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/audio/src.c b/src/audio/src.c index 1f84a5a..203e802 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -322,7 +322,7 @@ static int src_params(struct comp_dev *dev) size_t delay_lines_size; uint32_t source_rate, sink_rate; int32_t *buffer_start; - int n = 0, i, err, frames_is_for_source, q; + int n = 0, i, err, frames_is_for_source, nch, q;
trace_src("par");
@@ -392,7 +392,8 @@ static int src_params(struct comp_dev *dev) buffer_start = cd->delay_lines + need.scratch;
/* Initize SRC for actual sample rate */ - for (i = 0; i < params->channels; i++) { + nch = MIN(params->channels, PLATFORM_MAX_CHANNELS); + for (i = 0; i < nch; i++) { n = src_polyphase_init(&cd->src[i], source_rate, sink_rate, &need, buffer_start); buffer_start += need.single_src; diff --git a/src/audio/src_core.h b/src/audio/src_core.h index 5977421..886cc23 100644 --- a/src/audio/src_core.h +++ b/src/audio/src_core.h @@ -33,6 +33,7 @@ #define SRC_CORE_H
#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b))
struct src_alloc { int fir_s1;
This patch fixes the circular dependency of defines that prevented the 16 bit coefficients to be applied correctly.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com --- src/audio/src_core.c | 14 -------------- src/audio/src_core.h | 6 +----- 2 files changed, 1 insertion(+), 19 deletions(-)
diff --git a/src/audio/src_core.c b/src/audio/src_core.c index 342e8a7..1577e14 100644 --- a/src/audio/src_core.c +++ b/src/audio/src_core.c @@ -628,13 +628,6 @@ void src_print_info(struct polyphase_src *src) printf("SRC1 input blk %d\n", src->stage1->blk_in); printf("SRC1 output blk %d\n", src->stage1->blk_out); printf("SRC1 halfband %d\n", src->stage1->halfband); - printf("SRC1 coef[0] %d\n", src->stage1->coefs[0]); - if (n1 > 3) { - printf("SRC1 coef[1] %d\n", src->stage1->coefs[1]); - printf("SRC1 coef[2] %d\n", src->stage1->coefs[2]); - printf("SRC1 coef[%d] %d\n", - n1 - 1, src->stage1->coefs[n1 - 1]); - } printf("SRC1 FIR delay %d\n", src->state1.fir_delay_size); printf("SRC1 out delay %d\n", src->state1.out_delay_size);
@@ -647,13 +640,6 @@ void src_print_info(struct polyphase_src *src) printf("SRC2 input blk %d\n", src->stage2->blk_in); printf("SRC2 output blk %d\n", src->stage2->blk_out); printf("SRC2 halfband %d\n", src->stage2->halfband); - printf("SRC2 coef[0] %d\n", src->stage2->coefs[0]); - if (n2 > 3) { - printf("SRC2 coef[1] %d\n", src->stage2->coefs[1]); - printf("SRC2 coef[2] %d\n", src->stage2->coefs[2]); - printf("SRC2 coef[%d] %d\n", - n1 - 1, src->stage2->coefs[n2 - 1]); - } printf("SRC2 FIR delay %d\n", src->state2.fir_delay_size); printf("SRC2 out delay %d\n", src->state2.out_delay_size); } diff --git a/src/audio/src_core.h b/src/audio/src_core.h index 886cc23..2965c7d 100644 --- a/src/audio/src_core.h +++ b/src/audio/src_core.h @@ -62,11 +62,7 @@ struct src_stage { const int blk_out; const int halfband; const int shift; -#if SRC_SHORT == 1 - const int16_t *coefs; -#else - const int32_t *coefs; -#endif + const void *coefs; /* Can be int16_t or int32_t depending on config */ };
struct src_state {
This patch adds a very small size and fast to compute SRC coefficients set for converting between 8/16/24/32/44.1/48 kHz and 48 kHz. It is set as default for BYT platform until a more optimized SRC core is available. The quality of this set has been reduced to achieve the faster computation.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com --- src/audio/src_config.h | 6 +- .../src/src_tiny_int16_1_2_3750_5100.h | 44 +++ .../src/src_tiny_int16_1_3_1875_5100.h | 33 +++ .../src/src_tiny_int16_1_3_3750_5100.h | 62 ++++ .../src/src_tiny_int16_20_21_3445_5100.h | 326 +++++++++++++++++++++ .../src/src_tiny_int16_21_20_3445_5100.h | 321 ++++++++++++++++++++ .../src/src_tiny_int16_2_1_3750_5100.h | 46 +++ .../src/src_tiny_int16_2_3_3750_5100.h | 64 ++++ .../src/src_tiny_int16_3_1_1875_5100.h | 33 +++ .../src/src_tiny_int16_3_1_3750_5100.h | 63 ++++ .../src/src_tiny_int16_3_2_3750_5100.h | 63 ++++ .../src/src_tiny_int16_7_8_3750_5100.h | 167 +++++++++++ .../src/src_tiny_int16_8_7_3750_5100.h | 166 +++++++++++ .../audio/coefficients/src/src_tiny_int16_define.h | 11 + .../audio/coefficients/src/src_tiny_int16_table.h | 72 +++++ 15 files changed, 1474 insertions(+), 3 deletions(-) create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_1_2_3750_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_1_3_1875_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_1_3_3750_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_20_21_3445_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_21_20_3445_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_2_1_3750_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_2_3_3750_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_3_1_1875_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_3_1_3750_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_3_2_3750_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_7_8_3750_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_8_7_3750_5100.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_define.h create mode 100644 src/include/reef/audio/coefficients/src/src_tiny_int16_table.h
diff --git a/src/audio/src_config.h b/src/audio/src_config.h index f983723..a34e8a5 100644 --- a/src/audio/src_config.h +++ b/src/audio/src_config.h @@ -35,9 +35,9 @@ #include <config.h>
#if CONFIG_BAYTRAIL -#define SRC_SHORT 0 -#include <reef/audio/coefficients/src/src_small_int24_define.h> -#include <reef/audio/coefficients/src/src_small_int24_table.h> +#define SRC_SHORT 1 +#include <reef/audio/coefficients/src/src_tiny_int16_define.h> +#include <reef/audio/coefficients/src/src_tiny_int16_table.h> #else #define SHORT_SHORT 0 #include <reef/audio/coefficients/src/src_std_int24_define.h> diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_1_2_3750_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_1_2_3750_5100.h new file mode 100644 index 0000000..d3469a6 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_1_2_3750_5100.h @@ -0,0 +1,44 @@ +const int16_t src_int16_1_2_3750_5100_fir[38] = { + 51, + -121, + -177, + 149, + 398, + -68, + -694, + -211, + 995, + 777, + -1172, + -1716, + 1021, + 3153, + -171, + -5516, + -2578, + 11935, + 26490, + 26490, + 11935, + -2578, + -5516, + -171, + 3153, + 1021, + -1716, + -1172, + 777, + 995, + -211, + -694, + -68, + 398, + 149, + -177, + -121, + 51 + +}; +struct src_stage src_int16_1_2_3750_5100 = { + 1, 0, 1, 38, 38, 2, 1, 0, 1, + src_int16_1_2_3750_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_1_3_1875_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_1_3_1875_5100.h new file mode 100644 index 0000000..aface9c --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_1_3_1875_5100.h @@ -0,0 +1,33 @@ +const int16_t src_int16_1_3_1875_5100_fir[27] = { + -4, + 223, + 611, + 835, + 394, + -994, + -2923, + -4122, + -2891, + 1966, + 10180, + 19698, + 27355, + 30291, + 27355, + 19698, + 10180, + 1966, + -2891, + -4122, + -2923, + -994, + 394, + 835, + 611, + 223, + -4 + +}; +struct src_stage src_int16_1_3_1875_5100 = { + 1, 0, 1, 27, 27, 3, 1, 0, 2, + src_int16_1_3_1875_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_1_3_3750_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_1_3_3750_5100.h new file mode 100644 index 0000000..6a58744 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_1_3_3750_5100.h @@ -0,0 +1,62 @@ +const int16_t src_int16_1_3_3750_5100_fir[56] = { + 17, + -58, + -123, + -91, + 55, + 221, + 240, + 28, + -301, + -465, + -244, + 291, + 735, + 635, + -96, + -978, + -1232, + -413, + 1071, + 2066, + 1461, + -798, + -3284, + -3740, + -527, + 6049, + 13523, + 18476, + 18476, + 13523, + 6049, + -527, + -3740, + -3284, + -798, + 1461, + 2066, + 1071, + -413, + -1232, + -978, + -96, + 635, + 735, + 291, + -244, + -465, + -301, + 28, + 240, + 221, + 55, + -91, + -123, + -58, + 17 + +}; +struct src_stage src_int16_1_3_3750_5100 = { + 1, 0, 1, 56, 56, 3, 1, 0, 1, + src_int16_1_3_3750_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_20_21_3445_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_20_21_3445_5100.h new file mode 100644 index 0000000..b569d87 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_20_21_3445_5100.h @@ -0,0 +1,326 @@ +const int16_t src_int16_20_21_3445_5100_fir[320] = { + 53, + -203, + 342, + -181, + -643, + 2315, + -4645, + 7405, + 25888, + 4758, + -4056, + 2414, + -916, + 31, + 240, + -176, + 54, + -211, + 388, + -294, + -478, + 2201, + -4854, + 8785, + 25680, + 3510, + -3692, + 2403, + -1019, + 129, + 186, + -158, + 50, + -218, + 435, + -408, + -296, + 2045, + -4995, + 10186, + 25338, + 2324, + -3294, + 2356, + -1103, + 219, + 136, + -142, + 48, + -221, + 473, + -524, + -98, + 1846, + -5063, + 11596, + 24861, + 1211, + -2866, + 2272, + -1161, + 299, + 86, + -121, + 40, + -221, + 509, + -636, + 112, + 1605, + -5053, + 13005, + 24256, + 176, + -2418, + 2159, + -1201, + 370, + 38, + -104, + 35, + -215, + 535, + -744, + 332, + 1324, + -4956, + 14397, + 23531, + -773, + -1959, + 2015, + -1218, + 431, + -6, + -83, + 23, + -207, + 557, + -848, + 558, + 1005, + -4770, + 15762, + 22689, + -1634, + -1495, + 1850, + -1215, + 481, + -48, + -66, + 14, + -191, + 568, + -940, + 789, + 650, + -4491, + 17087, + 21742, + -2401, + -1034, + 1661, + -1192, + 519, + -86, + -46, + -1, + -173, + 572, + -1025, + 1017, + 264, + -4116, + 18359, + 20698, + -3071, + -583, + 1458, + -1152, + 548, + -121, + -31, + -13, + -148, + 564, + -1094, + 1242, + -149, + -3643, + 19566, + 19566, + -3643, + -149, + 1242, + -1094, + 563, + -148, + -13, + -31, + -121, + 548, + -1153, + 1458, + -584, + -3072, + 20699, + 18359, + -4116, + 264, + 1017, + -1025, + 572, + -173, + -1, + -46, + -86, + 518, + -1192, + 1661, + -1034, + -2401, + 21742, + 17087, + -4491, + 650, + 788, + -941, + 568, + -191, + 14, + -66, + -48, + 480, + -1215, + 1849, + -1495, + -1634, + 22690, + 15762, + -4770, + 1004, + 558, + -848, + 557, + -207, + 23, + -83, + -6, + 430, + -1218, + 2015, + -1959, + -773, + 23531, + 14397, + -4956, + 1324, + 332, + -744, + 535, + -215, + 35, + -104, + 38, + 370, + -1201, + 2159, + -2418, + 175, + 24256, + 13004, + -5052, + 1605, + 112, + -637, + 508, + -221, + 40, + -121, + 86, + 298, + -1162, + 2273, + -2866, + 1211, + 24861, + 11595, + -5063, + 1846, + -98, + -524, + 473, + -221, + 48, + -142, + 135, + 219, + -1102, + 2356, + -3293, + 2325, + 25337, + 10186, + -4995, + 2045, + -296, + -408, + 435, + -218, + 50, + -158, + 186, + 130, + -1019, + 2403, + -3692, + 3510, + 25681, + 8785, + -4853, + 2201, + -478, + -294, + 388, + -211, + 54, + -176, + 240, + 31, + -915, + 2414, + -4056, + 4758, + 25888, + 7406, + -4645, + 2315, + -642, + -181, + 342, + -203, + 53, + -189, + 290, + -72, + -789, + 2384, + -4377, + 6059, + 25958, + 6060, + -4377, + 2385, + -789, + -72, + 290, + -189, + 1 + +}; +struct src_stage src_int16_20_21_3445_5100 = { + 1, 1, 20, 16, 320, 21, 20, 0, 0, + src_int16_20_21_3445_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_21_20_3445_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_21_20_3445_5100.h new file mode 100644 index 0000000..0ae042f --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_21_20_3445_5100.h @@ -0,0 +1,321 @@ +const int16_t src_int16_21_20_3445_5100_fir[315] = { + 46, + -219, + 514, + -765, + 579, + 678, + -4314, + 20545, + 19276, + -4707, + 1048, + 344, + -653, + 478, + -216, + 44, + -219, + 542, + -871, + 818, + 275, + -3819, + 21733, + 17938, + -4998, + 1381, + 116, + -537, + 438, + -207, + 37, + -212, + 565, + -968, + 1055, + -156, + -3219, + 22830, + 16547, + -5192, + 1675, + -102, + -419, + 393, + -199, + 32, + -205, + 576, + -1054, + 1290, + -610, + -2518, + 23826, + 15113, + -5292, + 1924, + -307, + -301, + 345, + -186, + 22, + -189, + 581, + -1128, + 1514, + -1081, + -1714, + 24710, + 13649, + -5303, + 2133, + -495, + -185, + 293, + -172, + 13, + -172, + 572, + -1188, + 1726, + -1563, + -812, + 25474, + 12172, + -5230, + 2293, + -666, + -75, + 241, + -153, + -1, + -147, + 557, + -1229, + 1922, + -2048, + 185, + 26108, + 10691, + -5081, + 2412, + -816, + 32, + 187, + -136, + -12, + -120, + 527, + -1253, + 2097, + -2529, + 1272, + 26610, + 9220, + -4862, + 2484, + -946, + 132, + 136, + -117, + -30, + -85, + 490, + -1256, + 2245, + -2998, + 2438, + 26970, + 7771, + -4580, + 2515, + -1053, + 224, + 85, + -100, + -44, + -48, + 438, + -1239, + 2365, + -3445, + 3683, + 27188, + 6359, + -4245, + 2501, + -1138, + 306, + 37, + -80, + -63, + -6, + 378, + -1200, + 2451, + -3864, + 4992, + 27261, + 4992, + -3864, + 2451, + -1200, + 378, + -6, + -63, + -80, + 38, + 306, + -1138, + 2501, + -4245, + 6360, + 27189, + 3683, + -3445, + 2365, + -1239, + 438, + -48, + -44, + -100, + 85, + 224, + -1053, + 2514, + -4580, + 7772, + 26969, + 2438, + -2997, + 2245, + -1255, + 489, + -85, + -30, + -117, + 136, + 133, + -947, + 2484, + -4862, + 9220, + 26609, + 1272, + -2529, + 2097, + -1253, + 527, + -120, + -12, + -136, + 188, + 33, + -816, + 2413, + -5080, + 10691, + 26108, + 185, + -2048, + 1922, + -1228, + 557, + -147, + -1, + -153, + 241, + -74, + -666, + 2294, + -5230, + 12172, + 25473, + -812, + -1563, + 1727, + -1187, + 572, + -172, + 13, + -171, + 292, + -185, + -495, + 2133, + -5303, + 13650, + 24710, + -1714, + -1081, + 1514, + -1128, + 581, + -189, + 22, + -186, + 344, + -301, + -307, + 1925, + -5292, + 15113, + 23826, + -2518, + -610, + 1290, + -1054, + 576, + -205, + 32, + -199, + 392, + -419, + -102, + 1675, + -5192, + 16547, + 22831, + -3219, + -156, + 1055, + -967, + 565, + -212, + 37, + -207, + 438, + -537, + 116, + 1381, + -4998, + 17939, + 21733, + -3819, + 275, + 818, + -871, + 542, + -219, + 44, + -216, + 479, + -654, + 344, + 1048, + -4707, + 19276, + 20545, + -4314, + 678, + 578, + -765, + 514, + -219, + 46 + +}; +struct src_stage src_int16_21_20_3445_5100 = { + 19, 20, 21, 15, 315, 20, 21, 0, 0, + src_int16_21_20_3445_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_2_1_3750_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_2_1_3750_5100.h new file mode 100644 index 0000000..c23c5b3 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_2_1_3750_5100.h @@ -0,0 +1,46 @@ +const int16_t src_int16_2_1_3750_5100_fir[40] = { + 94, + -219, + 368, + -477, + 444, + -128, + -656, + 2235, + -5647, + 20312, + 20312, + -5647, + 2235, + -656, + -128, + 444, + -477, + 368, + -219, + 94, + -26, + -59, + 276, + -660, + 1211, + -1885, + 2594, + -3223, + 3657, + 28793, + 3657, + -3223, + 2594, + -1885, + 1211, + -660, + 276, + -59, + -26, + 1 + +}; +struct src_stage src_int16_2_1_3750_5100 = { + 0, 1, 2, 20, 40, 1, 2, 0, 0, + src_int16_2_1_3750_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_2_3_3750_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_2_3_3750_5100.h new file mode 100644 index 0000000..5cd42a0 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_2_3_3750_5100.h @@ -0,0 +1,64 @@ +const int16_t src_int16_2_3_3750_5100_fir[58] = { + 45, + -108, + -32, + 272, + -143, + -420, + 569, + 337, + -1242, + 309, + 2011, + -2155, + -2632, + 9889, + 19158, + 9888, + -2632, + -2155, + 2011, + 309, + -1242, + 337, + 569, + -420, + -143, + 272, + -32, + -108, + 45, + -17, + -135, + 153, + 172, + -439, + 2, + 790, + -576, + -966, + 1727, + 483, + -3911, + 2456, + 16511, + 16510, + 2456, + -3911, + 483, + 1727, + -966, + -576, + 790, + 2, + -439, + 172, + 153, + -135, + -17, + 1 + +}; +struct src_stage src_int16_2_3_3750_5100 = { + 1, 1, 2, 29, 58, 3, 2, 0, 0, + src_int16_2_3_3750_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_3_1_1875_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_3_1_1875_5100.h new file mode 100644 index 0000000..d53be01 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_3_1_1875_5100.h @@ -0,0 +1,33 @@ +const int16_t src_int16_3_1_1875_5100_fir[27] = { + 76, + 615, + -2940, + 4365, + 22129, + 11291, + -3043, + -154, + 371, + 371, + -154, + -3043, + 11291, + 22129, + 4365, + -2940, + 615, + 76, + 676, + -1574, + -723, + 17996, + 17996, + -723, + -1574, + 676, + -1 + +}; +struct src_stage src_int16_3_1_1875_5100 = { + 0, 1, 3, 9, 27, 1, 3, 0, 0, + src_int16_3_1_1875_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_3_1_3750_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_3_1_3750_5100.h new file mode 100644 index 0000000..cfbd8a1 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_3_1_3750_5100.h @@ -0,0 +1,63 @@ +const int16_t src_int16_3_1_3750_5100_fir[57] = { + 27, + -138, + 361, + -698, + 1103, + -1467, + 1607, + -1197, + -790, + 27714, + 9074, + -4927, + 3100, + -1848, + 953, + -366, + 43, + 82, + -87, + -87, + 82, + 43, + -366, + 953, + -1848, + 3100, + -4927, + 9074, + 27714, + -790, + -1197, + 1607, + -1467, + 1103, + -698, + 361, + -138, + 27, + -184, + 332, + -451, + 437, + -145, + -620, + 2191, + -5610, + 20284, + 20284, + -5610, + 2191, + -620, + -145, + 437, + -451, + 332, + -184, + 1 + +}; +struct src_stage src_int16_3_1_3750_5100 = { + 0, 1, 3, 19, 57, 1, 3, 0, 0, + src_int16_3_1_3750_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_3_2_3750_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_3_2_3750_5100.h new file mode 100644 index 0000000..e66696a --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_3_2_3750_5100.h @@ -0,0 +1,63 @@ +const int16_t src_int16_3_2_3750_5100_fir[57] = { + 27, + -140, + 361, + -700, + 1104, + -1468, + 1609, + -1197, + -788, + 27714, + 9076, + -4927, + 3102, + -1848, + 955, + -366, + 45, + 82, + -85, + -85, + 82, + 45, + -366, + 955, + -1848, + 3102, + -4927, + 9076, + 27714, + -788, + -1197, + 1609, + -1467, + 1104, + -700, + 361, + -140, + 27, + -184, + 330, + -451, + 435, + -145, + -622, + 2191, + -5611, + 20283, + 20283, + -5611, + 2191, + -622, + -145, + 435, + -451, + 330, + -184, + 1 + +}; +struct src_stage src_int16_3_2_3750_5100 = { + 1, 2, 3, 19, 57, 2, 3, 0, 0, + src_int16_3_2_3750_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_7_8_3750_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_7_8_3750_5100.h new file mode 100644 index 0000000..a2f3ee3 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_7_8_3750_5100.h @@ -0,0 +1,167 @@ +const int16_t src_int16_7_8_3750_5100_fir[161] = { + 34, + -16, + -108, + 330, + -482, + 300, + 412, + -1539, + 2503, + -2276, + -970, + 22055, + 16075, + -4432, + 314, + 1373, + -1534, + 925, + -222, + -194, + 271, + -162, + 45, + 50, + -57, + -50, + 299, + -568, + 570, + 10, + -1237, + 2720, + -3515, + 1774, + 23969, + 12430, + -5084, + 1385, + 634, + -1269, + 999, + -416, + -35, + 198, + -157, + 58, + 59, + -97, + 29, + 226, + -593, + 798, + -440, + -745, + 2617, + -4501, + 5048, + 24963, + 8674, + -5072, + 2171, + -99, + -886, + 949, + -544, + 110, + 114, + -132, + 65, + 65, + -132, + 114, + 110, + -544, + 950, + -886, + -99, + 2170, + -5072, + 8674, + 24963, + 5048, + -4501, + 2618, + -745, + -440, + 798, + -593, + 226, + 29, + -97, + 59, + 58, + -157, + 198, + -35, + -417, + 999, + -1269, + 634, + 1384, + -5084, + 12430, + 23969, + 1774, + -3515, + 2721, + -1237, + 9, + 571, + -568, + 299, + -50, + -57, + 50, + 45, + -162, + 271, + -194, + -222, + 925, + -1534, + 1373, + 314, + -4432, + 16075, + 22055, + -971, + -2276, + 2503, + -1539, + 412, + 301, + -482, + 330, + -108, + -16, + 34, + 17, + -148, + 317, + -351, + 26, + 727, + -1634, + 2027, + -948, + -3062, + 19359, + 19359, + -3062, + -948, + 2027, + -1634, + 727, + 26, + -351, + 316, + -148, + 17, + 1 + +}; +struct src_stage src_int16_7_8_3750_5100 = { + 1, 1, 7, 23, 161, 8, 7, 0, 0, + src_int16_7_8_3750_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_8_7_3750_5100.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_8_7_3750_5100.h new file mode 100644 index 0000000..b6757a3 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_8_7_3750_5100.h @@ -0,0 +1,166 @@ +const int16_t src_int16_8_7_3750_5100_fir[160] = { + 45, + -86, + 79, + 47, + -369, + 955, + -1834, + 3019, + -4624, + 7804, + 28097, + 372, + -1841, + 1956, + -1614, + 1120, + -651, + 300, + -91, + 1, + 61, + -128, + 175, + -126, + -116, + 661, + -1609, + 3092, + -5535, + 12055, + 26421, + -2403, + -342, + 1149, + -1238, + 1003, + -666, + 359, + -146, + 36, + 67, + -161, + 266, + -309, + 184, + 248, + -1153, + 2780, + -5886, + 16319, + 23762, + -4384, + 1004, + 298, + -759, + 783, + -600, + 367, + -174, + 56, + 69, + -180, + 334, + -474, + 496, + -243, + -498, + 2073, + -5534, + 20313, + 20313, + -5534, + 2073, + -498, + -243, + 496, + -474, + 334, + -180, + 69, + 56, + -174, + 367, + -600, + 783, + -759, + 298, + 1004, + -4384, + 23762, + 16319, + -5886, + 2780, + -1153, + 248, + 184, + -309, + 266, + -161, + 67, + 36, + -147, + 360, + -666, + 1003, + -1238, + 1149, + -342, + -2403, + 26421, + 12055, + -5535, + 3092, + -1609, + 661, + -116, + -126, + 175, + -128, + 61, + 1, + -91, + 300, + -651, + 1120, + -1614, + 1956, + -1841, + 372, + 28097, + 7804, + -4624, + 3019, + -1834, + 955, + -369, + 47, + 79, + -86, + 45, + -39, + -15, + 195, + -553, + 1110, + -1828, + 2613, + -3330, + 3832, + 28670, + 3832, + -3330, + 2613, + -1828, + 1110, + -553, + 195, + -15, + -39, + 1 + +}; +struct src_stage src_int16_8_7_3750_5100 = { + 6, 7, 8, 20, 160, 7, 8, 0, 0, + src_int16_8_7_3750_5100_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_define.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_define.h new file mode 100644 index 0000000..5231cb9 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_define.h @@ -0,0 +1,11 @@ +/* SRC constants */ +#define MAX_FIR_DELAY_SIZE 415 +#define MAX_OUT_DELAY_SIZE 401 +#define MAX_BLK_IN 21 +#define MAX_BLK_OUT 21 +#define NUM_IN_FS 6 +#define NUM_OUT_FS 6 +#define STAGE1_TIMES_MAX 21 +#define STAGE2_TIMES_MAX 21 +#define STAGE_BUF_SIZE 168 +#define NUM_ALL_COEFFICIENTS 1320 diff --git a/src/include/reef/audio/coefficients/src/src_tiny_int16_table.h b/src/include/reef/audio/coefficients/src/src_tiny_int16_table.h new file mode 100644 index 0000000..0d4f9d0 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_tiny_int16_table.h @@ -0,0 +1,72 @@ +/* SRC conversions */ +#include <reef/audio/coefficients/src/src_tiny_int16_1_2_3750_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_1_3_1875_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_1_3_3750_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_2_1_3750_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_2_3_3750_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_3_1_1875_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_3_1_3750_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_3_2_3750_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_7_8_3750_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_8_7_3750_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_20_21_3445_5100.h> +#include <reef/audio/coefficients/src/src_tiny_int16_21_20_3445_5100.h> + +/* SRC table */ +int16_t fir_one = 16384; +struct src_stage src_int16_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one }; +struct src_stage src_int16_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one }; +int src_in_fs[6] = { 8000, 16000, 24000, 32000, 44100, 48000}; +int src_out_fs[6] = { 8000, 16000, 24000, 32000, 44100, 48000}; +struct src_stage *src_table1[6][6] = { + { &src_int16_1_1_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_1_3_1875_5100 + }, + { &src_int16_0_0_0_0, &src_int16_1_1_0_0, + &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_1_3_3750_5100 + }, + { &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_1_1_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_1_2_3750_5100 + }, + { &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_1_1_0_0, + &src_int16_0_0_0_0, &src_int16_2_3_3750_5100 + }, + { &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_1_1_0_0, &src_int16_21_20_3445_5100 + }, + { &src_int16_2_1_3750_5100, &src_int16_3_1_3750_5100, + &src_int16_2_1_3750_5100, &src_int16_3_2_3750_5100, + &src_int16_8_7_3750_5100, &src_int16_1_1_0_0 + } +}; +struct src_stage *src_table2[6][6] = { + { &src_int16_1_1_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_1_2_3750_5100 + }, + { &src_int16_0_0_0_0, &src_int16_1_1_0_0, + &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_1_1_0_0 + }, + { &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_1_1_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_1_1_0_0 + }, + { &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_1_1_0_0, + &src_int16_0_0_0_0, &src_int16_1_1_0_0 + }, + { &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_0_0_0_0, &src_int16_0_0_0_0, + &src_int16_1_1_0_0, &src_int16_7_8_3750_5100 + }, + { &src_int16_3_1_1875_5100, &src_int16_1_1_0_0, + &src_int16_1_1_0_0, &src_int16_1_1_0_0, + &src_int16_20_21_3445_5100, &src_int16_1_1_0_0 + } +};
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com --- src/audio/src.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/audio/src.c b/src/audio/src.c index 203e802..86f56de 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -417,7 +417,9 @@ static int src_params(struct comp_dev *dev) break; }
- /* Need to compute this */ + /* Calculate period size based on config. First make sure that + * frame_bytes is set. + */ dev->frame_bytes = dev->params.sample_container_bytes * dev->params.channels; cd->period_bytes = dev->frames * dev->frame_bytes;
On Fri, 2017-09-22 at 16:08 +0300, Seppo Ingalsuo wrote:
This patch prevents SRCs init to loop past PLATFORM_MAX_CHANNELS.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com
All applied.
Thanks
Liam
--------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
participants (2)
-
Liam Girdwood
-
Seppo Ingalsuo