FFmpeg  4.0
Macros | Functions
signature_lookup.c File Reference

MPEG-7 video signature calculation and lookup filter. More...

#include "signature.h"

Go to the source code of this file.

Macros

#define HOUGH_MAX_OFFSET   90
 
#define MAX_FRAMERATE   60
 
#define DIR_PREV   0
 
#define DIR_NEXT   1
 
#define DIR_PREV_END   2
 
#define DIR_NEXT_END   3
 
#define STATUS_NULL   0
 
#define STATUS_END_REACHED   1
 
#define STATUS_BEGIN_REACHED   2
 

Functions

static void fill_l1distlut (uint8_t lut[])
 
static unsigned int intersection_word (const uint8_t *first, const uint8_t *second)
 
static unsigned int union_word (const uint8_t *first, const uint8_t *second)
 
static unsigned int get_l1dist (AVFilterContext *ctx, SignatureContext *sc, const uint8_t *first, const uint8_t *second)
 
static int get_jaccarddist (SignatureContext *sc, CoarseSignature *first, CoarseSignature *second)
 calculates the jaccard distance and evaluates a pair of coarse signatures as good More...
 
static int find_next_coarsecandidate (SignatureContext *sc, CoarseSignature *secondstart, CoarseSignature **first, CoarseSignature **second, int start)
 step through the coarsesignatures as long as a good candidate is found More...
 
static MatchingInfoget_matching_parameters (AVFilterContext *ctx, SignatureContext *sc, FineSignature *first, FineSignature *second)
 compares framesignatures and sorts out signatures with a l1 distance above a given threshold. More...
 
static int iterate_frame (double frr, FineSignature **a, FineSignature **b, int fcount, int *bcount, int dir)
 
static MatchingInfo evaluate_parameters (AVFilterContext *ctx, SignatureContext *sc, MatchingInfo *infos, MatchingInfo bestmatch, int mode)
 
static void sll_free (MatchingInfo *sll)
 
static MatchingInfo lookup_signatures (AVFilterContext *ctx, SignatureContext *sc, StreamContext *first, StreamContext *second, int mode)
 

Detailed Description

MPEG-7 video signature calculation and lookup filter.

Definition in file signature_lookup.c.

Macro Definition Documentation

◆ HOUGH_MAX_OFFSET

#define HOUGH_MAX_OFFSET   90

Definition at line 28 of file signature_lookup.c.

Referenced by get_matching_parameters().

◆ MAX_FRAMERATE

#define MAX_FRAMERATE   60

Definition at line 29 of file signature_lookup.c.

Referenced by get_matching_parameters().

◆ DIR_PREV

#define DIR_PREV   0

Definition at line 31 of file signature_lookup.c.

Referenced by evaluate_parameters(), and iterate_frame().

◆ DIR_NEXT

#define DIR_NEXT   1

Definition at line 32 of file signature_lookup.c.

Referenced by evaluate_parameters(), and iterate_frame().

◆ DIR_PREV_END

#define DIR_PREV_END   2

Definition at line 33 of file signature_lookup.c.

Referenced by evaluate_parameters(), and iterate_frame().

◆ DIR_NEXT_END

#define DIR_NEXT_END   3

Definition at line 34 of file signature_lookup.c.

Referenced by evaluate_parameters(), and iterate_frame().

◆ STATUS_NULL

#define STATUS_NULL   0

Definition at line 36 of file signature_lookup.c.

Referenced by evaluate_parameters().

◆ STATUS_END_REACHED

#define STATUS_END_REACHED   1

Definition at line 37 of file signature_lookup.c.

Referenced by evaluate_parameters().

◆ STATUS_BEGIN_REACHED

#define STATUS_BEGIN_REACHED   2

Definition at line 38 of file signature_lookup.c.

Referenced by evaluate_parameters().

Function Documentation

◆ fill_l1distlut()

static void fill_l1distlut ( uint8_t  lut[])
static

Definition at line 40 of file signature_lookup.c.

Referenced by lookup_signatures().

◆ intersection_word()

static unsigned int intersection_word ( const uint8_t first,
const uint8_t second 
)
static

Definition at line 60 of file signature_lookup.c.

Referenced by get_jaccarddist().

◆ union_word()

static unsigned int union_word ( const uint8_t first,
const uint8_t second 
)
static

Definition at line 75 of file signature_lookup.c.

Referenced by get_jaccarddist().

◆ get_l1dist()

static unsigned int get_l1dist ( AVFilterContext ctx,
SignatureContext sc,
const uint8_t first,
const uint8_t second 
)
static

Definition at line 90 of file signature_lookup.c.

Referenced by evaluate_parameters(), and get_matching_parameters().

◆ get_jaccarddist()

static int get_jaccarddist ( SignatureContext sc,
CoarseSignature first,
CoarseSignature second 
)
static

calculates the jaccard distance and evaluates a pair of coarse signatures as good

Returns
0 if pair is bad, 1 otherwise

Definition at line 115 of file signature_lookup.c.

Referenced by find_next_coarsecandidate().

◆ find_next_coarsecandidate()

static int find_next_coarsecandidate ( SignatureContext sc,
CoarseSignature secondstart,
CoarseSignature **  first,
CoarseSignature **  second,
int  start 
)
static

step through the coarsesignatures as long as a good candidate is found

Returns
0 if no candidate is found, 1 otherwise

Definition at line 140 of file signature_lookup.c.

Referenced by lookup_signatures().

◆ get_matching_parameters()

static MatchingInfo* get_matching_parameters ( AVFilterContext ctx,
SignatureContext sc,
FineSignature first,
FineSignature second 
)
static

compares framesignatures and sorts out signatures with a l1 distance above a given threshold.

Then tries to find out offset and differences between framerates with a hough transformation

Definition at line 174 of file signature_lookup.c.

Referenced by lookup_signatures().

◆ iterate_frame()

static int iterate_frame ( double  frr,
FineSignature **  a,
FineSignature **  b,
int  fcount,
int bcount,
int  dir 
)
static

Definition at line 315 of file signature_lookup.c.

Referenced by evaluate_parameters().

◆ evaluate_parameters()

static MatchingInfo evaluate_parameters ( AVFilterContext ctx,
SignatureContext sc,
MatchingInfo infos,
MatchingInfo  bestmatch,
int  mode 
)
static

Definition at line 418 of file signature_lookup.c.

Referenced by lookup_signatures().

◆ sll_free()

static void sll_free ( MatchingInfo sll)
static

Definition at line 523 of file signature_lookup.c.

Referenced by lookup_signatures().

◆ lookup_signatures()

static MatchingInfo lookup_signatures ( AVFilterContext ctx,
SignatureContext sc,
StreamContext first,
StreamContext second,
int  mode 
)
static

Definition at line 533 of file signature_lookup.c.

Referenced by request_frame().