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