52 unsigned int frame_index, start_frame,
stop_frame, nb_frames;
62 #define OFFSET(x) offsetof(FadeContext, x)
63 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
68 {
"start_frame",
"set expression of frame to start fading",
OFFSET(start_frame),
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX,
FLAGS },
70 {
"nb_frames",
"set expression for fade duration in frames",
OFFSET(nb_frames),
AV_OPT_TYPE_INT, {.i64 = 25 }, 0, INT_MAX,
FLAGS },
81 static const char *shorthand[] = {
"type",
"start_frame",
"nb_frames",
NULL };
84 fade->
class = &fade_class;
91 if (!strcmp(fade->
type,
"in"))
93 else if (!strcmp(fade->
type,
"out")) {
98 "Type argument must be 'in' or 'out' but '%s' was specified\n", fade->
type);
104 "type:%s start_frame:%d nb_frames:%d alpha:%d\n",
163 int fade_factor,
int black_level,
int black_level_scaled,
171 for (i = 0; i < h; i++) {
172 p = data + offset + (y+i) * line_size;
173 for (j = 0; j < w * bytes_per_plane; j++) {
175 *p = ((*p - black_level) * fade_factor + black_level_scaled) >> 16;
187 if (fade->
factor < UINT16_MAX) {
203 if (frame->
data[1] && frame->
data[2]) {
205 for (plane = 1; plane < 3; plane++) {
206 for (i = 0; i < frame->
video->
h; i++) {
208 for (j = 0; j < inlink->
w >> fade->
hsub; j++) {
212 *p = ((*p - 128) * fade->
factor + 8421367) >> 16;
258 .
inputs = avfilter_vf_fade_inputs,
259 .
outputs = avfilter_vf_fade_outputs,
260 .priv_class = &fade_class,