pixelutils.h 2.0 KB

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