FFmpeg
avf_showcqt.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Muhammad Faiz <mfcc64@gmail.com>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVFILTER_SHOWCQT_H
22 #define AVFILTER_SHOWCQT_H
23 
24 #include "libavutil/tx.h"
25 #include "avfilter.h"
26 #include "internal.h"
27 
28 typedef struct Coeffs {
29  float *val;
30  int start, len;
31 } Coeffs;
32 
33 typedef struct RGBFloat {
34  float r, g, b;
35 } RGBFloat;
36 
37 typedef struct YUVFloat {
38  float y, u, v;
39 } YUVFloat;
40 
41 typedef union {
44 } ColorFloat;
45 
46 typedef struct ShowCQTContext {
47  const AVClass *class;
52  int sono_idx;
54  int step;
59  int64_t next_pts;
60  double *freq;
68  float *attack_data;
69  int fft_bits;
70  int fft_len;
71  int cqt_len;
72  int cqt_align;
74  float *h_buf;
75  float *rcp_h_buf;
76  float *sono_v_buf;
77  float *bar_v_buf;
78  float cmatrix[3][3];
79  float cscheme_v[6];
80  /* callback */
81  void (*cqt_calc)(AVComplexFloat *dst, const AVComplexFloat *src, const Coeffs *coeffs,
82  int len, int fft_len);
83  void (*permute_coeffs)(float *v, int len);
84  void (*draw_bar)(AVFrame *out, const float *h, const float *rcp_h,
85  const ColorFloat *c, int bar_h, float bar_t);
86  void (*draw_axis)(AVFrame *out, AVFrame *axis, const ColorFloat *c, int off);
87  void (*draw_sono)(AVFrame *out, AVFrame *sono, int off, int idx);
88  void (*update_sono)(AVFrame *sono, const ColorFloat *c, int idx);
89  /* performance debugging */
90  int64_t fft_time;
91  int64_t cqt_time;
94  int64_t alloc_time;
95  int64_t bar_time;
96  int64_t axis_time;
97  int64_t sono_time;
98  /* option */
99  int width, height;
101  int bar_h;
102  int axis_h;
103  int sono_h;
104  int fullhd; /* deprecated */
105  char *sono_v;
106  char *bar_v;
107  float sono_g;
108  float bar_g;
109  float bar_t;
110  double timeclamp;
111  double attack;
112  double basefreq;
113  double endfreq;
114  float coeffclamp; /* deprecated - ignored */
115  char *tlength;
116  int count;
117  int fcount;
118  char *fontfile;
119  char *font;
120  char *fontcolor;
121  char *axisfile;
122  int axis;
123  int csp;
124  char *cscheme;
126 
128 
129 #endif
ShowCQTContext::coeffs
Coeffs * coeffs
Definition: avf_showcqt.h:63
ShowCQTContext::next_pts
int64_t next_pts
Definition: avf_showcqt.h:59
ShowCQTContext::bar_g
float bar_g
Definition: avf_showcqt.h:108
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
YUVFloat::v
float v
Definition: avf_showcqt.h:38
ShowCQTContext::fullhd
int fullhd
Definition: avf_showcqt.h:104
ShowCQTContext::bar_v_buf
float * bar_v_buf
Definition: avf_showcqt.h:77
out
FILE * out
Definition: movenc.c:54
ColorFloat
Definition: avf_showcqt.h:41
AVTXContext
Definition: tx_priv.h:110
ShowCQTContext::cqt_align
int cqt_align
Definition: avf_showcqt.h:72
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:317
ShowCQTContext::step
int step
Definition: avf_showcqt.h:54
AVComplexFloat
Definition: tx.h:27
ShowCQTContext::fft_len
int fft_len
Definition: avf_showcqt.h:70
ShowCQTContext::step_frac
AVRational step_frac
Definition: avf_showcqt.h:55
ShowCQTContext::sono_g
float sono_g
Definition: avf_showcqt.h:107
ShowCQTContext::width
int width
Definition: avf_showcqt.h:99
ShowCQTContext::fcount
int fcount
Definition: avf_showcqt.h:117
ShowCQTContext::axisfile
char * axisfile
Definition: avf_showcqt.h:121
ShowCQTContext::update_sono
void(* update_sono)(AVFrame *sono, const ColorFloat *c, int idx)
Definition: avf_showcqt.h:88
ShowCQTContext::basefreq
double basefreq
Definition: avf_showcqt.h:112
ShowCQTContext::attack
double attack
Definition: avf_showcqt.h:111
ShowCQTContext::remaining_fill
int remaining_fill
Definition: avf_showcqt.h:57
ShowCQTContext::cmatrix
float cmatrix[3][3]
Definition: avf_showcqt.h:78
ShowCQTContext::fft_time
int64_t fft_time
Definition: avf_showcqt.h:90
ShowCQTContext::sono_idx
int sono_idx
Definition: avf_showcqt.h:52
ShowCQTContext::sono_count
int sono_count
Definition: avf_showcqt.h:53
ShowCQTContext::bar_time
int64_t bar_time
Definition: avf_showcqt.h:95
ShowCQTContext::rcp_h_buf
float * rcp_h_buf
Definition: avf_showcqt.h:75
av_tx_fn
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
Definition: tx.h:102
ShowCQTContext::sono_v
char * sono_v
Definition: avf_showcqt.h:105
s
#define s(width, name)
Definition: cbs_vp9.c:257
RGBFloat::g
float g
Definition: avf_showcqt.h:34
RGBFloat::b
float b
Definition: avf_showcqt.h:34
ShowCQTContext::remaining_frac
int remaining_frac
Definition: avf_showcqt.h:56
ShowCQTContext::axis_frame
AVFrame * axis_frame
Definition: avf_showcqt.h:49
ShowCQTContext
Definition: avf_showcqt.h:46
ShowCQTContext::axis_h
int axis_h
Definition: avf_showcqt.h:102
ShowCQTContext::rate
AVRational rate
Definition: avf_showcqt.h:100
ShowCQTContext::fontfile
char * fontfile
Definition: avf_showcqt.h:118
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ShowCQTContext::remaining_fill_max
int remaining_fill_max
Definition: avf_showcqt.h:58
ShowCQTContext::coeffclamp
float coeffclamp
Definition: avf_showcqt.h:114
ShowCQTContext::draw_axis
void(* draw_axis)(AVFrame *out, AVFrame *axis, const ColorFloat *c, int off)
Definition: avf_showcqt.h:86
ShowCQTContext::axis_time
int64_t axis_time
Definition: avf_showcqt.h:96
ShowCQTContext::fft_input
AVComplexFloat * fft_input
Definition: avf_showcqt.h:65
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
ShowCQTContext::tx_fn
av_tx_fn tx_fn
Definition: avf_showcqt.h:62
src
#define src
Definition: vp8dsp.c:255
ShowCQTContext::draw_bar
void(* draw_bar)(AVFrame *out, const float *h, const float *rcp_h, const ColorFloat *c, int bar_h, float bar_t)
Definition: avf_showcqt.h:84
ShowCQTContext::tlength
char * tlength
Definition: avf_showcqt.h:115
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
ShowCQTContext::font
char * font
Definition: avf_showcqt.h:119
YUVFloat::y
float y
Definition: avf_showcqt.h:38
ShowCQTContext::fft_bits
int fft_bits
Definition: avf_showcqt.h:69
ShowCQTContext::cqt_result
AVComplexFloat * cqt_result
Definition: avf_showcqt.h:67
RGBFloat
Definition: avf_showcqt.h:33
ShowCQTContext::fft_result
AVComplexFloat * fft_result
Definition: avf_showcqt.h:66
ShowCQTContext::count
int count
Definition: avf_showcqt.h:116
ShowCQTContext::axis
int axis
Definition: avf_showcqt.h:122
ShowCQTContext::fft_data
AVComplexFloat * fft_data
Definition: avf_showcqt.h:64
Coeffs::val
float * val
Definition: avf_showcqt.h:29
ShowCQTContext::permute_coeffs
void(* permute_coeffs)(float *v, int len)
Definition: avf_showcqt.h:83
ShowCQTContext::attack_data
float * attack_data
Definition: avf_showcqt.h:68
ShowCQTContext::fontcolor
char * fontcolor
Definition: avf_showcqt.h:120
ShowCQTContext::h_buf
float * h_buf
Definition: avf_showcqt.h:74
ColorFloat::rgb
RGBFloat rgb
Definition: avf_showcqt.h:42
ShowCQTContext::fft_ctx
AVTXContext * fft_ctx
Definition: avf_showcqt.h:61
ShowCQTContext::ctx
AVFilterContext * ctx
Definition: avf_showcqt.h:48
ShowCQTContext::timeclamp
double timeclamp
Definition: avf_showcqt.h:110
internal.h
ShowCQTContext::process_cqt_time
int64_t process_cqt_time
Definition: avf_showcqt.h:92
Coeffs::len
int len
Definition: avf_showcqt.h:30
ShowCQTContext::endfreq
double endfreq
Definition: avf_showcqt.h:113
ShowCQTContext::sono_time
int64_t sono_time
Definition: avf_showcqt.h:97
len
int len
Definition: vorbis_enc_data.h:426
ShowCQTContext::sono_frame
AVFrame * sono_frame
Definition: avf_showcqt.h:50
RGBFloat::r
float r
Definition: avf_showcqt.h:34
Coeffs::start
int start
Definition: avf_showcqt.h:30
Coeffs
Definition: af_atilt.c:28
ShowCQTContext::bar_h
int bar_h
Definition: avf_showcqt.h:101
ShowCQTContext::csp
int csp
Definition: avf_showcqt.h:123
avfilter.h
ShowCQTContext::freq
double * freq
Definition: avf_showcqt.h:60
ShowCQTContext::cqt_len
int cqt_len
Definition: avf_showcqt.h:71
ff_showcqt_init_x86
void ff_showcqt_init_x86(ShowCQTContext *s)
Definition: avf_showcqt_init.c:47
AVFilterContext
An instance of a filter.
Definition: avfilter.h:402
ShowCQTContext::draw_sono
void(* draw_sono)(AVFrame *out, AVFrame *sono, int off, int idx)
Definition: avf_showcqt.h:87
ShowCQTContext::sono_v_buf
float * sono_v_buf
Definition: avf_showcqt.h:76
ShowCQTContext::height
int height
Definition: avf_showcqt.h:99
ShowCQTContext::sono_h
int sono_h
Definition: avf_showcqt.h:103
ShowCQTContext::bar_v
char * bar_v
Definition: avf_showcqt.h:106
ShowCQTContext::cqt_calc
void(* cqt_calc)(AVComplexFloat *dst, const AVComplexFloat *src, const Coeffs *coeffs, int len, int fft_len)
Definition: avf_showcqt.h:81
h
h
Definition: vp9dsp_template.c:2038
ShowCQTContext::cscheme
char * cscheme
Definition: avf_showcqt.h:124
ColorFloat::yuv
YUVFloat yuv
Definition: avf_showcqt.h:43
ShowCQTContext::format
enum AVPixelFormat format
Definition: avf_showcqt.h:51
ShowCQTContext::c_buf
ColorFloat * c_buf
Definition: avf_showcqt.h:73
ShowCQTContext::cscheme_v
float cscheme_v[6]
Definition: avf_showcqt.h:79
YUVFloat
Definition: avf_showcqt.h:37
ShowCQTContext::alloc_time
int64_t alloc_time
Definition: avf_showcqt.h:94
YUVFloat::u
float u
Definition: avf_showcqt.h:38
tx.h
ShowCQTContext::bar_t
float bar_t
Definition: avf_showcqt.h:109
ShowCQTContext::update_sono_time
int64_t update_sono_time
Definition: avf_showcqt.h:93
ShowCQTContext::cqt_time
int64_t cqt_time
Definition: avf_showcqt.h:91