2016-04-29 18:23:33 +01:00
|
|
|
#ifndef WIN32 /* currently we support fast acosf computation only on UNIX/Linux */
|
2016-03-27 20:39:53 +01:00
|
|
|
/*
|
|
|
|
* @brief Fast arithmetic using precomputed arc cosine table.
|
2016-06-24 18:36:55 +01:00
|
|
|
*
|
2016-04-23 00:01:11 +01:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Eric des Courtis <eric.des.courtis@benbria.com>
|
2016-06-24 18:36:55 +01:00
|
|
|
* Piotr Gregor <piotrgregor@rsyncme.org>
|
2016-03-27 20:39:53 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __AVMD_FAST_ACOSF_H__
|
|
|
|
#define __AVMD_FAST_ACOSF_H__
|
2010-05-25 15:03:14 -04:00
|
|
|
|
2016-02-21 15:16:55 +00:00
|
|
|
|
|
|
|
#define ACOS_TABLE_FILENAME "/tmp/acos_table.dat"
|
|
|
|
|
2016-03-27 20:39:53 +01:00
|
|
|
|
2016-02-21 15:16:55 +00:00
|
|
|
/*! \brief Arc cosine table initialization.
|
|
|
|
*
|
|
|
|
* @return 0 on success, negative value otherwise:
|
|
|
|
* -1 can't access arc cos table with error != NOENT,
|
|
|
|
* -2 table creation failed (compute_table)
|
|
|
|
* -3 can access table but fopen failed
|
|
|
|
* -4 mmap failed
|
|
|
|
*/
|
|
|
|
extern int init_fast_acosf(void);
|
|
|
|
|
|
|
|
/*! \brief Arc cosine table deinitialization.
|
|
|
|
*
|
|
|
|
* @return 0 on success, negative value otherwise:
|
|
|
|
* -1 munmap failed,
|
|
|
|
* -2 close failed
|
|
|
|
*/
|
|
|
|
extern int destroy_fast_acosf(void);
|
|
|
|
|
|
|
|
/*! \brief Return arc cos for this argument.
|
|
|
|
* @details Uses previously created and mmapped file.
|
|
|
|
*/
|
2010-05-25 15:03:14 -04:00
|
|
|
extern float fast_acosf(float x);
|
2016-02-21 15:16:55 +00:00
|
|
|
|
|
|
|
/*! \brief Arc cosine table creation.
|
|
|
|
*
|
|
|
|
* @return 0 on success, negative value otherwise:
|
|
|
|
* -1 fwrite failed,
|
|
|
|
* -2 fclose failed
|
|
|
|
*/
|
|
|
|
extern int compute_table(void);
|
2010-05-25 15:03:14 -04:00
|
|
|
|
2016-03-27 20:39:53 +01:00
|
|
|
#endif /* __AVMD_FAST_ACOSF_H__ */
|
2016-04-29 18:23:33 +01:00
|
|
|
#endif
|