Go to the documentation of this file.
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
56 int jobnr,
int nb_jobs,
62 const void **
s =
td->s;
63 const int nb_samples =
td->nb_samples;
65 const float mult =
td->mult;
67 const int start = (
channels * jobnr) / nb_jobs;
68 const int end = (
channels * (jobnr+1)) / nb_jobs;
72 for (
c = start;
c < end;
c++) {
73 const float *
src =
s[0];
76 for (n = 0; n < nb_samples; n++) {
77 float current =
src[
c];
83 dst[
c] = current + (current - prv[
c]) *
mult;
99 int jobnr,
int nb_jobs,
105 const void **
s =
td->s;
106 const int nb_samples =
td->nb_samples;
108 const double mult =
td->mult;
109 const double scale = 1.0 / (-
mult + 1.0);
110 const int start = (
channels * jobnr) / nb_jobs;
111 const int end = (
channels * (jobnr+1)) / nb_jobs;
115 for (
c = start;
c < end;
c++) {
116 const double *
src =
s[0];
119 for (n = 0; n < nb_samples; n++) {
120 double current =
src[
c];
126 dst[
c] = current + (current - prv[
c]) *
mult;
142 int jobnr,
int nb_jobs,
148 const void **
s =
td->s;
149 const int nb_samples =
td->nb_samples;
151 const float mult =
td->mult;
153 const int start = (
channels * jobnr) / nb_jobs;
154 const int end = (
channels * (jobnr+1)) / nb_jobs;
157 for (
c = start;
c < end;
c++) {
158 const float *
src =
s[
c];
162 for (n = 0; n < nb_samples; n++) {
163 float current =
src[n];
166 dst[n] = (current - prv[0] *
mult) *
scale;
169 dst[n] = current + (current - prv[0]) *
mult;
182 int jobnr,
int nb_jobs,
188 const void **
s =
td->s;
189 const int nb_samples =
td->nb_samples;
191 const double mult =
td->mult;
192 const double scale = 1.0 / (-
mult + 1.0);
193 const int start = (
channels * jobnr) / nb_jobs;
194 const int end = (
channels * (jobnr+1)) / nb_jobs;
197 for (
c = start;
c < end;
c++) {
198 const double *
src =
s[
c];
202 for (n = 0; n < nb_samples; n++) {
203 double current =
src[n];
206 dst[n] = (current - prv[0] *
mult) *
scale;
209 dst[n] = current + (current - prv[0]) *
mult;
221 #define filters(fmt, inverse, clip, i, c) \
222 static int filter_## inverse ##_## fmt ##_## clip(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
224 return filter_## fmt(ctx, arg, jobnr, nb_jobs, i, c); \
229 filters(flt, noinverse, noclip, 0, 0)
234 filters(fltp, noinverse, noclip, 0, 0)
239 filters(dbl, noinverse, noclip, 0, 0)
244 filters(dblp, noinverse, noclip, 0, 0)
254 s->filter[0][0] = filter_inverse_flt_noclip;
255 s->filter[1][0] = filter_noinverse_flt_noclip;
256 s->filter[0][1] = filter_inverse_flt_clip;
257 s->filter[1][1] = filter_noinverse_flt_clip;
260 s->filter[0][0] = filter_inverse_fltp_noclip;
261 s->filter[1][0] = filter_noinverse_fltp_noclip;
262 s->filter[0][1] = filter_inverse_fltp_clip;
263 s->filter[1][1] = filter_noinverse_fltp_clip;
266 s->filter[0][0] = filter_inverse_dbl_noclip;
267 s->filter[1][0] = filter_noinverse_dbl_noclip;
268 s->filter[0][1] = filter_inverse_dbl_clip;
269 s->filter[1][1] = filter_noinverse_dbl_clip;
272 s->filter[0][0] = filter_inverse_dblp_noclip;
273 s->filter[1][0] = filter_noinverse_dblp_noclip;
274 s->filter[0][1] = filter_inverse_dblp_clip;
275 s->filter[1][1] = filter_noinverse_dblp_clip;
311 td.d = (
void **)
out->extended_data;
313 td.p = (
void **)
s->prev->extended_data;
316 td.mult =
ctx->is_disabled ? 0.f :
s->mult;
334 char *res,
int res_len,
int flags)
362 .
name =
"crystalizer",
365 .priv_class = &crystalizer_class,
static const AVFilterPad outputs[]
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
@ AV_SAMPLE_FMT_FLTP
float, planar
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int(* filter[2][2])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
static av_cold void uninit(AVFilterContext *ctx)
const char * name
Filter name.
A link between two filters.
AVFILTER_DEFINE_CLASS(crystalizer)
static av_always_inline int filter_dblp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs, int inverse, int clip)
static av_always_inline int filter_dbl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs, int inverse, int clip)
static av_always_inline float scale(float x, float s)
A filter pad used for either input or output.
#define filters(fmt, inverse, clip, i, c)
static int16_t mult(Float11 *f1, Float11 *f2)
static av_always_inline int filter_flt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs, int inverse, int clip)
int channels
number of audio channels, only used for audio.
#define FILTER_INPUTS(array)
static av_always_inline int filter_fltp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs, int inverse, int clip)
Describe the class of an AVClass context structure.
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
static int config_input(AVFilterLink *inlink)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
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 nb_samples
number of audio samples (per channel) described by this frame
static const AVFilterPad inputs[]
static const AVOption crystalizer_options[]
uint8_t ** extended_data
pointers to the data planes/channels.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Used for passing data between threads.
const char * name
Pad name.
static int inverse(AudioFWTDNContext *s, double **in, int *in_length, double *out, int out_length, int ch, uint64_t sn)
@ AV_SAMPLE_FMT_DBLP
double, planar
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define FILTER_OUTPUTS(array)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
#define flags(name, subs,...)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
const AVFilter ff_af_crystalizer
@ AV_SAMPLE_FMT_DBL
double
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
static double clip(void *opaque, double val)
Clip value val in the minval - maxval range.
#define FILTER_SAMPLEFMTS(...)