2015-01-18 23:26:48 +01:00
|
|
|
/*
|
|
|
|
* Original MPlayer filters by Richard Felker, Hampa Hug, Daniel Moreno,
|
|
|
|
* and Michael Niedermeyer.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 James Darnley <james.darnley@gmail.com>
|
|
|
|
* Copyright (c) 2015 Arwa Arif <arwaarif1994@gmail.com>
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with FFmpeg; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AVFILTER_EQ_H
|
|
|
|
#define AVFILTER_EQ_H
|
|
|
|
|
|
|
|
#include "avfilter.h"
|
2015-02-18 20:56:44 +01:00
|
|
|
#include "libavutil/eval.h"
|
|
|
|
|
2015-03-13 07:16:42 +01:00
|
|
|
static const char *const var_names[] = {
|
|
|
|
"n", // frame count
|
|
|
|
"pos", // frame position
|
|
|
|
"r", // frame rate
|
|
|
|
"t", // timestamp expressed in seconds
|
2015-02-18 20:56:44 +01:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum var_name {
|
2015-03-13 07:16:42 +01:00
|
|
|
VAR_N,
|
|
|
|
VAR_POS,
|
|
|
|
VAR_R,
|
|
|
|
VAR_T,
|
|
|
|
VAR_NB
|
2015-02-18 20:56:44 +01:00
|
|
|
};
|
2015-01-18 23:26:48 +01:00
|
|
|
|
|
|
|
typedef struct EQParameters {
|
|
|
|
void (*adjust)(struct EQParameters *eq, uint8_t *dst, int dst_stride,
|
2015-01-27 01:46:08 +01:00
|
|
|
const uint8_t *src, int src_stride, int w, int h);
|
2015-01-18 23:26:48 +01:00
|
|
|
|
|
|
|
uint8_t lut[256];
|
|
|
|
|
|
|
|
double brightness, contrast, gamma, gamma_weight;
|
|
|
|
int lut_clean;
|
2015-02-18 20:56:44 +01:00
|
|
|
|
2015-01-18 23:26:48 +01:00
|
|
|
} EQParameters;
|
|
|
|
|
2017-05-12 20:00:49 +02:00
|
|
|
typedef struct EQContext {
|
2015-01-18 23:26:48 +01:00
|
|
|
const AVClass *class;
|
|
|
|
|
|
|
|
EQParameters param[3];
|
|
|
|
|
2015-02-18 20:56:44 +01:00
|
|
|
char *contrast_expr;
|
|
|
|
AVExpr *contrast_pexpr;
|
2015-03-13 07:16:42 +01:00
|
|
|
double contrast;
|
2015-02-18 20:56:44 +01:00
|
|
|
|
|
|
|
char *brightness_expr;
|
|
|
|
AVExpr *brightness_pexpr;
|
2015-03-13 07:16:42 +01:00
|
|
|
double brightness;
|
2015-02-18 20:56:44 +01:00
|
|
|
|
|
|
|
char *saturation_expr;
|
|
|
|
AVExpr *saturation_pexpr;
|
2015-03-13 07:16:42 +01:00
|
|
|
double saturation;
|
2015-02-18 20:56:44 +01:00
|
|
|
|
|
|
|
char *gamma_expr;
|
|
|
|
AVExpr *gamma_pexpr;
|
2015-03-13 07:16:42 +01:00
|
|
|
double gamma;
|
2015-02-18 20:56:44 +01:00
|
|
|
|
|
|
|
char *gamma_weight_expr;
|
|
|
|
AVExpr *gamma_weight_pexpr;
|
2015-03-13 07:16:42 +01:00
|
|
|
double gamma_weight;
|
2015-02-18 20:56:44 +01:00
|
|
|
|
|
|
|
char *gamma_r_expr;
|
|
|
|
AVExpr *gamma_r_pexpr;
|
2015-03-13 07:16:42 +01:00
|
|
|
double gamma_r;
|
2015-02-18 20:56:44 +01:00
|
|
|
|
|
|
|
char *gamma_g_expr;
|
|
|
|
AVExpr *gamma_g_pexpr;
|
2015-03-13 07:16:42 +01:00
|
|
|
double gamma_g;
|
2015-02-18 20:56:44 +01:00
|
|
|
|
|
|
|
char *gamma_b_expr;
|
|
|
|
AVExpr *gamma_b_pexpr;
|
2015-03-13 07:16:42 +01:00
|
|
|
double gamma_b;
|
2015-01-18 23:26:48 +01:00
|
|
|
|
2015-03-13 07:16:42 +01:00
|
|
|
double var_values[VAR_NB];
|
2015-01-18 23:26:48 +01:00
|
|
|
|
|
|
|
void (*process)(struct EQParameters *par, uint8_t *dst, int dst_stride,
|
2015-01-27 01:46:08 +01:00
|
|
|
const uint8_t *src, int src_stride, int w, int h);
|
2015-01-18 23:26:48 +01:00
|
|
|
|
2015-03-13 07:16:42 +01:00
|
|
|
enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB } eval_mode;
|
2015-01-18 23:26:48 +01:00
|
|
|
} EQContext;
|
|
|
|
|
2019-09-18 09:05:33 +02:00
|
|
|
void ff_eq_init(EQContext *eq);
|
2015-01-18 23:26:48 +01:00
|
|
|
void ff_eq_init_x86(EQContext *eq);
|
|
|
|
|
|
|
|
#endif /* AVFILTER_EQ_H */
|