93 #define OFFSET(x) offsetof(ShowWavesContext, x) 94 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM 107 {
"split_channels",
"draw channels separately",
OFFSET(split_channels),
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
108 {
"colors",
"set channels colors",
OFFSET(colors),
AV_OPT_TYPE_STRING, {.str =
"red|green|blue|yellow|orange|lime|pink|magenta|brown" }, 0, 0, FLAGS },
177 return height/2 -
av_rescale(sample, height/2, INT16_MAX);
187 return height/2 -
FFSIGN(sample) * (log10(1 +
FFABS(sample)) * (height/2) / log10(1 + INT16_MAX));
192 return log10(1 +
FFABS(sample)) * height / log10(1 + INT16_MAX);
197 return height/2 -
FFSIGN(sample) * (sqrt(
FFABS(sample)) * (height/2) / sqrt(INT16_MAX));
202 return sqrt(
FFABS(sample)) * height / sqrt(INT16_MAX);
219 if (h >= 0 && h < height) {
220 buf[h * linesize + 0] += color[0];
221 buf[h * linesize + 1] += color[1];
222 buf[h * linesize + 2] += color[2];
223 buf[h * linesize + 3] += color[3];
231 if (h >= 0 && h < height) {
232 buf[h * linesize + 0] = color[0];
233 buf[h * linesize + 1] = color[1];
234 buf[h * linesize + 2] = color[2];
235 buf[h * linesize + 3] = color[3];
244 int start = height/2;
245 int end = av_clip(h, 0, height-1);
247 FFSWAP(int16_t, start, end);
248 for (k = start; k <
end; k++) {
249 buf[k * linesize + 0] += color[0];
250 buf[k * linesize + 1] += color[1];
251 buf[k * linesize + 2] += color[2];
252 buf[k * linesize + 3] += color[3];
261 int start = height/2;
262 int end = av_clip(h, 0, height-1);
264 FFSWAP(int16_t, start, end);
265 for (k = start; k <
end; k++) {
266 buf[k * linesize + 0] = color[0];
267 buf[k * linesize + 1] = color[1];
268 buf[k * linesize + 2] = color[2];
269 buf[k * linesize + 3] = color[3];
278 if (h >= 0 && h < height) {
279 buf[h * linesize + 0] += color[0];
280 buf[h * linesize + 1] += color[1];
281 buf[h * linesize + 2] += color[2];
282 buf[h * linesize + 3] += color[3];
283 if (*prev_y && h != *prev_y) {
285 int end = av_clip(h, 0, height-1);
287 FFSWAP(int16_t, start, end);
288 for (k = start + 1; k <
end; k++) {
289 buf[k * linesize + 0] += color[0];
290 buf[k * linesize + 1] += color[1];
291 buf[k * linesize + 2] += color[2];
292 buf[k * linesize + 3] += color[3];
304 if (h >= 0 && h < height) {
305 buf[h * linesize + 0] = color[0];
306 buf[h * linesize + 1] = color[1];
307 buf[h * linesize + 2] = color[2];
308 buf[h * linesize + 3] = color[3];
309 if (*prev_y && h != *prev_y) {
311 int end = av_clip(h, 0, height-1);
313 FFSWAP(int16_t, start, end);
314 for (k = start + 1; k <
end; k++) {
315 buf[k * linesize + 0] = color[0];
316 buf[k * linesize + 1] = color[1];
317 buf[k * linesize + 2] = color[2];
318 buf[k * linesize + 3] = color[3];
330 const int start = (height -
h) / 2;
331 const int end = start +
h;
332 for (k = start; k <
end; k++) {
333 buf[k * linesize + 0] += color[0];
334 buf[k * linesize + 1] += color[1];
335 buf[k * linesize + 2] += color[2];
336 buf[k * linesize + 3] += color[3];
344 const int start = (height -
h) / 2;
345 const int end = start +
h;
346 for (k = start; k <
end; k++) {
347 buf[k * linesize + 0] = color[0];
348 buf[k * linesize + 1] = color[1];
349 buf[k * linesize + 2] = color[2];
350 buf[k * linesize + 3] = color[3];
358 if (h >= 0 && h < height)
359 buf[h * linesize] += color[0];
367 int start = height/2;
368 int end = av_clip(h, 0, height-1);
370 FFSWAP(int16_t, start, end);
371 for (k = start; k <
end; k++)
372 buf[k * linesize] += color[0];
380 if (h >= 0 && h < height) {
381 buf[h * linesize] += color[0];
382 if (*prev_y && h != *prev_y) {
384 int end = av_clip(h, 0, height-1);
386 FFSWAP(int16_t, start, end);
387 for (k = start + 1; k <
end; k++)
388 buf[k * linesize] += color[0];
399 const int start = (height -
h) / 2;
400 const int end = start +
h;
401 for (k = start; k <
end; k++)
402 buf[k * linesize] += color[0];
411 char *colors, *saveptr =
NULL;
426 outlink->
w = showwaves->
w;
427 outlink->
h = showwaves->
h;
436 switch (outlink->
format) {
438 switch (showwaves->
mode) {
449 switch (showwaves->
mode) {
461 switch (showwaves->
scale) {
463 switch (showwaves->
mode) {
473 switch (showwaves->
mode) {
483 switch (showwaves->
mode) {
493 switch (showwaves->
mode) {
519 uint8_t fg[4] = { 0xff, 0xff, 0xff, 0xff };
527 showwaves->
fg[4*ch + 0] = fg[0] * x / 255.;
528 showwaves->
fg[4*ch + 1] = fg[1] * x / 255.;
529 showwaves->
fg[4*ch + 2] = fg[2] * x / 255.;
530 showwaves->
fg[4*ch + 3] = fg[3] * x / 255.;
534 showwaves->
fg[4 * ch + 0] = x;
567 const int linesize = out->
linesize[0];
568 const int pixstep = showwaves->
pixstep;
570 int64_t *sum = showwaves->
sum;
572 if (max_samples == 0) {
577 av_log(ctx,
AV_LOG_DEBUG,
"Create frame averaging %"PRId64
" samples per column\n", max_samples);
579 memset(sum, 0, nb_channels);
584 const int16_t *p = (
const int16_t *)frame->
data[0];
590 sum[ch] += abs(p[ch + i*nb_channels]) << 1;
591 if (n++ == max_samples) {
593 int16_t
sample = sum[
ch] / max_samples;
598 buf += ch*ch_height*linesize;
600 h = showwaves->
get_h(sample, ch_height);
601 showwaves->
draw_sample(buf, ch_height, linesize, &showwaves->
buf_idy[ch], &showwaves->
fg[ch * 4], h);
646 for (j = 0; j < outlink->
h; j++)
656 if (!strcmp(ctx->
filter->
name,
"showwavespic")) {
664 #if CONFIG_SHOWWAVES_FILTER 673 int16_t *p = (int16_t *)insamples->
data[0];
676 const int pixstep = showwaves->
pixstep;
677 const int n = showwaves->
n;
681 for (i = 0; i < nb_samples; i++) {
690 const int linesize = outpicref->
linesize[0];
694 buf += j*ch_height*linesize;
695 h = showwaves->
get_h(*p++, ch_height);
697 &showwaves->
buf_idy[j], &showwaves->
fg[j * 4], h);
705 if (showwaves->
buf_idx == showwaves->
w)
720 .filter_frame = showwaves_filter_frame,
742 .
inputs = showwaves_inputs,
744 .priv_class = &showwaves_class,
747 #endif // CONFIG_SHOWWAVES_FILTER 749 #if CONFIG_SHOWWAVESPIC_FILTER 751 #define OFFSET(x) offsetof(ShowWavesContext, x) 752 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM 754 static const AVOption showwavespic_options[] = {
758 {
"colors",
"set channels colors",
OFFSET(colors),
AV_OPT_TYPE_STRING, {.str =
"red|green|blue|yellow|orange|lime|pink|magenta|brown" }, 0, 0,
FLAGS },
769 static int showwavespic_config_input(
AVFilterLink *inlink)
788 int16_t *p = (int16_t *)insamples->
data[0];
804 f->
frame = insamples;
827 .config_props = showwavespic_config_input,
828 .filter_frame = showwavespic_filter_frame,
833 static const AVFilterPad showwavespic_outputs[] = {
844 .
name =
"showwavespic",
850 .
inputs = showwavespic_inputs,
851 .
outputs = showwavespic_outputs,
852 .priv_class = &showwavespic_class,
855 #endif // CONFIG_SHOWWAVESPIC_FILTER
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
This structure describes decoded (raw) audio or video data.
int(* get_h)(int16_t sample, int height)
static int alloc_out_frame(ShowWavesContext *showwaves, const int16_t *p, const AVFilterLink *inlink, AVFilterLink *outlink, const AVFrame *in)
Main libavfilter public API header.
int h
agreed upon image height
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(INT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&HAVE_MMX) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out-> ch ch
static void draw_sample_line_gray(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static void draw_sample_p2p_rgba_scale(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
static av_cold int end(AVCodecContext *avctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static av_cold void uninit(AVFilterContext *ctx)
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
static void draw_sample_cline_rgba_scale(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx)
Put the RGBA values that correspond to color_string in rgba_color.
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void draw_sample_cline_rgba_full(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists.
int sample_rate
samples per second
struct frame_node * last_frame
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert().
struct AVFilterChannelLayouts * out_channel_layouts
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
AVFilter ff_avf_showwavespic
static int get_lin_h2(int16_t sample, int height)
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int w
agreed upon image width
static int get_cbrt_h(int16_t sample, int height)
audio channel layout utility functions
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
struct frame_node * audio_frames
static void draw_sample_line_rgba_full(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
static int push_single_pic(AVFilterLink *outlink)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
AVFilterFormats * out_samplerates
static const AVFilterPad outputs[]
int format
agreed upon media format
A list of supported channel layouts.
static void draw_sample_point_rgba_scale(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
char * av_strdup(const char *s)
Duplicate a string.
AVSampleFormat
Audio sample formats.
static int config_output(AVFilterLink *outlink)
typedef void(RENAME(mix_any_func_type))
static int push_frame(AVFilterLink *outlink)
static int get_cbrt_h2(int16_t sample, int height)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static int request_frame(AVFilterLink *outlink)
static AVRational av_make_q(int num, int den)
Create an AVRational.
static int get_log_h2(int16_t sample, int height)
int draw_mode
ShowWavesDrawMode.
static int get_log_h(int16_t sample, int height)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
AVFILTER_DEFINE_CLASS(showwaves)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
static int query_formats(AVFilterContext *ctx)
offset must point to AVRational
static void draw_sample_line_rgba_scale(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
const char * name
Filter name.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
static void draw_sample_point_gray(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
offset must point to two consecutive integers
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
static enum AVPixelFormat pix_fmts[]
static int get_sqrt_h2(int16_t sample, int height)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok()...
static void draw_sample_point_rgba_full(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
static void draw_sample_p2p_rgba_full(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
static void draw_sample_p2p_gray(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
static int get_sqrt_h(int16_t sample, int height)
int channels
Number of channels.
static int get_lin_h(int16_t sample, int height)
AVFilterContext * dst
dest filter
static enum AVSampleFormat sample_fmts[]
void(* draw_sample)(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
#define av_malloc_array(a, b)
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
#define FFSWAP(type, a, b)
AVFilter ff_avf_showwaves
static const AVOption showwaves_options[]
static av_cold int init(AVFilterContext *ctx)
AVPixelFormat
Pixel format.
mode
Use these values in ebur128_init (or'ed).
int nb_samples
number of audio samples (per channel) described by this frame
const AVFilter * filter
the AVFilter of which this is an instance
static void draw_sample_cline_gray(uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
AVFilterFormats * out_formats
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().