Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * This file is part of FFmpeg. | ||
3 | * | ||
4 | * FFmpeg is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Lesser General Public | ||
6 | * License as published by the Free Software Foundation; either | ||
7 | * version 2.1 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * FFmpeg is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * Lesser General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public | ||
15 | * License along with FFmpeg; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
17 | */ | ||
18 | |||
19 | /** | ||
20 | * @file | ||
21 | * Scene SAD functions | ||
22 | */ | ||
23 | |||
24 | #include "scene_sad.h" | ||
25 | |||
26 | 107 | void ff_scene_sad16_c(SCENE_SAD_PARAMS) | |
27 | { | ||
28 | 107 | uint64_t sad = 0; | |
29 | 107 | const uint16_t *src1w = (const uint16_t *)src1; | |
30 | 107 | const uint16_t *src2w = (const uint16_t *)src2; | |
31 | int x, y; | ||
32 | |||
33 | 107 | stride1 /= 2; | |
34 | 107 | stride2 /= 2; | |
35 | |||
36 |
2/2✓ Branch 0 taken 25968 times.
✓ Branch 1 taken 107 times.
|
26075 | for (y = 0; y < height; y++) { |
37 |
2/2✓ Branch 0 taken 7293952 times.
✓ Branch 1 taken 25968 times.
|
7319920 | for (x = 0; x < width; x++) |
38 |
2/2✓ Branch 0 taken 6731158 times.
✓ Branch 1 taken 562794 times.
|
7293952 | sad += FFABS(src1w[x] - src2w[x]); |
39 | 25968 | src1w += stride1; | |
40 | 25968 | src2w += stride2; | |
41 | } | ||
42 | 107 | *sum = sad; | |
43 | 107 | } | |
44 | |||
45 | 3376 | void ff_scene_sad_c(SCENE_SAD_PARAMS) | |
46 | { | ||
47 | 3376 | uint64_t sad = 0; | |
48 | int x, y; | ||
49 | |||
50 |
2/2✓ Branch 0 taken 886336 times.
✓ Branch 1 taken 3376 times.
|
889712 | for (y = 0; y < height; y++) { |
51 |
2/2✓ Branch 0 taken 657408 times.
✓ Branch 1 taken 886336 times.
|
1543744 | for (x = 0; x < width; x++) |
52 |
2/2✓ Branch 0 taken 515986 times.
✓ Branch 1 taken 141422 times.
|
657408 | sad += FFABS(src1[x] - src2[x]); |
53 | 886336 | src1 += stride1; | |
54 | 886336 | src2 += stride2; | |
55 | } | ||
56 | 3376 | *sum = sad; | |
57 | 3376 | } | |
58 | |||
59 | 87 | ff_scene_sad_fn ff_scene_sad_get_fn(int depth) | |
60 | { | ||
61 | 87 | ff_scene_sad_fn sad = NULL; | |
62 | #if ARCH_X86 | ||
63 | 87 | sad = ff_scene_sad_get_fn_x86(depth); | |
64 | #endif | ||
65 |
2/2✓ Branch 0 taken 71 times.
✓ Branch 1 taken 16 times.
|
87 | if (!sad) { |
66 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 63 times.
|
71 | if (depth <= 8) |
67 | 8 | sad = ff_scene_sad_c; | |
68 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | else if (depth <= 16) |
69 | 63 | sad = ff_scene_sad16_c; | |
70 | } | ||
71 | 87 | return sad; | |
72 | } | ||
73 |