vf_noise.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at>
  3. * Copyright (c) 2013 Paul B Mahol
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #ifndef AVFILTER_NOISE_H
  22. #define AVFILTER_NOISE_H
  23. #include "libavutil/lfg.h"
  24. #include "avfilter.h"
  25. #define MAX_NOISE 5120
  26. #define MAX_SHIFT 1024
  27. #define MAX_RES (MAX_NOISE-MAX_SHIFT)
  28. #define NOISE_UNIFORM 1
  29. #define NOISE_TEMPORAL 2
  30. #define NOISE_AVERAGED 8
  31. #define NOISE_PATTERN 16
  32. typedef struct {
  33. int strength;
  34. unsigned flags;
  35. AVLFG lfg;
  36. int seed;
  37. int8_t *noise;
  38. int8_t *prev_shift[MAX_RES][3];
  39. int rand_shift[MAX_RES];
  40. int rand_shift_init;
  41. } FilterParams;
  42. typedef struct {
  43. const AVClass *class;
  44. int nb_planes;
  45. int bytewidth[4];
  46. int height[4];
  47. FilterParams all;
  48. FilterParams param[4];
  49. void (*line_noise)(uint8_t *dst, const uint8_t *src, const int8_t *noise, int len, int shift);
  50. void (*line_noise_avg)(uint8_t *dst, const uint8_t *src, int len, const int8_t * const *shift);
  51. } NoiseContext;
  52. void ff_line_noise_c(uint8_t *dst, const uint8_t *src, const int8_t *noise, int len, int shift);
  53. void ff_line_noise_avg_c(uint8_t *dst, const uint8_t *src, int len, const int8_t * const *shift);
  54. void ff_noise_init_x86(NoiseContext *n);
  55. #endif /* AVFILTER_NOISE_H */