81 const char *amount_str =
s->amount_str;
85 amount_str = (!
s->drop_str && !
s->dropamount) ?
"-1" :
"0";
88 strcmp(amount_str,
"0")) {
100 if (
s->drop_str &&
s->dropamount) {
102 s->drop_str,
s->dropamount);
127 int i, ret, amount, drop = 0;
134 s->var_values[
VAR_N] =
s->pkt_idx++;
154 amount = (
s->state % 10001 + 1);
164 drop = !(
s->state %
FFABS((
int)res));
170 drop = !(
s->state %
s->dropamount);
174 pkt->stream_index, (
unsigned int)
s->var_values[
VAR_N],
pkt->pts, amount, drop);
190 for (
i = 0;
i <
pkt->size;
i++) {
191 s->state +=
pkt->data[
i] + 1;
192 if (amount &&
s->state % amount == 0)
193 pkt->data[
i] =
s->state;
207 s->amount_pexpr =
s->drop_pexpr =
NULL;
210#define OFFSET(x) offsetof(NoiseContext, x)
211#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_BSF_PARAM)
220 .class_name =
"noise",
static av_cold void close(AVCodecParserContext *s)
const FFBitStreamFilter ff_noise_bsf
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
#define i(width, name, range_min, range_max)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int(* init)(AVBSFContext *ctx)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
simple arithmetic expression evaluator
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ 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...
@ AV_CODEC_ID_WRAPPED_AVFRAME
Passthrough codec, AVFrames wrapped in AVPacket.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int av_packet_make_writable(AVPacket *pkt)
Create a writable reference for the data described by a given packet, avoiding data copy if possible.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define LIBAVUTIL_VERSION_INT
static void noise_close(AVBSFContext *bsf)
static int noise(AVBSFContext *ctx, AVPacket *pkt)
static const AVClass noise_class
static int noise_init(AVBSFContext *ctx)
static const char *const var_names[]
The bitstream filter state.
void * priv_data
Opaque filter-specific private data.
Describe the class of an AVClass context structure.
This structure stores compressed data.
double var_values[VAR_VARS_NB]
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static AVFormatContext * ctx