avf_showcqt.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. #ifndef AVFILTER_SHOWCQT_H
  21. #define AVFILTER_SHOWCQT_H
  22. #include "libavcodec/avfft.h"
  23. #include "avfilter.h"
  24. #include "internal.h"
  25. typedef struct {
  26. FFTSample *val;
  27. int start, len;
  28. } Coeffs;
  29. enum CoeffsType {
  30. COEFFS_TYPE_DEFAULT,
  31. COEFFS_TYPE_INTERLEAVE
  32. };
  33. typedef struct {
  34. float r, g, b;
  35. } RGBFloat;
  36. typedef struct {
  37. float y, u, v;
  38. } YUVFloat;
  39. typedef union {
  40. RGBFloat rgb;
  41. YUVFloat yuv;
  42. } ColorFloat;
  43. typedef struct {
  44. const AVClass *class;
  45. AVFilterContext *ctx;
  46. AVFrame *axis_frame;
  47. AVFrame *sono_frame;
  48. enum AVPixelFormat format;
  49. int sono_idx;
  50. int sono_count;
  51. int step;
  52. AVRational step_frac;
  53. int remaining_frac;
  54. int remaining_fill;
  55. int64_t frame_count;
  56. double *freq;
  57. FFTContext *fft_ctx;
  58. Coeffs *coeffs;
  59. FFTComplex *fft_data;
  60. FFTComplex *fft_result;
  61. FFTComplex *cqt_result;
  62. int fft_bits;
  63. int fft_len;
  64. int cqt_len;
  65. int cqt_align;
  66. enum CoeffsType cqt_coeffs_type;
  67. ColorFloat *c_buf;
  68. float *h_buf;
  69. float *rcp_h_buf;
  70. float *sono_v_buf;
  71. float *bar_v_buf;
  72. /* callback */
  73. void (*cqt_calc)(FFTComplex *dst, const FFTComplex *src, const Coeffs *coeffs,
  74. int len, int fft_len);
  75. void (*draw_bar)(AVFrame *out, const float *h, const float *rcp_h,
  76. const ColorFloat *c, int bar_h);
  77. void (*draw_axis)(AVFrame *out, AVFrame *axis, const ColorFloat *c, int off);
  78. void (*draw_sono)(AVFrame *out, AVFrame *sono, int off, int idx);
  79. void (*update_sono)(AVFrame *sono, const ColorFloat *c, int idx);
  80. /* option */
  81. int width, height;
  82. AVRational rate;
  83. int bar_h;
  84. int axis_h;
  85. int sono_h;
  86. int fullhd; /* deprecated */
  87. char *sono_v;
  88. char *bar_v;
  89. float sono_g;
  90. float bar_g;
  91. double timeclamp;
  92. double basefreq;
  93. double endfreq;
  94. float coeffclamp; /* deprecated - ignored */
  95. char *tlength;
  96. int count;
  97. int fcount;
  98. char *fontfile;
  99. char *fontcolor;
  100. char *axisfile;
  101. int axis;
  102. } ShowCQTContext;
  103. #endif