[FFmpeg-trac] #7242(avfilter:new): zoompan filter variables 'in' and 'on' start at 2, 1 instead of at 0

FFmpeg trac at avcodec.org
Sun Jun 3 11:13:20 EEST 2018


#7242: zoompan filter variables 'in' and 'on' start at 2, 1 instead of at 0
------------------------------------+------------------------------------
             Reporter:  jdlh        |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avfilter
              Version:  git-master  |               Resolution:
             Keywords:  zoompan     |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Comment (by jdlh):

 I tried to read through the code and simulate it in my head.  If you
 accept my claim that '''in''' and '''on''' should start at 0 instead of 1
 and 2, then I think the fix is in `libavfilter/vf_zoompan.c`, function
 `activate()`, lines 252:317.

 The variables appear to be set in lines 277:278:
 {{{
         s->var_values[VAR_IN]    = inlink->frame_count_out + 1;
         s->var_values[VAR_ON]    = outlink->frame_count_in + 1;
 }}}

 Removing the `+1` from each expression would correct '''on''' to the
 ordinal value, and get '''in''' closer.

 I think other discrepancy with the '''in''' value comes from this lines
 277:278 being called after having called `ff_inlink_consume_frame(inlink,
 &s->in))` in line 269.

 {{{
     if (!s->in && (ret = ff_inlink_consume_frame(inlink, &s->in)) > 0) {
         ...[omitted]...
     }
 }}}

 `ff_inlink_consume_frame()` calls `consume_update()`, which increments
 `link->frame_count_out`. This is essentially:

 {{{
     out++;
     in = out;
 }}}

 when maybe the original intention was:

 {{{
     in = out++;
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7242#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list