vf_eq.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Original MPlayer filters by Richard Felker, Hampa Hug, Daniel Moreno,
  3. * and Michael Niedermeyer.
  4. *
  5. * Copyright (c) 2014 James Darnley <james.darnley@gmail.com>
  6. * Copyright (c) 2015 Arwa Arif <arwaarif1994@gmail.com>
  7. *
  8. * This file is part of FFmpeg.
  9. *
  10. * FFmpeg is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * FFmpeg is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along
  21. * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  23. */
  24. #ifndef AVFILTER_EQ_H
  25. #define AVFILTER_EQ_H
  26. #include "avfilter.h"
  27. #include "libavutil/eval.h"
  28. static const char * const var_names[] = {
  29. "contrast",
  30. "brightness",
  31. "saturation",
  32. "gamma",
  33. "gamma_weight",
  34. "gamma_r",
  35. "gamma_g",
  36. "gamma_b",
  37. NULL
  38. };
  39. enum var_name {
  40. VAR_CONTRAST ,
  41. VAR_BRIGHTNESS ,
  42. VAR_SATURATION ,
  43. VAR_GAMMA ,
  44. VAR_GAMMA_WEIGHT ,
  45. VAR_GAMMA_R ,
  46. VAR_GAMMA_G ,
  47. VAR_GAMMA_B ,
  48. VAR_VARS_NB ,
  49. };
  50. typedef struct EQParameters {
  51. void (*adjust)(struct EQParameters *eq, uint8_t *dst, int dst_stride,
  52. const uint8_t *src, int src_stride, int w, int h);
  53. uint8_t lut[256];
  54. double brightness, contrast, gamma, gamma_weight;
  55. int lut_clean;
  56. } EQParameters;
  57. typedef struct {
  58. const AVClass *class;
  59. EQParameters param[3];
  60. char *contrast_expr;
  61. AVExpr *contrast_pexpr;
  62. char *brightness_expr;
  63. AVExpr *brightness_pexpr;
  64. char *saturation_expr;
  65. AVExpr *saturation_pexpr;
  66. char *gamma_expr;
  67. AVExpr *gamma_pexpr;
  68. char *gamma_weight_expr;
  69. AVExpr *gamma_weight_pexpr;
  70. char *gamma_r_expr;
  71. AVExpr *gamma_r_pexpr;
  72. char *gamma_g_expr;
  73. AVExpr *gamma_g_pexpr;
  74. char *gamma_b_expr;
  75. AVExpr *gamma_b_pexpr;
  76. double var_values[VAR_VARS_NB];
  77. void (*process)(struct EQParameters *par, uint8_t *dst, int dst_stride,
  78. const uint8_t *src, int src_stride, int w, int h);
  79. } EQContext;
  80. void ff_eq_init_x86(EQContext *eq);
  81. #endif /* AVFILTER_EQ_H */