mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
lavfi: split frame_count between input and output.
AVFilterLink.frame_count is supposed to count the number of frames that were passed on the link, but with min_samples, that number is not always the same for the source and destination filters. With the addition of a FIFO on the link, the difference will become more significant. Split the variable in two: frame_count_in counts the number of frames that entered the link, frame_count_out counts the number of frames that were sent to the destination filter.
This commit is contained in:
parent
22aa649c13
commit
183ce55b0d
@ -206,7 +206,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
|
||||
"n:%"PRId64" pts:%s pts_time:%s pos:%"PRId64" "
|
||||
"fmt:%s channels:%d chlayout:%s rate:%d nb_samples:%d "
|
||||
"checksum:%08"PRIX32" ",
|
||||
inlink->frame_count,
|
||||
inlink->frame_count_out,
|
||||
av_ts2str(buf->pts), av_ts2timestr(buf->pts, &inlink->time_base),
|
||||
av_frame_get_pkt_pos(buf),
|
||||
av_get_sample_fmt_name(buf->format), av_frame_get_channels(buf), chlayout_str,
|
||||
|
@ -393,7 +393,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
|
||||
}
|
||||
vol->var_values[VAR_PTS] = TS2D(buf->pts);
|
||||
vol->var_values[VAR_T ] = TS2T(buf->pts, inlink->time_base);
|
||||
vol->var_values[VAR_N ] = inlink->frame_count;
|
||||
vol->var_values[VAR_N ] = inlink->frame_count_out;
|
||||
|
||||
pos = av_frame_get_pkt_pos(buf);
|
||||
vol->var_values[VAR_POS] = pos == -1 ? NAN : pos;
|
||||
|
@ -219,7 +219,7 @@ static int request_frame(AVFilterLink *outlink)
|
||||
SineContext *sine = outlink->src->priv;
|
||||
AVFrame *frame;
|
||||
double values[VAR_VARS_NB] = {
|
||||
[VAR_N] = outlink->frame_count,
|
||||
[VAR_N] = outlink->frame_count_in,
|
||||
[VAR_PTS] = sine->pts,
|
||||
[VAR_T] = sine->pts * av_q2d(outlink->time_base),
|
||||
[VAR_TB] = av_q2d(outlink->time_base),
|
||||
|
@ -326,12 +326,12 @@ static inline void plot_freq(ShowFreqsContext *s, int ch,
|
||||
|
||||
switch (s->avg) {
|
||||
case 0:
|
||||
y = s->avg_data[ch][f] = !outlink->frame_count ? y : FFMIN(avg, y);
|
||||
y = s->avg_data[ch][f] = !outlink->frame_count_in ? y : FFMIN(avg, y);
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
s->avg_data[ch][f] = avg + y * (y - avg) / (FFMIN(outlink->frame_count + 1, s->avg) * y);
|
||||
s->avg_data[ch][f] = avg + y * (y - avg) / (FFMIN(outlink->frame_count_in + 1, s->avg) * y);
|
||||
y = s->avg_data[ch][f];
|
||||
break;
|
||||
}
|
||||
|
@ -1120,7 +1120,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
|
||||
pts = out->pts;
|
||||
if (dstctx->enable_str) {
|
||||
int64_t pos = av_frame_get_pkt_pos(out);
|
||||
dstctx->var_values[VAR_N] = link->frame_count;
|
||||
dstctx->var_values[VAR_N] = link->frame_count_out;
|
||||
dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
|
||||
dstctx->var_values[VAR_W] = link->w;
|
||||
dstctx->var_values[VAR_H] = link->h;
|
||||
@ -1132,7 +1132,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
|
||||
filter_frame = default_filter_frame;
|
||||
}
|
||||
ret = filter_frame(link, out);
|
||||
link->frame_count++;
|
||||
link->frame_count_out++;
|
||||
ff_update_link_current_pts(link, pts);
|
||||
return ret;
|
||||
|
||||
@ -1221,6 +1221,7 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
|
||||
}
|
||||
|
||||
link->frame_wanted_out = 0;
|
||||
link->frame_count_in++;
|
||||
/* Go directly to actual filtering if possible */
|
||||
if (link->type == AVMEDIA_TYPE_AUDIO &&
|
||||
link->min_samples &&
|
||||
|
@ -533,7 +533,7 @@ struct AVFilterLink {
|
||||
/**
|
||||
* Number of past frames sent through the link.
|
||||
*/
|
||||
int64_t frame_count;
|
||||
int64_t frame_count_in, frame_count_out;
|
||||
|
||||
/**
|
||||
* A pointer to a FFVideoFramePool struct.
|
||||
|
@ -298,7 +298,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
LoopContext *s = ctx->priv;
|
||||
int ret = 0;
|
||||
|
||||
if (inlink->frame_count >= s->start && s->size > 0 && s->loop != 0) {
|
||||
if (inlink->frame_count_out >= s->start && s->size > 0 && s->loop != 0) {
|
||||
if (s->nb_frames < s->size) {
|
||||
if (!s->nb_frames)
|
||||
s->start_pts = frame->pts;
|
||||
|
@ -315,14 +315,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
case METADATA_PRINT:
|
||||
if (!s->key && e) {
|
||||
s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%-7s\n",
|
||||
inlink->frame_count, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
|
||||
inlink->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
|
||||
s->print(ctx, "%s=%s\n", e->key, e->value);
|
||||
while ((e = av_dict_get(*metadata, "", e, AV_DICT_IGNORE_SUFFIX)) != NULL) {
|
||||
s->print(ctx, "%s=%s\n", e->key, e->value);
|
||||
}
|
||||
} else if (e && e->value && (!s->value || (e->value && s->compare(s, e->value, s->value)))) {
|
||||
s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%-7s\n",
|
||||
inlink->frame_count, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
|
||||
inlink->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
|
||||
s->print(ctx, "%s=%s\n", s->key, e->value);
|
||||
}
|
||||
return ff_filter_frame(outlink, frame);
|
||||
|
@ -318,7 +318,7 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame)
|
||||
if (isnan(select->var_values[VAR_START_T]))
|
||||
select->var_values[VAR_START_T] = TS2D(frame->pts) * av_q2d(inlink->time_base);
|
||||
|
||||
select->var_values[VAR_N ] = inlink->frame_count;
|
||||
select->var_values[VAR_N ] = inlink->frame_count_out;
|
||||
select->var_values[VAR_PTS] = TS2D(frame->pts);
|
||||
select->var_values[VAR_T ] = TS2D(frame->pts) * av_q2d(inlink->time_base);
|
||||
select->var_values[VAR_POS] = av_frame_get_pkt_pos(frame) == -1 ? NAN : av_frame_get_pkt_pos(frame);
|
||||
|
@ -72,7 +72,7 @@ static int process_frame(FFFrameSync *fs)
|
||||
AVFrame *out;
|
||||
|
||||
if (s->is_audio && s->last_pts[j] == in[j]->pts &&
|
||||
ctx->outputs[i]->frame_count > 0)
|
||||
ctx->outputs[i]->frame_count_in > 0)
|
||||
continue;
|
||||
out = av_frame_clone(in[j]);
|
||||
if (!out)
|
||||
|
@ -80,7 +80,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
h = box.y2 - box.y1 + 1;
|
||||
|
||||
av_log(ctx, AV_LOG_INFO,
|
||||
"n:%"PRId64" pts:%s pts_time:%s", inlink->frame_count,
|
||||
"n:%"PRId64" pts:%s pts_time:%s", inlink->frame_count_out,
|
||||
av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
|
||||
|
||||
if (has_bbox) {
|
||||
|
@ -155,7 +155,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
|
||||
|
||||
av_log(ctx, AV_LOG_DEBUG,
|
||||
"frame:%"PRId64" picture_black_ratio:%f pts:%s t:%s type:%c\n",
|
||||
inlink->frame_count, picture_black_ratio,
|
||||
inlink->frame_count_out, picture_black_ratio,
|
||||
av_ts2str(picref->pts), av_ts2timestr(picref->pts, &inlink->time_base),
|
||||
av_get_picture_type_char(picref->pict_type));
|
||||
|
||||
|
@ -352,7 +352,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
|
||||
uint8_t *dst = td->dst->data[td->plane];
|
||||
double values[VAR_VARS_NB];
|
||||
|
||||
values[VAR_N] = td->inlink->frame_count;
|
||||
values[VAR_N] = td->inlink->frame_count_out;
|
||||
values[VAR_T] = td->dst->pts == AV_NOPTS_VALUE ? NAN : td->dst->pts * av_q2d(td->inlink->time_base);
|
||||
values[VAR_W] = td->w;
|
||||
values[VAR_H] = td->h;
|
||||
|
@ -255,7 +255,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
|
||||
frame->width = s->w;
|
||||
frame->height = s->h;
|
||||
|
||||
s->var_values[VAR_N] = link->frame_count;
|
||||
s->var_values[VAR_N] = link->frame_count_out;
|
||||
s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
|
||||
NAN : frame->pts * av_q2d(link->time_base);
|
||||
s->var_values[VAR_POS] = av_frame_get_pkt_pos(frame) == -1 ?
|
||||
|
@ -223,7 +223,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
av_frame_free(&frame);
|
||||
frame = dm->clean_src[i];
|
||||
}
|
||||
frame->pts = av_rescale_q(outlink->frame_count, dm->ts_unit, (AVRational){1,1}) +
|
||||
frame->pts = av_rescale_q(outlink->frame_count_in, dm->ts_unit, (AVRational){1,1}) +
|
||||
(dm->start_pts == AV_NOPTS_VALUE ? 0 : dm->start_pts);
|
||||
ret = ff_filter_frame(outlink, frame);
|
||||
if (ret < 0)
|
||||
|
@ -335,7 +335,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
|
||||
|
||||
av_frame_copy_props(frame, inpicref);
|
||||
frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
|
||||
av_rescale(outlink->frame_count, s->ts_unit.num,
|
||||
av_rescale(outlink->frame_count_in, s->ts_unit.num,
|
||||
s->ts_unit.den);
|
||||
ret = ff_filter_frame(outlink, frame);
|
||||
}
|
||||
|
@ -1184,7 +1184,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame,
|
||||
|
||||
if (s->tc_opt_string) {
|
||||
char tcbuf[AV_TIMECODE_STR_SIZE];
|
||||
av_timecode_make_string(&s->tc, tcbuf, inlink->frame_count);
|
||||
av_timecode_make_string(&s->tc, tcbuf, inlink->frame_count_out);
|
||||
av_bprint_clear(bp);
|
||||
av_bprintf(bp, "%s%s", s->text, tcbuf);
|
||||
}
|
||||
@ -1345,7 +1345,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
#endif
|
||||
}
|
||||
|
||||
s->var_values[VAR_N] = inlink->frame_count+s->start_number;
|
||||
s->var_values[VAR_N] = inlink->frame_count_out + s->start_number;
|
||||
s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
|
||||
NAN : frame->pts * av_q2d(inlink->time_base);
|
||||
|
||||
|
@ -265,7 +265,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
av_frame_copy_props(out, in);
|
||||
desc = av_pix_fmt_desc_get(inlink->format);
|
||||
|
||||
eq->var_values[VAR_N] = inlink->frame_count;
|
||||
eq->var_values[VAR_N] = inlink->frame_count_out;
|
||||
eq->var_values[VAR_POS] = pos == -1 ? NAN : pos;
|
||||
eq->var_values[VAR_T] = TS2T(in->pts, inlink->time_base);
|
||||
|
||||
|
@ -300,7 +300,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
if (s->fade_state == VF_FADE_WAITING) {
|
||||
s->factor=0;
|
||||
if (frame_timestamp >= s->start_time/(double)AV_TIME_BASE
|
||||
&& inlink->frame_count >= s->start_frame) {
|
||||
&& inlink->frame_count_out >= s->start_frame) {
|
||||
// Time to start fading
|
||||
s->fade_state = VF_FADE_FADING;
|
||||
|
||||
@ -311,15 +311,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
|
||||
// Save start frame in case we are starting based on time and fading based on frames
|
||||
if (s->start_time != 0 && s->start_frame == 0) {
|
||||
s->start_frame = inlink->frame_count;
|
||||
s->start_frame = inlink->frame_count_out;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s->fade_state == VF_FADE_FADING) {
|
||||
if (s->duration == 0) {
|
||||
// Fading based on frame count
|
||||
s->factor = (inlink->frame_count - s->start_frame) * s->fade_per_frame;
|
||||
if (inlink->frame_count > s->start_frame + s->nb_frames) {
|
||||
s->factor = (inlink->frame_count_out - s->start_frame) * s->fade_per_frame;
|
||||
if (inlink->frame_count_out > s->start_frame + s->nb_frames) {
|
||||
s->fade_state = VF_FADE_DONE;
|
||||
}
|
||||
|
||||
|
@ -147,22 +147,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
}
|
||||
switch (s->mode) {
|
||||
case 0:
|
||||
if (tf > outlink->frame_count + 1 || tf < FFMAX(0, outlink->frame_count - 1) ||
|
||||
bf > outlink->frame_count + 1 || bf < FFMAX(0, outlink->frame_count - 1)) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Out of range frames %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inlink->frame_count);
|
||||
if (tf > outlink->frame_count_in + 1 || tf < FFMAX(0, outlink->frame_count_in - 1) ||
|
||||
bf > outlink->frame_count_in + 1 || bf < FFMAX(0, outlink->frame_count_in - 1)) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Out of range frames %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inlink->frame_count_out);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (tf > 1 || tf < -1 ||
|
||||
bf > 1 || bf < -1) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Out of range %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inlink->frame_count);
|
||||
av_log(ctx, AV_LOG_ERROR, "Out of range %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inlink->frame_count_out);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
};
|
||||
break;
|
||||
} else {
|
||||
av_log(ctx, AV_LOG_ERROR, "Missing entry for %"PRId64". input frame.\n", inlink->frame_count);
|
||||
av_log(ctx, AV_LOG_ERROR, "Missing entry for %"PRId64". input frame.\n", inlink->frame_count_out);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
@ -174,8 +174,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
|
||||
switch (s->mode) {
|
||||
case 0:
|
||||
top = s->frame[tf - outlink->frame_count + 1];
|
||||
bottom = s->frame[bf - outlink->frame_count + 1];
|
||||
top = s->frame[tf - outlink->frame_count_in + 1];
|
||||
bottom = s->frame[bf - outlink->frame_count_in + 1];
|
||||
break;
|
||||
case 1:
|
||||
top = s->frame[1 + tf];
|
||||
|
@ -740,7 +740,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
|
||||
/* scene change check */
|
||||
if (fm->combmatch == COMBMATCH_SC) {
|
||||
if (fm->lastn == outlink->frame_count - 1) {
|
||||
if (fm->lastn == outlink->frame_count_in - 1) {
|
||||
if (fm->lastscdiff > fm->scthresh)
|
||||
sc = 1;
|
||||
} else if (luma_abs_diff(fm->prv, fm->src) > fm->scthresh) {
|
||||
@ -748,7 +748,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
}
|
||||
|
||||
if (!sc) {
|
||||
fm->lastn = outlink->frame_count;
|
||||
fm->lastn = outlink->frame_count_in;
|
||||
fm->lastscdiff = luma_abs_diff(fm->src, fm->nxt);
|
||||
sc = fm->lastscdiff > fm->scthresh;
|
||||
}
|
||||
@ -807,7 +807,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
dst->interlaced_frame = combs[match] >= fm->combpel;
|
||||
if (dst->interlaced_frame) {
|
||||
av_log(ctx, AV_LOG_WARNING, "Frame #%"PRId64" at %s is still interlaced\n",
|
||||
outlink->frame_count, av_ts2timestr(in->pts, &inlink->time_base));
|
||||
outlink->frame_count_in, av_ts2timestr(in->pts, &inlink->time_base));
|
||||
dst->top_field_first = field;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
|
||||
{
|
||||
FrameStepContext *framestep = inlink->dst->priv;
|
||||
|
||||
if (!(inlink->frame_count % framestep->frame_step)) {
|
||||
if (!(inlink->frame_count_out % framestep->frame_step)) {
|
||||
return ff_filter_frame(inlink->dst->outputs[0], ref);
|
||||
} else {
|
||||
av_frame_free(&ref);
|
||||
|
@ -208,7 +208,7 @@ static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
AVFilterLink *outlink = inlink->dst->outputs[0];
|
||||
AVFrame *out;
|
||||
double values[VAR_VARS_NB] = {
|
||||
[VAR_N] = inlink->frame_count,
|
||||
[VAR_N] = inlink->frame_count_out,
|
||||
[VAR_T] = in->pts == AV_NOPTS_VALUE ? NAN : in->pts * av_q2d(inlink->time_base),
|
||||
};
|
||||
|
||||
|
@ -318,7 +318,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
|
||||
av_frame_copy_props(outpic, inpic);
|
||||
}
|
||||
|
||||
hue->var_values[VAR_N] = inlink->frame_count;
|
||||
hue->var_values[VAR_N] = inlink->frame_count_out;
|
||||
hue->var_values[VAR_T] = TS2T(inpic->pts, inlink->time_base);
|
||||
hue->var_values[VAR_PTS] = TS2D(inpic->pts);
|
||||
|
||||
|
@ -667,7 +667,7 @@ static AVFrame *do_blend(AVFilterContext *ctx, AVFrame *mainpic,
|
||||
if (s->eval_mode == EVAL_MODE_FRAME) {
|
||||
int64_t pos = av_frame_get_pkt_pos(mainpic);
|
||||
|
||||
s->var_values[VAR_N] = inlink->frame_count;
|
||||
s->var_values[VAR_N] = inlink->frame_count_out;
|
||||
s->var_values[VAR_T] = mainpic->pts == AV_NOPTS_VALUE ?
|
||||
NAN : mainpic->pts * av_q2d(inlink->time_base);
|
||||
s->var_values[VAR_POS] = pos == -1 ? NAN : pos;
|
||||
|
@ -889,7 +889,7 @@ static AVFrame *apply_palette(AVFilterLink *inlink, AVFrame *in)
|
||||
}
|
||||
memcpy(out->data[1], s->palette, AVPALETTE_SIZE);
|
||||
if (s->calc_mean_err)
|
||||
debug_mean_error(s, in, out, inlink->frame_count);
|
||||
debug_mean_error(s, in, out, inlink->frame_count_out);
|
||||
av_frame_free(&in);
|
||||
return out;
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ static int calc_persp_luts(AVFilterContext *ctx, AVFilterLink *inlink)
|
||||
double (*ref)[2] = s->ref;
|
||||
|
||||
double values[VAR_VARS_NB] = { [VAR_W] = inlink->w, [VAR_H] = inlink->h,
|
||||
[VAR_IN] = inlink->frame_count + 1,
|
||||
[VAR_ON] = outlink->frame_count + 1 };
|
||||
[VAR_IN] = inlink->frame_count_out + 1,
|
||||
[VAR_ON] = outlink->frame_count_in + 1 };
|
||||
const int h = values[VAR_H];
|
||||
const int w = values[VAR_W];
|
||||
double x0, x1, x2, x3, x4, x5, x6, x7, x8, q;
|
||||
|
@ -522,7 +522,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
}
|
||||
av_frame_copy_props(out, in);
|
||||
|
||||
rot->var_values[VAR_N] = inlink->frame_count;
|
||||
rot->var_values[VAR_N] = inlink->frame_count_out;
|
||||
rot->var_values[VAR_T] = TS2T(in->pts, inlink->time_base);
|
||||
rot->angle = res = av_expr_eval(rot->angle_expr, rot->var_values, rot);
|
||||
|
||||
|
@ -107,7 +107,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
"n:%4"PRId64" pts:%7s pts_time:%-7s pos:%9"PRId64" "
|
||||
"fmt:%s sar:%d/%d s:%dx%d i:%c iskey:%d type:%c "
|
||||
"checksum:%08"PRIX32" plane_checksum:[%08"PRIX32,
|
||||
inlink->frame_count,
|
||||
inlink->frame_count_out,
|
||||
av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base), av_frame_get_pkt_pos(frame),
|
||||
desc->name,
|
||||
frame->sample_aspect_ratio.num, frame->sample_aspect_ratio.den,
|
||||
|
@ -97,7 +97,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
var_values[VAR_A] = (float) inlink->w / inlink->h;
|
||||
var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? av_q2d(inlink->sample_aspect_ratio) : 1;
|
||||
var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
|
||||
var_values[VAR_N] = inlink->frame_count;
|
||||
var_values[VAR_N] = inlink->frame_count_out;
|
||||
var_values[VAR_T] = in->pts == AV_NOPTS_VALUE ? NAN : in->pts * av_q2d(inlink->time_base);
|
||||
var_values[VAR_POS] = av_frame_get_pkt_pos(in) == -1 ? NAN : av_frame_get_pkt_pos(in);
|
||||
|
||||
|
@ -244,7 +244,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
|
||||
|
||||
av_frame_copy_props(frame, inpicref);
|
||||
frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
|
||||
av_rescale(outlink->frame_count, s->ts_unit.num,
|
||||
av_rescale(outlink->frame_count_in, s->ts_unit.num,
|
||||
s->ts_unit.den);
|
||||
ret = ff_filter_frame(outlink, frame);
|
||||
}
|
||||
|
@ -280,12 +280,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
|
||||
copy_picture_field(tinterlace, out->data, out->linesize,
|
||||
(const uint8_t **)cur->data, cur->linesize,
|
||||
inlink->format, inlink->w, inlink->h,
|
||||
FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? inlink->frame_count & 1 ? FIELD_LOWER : FIELD_UPPER : FIELD_UPPER, tinterlace->flags);
|
||||
FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? inlink->frame_count_out & 1 ? FIELD_LOWER : FIELD_UPPER : FIELD_UPPER, tinterlace->flags);
|
||||
/* write even frame lines into the lower field of the new frame */
|
||||
copy_picture_field(tinterlace, out->data, out->linesize,
|
||||
(const uint8_t **)next->data, next->linesize,
|
||||
inlink->format, inlink->w, inlink->h,
|
||||
FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? inlink->frame_count & 1 ? FIELD_UPPER : FIELD_LOWER : FIELD_LOWER, tinterlace->flags);
|
||||
FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? inlink->frame_count_out & 1 ? FIELD_UPPER : FIELD_LOWER : FIELD_LOWER, tinterlace->flags);
|
||||
if (tinterlace->mode != MODE_MERGEX2)
|
||||
av_frame_free(&tinterlace->next);
|
||||
break;
|
||||
|
@ -165,7 +165,7 @@ static void update_context(VignetteContext *s, AVFilterLink *inlink, AVFrame *fr
|
||||
int dst_linesize = s->fmap_linesize;
|
||||
|
||||
if (frame) {
|
||||
s->var_values[VAR_N] = inlink->frame_count;
|
||||
s->var_values[VAR_N] = inlink->frame_count_out;
|
||||
s->var_values[VAR_T] = TS2T(frame->pts, inlink->time_base);
|
||||
s->var_values[VAR_PTS] = TS2D(frame->pts);
|
||||
} else {
|
||||
|
@ -149,7 +149,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va
|
||||
var_values[VAR_PDURATION] = s->prev_nb_frames;
|
||||
var_values[VAR_TIME] = pts * av_q2d(outlink->time_base);
|
||||
var_values[VAR_FRAME] = i;
|
||||
var_values[VAR_ON] = outlink->frame_count + 1;
|
||||
var_values[VAR_ON] = outlink->frame_count_in + 1;
|
||||
if ((ret = av_expr_parse_and_eval(zoom, s->zoom_expr_str,
|
||||
var_names, var_values,
|
||||
NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
|
||||
@ -235,8 +235,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = in->height;
|
||||
s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = s->w;
|
||||
s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = s->h;
|
||||
s->var_values[VAR_IN] = inlink->frame_count + 1;
|
||||
s->var_values[VAR_ON] = outlink->frame_count + 1;
|
||||
s->var_values[VAR_IN] = inlink->frame_count_out + 1;
|
||||
s->var_values[VAR_ON] = outlink->frame_count_in + 1;
|
||||
s->var_values[VAR_PX] = s->x;
|
||||
s->var_values[VAR_PY] = s->y;
|
||||
s->var_values[VAR_X] = 0;
|
||||
|
@ -303,7 +303,7 @@ static int request_frame(AVFilterLink *outlink)
|
||||
AVFrame *picref;
|
||||
int w = WIDTH, h = HEIGHT,
|
||||
cw = AV_CEIL_RSHIFT(w, test->hsub), ch = AV_CEIL_RSHIFT(h, test->vsub);
|
||||
unsigned int frame = outlink->frame_count;
|
||||
unsigned int frame = outlink->frame_count_in;
|
||||
enum test_type tt = test->test;
|
||||
int i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user