libvmaf
Toggle main menu visibility
Loading...
Searching...
No Matches
integer_motion.h
Go to the documentation of this file.
1
18
19
#ifndef FEATURE_MOTION_H_
20
#define FEATURE_MOTION_H_
21
22
#include <stdbool.h>
23
#include <stdint.h>
24
25
static
const
uint16_t filter[5] = { 3571, 16004, 26386, 16004, 3571 };
26
static
const
int
filter_width =
sizeof
(filter) /
sizeof
(filter[0]);
27
28
static
inline
uint32_t
29
edge_16(
bool
horizontal,
const
uint16_t *src,
int
width,
30
int
height,
int
stride,
int
i,
int
j)
31
{
32
const
int
radius = filter_width / 2;
33
uint32_t accum = 0;
34
35
// MIRROR | ЯOЯЯIM
36
for
(
int
k = 0; k < filter_width; ++k) {
37
int
i_tap = horizontal ? i : i - radius + k;
38
int
j_tap = horizontal ? j - radius + k : j;
39
40
if
(horizontal) {
41
if
(j_tap < 0)
42
j_tap = -j_tap;
43
else
if
(j_tap >= width)
44
j_tap = width - (j_tap - width + 2);
45
}
else
{
46
if
(i_tap < 0)
47
i_tap = -i_tap;
48
else
if
(i_tap >= height)
49
i_tap = height - (i_tap - height + 2);
50
}
51
accum += filter[k] * src[i_tap * stride + j_tap];
52
}
53
return
accum;
54
}
55
56
#endif
/* _FEATURE_MOTION_H_ */
src
feature
integer_motion.h
Generated by
1.18.0