pixelutils.h 2.0 KB

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