35#define OFFSET(x) offsetof(CrystalizerContext, x)
36#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
55#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed) \
56static int filter_## inverse ##_## fmt ##_## clp(AVFilterContext *ctx, \
57 void *arg, int jobnr,\
60 ThreadData *td = arg; \
63 const void **s = td->s; \
64 const int nb_samples = td->nb_samples; \
65 const int channels = td->channels; \
66 const type mult = td->mult; \
67 const type scale = one / (-mult + one); \
68 const int start = ff_slice_pos(channels, jobnr, nb_jobs); \
69 const int end = ff_slice_pos(channels, jobnr + 1, nb_jobs); \
73 for (int c = start; c < end; c++) { \
74 const type *src = s[0]; \
77 for (int n = 0; n < nb_samples; n++) { \
78 type current = src[c]; \
81 dst[c] = (current - prv[c] * mult) * scale; \
84 dst[c] = current + (current - prv[c]) * mult; \
88 dst[c] = clip_fn(dst[c], -one, one); \
96 for (int c = start; c < end; c++) { \
97 const type *src = s[c]; \
101 for (int n = 0; n < nb_samples; n++) { \
102 type current = src[n]; \
105 dst[n] = (current - prv[0] * mult) * scale; \
108 dst[n] = current + (current - prv[0]) * mult; \
112 dst[n] = clip_fn(dst[n], -one, one); \
146 switch (inlink->format) {
147 case AV_SAMPLE_FMT_FLT:
148 s->filter[0][0] = filter_inverse_flt_noclip;
149 s->filter[1][0] = filter_noinverse_flt_noclip;
150 s->filter[0][1] = filter_inverse_flt_clip;
151 s->filter[1][1] = filter_noinverse_flt_clip;
153 case AV_SAMPLE_FMT_FLTP:
154 s->filter[0][0] = filter_inverse_fltp_noclip;
155 s->filter[1][0] = filter_noinverse_fltp_noclip;
156 s->filter[0][1] = filter_inverse_fltp_clip;
157 s->filter[1][1] = filter_noinverse_fltp_clip;
159 case AV_SAMPLE_FMT_DBL:
160 s->filter[0][0] = filter_inverse_dbl_noclip;
161 s->filter[1][0] = filter_noinverse_dbl_noclip;
162 s->filter[0][1] = filter_inverse_dbl_clip;
163 s->filter[1][1] = filter_noinverse_dbl_clip;
165 case AV_SAMPLE_FMT_DBLP:
166 s->filter[0][0] = filter_inverse_dblp_noclip;
167 s->filter[1][0] = filter_noinverse_dblp_noclip;
168 s->filter[0][1] = filter_inverse_dblp_clip;
169 s->filter[1][1] = filter_noinverse_dblp_clip;
205 td.
d = (
void **)
out->extended_data;
207 td.
p = (
void **)
s->prev->extended_data;
210 td.
mult =
ctx->is_disabled ? 0.f :
s->mult;
237 .p.name =
"crystalizer",
239 .p.priv_class = &crystalizer_class,
static const AVFilterPad inputs[]
static int config_input(AVFilterLink *inlink)
static const AVOption crystalizer_options[]
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
const FFFilter ff_af_crystalizer
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static av_cold void uninit(AVFilterContext *ctx)
static AVFormatContext * ctx
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.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Main libavfilter public API header.
Public libavutil channel layout APIs header.
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
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.
@ AV_SAMPLE_FMT_FLTP
float, planar
@ AV_SAMPLE_FMT_DBLP
double, planar
@ AV_SAMPLE_FMT_DBL
double
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int16_t mult(Float11 *f1, Float11 *f2)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FILTER_SAMPLEFMTS(...)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
A link between two filters.
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
AVFilterContext * dst
dest filter
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
AVChannelLayout ch_layout
Channel layout of the audio data.
uint8_t ** extended_data
pointers to the data planes/channels.
int(* filter[2][2])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Used for passing data between threads.