[FFmpeg-devel] [PATCHv2] add signature filter for MPEG7 video signature

Gerion Entrup gerion.entrup.ffdev at flump.de
Tue May 3 19:01:51 CEST 2016


On Sonntag, 24. April 2016 01:44:51 CEST Michael Niedermayer wrote:
> On Tue, Apr 19, 2016 at 04:37:16PM +0200, Gerion Entrup wrote:
> > On Dienstag, 19. April 2016 13:25:53 CEST Moritz Barsnick wrote:
> > +static int request_frame(AVFilterLink *outlink)
> > +{
> > +    AVFilterContext *ctx = outlink->src;
> > +    SignatureContext *sc = ctx->priv;
> > +    int i, ret;
> > +
> > +    for (i = 0; i < sc->nb_inputs; i++){
> > +        ret = ff_request_frame(ctx->inputs[i]);
> > +        // TODO handle this in a better way?
> > +        // Problem is the following:
> > +        // Assuming two inputs, inputA with 50 frames, inputB with 100 frames
> > +        // simply returning ret when < 0 would result in not filtering inputB
> > +        // after 50 frames anymore, not wanted
> > +        // only returning ret at the end would result in only respecting the error
> > +        // values of the last input, please comment
> > +        if (ret < 0 && ret != AVERROR_EOF)
> > +            return ret;
> > +    }
> > +    return ret;
> > +}
> 
> i dont know what exactly you want to happen when the inputs mismatch
> but handling it like other dualinput filters might be an option
vf_decimate, vf_fieldmatch: a main input exists, that dominates
vf_mergeplanes, vf_stack, f_streamselect: return value of ff_framesync_request_frame is used
af_amerge, af_join: as soon as one inputstream end, the filter quits, other said, the first error is returned
af_amix: AVERROR_EOF is catched and things happen, could be a possible solution, but is audio related
af_ladspa: beside other things, with multiinput the return value of ff_request_frame is returned
avf_concat, f_interleave: only values except AVERROR_EOF are handled, in some way similar like my current solution but without the <0 check

I see not an analog usecase with any of these filters. If the inputs mismatch absolutely nothing should happen.
The filter (the algorithm) does not require inputs of same length.


> 
> 
> [...]
> > +static av_cold void uninit(AVFilterContext *ctx)
> > +{
> > +    SignatureContext *sic = ctx->priv;
> > +    StreamContext *sc, *sc2;
> > +    void* tmp;
> > +    FineSignature* finsig;
> > +    CourseSignature* cousig;
> > +    MatchingInfo match;
> > +    int i,j;
> > +
> > +    //TODO export and especially lookup_signature can have a return value to show some error etc.
> > +    //How could this be handled in this function?
> 
> why does it need to happen in uninit ?
> EOF could be detected before uninit if it doesnt work here
What would be another good place to call export and lookup? The process chart would be something like:

[input1]-->[signature_computation with loop over all frames]-->[export]-.
                                                                         -->[lookup]
[input2]-->[signature_computation with loop over all frames]-->[export]-`

ATM signature_computation is done in filter_frame and export and lookup are in uninit.

Gerion




More information about the ffmpeg-devel mailing list