vf_eq.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. "n", // frame count
  30. "pos", // frame position
  31. "r", // frame rate
  32. "t", // timestamp expressed in seconds
  33. NULL
  34. };
  35. enum var_name {
  36. VAR_N,
  37. VAR_POS,
  38. VAR_R,
  39. VAR_T,
  40. VAR_NB
  41. };
  42. typedef struct EQParameters {
  43. void (*adjust)(struct EQParameters *eq, uint8_t *dst, int dst_stride,
  44. const uint8_t *src, int src_stride, int w, int h);
  45. uint8_t lut[256];
  46. double brightness, contrast, gamma, gamma_weight;
  47. int lut_clean;
  48. } EQParameters;
  49. typedef struct {
  50. const AVClass *class;
  51. EQParameters param[3];
  52. char *contrast_expr;
  53. AVExpr *contrast_pexpr;
  54. double contrast;
  55. char *brightness_expr;
  56. AVExpr *brightness_pexpr;
  57. double brightness;
  58. char *saturation_expr;
  59. AVExpr *saturation_pexpr;
  60. double saturation;
  61. char *gamma_expr;
  62. AVExpr *gamma_pexpr;
  63. double gamma;
  64. char *gamma_weight_expr;
  65. AVExpr *gamma_weight_pexpr;
  66. double gamma_weight;
  67. char *gamma_r_expr;
  68. AVExpr *gamma_r_pexpr;
  69. double gamma_r;
  70. char *gamma_g_expr;
  71. AVExpr *gamma_g_pexpr;
  72. double gamma_g;
  73. char *gamma_b_expr;
  74. AVExpr *gamma_b_pexpr;
  75. double gamma_b;
  76. double var_values[VAR_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. enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB } eval_mode;
  80. } EQContext;
  81. void ff_eq_init_x86(EQContext *eq);
  82. #endif /* AVFILTER_EQ_H */