Merge pull request #761 in FS/freeswitch from ~PIOTRGREGOR/freeswitch:bugfix/FS-8960-avmd-set-buffer-position-to-beginning to master
* commit 'fce7cfee35468decc8246c410cfd100dc6df7d5a': FS-8960 Set buffer position to beginning on reset
This commit is contained in:
commit
4ff1a6d2cc
|
@ -92,13 +92,14 @@ extern size_t next_power_of_2(size_t v);
|
|||
|
||||
//#define DESTROY_CIRC_BUFFER(b) free((b)->buf)
|
||||
#define GET_BACKLOG_POS(b) ((b)->lpos - (b)->backlog)
|
||||
#define GET_CURRENT_POS(b) ((b)->lpos)
|
||||
#define GET_CURRENT_SAMPLE(b) GET_SAMPLE((b), GET_CURRENT_POS((b)))
|
||||
#define GET_CURRENT_POS(b) ((b)->pos)
|
||||
#define GET_CURRENT_LPOS(b) ((b)->lpos)
|
||||
#define GET_CURRENT_SAMPLE(b) GET_SAMPLE((b), GET_CURRENT_LPOS((b)))
|
||||
|
||||
#define ADD_SAMPLE(b, s) \
|
||||
do { \
|
||||
INC_POS((b)); \
|
||||
SET_SAMPLE((b), GET_CURRENT_POS((b)), (s)); \
|
||||
SET_SAMPLE((b), GET_CURRENT_LPOS((b)), (s)); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,22 +25,9 @@
|
|||
*
|
||||
* This module detects voicemail beeps using a generalized approach.
|
||||
*
|
||||
* Mofdifications:
|
||||
*
|
||||
* Piotr Gregor <piotrek.gregor@gmail.com>
|
||||
* FS-8808 : code refactor
|
||||
* FS-8809 : fix MAP_POPULATE undeclared
|
||||
* FS-8810 : fix float-int-float fast arc cosine
|
||||
* mapping construction (reuse)
|
||||
* FS-8852 : use predefined table length instead
|
||||
* of hardcoded computation
|
||||
* FS-8853 : enable change of resolution (and size)
|
||||
* of fast arc cos table
|
||||
* FS-8854 : initialize circular buffer
|
||||
* FS-8855 : fix APPEND_SMA_VAL macro and avmd_process
|
||||
* callback so that the variance of tone's
|
||||
* frequency estimation is correctly
|
||||
* calculated
|
||||
* Modifications:
|
||||
* Piotr Gregor <piotrek.gregor@gmail.com>:
|
||||
* FS-8808, FS-8809, FS-8810, FS-8852, FS-8853, FS-8854, FS-8855
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
|
@ -91,7 +78,7 @@
|
|||
/*! Maximum frequency as digital normalized frequency */
|
||||
#define MAX_FREQUENCY_R(r) ((2.0 * M_PI * MAX_FREQUENCY) / (r))
|
||||
/* decrease this value to eliminate false positives */
|
||||
#define VARIANCE_THRESHOLD (0.001)
|
||||
#define VARIANCE_THRESHOLD (0.0001)
|
||||
|
||||
#include "amplitude.h"
|
||||
#include "buffer.h"
|
||||
|
@ -233,7 +220,7 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, sw
|
|||
/*! \brief FreeSWITCH module loading function.
|
||||
*
|
||||
* @author Eric des Courtis
|
||||
* @par Changes: Piotr Gregor, 07 Feb 2016 (FS-8809, FS-8810)
|
||||
* @par Modifications: Piotr Gregor
|
||||
* @return On success SWITCH_STATUS_SUCCES,
|
||||
* on failure SWITCH_STATUS_TERM.
|
||||
*/
|
||||
|
@ -587,8 +574,7 @@ end:
|
|||
|
||||
/*! \brief Process one frame of data with avmd algorithm.
|
||||
* @author Eric des Courtis
|
||||
* @par Modifications: Piotr Gregor (FS-8852, FS-8853, FS-8854, FS-8855)
|
||||
* (improved variance estimation calculation)
|
||||
* @par Modifications: Piotr Gregor
|
||||
* @param session An avmd session.
|
||||
* @param frame An audio frame.
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,8 @@ typedef struct {
|
|||
|
||||
#define GET_SMA_SAMPLE(b, p) ((b)->data[(p) % (b)->len])
|
||||
#define SET_SMA_SAMPLE(b, p, v) ((b)->data[(p) % (b)->len] = (v))
|
||||
#define GET_CURRENT_SMA_POS(b) ((b)->lpos)
|
||||
#define GET_CURRENT_SMA_POS(b) ((b)->pos)
|
||||
#define GET_CURRENT_SMA_LPOS(b) ((b)->lpos)
|
||||
|
||||
#define INC_SMA_POS(b) \
|
||||
{ \
|
||||
|
@ -52,6 +53,8 @@ typedef struct {
|
|||
{ \
|
||||
(b)->sma = 0.0; \
|
||||
(void)memset((b)->data, 0, sizeof(BUFF_TYPE) * (b)->len); \
|
||||
(b)->pos = 0; \
|
||||
(b)->lpos = 0; \
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue