28#define THRESHOLD_FUNC(depth, opt) \
29void ff_threshold##depth##_##opt(const uint8_t *in, const uint8_t *threshold,\
30 const uint8_t *min, const uint8_t *max, \
32 ptrdiff_t ilinesize, ptrdiff_t tlinesize, \
33 ptrdiff_t flinesize, ptrdiff_t slinesize, \
34 ptrdiff_t olinesize, \
43 const uint8_t *
min, const uint8_t *
max,
45 ptrdiff_t ilinesize, ptrdiff_t tlinesize,
46 ptrdiff_t flinesize, ptrdiff_t slinesize,
48 int start,
int end,
int h)
50 for (
int y = 0; y <
h; y++) {
51 for (
int x = start; x < end; x++)
52 out[x] = in[x] <= threshold[x] ?
min[x] :
max[x];
54 threshold += tlinesize;
62 const uint8_t *ffirst,
const uint8_t *ssecond,
64 ptrdiff_t ilinesize, ptrdiff_t tlinesize,
65 ptrdiff_t flinesize, ptrdiff_t slinesize,
67 int start,
int end,
int h)
69 const uint16_t *in = (
const uint16_t *)iin;
70 const uint16_t *threshold = (
const uint16_t *)tthreshold;
71 const uint16_t *
min = (
const uint16_t *)ffirst;
72 const uint16_t *
max = (
const uint16_t *)ssecond;
73 uint16_t *
out = (uint16_t *)oout;
75 for (
int y = 0; y <
h; y++) {
76 for (
int x = start; x < end; x++)
77 out[x] = in[x] <= threshold[x] ?
min[x] :
max[x];
79 threshold += tlinesize / 2;
86#define THRESHOLD_X86(depth, opt, vec_elements) \
87static void threshold##depth##_##opt##_x86(const uint8_t *in, const uint8_t *threshold, \
88 const uint8_t *min, const uint8_t *max, \
90 ptrdiff_t ilinesize, ptrdiff_t tlinesize, \
91 ptrdiff_t flinesize, ptrdiff_t slinesize, \
92 ptrdiff_t olinesize, \
95 int aligned_w = w & ~((vec_elements) - 1); \
97 ff_threshold##depth##_##opt(in, threshold, min, max, out, \
98 ilinesize, tlinesize, flinesize, slinesize, olinesize, \
101 threshold##depth##_tail(in, threshold, min, max, out, \
102 ilinesize, tlinesize, flinesize, slinesize, olinesize, \
117 s->threshold = threshold8_sse4_x86;
120 s->threshold = threshold8_avx2_x86;
122 }
else if (
s->depth == 16) {
124 s->threshold = threshold16_sse4_x86;
127 s->threshold = threshold16_avx2_x86;
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_SSE4(flags)
void ff_threshold_init_x86(ThresholdContext *s)
#define THRESHOLD_FUNC(depth, opt)
#define THRESHOLD_X86(depth, opt, vec_elements)
static void threshold16_tail(const uint8_t *iin, const uint8_t *tthreshold, const uint8_t *ffirst, const uint8_t *ssecond, uint8_t *oout, ptrdiff_t ilinesize, ptrdiff_t tlinesize, ptrdiff_t flinesize, ptrdiff_t slinesize, ptrdiff_t olinesize, int start, int end, int h)
static void threshold8_tail(const uint8_t *in, const uint8_t *threshold, const uint8_t *min, const uint8_t *max, uint8_t *out, ptrdiff_t ilinesize, ptrdiff_t tlinesize, ptrdiff_t flinesize, ptrdiff_t slinesize, ptrdiff_t olinesize, int start, int end, int h)