FFmpeg
signature.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Gerion Entrup
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 /**
22  * @file
23  * MPEG-7 video signature calculation and lookup filter
24  */
25 
26 #ifndef AVFILTER_SIGNATURE_H
27 #define AVFILTER_SIGNATURE_H
28 
29 #include <float.h>
30 #include "libavutil/common.h"
31 #include "libavutil/opt.h"
32 #include "libavutil/timestamp.h"
33 #include "avfilter.h"
34 #include "internal.h"
35 
36 #define ELEMENT_COUNT 10
37 #define SIGELEM_SIZE 380
38 #define DIFFELEM_SIZE 348 /* SIGELEM_SIZE - elem_a1 - elem_a2 */
39 #define COARSE_SIZE 90
40 
46 };
47 
48 enum formats {
52 };
53 
54 typedef struct Point {
57 } Point;
58 
59 typedef struct Block {
62 } Block;
63 
64 typedef struct ElemCat {
65  int av_elem; /* average element category */
66  short left_count; /* count of blocks that will be added together */
67  short block_count; /* count of blocks per element */
68  short elem_count;
69  const Block* blocks;
70 } ElemCat;
71 
72 typedef struct FineSignature {
75  uint64_t pts;
76  uint32_t index; /* needed for xmlexport */
81 
82 typedef struct CoarseSignature {
83  uint8_t data[5][31]; /* 5 words with min. 243 bit */
84  struct FineSignature* first; /* associated Finesignatures */
88 
89 /* lookup types */
90 typedef struct MatchingInfo {
91  double meandist;
92  double framerateratio; /* second/first */
93  int score;
94  int offset;
95  int matchframes; /* number of matching frames */
96  int whole;
99  struct MatchingInfo* next;
100 } MatchingInfo;
101 
102 typedef struct StreamContext {
104  /* needed for xml_export */
105  int w; /* height */
106  int h; /* width */
107 
108  /* overflow protection */
109  int divide;
110 
113 
115  CoarseSignature* coarseend; /* needed for xml export */
116  /* helpers to store the alternating signatures */
119 
120  int coarsecount; /* counter from 0 to 89 */
121  int midcoarse; /* whether it is a coarsesignature beginning from 45 + i * 90 */
122  uint32_t lastindex; /* helper to store amount of frames */
123 
124  int exported; /* boolean whether stream already exported */
125 } StreamContext;
126 
127 typedef struct SignatureContext {
128  const AVClass *class;
129  /* input parameters */
130  int mode;
132  char *filename;
133  int format;
136  int thl1;
137  int thdi;
138  int thit;
139  /* end input parameters */
140 
141  uint8_t l1distlut[243*242/2]; /* 243 + 242 + 241 ... */
144 
145 
146 static const Block elem_a1_data[] = {
147  {{ 0, 0},{ 7, 7}},
148  {{ 8, 0},{15, 7}},
149  {{ 0, 8},{ 7,15}},
150  {{ 8, 8},{15,15}},
151  {{16, 0},{23, 7}},
152  {{24, 0},{31, 7}},
153  {{16, 8},{23,15}},
154  {{24, 8},{31,15}},
155  {{ 0,16},{ 7,23}},
156  {{ 8,16},{15,23}},
157  {{ 0,24},{ 7,31}},
158  {{ 8,24},{15,31}},
159  {{16,16},{23,23}},
160  {{24,16},{31,23}},
161  {{16,24},{23,31}},
162  {{24,24},{31,31}},
163  {{ 0, 0},{15,15}},
164  {{16, 0},{31,15}},
165  {{ 0,16},{15,31}},
166  {{16,16},{31,31}}
167 };
168 static const ElemCat elem_a1 = { 1, 1, 1, 20, elem_a1_data };
169 
170 static const Block elem_a2_data[] = {
171  {{ 2, 2},{ 9, 9}},
172  {{12, 2},{19, 9}},
173  {{22, 2},{29, 9}},
174  {{ 2,12},{ 9,19}},
175  {{12,12},{19,19}},
176  {{22,12},{29,19}},
177  {{ 2,22},{ 9,29}},
178  {{12,22},{19,29}},
179  {{22,22},{29,29}},
180  {{ 9, 9},{22,22}},
181  {{ 6, 6},{25,25}},
182  {{ 3, 3},{28,28}}
183 };
184 static const ElemCat elem_a2 = { 1, 1, 1, 12, elem_a2_data };
185 
186 static const Block elem_d1_data[] = {
187  {{ 0, 0},{ 1, 3}},{{ 2, 0},{ 3, 3}},
188  {{ 4, 0},{ 7, 1}},{{ 4, 2},{ 7, 3}},
189  {{ 0, 6},{ 3, 7}},{{ 0, 4},{ 3, 5}},
190  {{ 6, 4},{ 7, 7}},{{ 4, 4},{ 5, 7}},
191  {{ 8, 0},{ 9, 3}},{{10, 0},{11, 3}},
192  {{12, 0},{15, 1}},{{12, 2},{15, 3}},
193  {{ 8, 6},{11, 7}},{{ 8, 4},{11, 5}},
194  {{14, 4},{15, 7}},{{12, 4},{13, 7}},
195  {{ 0, 8},{ 1,11}},{{ 2, 8},{ 3,11}},
196  {{ 4, 8},{ 7, 9}},{{ 4,10},{ 7,11}},
197  {{ 0,14},{ 3,15}},{{ 0,12},{ 3,13}},
198  {{ 6,12},{ 7,15}},{{ 4,12},{ 5,15}},
199  {{ 8, 8},{ 9,11}},{{10, 8},{11,11}},
200  {{12, 8},{15, 9}},{{12,10},{15,11}},
201  {{ 8,14},{11,15}},{{ 8,12},{11,13}},
202  {{14,12},{15,15}},{{12,12},{13,15}},
203  {{16, 0},{19, 1}},{{16, 2},{19, 3}},
204  {{22, 0},{23, 3}},{{20, 0},{21, 3}},
205  {{16, 4},{17, 7}},{{18, 4},{19, 7}},
206  {{20, 6},{23, 7}},{{20, 4},{23, 5}},
207  {{24, 0},{27, 1}},{{24, 2},{27, 3}},
208  {{30, 0},{31, 3}},{{28, 0},{29, 3}},
209  {{24, 4},{25, 7}},{{26, 4},{27, 7}},
210  {{28, 6},{31, 7}},{{28, 4},{31, 5}},
211  {{16, 8},{19, 9}},{{16,10},{19,11}},
212  {{22, 8},{23,11}},{{20, 8},{21,11}},
213  {{16,12},{17,15}},{{18,12},{19,15}},
214  {{20,14},{23,15}},{{20,12},{23,13}},
215  {{24, 8},{27, 9}},{{24,10},{27,11}},
216  {{30, 8},{31,11}},{{28, 8},{29,11}},
217  {{24,12},{25,15}},{{26,12},{27,15}},
218  {{28,14},{31,15}},{{28,12},{31,13}},
219  {{ 0,16},{ 3,17}},{{ 0,18},{ 3,19}},
220  {{ 6,16},{ 7,19}},{{ 4,16},{ 5,19}},
221  {{ 0,20},{ 1,23}},{{ 2,20},{ 3,23}},
222  {{ 4,22},{ 7,23}},{{ 4,20},{ 7,21}},
223  {{ 8,16},{11,17}},{{ 8,18},{11,19}},
224  {{14,16},{15,19}},{{12,16},{13,19}},
225  {{ 8,20},{ 9,23}},{{10,20},{11,23}},
226  {{12,22},{15,23}},{{12,20},{15,21}},
227  {{ 0,24},{ 3,25}},{{ 0,26},{ 3,27}},
228  {{ 6,24},{ 7,27}},{{ 4,24},{ 5,27}},
229  {{ 0,28},{ 1,31}},{{ 2,28},{ 3,31}},
230  {{ 4,30},{ 7,31}},{{ 4,28},{ 7,29}},
231  {{ 8,24},{11,25}},{{ 8,26},{11,27}},
232  {{14,24},{15,27}},{{12,24},{13,27}},
233  {{ 8,28},{ 9,31}},{{10,28},{11,31}},
234  {{12,30},{15,31}},{{12,28},{15,29}},
235  {{16,16},{17,19}},{{18,16},{19,19}},
236  {{20,16},{23,17}},{{20,18},{23,19}},
237  {{16,22},{19,23}},{{16,20},{19,21}},
238  {{22,20},{23,23}},{{20,20},{21,23}},
239  {{24,16},{25,19}},{{26,16},{27,19}},
240  {{28,16},{31,17}},{{28,18},{31,19}},
241  {{24,22},{27,23}},{{24,20},{27,21}},
242  {{30,20},{31,23}},{{28,20},{29,23}},
243  {{16,24},{17,27}},{{18,24},{19,27}},
244  {{20,24},{23,25}},{{20,26},{23,27}},
245  {{16,30},{19,31}},{{16,28},{19,29}},
246  {{22,28},{23,31}},{{20,28},{21,31}},
247  {{24,24},{25,27}},{{26,24},{27,27}},
248  {{28,24},{31,25}},{{28,26},{31,27}},
249  {{24,30},{27,31}},{{24,28},{27,29}},
250  {{30,28},{31,31}},{{28,28},{29,31}},
251  {{ 2, 2},{ 3, 5}},{{ 4, 2},{ 5, 5}},
252  {{ 6, 2},{ 9, 3}},{{ 6, 4},{ 9, 5}},
253  {{ 2, 8},{ 5, 9}},{{ 2, 6},{ 5, 7}},
254  {{ 8, 6},{ 9, 9}},{{ 6, 6},{ 7, 9}},
255  {{12, 2},{13, 5}},{{14, 2},{15, 5}},
256  {{16, 2},{19, 3}},{{16, 4},{19, 5}},
257  {{12, 8},{15, 9}},{{12, 6},{15, 7}},
258  {{18, 6},{19, 9}},{{16, 6},{17, 9}},
259  {{22, 2},{23, 5}},{{24, 2},{25, 5}},
260  {{26, 2},{29, 3}},{{26, 4},{29, 5}},
261  {{22, 8},{25, 9}},{{22, 6},{25, 7}},
262  {{28, 6},{29, 9}},{{26, 6},{27, 9}},
263  {{ 2,12},{ 3,15}},{{ 4,12},{ 5,15}},
264  {{ 6,12},{ 9,13}},{{ 6,14},{ 9,15}},
265  {{ 2,18},{ 5,19}},{{ 2,16},{ 5,17}},
266  {{ 8,16},{ 9,19}},{{ 6,16},{ 7,19}},
267  {{12,12},{15,13}},{{12,14},{15,15}},
268  {{16,12},{19,13}},{{16,14},{19,15}},
269  {{12,18},{15,19}},{{12,16},{15,17}},
270  {{16,18},{19,19}},{{16,16},{19,17}},
271  {{22,12},{23,15}},{{24,12},{25,15}},
272  {{26,12},{29,13}},{{26,14},{29,15}},
273  {{22,18},{25,19}},{{22,16},{25,17}},
274  {{28,16},{29,19}},{{26,16},{27,19}},
275  {{ 2,22},{ 3,25}},{{ 4,22},{ 5,25}},
276  {{ 6,22},{ 9,23}},{{ 6,24},{ 9,25}},
277  {{ 2,28},{ 5,29}},{{ 2,26},{ 5,27}},
278  {{ 8,26},{ 9,29}},{{ 6,26},{ 7,29}},
279  {{12,22},{13,25}},{{14,22},{15,25}},
280  {{16,22},{19,23}},{{16,24},{19,25}},
281  {{12,28},{15,29}},{{12,26},{15,27}},
282  {{18,26},{19,29}},{{16,26},{17,29}},
283  {{22,22},{23,25}},{{24,22},{25,25}},
284  {{26,22},{29,23}},{{26,24},{29,25}},
285  {{22,28},{25,29}},{{22,26},{25,27}},
286  {{28,26},{29,29}},{{26,26},{27,29}},
287  {{ 7, 7},{10, 8}},{{ 7, 9},{10,10}},
288  {{11, 7},{12,10}},{{13, 7},{14,10}},
289  {{ 7,11},{ 8,14}},{{ 9,11},{10,14}},
290  {{11,11},{14,12}},{{11,13},{14,14}},
291  {{17, 7},{20, 8}},{{17, 9},{20,10}},
292  {{21, 7},{22,10}},{{23, 7},{24,10}},
293  {{17,11},{18,14}},{{19,11},{20,14}},
294  {{21,11},{24,12}},{{21,13},{24,14}},
295  {{ 7,17},{10,18}},{{ 7,19},{10,20}},
296  {{11,17},{12,20}},{{13,17},{14,20}},
297  {{ 7,21},{ 8,24}},{{ 9,21},{10,24}},
298  {{11,21},{14,22}},{{11,23},{14,24}},
299  {{17,17},{20,18}},{{17,19},{20,20}},
300  {{21,17},{22,20}},{{23,17},{24,20}},
301  {{17,21},{18,24}},{{19,21},{20,24}},
302  {{21,21},{24,22}},{{21,23},{24,24}}
303 };
304 static const ElemCat elem_d1 = { 0, 1, 2, 116, elem_d1_data };
305 
306 static const Block elem_d2_data[] = {
307  {{ 0, 0},{ 3, 3}},{{ 4, 4},{ 7, 7}},{{ 4, 0},{ 7, 3}},{{ 0, 4},{ 3, 7}},
308  {{ 8, 0},{11, 3}},{{12, 4},{15, 7}},{{12, 0},{15, 3}},{{ 8, 4},{11, 7}},
309  {{16, 0},{19, 3}},{{20, 4},{23, 7}},{{20, 0},{23, 3}},{{16, 4},{19, 7}},
310  {{24, 0},{27, 3}},{{28, 4},{31, 7}},{{28, 0},{31, 3}},{{24, 4},{27, 7}},
311  {{ 0, 8},{ 3,11}},{{ 4,12},{ 7,15}},{{ 4, 8},{ 7,11}},{{ 0,12},{ 3,15}},
312  {{ 8, 8},{11,11}},{{12,12},{15,15}},{{12, 8},{15,11}},{{ 8,12},{11,15}},
313  {{16, 8},{19,11}},{{20,12},{23,15}},{{20, 8},{23,11}},{{16,12},{19,15}},
314  {{24, 8},{27,11}},{{28,12},{31,15}},{{28, 8},{31,11}},{{24,12},{27,15}},
315  {{ 0,16},{ 3,19}},{{ 4,20},{ 7,23}},{{ 4,16},{ 7,19}},{{ 0,20},{ 3,23}},
316  {{ 8,16},{11,19}},{{12,20},{15,23}},{{12,16},{15,19}},{{ 8,20},{11,23}},
317  {{16,16},{19,19}},{{20,20},{23,23}},{{20,16},{23,19}},{{16,20},{19,23}},
318  {{24,16},{27,19}},{{28,20},{31,23}},{{28,16},{31,19}},{{24,20},{27,23}},
319  {{ 0,24},{ 3,27}},{{ 4,28},{ 7,31}},{{ 4,24},{ 7,27}},{{ 0,28},{ 3,31}},
320  {{ 8,24},{11,27}},{{12,28},{15,31}},{{12,24},{15,27}},{{ 8,28},{11,31}},
321  {{16,24},{19,27}},{{20,28},{23,31}},{{20,24},{23,27}},{{16,28},{19,31}},
322  {{24,24},{27,27}},{{28,28},{31,31}},{{28,24},{31,27}},{{24,28},{27,31}},
323  {{ 4, 4},{ 7, 7}},{{ 8, 8},{11,11}},{{ 8, 4},{11, 7}},{{ 4, 8},{ 7,11}},
324  {{12, 4},{15, 7}},{{16, 8},{19,11}},{{16, 4},{19, 7}},{{12, 8},{15,11}},
325  {{20, 4},{23, 7}},{{24, 8},{27,11}},{{24, 4},{27, 7}},{{20, 8},{23,11}},
326  {{ 4,12},{ 7,15}},{{ 8,16},{11,19}},{{ 8,12},{11,15}},{{ 4,16},{ 7,19}},
327  {{12,12},{15,15}},{{16,16},{19,19}},{{16,12},{19,15}},{{12,16},{15,19}},
328  {{20,12},{23,15}},{{24,16},{27,19}},{{24,12},{27,15}},{{20,16},{23,19}},
329  {{ 4,20},{ 7,23}},{{ 8,24},{11,27}},{{ 8,20},{11,23}},{{ 4,24},{ 7,27}},
330  {{12,20},{15,23}},{{16,24},{19,27}},{{16,20},{19,23}},{{12,24},{15,27}},
331  {{20,20},{23,23}},{{24,24},{27,27}},{{24,20},{27,23}},{{20,24},{23,27}}
332 };
333 static const ElemCat elem_d2 = { 0, 2, 4, 25, elem_d2_data };
334 
335 static const Block elem_d3_data[] = {
336  {{ 1, 1},{10,10}},{{11, 1},{20,10}},
337  {{ 1, 1},{10,10}},{{21, 1},{30,10}},
338  {{ 1, 1},{10,10}},{{ 1,11},{10,20}},
339  {{ 1, 1},{10,10}},{{11,11},{20,20}},
340  {{ 1, 1},{10,10}},{{21,11},{30,20}},
341  {{ 1, 1},{10,10}},{{ 1,21},{10,30}},
342  {{ 1, 1},{10,10}},{{11,21},{20,30}},
343  {{ 1, 1},{10,10}},{{21,21},{30,30}},
344  {{11, 1},{20,10}},{{21, 1},{30,10}},
345  {{11, 1},{20,10}},{{ 1,11},{10,20}},
346  {{11, 1},{20,10}},{{11,11},{20,20}},
347  {{11, 1},{20,10}},{{21,11},{30,20}},
348  {{11, 1},{20,10}},{{ 1,21},{10,30}},
349  {{11, 1},{20,10}},{{11,21},{20,30}},
350  {{11, 1},{20,10}},{{21,21},{30,30}},
351  {{21, 1},{30,10}},{{ 1,11},{10,20}},
352  {{21, 1},{30,10}},{{11,11},{20,20}},
353  {{21, 1},{30,10}},{{21,11},{30,20}},
354  {{21, 1},{30,10}},{{ 1,21},{10,30}},
355  {{21, 1},{30,10}},{{11,21},{20,30}},
356  {{21, 1},{30,10}},{{21,21},{30,30}},
357  {{ 1,11},{10,20}},{{11,11},{20,20}},
358  {{ 1,11},{10,20}},{{21,11},{30,20}},
359  {{ 1,11},{10,20}},{{ 1,21},{10,30}},
360  {{ 1,11},{10,20}},{{11,21},{20,30}},
361  {{ 1,11},{10,20}},{{21,21},{30,30}},
362  {{11,11},{20,20}},{{21,11},{30,20}},
363  {{11,11},{20,20}},{{ 1,21},{10,30}},
364  {{11,11},{20,20}},{{11,21},{20,30}},
365  {{11,11},{20,20}},{{21,21},{30,30}},
366  {{21,11},{30,20}},{{ 1,21},{10,30}},
367  {{21,11},{30,20}},{{11,21},{20,30}},
368  {{21,11},{30,20}},{{21,21},{30,30}},
369  {{ 1,21},{10,30}},{{11,21},{20,30}},
370  {{ 1,21},{10,30}},{{21,21},{30,30}},
371  {{11,21},{20,30}},{{21,21},{30,30}}
372 };
373 static const ElemCat elem_d3 = { 0, 1, 2, 36, elem_d3_data };
374 
375 static const Block elem_d4_data[] = {
376  {{ 7,13},{12,18}},{{19,13},{24,18}},
377  {{13, 7},{18,12}},{{13,19},{18,24}},
378  {{ 7, 7},{12,12}},{{19,19},{24,24}},
379  {{19, 7},{24,12}},{{ 7,19},{12,24}},
380  {{13, 7},{18,12}},{{19,13},{24,18}},
381  {{19,13},{24,18}},{{13,19},{18,24}},
382  {{13,19},{18,24}},{{ 7,13},{12,18}},
383  {{ 7,13},{12,18}},{{13, 7},{18,12}},
384  {{ 7, 7},{12,12}},{{19, 7},{24,12}},
385  {{19, 7},{24,12}},{{19,19},{24,24}},
386  {{19,19},{24,24}},{{ 7,19},{12,24}},
387  {{ 7,19},{12,24}},{{ 7, 7},{12,12}},
388  {{13,13},{18,18}},{{13, 1},{18, 6}},
389  {{13,13},{18,18}},{{25,13},{30,18}},
390  {{13,13},{18,18}},{{13,25},{18,30}},
391  {{13,13},{18,18}},{{ 1,13},{ 6,18}},
392  {{13, 1},{18, 6}},{{13,25},{18,30}},
393  {{ 1,13},{ 6,18}},{{25,13},{30,18}},
394  {{ 7, 1},{12, 6}},{{19, 1},{24, 6}},
395  {{ 7,25},{12,30}},{{19,25},{24,30}},
396  {{ 1, 7},{ 6,12}},{{ 1,19},{ 6,24}},
397  {{25, 7},{30,12}},{{25,19},{30,24}},
398  {{ 7, 1},{12, 6}},{{ 1, 7},{ 6,12}},
399  {{19, 1},{24, 6}},{{25, 7},{30,12}},
400  {{25,19},{30,24}},{{19,25},{24,30}},
401  {{ 1,19},{ 6,24}},{{ 7,25},{12,30}},
402  {{ 1, 1},{ 6, 6}},{{25, 1},{30, 6}},
403  {{25, 1},{30, 6}},{{25,25},{30,30}},
404  {{25,25},{30,30}},{{ 1,25},{ 6,30}},
405  {{ 1,25},{ 6,30}},{{ 1, 1},{ 6, 6}}
406 };
407 static const ElemCat elem_d4 = { 0, 1, 2, 30, elem_d4_data };
408 
409 static const Block elem_d5_data[] = {
410  {{ 1, 1},{10, 3}},{{ 1, 4},{ 3, 7}},{{ 8, 4},{10, 7}},{{ 1, 8},{10,10}},{{ 4, 4},{ 7, 7}},
411  {{11, 1},{20, 3}},{{11, 4},{13, 7}},{{18, 4},{20, 7}},{{11, 8},{20,10}},{{14, 4},{17, 7}},
412  {{21, 1},{30, 3}},{{21, 4},{23, 7}},{{28, 4},{30, 7}},{{21, 8},{30,10}},{{24, 4},{27, 7}},
413  {{ 1,11},{10,13}},{{ 1,14},{ 3,17}},{{ 8,14},{10,17}},{{ 1,18},{10,20}},{{ 4,14},{ 7,17}},
414  {{11,11},{20,13}},{{11,14},{13,17}},{{18,14},{20,17}},{{11,18},{20,20}},{{14,14},{17,17}},
415  {{21,11},{30,13}},{{21,14},{23,17}},{{28,14},{30,17}},{{21,18},{30,20}},{{24,14},{27,17}},
416  {{ 1,21},{10,23}},{{ 1,24},{ 3,27}},{{ 8,24},{10,27}},{{ 1,28},{10,30}},{{ 4,24},{ 7,27}},
417  {{11,21},{20,23}},{{11,24},{13,27}},{{18,24},{20,27}},{{11,28},{20,30}},{{14,24},{17,27}},
418  {{21,21},{30,23}},{{21,24},{23,27}},{{28,24},{30,27}},{{21,28},{30,30}},{{24,24},{27,27}},
419  {{ 6, 6},{15, 8}},{{ 6, 9},{ 8,12}},{{13, 9},{15,12}},{{ 6,13},{15,15}},{{ 9, 9},{12,12}},
420  {{16, 6},{25, 8}},{{16, 9},{18,12}},{{23, 9},{25,12}},{{16,13},{25,15}},{{19, 9},{22,12}},
421  {{ 6,16},{15,18}},{{ 6,19},{ 8,22}},{{13,19},{15,22}},{{ 6,23},{15,25}},{{ 9,19},{12,22}},
422  {{16,16},{25,18}},{{16,19},{18,22}},{{23,19},{25,22}},{{16,23},{25,25}},{{19,19},{22,22}},
423  {{ 6, 1},{15, 3}},{{ 6, 4},{ 8, 7}},{{13, 4},{15, 7}},{{ 6, 8},{15,10}},{{ 9, 4},{12, 7}},
424  {{16, 1},{25, 3}},{{16, 4},{18, 7}},{{23, 4},{25, 7}},{{16, 8},{25,10}},{{19, 4},{22, 7}},
425  {{ 1, 6},{10, 8}},{{ 1, 9},{ 3,12}},{{ 8, 9},{10,12}},{{ 1,13},{10,15}},{{ 4, 9},{ 7,12}},
426  {{11, 6},{20, 8}},{{11, 9},{13,12}},{{18, 9},{20,12}},{{11,13},{20,15}},{{14, 9},{17,12}},
427  {{21, 6},{30, 8}},{{21, 9},{23,12}},{{28, 9},{30,12}},{{21,13},{30,15}},{{24, 9},{27,12}},
428  {{ 6,11},{15,13}},{{ 6,14},{ 8,17}},{{13,14},{15,17}},{{ 6,18},{15,20}},{{ 9,14},{12,17}},
429  {{16,11},{25,13}},{{16,14},{18,17}},{{23,14},{25,17}},{{16,18},{25,20}},{{19,14},{22,17}},
430  {{ 1,16},{10,18}},{{ 1,19},{ 3,22}},{{ 8,19},{10,22}},{{ 1,23},{10,25}},{{ 4,19},{ 7,22}},
431  {{11,16},{20,18}},{{11,19},{13,22}},{{18,19},{20,22}},{{11,23},{20,25}},{{14,19},{17,22}},
432  {{21,16},{30,18}},{{21,19},{23,22}},{{28,19},{30,22}},{{21,23},{30,25}},{{24,19},{27,22}},
433  {{ 6,21},{15,23}},{{ 6,24},{ 8,27}},{{13,24},{15,27}},{{ 6,28},{15,30}},{{ 9,24},{12,27}},
434  {{16,21},{25,23}},{{16,24},{18,27}},{{23,24},{25,27}},{{16,28},{25,30}},{{19,24},{22,27}},
435  {{ 2, 2},{14, 6}},{{ 2, 7},{ 6, 9}},{{10, 7},{14, 9}},{{ 2,10},{14,14}},{{ 7, 7},{ 9, 9}},
436  {{ 7, 2},{19, 6}},{{ 7, 7},{11, 9}},{{15, 7},{19, 9}},{{ 7,10},{19,14}},{{12, 7},{14, 9}},
437  {{12, 2},{24, 6}},{{12, 7},{16, 9}},{{20, 7},{24, 9}},{{12,10},{24,14}},{{17, 7},{19, 9}},
438  {{17, 2},{29, 6}},{{17, 7},{21, 9}},{{25, 7},{29, 9}},{{17,10},{29,14}},{{22, 7},{24, 9}},
439  {{ 2, 7},{14,11}},{{ 2,12},{ 6,14}},{{10,12},{14,14}},{{ 2,15},{14,19}},{{ 7,12},{ 9,14}},
440  {{ 7, 7},{19,11}},{{ 7,12},{11,14}},{{15,12},{19,14}},{{ 7,15},{19,19}},{{12,12},{14,14}},
441  {{12, 7},{24,11}},{{12,12},{16,14}},{{20,12},{24,14}},{{12,15},{24,19}},{{17,12},{19,14}},
442  {{17, 7},{29,11}},{{17,12},{21,14}},{{25,12},{29,14}},{{17,15},{29,19}},{{22,12},{24,14}},
443  {{ 2,12},{14,16}},{{ 2,17},{ 6,19}},{{10,17},{14,19}},{{ 2,20},{14,24}},{{ 7,17},{ 9,19}},
444  {{ 7,12},{19,16}},{{ 7,17},{11,19}},{{15,17},{19,19}},{{ 7,20},{19,24}},{{12,17},{14,19}},
445  {{12,12},{24,16}},{{12,17},{16,19}},{{20,17},{24,19}},{{12,20},{24,24}},{{17,17},{19,19}},
446  {{17,12},{29,16}},{{17,17},{21,19}},{{25,17},{29,19}},{{17,20},{29,24}},{{22,17},{24,19}},
447  {{ 2,17},{14,21}},{{ 2,22},{ 6,24}},{{10,22},{14,24}},{{ 2,25},{14,29}},{{ 7,22},{ 9,24}},
448  {{ 7,17},{19,21}},{{ 7,22},{11,24}},{{15,22},{19,24}},{{ 7,25},{19,29}},{{12,22},{14,24}},
449  {{12,17},{24,21}},{{12,22},{16,24}},{{20,22},{24,24}},{{12,25},{24,29}},{{17,22},{19,24}},
450  {{17,17},{29,21}},{{17,22},{21,24}},{{25,22},{29,24}},{{17,25},{29,29}},{{22,22},{24,24}},
451  {{ 8, 3},{13, 4}},{{ 8, 5},{ 9, 6}},{{12, 5},{13, 6}},{{ 8, 7},{13, 8}},{{10, 5},{11, 6}},
452  {{13, 3},{18, 4}},{{13, 5},{14, 6}},{{17, 5},{18, 6}},{{13, 7},{18, 8}},{{15, 5},{16, 6}},
453  {{18, 3},{23, 4}},{{18, 5},{19, 6}},{{22, 5},{23, 6}},{{18, 7},{23, 8}},{{20, 5},{21, 6}},
454  {{ 3, 8},{ 8, 9}},{{ 3,10},{ 4,11}},{{ 7,10},{ 8,11}},{{ 3,12},{ 8,13}},{{ 5,10},{ 6,11}},
455  {{ 8, 8},{13, 9}},{{ 8,10},{ 9,11}},{{12,10},{13,11}},{{ 8,12},{13,13}},{{10,10},{11,11}},
456  {{13, 8},{18, 9}},{{13,10},{14,11}},{{17,10},{18,11}},{{13,12},{18,13}},{{15,10},{16,11}},
457  {{18, 8},{23, 9}},{{18,10},{19,11}},{{22,10},{23,11}},{{18,12},{23,13}},{{20,10},{21,11}},
458  {{23, 8},{28, 9}},{{23,10},{24,11}},{{27,10},{28,11}},{{23,12},{28,13}},{{25,10},{26,11}},
459  {{ 3,13},{ 8,14}},{{ 3,15},{ 4,16}},{{ 7,15},{ 8,16}},{{ 3,17},{ 8,18}},{{ 5,15},{ 6,16}},
460  {{ 8,13},{13,14}},{{ 8,15},{ 9,16}},{{12,15},{13,16}},{{ 8,17},{13,18}},{{10,15},{11,16}},
461  {{13,13},{18,14}},{{13,15},{14,16}},{{17,15},{18,16}},{{13,17},{18,18}},{{15,15},{16,16}},
462  {{18,13},{23,14}},{{18,15},{19,16}},{{22,15},{23,16}},{{18,17},{23,18}},{{20,15},{21,16}},
463  {{23,13},{28,14}},{{23,15},{24,16}},{{27,15},{28,16}},{{23,17},{28,18}},{{25,15},{26,16}},
464  {{ 3,18},{ 8,19}},{{ 3,20},{ 4,21}},{{ 7,20},{ 8,21}},{{ 3,22},{ 8,23}},{{ 5,20},{ 6,21}},
465  {{ 8,18},{13,19}},{{ 8,20},{ 9,21}},{{12,20},{13,21}},{{ 8,22},{13,23}},{{10,20},{11,21}},
466  {{13,18},{18,19}},{{13,20},{14,21}},{{17,20},{18,21}},{{13,22},{18,23}},{{15,20},{16,21}},
467  {{18,18},{23,19}},{{18,20},{19,21}},{{22,20},{23,21}},{{18,22},{23,23}},{{20,20},{21,21}},
468  {{23,18},{28,19}},{{23,20},{24,21}},{{27,20},{28,21}},{{23,22},{28,23}},{{25,20},{26,21}},
469  {{ 8,23},{13,24}},{{ 8,25},{ 9,26}},{{12,25},{13,26}},{{ 8,27},{13,28}},{{10,25},{11,26}},
470  {{13,23},{18,24}},{{13,25},{14,26}},{{17,25},{18,26}},{{13,27},{18,28}},{{15,25},{16,26}},
471  {{18,23},{23,24}},{{18,25},{19,26}},{{22,25},{23,26}},{{18,27},{23,28}},{{20,25},{21,26}}
472 };
473 static const ElemCat elem_d5 = { 0, 4, 5, 62, elem_d5_data };
474 
475 static const Block elem_d6_data[] = {
476  {{ 3, 5},{12,10}},{{ 5, 3},{10,12}},
477  {{11, 5},{20,10}},{{13, 3},{18,12}},
478  {{19, 5},{28,10}},{{21, 3},{26,12}},
479  {{ 3,13},{12,18}},{{ 5,11},{10,20}},
480  {{11,13},{20,18}},{{13,11},{18,20}},
481  {{19,13},{28,18}},{{21,11},{26,20}},
482  {{ 3,21},{12,26}},{{ 5,19},{10,28}},
483  {{11,21},{20,26}},{{13,19},{18,28}},
484  {{19,21},{28,26}},{{21,19},{26,28}}
485 };
486 static const ElemCat elem_d6 = { 0, 1, 2, 9, elem_d6_data };
487 
488 static const Block elem_d7_data[] = {
489  {{ 0, 4},{ 3, 7}},{{ 8, 4},{11, 7}},{{ 4, 4},{ 7, 7}},
490  {{ 4, 0},{ 7, 3}},{{ 4, 8},{ 7,11}},{{ 4, 4},{ 7, 7}},
491  {{ 5, 4},{ 8, 7}},{{13, 4},{16, 7}},{{ 9, 4},{12, 7}},
492  {{ 9, 0},{12, 3}},{{ 9, 8},{12,11}},{{ 9, 4},{12, 7}},
493  {{10, 4},{13, 7}},{{18, 4},{21, 7}},{{14, 4},{17, 7}},
494  {{14, 0},{17, 3}},{{14, 8},{17,11}},{{14, 4},{17, 7}},
495  {{15, 4},{18, 7}},{{23, 4},{26, 7}},{{19, 4},{22, 7}},
496  {{19, 0},{22, 3}},{{19, 8},{22,11}},{{19, 4},{22, 7}},
497  {{20, 4},{23, 7}},{{28, 4},{31, 7}},{{24, 4},{27, 7}},
498  {{24, 0},{27, 3}},{{24, 8},{27,11}},{{24, 4},{27, 7}},
499  {{ 0, 9},{ 3,12}},{{ 8, 9},{11,12}},{{ 4, 9},{ 7,12}},
500  {{ 4, 5},{ 7, 8}},{{ 4,13},{ 7,16}},{{ 4, 9},{ 7,12}},
501  {{ 5, 9},{ 8,12}},{{13, 9},{16,12}},{{ 9, 9},{12,12}},
502  {{ 9, 5},{12, 8}},{{ 9,13},{12,16}},{{ 9, 9},{12,12}},
503  {{10, 9},{13,12}},{{18, 9},{21,12}},{{14, 9},{17,12}},
504  {{14, 5},{17, 8}},{{14,13},{17,16}},{{14, 9},{17,12}},
505  {{15, 9},{18,12}},{{23, 9},{26,12}},{{19, 9},{22,12}},
506  {{19, 5},{22, 8}},{{19,13},{22,16}},{{19, 9},{22,12}},
507  {{20, 9},{23,12}},{{28, 9},{31,12}},{{24, 9},{27,12}},
508  {{24, 5},{27, 8}},{{24,13},{27,16}},{{24, 9},{27,12}},
509  {{ 0,14},{ 3,17}},{{ 8,14},{11,17}},{{ 4,14},{ 7,17}},
510  {{ 4,10},{ 7,13}},{{ 4,18},{ 7,21}},{{ 4,14},{ 7,17}},
511  {{ 5,14},{ 8,17}},{{13,14},{16,17}},{{ 9,14},{12,17}},
512  {{ 9,10},{12,13}},{{ 9,18},{12,21}},{{ 9,14},{12,17}},
513  {{10,14},{13,17}},{{18,14},{21,17}},{{14,14},{17,17}},
514  {{14,10},{17,13}},{{14,18},{17,21}},{{14,14},{17,17}},
515  {{15,14},{18,17}},{{23,14},{26,17}},{{19,14},{22,17}},
516  {{19,10},{22,13}},{{19,18},{22,21}},{{19,14},{22,17}},
517  {{20,14},{23,17}},{{28,14},{31,17}},{{24,14},{27,17}},
518  {{24,10},{27,13}},{{24,18},{27,21}},{{24,14},{27,17}},
519  {{ 0,19},{ 3,22}},{{ 8,19},{11,22}},{{ 4,19},{ 7,22}},
520  {{ 4,15},{ 7,18}},{{ 4,23},{ 7,26}},{{ 4,19},{ 7,22}},
521  {{ 5,19},{ 8,22}},{{13,19},{16,22}},{{ 9,19},{12,22}},
522  {{ 9,15},{12,18}},{{ 9,23},{12,26}},{{ 9,19},{12,22}},
523  {{10,19},{13,22}},{{18,19},{21,22}},{{14,19},{17,22}},
524  {{14,15},{17,18}},{{14,23},{17,26}},{{14,19},{17,22}},
525  {{15,19},{18,22}},{{23,19},{26,22}},{{19,19},{22,22}},
526  {{19,15},{22,18}},{{19,23},{22,26}},{{19,19},{22,22}},
527  {{20,19},{23,22}},{{28,19},{31,22}},{{24,19},{27,22}},
528  {{24,15},{27,18}},{{24,23},{27,26}},{{24,19},{27,22}},
529  {{ 0,24},{ 3,27}},{{ 8,24},{11,27}},{{ 4,24},{ 7,27}},
530  {{ 4,20},{ 7,23}},{{ 4,28},{ 7,31}},{{ 4,24},{ 7,27}},
531  {{ 5,24},{ 8,27}},{{13,24},{16,27}},{{ 9,24},{12,27}},
532  {{ 9,20},{12,23}},{{ 9,28},{12,31}},{{ 9,24},{12,27}},
533  {{10,24},{13,27}},{{18,24},{21,27}},{{14,24},{17,27}},
534  {{14,20},{17,23}},{{14,28},{17,31}},{{14,24},{17,27}},
535  {{15,24},{18,27}},{{23,24},{26,27}},{{19,24},{22,27}},
536  {{19,20},{22,23}},{{19,28},{22,31}},{{19,24},{22,27}},
537  {{20,24},{23,27}},{{28,24},{31,27}},{{24,24},{27,27}},
538  {{24,20},{27,23}},{{24,28},{27,31}},{{24,24},{27,27}}
539 };
540 static const ElemCat elem_d7 = { 0, 2, 3, 50, elem_d7_data };
541 
542 static const Block elem_d8_data[] = {
543  {{ 0, 0},{ 7, 3}},{{ 0, 4},{ 7, 7}},
544  {{ 8, 0},{11, 7}},{{12, 0},{15, 7}},
545  {{ 0, 8},{ 3,15}},{{ 4, 8},{ 7,15}},
546  {{ 8, 8},{15,11}},{{ 8,12},{15,15}},
547  {{16, 0},{19, 7}},{{20, 0},{23, 7}},
548  {{24, 0},{31, 3}},{{24, 4},{31, 7}},
549  {{16, 8},{23,11}},{{16,12},{23,15}},
550  {{24, 8},{27,15}},{{28, 8},{31,15}},
551  {{ 0,16},{ 3,23}},{{ 4,16},{ 7,23}},
552  {{ 8,16},{15,19}},{{ 8,20},{15,23}},
553  {{ 0,24},{ 7,27}},{{ 0,28},{ 7,31}},
554  {{ 8,24},{11,31}},{{12,24},{15,31}},
555  {{16,16},{23,19}},{{16,20},{23,23}},
556  {{24,16},{27,23}},{{28,16},{31,23}},
557  {{16,24},{19,31}},{{20,24},{23,31}},
558  {{24,24},{31,27}},{{24,28},{31,31}},
559  {{ 0, 0},{ 7,15}},{{ 8, 0},{15,15}},
560  {{16, 0},{31, 7}},{{16, 8},{31,15}},
561  {{ 0,16},{15,23}},{{ 0,24},{15,31}},
562  {{16,16},{23,31}},{{24,16},{31,31}}
563 };
564 static const ElemCat elem_d8 = { 0, 1, 2, 20, elem_d8_data };
565 
568  &elem_d5, &elem_d6, &elem_d7, &elem_d8 };
569 #endif /* AVFILTER_SIGNATURE_H */
formats
formats
Definition: signature.h:48
elem_d1
static const ElemCat elem_d1
Definition: signature.h:304
elem_d7_data
static const Block elem_d7_data[]
Definition: signature.h:488
elem_d2_data
static const Block elem_d2_data[]
Definition: signature.h:306
MatchingInfo::framerateratio
double framerateratio
Definition: signature.h:92
opt.h
StreamContext::coarsesiglist
CoarseSignature * coarsesiglist
Definition: signature.h:114
elements
static const ElemCat * elements[ELEMENT_COUNT]
Definition: signature.h:566
elem_d6
static const ElemCat elem_d6
Definition: signature.h:486
MatchingInfo::meandist
double meandist
Definition: signature.h:91
FineSignature::next
struct FineSignature * next
Definition: signature.h:73
FORMAT_BINARY
@ FORMAT_BINARY
Definition: signature.h:49
ElemCat::left_count
short left_count
Definition: signature.h:66
MatchingInfo
Definition: signature.h:90
StreamContext::curcoarsesig2
CoarseSignature * curcoarsesig2
Definition: signature.h:118
ElemCat::av_elem
int av_elem
Definition: signature.h:65
MatchingInfo::whole
int whole
Definition: signature.h:96
StreamContext::divide
int divide
Definition: signature.h:109
MatchingInfo::score
int score
Definition: signature.h:93
FineSignature::confidence
uint8_t confidence
Definition: signature.h:77
float.h
SignatureContext::l1distlut
uint8_t l1distlut[243 *242/2]
Definition: signature.h:141
elem_d3
static const ElemCat elem_d3
Definition: signature.h:373
elem_d5_data
static const Block elem_d5_data[]
Definition: signature.h:409
FineSignature::pts
uint64_t pts
Definition: signature.h:75
FineSignature::index
uint32_t index
Definition: signature.h:76
StreamContext::exported
int exported
Definition: signature.h:124
SignatureContext::mode
int mode
Definition: signature.h:130
SignatureContext::thdi
int thdi
Definition: signature.h:137
CoarseSignature::last
struct FineSignature * last
Definition: signature.h:85
elem_d6_data
static const Block elem_d6_data[]
Definition: signature.h:475
ElemCat::blocks
const Block * blocks
Definition: signature.h:69
ElemCat
Definition: signature.h:64
Block::to
Point to
Definition: signature.h:61
Point::y
uint8_t y
Definition: signature.h:56
MODE_FAST
@ MODE_FAST
Definition: signature.h:44
CoarseSignature::first
struct FineSignature * first
Definition: signature.h:84
elem_d2
static const ElemCat elem_d2
Definition: signature.h:333
SIGELEM_SIZE
#define SIGELEM_SIZE
Definition: signature.h:37
SignatureContext::nb_inputs
int nb_inputs
Definition: signature.h:131
ElemCat::block_count
short block_count
Definition: signature.h:67
NB_LOOKUP_MODE
@ NB_LOOKUP_MODE
Definition: signature.h:45
Point::x
uint8_t x
Definition: signature.h:55
elem_d4
static const ElemCat elem_d4
Definition: signature.h:407
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
elem_a2_data
static const Block elem_a2_data[]
Definition: signature.h:170
SignatureContext::thit
int thit
Definition: signature.h:138
Block::up
Point up
Definition: signature.h:60
MODE_FULL
@ MODE_FULL
Definition: signature.h:43
Point
Definition: signature.h:54
MatchingInfo::offset
int offset
Definition: signature.h:94
StreamContext
Definition: transcoding.c:50
Block
Definition: flashsv2enc.c:68
elem_a1
static const ElemCat elem_a1
Definition: signature.h:168
StreamContext::midcoarse
int midcoarse
Definition: signature.h:121
StreamContext::curfinesig
FineSignature * curfinesig
Definition: signature.h:112
StreamContext::h
int h
Definition: signature.h:106
elem_d1_data
static const Block elem_d1_data[]
Definition: signature.h:186
elem_a1_data
static const Block elem_a1_data[]
Definition: signature.h:146
SignatureContext::thcomposdist
int thcomposdist
Definition: signature.h:135
elem_a2
static const ElemCat elem_a2
Definition: signature.h:184
FineSignature
Definition: signature.h:72
internal.h
SignatureContext
Definition: signature.h:127
elem_d5
static const ElemCat elem_d5
Definition: signature.h:473
common.h
StreamContext::coarsecount
int coarsecount
Definition: signature.h:120
uint8_t
uint8_t
Definition: audio_convert.c:194
MODE_OFF
@ MODE_OFF
Definition: signature.h:42
SignatureContext::thl1
int thl1
Definition: signature.h:136
NB_FORMATS
@ NB_FORMATS
Definition: signature.h:51
CoarseSignature::data
uint8_t data[5][31]
Definition: signature.h:83
StreamContext::w
int w
Definition: signature.h:105
StreamContext::coarseend
CoarseSignature * coarseend
Definition: signature.h:115
CoarseSignature::next
struct CoarseSignature * next
Definition: signature.h:86
ElemCat::elem_count
short elem_count
Definition: signature.h:68
elem_d7
static const ElemCat elem_d7
Definition: signature.h:540
avfilter.h
ELEMENT_COUNT
#define ELEMENT_COUNT
Definition: signature.h:36
FineSignature::framesig
uint8_t framesig[SIGELEM_SIZE/5]
Definition: signature.h:79
SignatureContext::thworddist
int thworddist
Definition: signature.h:134
MatchingInfo::second
struct FineSignature * second
Definition: signature.h:98
SignatureContext::filename
char * filename
Definition: signature.h:132
StreamContext::curcoarsesig1
CoarseSignature * curcoarsesig1
Definition: signature.h:117
MatchingInfo::next
struct MatchingInfo * next
Definition: signature.h:99
FineSignature::prev
struct FineSignature * prev
Definition: signature.h:74
FineSignature::words
uint8_t words[5]
Definition: signature.h:78
FORMAT_XML
@ FORMAT_XML
Definition: signature.h:50
SignatureContext::format
int format
Definition: signature.h:133
MatchingInfo::first
struct FineSignature * first
Definition: signature.h:97
StreamContext::finesiglist
FineSignature * finesiglist
Definition: signature.h:111
lookup_mode
lookup_mode
Definition: signature.h:41
timestamp.h
SignatureContext::streamcontexts
StreamContext * streamcontexts
Definition: signature.h:142
StreamContext::time_base
AVRational time_base
Definition: signature.h:103
elem_d3_data
static const Block elem_d3_data[]
Definition: signature.h:335
elem_d8
static const ElemCat elem_d8
Definition: signature.h:564
elem_d8_data
static const Block elem_d8_data[]
Definition: signature.h:542
elem_d4_data
static const Block elem_d4_data[]
Definition: signature.h:375
CoarseSignature
Definition: signature.h:82
MatchingInfo::matchframes
int matchframes
Definition: signature.h:95
StreamContext::lastindex
uint32_t lastindex
Definition: signature.h:122