ipp_codecs.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. /*
  2. * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __PJMEDIA_CODECS_IPP_H__
  20. #define __PJMEDIA_CODECS_IPP_H__
  21. /**
  22. * @file pjmedia-codec/ipp_codecs.h
  23. * @brief IPP codecs wrapper.
  24. */
  25. #include <pjmedia-codec/types.h>
  26. /**
  27. * @defgroup PJMED_IPP_CODEC IPP Codecs
  28. * @ingroup PJMEDIA_CODEC_CODECS
  29. * @brief Implementation of IPP codecs
  30. * @{
  31. *
  32. * This section describes functions to initialize and register IPP codec
  33. * factory to the codec manager. After the codec factory has been registered,
  34. * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
  35. *
  36. * This codec factory contains various codecs, i.e: G.729, G.723.1, G.726,
  37. * G.728, G.722.1, AMR, and AMR-WB.
  38. *
  39. *
  40. * \section pjmedia_codec_ipp_g729 IPP G.729
  41. *
  42. * IPP G.729 is compliant with ITU-T G.729 and Annexes A, B, C, C+, D,
  43. * E, I specifications. However, currently the pjmedia implementation is
  44. * using Annexes A and B only.
  45. *
  46. * IPP G.729 supports 16-bit PCM audio signal with sampling rate 8000Hz,
  47. * frame length 10ms, and resulting in bitrate 8000bps (annexes D and E
  48. * introduce bitrates 6400bps and 11800bps).
  49. *
  50. * \subsection ipp_g729_codec_setting Codec Settings
  51. *
  52. * General codec settings for this codec such as VAD and PLC can be
  53. * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
  54. * Please see the documentation of #pjmedia_codec_param for more info.
  55. *
  56. * Note that G.729 VAD status should be signalled in SDP, see more
  57. * description below.
  58. *
  59. * \subsubsection ipp_g729_annexb Annex B
  60. *
  61. * The capability of VAD/DTX is specified in Annex B.
  62. *
  63. * By default, Annex B is enabled. This default setting of Annex B can
  64. * be modified using #pjmedia_codec_mgr_set_default_param().
  65. *
  66. * In #pjmedia_codec_param, Annex B is configured via VAD setting and
  67. * format parameter "annexb" in the SDP "a=fmtp" attribute in
  68. * decoding fmtp field. Valid values are "yes" and "no",
  69. * the implementation default is "yes". When this parameter is omitted
  70. * in the SDP, the value will be "yes" (RFC 4856 Section 2.1.9).
  71. *
  72. * Here is an example of modifying default setting of Annex B to
  73. * be disabled using #pjmedia_codec_mgr_set_default_param():
  74. \code
  75. pjmedia_codec_param param;
  76. pjmedia_codec_mgr_get_default_param(.., &param);
  77. ...
  78. // Set VAD
  79. param.setting.vad = 0;
  80. // Set SDP format parameter
  81. param.setting.dec_fmtp.cnt = 1;
  82. param.setting.dec_fmtp.param[0].name = pj_str("annexb");
  83. param.setting.dec_fmtp.param[0].val = pj_str("no");
  84. ...
  85. pjmedia_codec_mgr_set_default_param(.., &param);
  86. \endcode
  87. *
  88. * \note
  89. * The difference of Annex B status in SDP offer/answer may be considered as
  90. * incompatible codec in SDP negotiation.
  91. *
  92. *
  93. * \section pjmedia_codec_ipp_g7231 IPP G.723.1
  94. *
  95. * IPP G.723.1 speech codec is compliant with ITU-T G.723.1 and Annex A
  96. * specifications.
  97. *
  98. * IPP G.723.1 supports 16-bit PCM audio signal with sampling rate 8000Hz,
  99. * frame length 30ms, and resulting in bitrates 5300bps and 6300bps.
  100. *
  101. * By default, pjmedia implementation uses encoding bitrate of 6300bps.
  102. * The bitrate is signalled in-band in G.723.1 frames and interoperable.
  103. *
  104. * \subsection ipp_g723_codec_setting Codec Settings
  105. *
  106. * General codec settings for this codec such as VAD and PLC can be
  107. * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
  108. * Please see the documentation of #pjmedia_codec_param for more info.
  109. *
  110. *
  111. * \section pjmedia_codec_ipp_g726 IPP G.726
  112. *
  113. * IPP G.726 is compliant with ITU-T G.726 and G.726 Annex A specifications.
  114. *
  115. * IPP G.726 supports 16-bit PCM audio signal with sampling rate 8000Hz,
  116. * 10ms frame length and producing 16kbps, 24kbps, 32kbps, 48kbps bitrates.
  117. * The bitrate is specified explicitly in its encoding name, i.e: G726-16,
  118. * G726-24, G726-32, G726-48.
  119. *
  120. * \subsection ipp_g726_codec_setting Codec Settings
  121. *
  122. * General codec settings for this codec such as VAD and PLC can be
  123. * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
  124. * Please see the documentation of #pjmedia_codec_param for more info.
  125. *
  126. *
  127. * \section pjmedia_codec_ipp_g728 IPP G.728
  128. *
  129. * IPP G.728 is compliant with ITU-T G.728 with I, G, H Appendixes
  130. * specifications for Low-Delay CELP coder.
  131. *
  132. * IPP G.728 supports 16-bit PCM audio signal with sampling rate 8000Hz,
  133. * 20ms frame length and producing 9.6kbps, 12.8kbps, and 16kbps bitrates.
  134. *
  135. * The pjmedia implementation currently uses 16kbps bitrate only.
  136. *
  137. * \subsection ipp_g728_codec_setting Codec Settings
  138. *
  139. * General codec settings for this codec such as VAD and PLC can be
  140. * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
  141. * Please see the documentation of #pjmedia_codec_param for more info.
  142. *
  143. *
  144. * \section pjmedia_codec_ipp_g7221 IPP G.722.1
  145. *
  146. * The pjmedia implementation of IPP G.722.1 supports 16-bit PCM audio
  147. * signal with sampling rate 16000Hz, 20ms frame length and producing
  148. * 16kbps, 24kbps, and 32kbps bitrates.
  149. *
  150. * \subsection ipp_g7221_codec_setting Codec Settings
  151. *
  152. * General codec settings for this codec such as VAD and PLC can be
  153. * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
  154. * Please see the documentation of #pjmedia_codec_param for more info.
  155. *
  156. * \subsubsection ipp_g7221_bitrate Bitrate
  157. *
  158. * The codec implementation supports only standard bitrates, i.e:
  159. * 24kbps and 32kbps. Both are enabled by default.
  160. *
  161. * \remark
  162. * There is a flaw in the codec manager as currently it could not
  163. * differentiate G.722.1 codecs by bitrates, hence invoking
  164. * #pjmedia_codec_mgr_set_default_param() may only affect a G.722.1 codec
  165. * with the highest priority (or first index found in codec enumeration
  166. * when they have same priority) and invoking
  167. * #pjmedia_codec_mgr_set_codec_priority() will set priority of all G.722.1
  168. * codecs with sampling rate as specified.
  169. *
  170. *
  171. * \section pjmedia_codec_ipp_amr IPP AMR
  172. *
  173. * The IPP AMR is compliant with GSM06.90-94 specifications for GSM Adaptive
  174. * Multi-Rate codec.
  175. *
  176. * IPP AMR supports 16-bit PCM audio signal with sampling rate 8000Hz,
  177. * 20ms frame length and producing various bitrates that ranges from 4.75kbps
  178. * to 12.2kbps.
  179. *
  180. * \subsection ipp_amr_codec_setting Codec Settings
  181. *
  182. * General codec settings for this codec such as VAD and PLC can be
  183. * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
  184. * Please see the documentation of #pjmedia_codec_param for more info.
  185. *
  186. * \subsubsection ipp_amr_bitrate Bitrate
  187. *
  188. * By default, encoding bitrate is 7400bps. This default setting can be
  189. * modified using #pjmedia_codec_mgr_set_default_param() by specifying
  190. * prefered AMR bitrate in field <tt>info::avg_bps</tt> of
  191. * #pjmedia_codec_param. Valid bitrates could be seen in
  192. * #pjmedia_codec_amrnb_bitrates.
  193. *
  194. * \subsubsection ipp_amr_payload_format Payload Format
  195. *
  196. * There are two AMR payload format types, bandwidth-efficient and
  197. * octet-aligned. Default setting is using octet-aligned. This default payload
  198. * format can be modified using #pjmedia_codec_mgr_set_default_param().
  199. *
  200. * In #pjmedia_codec_param, payload format can be set by specifying SDP
  201. * format parameters "octet-align" in the SDP "a=fmtp" attribute for
  202. * decoding direction. Valid values are "0" (for bandwidth efficient mode)
  203. * and "1" (for octet-aligned mode).
  204. *
  205. * \subsubsection ipp_amr_mode_set Mode-Set
  206. *
  207. * Mode-set is used for restricting AMR modes in decoding direction.
  208. *
  209. * By default, no mode-set restriction applied. This default setting can be
  210. * be modified using #pjmedia_codec_mgr_set_default_param().
  211. *
  212. * In #pjmedia_codec_param, mode-set could be specified via format parameters
  213. * "mode-set" in the SDP "a=fmtp" attribute for decoding direction. Valid
  214. * value is a comma separated list of modes from the set 0 - 7, e.g:
  215. * "4,5,6,7". When this parameter is omitted, no mode-set restrictions applied.
  216. *
  217. * Here is an example of modifying AMR default codec param:
  218. \code
  219. pjmedia_codec_param param;
  220. pjmedia_codec_mgr_get_default_param(.., &param);
  221. ...
  222. // set default encoding bitrate to the highest 12.2kbps
  223. param.info.avg_bps = 12200;
  224. // restrict decoding bitrate to 10.2kbps and 12.2kbps only
  225. param.setting.dec_fmtp.param[0].name = pj_str("mode-set");
  226. param.setting.dec_fmtp.param[0].val = pj_str("6,7");
  227. // also set to use bandwidth-efficient payload format
  228. param.setting.dec_fmtp.param[1].name = pj_str("octet-align");
  229. param.setting.dec_fmtp.param[1].val = pj_str("0");
  230. param.setting.dec_fmtp.cnt = 2;
  231. ...
  232. pjmedia_codec_mgr_set_default_param(.., &param);
  233. \endcode
  234. *
  235. *
  236. * \section pjmedia_codec_ipp_amrwb IPP AMR-WB
  237. *
  238. * The IPP AMR-WB is compliant with 3GPP TS 26.190-192, 194, 201
  239. * specifications for Adaptive Multi-Rate WideBand codec.
  240. *
  241. * IPP AMR-WB supports 16-bit PCM audio signal with sampling rate 16000Hz,
  242. * 20ms frame length and producing various bitrates. Valid bitrates could be
  243. * seen in #pjmedia_codec_amrwb_bitrates. The pjmedia implementation default
  244. * bitrate is 15850bps.
  245. *
  246. * \subsection ipp_amrwb_codec_setting Codec Settings
  247. *
  248. * General codec settings for this codec such as VAD and PLC can be
  249. * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
  250. * Please see the documentation of #pjmedia_codec_param for more info.
  251. *
  252. * \subsubsection ipp_amrwb_bitrate Bitrate
  253. *
  254. * By default, encoding bitrate is 15850bps. This default setting can be
  255. * modified using #pjmedia_codec_mgr_set_default_param() by specifying
  256. * prefered AMR bitrate in field <tt>info::avg_bps</tt> of
  257. * #pjmedia_codec_param.
  258. *
  259. * \subsubsection ipp_amrwb_payload_format Payload Format
  260. *
  261. * There are two AMR payload format types, bandwidth-efficient and
  262. * octet-aligned. Default setting is using octet-aligned. This default payload
  263. * format can be modified using #pjmedia_codec_mgr_set_default_param().
  264. *
  265. * In #pjmedia_codec_param, payload format can be set by specifying SDP
  266. * format parameters "octet-align" in the SDP "a=fmtp" attribute for
  267. * decoding direction. Valid values are "0" (for bandwidth efficient mode)
  268. * and "1" (for octet-aligned mode).
  269. *
  270. * \subsubsection ipp_amrwb_mode_set Mode-Set
  271. *
  272. * Mode-set is used for restricting AMR modes in decoding direction.
  273. *
  274. * By default, no mode-set restriction applied. This default setting can be
  275. * be modified using #pjmedia_codec_mgr_set_default_param().
  276. *
  277. * In #pjmedia_codec_param, mode-set could be specified via format parameters
  278. * "mode-set" in the SDP "a=fmtp" attribute for decoding direction. Valid
  279. * value is a comma separated list of modes from the set 0 - 7, e.g:
  280. * "4,5,6,7". When this parameter is omitted, no mode-set restrictions applied.
  281. */
  282. PJ_BEGIN_DECL
  283. /**
  284. * Initialize and register IPP codecs factory to pjmedia endpoint.
  285. *
  286. * @param endpt The pjmedia endpoint.
  287. *
  288. * @return PJ_SUCCESS on success.
  289. */
  290. PJ_DECL(pj_status_t) pjmedia_codec_ipp_init( pjmedia_endpt *endpt );
  291. /**
  292. * Unregister IPP codecs factory from pjmedia endpoint and deinitialize
  293. * the IPP codecs library.
  294. *
  295. * @return PJ_SUCCESS on success.
  296. */
  297. PJ_DECL(pj_status_t) pjmedia_codec_ipp_deinit(void);
  298. PJ_END_DECL
  299. /**
  300. * @}
  301. */
  302. #endif /* __PJMEDIA_CODECS_IPP_H__ */