25#define DETECT_RANGE_FUNC(FUNC_NAME, ASM_FUNC_NAME, C_FUNC_NAME, SHIFT, MMSIZE) \
26int ASM_FUNC_NAME(const uint8_t *src, ptrdiff_t stride, \
27 ptrdiff_t width, ptrdiff_t height, int min, int max); \
29static int FUNC_NAME(const uint8_t *src, ptrdiff_t stride, \
30 ptrdiff_t width, ptrdiff_t height, int min, int max) \
32 ptrdiff_t total = width << SHIFT; \
33 ptrdiff_t bytes = total & ~(MMSIZE - 1); \
36 return C_FUNC_NAME(src, stride, width, height, min, max); \
38 ret = ASM_FUNC_NAME(src, stride, bytes, height, min, max); \
39 if (ret || bytes == total) \
42 return ret | ASM_FUNC_NAME(src + total - MMSIZE, stride, MMSIZE, \
46#define DETECT_ALPHA_FUNC(FUNC_NAME, ASM_FUNC_NAME, C_FUNC_NAME, SHIFT, MMSIZE) \
47int ASM_FUNC_NAME(const uint8_t *color, ptrdiff_t color_stride, \
48 const uint8_t *alpha, ptrdiff_t alpha_stride, \
49 ptrdiff_t width, ptrdiff_t height, int p, int q, int k); \
51static int FUNC_NAME(const uint8_t *color, ptrdiff_t color_stride, \
52 const uint8_t *alpha, ptrdiff_t alpha_stride, \
53 ptrdiff_t width, ptrdiff_t height, int p, int q, int k) \
55 ptrdiff_t total = width << SHIFT; \
56 ptrdiff_t bytes = total & ~(MMSIZE - 1); \
59 return C_FUNC_NAME(color, color_stride, alpha, alpha_stride, \
60 width, height, p, q, k); \
62 ret = ASM_FUNC_NAME(color, color_stride, alpha, alpha_stride, \
63 bytes, height, p, q, k); \
64 if (ret == FF_ALPHA_STRAIGHT || bytes == total) \
67 return ret | ASM_FUNC_NAME(color + total - MMSIZE, color_stride, \
68 alpha + total - MMSIZE, alpha_stride, \
69 MMSIZE, height, p, q, k); \
72#if HAVE_AVX512ICL_EXTERNAL
99 dsp->
detect_range = depth > 8 ? detect_range16_avx2 : detect_range_avx2;
101 dsp->
detect_alpha = depth > 8 ? detect_alpha16_limited_avx2 : detect_alpha_limited_avx2;
103 dsp->
detect_alpha = depth > 8 ? detect_alpha16_full_off_avx2 : detect_alpha_full_off_avx2;
105 dsp->
detect_alpha = depth > 8 ? detect_alpha16_full_avx2 : detect_alpha_full_avx2;
109#if HAVE_AVX512ICL_EXTERNAL
111 dsp->
detect_range = depth > 8 ? detect_range16_avx512icl : detect_range_avx512icl;
113 dsp->
detect_alpha = depth > 8 ? detect_alpha16_limited_avx512icl : detect_alpha_limited_avx512icl;
115 dsp->
detect_alpha = depth > 8 ? detect_alpha16_full_off_avx512icl : detect_alpha_full_off_avx512icl;
117 dsp->
detect_alpha = depth > 8 ? detect_alpha16_full_avx512icl : detect_alpha_full_avx512icl;
Macro definitions for various function/variable attributes.
static atomic_int cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define EXTERNAL_AVX2_FAST(flags)
#define EXTERNAL_AVX512ICL(flags)
AVColorRange
Visual content value range.
@ AVCOL_RANGE_JPEG
Full range content.
int(* detect_range)(const uint8_t *data, ptrdiff_t stride, ptrdiff_t width, ptrdiff_t height, int mpeg_min, int mpeg_max)
int(* detect_alpha)(const uint8_t *color, ptrdiff_t color_stride, const uint8_t *alpha, ptrdiff_t alpha_stride, ptrdiff_t width, ptrdiff_t height, int alpha_max, int mpeg_range, int offset)
static int ff_detect_alpha16_full_c(const uint8_t *color, ptrdiff_t color_stride, const uint8_t *alpha, ptrdiff_t alpha_stride, ptrdiff_t width, ptrdiff_t height, int alpha_max, int mpeg_range, int offset)
static int ff_detect_range_c(const uint8_t *data, ptrdiff_t stride, ptrdiff_t width, ptrdiff_t height, int mpeg_min, int mpeg_max)
static int ff_detect_alpha16_limited_c(const uint8_t *color, ptrdiff_t color_stride, const uint8_t *alpha, ptrdiff_t alpha_stride, ptrdiff_t width, ptrdiff_t height, int alpha_max, int mpeg_range, int offset)
static int ff_detect_alpha_full_c(const uint8_t *color, ptrdiff_t color_stride, const uint8_t *alpha, ptrdiff_t alpha_stride, ptrdiff_t width, ptrdiff_t height, int alpha_max, int mpeg_range, int offset)
static int ff_detect_alpha_limited_c(const uint8_t *color, ptrdiff_t color_stride, const uint8_t *alpha, ptrdiff_t alpha_stride, ptrdiff_t width, ptrdiff_t height, int alpha_max, int mpeg_range, int offset)
static int ff_detect_range16_c(const uint8_t *data, ptrdiff_t stride, ptrdiff_t width, ptrdiff_t height, int mpeg_min, int mpeg_max)
#define DETECT_RANGE_FUNC(FUNC_NAME, ASM_FUNC_NAME, C_FUNC_NAME, SHIFT, MMSIZE)
av_cold void ff_color_detect_dsp_init_x86(FFColorDetectDSPContext *dsp, int depth, int offset, enum AVColorRange color_range)
#define DETECT_ALPHA_FUNC(FUNC_NAME, ASM_FUNC_NAME, C_FUNC_NAME, SHIFT, MMSIZE)