]> git.sesse.net Git - ffmpeg/blob - libavfilter/vf_eq.h
avfilter/af_volume: fix precision=fixed and volume=0 case
[ffmpeg] / libavfilter / vf_eq.h
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
25 #ifndef AVFILTER_EQ_H
26 #define AVFILTER_EQ_H
27
28 #include "avfilter.h"
29 #include "libavutil/eval.h"
30
31 static const char * const var_names[] = {
32     "contrast",
33     "brightness",
34     "saturation",
35     "gamma",
36     "gamma_weight",
37     "gamma_r",
38     "gamma_g",
39     "gamma_b",
40     NULL
41 };
42
43 enum var_name {
44     VAR_CONTRAST ,
45     VAR_BRIGHTNESS ,
46     VAR_SATURATION ,
47     VAR_GAMMA ,
48     VAR_GAMMA_WEIGHT ,
49     VAR_GAMMA_R ,
50     VAR_GAMMA_G ,
51     VAR_GAMMA_B ,
52     VAR_VARS_NB ,
53 };
54
55 typedef struct EQParameters {
56     void (*adjust)(struct EQParameters *eq, uint8_t *dst, int dst_stride,
57                    const uint8_t *src, int src_stride, int w, int h);
58
59     uint8_t lut[256];
60
61     double brightness, contrast, gamma, gamma_weight;
62     int lut_clean;
63
64 } EQParameters;
65
66 typedef struct {
67     const AVClass *class;
68
69     EQParameters param[3];
70
71     char   *contrast_expr;
72     AVExpr *contrast_pexpr;
73
74     char   *brightness_expr;
75     AVExpr *brightness_pexpr;
76
77     char   *saturation_expr;
78     AVExpr *saturation_pexpr;
79
80     char   *gamma_expr;
81     AVExpr *gamma_pexpr;
82
83     char   *gamma_weight_expr;
84     AVExpr *gamma_weight_pexpr;
85
86     char   *gamma_r_expr;
87     AVExpr *gamma_r_pexpr;
88
89     char   *gamma_g_expr;
90     AVExpr *gamma_g_pexpr;
91
92     char   *gamma_b_expr;
93     AVExpr *gamma_b_pexpr;
94
95     double var_values[VAR_VARS_NB];
96
97     void (*process)(struct EQParameters *par, uint8_t *dst, int dst_stride,
98                     const uint8_t *src, int src_stride, int w, int h);
99
100 } EQContext;
101
102 void ff_eq_init_x86(EQContext *eq);
103
104 #endif /* AVFILTER_EQ_H */