blob: a8dbc157e1055a636de42a64233c20a7d1c56c08
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 | #ifndef AVUTIL_PIXELUTILS_H |
20 | #define AVUTIL_PIXELUTILS_H |
21 | |
22 | #include <stddef.h> |
23 | #include <stdint.h> |
24 | #include "common.h" |
25 | |
26 | /** |
27 | * Sum of abs(src1[x] - src2[x]) |
28 | */ |
29 | typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, |
30 | const uint8_t *src2, ptrdiff_t stride2); |
31 | |
32 | /** |
33 | * Get a potentially optimized pointer to a Sum-of-absolute-differences |
34 | * function (see the av_pixelutils_sad_fn prototype). |
35 | * |
36 | * @param w_bits 1<<w_bits is the requested width of the block size |
37 | * @param h_bits 1<<h_bits is the requested height of the block size |
38 | * @param aligned If set to 2, the returned sad function will assume src1 and |
39 | * src2 addresses are aligned on the block size. |
40 | * If set to 1, the returned sad function will assume src1 is |
41 | * aligned on the block size. |
42 | * If set to 0, the returned sad function assume no particular |
43 | * alignment. |
44 | * @param log_ctx context used for logging, can be NULL |
45 | * |
46 | * @return a pointer to the SAD function or NULL in case of error (because of |
47 | * invalid parameters) |
48 | */ |
49 | av_pixelutils_sad_fn av_pixelutils_get_sad_fn(int w_bits, int h_bits, |
50 | int aligned, void *log_ctx); |
51 | |
52 | #endif /* AVUTIL_PIXELUTILS_H */ |
53 |