130#define OFFSET(x) offsetof(ShowCWTContext, x)
131#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
205 for (
int n = 0; n <
s->nb_threads; n++)
211 for (
int n = 0; n <
s->nb_threads; n++)
217 for (
int n = 0; n <
s->frequency_band_count; n++)
246 int frequency_band_count,
247 float frequency_range,
248 float frequency_offset,
249 int frequency_scale,
float deviation)
253 deviation =
sqrtf(deviation / (4.f *
M_PI));
254 for (
int y = 0; y < frequency_band_count; y++) {
255 float frequency = frequency_range * (1.f - (
float)y / frequency_band_count) + frequency_offset;
256 float frequency_derivative = frequency_range / frequency_band_count;
258 switch (frequency_scale) {
260 frequency =
powf(2.f, frequency);
261 frequency_derivative *= logf(2.f) * frequency;
264 frequency = 600.f * sinhf(frequency / 6.f);
265 frequency_derivative *=
sqrtf(frequency * frequency + 360000.f) / 6.f;
268 frequency = 700.f * (
powf(10.f, frequency / 2595.f) - 1.f);
269 frequency_derivative *= (frequency + 700.f) * logf(10.f) / 2595.f;
272 frequency = 676170.4f / (47.06538f -
expf(frequency * 0.08950404f)) - 14678.49f;
273 frequency_derivative *= (frequency * frequency + 14990.4f * frequency + 4577850.f) / 160514.f;
276 frequency = frequency * frequency;
277 frequency_derivative *= 2.f *
sqrtf(frequency);
280 frequency = frequency * frequency * frequency;
281 frequency_derivative *= 3.f *
powf(frequency, 2.f / 3.f);
284 frequency = frequency * frequency * frequency * frequency;
285 frequency_derivative *= 4.f *
powf(frequency, 3.f / 4.f);
288 frequency = 2.f *
powf(frequency, 3.f / 2.f) / 3.f;
289 frequency_derivative *=
sqrtf(frequency);
296 ret = 1.f / (frequency_derivative * deviation);
304 const float max =
s->maximum_intensity;
305 const float min =
s->minimum_intensity;
338 const int hop_size =
s->hop_size;
340 float *cache = (
float *)
s->cache->extended_data[ch];
343 const int offset = (
s->input_padding_size - hop_size) >> 1;
353 if (fin &&
s->hop_index + fin->
nb_samples < hop_size)
356 memset(
src, 0,
sizeof(
float) *
s->fft_size);
357 for (
int n = 0; n < hop_size; n++)
365#define DRAW_BAR_COLOR(x) \
372 float mul = (Y - ht) * bh[0]; \
373 dstY[x] = av_clip_uint8(lrintf(Y * mul * 255.f)); \
374 dstU[x] = av_clip_uint8(lrintf((U-0.5f) * 128.f + 128)); \
375 dstV[x] = av_clip_uint8(lrintf((V-0.5f) * 128.f + 128)); \
380 float Y,
float U,
float V)
382 float *bh = ((
float *)
s->bh_out->extended_data[0]) + y;
383 const ptrdiff_t ylinesize =
s->outpicref->linesize[0];
384 const ptrdiff_t ulinesize =
s->outpicref->linesize[1];
385 const ptrdiff_t vlinesize =
s->outpicref->linesize[2];
386 const int direction =
s->direction;
387 const int sono_size =
s->sono_size;
388 const int bar_size =
s->bar_size;
389 const float rcp_bar_h = 1.f / bar_size;
390 uint8_t *dstY, *dstU, *dstV;
393 bh[0] = 1.f / (
Y + 0.0001f);
396 dstY =
s->outpicref->data[0] + y * ylinesize;
397 dstU =
s->outpicref->data[1] + y * ulinesize;
398 dstV =
s->outpicref->data[2] + y * vlinesize;
399 for (
int x = 0; x < bar_size; x++) {
400 float ht = (bar_size - x) * rcp_bar_h;
405 dstY =
s->outpicref->data[0] + y * ylinesize;
406 dstU =
s->outpicref->data[1] + y * ulinesize;
407 dstV =
s->outpicref->data[2] + y * vlinesize;
408 for (
int x = 0; x < bar_size; x++) {
409 float ht = x * rcp_bar_h;
414 dstY =
s->outpicref->data[0] +
w - 1 - y;
415 dstU =
s->outpicref->data[1] +
w - 1 - y;
416 dstV =
s->outpicref->data[2] +
w - 1 - y;
417 for (
int x = 0; x < bar_size; x++) {
418 float ht = (bar_size - x) * rcp_bar_h;
426 dstY =
s->outpicref->data[0] +
w - 1 - y + ylinesize * sono_size;
427 dstU =
s->outpicref->data[1] +
w - 1 - y + ulinesize * sono_size;
428 dstV =
s->outpicref->data[2] +
w - 1 - y + vlinesize * sono_size;
429 for (
int x = 0; x < bar_size; x++) {
430 float ht = x * rcp_bar_h;
443 const ptrdiff_t ylinesize =
s->outpicref->linesize[0];
444 const ptrdiff_t ulinesize =
s->outpicref->linesize[1];
445 const ptrdiff_t vlinesize =
s->outpicref->linesize[2];
446 const ptrdiff_t alinesize =
s->outpicref->linesize[3];
447 const float log_factor = 1.f/logf(
s->logarithmic_basis);
448 const int count =
s->frequency_band_count;
450 const int end =
ff_slice_pos(count, jobnr + 1, nb_jobs);
451 const int nb_channels =
s->nb_channels;
452 const int iscale =
s->intensity_scale;
453 const int ihop_index =
s->ihop_index;
454 const int ihop_size =
s->ihop_size;
455 const float rotation =
s->rotation;
456 const int direction =
s->direction;
457 uint8_t *dstY, *dstU, *dstV, *dstA;
458 const int sono_size =
s->sono_size;
459 const int bar_size =
s->bar_size;
460 const int mode =
s->mode;
461 const int w_1 =
s->w - 1;
462 const int x =
s->pos;
465 for (
int y = start; y < end; y++) {
467 0 * ihop_size + ihop_index;
475 dstY =
s->outpicref->data[0] + y * ylinesize;
476 dstU =
s->outpicref->data[1] + y * ulinesize;
477 dstV =
s->outpicref->data[2] + y * vlinesize;
478 dstA =
s->outpicref->data[3] ?
s->outpicref->data[3] + y * alinesize :
NULL;
482 dstY =
s->outpicref->data[0] + x * ylinesize + w_1 - y;
483 dstU =
s->outpicref->data[1] + x * ulinesize + w_1 - y;
484 dstV =
s->outpicref->data[2] + x * vlinesize + w_1 - y;
485 dstA =
s->outpicref->data[3] ?
s->outpicref->data[3] + x * alinesize + w_1 - y :
NULL;
495 switch (
s->direction) {
497 memmove(dstY, dstY + 1, w_1);
498 memmove(dstU, dstU + 1, w_1);
499 memmove(dstV, dstV + 1, w_1);
501 memmove(dstA, dstA + 1, w_1);
504 memmove(dstY + 1, dstY, w_1);
505 memmove(dstU + 1, dstU, w_1);
506 memmove(dstV + 1, dstV, w_1);
508 memmove(dstA + 1, dstA, w_1);
531 u = hypotf(
src[0].re,
src[0].im);
545 U = 0.5f + 0.5f * z *
u;
546 V = 0.5f + 0.5f * z * v;
562 const int nb_channels =
s->nb_channels;
563 const float yf = 1.f / nb_channels;
567 for (
int ch = 0; ch < nb_channels; ch++) {
571 z = hypotf(srcn[0].re, srcn[0].im);
575 U += z * yf *
sinf(2.f *
M_PI * (ch * yf + rotation));
576 V += z * yf *
cosf(2.f *
M_PI * (ch * yf + rotation));
592 Y = hypotf(
src[0].re,
src[0].im);
595 U = 0.5f + 0.5f *
U *
Y /
M_PI;
611 Y = 0.5f + 0.5f *
Y /
M_PI;
623 Y = hypotf(
src[0].re,
src[0].im);
644 const int ch = *(
int *)
arg;
648 const int output_padding_size =
s->output_padding_size;
649 const int input_padding_size =
s->input_padding_size;
650 const float scale = 1.f / input_padding_size;
651 const int ihop_size =
s->ihop_size;
652 const int count =
s->frequency_band_count;
654 const int end =
ff_slice_pos(count, jobnr + 1, nb_jobs);
656 for (
int y = start; y < end; y++) {
662 const unsigned *
index = (
const unsigned *)
s->index;
663 const int kernel_start =
s->kernel_start[y];
664 const int kernel_stop =
s->kernel_stop[y];
665 const int kernel_range = kernel_stop - kernel_start + 1;
668 if (kernel_start >= 0) {
670 memcpy(srcx, fft_out + kernel_start,
sizeof(*fft_out) * kernel_range);
673 memcpy(srcx+
offset, fft_out,
sizeof(*fft_out) * (kernel_range-
offset));
674 memcpy(srcx, fft_out+input_padding_size-
offset,
sizeof(*fft_out)*
offset);
677 s->fdsp->vector_fmul_scalar((
float *)srcx, (
const float *)srcx,
scale,
FFALIGN(kernel_range * 2, 4));
678 s->fdsp->vector_fmul((
float *)dstx, (
const float *)srcx,
679 (
const float *)kernel,
FFALIGN(kernel_range * 2, 16));
681 memset(isrc, 0,
sizeof(*isrc) * output_padding_size);
683 const unsigned *kindex =
index + kernel_start;
684 for (
int i = 0;
i < kernel_range;
i++) {
685 const unsigned n = kindex[
i];
687 isrc[n].
re += dstx[
i].
re;
688 isrc[n].
im += dstx[
i].
im;
691 for (
int i = 0;
i < kernel_range;
i++) {
692 const unsigned n = (
i-kernel_start) & (output_padding_size-1);
694 isrc[n].
re += dstx[
i].
re;
695 isrc[n].
im += dstx[
i].
im;
699 s->itx_fn(
s->ifft[jobnr], idst, isrc,
sizeof(*isrc));
701 memcpy(chout, idst,
sizeof(*chout) * ihop_size);
702 for (
int n = 0; n < ihop_size; n++) {
703 chout[n].
re += over[n].
re;
704 chout[n].
im += over[n].
im;
706 memcpy(over, idst + ihop_size,
sizeof(*over) * ihop_size);
715 const int size =
s->input_padding_size;
716 const int output_sample_count =
s->output_sample_count;
717 const int fsize =
s->frequency_band_count;
718 int *kernel_start =
s->kernel_start;
719 int *kernel_stop =
s->kernel_stop;
720 unsigned *
index =
s->index;
721 int range_min = INT_MAX;
722 int range_max = 0, ret = 0;
729 for (
int y = 0; y <
fsize; y++) {
731 int start = INT_MIN, stop = INT_MAX;
732 const float frequency =
s->frequency_band[y*2];
733 const float deviation = 1.f / (
s->frequency_band[y*2+1] *
734 output_sample_count);
739 memset(tkernel, 0,
size *
sizeof(*tkernel));
740 for (
int n =
a; n <
b; n++) {
741 float ff,
f = n+0.5f-frequency;
743 ff =
expf(-
f*
f*deviation);
744 tkernel[n+
range] = ff;
747 for (
int n =
a; n <
b; n++) {
748 if (tkernel[n+
range] != 0.f) {
749 if (tkernel[n+
range] > FLT_MIN)
756 for (
int n =
b - 1; n >=
a; n--) {
757 if (tkernel[n+
range] != 0.f) {
758 if (tkernel[n+
range] > FLT_MIN)
765 if (start == INT_MIN || stop == INT_MAX) {
770 kernel_start[y] = start;
771 kernel_stop[y] = stop;
779 for (
int n = 0; n <= stop - start; n++) {
780 kernel[n].
re = tkernel[n+
range+start];
781 kernel[n].
im = tkernel[n+
range+start];
784 range_min =
FFMIN(range_min, stop+1-start);
785 range_max =
FFMAX(range_max, stop+1-start);
787 s->kernel[y] = kernel;
790 for (
int n = 0; n <
size; n++)
791 index[n] = n & (
s->output_padding_size - 1);
807 const float limit_frequency = inlink->
sample_rate * 0.5f;
808 float maximum_frequency =
fminf(
s->maximum_frequency, limit_frequency);
809 float minimum_frequency =
s->minimum_frequency;
814 if (minimum_frequency >= maximum_frequency) {
816 minimum_frequency, maximum_frequency);
826 switch (
s->direction) {
829 s->bar_size =
s->w *
s->bar_ratio;
830 s->sono_size =
s->w -
s->bar_size;
831 s->frequency_band_count =
s->h;
835 s->bar_size =
s->h *
s->bar_ratio;
836 s->sono_size =
s->h -
s->bar_size;
837 s->frequency_band_count =
s->w;
841 switch (
s->frequency_scale) {
843 minimum_frequency = logf(minimum_frequency) / logf(2.f);
844 maximum_frequency = logf(maximum_frequency) / logf(2.f);
847 minimum_frequency = 6.f * asinhf(minimum_frequency / 600.f);
848 maximum_frequency = 6.f * asinhf(maximum_frequency / 600.f);
851 minimum_frequency = 2595.f *
log10f(1.f + minimum_frequency / 700.f);
852 maximum_frequency = 2595.f *
log10f(1.f + maximum_frequency / 700.f);
855 minimum_frequency = 11.17268f * logf(1.f + (46.06538f * minimum_frequency) / (minimum_frequency + 14678.49f));
856 maximum_frequency = 11.17268f * logf(1.f + (46.06538f * maximum_frequency) / (maximum_frequency + 14678.49f));
859 minimum_frequency =
sqrtf(minimum_frequency);
860 maximum_frequency =
sqrtf(maximum_frequency);
863 minimum_frequency =
cbrtf(minimum_frequency);
864 maximum_frequency =
cbrtf(maximum_frequency);
867 minimum_frequency =
powf(minimum_frequency, 0.25f);
868 maximum_frequency =
powf(maximum_frequency, 0.25f);
871 minimum_frequency =
powf(9.f * (minimum_frequency * minimum_frequency) / 4.f, 1.f / 3.f);
872 maximum_frequency =
powf(9.f * (maximum_frequency * maximum_frequency) / 4.f, 1.f / 3.f);
876 s->frequency_band =
av_calloc(
s->frequency_band_count,
877 sizeof(*
s->frequency_band) * 2);
878 if (!
s->frequency_band)
883 s->frequency_band_count, maximum_frequency - minimum_frequency,
884 minimum_frequency,
s->frequency_scale,
s->deviation);
885 s->nb_consumed_samples =
av_clipd(nb_samples, 1, 65536);
892 s->input_sample_count = 1 << (32 -
ff_clz(
s->nb_consumed_samples));
893 s->input_padding_size = 1 << (32 -
ff_clz(
s->input_sample_count));
895 s->output_padding_size = 1 << (32 -
ff_clz(
s->output_sample_count));
897 s->hop_size =
s->input_sample_count;
898 s->ihop_size =
s->output_padding_size >> 1;
911 for (
int n = 0; n <
s->nb_threads; n++) {
921 for (
int n = 0; n <
s->nb_threads; n++) {
932 s->kernel =
av_calloc(
s->frequency_band_count,
sizeof(*
s->kernel));
939 s->index =
av_calloc(
s->input_padding_size,
sizeof(*
s->index));
940 s->kernel_start =
av_calloc(
s->frequency_band_count,
sizeof(*
s->kernel_start));
941 s->kernel_stop =
av_calloc(
s->frequency_band_count,
sizeof(*
s->kernel_stop));
942 if (!
s->outpicref || !
s->fft_in || !
s->fft_out || !
s->src_x || !
s->dst_x || !
s->over ||
943 !
s->ifft_in || !
s->ifft_out || !
s->kernel_start || !
s->kernel_stop || !
s->ch_out ||
944 !
s->cache || !
s->index || !
s->bh_out || !
s->kernel)
947 s->ch_out->format = inlink->
format;
949 s->ch_out->ch_layout.nb_channels =
s->frequency_band_count;
954 s->ifft_in->format = inlink->
format;
955 s->ifft_in->nb_samples =
s->ifft_size * 2;
956 s->ifft_in->ch_layout.nb_channels =
s->nb_threads;
961 s->ifft_out->format = inlink->
format;
962 s->ifft_out->nb_samples =
s->ifft_size * 2;
963 s->ifft_out->ch_layout.nb_channels =
s->nb_threads;
968 s->src_x->format = inlink->
format;
969 s->src_x->nb_samples =
s->fft_size * 2;
970 s->src_x->ch_layout.nb_channels =
s->nb_threads;
975 s->dst_x->format = inlink->
format;
976 s->dst_x->nb_samples =
s->fft_size * 2;
977 s->dst_x->ch_layout.nb_channels =
s->nb_threads;
982 s->outpicref->sample_aspect_ratio = (
AVRational){1,1};
984 for (
int y = 0; y < outlink->
h; y++) {
985 memset(
s->outpicref->data[0] + y *
s->outpicref->linesize[0], 0, outlink->
w);
986 memset(
s->outpicref->data[1] + y *
s->outpicref->linesize[1], 128, outlink->
w);
987 memset(
s->outpicref->data[2] + y *
s->outpicref->linesize[2], 128, outlink->
w);
988 if (
s->outpicref->data[3])
989 memset(
s->outpicref->data[3] + y *
s->outpicref->linesize[3], 0, outlink->
w);
995 for (
int n = 0; n <
s->frequency_band_count; n++) {
996 s->frequency_band[2*n ] *=
factor;
997 s->frequency_band[2*n+1] *=
factor;
1009 switch (
s->direction) {
1012 s->pos =
s->bar_size;
1016 s->pos =
FFMAX(
s->sono_size - 1, 0);
1021 if (strcmp(
s->rate_str,
"auto")) {
1026 s->frame_rate =
s->auto_frame_rate;
1043 const int nb_planes = 3 + (
s->outpicref->data[3] !=
NULL);
1048 switch (
s->direction) {
1050 for (
int p = 0; p < nb_planes; p++) {
1051 ptrdiff_t linesize =
s->outpicref->linesize[p];
1053 for (
int y =
s->h - 1; y >
s->bar_size; y--) {
1054 uint8_t *
dst =
s->outpicref->data[p] + y * linesize;
1056 memmove(
dst,
dst - linesize,
s->w);
1061 for (
int p = 0; p < nb_planes; p++) {
1062 ptrdiff_t linesize =
s->outpicref->linesize[p];
1064 for (
int y = 0; y <
s->sono_size - 1; y++) {
1065 uint8_t *
dst =
s->outpicref->data[p] + y * linesize;
1067 memmove(
dst,
dst + linesize,
s->w);
1080 switch (
s->direction) {
1083 if (
s->pos >=
s->w) {
1084 s->pos =
s->bar_size;
1091 s->pos =
FFMAX(
s->sono_size - 1, 0);
1097 if (
s->pos >=
s->h) {
1098 s->pos =
s->bar_size;
1105 s->pos =
FFMAX(
s->sono_size - 1, 0);
1112 switch (
s->direction) {
1115 s->pos =
s->bar_size;
1119 s->pos =
FFMAX(
s->sono_size - 1, 0);
1126 switch (
s->direction) {
1128 for (
int p = 0; p < nb_planes; p++) {
1129 ptrdiff_t linesize =
s->outpicref->linesize[p];
1130 const int size =
s->w -
s->pos;
1131 const int fill = p > 0 && p < 3 ? 128 : 0;
1132 const int x =
s->pos;
1134 for (
int y = 0; y <
s->h; y++) {
1135 uint8_t *
dst =
s->outpicref->data[p] + y * linesize + x;
1142 for (
int p = 0; p < nb_planes; p++) {
1143 ptrdiff_t linesize =
s->outpicref->linesize[p];
1145 const int fill = p > 0 && p < 3 ? 128 : 0;
1147 for (
int y = 0; y <
s->h; y++) {
1148 uint8_t *
dst =
s->outpicref->data[p] + y * linesize;
1155 for (
int p = 0; p < nb_planes; p++) {
1156 ptrdiff_t linesize =
s->outpicref->linesize[p];
1157 const int fill = p > 0 && p < 3 ? 128 : 0;
1159 for (
int y =
s->pos; y < s->
h; y++) {
1160 uint8_t *
dst =
s->outpicref->data[p] + y * linesize;
1162 memset(
dst, fill,
s->w);
1167 for (
int p = 0; p < nb_planes; p++) {
1168 ptrdiff_t linesize =
s->outpicref->linesize[p];
1169 const int fill = p > 0 && p < 3 ? 128 : 0;
1171 for (
int y =
FFMIN(
s->pos,
s->sono_size - 1); y >= 0; y--) {
1172 uint8_t *
dst =
s->outpicref->data[p] + y * linesize;
1174 memset(
dst, fill,
s->w);
1185 const int offset = (
s->input_padding_size -
s->hop_size) >> 1;
1189 s->outpicref->duration = 1;
1193 if (
s->ihop_index >=
s->ihop_size)
1194 s->ihop_index =
s->hop_index = 0;
1199 if (
s->old_pts <
s->outpicref->pts) {
1209 s->old_pts =
s->outpicref->pts;
1225 const int count =
s->nb_channels;
1227 const int end =
ff_slice_pos(count, jobnr + 1, nb_jobs);
1229 for (
int ch = start; ch < end; ch++)
1240 int ret = 0, status;
1248 if (
s->hop_index <
s->hop_size) {
1255 if (ret > 0 ||
s->eof) {
1257 FFMIN(
s->nb_threads,
s->nb_channels));
1259 if (
s->hop_index == 0) {
1260 s->in_pts = fin->
pts;
1267 s->hop_index =
s->hop_size;
1272 if (
s->hop_index >=
s->hop_size ||
s->ihop_index > 0) {
1273 for (
int ch = 0; ch <
s->nb_channels &&
s->ihop_index == 0; ch++) {
1301 s->hop_index >=
s->hop_size ||
s->eof) {
1323 .p.name =
"showcwt",
1324 .p.description =
NULL_IF_CONFIG_SMALL(
"Convert input audio to a CWT (Continuous Wavelet Transform) spectrum video output."),
1325 .p.priv_class = &showcwt_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static enum AVSampleFormat sample_fmts[]
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
const FFFilter ff_avf_showcwt
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
static int64_t fsize(FILE *f)
static int run_channels_cwt_prepare(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define DRAW_BAR_COLOR(x)
static float frequency_band(float *frequency_band, int frequency_band_count, float frequency_range, float frequency_offset, int frequency_scale, float deviation)
static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static const AVFilterPad showcwt_outputs[]
static int run_channel_cwt_prepare(AVFilterContext *ctx, void *arg, int jobnr, int ch)
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static int output_frame(AVFilterContext *ctx)
static void draw_bar(ShowCWTContext *s, int y, float Y, float U, float V)
static int config_output(AVFilterLink *outlink)
static const AVOption showcwt_options[]
static float remap_log(ShowCWTContext *s, float value, int iscale, float log_factor)
static int run_channel_cwt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int compute_kernel(AVFilterContext *ctx)
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
int ff_inlink_queued_samples(AVFilterLink *link)
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Main libavfilter public API header.
static void BS_FUNC skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
static __device__ float sqrtf(float a)
float fminf(float, float)
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AVERROR_EOF
End of file.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static AVRational av_make_q(int num, int den)
Create an AVRational.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_FLTP
float, planar
#define AV_NOPTS_VALUE
Undefined timestamp value.
static void scale(int *out, const int *in, const int w, const int h, const int shift)
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define u(width, name, range_min, range_max)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
static FilterLink * ff_filter_link(AVFilterLink *link)
#define AVFILTER_DEFINE_CLASS(fname)
#define FILTER_QUERY_FUNC2(func)
static const int factor[16]
size_t av_cpu_max_align(void)
Get the maximum data alignment that may be required by FFmpeg.
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
static av_always_inline float cbrtf(float x)
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
@ AVCOL_RANGE_JPEG
Full range content.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int sample_rate
samples per second
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t ** extended_data
pointers to the data planes/channels.
Rational number (pair of numerator and denominator).
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
AVRational auto_frame_rate
#define av_malloc_array(a, b)
static AVFormatContext * ctx
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
@ AV_TX_FLOAT_FFT
Standard complex to complex FFT with sample data type of AVComplexFloat, AVComplexDouble or AVComplex...
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.