summaryrefslogtreecommitdiff
path: root/pjmedia/include/pjmedia-codec
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2010-06-11 13:38:42 +0000
committerNanang Izzuddin <nanang@teluu.com>2010-06-11 13:38:42 +0000
commit478d7fed9b2d5713500c91dd296356b7ea939502 (patch)
tree8e2b057e5f4838a51e5ab954cf3e683f830ebb69 /pjmedia/include/pjmedia-codec
parentf58cd5dab31fb33928ff092f534b4145873c8dad (diff)
Close #1072:
- Added API pjmedia_codec_g722_set_pcm_shift() to enable configurable level-adjusment setting. - Also added macro PJMEDIA_G722_DEFAULT_PCM_SHIFT (default value is 2) to accomplish 14-16 bit PCM conversion for G722 input/output. - Added a feature in G722 to stop level-adjusment/PCM-shifting when clipping occured, compile-time configurable via PJMEDIA_G722_STOP_PCM_SHIFT_ON_CLIPPING macro. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3202 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include/pjmedia-codec')
-rw-r--r--pjmedia/include/pjmedia-codec/config.h34
-rw-r--r--pjmedia/include/pjmedia-codec/g722.h15
2 files changed, 49 insertions, 0 deletions
diff --git a/pjmedia/include/pjmedia-codec/config.h b/pjmedia/include/pjmedia-codec/config.h
index 79322bb2..3dbb5c56 100644
--- a/pjmedia/include/pjmedia-codec/config.h
+++ b/pjmedia/include/pjmedia-codec/config.h
@@ -98,6 +98,40 @@
/**
+ * Default G.722 codec encoder and decoder level adjustment. The G.722
+ * specifies that it uses 14 bit PCM for input and output, while PJMEDIA
+ * normally uses 16 bit PCM, so the conversion is done by applying
+ * level adjustment. If the value is non-zero, then PCM input samples to
+ * the encoder will be shifted right by this value, and similarly PCM
+ * output samples from the decoder will be shifted left by this value.
+ *
+ * This can be changed at run-time after initialization by calling
+ * #pjmedia_codec_g722_set_pcm_shift().
+ *
+ * Default: 2.
+ */
+#ifndef PJMEDIA_G722_DEFAULT_PCM_SHIFT
+# define PJMEDIA_G722_DEFAULT_PCM_SHIFT 2
+#endif
+
+
+/**
+ * Specifies whether G.722 PCM shifting should be stopped when clipping
+ * detected in the decoder. Enabling this feature can be useful when
+ * talking to G.722 implementation that uses 16 bit PCM for G.722 input/
+ * output (for any reason it seems to work) and the PCM shifting causes
+ * audio clipping.
+ *
+ * See also #PJMEDIA_G722_DEFAULT_PCM_SHIFT.
+ *
+ * Default: enabled.
+ */
+#ifndef PJMEDIA_G722_STOP_PCM_SHIFT_ON_CLIPPING
+# define PJMEDIA_G722_STOP_PCM_SHIFT_ON_CLIPPING 1
+#endif
+
+
+/**
* Enable the features provided by Intel IPP libraries, for example
* codecs such as G.729, G.723.1, G.726, G.728, G.722.1, and AMR.
*
diff --git a/pjmedia/include/pjmedia-codec/g722.h b/pjmedia/include/pjmedia-codec/g722.h
index 71a5bb5b..594d5a5e 100644
--- a/pjmedia/include/pjmedia-codec/g722.h
+++ b/pjmedia/include/pjmedia-codec/g722.h
@@ -78,6 +78,21 @@ PJ_DECL(pj_status_t) pjmedia_codec_g722_init(pjmedia_endpt *endpt);
PJ_DECL(pj_status_t) pjmedia_codec_g722_deinit(void);
+/**
+ * Set the G.722 codec encoder and decoder level adjustment.
+ * If the value is non-zero, then PCM input samples to the encoder will
+ * be shifted right by this value, and similarly PCM output samples from
+ * the decoder will be shifted left by this value.
+ *
+ * Default value is PJMEDIA_G722_DEFAULT_PCM_SHIFT.
+ *
+ * @param val The value
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_codec_g722_set_pcm_shift(unsigned val);
+
+
PJ_END_DECL