modes.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. /* Copyright (C) 2002 Jean-Marc Valin
  2. File: modes.c
  3. Describes the different modes of the codec
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions
  6. are met:
  7. - Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. - Neither the name of the Xiph.org Foundation nor the names of its
  13. contributors may be used to endorse or promote products derived from
  14. this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  16. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  17. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
  19. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  20. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  22. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  23. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  24. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifdef HAVE_CONFIG_H
  28. #include "config.h"
  29. #endif
  30. #include "modes.h"
  31. #include "ltp.h"
  32. #include "quant_lsp.h"
  33. #include "cb_search.h"
  34. #include "sb_celp.h"
  35. #include "nb_celp.h"
  36. #include "vbr.h"
  37. #include "misc.h"
  38. #include <math.h>
  39. #ifndef NULL
  40. #define NULL 0
  41. #endif
  42. #define MAX_IN_SAMPLES 640
  43. const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
  44. /* Extern declarations for all codebooks we use here */
  45. extern const signed char gain_cdbk_nb[];
  46. extern const signed char gain_cdbk_lbr[];
  47. extern const signed char hexc_table[];
  48. extern const signed char exc_5_256_table[];
  49. extern const signed char exc_5_64_table[];
  50. extern const signed char exc_8_128_table[];
  51. extern const signed char exc_10_32_table[];
  52. extern const signed char exc_10_16_table[];
  53. extern const signed char exc_20_32_table[];
  54. extern const signed char hexc_10_32_table[];
  55. /* Parameters for Long-Term Prediction (LTP)*/
  56. static const ltp_params ltp_params_nb = {
  57. gain_cdbk_nb,
  58. 7,
  59. 7
  60. };
  61. /* Parameters for Long-Term Prediction (LTP)*/
  62. static const ltp_params ltp_params_vlbr = {
  63. gain_cdbk_lbr,
  64. 5,
  65. 0
  66. };
  67. /* Parameters for Long-Term Prediction (LTP)*/
  68. static const ltp_params ltp_params_lbr = {
  69. gain_cdbk_lbr,
  70. 5,
  71. 7
  72. };
  73. /* Parameters for Long-Term Prediction (LTP)*/
  74. static const ltp_params ltp_params_med = {
  75. gain_cdbk_lbr,
  76. 5,
  77. 7
  78. };
  79. /* Split-VQ innovation parameters for very low bit-rate narrowband */
  80. static const split_cb_params split_cb_nb_vlbr = {
  81. 10, /*subvect_size*/
  82. 4, /*nb_subvect*/
  83. exc_10_16_table, /*shape_cb*/
  84. 4, /*shape_bits*/
  85. 0,
  86. };
  87. /* Split-VQ innovation parameters for very low bit-rate narrowband */
  88. static const split_cb_params split_cb_nb_ulbr = {
  89. 20, /*subvect_size*/
  90. 2, /*nb_subvect*/
  91. exc_20_32_table, /*shape_cb*/
  92. 5, /*shape_bits*/
  93. 0,
  94. };
  95. /* Split-VQ innovation parameters for low bit-rate narrowband */
  96. static const split_cb_params split_cb_nb_lbr = {
  97. 10, /*subvect_size*/
  98. 4, /*nb_subvect*/
  99. exc_10_32_table, /*shape_cb*/
  100. 5, /*shape_bits*/
  101. 0,
  102. };
  103. /* Split-VQ innovation parameters narrowband */
  104. static const split_cb_params split_cb_nb = {
  105. 5, /*subvect_size*/
  106. 8, /*nb_subvect*/
  107. exc_5_64_table, /*shape_cb*/
  108. 6, /*shape_bits*/
  109. 0,
  110. };
  111. /* Split-VQ innovation parameters narrowband */
  112. static const split_cb_params split_cb_nb_med = {
  113. 8, /*subvect_size*/
  114. 5, /*nb_subvect*/
  115. exc_8_128_table, /*shape_cb*/
  116. 7, /*shape_bits*/
  117. 0,
  118. };
  119. /* Split-VQ innovation for low-band wideband */
  120. static const split_cb_params split_cb_sb = {
  121. 5, /*subvect_size*/
  122. 8, /*nb_subvect*/
  123. exc_5_256_table, /*shape_cb*/
  124. 8, /*shape_bits*/
  125. 0,
  126. };
  127. #ifndef DISABLE_WIDEBAND
  128. /* Split-VQ innovation for high-band wideband */
  129. static const split_cb_params split_cb_high = {
  130. 8, /*subvect_size*/
  131. 5, /*nb_subvect*/
  132. hexc_table, /*shape_cb*/
  133. 7, /*shape_bits*/
  134. 1,
  135. };
  136. /* Split-VQ innovation for high-band wideband */
  137. static const split_cb_params split_cb_high_lbr = {
  138. 10, /*subvect_size*/
  139. 4, /*nb_subvect*/
  140. hexc_10_32_table, /*shape_cb*/
  141. 5, /*shape_bits*/
  142. 0,
  143. };
  144. #endif
  145. /* 2150 bps "vocoder-like" mode for comfort noise */
  146. static const SpeexSubmode nb_submode1 = {
  147. 0,
  148. 1,
  149. 0,
  150. 0,
  151. /* LSP quantization */
  152. lsp_quant_lbr,
  153. lsp_unquant_lbr,
  154. /* No pitch quantization */
  155. forced_pitch_quant,
  156. forced_pitch_unquant,
  157. NULL,
  158. /* No innovation quantization (noise only) */
  159. noise_codebook_quant,
  160. noise_codebook_unquant,
  161. NULL,
  162. #ifdef FIXED_POINT
  163. 22938, 22938, 0, -1,
  164. #else
  165. .7, .7, 0, -1,
  166. #endif
  167. 43
  168. };
  169. /* 3.95 kbps very low bit-rate mode */
  170. static const SpeexSubmode nb_submode8 = {
  171. 0,
  172. 1,
  173. 0,
  174. 0,
  175. /*LSP quantization*/
  176. lsp_quant_lbr,
  177. lsp_unquant_lbr,
  178. /*No pitch quantization*/
  179. forced_pitch_quant,
  180. forced_pitch_unquant,
  181. NULL,
  182. /*Innovation quantization*/
  183. split_cb_search_shape_sign,
  184. split_cb_shape_sign_unquant,
  185. &split_cb_nb_ulbr,
  186. #ifdef FIXED_POINT
  187. 22938, 16384, 11796, 21299,
  188. #else
  189. 0.7, 0.5, .36, .65,
  190. #endif
  191. 79
  192. };
  193. /* 5.95 kbps very low bit-rate mode */
  194. static const SpeexSubmode nb_submode2 = {
  195. 0,
  196. 0,
  197. 0,
  198. 0,
  199. /*LSP quantization*/
  200. lsp_quant_lbr,
  201. lsp_unquant_lbr,
  202. /*No pitch quantization*/
  203. pitch_search_3tap,
  204. pitch_unquant_3tap,
  205. &ltp_params_vlbr,
  206. /*Innovation quantization*/
  207. split_cb_search_shape_sign,
  208. split_cb_shape_sign_unquant,
  209. &split_cb_nb_vlbr,
  210. #ifdef FIXED_POINT
  211. 22938, 16384, 11796, 18022,
  212. #else
  213. 0.7, 0.5, .36, .55,
  214. #endif
  215. 119
  216. };
  217. /* 8 kbps low bit-rate mode */
  218. static const SpeexSubmode nb_submode3 = {
  219. -1,
  220. 0,
  221. 1,
  222. 0,
  223. /*LSP quantization*/
  224. lsp_quant_lbr,
  225. lsp_unquant_lbr,
  226. /*Pitch quantization*/
  227. pitch_search_3tap,
  228. pitch_unquant_3tap,
  229. &ltp_params_lbr,
  230. /*Innovation quantization*/
  231. split_cb_search_shape_sign,
  232. split_cb_shape_sign_unquant,
  233. &split_cb_nb_lbr,
  234. #ifdef FIXED_POINT
  235. 22938, 18022, 9830, 14746,
  236. #else
  237. 0.7, 0.55, .30, .45,
  238. #endif
  239. 160
  240. };
  241. /* 11 kbps medium bit-rate mode */
  242. static const SpeexSubmode nb_submode4 = {
  243. -1,
  244. 0,
  245. 1,
  246. 0,
  247. /*LSP quantization*/
  248. lsp_quant_lbr,
  249. lsp_unquant_lbr,
  250. /*Pitch quantization*/
  251. pitch_search_3tap,
  252. pitch_unquant_3tap,
  253. &ltp_params_med,
  254. /*Innovation quantization*/
  255. split_cb_search_shape_sign,
  256. split_cb_shape_sign_unquant,
  257. &split_cb_nb_med,
  258. #ifdef FIXED_POINT
  259. 22938, 20644, 5243, 11469,
  260. #else
  261. 0.7, 0.63, .16, .35,
  262. #endif
  263. 220
  264. };
  265. /* 15 kbps high bit-rate mode */
  266. static const SpeexSubmode nb_submode5 = {
  267. -1,
  268. 0,
  269. 3,
  270. 0,
  271. /*LSP quantization*/
  272. lsp_quant_nb,
  273. lsp_unquant_nb,
  274. /*Pitch quantization*/
  275. pitch_search_3tap,
  276. pitch_unquant_3tap,
  277. &ltp_params_nb,
  278. /*Innovation quantization*/
  279. split_cb_search_shape_sign,
  280. split_cb_shape_sign_unquant,
  281. &split_cb_nb,
  282. #ifdef FIXED_POINT
  283. 22938, 21299, 3932, 8192,
  284. #else
  285. 0.7, 0.65, .12, .25,
  286. #endif
  287. 300
  288. };
  289. /* 18.2 high bit-rate mode */
  290. static const SpeexSubmode nb_submode6 = {
  291. -1,
  292. 0,
  293. 3,
  294. 0,
  295. /*LSP quantization*/
  296. lsp_quant_nb,
  297. lsp_unquant_nb,
  298. /*Pitch quantization*/
  299. pitch_search_3tap,
  300. pitch_unquant_3tap,
  301. &ltp_params_nb,
  302. /*Innovation quantization*/
  303. split_cb_search_shape_sign,
  304. split_cb_shape_sign_unquant,
  305. &split_cb_sb,
  306. #ifdef FIXED_POINT
  307. 22282, 21299, 2294, 3277,
  308. #else
  309. 0.68, 0.65, .07, .1,
  310. #endif
  311. 364
  312. };
  313. /* 24.6 kbps high bit-rate mode */
  314. static const SpeexSubmode nb_submode7 = {
  315. -1,
  316. 0,
  317. 3,
  318. 1,
  319. /*LSP quantization*/
  320. lsp_quant_nb,
  321. lsp_unquant_nb,
  322. /*Pitch quantization*/
  323. pitch_search_3tap,
  324. pitch_unquant_3tap,
  325. &ltp_params_nb,
  326. /*Innovation quantization*/
  327. split_cb_search_shape_sign,
  328. split_cb_shape_sign_unquant,
  329. &split_cb_nb,
  330. #ifdef FIXED_POINT
  331. 21299, 21299, 0, -1,
  332. #else
  333. 0.65, 0.65, .0, -1,
  334. #endif
  335. 492
  336. };
  337. /* Default mode for narrowband */
  338. static const SpeexNBMode nb_mode = {
  339. 160, /*frameSize*/
  340. 40, /*subframeSize*/
  341. 10, /*lpcSize*/
  342. 17, /*pitchStart*/
  343. 144, /*pitchEnd*/
  344. #ifdef FIXED_POINT
  345. 29491, 19661, /* gamma1, gamma2 */
  346. #else
  347. 0.9, 0.6, /* gamma1, gamma2 */
  348. #endif
  349. .012, /*lag_factor*/
  350. QCONST16(.0002,15), /*lpc_floor*/
  351. #ifdef EPIC_48K
  352. 0,
  353. #endif
  354. {NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
  355. &nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
  356. 5,
  357. {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}
  358. };
  359. /* Default mode for narrowband */
  360. const SpeexMode speex_nb_mode = {
  361. &nb_mode,
  362. nb_mode_query,
  363. "narrowband",
  364. 0,
  365. 4,
  366. &nb_encoder_init,
  367. &nb_encoder_destroy,
  368. &nb_encode,
  369. &nb_decoder_init,
  370. &nb_decoder_destroy,
  371. &nb_decode,
  372. &nb_encoder_ctl,
  373. &nb_decoder_ctl,
  374. };
  375. /* Wideband part */
  376. static const SpeexSubmode wb_submode1 = {
  377. 0,
  378. 0,
  379. 1,
  380. 0,
  381. /*LSP quantization*/
  382. lsp_quant_high,
  383. lsp_unquant_high,
  384. /*Pitch quantization*/
  385. NULL,
  386. NULL,
  387. NULL,
  388. /*No innovation quantization*/
  389. NULL,
  390. NULL,
  391. NULL,
  392. #ifdef FIXED_POINT
  393. 24576, 24576, 0, -1,
  394. #else
  395. .75, .75, .0, -1,
  396. #endif
  397. 36
  398. };
  399. static const SpeexSubmode wb_submode2 = {
  400. 0,
  401. 0,
  402. 1,
  403. 0,
  404. /*LSP quantization*/
  405. lsp_quant_high,
  406. lsp_unquant_high,
  407. /*Pitch quantization*/
  408. NULL,
  409. NULL,
  410. NULL,
  411. /*Innovation quantization*/
  412. split_cb_search_shape_sign,
  413. split_cb_shape_sign_unquant,
  414. #ifdef DISABLE_WIDEBAND
  415. NULL,
  416. #else
  417. &split_cb_high_lbr,
  418. #endif
  419. #ifdef FIXED_POINT
  420. 27853, 19661, 8192, -1,
  421. #else
  422. .85, .6, .25, -1,
  423. #endif
  424. 112
  425. };
  426. static const SpeexSubmode wb_submode3 = {
  427. 0,
  428. 0,
  429. 1,
  430. 0,
  431. /*LSP quantization*/
  432. lsp_quant_high,
  433. lsp_unquant_high,
  434. /*Pitch quantization*/
  435. NULL,
  436. NULL,
  437. NULL,
  438. /*Innovation quantization*/
  439. split_cb_search_shape_sign,
  440. split_cb_shape_sign_unquant,
  441. #ifdef DISABLE_WIDEBAND
  442. NULL,
  443. #else
  444. &split_cb_high,
  445. #endif
  446. #ifdef FIXED_POINT
  447. 24576, 22938, 1638, -1,
  448. #else
  449. .75, .7, .05, -1,
  450. #endif
  451. 192
  452. };
  453. static const SpeexSubmode wb_submode4 = {
  454. 0,
  455. 0,
  456. 1,
  457. 1,
  458. /*LSP quantization*/
  459. lsp_quant_high,
  460. lsp_unquant_high,
  461. /*Pitch quantization*/
  462. NULL,
  463. NULL,
  464. NULL,
  465. /*Innovation quantization*/
  466. split_cb_search_shape_sign,
  467. split_cb_shape_sign_unquant,
  468. #ifdef DISABLE_WIDEBAND
  469. NULL,
  470. #else
  471. &split_cb_high,
  472. #endif
  473. #ifdef FIXED_POINT
  474. 24576, 24576, 0, -1,
  475. #else
  476. .75, .75, .0, -1,
  477. #endif
  478. 352
  479. };
  480. /* Split-band wideband CELP mode*/
  481. static const SpeexSBMode sb_wb_mode = {
  482. &speex_nb_mode,
  483. 160, /*frameSize*/
  484. 40, /*subframeSize*/
  485. 8, /*lpcSize*/
  486. 640, /*bufSize*/
  487. #ifdef FIXED_POINT
  488. 29491, 19661, /* gamma1, gamma2 */
  489. #else
  490. 0.9, 0.6, /* gamma1, gamma2 */
  491. #endif
  492. .001, /*lag_factor*/
  493. QCONST16(.0001,15), /*lpc_floor*/
  494. 0.9,
  495. {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
  496. 3,
  497. {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
  498. {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4},
  499. vbr_hb_thresh,
  500. 5
  501. };
  502. const SpeexMode speex_wb_mode = {
  503. &sb_wb_mode,
  504. wb_mode_query,
  505. "wideband (sub-band CELP)",
  506. 1,
  507. 4,
  508. &sb_encoder_init,
  509. &sb_encoder_destroy,
  510. &sb_encode,
  511. &sb_decoder_init,
  512. &sb_decoder_destroy,
  513. &sb_decode,
  514. &sb_encoder_ctl,
  515. &sb_decoder_ctl,
  516. };
  517. /* "Ultra-wideband" mode stuff */
  518. /* Split-band "ultra-wideband" (32 kbps) CELP mode*/
  519. static const SpeexSBMode sb_uwb_mode = {
  520. &speex_wb_mode,
  521. 320, /*frameSize*/
  522. 80, /*subframeSize*/
  523. 8, /*lpcSize*/
  524. 1280, /*bufSize*/
  525. #ifdef FIXED_POINT
  526. 29491, 19661, /* gamma1, gamma2 */
  527. #else
  528. 0.9, 0.6, /* gamma1, gamma2 */
  529. #endif
  530. .002, /*lag_factor*/
  531. QCONST16(.0001,15), /*lpc_floor*/
  532. 0.7,
  533. {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
  534. 1,
  535. {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
  536. {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  537. vbr_uhb_thresh,
  538. 2
  539. };
  540. const SpeexMode speex_uwb_mode = {
  541. &sb_uwb_mode,
  542. wb_mode_query,
  543. "ultra-wideband (sub-band CELP)",
  544. 2,
  545. 4,
  546. &sb_encoder_init,
  547. &sb_encoder_destroy,
  548. &sb_encode,
  549. &sb_decoder_init,
  550. &sb_decoder_destroy,
  551. &sb_decode,
  552. &sb_encoder_ctl,
  553. &sb_decoder_ctl,
  554. };
  555. #ifdef EPIC_48K
  556. extern const signed char gain_cdbk_ulbr[];
  557. extern const signed char exc_12_32_table[];
  558. /* Parameters for Long-Term Prediction (LTP)*/
  559. static const ltp_params ltp_params_48k = {
  560. gain_cdbk_ulbr,
  561. 3,
  562. 0
  563. };
  564. static const split_cb_params split_cb_nb_48k = {
  565. 12, /*subvect_size*/
  566. 4, /*nb_subvect*/
  567. exc_12_32_table, /*shape_cb*/
  568. 5, /*shape_bits*/
  569. 0,
  570. };
  571. /* 4.8 kbps very low bit-rate mode */
  572. static const SpeexSubmode nb_48k_submode = {
  573. 0,
  574. 0,
  575. 0,
  576. 0,
  577. /*LSP quantization*/
  578. lsp_quant_48k,
  579. lsp_unquant_48k,
  580. /*No pitch quantization*/
  581. pitch_search_3tap,
  582. pitch_unquant_3tap,
  583. &ltp_params_48k,
  584. /*Innovation quantization*/
  585. split_cb_search_shape_sign,
  586. split_cb_shape_sign_unquant,
  587. &split_cb_nb_48k,
  588. #ifdef FIXED_POINT
  589. 22938, 16384, 11796, 18022,
  590. #else
  591. 0.7, 0.5, .36, .55,
  592. #endif
  593. 144
  594. };
  595. /* Special, non-standard 4.8 kbps mode */
  596. static const SpeexNBMode nb_48k_mode = {
  597. 240, /*frameSize*/
  598. 48, /*subframeSize*/
  599. 10, /*lpcSize*/
  600. 640, /*bufSize*/
  601. 17, /*pitchStart*/
  602. 144, /*pitchEnd*/
  603. 0.9, /*gamma1*/
  604. 0.6, /*gamma2*/
  605. .01, /*lag_factor*/
  606. QCONST16(.0003,15), /*lpc_floor*/
  607. 1,
  608. {NULL, NULL, &nb_48k_submode, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
  609. 2,
  610. {2,2,2,2,2,2,2,2,2,2,2}
  611. };
  612. /* Default mode for narrowband */
  613. const SpeexMode speex_nb_48k_mode = {
  614. &nb_48k_mode,
  615. nb_mode_query,
  616. "narrowband 4.8 kbps",
  617. 1000,
  618. 4,
  619. &nb_encoder_init,
  620. &nb_encoder_destroy,
  621. &nb_encode,
  622. &nb_decoder_init,
  623. &nb_decoder_destroy,
  624. &nb_decode,
  625. &nb_encoder_ctl,
  626. &nb_decoder_ctl,
  627. };
  628. #endif
  629. int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
  630. {
  631. return mode->query(mode->mode, request, ptr);
  632. }
  633. const SpeexMode * speex_lib_get_mode (int mode)
  634. {
  635. #ifdef EPIC_48K
  636. if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;
  637. #endif
  638. if (mode < 0 || mode > SPEEX_NB_MODES) return NULL;
  639. return speex_mode_list[mode];
  640. }
粤ICP备19079148号