+ +
65338e2 fix(windows): add win32 compat headers and export audio and simd APIs
saifmukhtar · 2026-11-24
main
| 1 | /* |
| 2 | * SPDX-License-Identifier: AGPL-3.0-or-later WITH Classpath-exception-2.0 |
| 3 | * Copyright (c) 2026 Saif Mukhtar |
| 4 | * |
| 5 | * OpenAVX - Open Audio-Video eXchange |
| 6 | * include/avx_simd.h - SIMD color conversion, DCT, and audio kernels |
| 7 | */ |
| 8 | |
| 9 | #ifndef AVX_SIMD_H |
| 10 | #define AVX_SIMD_H |
| 11 | |
| 12 | #include <stdint.h> |
| 13 | #include <stddef.h> |
| 14 | #include <stdbool.h> |
| 15 | #include "openavx.h" |
| 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | typedef enum { |
| 22 | AVX_SIMD_NONE = 0, |
| 23 | AVX_SIMD_AVX2 = 1, |
| 24 | AVX_SIMD_NEON = 2 |
| 25 | } avx_simd_type_e; |
| 26 | |
| 27 | /** |
| 28 | * Returns the currently active SIMD backend (detected dynamically at runtime). |
| 29 | */ |
| 30 | OPENAVX_API avx_simd_type_e avx_simd_get_caps(void); |
| 31 | |
| 32 | /** |
| 33 | * Returns human-readable name of active SIMD backend ("AVX2+FMA", "ARM NEON", "Portable C99"). |
| 34 | */ |
| 35 | OPENAVX_API const char* avx_simd_get_name(void); |
| 36 | |
| 37 | /* SIMD Accelerated Color Conversion Routines */ |
| 38 | OPENAVX_API void avx_simd_uyvy_to_rgba(const uint8_t *src, uint8_t *dst, int width, int height); |
| 39 | OPENAVX_API void avx_simd_uyvy_to_bgra(const uint8_t *src, uint8_t *dst, int width, int height); |
| 40 | OPENAVX_API void avx_simd_rgba_to_uyvy(const uint8_t *src, uint8_t *dst, int width, int height); |
| 41 | OPENAVX_API void avx_simd_bgra_to_uyvy(const uint8_t *src, uint8_t *dst, int width, int height); |
| 42 | OPENAVX_API void avx_simd_rgba_to_bgra(const uint8_t *src, uint8_t *dst, int width, int height); |
| 43 | OPENAVX_API void avx_simd_alpha_blend_rgba(const uint8_t *fg, const uint8_t *bg, uint8_t *out, int width, int height); |
| 44 | |
| 45 | /* SIMD Accelerated SpeedHQ-2 8x8 DCT Transforms */ |
| 46 | OPENAVX_API void avx_simd_fdct_8x8(const int16_t in[64], int16_t out[64]); |
| 47 | OPENAVX_API void avx_simd_idct_8x8_put(const int16_t in[64], uint8_t *dest, int stride); |
| 48 | |
| 49 | /* Scalar Reference Implementations (for benchmark comparison & verification) */ |
| 50 | OPENAVX_API void avx_scalar_uyvy_to_rgba(const uint8_t *src, uint8_t *dst, int width, int height); |
| 51 | OPENAVX_API void avx_scalar_uyvy_to_bgra(const uint8_t *src, uint8_t *dst, int width, int height); |
| 52 | OPENAVX_API void avx_scalar_rgba_to_uyvy(const uint8_t *src, uint8_t *dst, int width, int height); |
| 53 | OPENAVX_API void avx_scalar_bgra_to_uyvy(const uint8_t *src, uint8_t *dst, int width, int height); |
| 54 | OPENAVX_API void avx_scalar_rgba_to_bgra(const uint8_t *src, uint8_t *dst, int width, int height); |
| 55 | OPENAVX_API void avx_scalar_alpha_blend_rgba(const uint8_t *fg, const uint8_t *bg, uint8_t *out, int width, int height); |
| 56 | OPENAVX_API void avx_scalar_fdct_8x8(const int16_t in[64], int16_t out[64]); |
| 57 | OPENAVX_API void avx_scalar_idct_8x8_put(const int16_t in[64], uint8_t *dest, int stride); |
| 58 | |
| 59 | #ifdef __cplusplus |
| 60 | } |
| 61 | #endif |
| 62 | |
| 63 | #endif /* AVX_SIMD_H */ |