Skip to content

Commit f05f7c2

Browse files
committed
one more update of ESP8266Audio library
1 parent f6daea2 commit f05f7c2

File tree

9 files changed

+89
-78
lines changed

9 files changed

+89
-78
lines changed

software/firmware/source/libraries/ESP8266Audio/src/AudioGeneratorFLAC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ char AudioGeneratorFLAC::error_cb_str[64];
196196
void AudioGeneratorFLAC::error_cb(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status)
197197
{
198198
(void) decoder;
199-
strncpy_P(error_cb_str, FLAC__StreamDecoderErrorStatusString[status], 64);
199+
strncpy_P(error_cb_str, FLAC__StreamDecoderErrorStatusString[status], sizeof(AudioGeneratorFLAC::error_cb_str) - 1);
200200
cb.st((int)status, error_cb_str);
201201
}
202202

software/firmware/source/libraries/ESP8266Audio/src/libmad/layer3.c

Lines changed: 74 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -352,19 +352,19 @@ struct fixedfloat {
352352
353353
root_table[3 + x] = 2^(x/4)
354354
*/
355+
static mad_fixed_t const root_table_val[7] PROGMEM = {
356+
MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */,
357+
MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */,
358+
MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */,
359+
MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */,
360+
MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */,
361+
MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */,
362+
MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */
363+
};
355364
static inline mad_fixed_t root_table(int i)
356365
{
357-
static mad_fixed_t const root_table_val[7] PROGMEM = {
358-
MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */,
359-
MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */,
360-
MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */,
361-
MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */,
362-
MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */,
363-
MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */,
364-
MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */
365-
};
366-
volatile uint32_t a = *(uint32_t*)&root_table_val[i];
367-
return *(mad_fixed_t*)&a;
366+
volatile mad_fixed_t a = root_table_val[i];
367+
return a;
368368
}
369369
/*
370370
coefficients for aliasing reduction
@@ -374,28 +374,28 @@ static inline mad_fixed_t root_table(int i)
374374
cs[i] = 1 / sqrt(1 + c[i]^2)
375375
ca[i] = c[i] / sqrt(1 + c[i]^2)
376376
*/
377+
static mad_fixed_t const cs_val[8] PROGMEM = {
378+
+MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */,
379+
+MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */,
380+
+MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */,
381+
+MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */
382+
};
377383
static inline mad_fixed_t cs(int i)
378384
{
379-
static mad_fixed_t const cs_val[8] PROGMEM = {
380-
+MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */,
381-
+MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */,
382-
+MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */,
383-
+MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */
384-
};
385-
volatile uint32_t a = *(uint32_t*)&cs_val[i];
386-
return *(mad_fixed_t*)&a;
385+
volatile mad_fixed_t a = cs_val[i];
386+
return a;
387387
}
388388

389+
static mad_fixed_t const ca_val[8] PROGMEM = {
390+
-MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */,
391+
-MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */,
392+
-MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */,
393+
-MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */
394+
};
389395
static inline mad_fixed_t ca(int i)
390396
{
391-
static mad_fixed_t const ca_val[8] PROGMEM = {
392-
-MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */,
393-
-MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */,
394-
-MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */,
395-
-MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */
396-
};
397-
volatile uint32_t a = *(uint32_t*)&ca_val[i];
398-
return *(mad_fixed_t*)&a;
397+
volatile mad_fixed_t a = ca_val[i];
398+
return a;
399399
}
400400

401401
/*
@@ -417,31 +417,31 @@ mad_fixed_t const imdct_s[6][6] PROGMEM = {
417417
418418
window_l[i] = sin((PI / 36) * (i + 1/2))
419419
*/
420+
static mad_fixed_t const window_l_val[36] PROGMEM = {
421+
MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
422+
MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */,
423+
MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */,
424+
MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
425+
MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */,
426+
MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */,
427+
428+
MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
429+
MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */,
430+
MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */,
431+
MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
432+
MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */,
433+
MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */,
434+
435+
MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */,
436+
MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */,
437+
MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */,
438+
MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */,
439+
MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */,
440+
MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */,
441+
};
420442
static inline mad_fixed_t window_l(int i)
421443
{
422-
static mad_fixed_t const window_l_val[36] PROGMEM = {
423-
MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
424-
MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */,
425-
MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */,
426-
MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
427-
MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */,
428-
MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */,
429-
430-
MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
431-
MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */,
432-
MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */,
433-
MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
434-
MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */,
435-
MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */,
436-
437-
MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */,
438-
MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */,
439-
MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */,
440-
MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */,
441-
MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */,
442-
MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */,
443-
};
444-
volatile uint32_t a = *(uint32_t*)&window_l_val[i];
444+
volatile mad_fixed_t a = window_l_val[i];
445445
return *(mad_fixed_t*)&a;
446446
}
447447
# endif /* ASO_IMDCT */
@@ -452,18 +452,18 @@ static inline mad_fixed_t window_l(int i)
452452
453453
window_s[i] = sin((PI / 12) * (i + 1/2))
454454
*/
455+
static mad_fixed_t const window_s_val[12] PROGMEM = {
456+
MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */,
457+
MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */,
458+
MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
459+
MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
460+
MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
461+
MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
462+
};
455463
static inline mad_fixed_t window_s(int i)
456464
{
457-
static mad_fixed_t const window_s_val[12] PROGMEM = {
458-
MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */,
459-
MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */,
460-
MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
461-
MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
462-
MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
463-
MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
464-
};
465-
volatile uint32_t a = *(uint32_t*)&window_s_val[i];
466-
return *(mad_fixed_t*)&a;
465+
volatile mad_fixed_t a = window_s_val[i];
466+
return a;
467467
}
468468

469469
/*
@@ -473,19 +473,19 @@ static inline mad_fixed_t window_s(int i)
473473
is_ratio[i] = tan(i * (PI / 12))
474474
is_table[i] = is_ratio[i] / (1 + is_ratio[i])
475475
*/
476+
static mad_fixed_t const is_table_val[7] PROGMEM = {
477+
MAD_F(0x00000000) /* 0.000000000 */,
478+
MAD_F(0x0361962f) /* 0.211324865 */,
479+
MAD_F(0x05db3d74) /* 0.366025404 */,
480+
MAD_F(0x08000000) /* 0.500000000 */,
481+
MAD_F(0x0a24c28c) /* 0.633974596 */,
482+
MAD_F(0x0c9e69d1) /* 0.788675135 */,
483+
MAD_F(0x10000000) /* 1.000000000 */
484+
};
476485
static inline mad_fixed_t is_table(int i)
477486
{
478-
static mad_fixed_t const is_table_val[7] PROGMEM = {
479-
MAD_F(0x00000000) /* 0.000000000 */,
480-
MAD_F(0x0361962f) /* 0.211324865 */,
481-
MAD_F(0x05db3d74) /* 0.366025404 */,
482-
MAD_F(0x08000000) /* 0.500000000 */,
483-
MAD_F(0x0a24c28c) /* 0.633974596 */,
484-
MAD_F(0x0c9e69d1) /* 0.788675135 */,
485-
MAD_F(0x10000000) /* 1.000000000 */
486-
};
487-
volatile uint32_t a = *(uint32_t*)&is_table_val[i];
488-
return *(mad_fixed_t*)&a;
487+
volatile mad_fixed_t a = is_table_val[i];
488+
return a;
489489
}
490490

491491
/*
@@ -1739,7 +1739,10 @@ void sdctII(mad_fixed_t const x[18], mad_fixed_t X[18])
17391739
s = *(volatile mad_fixed_t*)(volatile uint32_t*)&scale[i + 2]; tmp[i + 2] = mad_f_mul(x[i + 2] - x[18 - (i + 2) - 1], s); //scale[i + 2]);
17401740
}
17411741

1742+
#pragma GCC diagnostic push
1743+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
17421744
fastsdct(tmp, &X[1]);
1745+
#pragma GCC diagnostic pop
17431746

17441747
/* output accumulation */
17451748

software/firmware/source/libraries/ESP8266Audio/src/libopus/opus_encoder.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2525
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626
*/
27-
27+
#if 0
2828
//#ifdef HAVE_CONFIG_H
2929
#include "config.h"
3030
//#endif
@@ -2781,3 +2781,4 @@ void opus_encoder_destroy(OpusEncoder *st)
27812781
{
27822782
opus_free(st);
27832783
}
2784+
#endif

software/firmware/source/libraries/ESP8266Audio/src/libopus/opus_multistream_encoder.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2525
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626
*/
27-
27+
#if 0
2828
//#ifdef HAVE_CONFIG_H
2929
#include "config.h"
3030
//#endif
@@ -1326,3 +1326,4 @@ void opus_multistream_encoder_destroy(OpusMSEncoder *st)
13261326
{
13271327
opus_free(st);
13281328
}
1329+
#endif

software/firmware/source/libraries/ESP8266Audio/src/libopus/opus_projection_encoder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2525
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626
*/
27-
27+
#if 0
2828
//#ifdef HAVE_CONFIG_H
2929
#include "config.h"
3030
//#endif
@@ -465,4 +465,4 @@ int opus_projection_encoder_ctl(OpusProjectionEncoder *st, int request, ...)
465465
va_end(ap);
466466
return OPUS_BAD_ARG;
467467
}
468-
468+
#endif

software/firmware/source/libraries/ESP8266Audio/src/libopus/silk/NLSF2A.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ static OPUS_INLINE void silk_NLSF2A_find_poly(
6262
}
6363
}
6464

65+
#pragma GCC diagnostic push
66+
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
6567
/* compute whitening filter coefficients from normalized line spectral frequencies */
6668
void silk_NLSF2A(
6769
opus_int16 *a_Q12, /* O monic whitening filter coefficients in Q12, [ d ] */
@@ -143,4 +145,4 @@ void silk_NLSF2A(
143145
free(Q);
144146
free(a32_QA1);
145147
}
146-
148+
#pragma GCC diagnostic pop

software/firmware/source/libraries/ESP8266Audio/src/libopus/silk/enc_API.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2424
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2525
POSSIBILITY OF SUCH DAMAGE.
2626
***********************************************************************/
27+
#if 0
2728

2829
//#ifdef HAVE_CONFIG_H
2930
#include "../config.h"
@@ -574,3 +575,4 @@ opus_int silk_Encode( /* O Returns error co
574575
return ret;
575576
}
576577

578+
#endif

software/firmware/source/libraries/ESP8266Audio/src/libopus/silk/fixed/encode_frame_FIX.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
3434
#include "../../celt/stack_alloc.h"
3535
#include "../tuning_parameters.h"
3636

37+
#if 0
3738
/* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */
3839
static OPUS_INLINE void silk_LBRR_encode_FIX(
3940
silk_encoder_state_FIX *psEnc, /* I/O Pointer to Silk FIX encoder state */
@@ -446,3 +447,4 @@ static OPUS_INLINE void silk_LBRR_encode_FIX(
446447
silk_memcpy( psEncCtrl->Gains_Q16, TempGains_Q16, psEnc->sCmn.nb_subfr * sizeof( opus_int32 ) );
447448
}
448449
}
450+
#endif

software/firmware/source/libraries/ESP8266Audio/src/opusfile/opusfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ opus_int64 op_raw_total(const OggOpusFile *_of,int _li){
17491749
ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li){
17501750
OggOpusLink *links;
17511751
ogg_int64_t pcm_total;
1752-
ogg_int64_t diff;
1752+
ogg_int64_t diff = 0;
17531753
int nlinks;
17541754
nlinks=_of->nlinks;
17551755
if(OP_UNLIKELY(_of->ready_state<OP_OPENED)

0 commit comments

Comments
 (0)