mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Initial import
This commit is contained in:
commit
c91b3c5006
14915 changed files with 590219 additions and 0 deletions
27
dsp/core/q.h
Normal file
27
dsp/core/q.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef COSMOPOLITAN_DSP_CORE_Q_H_
|
||||
#define COSMOPOLITAN_DSP_CORE_Q_H_
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macros.h"
|
||||
#include "libc/math.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/**
|
||||
* @fileoverview Fixed point arithmetic macros.
|
||||
* @see en.wikipedia.org/wiki/Q_(number_format)
|
||||
*/
|
||||
|
||||
#define F2Q(Q, I) MIN((1 << Q) - 1, roundf((I) * (1.f * ((1 << Q) - 1))))
|
||||
#define Q2F(Q, I) ((I) * (1.f / ((1 << Q) - 1)))
|
||||
#define QRS(Q, X) (((X) + (1 << (Q - 1))) >> Q)
|
||||
#define LQRS(Q, X) (((X) + (1L << (Q - 1))) >> Q)
|
||||
|
||||
double DifferSumSq(const double[static 6], double, double);
|
||||
double DifferSumSq8(const double[static 8], double, double);
|
||||
|
||||
long GetIntegerCoefficients(long[static 6], const double[static 6], long, long,
|
||||
long);
|
||||
long GetIntegerCoefficients8(long[static 8], const double[static 8], long, long,
|
||||
long);
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_DSP_CORE_Q_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue