h264_metadata: Add option to delete filler data
[libav.git] / libavfilter / vf_yadif.c
CommitLineData
acbac567
MN
1/*
2 * Copyright (C) 2006-2010 Michael Niedermayer <michaelni@gmx.at>
b137bf7d 3 * 2010 James Darnley <james.darnley@gmail.com>
acbac567 4 *
2912e87a 5 * This file is part of Libav.
acbac567 6 *
d8e763fd
RK
7 * Libav 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.
acbac567 11 *
2912e87a 12 * Libav is distributed in the hope that it will be useful,
acbac567 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d8e763fd
RK
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
acbac567 16 *
d8e763fd
RK
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
acbac567
MN
20 */
21
22#include "libavutil/cpu.h"
acbac567 23#include "libavutil/common.h"
7536c671 24#include "libavutil/opt.h"
88312a4d 25#include "libavutil/pixdesc.h"
acbac567 26#include "avfilter.h"
b74a1da4 27#include "formats.h"
803391f7 28#include "internal.h"
43c7a01e 29#include "video.h"
acbac567
MN
30#include "yadif.h"
31
32#undef NDEBUG
33#include <assert.h>
34
cb79881b
AK
35typedef struct ThreadData {
36 AVFrame *frame;
37 int plane;
38 int w, h;
39 int parity;
40 int tff;
41} ThreadData;
42
feed2390
MN
43#define MAX_ALIGN 8
44
acbac567 45#define CHECK(j)\
b0ef0ae7 46 { int score = FFABS(cur[mrefs - 1 + (j)] - cur[prefs - 1 - (j)])\
233ed6b3 47 + FFABS(cur[mrefs +(j)] - cur[prefs -(j)])\
b0ef0ae7 48 + FFABS(cur[mrefs + 1 + (j)] - cur[prefs + 1 - (j)]);\
acbac567
MN
49 if (score < spatial_score) {\
50 spatial_score= score;\
233ed6b3 51 spatial_pred= (cur[mrefs +(j)] + cur[prefs -(j)])>>1;\
acbac567 52
b0ef0ae7
JD
53/* The is_not_edge argument here controls when the code will enter a branch
54 * which reads up to and including x-3 and x+3. */
55
56#define FILTER(start, end, is_not_edge) \
64ed3976 57 for (x = start; x < end; x++) { \
b137bf7d
JD
58 int c = cur[mrefs]; \
59 int d = (prev2[0] + next2[0])>>1; \
60 int e = cur[prefs]; \
61 int temporal_diff0 = FFABS(prev2[0] - next2[0]); \
62 int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1; \
63 int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1; \
28165fee
LB
64 int diff = FFMAX3(temporal_diff0 >> 1, temporal_diff1, temporal_diff2); \
65 int spatial_pred = (c+e) >> 1; \
b137bf7d 66 \
b0ef0ae7
JD
67 if (is_not_edge) {\
68 int spatial_score = FFABS(cur[mrefs - 1] - cur[prefs - 1]) + FFABS(c-e) \
69 + FFABS(cur[mrefs + 1] - cur[prefs + 1]) - 1; \
64ed3976
AK
70 CHECK(-1) CHECK(-2) }} }} \
71 CHECK( 1) CHECK( 2) }} }} \
72 }\
b137bf7d
JD
73 \
74 if (mode < 2) { \
28165fee
LB
75 int b = (prev2[2 * mrefs] + next2[2 * mrefs])>>1; \
76 int f = (prev2[2 * prefs] + next2[2 * prefs])>>1; \
77 int max = FFMAX3(d - e, d - c, FFMIN(b - c, f - e)); \
78 int min = FFMIN3(d - e, d - c, FFMAX(b - c, f - e)); \
b137bf7d
JD
79 \
80 diff = FFMAX3(diff, min, -max); \
81 } \
82 \
83 if (spatial_pred > d + diff) \
84 spatial_pred = d + diff; \
85 else if (spatial_pred < d - diff) \
86 spatial_pred = d - diff; \
87 \
88 dst[0] = spatial_pred; \
89 \
90 dst++; \
91 cur++; \
92 prev++; \
93 next++; \
94 prev2++; \
95 next2++; \
96 }
acbac567 97
99162f8d
AK
98static void filter_line_c(void *dst1,
99 void *prev1, void *cur1, void *next1,
b137bf7d
JD
100 int w, int prefs, int mrefs, int parity, int mode)
101{
99162f8d
AK
102 uint8_t *dst = dst1;
103 uint8_t *prev = prev1;
104 uint8_t *cur = cur1;
105 uint8_t *next = next1;
b137bf7d
JD
106 int x;
107 uint8_t *prev2 = parity ? prev : cur ;
108 uint8_t *next2 = parity ? cur : next;
acbac567 109
b0ef0ae7
JD
110 /* The function is called with the pointers already pointing to data[3] and
111 * with 6 subtracted from the width. This allows the FILTER macro to be
112 * called so that it processes all the pixels normally. A constant value of
113 * true for is_not_edge lets the compiler ignore the if statement. */
114 FILTER(0, w, 1)
b137bf7d 115}
acbac567 116
64ed3976 117static void filter_edges(void *dst1, void *prev1, void *cur1, void *next1,
b0ef0ae7 118 int w, int prefs, int mrefs, int parity, int mode)
64ed3976
AK
119{
120 uint8_t *dst = dst1;
121 uint8_t *prev = prev1;
122 uint8_t *cur = cur1;
123 uint8_t *next = next1;
124 int x;
125 uint8_t *prev2 = parity ? prev : cur ;
126 uint8_t *next2 = parity ? cur : next;
127
feed2390
MN
128 const int edge = MAX_ALIGN - 1;
129
b0ef0ae7
JD
130 /* Only edge pixels need to be processed here. A constant value of false
131 * for is_not_edge should let the compiler ignore the whole branch. */
132 FILTER(0, 3, 0)
64ed3976 133
feed2390
MN
134 dst = (uint8_t*)dst1 + w - edge;
135 prev = (uint8_t*)prev1 + w - edge;
136 cur = (uint8_t*)cur1 + w - edge;
137 next = (uint8_t*)next1 + w - edge;
64ed3976
AK
138 prev2 = (uint8_t*)(parity ? prev : cur);
139 next2 = (uint8_t*)(parity ? cur : next);
140
feed2390 141 FILTER(w - edge, w - 3, 1)
b0ef0ae7 142 FILTER(w - 3, w, 0)
64ed3976
AK
143}
144
145
99162f8d
AK
146static void filter_line_c_16bit(void *dst1,
147 void *prev1, void *cur1, void *next1,
28165fee
LB
148 int w, int prefs, int mrefs, int parity,
149 int mode)
b137bf7d 150{
99162f8d
AK
151 uint16_t *dst = dst1;
152 uint16_t *prev = prev1;
153 uint16_t *cur = cur1;
154 uint16_t *next = next1;
b137bf7d
JD
155 int x;
156 uint16_t *prev2 = parity ? prev : cur ;
157 uint16_t *next2 = parity ? cur : next;
158 mrefs /= 2;
159 prefs /= 2;
acbac567 160
b0ef0ae7 161 FILTER(0, w, 1)
64ed3976
AK
162}
163
164static void filter_edges_16bit(void *dst1, void *prev1, void *cur1, void *next1,
b0ef0ae7 165 int w, int prefs, int mrefs, int parity, int mode)
64ed3976
AK
166{
167 uint16_t *dst = dst1;
168 uint16_t *prev = prev1;
169 uint16_t *cur = cur1;
170 uint16_t *next = next1;
171 int x;
172 uint16_t *prev2 = parity ? prev : cur ;
173 uint16_t *next2 = parity ? cur : next;
feed2390
MN
174
175 const int edge = MAX_ALIGN / 2 - 1;
176
d10499a3
JD
177 mrefs /= 2;
178 prefs /= 2;
64ed3976 179
b0ef0ae7 180 FILTER(0, 3, 0)
64ed3976 181
feed2390
MN
182 dst = (uint16_t*)dst1 + w - edge;
183 prev = (uint16_t*)prev1 + w - edge;
184 cur = (uint16_t*)cur1 + w - edge;
185 next = (uint16_t*)next1 + w - edge;
64ed3976
AK
186 prev2 = (uint16_t*)(parity ? prev : cur);
187 next2 = (uint16_t*)(parity ? cur : next);
188
feed2390 189 FILTER(w - edge, w - 3, 1)
b0ef0ae7 190 FILTER(w - 3, w, 0)
acbac567
MN
191}
192
cb79881b
AK
193static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
194{
195 YADIFContext *s = ctx->priv;
196 ThreadData *td = arg;
197 int refs = s->cur->linesize[td->plane];
2268db2c 198 int df = (s->csp->comp[td->plane].depth + 7) / 8;
cb79881b
AK
199 int pix_3 = 3 * df;
200 int slice_h = td->h / nb_jobs;
201 int slice_start = jobnr * slice_h;
202 int slice_end = (jobnr == nb_jobs - 1) ? td->h : (jobnr + 1) * slice_h;
203 int y;
feed2390 204 int edge = 3 + MAX_ALIGN / df - 1;
cb79881b
AK
205
206 /* filtering reads 3 pixels to the left/right; to avoid invalid reads,
207 * we need to call the c variant which avoids this for border pixels
208 */
209 for (y = slice_start; y < slice_end; y++) {
210 if ((y ^ td->parity) & 1) {
211 uint8_t *prev = &s->prev->data[td->plane][y * refs];
212 uint8_t *cur = &s->cur ->data[td->plane][y * refs];
213 uint8_t *next = &s->next->data[td->plane][y * refs];
214 uint8_t *dst = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]];
215 int mode = y == 1 || y + 2 == td->h ? 2 : s->mode;
216 s->filter_line(dst + pix_3, prev + pix_3, cur + pix_3,
feed2390 217 next + pix_3, td->w - edge,
cb79881b
AK
218 y + 1 < td->h ? refs : -refs,
219 y ? -refs : refs,
220 td->parity ^ td->tff, mode);
221 s->filter_edges(dst, prev, cur, next, td->w,
222 y + 1 < td->h ? refs : -refs,
223 y ? -refs : refs,
224 td->parity ^ td->tff, mode);
225 } else {
226 memcpy(&td->frame->data[td->plane][y * td->frame->linesize[td->plane]],
227 &s->cur->data[td->plane][y * refs], td->w * df);
228 }
229 }
230 return 0;
231}
232
7e350379 233static void filter(AVFilterContext *ctx, AVFrame *dstpic,
acbac567
MN
234 int parity, int tff)
235{
236 YADIFContext *yadif = ctx->priv;
cb79881b
AK
237 ThreadData td = { .frame = dstpic, .parity = parity, .tff = tff };
238 int i;
acbac567 239
88312a4d 240 for (i = 0; i < yadif->csp->nb_components; i++) {
7e350379
AK
241 int w = dstpic->width;
242 int h = dstpic->height;
acbac567 243
be4e8908 244 if (i == 1 || i == 2) {
88312a4d
JD
245 w >>= yadif->csp->log2_chroma_w;
246 h >>= yadif->csp->log2_chroma_h;
247 }
248
cb79881b
AK
249
250 td.w = w;
251 td.h = h;
252 td.plane = i;
253
254 ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ctx->graph->nb_threads));
acbac567 255 }
731fa116
RB
256
257 emms_c();
acbac567
MN
258}
259
7e350379 260static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h)
acbac567 261{
7e350379 262 AVFrame *frame;
28165fee
LB
263 int width = FFALIGN(w, 32);
264 int height = FFALIGN(h + 2, 32);
acbac567
MN
265 int i;
266
7e350379 267 frame = ff_default_get_video_buffer(link, width, height);
acbac567 268
7e350379
AK
269 frame->width = w;
270 frame->height = h;
acbac567
MN
271
272 for (i = 0; i < 3; i++)
7e350379 273 frame->data[i] += frame->linesize[i];
acbac567 274
7e350379 275 return frame;
acbac567
MN
276}
277
3825b526 278static int return_frame(AVFilterContext *ctx, int is_second)
b0f65613 279{
acbac567 280 YADIFContext *yadif = ctx->priv;
28165fee 281 AVFilterLink *link = ctx->outputs[0];
3825b526 282 int tff, ret;
a51c71bb
BC
283
284 if (yadif->parity == -1) {
7e350379
AK
285 tff = yadif->cur->interlaced_frame ?
286 yadif->cur->top_field_first : 1;
a51c71bb 287 } else {
28165fee 288 tff = yadif->parity ^ 1;
a51c71bb 289 }
acbac567 290
5feb67f8 291 if (is_second) {
7e350379 292 yadif->out = ff_get_video_buffer(link, link->w, link->h);
8f3a3ce7
AK
293 if (!yadif->out)
294 return AVERROR(ENOMEM);
295
7e350379
AK
296 av_frame_copy_props(yadif->out, yadif->cur);
297 yadif->out->interlaced_frame = 0;
5feb67f8 298 }
acbac567
MN
299
300 filter(ctx, yadif->out, tff ^ !is_second, tff);
301
902d49ee 302 if (is_second) {
7dd56d41
RN
303 int64_t cur_pts = yadif->cur->pts;
304 int64_t next_pts = yadif->next->pts;
305
306 if (next_pts != AV_NOPTS_VALUE && cur_pts != AV_NOPTS_VALUE) {
307 yadif->out->pts = cur_pts + next_pts;
902d49ee
BC
308 } else {
309 yadif->out->pts = AV_NOPTS_VALUE;
310 }
902d49ee 311 }
565e4993 312 ret = ff_filter_frame(ctx->outputs[0], yadif->out);
acbac567 313
b0f65613 314 yadif->frame_pending = (yadif->mode&1) && !is_second;
565e4993 315 return ret;
acbac567
MN
316}
317
7e350379 318static int filter_frame(AVFilterLink *link, AVFrame *frame)
acbac567
MN
319{
320 AVFilterContext *ctx = link->dst;
321 YADIFContext *yadif = ctx->priv;
322
b0f65613 323 if (yadif->frame_pending)
acbac567
MN
324 return_frame(ctx, 1);
325
326 if (yadif->prev)
7e350379 327 av_frame_free(&yadif->prev);
acbac567
MN
328 yadif->prev = yadif->cur;
329 yadif->cur = yadif->next;
7e350379 330 yadif->next = frame;
acbac567 331
b0f65613 332 if (!yadif->cur)
ebc8d974 333 return 0;
acbac567 334
7e350379
AK
335 if (yadif->auto_enable && !yadif->cur->interlaced_frame) {
336 yadif->out = av_frame_clone(yadif->cur);
1dc42050
AK
337 if (!yadif->out)
338 return AVERROR(ENOMEM);
339
7e350379 340 av_frame_free(&yadif->prev);
7dd56d41
RN
341 if (yadif->out->pts != AV_NOPTS_VALUE)
342 yadif->out->pts *= 2;
565e4993 343 return ff_filter_frame(ctx->outputs[0], yadif->out);
ab09df9d
JP
344 }
345
1dc42050 346 if (!yadif->prev &&
7e350379 347 !(yadif->prev = av_frame_clone(yadif->cur)))
1dc42050 348 return AVERROR(ENOMEM);
48f7f29f 349
7e350379 350 yadif->out = ff_get_video_buffer(ctx->outputs[0], link->w, link->h);
8f3a3ce7
AK
351 if (!yadif->out)
352 return AVERROR(ENOMEM);
acbac567 353
7e350379
AK
354 av_frame_copy_props(yadif->out, yadif->cur);
355 yadif->out->interlaced_frame = 0;
28165fee 356
7dd56d41
RN
357 if (yadif->out->pts != AV_NOPTS_VALUE)
358 yadif->out->pts *= 2;
28165fee 359
565e4993 360 return return_frame(ctx, 0);
acbac567
MN
361}
362
363static int request_frame(AVFilterLink *link)
364{
365 AVFilterContext *ctx = link->src;
366 YADIFContext *yadif = ctx->priv;
367
b0f65613 368 if (yadif->frame_pending) {
acbac567
MN
369 return_frame(ctx, 1);
370 return 0;
371 }
372
b0f65613 373 do {
acbac567
MN
374 int ret;
375
394a0267
RN
376 if (yadif->eof)
377 return AVERROR_EOF;
378
803391f7 379 ret = ff_request_frame(link->src->inputs[0]);
394a0267
RN
380
381 if (ret == AVERROR_EOF && yadif->next) {
7e350379 382 AVFrame *next = av_frame_clone(yadif->next);
28165fee 383
1dc42050
AK
384 if (!next)
385 return AVERROR(ENOMEM);
386
394a0267
RN
387 next->pts = yadif->next->pts * 2 - yadif->cur->pts;
388
565e4993 389 filter_frame(link->src->inputs[0], next);
394a0267
RN
390 yadif->eof = 1;
391 } else if (ret < 0) {
acbac567 392 return ret;
394a0267 393 }
b0f65613 394 } while (!yadif->cur);
acbac567
MN
395
396 return 0;
397}
398
399static int poll_frame(AVFilterLink *link)
400{
401 YADIFContext *yadif = link->src->priv;
402 int ret, val;
403
b0f65613 404 if (yadif->frame_pending)
acbac567
MN
405 return 1;
406
803391f7 407 val = ff_poll_frame(link->src->inputs[0]);
a07578f3
RN
408 if (val <= 0)
409 return val;
acbac567 410
41ed7ab4 411 //FIXME change API to not require this red tape
28165fee 412 if (val == 1 && !yadif->next) {
803391f7 413 if ((ret = ff_request_frame(link->src->inputs[0])) < 0)
acbac567 414 return ret;
803391f7 415 val = ff_poll_frame(link->src->inputs[0]);
a07578f3
RN
416 if (val <= 0)
417 return val;
acbac567 418 }
d85e18e6 419 assert(yadif->next || !val);
acbac567 420
7e350379 421 if (yadif->auto_enable && yadif->next && !yadif->next->interlaced_frame)
ab09df9d
JP
422 return val;
423
acbac567
MN
424 return val * ((yadif->mode&1)+1);
425}
426
427static av_cold void uninit(AVFilterContext *ctx)
428{
429 YADIFContext *yadif = ctx->priv;
430
7e350379
AK
431 if (yadif->prev) av_frame_free(&yadif->prev);
432 if (yadif->cur ) av_frame_free(&yadif->cur );
433 if (yadif->next) av_frame_free(&yadif->next);
acbac567
MN
434}
435
436static int query_formats(AVFilterContext *ctx)
437{
716d413c
AK
438 static const enum AVPixelFormat pix_fmts[] = {
439 AV_PIX_FMT_YUV420P,
440 AV_PIX_FMT_YUV422P,
441 AV_PIX_FMT_YUV444P,
442 AV_PIX_FMT_YUV410P,
443 AV_PIX_FMT_YUV411P,
444 AV_PIX_FMT_GRAY8,
445 AV_PIX_FMT_YUVJ420P,
446 AV_PIX_FMT_YUVJ422P,
447 AV_PIX_FMT_YUVJ444P,
448 AV_NE( AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_GRAY16LE ),
449 AV_PIX_FMT_YUV440P,
450 AV_PIX_FMT_YUVJ440P,
451 AV_NE( AV_PIX_FMT_YUV420P10BE, AV_PIX_FMT_YUV420P10LE ),
452 AV_NE( AV_PIX_FMT_YUV422P10BE, AV_PIX_FMT_YUV422P10LE ),
453 AV_NE( AV_PIX_FMT_YUV444P10BE, AV_PIX_FMT_YUV444P10LE ),
454 AV_NE( AV_PIX_FMT_YUV420P16BE, AV_PIX_FMT_YUV420P16LE ),
455 AV_NE( AV_PIX_FMT_YUV422P16BE, AV_PIX_FMT_YUV422P16LE ),
456 AV_NE( AV_PIX_FMT_YUV444P16BE, AV_PIX_FMT_YUV444P16LE ),
457 AV_PIX_FMT_YUVA420P,
458 AV_PIX_FMT_NONE
acbac567
MN
459 };
460
b74a1da4 461 ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
acbac567
MN
462
463 return 0;
464}
465
7dd56d41
RN
466static int config_props(AVFilterLink *link)
467{
ccd70d9c
AK
468 YADIFContext *s = link->src->priv;
469
7dd56d41
RN
470 link->time_base.num = link->src->inputs[0]->time_base.num;
471 link->time_base.den = link->src->inputs[0]->time_base.den * 2;
472 link->w = link->src->inputs[0]->w;
473 link->h = link->src->inputs[0]->h;
474
9df477e0
MN
475 if (s->mode & 1)
476 link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate,
477 (AVRational){2, 1});
478
ccd70d9c 479 s->csp = av_pix_fmt_desc_get(link->format);
2268db2c 480 if (s->csp->comp[0].depth > 8) {
64ed3976
AK
481 s->filter_line = filter_line_c_16bit;
482 s->filter_edges = filter_edges_16bit;
ccd70d9c 483 } else {
64ed3976
AK
484 s->filter_line = filter_line_c;
485 s->filter_edges = filter_edges;
ccd70d9c
AK
486
487 if (ARCH_X86)
488 ff_yadif_init_x86(s);
489 }
490
7dd56d41
RN
491 return 0;
492}
493
7536c671
AK
494#define OFFSET(x) offsetof(YADIFContext, x)
495#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
496static const AVOption options[] = {
497 { "mode", NULL, OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, FLAGS },
498 { "parity", NULL, OFFSET(parity), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, FLAGS, "parity" },
499 { "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, .unit = "parity" },
500 { "tff", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, .unit = "parity" },
501 { "bff", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .unit = "parity" },
502 { "auto", NULL, OFFSET(auto_enable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },
503 { NULL },
504};
505
506static const AVClass yadif_class = {
507 .class_name = "yadif",
508 .item_name = av_default_item_name,
509 .option = options,
510 .version = LIBAVUTIL_VERSION_INT,
511};
512
568c70e7
MR
513static const AVFilterPad avfilter_vf_yadif_inputs[] = {
514 {
515 .name = "default",
516 .type = AVMEDIA_TYPE_VIDEO,
568c70e7 517 .get_video_buffer = get_video_buffer,
565e4993 518 .filter_frame = filter_frame,
568c70e7
MR
519 },
520 { NULL }
521};
522
523static const AVFilterPad avfilter_vf_yadif_outputs[] = {
524 {
525 .name = "default",
526 .type = AVMEDIA_TYPE_VIDEO,
527 .poll_frame = poll_frame,
528 .request_frame = request_frame,
529 .config_props = config_props,
530 },
531 { NULL }
532};
533
cd43ca04 534AVFilter ff_vf_yadif = {
acbac567
MN
535 .name = "yadif",
536 .description = NULL_IF_CONFIG_SMALL("Deinterlace the input image"),
537
538 .priv_size = sizeof(YADIFContext),
7536c671 539 .priv_class = &yadif_class,
acbac567
MN
540 .uninit = uninit,
541 .query_formats = query_formats,
542
568c70e7
MR
543 .inputs = avfilter_vf_yadif_inputs,
544
545 .outputs = avfilter_vf_yadif_outputs,
cb79881b
AK
546
547 .flags = AVFILTER_FLAG_SLICE_THREADS,
acbac567 548};