vf_xbr.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * Copyright (c) 2011, 2012 Hyllian/Jararaca <sergiogdb@gmail.com>
  5. * Copyright (c) 2014 Arwa Arif <arwaarif1994@gmail.com>
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * XBR Filter is used for depixelization of image.
  24. * This is based on Hyllian's xBR shader.
  25. *
  26. * @see https://forums.libretro.com/t/xbr-algorithm-tutorial/123
  27. * @see https://github.com/yoyofr/iFBA/blob/master/fba_src/src/intf/video/scalers/xbr.cpp
  28. */
  29. #include "libavutil/opt.h"
  30. #include "libavutil/avassert.h"
  31. #include "libavutil/pixdesc.h"
  32. #include "internal.h"
  33. #define LB_MASK 0x00FEFEFE
  34. #define RED_BLUE_MASK 0x00FF00FF
  35. #define GREEN_MASK 0x0000FF00
  36. #ifdef PI
  37. #undef PI
  38. #endif
  39. typedef int (*xbrfunc_t)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
  40. typedef struct XBRContext {
  41. const AVClass *class;
  42. int n;
  43. xbrfunc_t func;
  44. uint32_t rgbtoyuv[1<<24];
  45. } XBRContext;
  46. typedef struct ThreadData {
  47. AVFrame *in, *out;
  48. const uint32_t *rgbtoyuv;
  49. } ThreadData;
  50. #define OFFSET(x) offsetof(XBRContext, x)
  51. #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
  52. static const AVOption xbr_options[] = {
  53. { "n", "set scale factor", OFFSET(n), AV_OPT_TYPE_INT, {.i64 = 3}, 2, 4, .flags = FLAGS },
  54. { NULL }
  55. };
  56. AVFILTER_DEFINE_CLASS(xbr);
  57. static uint32_t pixel_diff(uint32_t x, uint32_t y, const uint32_t *r2y)
  58. {
  59. #define YMASK 0xff0000
  60. #define UMASK 0x00ff00
  61. #define VMASK 0x0000ff
  62. #define ABSDIFF(a,b) (abs((int)(a)-(int)(b)))
  63. uint32_t yuv1 = r2y[x & 0xffffff];
  64. uint32_t yuv2 = r2y[y & 0xffffff];
  65. return (ABSDIFF(yuv1 & YMASK, yuv2 & YMASK) >> 16) +
  66. (ABSDIFF(yuv1 & UMASK, yuv2 & UMASK) >> 8) +
  67. ABSDIFF(yuv1 & VMASK, yuv2 & VMASK);
  68. }
  69. #define ALPHA_BLEND_128_W(a, b) ((((a) & LB_MASK) >> 1) + (((b) & LB_MASK) >> 1))
  70. #define ALPHA_BLEND_BASE(a, b, m, s) ( (RED_BLUE_MASK & (((a) & RED_BLUE_MASK) + (((((b) & RED_BLUE_MASK) - ((a) & RED_BLUE_MASK)) * (m)) >> (s)))) \
  71. | (GREEN_MASK & (((a) & GREEN_MASK) + (((((b) & GREEN_MASK) - ((a) & GREEN_MASK)) * (m)) >> (s)))))
  72. #define ALPHA_BLEND_32_W(a, b) ALPHA_BLEND_BASE(a, b, 1, 3)
  73. #define ALPHA_BLEND_64_W(a, b) ALPHA_BLEND_BASE(a, b, 1, 2)
  74. #define ALPHA_BLEND_192_W(a, b) ALPHA_BLEND_BASE(a, b, 3, 2)
  75. #define ALPHA_BLEND_224_W(a, b) ALPHA_BLEND_BASE(a, b, 7, 3)
  76. #define df(A, B) pixel_diff(A, B, r2y)
  77. #define eq(A, B) (df(A, B) < 155)
  78. #define FILT2(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, \
  79. N0, N1, N2, N3) do { \
  80. if (PE != PH && PE != PF) { \
  81. const unsigned e = df(PE,PC) + df(PE,PG) + df(PI,H5) + df(PI,F4) + (df(PH,PF)<<2); \
  82. const unsigned i = df(PH,PD) + df(PH,I5) + df(PF,I4) + df(PF,PB) + (df(PE,PI)<<2); \
  83. if (e <= i) { \
  84. const unsigned px = df(PE,PF) <= df(PE,PH) ? PF : PH; \
  85. if (e < i && (!eq(PF,PB) && !eq(PH,PD) || eq(PE,PI) \
  86. && (!eq(PF,I4) && !eq(PH,I5)) \
  87. || eq(PE,PG) || eq(PE,PC))) { \
  88. const unsigned ke = df(PF,PG); \
  89. const unsigned ki = df(PH,PC); \
  90. const int left = ke<<1 <= ki && PE != PG && PD != PG; \
  91. const int up = ke >= ki<<1 && PE != PC && PB != PC; \
  92. if (left && up) { \
  93. E[N3] = ALPHA_BLEND_224_W(E[N3], px); \
  94. E[N2] = ALPHA_BLEND_64_W( E[N2], px); \
  95. E[N1] = E[N2]; \
  96. } else if (left) { \
  97. E[N3] = ALPHA_BLEND_192_W(E[N3], px); \
  98. E[N2] = ALPHA_BLEND_64_W( E[N2], px); \
  99. } else if (up) { \
  100. E[N3] = ALPHA_BLEND_192_W(E[N3], px); \
  101. E[N1] = ALPHA_BLEND_64_W( E[N1], px); \
  102. } else { /* diagonal */ \
  103. E[N3] = ALPHA_BLEND_128_W(E[N3], px); \
  104. } \
  105. } else { \
  106. E[N3] = ALPHA_BLEND_128_W(E[N3], px); \
  107. } \
  108. } \
  109. } \
  110. } while (0)
  111. #define FILT3(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, \
  112. N0, N1, N2, N3, N4, N5, N6, N7, N8) do { \
  113. if (PE != PH && PE != PF) { \
  114. const unsigned e = df(PE,PC) + df(PE,PG) + df(PI,H5) + df(PI,F4) + (df(PH,PF)<<2); \
  115. const unsigned i = df(PH,PD) + df(PH,I5) + df(PF,I4) + df(PF,PB) + (df(PE,PI)<<2); \
  116. if (e <= i) { \
  117. const unsigned px = df(PE,PF) <= df(PE,PH) ? PF : PH; \
  118. if (e < i && (!eq(PF,PB) && !eq(PF,PC) || !eq(PH,PD) && !eq(PH,PG) || eq(PE,PI) \
  119. && (!eq(PF,F4) && !eq(PF,I4) || !eq(PH,H5) && !eq(PH,I5)) \
  120. || eq(PE,PG) || eq(PE,PC))) { \
  121. const unsigned ke = df(PF,PG); \
  122. const unsigned ki = df(PH,PC); \
  123. const int left = ke<<1 <= ki && PE != PG && PD != PG; \
  124. const int up = ke >= ki<<1 && PE != PC && PB != PC; \
  125. if (left && up) { \
  126. E[N7] = ALPHA_BLEND_192_W(E[N7], px); \
  127. E[N6] = ALPHA_BLEND_64_W( E[N6], px); \
  128. E[N5] = E[N7]; \
  129. E[N2] = E[N6]; \
  130. E[N8] = px; \
  131. } else if (left) { \
  132. E[N7] = ALPHA_BLEND_192_W(E[N7], px); \
  133. E[N5] = ALPHA_BLEND_64_W( E[N5], px); \
  134. E[N6] = ALPHA_BLEND_64_W( E[N6], px); \
  135. E[N8] = px; \
  136. } else if (up) { \
  137. E[N5] = ALPHA_BLEND_192_W(E[N5], px); \
  138. E[N7] = ALPHA_BLEND_64_W( E[N7], px); \
  139. E[N2] = ALPHA_BLEND_64_W( E[N2], px); \
  140. E[N8] = px; \
  141. } else { /* diagonal */ \
  142. E[N8] = ALPHA_BLEND_224_W(E[N8], px); \
  143. E[N5] = ALPHA_BLEND_32_W( E[N5], px); \
  144. E[N7] = ALPHA_BLEND_32_W( E[N7], px); \
  145. } \
  146. } else { \
  147. E[N8] = ALPHA_BLEND_128_W(E[N8], px); \
  148. } \
  149. } \
  150. } \
  151. } while (0)
  152. #define FILT4(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, \
  153. N15, N14, N11, N3, N7, N10, N13, N12, N9, N6, N2, N1, N5, N8, N4, N0) do { \
  154. if (PE != PH && PE != PF) { \
  155. const unsigned e = df(PE,PC) + df(PE,PG) + df(PI,H5) + df(PI,F4) + (df(PH,PF)<<2); \
  156. const unsigned i = df(PH,PD) + df(PH,I5) + df(PF,I4) + df(PF,PB) + (df(PE,PI)<<2); \
  157. if (e <= i) { \
  158. const unsigned px = df(PE,PF) <= df(PE,PH) ? PF : PH; \
  159. if (e < i && (!eq(PF,PB) && !eq(PH,PD) || eq(PE,PI) \
  160. && (!eq(PF,I4) && !eq(PH,I5)) \
  161. || eq(PE,PG) || eq(PE,PC))) { \
  162. const unsigned ke = df(PF,PG); \
  163. const unsigned ki = df(PH,PC); \
  164. const int left = ke<<1 <= ki && PE != PG && PD != PG; \
  165. const int up = ke >= ki<<1 && PE != PC && PB != PC; \
  166. if (left && up) { \
  167. E[N13] = ALPHA_BLEND_192_W(E[N13], px); \
  168. E[N12] = ALPHA_BLEND_64_W( E[N12], px); \
  169. E[N15] = E[N14] = E[N11] = px; \
  170. E[N10] = E[N3] = E[N12]; \
  171. E[N7] = E[N13]; \
  172. } else if (left) { \
  173. E[N11] = ALPHA_BLEND_192_W(E[N11], px); \
  174. E[N13] = ALPHA_BLEND_192_W(E[N13], px); \
  175. E[N10] = ALPHA_BLEND_64_W( E[N10], px); \
  176. E[N12] = ALPHA_BLEND_64_W( E[N12], px); \
  177. E[N14] = px; \
  178. E[N15] = px; \
  179. } else if (up) { \
  180. E[N14] = ALPHA_BLEND_192_W(E[N14], px); \
  181. E[N7 ] = ALPHA_BLEND_192_W(E[N7 ], px); \
  182. E[N10] = ALPHA_BLEND_64_W( E[N10], px); \
  183. E[N3 ] = ALPHA_BLEND_64_W( E[N3 ], px); \
  184. E[N11] = px; \
  185. E[N15] = px; \
  186. } else { /* diagonal */ \
  187. E[N11] = ALPHA_BLEND_128_W(E[N11], px); \
  188. E[N14] = ALPHA_BLEND_128_W(E[N14], px); \
  189. E[N15] = px; \
  190. } \
  191. } else { \
  192. E[N15] = ALPHA_BLEND_128_W(E[N15], px); \
  193. } \
  194. } \
  195. } \
  196. } while (0)
  197. static av_always_inline void xbr_filter(const ThreadData *td, int jobnr, int nb_jobs, int n)
  198. {
  199. int x, y;
  200. const AVFrame *input = td->in;
  201. AVFrame *output = td->out;
  202. const uint32_t *r2y = td->rgbtoyuv;
  203. const int slice_start = (input->height * jobnr ) / nb_jobs;
  204. const int slice_end = (input->height * (jobnr+1)) / nb_jobs;
  205. const int nl = output->linesize[0] >> 2;
  206. const int nl1 = nl + nl;
  207. const int nl2 = nl1 + nl;
  208. for (y = slice_start; y < slice_end; y++) {
  209. uint32_t *E = (uint32_t *)(output->data[0] + y * output->linesize[0] * n);
  210. const uint32_t *sa2 = (uint32_t *)(input->data[0] + y * input->linesize[0] - 8); /* center */
  211. const uint32_t *sa1 = sa2 - (input->linesize[0]>>2); /* up x1 */
  212. const uint32_t *sa0 = sa1 - (input->linesize[0]>>2); /* up x2 */
  213. const uint32_t *sa3 = sa2 + (input->linesize[0]>>2); /* down x1 */
  214. const uint32_t *sa4 = sa3 + (input->linesize[0]>>2); /* down x2 */
  215. if (y <= 1) {
  216. sa0 = sa1;
  217. if (y == 0) {
  218. sa0 = sa1 = sa2;
  219. }
  220. }
  221. if (y >= input->height - 2) {
  222. sa4 = sa3;
  223. if (y == input->height - 1) {
  224. sa4 = sa3 = sa2;
  225. }
  226. }
  227. for (x = 0; x < input->width; x++) {
  228. const uint32_t B1 = sa0[2];
  229. const uint32_t PB = sa1[2];
  230. const uint32_t PE = sa2[2];
  231. const uint32_t PH = sa3[2];
  232. const uint32_t H5 = sa4[2];
  233. const int pprev = 2 - (x > 0);
  234. const uint32_t A1 = sa0[pprev];
  235. const uint32_t PA = sa1[pprev];
  236. const uint32_t PD = sa2[pprev];
  237. const uint32_t PG = sa3[pprev];
  238. const uint32_t G5 = sa4[pprev];
  239. const int pprev2 = pprev - (x > 1);
  240. const uint32_t A0 = sa1[pprev2];
  241. const uint32_t D0 = sa2[pprev2];
  242. const uint32_t G0 = sa3[pprev2];
  243. const int pnext = 3 - (x == input->width - 1);
  244. const uint32_t C1 = sa0[pnext];
  245. const uint32_t PC = sa1[pnext];
  246. const uint32_t PF = sa2[pnext];
  247. const uint32_t PI = sa3[pnext];
  248. const uint32_t I5 = sa4[pnext];
  249. const int pnext2 = pnext + 1 - (x >= input->width - 2);
  250. const uint32_t C4 = sa1[pnext2];
  251. const uint32_t F4 = sa2[pnext2];
  252. const uint32_t I4 = sa3[pnext2];
  253. if (n == 2) {
  254. E[0] = E[1] = // 0, 1
  255. E[nl] = E[nl + 1] = PE; // 2, 3
  256. FILT2(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, 0, 1, nl, nl+1);
  257. FILT2(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, nl, 0, nl+1, 1);
  258. FILT2(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, nl+1, nl, 1, 0);
  259. FILT2(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, 1, nl+1, 0, nl);
  260. } else if (n == 3) {
  261. E[0] = E[1] = E[2] = // 0, 1, 2
  262. E[nl] = E[nl+1] = E[nl+2] = // 3, 4, 5
  263. E[nl1] = E[nl1+1] = E[nl1+2] = PE; // 6, 7, 8
  264. FILT3(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, 0, 1, 2, nl, nl+1, nl+2, nl1, nl1+1, nl1+2);
  265. FILT3(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, nl1, nl, 0, nl1+1, nl+1, 1, nl1+2, nl+2, 2);
  266. FILT3(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, nl1+2, nl1+1, nl1, nl+2, nl+1, nl, 2, 1, 0);
  267. FILT3(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, 2, nl+2, nl1+2, 1, nl+1, nl1+1, 0, nl, nl1);
  268. } else if (n == 4) {
  269. E[0] = E[1] = E[2] = E[3] = // 0, 1, 2, 3
  270. E[nl] = E[nl+1] = E[nl+2] = E[nl+3] = // 4, 5, 6, 7
  271. E[nl1] = E[nl1+1] = E[nl1+2] = E[nl1+3] = // 8, 9, 10, 11
  272. E[nl2] = E[nl2+1] = E[nl2+2] = E[nl2+3] = PE; // 12, 13, 14, 15
  273. FILT4(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, nl2+3, nl2+2, nl1+3, 3, nl+3, nl1+2, nl2+1, nl2, nl1+1, nl+2, 2, 1, nl+1, nl1, nl, 0);
  274. FILT4(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, 3, nl+3, 2, 0, 1, nl+2, nl1+3, nl2+3, nl1+2, nl+1, nl, nl1, nl1+1, nl2+2, nl2+1, nl2);
  275. FILT4(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, 0, 1, nl, nl2, nl1, nl+1, 2, 3, nl+2, nl1+1, nl2+1, nl2+2, nl1+2, nl+3, nl1+3, nl2+3);
  276. FILT4(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, nl2, nl1, nl2+1, nl2+3, nl2+2, nl1+1, nl, 0, nl+1, nl1+2, nl1+3, nl+3, nl+2, 1, 2, 3);
  277. }
  278. sa0 += 1;
  279. sa1 += 1;
  280. sa2 += 1;
  281. sa3 += 1;
  282. sa4 += 1;
  283. E += n;
  284. }
  285. }
  286. }
  287. #define XBR_FUNC(size) \
  288. static int xbr##size##x(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
  289. { \
  290. xbr_filter(arg, jobnr, nb_jobs, size); \
  291. return 0; \
  292. }
  293. XBR_FUNC(2)
  294. XBR_FUNC(3)
  295. XBR_FUNC(4)
  296. static int config_output(AVFilterLink *outlink)
  297. {
  298. AVFilterContext *ctx = outlink->src;
  299. XBRContext *s = ctx->priv;
  300. AVFilterLink *inlink = ctx->inputs[0];
  301. outlink->w = inlink->w * s->n;
  302. outlink->h = inlink->h * s->n;
  303. return 0;
  304. }
  305. static int query_formats(AVFilterContext *ctx)
  306. {
  307. static const enum AVPixelFormat pix_fmts[] = {
  308. AV_PIX_FMT_0RGB32, AV_PIX_FMT_NONE,
  309. };
  310. AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
  311. if (!fmts_list)
  312. return AVERROR(ENOMEM);
  313. return ff_set_common_formats(ctx, fmts_list);
  314. }
  315. static int filter_frame(AVFilterLink *inlink, AVFrame *in)
  316. {
  317. AVFilterContext *ctx = inlink->dst;
  318. AVFilterLink *outlink = ctx->outputs[0];
  319. XBRContext *s = ctx->priv;
  320. ThreadData td;
  321. AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
  322. if (!out) {
  323. av_frame_free(&in);
  324. return AVERROR(ENOMEM);
  325. }
  326. av_frame_copy_props(out, in);
  327. td.in = in;
  328. td.out = out;
  329. td.rgbtoyuv = s->rgbtoyuv;
  330. ctx->internal->execute(ctx, s->func, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx)));
  331. out->width = outlink->w;
  332. out->height = outlink->h;
  333. av_frame_free(&in);
  334. return ff_filter_frame(outlink, out);
  335. }
  336. static int init(AVFilterContext *ctx)
  337. {
  338. XBRContext *s = ctx->priv;
  339. static const xbrfunc_t xbrfuncs[] = {xbr2x, xbr3x, xbr4x};
  340. uint32_t c;
  341. int bg, rg, g;
  342. for (bg = -255; bg < 256; bg++) {
  343. for (rg = -255; rg < 256; rg++) {
  344. const uint32_t u = (uint32_t)((-169*rg + 500*bg)/1000) + 128;
  345. const uint32_t v = (uint32_t)(( 500*rg - 81*bg)/1000) + 128;
  346. int startg = FFMAX3(-bg, -rg, 0);
  347. int endg = FFMIN3(255-bg, 255-rg, 255);
  348. uint32_t y = (uint32_t)(( 299*rg + 1000*startg + 114*bg)/1000);
  349. c = bg + rg * (1 << 16) + 0x010101 * startg;
  350. for (g = startg; g <= endg; g++) {
  351. s->rgbtoyuv[c] = ((y++) << 16) + (u << 8) + v;
  352. c+= 0x010101;
  353. }
  354. }
  355. }
  356. s->func = xbrfuncs[s->n - 2];
  357. return 0;
  358. }
  359. static const AVFilterPad xbr_inputs[] = {
  360. {
  361. .name = "default",
  362. .type = AVMEDIA_TYPE_VIDEO,
  363. .filter_frame = filter_frame,
  364. },
  365. { NULL }
  366. };
  367. static const AVFilterPad xbr_outputs[] = {
  368. {
  369. .name = "default",
  370. .type = AVMEDIA_TYPE_VIDEO,
  371. .config_props = config_output,
  372. },
  373. { NULL }
  374. };
  375. AVFilter ff_vf_xbr = {
  376. .name = "xbr",
  377. .description = NULL_IF_CONFIG_SMALL("Scale the input using xBR algorithm."),
  378. .inputs = xbr_inputs,
  379. .outputs = xbr_outputs,
  380. .query_formats = query_formats,
  381. .priv_size = sizeof(XBRContext),
  382. .priv_class = &xbr_class,
  383. .init = init,
  384. .flags = AVFILTER_FLAG_SLICE_THREADS,
  385. };