pjsip logo pjsip.org
Open source SIP stack and media stack for presence, im/instant messaging, and multimedia communication
Loading

HOME

SIP/media Features
High Performance SIP
Small Footprint SIP
Symbian Port

FAQ

Documentation

Licensing

Download

Development (Trac)

Projects using pjsip

Mailing List

Open Source Links


About: PJLIB, PJLIB-UTIL, PJSIP, and PJMEDIA are created by: Benny Prijono
<bennylp@pjsip.org>


 

Home --> Documentations --> PJLIB Reference

Mathematics and Statistics
[Miscelaneous]

Data Structures

struct  pj_math_stat

Defines

#define PJ_PI   3.14159265358979323846
#define PJ_1_PI   0.318309886183790671538
#define PJ_ABS(x)   ((x) > 0 ? (x) : -(x))
#define PJ_MAX(x, y)   ((x) > (y)? (x) : (y))
#define PJ_MIN(x, y)   ((x) < (y)? (x) : (y))

Functions

unsigned pj_isqrt (unsigned i)
void pj_math_stat_init (pj_math_stat *stat)
void pj_math_stat_update (pj_math_stat *stat, int val)
unsigned pj_math_stat_get_stddev (const pj_math_stat *stat)
void pj_math_stat_set_stddev (pj_math_stat *stat, unsigned dev)

Detailed Description

Provides common mathematics constants and operations, and also standard statistics calculation (min, max, mean, standard deviation). Statistics calculation is done in realtime (statistics state is updated on time each new sample comes).


Define Documentation

#define PJ_ABS (  )     ((x) > 0 ? (x) : -(x))

Mathematical macro

#define PJ_PI   3.14159265358979323846

Mathematical constants


Function Documentation

unsigned pj_isqrt ( unsigned  i  ) 

Calculate integer square root of an integer.

Parameters:
i Integer to be calculated.
Returns:
Square root result.

Referenced by pj_math_stat_get_stddev().

unsigned pj_math_stat_get_stddev ( const pj_math_stat stat  ) 

Get the standard deviation of specified statistics state.

Parameters:
stat Statistic state.
Returns:
The standard deviation.

References pj_isqrt().

void pj_math_stat_init ( pj_math_stat stat  ) 

Initialize statistics state.

Parameters:
stat Statistic state.

References pj_bzero().

void pj_math_stat_set_stddev ( pj_math_stat stat,
unsigned  dev 
)

Set the standard deviation of statistics state. This is useful when the statistic state is operated in 'read-only' mode as a storage of statistical data.

Parameters:
stat Statistic state.
dev The standard deviation.
void pj_math_stat_update ( pj_math_stat stat,
int  val 
)

Update statistics state as a new sample comes.

Parameters:
stat Statistic state.
val The new sample data.

References int().

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.