signature.h 25 KB

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