genericStds.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. /* -----------------------------------------------------------------------------
  2. Software License for The Fraunhofer FDK AAC Codec Library for Android
  3. © Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
  4. Forschung e.V. All rights reserved.
  5. 1. INTRODUCTION
  6. The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
  7. that implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
  8. scheme for digital audio. This FDK AAC Codec software is intended to be used on
  9. a wide variety of Android devices.
  10. AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
  11. general perceptual audio codecs. AAC-ELD is considered the best-performing
  12. full-bandwidth communications codec by independent studies and is widely
  13. deployed. AAC has been standardized by ISO and IEC as part of the MPEG
  14. specifications.
  15. Patent licenses for necessary patent claims for the FDK AAC Codec (including
  16. those of Fraunhofer) may be obtained through Via Licensing
  17. (www.vialicensing.com) or through the respective patent owners individually for
  18. the purpose of encoding or decoding bit streams in products that are compliant
  19. with the ISO/IEC MPEG audio standards. Please note that most manufacturers of
  20. Android devices already license these patent claims through Via Licensing or
  21. directly from the patent owners, and therefore FDK AAC Codec software may
  22. already be covered under those patent licenses when it is used for those
  23. licensed purposes only.
  24. Commercially-licensed AAC software libraries, including floating-point versions
  25. with enhanced sound quality, are also available from Fraunhofer. Users are
  26. encouraged to check the Fraunhofer website for additional applications
  27. information and documentation.
  28. 2. COPYRIGHT LICENSE
  29. Redistribution and use in source and binary forms, with or without modification,
  30. are permitted without payment of copyright license fees provided that you
  31. satisfy the following conditions:
  32. You must retain the complete text of this software license in redistributions of
  33. the FDK AAC Codec or your modifications thereto in source code form.
  34. You must retain the complete text of this software license in the documentation
  35. and/or other materials provided with redistributions of the FDK AAC Codec or
  36. your modifications thereto in binary form. You must make available free of
  37. charge copies of the complete source code of the FDK AAC Codec and your
  38. modifications thereto to recipients of copies in binary form.
  39. The name of Fraunhofer may not be used to endorse or promote products derived
  40. from this library without prior written permission.
  41. You may not charge copyright license fees for anyone to use, copy or distribute
  42. the FDK AAC Codec software or your modifications thereto.
  43. Your modified versions of the FDK AAC Codec must carry prominent notices stating
  44. that you changed the software and the date of any change. For modified versions
  45. of the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
  46. must be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
  47. AAC Codec Library for Android."
  48. 3. NO PATENT LICENSE
  49. NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
  50. limitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
  51. Fraunhofer provides no warranty of patent non-infringement with respect to this
  52. software.
  53. You may use this FDK AAC Codec software or modifications thereto only for
  54. purposes that are authorized by appropriate patent licenses.
  55. 4. DISCLAIMER
  56. This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
  57. holders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
  58. including but not limited to the implied warranties of merchantability and
  59. fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  60. CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
  61. or consequential damages, including but not limited to procurement of substitute
  62. goods or services; loss of use, data, or profits, or business interruption,
  63. however caused and on any theory of liability, whether in contract, strict
  64. liability, or tort (including negligence), arising in any way out of the use of
  65. this software, even if advised of the possibility of such damage.
  66. 5. CONTACT INFORMATION
  67. Fraunhofer Institute for Integrated Circuits IIS
  68. Attention: Audio and Multimedia Departments - FDK AAC LL
  69. Am Wolfsmantel 33
  70. 91058 Erlangen, Germany
  71. www.iis.fraunhofer.de/amm
  72. amm-info@iis.fraunhofer.de
  73. ----------------------------------------------------------------------------- */
  74. /************************* System integration library **************************
  75. Author(s):
  76. Description:
  77. *******************************************************************************/
  78. /** \file genericStds.h
  79. \brief Generic Run-Time Support function wrappers and heap allocation
  80. monitoring.
  81. */
  82. #if !defined(GENERICSTDS_H)
  83. #define GENERICSTDS_H
  84. #include "machine_type.h"
  85. #ifndef M_PI
  86. #define M_PI 3.14159265358979323846 /*!< Pi. Only used in example projects. */
  87. #endif
  88. /**
  89. * Identifiers for various memory locations. They are used along with memory
  90. * allocation functions like FDKcalloc_L() to specify the requested memory's
  91. * location.
  92. */
  93. typedef enum {
  94. /* Internal */
  95. SECT_DATA_L1 = 0x2000,
  96. SECT_DATA_L2,
  97. SECT_DATA_L1_A,
  98. SECT_DATA_L1_B,
  99. SECT_CONSTDATA_L1,
  100. /* External */
  101. SECT_DATA_EXTERN = 0x4000,
  102. SECT_CONSTDATA_EXTERN
  103. } MEMORY_SECTION;
  104. /*! \addtogroup SYSLIB_MEMORY_MACROS FDK memory macros
  105. *
  106. * The \c H_ prefix indicates that the macro is to be used in a header file, the
  107. * \c C_ prefix indicates that the macro is to be used in a source file.
  108. *
  109. * Declaring memory areas requires to specify a unique name and a data type.
  110. *
  111. * For defining a memory area you require additionally one or two sizes,
  112. * depending if the memory should be organized into one or two dimensions.
  113. *
  114. * The macros containing the keyword \c AALLOC instead of \c ALLOC additionally
  115. * take care of returning aligned memory addresses (beyond the natural alignment
  116. * of its type). The preprocesor macro
  117. * ::ALIGNMENT_DEFAULT indicates the aligment to be used (this is hardware
  118. * specific).
  119. *
  120. * The \c _L suffix indicates that the memory will be located in a specific
  121. * section. This is useful to allocate critical memory section into fast
  122. * internal SRAM for example.
  123. *
  124. * @{
  125. */
  126. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  127. #define H_ALLOC_MEM(name, type) \
  128. type *Get##name(int n = 0); \
  129. void Free##name(type **p); \
  130. UINT GetRequiredMem##name(void);
  131. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  132. #define H_ALLOC_MEM_OVERLAY(name, type) \
  133. type *Get##name(int n = 0); \
  134. void Free##name(type **p); \
  135. UINT GetRequiredMem##name(void);
  136. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  137. #define C_ALLOC_MEM(name, type, num) \
  138. type *Get##name(int n) { \
  139. FDK_ASSERT((n) == 0); \
  140. return ((type *)FDKcalloc(num, sizeof(type))); \
  141. } \
  142. void Free##name(type **p) { \
  143. if (p != NULL) { \
  144. FDKfree(*p); \
  145. *p = NULL; \
  146. } \
  147. } \
  148. UINT GetRequiredMem##name(void) { \
  149. return ALGN_SIZE_EXTRES((num) * sizeof(type)); \
  150. }
  151. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  152. #define C_ALLOC_MEM2(name, type, n1, n2) \
  153. type *Get##name(int n) { \
  154. FDK_ASSERT((n) < (n2)); \
  155. return ((type *)FDKcalloc(n1, sizeof(type))); \
  156. } \
  157. void Free##name(type **p) { \
  158. if (p != NULL) { \
  159. FDKfree(*p); \
  160. *p = NULL; \
  161. } \
  162. } \
  163. UINT GetRequiredMem##name(void) { \
  164. return ALGN_SIZE_EXTRES((n1) * sizeof(type)) * (n2); \
  165. }
  166. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  167. #define C_AALLOC_MEM(name, type, num) \
  168. type *Get##name(int n) { \
  169. type *ap; \
  170. FDK_ASSERT((n) == 0); \
  171. ap = ((type *)FDKaalloc((num) * sizeof(type), ALIGNMENT_DEFAULT)); \
  172. return ap; \
  173. } \
  174. void Free##name(type **p) { \
  175. if (p != NULL) { \
  176. FDKafree(*p); \
  177. *p = NULL; \
  178. } \
  179. } \
  180. UINT GetRequiredMem##name(void) { \
  181. return ALGN_SIZE_EXTRES((num) * sizeof(type) + ALIGNMENT_DEFAULT + \
  182. sizeof(void *)); \
  183. }
  184. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  185. #define C_AALLOC_MEM2(name, type, n1, n2) \
  186. type *Get##name(int n) { \
  187. type *ap; \
  188. FDK_ASSERT((n) < (n2)); \
  189. ap = ((type *)FDKaalloc((n1) * sizeof(type), ALIGNMENT_DEFAULT)); \
  190. return ap; \
  191. } \
  192. void Free##name(type **p) { \
  193. if (p != NULL) { \
  194. FDKafree(*p); \
  195. *p = NULL; \
  196. } \
  197. } \
  198. UINT GetRequiredMem##name(void) { \
  199. return ALGN_SIZE_EXTRES((n1) * sizeof(type) + ALIGNMENT_DEFAULT + \
  200. sizeof(void *)) * \
  201. (n2); \
  202. }
  203. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  204. #define C_ALLOC_MEM_L(name, type, num, s) \
  205. type *Get##name(int n) { \
  206. FDK_ASSERT((n) == 0); \
  207. return ((type *)FDKcalloc_L(num, sizeof(type), s)); \
  208. } \
  209. void Free##name(type **p) { \
  210. if (p != NULL) { \
  211. FDKfree_L(*p); \
  212. *p = NULL; \
  213. } \
  214. } \
  215. UINT GetRequiredMem##name(void) { \
  216. return ALGN_SIZE_EXTRES((num) * sizeof(type)); \
  217. }
  218. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  219. #define C_ALLOC_MEM2_L(name, type, n1, n2, s) \
  220. type *Get##name(int n) { \
  221. FDK_ASSERT((n) < (n2)); \
  222. return (type *)FDKcalloc_L(n1, sizeof(type), s); \
  223. } \
  224. void Free##name(type **p) { \
  225. if (p != NULL) { \
  226. FDKfree_L(*p); \
  227. *p = NULL; \
  228. } \
  229. } \
  230. UINT GetRequiredMem##name(void) { \
  231. return ALGN_SIZE_EXTRES((n1) * sizeof(type)) * (n2); \
  232. }
  233. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  234. #define C_AALLOC_MEM_L(name, type, num, s) \
  235. type *Get##name(int n) { \
  236. type *ap; \
  237. FDK_ASSERT((n) == 0); \
  238. ap = ((type *)FDKaalloc_L((num) * sizeof(type), ALIGNMENT_DEFAULT, s)); \
  239. return ap; \
  240. } \
  241. void Free##name(type **p) { \
  242. if (p != NULL) { \
  243. FDKafree_L(*p); \
  244. *p = NULL; \
  245. } \
  246. } \
  247. UINT GetRequiredMem##name(void) { \
  248. return ALGN_SIZE_EXTRES((num) * sizeof(type) + ALIGNMENT_DEFAULT + \
  249. sizeof(void *)); \
  250. }
  251. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  252. #define C_AALLOC_MEM2_L(name, type, n1, n2, s) \
  253. type *Get##name(int n) { \
  254. type *ap; \
  255. FDK_ASSERT((n) < (n2)); \
  256. ap = ((type *)FDKaalloc_L((n1) * sizeof(type), ALIGNMENT_DEFAULT, s)); \
  257. return ap; \
  258. } \
  259. void Free##name(type **p) { \
  260. if (p != NULL) { \
  261. FDKafree_L(*p); \
  262. *p = NULL; \
  263. } \
  264. } \
  265. UINT GetRequiredMem##name(void) { \
  266. return ALGN_SIZE_EXTRES((n1) * sizeof(type) + ALIGNMENT_DEFAULT + \
  267. sizeof(void *)) * \
  268. (n2); \
  269. }
  270. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  271. #define C_ALLOC_MEM_OVERLAY(name, type, num, sect, tag) \
  272. C_AALLOC_MEM_L(name, type, num, sect)
  273. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  274. #define C_AALLOC_SCRATCH_START(name, type, n) \
  275. type _##name[(n) + (ALIGNMENT_DEFAULT + sizeof(type) - 1)]; \
  276. type *name = (type *)ALIGN_PTR(_##name); \
  277. C_ALLOC_ALIGNED_REGISTER(name, (n) * sizeof(type));
  278. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  279. #define C_ALLOC_SCRATCH_START(name, type, n) type name[n];
  280. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  281. #define C_AALLOC_SCRATCH_END(name, type, n) C_ALLOC_ALIGNED_UNREGISTER(name);
  282. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  283. #define C_ALLOC_SCRATCH_END(name, type, n)
  284. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  285. #define C_AALLOC_STACK_START(name, type, n) \
  286. type _##name[(n) + (ALIGNMENT_DEFAULT + sizeof(type) - 1)]; \
  287. type *name = (type *)ALIGN_PTR(_##name); \
  288. C_ALLOC_ALIGNED_REGISTER(name, (n) * sizeof(type));
  289. /** See \ref SYSLIB_MEMORY_MACROS for description. */
  290. #define C_AALLOC_STACK_END(name, type, n) C_ALLOC_ALIGNED_UNREGISTER(name);
  291. /*! @} */
  292. #define C_ALLOC_ALIGNED_REGISTER(x, size)
  293. #define C_ALLOC_ALIGNED_UNREGISTER(x)
  294. #define C_ALLOC_ALIGNED_CHECK(x)
  295. #define C_ALLOC_ALIGNED_CHECK2(x, y)
  296. #define FDK_showBacktrace(a, b)
  297. /*! \addtogroup SYSLIB_EXITCODES Unified exit codes
  298. * Exit codes to be used as return values of FDK software test and
  299. * demonstration applications. Not as return values of product modules and/or
  300. * libraries.
  301. * @{
  302. */
  303. #define FDK_EXITCODE_OK 0 /*!< Successful termination. No errors. */
  304. #define FDK_EXITCODE_USAGE \
  305. 64 /*!< The command/application was used incorrectly, e.g. with the wrong \
  306. number of arguments, a bad flag, a bad syntax in a parameter, or \
  307. whatever. */
  308. #define FDK_EXITCODE_DATAERROR \
  309. 65 /*!< The input data was incorrect in some way. This should only be used \
  310. for user data and not system files. */
  311. #define FDK_EXITCODE_NOINPUT \
  312. 66 /*!< An input file (not a system file) did not exist or was not readable. \
  313. */
  314. #define FDK_EXITCODE_UNAVAILABLE \
  315. 69 /*!< A service is unavailable. This can occur if a support program or \
  316. file does not exist. This can also be used as a catchall message when \
  317. something you wanted to do doesn't work, but you don't know why. */
  318. #define FDK_EXITCODE_SOFTWARE \
  319. 70 /*!< An internal software error has been detected. This should be limited \
  320. to non- operating system related errors as possible. */
  321. #define FDK_EXITCODE_CANTCREATE \
  322. 73 /*!< A (user specified) output file cannot be created. */
  323. #define FDK_EXITCODE_IOERROR \
  324. 74 /*!< An error occurred while doing I/O on some file. */
  325. /*! @} */
  326. /*--------------------------------------------
  327. * Runtime support declarations
  328. *---------------------------------------------*/
  329. #ifdef __cplusplus
  330. extern "C" {
  331. #endif
  332. void FDKprintf(const char *szFmt, ...);
  333. void FDKprintfErr(const char *szFmt, ...);
  334. /** Wrapper for <stdio.h>'s getchar(). */
  335. int FDKgetchar(void);
  336. INT FDKfprintf(void *stream, const char *format, ...);
  337. INT FDKsprintf(char *str, const char *format, ...);
  338. char *FDKstrchr(char *s, INT c);
  339. const char *FDKstrstr(const char *haystack, const char *needle);
  340. char *FDKstrcpy(char *dest, const char *src);
  341. char *FDKstrncpy(char *dest, const char *src, const UINT n);
  342. #define FDK_MAX_OVERLAYS 8 /**< Maximum number of memory overlays. */
  343. void *FDKcalloc(const UINT n, const UINT size);
  344. void *FDKmalloc(const UINT size);
  345. void FDKfree(void *ptr);
  346. /**
  347. * Allocate and clear an aligned memory area. Use FDKafree() instead of
  348. * FDKfree() for these memory areas.
  349. *
  350. * \param size Size of requested memory in bytes.
  351. * \param alignment Alignment of requested memory in bytes.
  352. * \return Pointer to allocated memory.
  353. */
  354. void *FDKaalloc(const UINT size, const UINT alignment);
  355. /**
  356. * Free an aligned memory area.
  357. *
  358. * \param ptr Pointer to be freed.
  359. */
  360. void FDKafree(void *ptr);
  361. /**
  362. * Allocate memory in a specific memory section.
  363. * Requests can be made for internal or external memory. If internal memory is
  364. * requested, FDKcalloc_L() first tries to use L1 memory, which sizes are
  365. * defined by ::DATA_L1_A_SIZE and ::DATA_L1_B_SIZE. If no L1 memory is
  366. * available, then FDKcalloc_L() tries to use L2 memory. If that fails as well,
  367. * the requested memory is allocated at an extern location using the fallback
  368. * FDKcalloc().
  369. *
  370. * \param n See MSDN documentation on calloc().
  371. * \param size See MSDN documentation on calloc().
  372. * \param s Memory section.
  373. * \return See MSDN documentation on calloc().
  374. */
  375. void *FDKcalloc_L(const UINT n, const UINT size, MEMORY_SECTION s);
  376. /**
  377. * Allocate aligned memory in a specific memory section.
  378. * See FDKcalloc_L() description for details - same applies here.
  379. */
  380. void *FDKaalloc_L(const UINT size, const UINT alignment, MEMORY_SECTION s);
  381. /**
  382. * Free memory that was allocated in a specific memory section.
  383. */
  384. void FDKfree_L(void *ptr);
  385. /**
  386. * Free aligned memory that was allocated in a specific memory section.
  387. */
  388. void FDKafree_L(void *ptr);
  389. /**
  390. * Copy memory. Source and destination memory must not overlap.
  391. * Either use implementation from a Standard Library, or, if no Standard Library
  392. * is available, a generic implementation.
  393. * The define ::USE_BUILTIN_MEM_FUNCTIONS in genericStds.cpp controls what to
  394. * use. The function arguments correspond to the standard memcpy(). Please see
  395. * MSDN documentation for details on how to use it.
  396. */
  397. void FDKmemcpy(void *dst, const void *src, const UINT size);
  398. /**
  399. * Copy memory. Source and destination memory are allowed to overlap.
  400. * Either use implementation from a Standard Library, or, if no Standard Library
  401. * is available, a generic implementation.
  402. * The define ::USE_BUILTIN_MEM_FUNCTIONS in genericStds.cpp controls what to
  403. * use. The function arguments correspond to the standard memmove(). Please see
  404. * MSDN documentation for details on how to use it.
  405. */
  406. void FDKmemmove(void *dst, const void *src, const UINT size);
  407. /**
  408. * Clear memory.
  409. * Either use implementation from a Standard Library, or, if no Standard Library
  410. * is available, a generic implementation.
  411. * The define ::USE_BUILTIN_MEM_FUNCTIONS in genericStds.cpp controls what to
  412. * use. The function arguments correspond to the standard memclear(). Please see
  413. * MSDN documentation for details on how to use it.
  414. */
  415. void FDKmemclear(void *memPtr, const UINT size);
  416. /**
  417. * Fill memory with values.
  418. * The function arguments correspond to the standard memset(). Please see MSDN
  419. * documentation for details on how to use it.
  420. */
  421. void FDKmemset(void *memPtr, const INT value, const UINT size);
  422. /* Compare function wrappers */
  423. INT FDKmemcmp(const void *s1, const void *s2, const UINT size);
  424. INT FDKstrcmp(const char *s1, const char *s2);
  425. INT FDKstrncmp(const char *s1, const char *s2, const UINT size);
  426. UINT FDKstrlen(const char *s);
  427. #define FDKmax(a, b) ((a) > (b) ? (a) : (b))
  428. #define FDKmin(a, b) ((a) < (b) ? (a) : (b))
  429. #define FDK_INT_MAX ((INT)0x7FFFFFFF)
  430. #define FDK_INT_MIN ((INT)0x80000000)
  431. /* FILE I/O */
  432. /*!
  433. * Check platform for endianess.
  434. *
  435. * \return 1 if platform is little endian, non-1 if platform is big endian.
  436. */
  437. int IS_LITTLE_ENDIAN(void);
  438. /*!
  439. * Convert input value to little endian format.
  440. *
  441. * \param val Value to be converted. It may be in both big or little endian.
  442. * \return Value in little endian format.
  443. */
  444. UINT TO_LITTLE_ENDIAN(UINT val);
  445. /*!
  446. * \fn FDKFILE *FDKfopen(const char *filename, const char *mode);
  447. * Standard fopen() wrapper.
  448. * \fn INT FDKfclose(FDKFILE *FP);
  449. * Standard fclose() wrapper.
  450. * \fn INT FDKfseek(FDKFILE *FP, LONG OFFSET, int WHENCE);
  451. * Standard fseek() wrapper.
  452. * \fn INT FDKftell(FDKFILE *FP);
  453. * Standard ftell() wrapper.
  454. * \fn INT FDKfflush(FDKFILE *fp);
  455. * Standard fflush() wrapper.
  456. * \fn UINT FDKfwrite(const void *ptrf, INT size, UINT nmemb, FDKFILE *fp);
  457. * Standard fwrite() wrapper.
  458. * \fn UINT FDKfread(void *dst, INT size, UINT nmemb, FDKFILE *fp);
  459. * Standard fread() wrapper.
  460. */
  461. typedef void FDKFILE;
  462. extern const INT FDKSEEK_SET, FDKSEEK_CUR, FDKSEEK_END;
  463. FDKFILE *FDKfopen(const char *filename, const char *mode);
  464. INT FDKfclose(FDKFILE *FP);
  465. INT FDKfseek(FDKFILE *FP, LONG OFFSET, int WHENCE);
  466. INT FDKftell(FDKFILE *FP);
  467. INT FDKfflush(FDKFILE *fp);
  468. UINT FDKfwrite(const void *ptrf, INT size, UINT nmemb, FDKFILE *fp);
  469. UINT FDKfread(void *dst, INT size, UINT nmemb, FDKFILE *fp);
  470. char *FDKfgets(void *dst, INT size, FDKFILE *fp);
  471. void FDKrewind(FDKFILE *fp);
  472. INT FDKfeof(FDKFILE *fp);
  473. /**
  474. * \brief Write each member in little endian order. Convert automatically
  475. * to host endianess.
  476. * \param ptrf Pointer to memory where to read data from.
  477. * \param size Size of each item to be written.
  478. * \param nmemb Number of items to be written.
  479. * \param fp File pointer of type FDKFILE.
  480. * \return Number of items read on success and fread() error on failure.
  481. */
  482. UINT FDKfwrite_EL(const void *ptrf, INT size, UINT nmemb, FDKFILE *fp);
  483. /**
  484. * \brief Read variable of size "size" as little endian. Convert
  485. * automatically to host endianess. 4-byte alignment is enforced for 24 bit
  486. * data, at 32 bit full scale.
  487. * \param dst Pointer to memory where to store data into.
  488. * \param size Size of each item to be read.
  489. * \param nmemb Number of items to be read.
  490. * \param fp File pointer of type FDKFILE.
  491. * \return Number of items read on success and fread() error on failure.
  492. */
  493. UINT FDKfread_EL(void *dst, INT size, UINT nmemb, FDKFILE *fp);
  494. /**
  495. * \brief Print FDK software disclaimer.
  496. */
  497. void FDKprintDisclaimer(void);
  498. #ifdef __cplusplus
  499. }
  500. #endif
  501. #endif /* GENERICSTDS_H */