cosmopolitan/dsp/core/c331.h

31 lines
746 B
C

#ifndef COSMOPOLITAN_DSP_CORE_C331_H_
#define COSMOPOLITAN_DSP_CORE_C331_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/**
* Fixed-point 8-bit magic edge resampling kernel.
*
* @define (3*a + 3*b + 1*c) / 7
* @see C1331()
*/
static inline pureconst artificial unsigned char C331(unsigned char al,
unsigned char bl,
unsigned char cl) {
unsigned eax, ebx, ecx;
eax = al;
ebx = bl;
ecx = cl;
eax += ebx;
eax *= 3 * 2350;
ecx *= 1 * 2350;
eax += ecx;
eax >>= 14;
al = eax;
return al;
}
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_DSP_CORE_C331_H_ */