summaryrefslogtreecommitdiffstats
path: root/libavfilter/avf_showcqt.h
diff options
context:
space:
mode:
authorMuhammad Faiz <mfcc64@gmail.com>2015-10-26 00:18:41 +0700
committerMichael Niedermayer <michael@niedermayer.cc>2015-10-28 02:30:03 +0100
commitf8d429e0c569d4f4ffd87af80e7375b3a6278869 (patch)
treea03b4f456a1b9a54df87d6569dfef2d619a5d0a8 /libavfilter/avf_showcqt.h
parent232b8a5a438ae1eb9efc7e535d9c1809ac164e5c (diff)
downloadffmpeg-streaming-f8d429e0c569d4f4ffd87af80e7375b3a6278869.zip
ffmpeg-streaming-f8d429e0c569d4f4ffd87af80e7375b3a6278869.tar.gz
avfilter/avf_showcqt: rewrite showcqt and add features
add yuv444p, yuv422p, and yuv420p output format (lower cpu usage on ffplay playback because it does not do format conversion) custom size with size/s option (fullhd option is deprecated) custom layout with bar_h, axis_h, and sono_h option support rational frame rate (within fps/r/rate option) relaxed frame rate restriction (support fractional sample step) support all input sample rates separate sonogram and bargraph volume (with volume/sono_v and volume2/bar_v) timeclamp option alias (timeclamp/tc) fcount option gamma option alias (gamma/sono_g and gamma2/bar_g) support custom frequency range (basefreq and endfreq) support drawing axis using external image file (axisfile option) alias for disabling drawing to axis (text/axis) possibility to optimize it using arch specific asm code Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/avf_showcqt.h')
-rw-r--r--libavfilter/avf_showcqt.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/libavfilter/avf_showcqt.h b/libavfilter/avf_showcqt.h
new file mode 100644
index 0000000..244c690
--- /dev/null
+++ b/libavfilter/avf_showcqt.h
@@ -0,0 +1,112 @@
+/*
+ * 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
+ */
+
+#ifndef AVFILTER_AVF_SHOWCQT_H
+#define AVFILTER_AVF_SHOWCQT_H
+
+#include "libavcodec/avfft.h"
+#include "avfilter.h"
+#include "internal.h"
+
+typedef struct {
+ FFTSample *val;
+ int start, len;
+} Coeffs;
+
+enum CoeffsType {
+ COEFFS_TYPE_DEFAULT,
+ COEFFS_TYPE_INTERLEAVE
+};
+
+typedef struct {
+ float r, g, b;
+} RGBFloat;
+
+typedef struct {
+ float y, u, v;
+} YUVFloat;
+
+typedef union {
+ RGBFloat rgb;
+ YUVFloat yuv;
+} ColorFloat;
+
+typedef struct {
+ 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;
+ int64_t frame_count;
+ double *freq;
+ FFTContext *fft_ctx;
+ Coeffs *coeffs;
+ FFTComplex *fft_data;
+ FFTComplex *fft_result;
+ FFTComplex *cqt_result;
+ int fft_bits;
+ int fft_len;
+ int cqt_len;
+ int cqt_align;
+ enum CoeffsType cqt_coeffs_type;
+ ColorFloat *c_buf;
+ float *h_buf;
+ float *rcp_h_buf;
+ float *sono_v_buf;
+ float *bar_v_buf;
+ /* callback */
+ void (*cqt_calc)(FFTComplex *dst, const FFTComplex *src, const Coeffs *coeffs,
+ int len, int fft_len);;
+ void (*draw_bar)(AVFrame *out, const float *h, const float *rcp_h,
+ const ColorFloat *c, int bar_h);
+ 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);
+ /* 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;
+ double timeclamp;
+ double basefreq;
+ double endfreq;
+ float coeffclamp; /* deprecated - ignored */
+ char *tlength;
+ int count;
+ int fcount;
+ char *fontfile;
+ char *fontcolor;
+ char *axisfile;
+ int axis;
+} ShowCQTContext;
+
+#endif
OpenPOWER on IntegriCloud