2015-10-25 19:18:41 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Muhammad Faiz <mfcc64@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 Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser 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
|
|
|
|
*/
|
|
|
|
|
2016-01-29 04:25:13 +02:00
|
|
|
#ifndef AVFILTER_SHOWCQT_H
|
|
|
|
#define AVFILTER_SHOWCQT_H
|
2015-10-25 19:18:41 +02:00
|
|
|
|
|
|
|
#include "libavcodec/avfft.h"
|
|
|
|
#include "avfilter.h"
|
|
|
|
#include "internal.h"
|
|
|
|
|
2017-05-12 20:00:49 +02:00
|
|
|
typedef struct Coeffs {
|
2015-10-25 19:18:41 +02:00
|
|
|
FFTSample *val;
|
|
|
|
int start, len;
|
|
|
|
} Coeffs;
|
|
|
|
|
2017-05-12 20:00:49 +02:00
|
|
|
typedef struct RGBFloat {
|
2015-10-25 19:18:41 +02:00
|
|
|
float r, g, b;
|
|
|
|
} RGBFloat;
|
|
|
|
|
2017-05-12 20:00:49 +02:00
|
|
|
typedef struct YUVFloat {
|
2015-10-25 19:18:41 +02:00
|
|
|
float y, u, v;
|
|
|
|
} YUVFloat;
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
RGBFloat rgb;
|
|
|
|
YUVFloat yuv;
|
|
|
|
} ColorFloat;
|
|
|
|
|
2017-05-12 20:00:49 +02:00
|
|
|
typedef struct ShowCQTContext {
|
2015-10-25 19:18:41 +02:00
|
|
|
const AVClass *class;
|
|
|
|
AVFilterContext *ctx;
|
|
|
|
AVFrame *axis_frame;
|
|
|
|
AVFrame *sono_frame;
|
|
|
|
enum AVPixelFormat format;
|
|
|
|
int sono_idx;
|
|
|
|
int sono_count;
|
|
|
|
int step;
|
|
|
|
AVRational step_frac;
|
|
|
|
int remaining_frac;
|
|
|
|
int remaining_fill;
|
2017-04-08 04:55:06 +02:00
|
|
|
int remaining_fill_max;
|
2016-02-16 02:03:37 +02:00
|
|
|
int64_t next_pts;
|
2015-10-25 19:18:41 +02:00
|
|
|
double *freq;
|
|
|
|
FFTContext *fft_ctx;
|
|
|
|
Coeffs *coeffs;
|
|
|
|
FFTComplex *fft_data;
|
|
|
|
FFTComplex *fft_result;
|
|
|
|
FFTComplex *cqt_result;
|
2017-04-08 04:55:06 +02:00
|
|
|
float *attack_data;
|
2015-10-25 19:18:41 +02:00
|
|
|
int fft_bits;
|
|
|
|
int fft_len;
|
|
|
|
int cqt_len;
|
|
|
|
int cqt_align;
|
|
|
|
ColorFloat *c_buf;
|
|
|
|
float *h_buf;
|
|
|
|
float *rcp_h_buf;
|
|
|
|
float *sono_v_buf;
|
|
|
|
float *bar_v_buf;
|
2016-10-13 01:00:24 +02:00
|
|
|
float cmatrix[3][3];
|
2016-10-19 17:17:24 +02:00
|
|
|
float cscheme_v[6];
|
2015-10-25 19:18:41 +02:00
|
|
|
/* callback */
|
|
|
|
void (*cqt_calc)(FFTComplex *dst, const FFTComplex *src, const Coeffs *coeffs,
|
2015-10-28 04:23:40 +02:00
|
|
|
int len, int fft_len);
|
2016-06-04 09:33:05 +02:00
|
|
|
void (*permute_coeffs)(float *v, int len);
|
2015-10-25 19:18:41 +02:00
|
|
|
void (*draw_bar)(AVFrame *out, const float *h, const float *rcp_h,
|
2016-10-28 07:55:04 +02:00
|
|
|
const ColorFloat *c, int bar_h, float bar_t);
|
2015-10-25 19:18:41 +02:00
|
|
|
void (*draw_axis)(AVFrame *out, AVFrame *axis, const ColorFloat *c, int off);
|
|
|
|
void (*draw_sono)(AVFrame *out, AVFrame *sono, int off, int idx);
|
|
|
|
void (*update_sono)(AVFrame *sono, const ColorFloat *c, int idx);
|
2016-03-06 07:54:32 +02:00
|
|
|
/* performance debugging */
|
|
|
|
int64_t fft_time;
|
|
|
|
int64_t cqt_time;
|
|
|
|
int64_t process_cqt_time;
|
|
|
|
int64_t update_sono_time;
|
|
|
|
int64_t alloc_time;
|
|
|
|
int64_t bar_time;
|
|
|
|
int64_t axis_time;
|
|
|
|
int64_t sono_time;
|
2015-10-25 19:18:41 +02:00
|
|
|
/* option */
|
|
|
|
int width, height;
|
|
|
|
AVRational rate;
|
|
|
|
int bar_h;
|
|
|
|
int axis_h;
|
|
|
|
int sono_h;
|
|
|
|
int fullhd; /* deprecated */
|
|
|
|
char *sono_v;
|
|
|
|
char *bar_v;
|
|
|
|
float sono_g;
|
|
|
|
float bar_g;
|
2016-10-28 07:55:04 +02:00
|
|
|
float bar_t;
|
2015-10-25 19:18:41 +02:00
|
|
|
double timeclamp;
|
2017-04-08 04:55:06 +02:00
|
|
|
double attack;
|
2015-10-25 19:18:41 +02:00
|
|
|
double basefreq;
|
|
|
|
double endfreq;
|
|
|
|
float coeffclamp; /* deprecated - ignored */
|
|
|
|
char *tlength;
|
|
|
|
int count;
|
|
|
|
int fcount;
|
|
|
|
char *fontfile;
|
2016-10-17 00:59:57 +02:00
|
|
|
char *font;
|
2015-10-25 19:18:41 +02:00
|
|
|
char *fontcolor;
|
|
|
|
char *axisfile;
|
|
|
|
int axis;
|
2016-10-13 01:00:24 +02:00
|
|
|
int csp;
|
2016-10-19 17:17:24 +02:00
|
|
|
char *cscheme;
|
2015-10-25 19:18:41 +02:00
|
|
|
} ShowCQTContext;
|
|
|
|
|
2016-06-04 09:33:05 +02:00
|
|
|
void ff_showcqt_init_x86(ShowCQTContext *s);
|
|
|
|
|
2015-10-25 19:18:41 +02:00
|
|
|
#endif
|