profile_tm.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. /* Copyright (C) 2007 Hong Zhiqian */
  2. /**
  3. @file profile_tm.h
  4. @author Hong Zhiqian
  5. @brief Various compatibility routines for Speex (TriMedia version)
  6. */
  7. /*
  8. Redistribution and use in source and binary forms, with or without
  9. modification, are permitted provided that the following conditions
  10. are met:
  11. - Redistributions of source code must retain the above copyright
  12. notice, this list of conditions and the following disclaimer.
  13. - Redistributions in binary form must reproduce the above copyright
  14. notice, this list of conditions and the following disclaimer in the
  15. documentation and/or other materials provided with the distribution.
  16. - Neither the name of the Xiph.org Foundation nor the names of its
  17. contributors may be used to endorse or promote products derived from
  18. this software without specific prior written permission.
  19. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
  23. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  24. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  25. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  26. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  27. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  28. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  29. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. /**
  32. * @remarks This file provide some capabilities to measure clock cycles.
  33. * Use this if unable to compile with TriMedia profile options
  34. */
  35. extern int __profile_begin;
  36. extern int __profile_end;
  37. #if TM_PROFILE
  38. #define PROFILE_START() \
  39. { \
  40. __profile_begin = cycles(); \
  41. } \
  42. #define PROFILE_STOP() \
  43. { \
  44. __profile_end = cycles(); \
  45. printf("%s\t%d\n", __FUNCTION__, end - begin); \
  46. } \
  47. #else
  48. #define PROFILE_START()
  49. #define PROFILE_STOP()
  50. #endif
  51. #if TM_PROFILE_SPXAUTOCORR
  52. #define _SPX_AUTOCORR_START() PROFILE_START()
  53. #define _SPX_AUTOCORR_STOP() PROFILE_STOP()
  54. #else
  55. #define _SPX_AUTOCORR_START()
  56. #define _SPX_AUTOCORR_STOP()
  57. #endif
  58. #if TM_PROFILE_INNERPROD
  59. #define INNERPROD_START() PROFILE_START()
  60. #define INNERPROD_STOP() PROFILE_STOP()
  61. #else
  62. #define INNERPROD_START()
  63. #define INNERPROD_STOP()
  64. #endif
  65. #if TM_PROFILE_PITCHXCORR
  66. #define PITCHXCORR_START() PROFILE_START()
  67. #define PITCHXCORR_STOP() PROFILE_STOP()
  68. #else
  69. #define PITCHXCORR_START()
  70. #define PITCHXCORR_STOP()
  71. #endif
  72. #if TM_PROFILE_COMPUTEPITCHERROR
  73. #define COMPUTEPITCHERROR_START() PROFILE_START()
  74. #define COMPUTEPITCHERROR_STOP() PROFILE_STOP()
  75. #else
  76. #define COMPUTEPITCHERROR_START()
  77. #define COMPUTEPITCHERROR_STOP()
  78. #endif
  79. #if TM_PROFILE_PITCHGAINSEARCH3TAPVQ
  80. #define PITCHGAINSEARCH3TAPVQ_START() PROFILE_START()
  81. #define PITCHGAINSEARCH3TAPVQ_STOP() PROFILE_STOP()
  82. #else
  83. #define PITCHGAINSEARCH3TAPVQ_START()
  84. #define PITCHGAINSEARCH3TAPVQ_STOP()
  85. #endif
  86. #if TM_PROFILE_OPENLOOPNBESTPITCH
  87. #define OPENLOOPNBESTPITCH_START() PROFILE_START()
  88. #define OPENLOOPNBESTPITCH_STOP() PROFILE_STOP()
  89. #else
  90. #define OPENLOOPNBESTPITCH_START()
  91. #define OPENLOOPNBESTPITCH_STOP()
  92. #endif
  93. #if TM_PROFILE_LSP_INTERPOLATE
  94. #define LSPINTERPOLATE_START() PROFILE_START()
  95. #define LSPINTERPOLATE_STOP() PROFILE_STOP()
  96. #else
  97. #define LSPINTERPOLATE_START()
  98. #define LSPINTERPOLATE_STOP()
  99. #endif
  100. #if TM_PROFILE_CHEBPOLYEVA
  101. #define CHEBPOLYEVA_START() PROFILE_START()
  102. #define CHEBPOLYEVA_STOP() PROFILE_STOP()
  103. #else
  104. #define CHEBPOLYEVA_START()
  105. #define CHEBPOLYEVA_STOP()
  106. #endif
  107. #if TM_PROFILE_COMPUTEQUANTWEIGHTS
  108. #define COMPUTEQUANTWEIGHTS_START() PROFILE_START()
  109. #define COMPUTEQUANTWEIGHTS_STOP() PROFILE_STOP()
  110. #else
  111. #define COMPUTEQUANTWEIGHTS_START()
  112. #define COMPUTEQUANTWEIGHTS_STOP()
  113. #endif
  114. #if TM_PROFILE_LSPQUANT
  115. #define LSPQUANT_START() PROFILE_START()
  116. #define LSPQUANT_STOP() PROFILE_STOP()
  117. #else
  118. #define LSPQUANT_START()
  119. #define LSPQUANT_STOP()
  120. #endif
  121. #if TM_PROFILE_LSPWEIGHTQUANT
  122. #define LSPWEIGHTQUANT_START() PROFILE_START()
  123. #define LSPWEIGHTQUANT_STOP() PROFILE_STOP()
  124. #else
  125. #define LSPWEIGHTQUANT_START()
  126. #define LSPWEIGHTQUANT_STOP()
  127. #endif
  128. #if TM_PROFILE_FIRMEM16
  129. #define FIRMEM16_START() PROFILE_START()
  130. #define FIRMEM16_STOP() PROFILE_STOP()
  131. #else
  132. #define FIRMEM16_START()
  133. #define FIRMEM16_STOP()
  134. #endif
  135. #if TM_PROFILE_IIRMEM16
  136. #define IIRMEM16_START() PROFILE_START()
  137. #define IIRMEM16_STOP() PROFILE_STOP()
  138. #else
  139. #define IIRMEM16_START()
  140. #define IIRMEM16_STOP()
  141. #endif
  142. #if TM_PROFILE_FILTERMEM16
  143. #define FILTERMEM16_START() PROFILE_START()
  144. #define FILTERMEM16_STOP() PROFILE_STOP()
  145. #else
  146. #define FILTERMEM16_START()
  147. #define FILTERMEM16_STOP()
  148. #endif
  149. #if TM_PROFILE_COMPUTERMS16
  150. #define COMPUTERMS16_START() PROFILE_START()
  151. #define COMPUTERMS16_STOP() PROFILE_STOP()
  152. #else
  153. #define COMPUTERMS16_START()
  154. #define COMPUTERMS16_STOP()
  155. #endif
  156. #if TM_PROFILE_NORMALIZE16
  157. #define NORMALIZE16_START() PROFILE_START()
  158. #define NORMALIZE16_STOP() PROFILE_STOP()
  159. #else
  160. #define NORMALIZE16_START()
  161. #define NORMALIZE16_STOP()
  162. #endif
  163. #if TM_PROFILE_BWLPC
  164. #define BWLPC_START() PROFILE_START()
  165. #define BWLPC_STOP() PROFILE_STOP()
  166. #else
  167. #define BWLPC_START()
  168. #define BWLPC_STOP()
  169. #endif
  170. #if TM_PROFILE_HIGHPASS
  171. #define HIGHPASS_START() PROFILE_START()
  172. #define HIGHPASS_STOP() PROFILE_STOP()
  173. #else
  174. #define HIGHPASS_START()
  175. #define HIGHPASS_STOP()
  176. #endif
  177. #if TM_PROFILE_SIGNALMUL
  178. #define SIGNALMUL_START() PROFILE_START()
  179. #define SIGNALMUL_STOP() PROFILE_STOP()
  180. #else
  181. #define SIGNALMUL_START()
  182. #define SIGNALMUL_STOP()
  183. #endif
  184. #if TM_PROFILE_SIGNALDIV
  185. #define SIGNALDIV_START() PROFILE_START()
  186. #define SIGNALDIV_STOP() PROFILE_STOP()
  187. #else
  188. #define SIGNALDIV_START()
  189. #define SIGNALDIV_STOP()
  190. #endif
  191. #if TM_PROFILE_COMPUTEIMPULSERESPONSE
  192. #define COMPUTEIMPULSERESPONSE_START() PROFILE_START()
  193. #define COMPUTEIMPULSERESPONSE_STOP() PROFILE_STOP()
  194. #else
  195. #define COMPUTEIMPULSERESPONSE_START()
  196. #define COMPUTEIMPULSERESPONSE_STOP()
  197. #endif
  198. #if TM_PROFILE_COMPUTEWEIGHTEDCODEBOOK
  199. #define COMPUTEWEIGHTEDCODEBOOK_START() PROFILE_START()
  200. #define COMPUTEWEIGHTEDCODEBOOK_STOP() PROFILE_STOP()
  201. #else
  202. #define COMPUTEWEIGHTEDCODEBOOK_START()
  203. #define COMPUTEWEIGHTEDCODEBOOK_STOP()
  204. #endif
  205. #if TM_PROFILE_TARGETUPDATE
  206. #define TARGETUPDATE_START() PROFILE_START()
  207. #define TARGETUPDATE_STOP() PROFILE_STOP()
  208. #else
  209. #define TARGETUPDATE_START()
  210. #define TARGETUPDATE_STOP()
  211. #endif
  212. #if TM_PROFILE_VQNBEST
  213. #define VQNBEST_START() PROFILE_START()
  214. #define VQNBEST_STOP() PROFILE_STOP()
  215. #else
  216. #define VQNBEST_START()
  217. #define VQNBEST_STOP()
  218. #endif
  219. #if TM_PROFILE_VQNBESTSIGN
  220. #define VQNBESTSIGN_START() PROFILE_START()
  221. #define VQNBESTSIGN_STOP() PROFILE_STOP()
  222. #else
  223. #define VQNBESTSIGN_START()
  224. #define VQNBESTSIGN_STOP()
  225. #endif
  226. #if TM_PROFILE_PREPROCESSANALYSIS
  227. #define PREPROCESSANAYLSIS_START() PROFILE_START()
  228. #define PREPROCESSANAYLSIS_STOP() PROFILE_STOP()
  229. #else
  230. #define PREPROCESSANAYLSIS_START()
  231. #define PREPROCESSANAYLSIS_STOP()
  232. #endif
  233. #if TM_PROFILE_UPDATENOISEPROB
  234. #define UPDATENOISEPROB_START() PROFILE_START()
  235. #define UPDATENOISEPROB_STOP() PROFILE_STOP()
  236. #else
  237. #define UPDATENOISEPROB_START()
  238. #define UPDATENOISEPROB_STOP()
  239. #endif
  240. #if TM_PROFILE_COMPUTEGAINFLOOR
  241. #define COMPUTEGAINFLOOR_START() PROFILE_START()
  242. #define COMPUTEGAINFLOOR_STOP() PROFILE_STOP()
  243. #else
  244. #define COMPUTEGAINFLOOR_START()
  245. #define COMPUTEGAINFLOOR_STOP()
  246. #endif
  247. #if TM_PROFILE_FILTERDCNOTCH16
  248. #define FILTERDCNOTCH16_START() PROFILE_START()
  249. #define FILTERDCNOTCH16_STOP() PROFILE_STOP()
  250. #else
  251. #define FILTERDCNOTCH16_START()
  252. #define FILTERDCNOTCH16_STOP()
  253. #endif
  254. #if TM_PROFILE_MDFINNERPROD
  255. #define MDFINNERPROD_START() PROFILE_START()
  256. #define MDFINNERPROD_STOP() PROFILE_STOP()
  257. #else
  258. #define MDFINNERPROD_START()
  259. #define MDFINNERPROD_STOP()
  260. #endif
  261. #if TM_PROFILE_SPECTRALMULACCUM
  262. #define SPECTRALMULACCUM_START() PROFILE_START()
  263. #define SPECTRALMULACCUM_STOP() PROFILE_STOP()
  264. #else
  265. #define SPECTRALMULACCUM_START()
  266. #define SPECTRALMULACCUM_STOP()
  267. #endif
  268. #if TM_PROFILE_WEIGHTEDSPECTRALMULCONJ
  269. #define WEIGHTEDSPECTRALMULCONJ_START() PROFILE_START()
  270. #define WEIGHTEDSPECTRALMULCONJ_STOP() PROFILE_STOP()
  271. #else
  272. #define WEIGHTEDSPECTRALMULCONJ_START()
  273. #define WEIGHTEDSPECTRALMULCONJ_STOP()
  274. #endif
  275. #if TM_PROFILE_MDFADJUSTPROP
  276. #define MDFADJUSTPROP_START() PROFILE_START()
  277. #define MDFADJUSTPROP_STOP() PROFILE_STOP()
  278. #else
  279. #define MDFADJUSTPROP_START()
  280. #define MDFADJUSTPROP_STOP()
  281. #endif
  282. #if TM_PROFILE_SPEEXECHOGETRESIDUAL
  283. #define SPEEXECHOGETRESIDUAL_START() PROFILE_START()
  284. #define SPEEXECHOGETRESIDUAL_STOP() PROFILE_STOP()
  285. #else
  286. #define SPEEXECHOGETRESIDUAL_START()
  287. #define SPEEXECHOGETRESIDUAL_STOP()
  288. #endif
  289. #if TM_PROFILE_LSPENFORCEMARGIN
  290. #define LSPENFORCEMARGIN_START() PROFILE_START()
  291. #define LSPENFORCEMARGIN_STOP() PROFILE_STOP()
  292. #else
  293. #define LSPENFORCEMARGIN_START()
  294. #define LSPENFORCEMARGIN_STOP()
  295. #endif
  296. #if TM_PROFILE_LSPTOLPC
  297. #define LSPTOLPC_START() PROFILE_START()
  298. #define LSPTOLPC_STOP() PROFILE_STOP()
  299. #else
  300. #define LSPTOLPC_START()
  301. #define LSPTOLPC_STOP()
  302. #endif
  303. #if TM_PROFILE_MAXIMIZERANGE
  304. #define MAXIMIZERANGE_START() PROFILE_START()
  305. #define MAXIMIZERANGE_STOP() PROFILE_STOP()
  306. #else
  307. #define MAXIMIZERANGE_START()
  308. #define MAXIMIZERANGE_STOP()
  309. #endif
  310. #if TM_PROFILE_RENORMRANGE
  311. #define RENORMRANGE_START() PROFILE_START()
  312. #define RENORMRANGE_STOP() PROFILE_STOP()
  313. #else
  314. #define RENORMRANGE_START()
  315. #define RENORMRANGE_STOP()
  316. #endif
  317. #if TM_PROFILE_POWERSPECTRUM
  318. #define POWERSPECTRUM_START() PROFILE_START()
  319. #define POWERSPECTRUM_STOP() PROFILE_STOP()
  320. #else
  321. #define POWERSPECTRUM_START()
  322. #define POWERSPECTRUM_STOP()
  323. #endif
  324. #if TM_PROFILE_QMFSYNTH
  325. #define QMFSYNTH_START() PROFILE_START()
  326. #define QMFSYNTH_STOP() PROFILE_STOP()
  327. #else
  328. #define QMFSYNTH_START()
  329. #define QMFSYNTH_STOP()
  330. #endif
  331. #if TM_PROFILE_QMFDECOMP
  332. #define QMFDECOMP_START() PROFILE_START()
  333. #define QMFDECOMP_STOP() PROFILE_STOP()
  334. #else
  335. #define QMFDECOMP_START()
  336. #define QMFDECOMP_STOP()
  337. #endif
  338. #if TM_PROFILE_FILTERBANKCOMPUTEBANK32
  339. #define FILTERBANKCOMPUTEBANK32_START() PROFILE_START()
  340. #define FILTERBANKCOMPUTEBANK32_STOP() PROFILE_STOP()
  341. #else
  342. #define FILTERBANKCOMPUTEBANK32_START()
  343. #define FILTERBANKCOMPUTEBANK32_STOP()
  344. #endif
  345. #if TM_PROFILE_FILTERBANKCOMPUTEPSD16
  346. #define FILTERBANKCOMPUTEPSD16_START() PROFILE_START()
  347. #define FILTERBANKCOMPUTEPSD16_STOP() PROFILE_STOP()
  348. #else
  349. #define FILTERBANKCOMPUTEPSD16_START()
  350. #define FILTERBANKCOMPUTEPSD16_STOP()
  351. #endif