]> git.sesse.net Git - ffmpeg/commitdiff
lavfi: split frame_count between input and output.
authorNicolas George <george@nsup.org>
Tue, 30 Aug 2016 13:28:41 +0000 (15:28 +0200)
committerNicolas George <george@nsup.org>
Sun, 13 Nov 2016 09:41:16 +0000 (10:41 +0100)
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.

35 files changed:
libavfilter/af_ashowinfo.c
libavfilter/af_volume.c
libavfilter/asrc_sine.c
libavfilter/avf_showfreqs.c
libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/f_loop.c
libavfilter/f_metadata.c
libavfilter/f_select.c
libavfilter/f_streamselect.c
libavfilter/vf_bbox.c
libavfilter/vf_blackdetect.c
libavfilter/vf_blend.c
libavfilter/vf_crop.c
libavfilter/vf_decimate.c
libavfilter/vf_detelecine.c
libavfilter/vf_drawtext.c
libavfilter/vf_eq.c
libavfilter/vf_fade.c
libavfilter/vf_fieldhint.c
libavfilter/vf_fieldmatch.c
libavfilter/vf_framestep.c
libavfilter/vf_geq.c
libavfilter/vf_hue.c
libavfilter/vf_overlay.c
libavfilter/vf_paletteuse.c
libavfilter/vf_perspective.c
libavfilter/vf_rotate.c
libavfilter/vf_showinfo.c
libavfilter/vf_swaprect.c
libavfilter/vf_telecine.c
libavfilter/vf_tinterlace.c
libavfilter/vf_vignette.c
libavfilter/vf_zoompan.c
libavfilter/vsrc_mptestsrc.c

index ca33add335ffcc12116312f5abb589d7ae80724a..ba600cbc6806eff896f6a2f87382b75840c06fd6 100644 (file)
@@ -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,
index 4d6b91645a1accb684798a50da8e908a0c77f586..68134033ec05ee494ead0d0b47043f0d6f37e324 100644 (file)
@@ -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;
index 2a2f3c37c0b741aa860e2a07611c751f684d1b50..ff77526622365e2cf6591fb2c95b4a9e6a53ba9a 100644 (file)
@@ -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),
index e2a923b8645b76ba32fe1bdbe3f554606ad68a2e..21735ed075f9e124d42a7ae9561c5b1940c3c4e4 100644 (file)
@@ -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;
     }
index 1d469c3334adcae809360c66d2c4029af0bca598..662f93304135b0906839e78f306efc62530c732f 100644 (file)
@@ -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 &&
index 15d00f70586f68ce079e97bdd9bbe24d6b548f4a..d21b1445f041fdbbaf9dd610e764ec405516f25e 100644 (file)
@@ -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.
index 00e02154e8670745a0e5f888a56b3621be44f8a2..69bfb10243ce14081640b2429c87d64a4ea57a13 100644 (file)
@@ -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;
index f2c71d98b4f7b8cdbaf4c82fac6657e9772b0627..24deccfb2cbe1cb0c2686b4f72a21c8cb9940d15 100644 (file)
@@ -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);
index 52f474eb935523ab203284d0a80a92c133b59c2e..03c1c0f3f321880ddabb8db14095cafee139e21b 100644 (file)
@@ -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);
index 03cedbaa8cb0d5eb5c784fc940ed87849491e799..1a517bfc958215de61ab6abd41f5fa0ebff1b693 100644 (file)
@@ -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)
index e92c3b477f9d94d09aa223ab4145375281c200e4..86054b2483ac628464f034c35eb5adf727b95db1 100644 (file)
@@ -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) {
index fbe3d108db91bfe82929d05d6da3b01eca916ad8..0f6adf49ede3306d7e02933c8c7a94da6ec4aac8 100644 (file)
@@ -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));
 
index 2731ec81bfa95469861d20b94c2c595a683a5d70..a3235e684b2fe23a8967c5d3cec6bd9db43bb41a 100644 (file)
@@ -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;
index bcdbb8cd5833b1a42250c4514e51d749c1bbfda6..85ea892d0133c37bb633660ae02b7646cdf4818c 100644 (file)
@@ -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 ?
index 39c333142597d6f2f684439f4aeb126e465dd733..1fb242a3ae542ca4d20c4a02b16a0dcad692d8a1 100644 (file)
@@ -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)
index 9a7b46219990240c548e9cfbe4b7d0a3dc45e3ab..0d5f88df77665028821e4c6ec0920071ca7aaa05 100644 (file)
@@ -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);
     }
index 331d6b92a8e6a99a28df6eff83ae5cd354d1f47f..649240b010f8ec8d27fc8a2ac056b8a9bcffc0ec 100644 (file)
@@ -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);
 
index 5ecdb31bcd40b5a7df21663154a83be160479e24..c450d5ed026d6074500c917ae55d1e324654cda4 100644 (file)
@@ -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);
 
index 0496645c97d46034a7e238e75102994ecf05be56..c30c41db0da4a42a05dfdd98dba332fca21a8331 100644 (file)
@@ -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;
             }
 
index 2b845e7330583dc873475ab567fc18ce59fd74da..26551ce7a81e9718a9af16e675ec43e3dfb27f09 100644 (file)
@@ -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];
index e155712caa0c2bdea669aa57cf210f8928b683af..54a2c7aa60a218e249d16f0895c66a740f2cd16a 100644 (file)
@@ -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;
     }
 
index 6f198b8ff5bc526cc47bce4a0e324702ed6c4691..8102e7c719552d0395aa51c15eb3d8e96b4d1baa 100644 (file)
@@ -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);
index 88d3b75af11e3fb7b72d4b187293f453a450311c..9d26f5442227c3942300fc59a526c61d7eb73c2b 100644 (file)
@@ -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),
     };
 
index b5d72136a1936cb2697812725c4fbe2d08267811..0d2862fb12ff4c9643787a57a8a401803477f036 100644 (file)
@@ -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);
 
index b249ad7ee4be65320436b1159ae38d1e4878a0a7..108a6fce3c53a105d8196613ff3b41f27ce8d914 100644 (file)
@@ -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;
index e063ff7386317e6544bb14da6c1929fc03eefb48..69d3be92da8c3a14e9101d7b3fd23fc028853ca2 100644 (file)
@@ -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;
 }
index 287db688454694348157f3a55aa436f020df1ea6..d590cfa48d7b026a2eaac4cd7fc4dafb22d68008 100644 (file)
@@ -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;
index 42e725aca944f9d4ca4eedd47c84979b033d20b6..371ff7f722ba4ae04fd5d2d8f5c674f65d673e60 100644 (file)
@@ -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);
 
index 5146995c23a450931ed0a9d59539b643cf6cc487..83d941c629a217a62322dcf7f08e8e99b1d31c5c 100644 (file)
@@ -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,
index a46762738a683698cf07e793585d5a945e35ace3..a0aa59d2365301607610f94ebed54ab85b400070 100644 (file)
@@ -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);
 
index 58babca9a16082463b4c3dd38042c8ae329a263f..35f382ef7fdaab0aa03a4268c964f622b11cf1af 100644 (file)
@@ -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);
     }
index 8a796ce933d1793e2144c52f63f3a6b455c97576..80146a94805f0ab9e7f89b17787ca3b2e291caf9 100644 (file)
@@ -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;
index 1d66c5025d094c448039c23b1a37ace0a1337e61..94b6c6ffff181903a4d8a43aa26963780d5e91de 100644 (file)
@@ -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 {
index 7a71503168f9d75f469aeecf48184db8974d975d..136d6c83fdcacae4961ca2235e60efa08b706015 100644 (file)
@@ -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;
index 3c758212bae5f8fa6385f8398662711d761cbb4c..c5fdea75dc7d13686875a67a43d68f2a881dd73a 100644 (file)
@@ -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;