62 #define OFFSET(x) offsetof(FadeContext, x)
63 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
70 {
"nb_frames",
"set expression for fade duration in frames",
OFFSET(nb_frames),
AV_OPT_TYPE_INT, {.i64 = 25 }, 0, INT_MAX,
FLAGS },
82 char *args1, *expr, *bufptr =
NULL;
84 fade->
class = &fade_class;
92 if (expr =
av_strtok(args1,
":", &bufptr)) {
100 if ((ret =
av_opt_set(fade,
"start_frame", expr, 0)) < 0) {
102 "Invalid value '%s' for start_frame option\n", expr);
107 if ((ret =
av_opt_set(fade,
"nb_frames", expr, 0)) < 0) {
109 "Invalid value '%s' for nb_frames option\n", expr);
118 if (!strcmp(fade->
type,
"in"))
120 else if (!strcmp(fade->
type,
"out")) {
125 "Type argument must be 'in' or 'out' but '%s' was specified\n", fade->
type);
132 "type:%s start_frame:%d nb_frames:%d alpha:%d\n",
201 int fade_factor,
int black_level,
int black_level_scaled,
209 for (i = 0; i < h; i++) {
210 p = data + offset + (y+i) * line_size;
211 for (j = 0; j < w * bytes_per_plane; j++) {
213 *p = ((*p - black_level) * fade_factor + black_level_scaled) >> 16;
225 if (fade->
factor < UINT16_MAX) {
241 if (frame->
data[1] && frame->
data[2]) {
243 for (plane = 1; plane < 3; plane++) {
244 for (i = 0; i < frame->
video->
h; i++) {
246 for (j = 0; j < inlink->
w >> fade->
hsub; j++) {
250 *p = ((*p - 128) * fade->
factor + 8421367) >> 16;
296 .
inputs = avfilter_vf_fade_inputs,
297 .
outputs = avfilter_vf_fade_outputs,
298 .priv_class = &fade_class,