1 /*
2 * Copyright (c) 2018 Ronald S. Bultje <rsbultje gmail com>
3 * Copyright (c) 2018 James Almer <jamrial gmail com>
4 *
5 * This file is part of FFmpeg.
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 #include <dav1d/dav1d.h>
23
24 #include "libavutil/avassert.h"
25 #include "libavutil/film_grain_params.h"
26 #include "libavutil/mastering_display_metadata.h"
27 #include "libavutil/imgutils.h"
28 #include "libavutil/opt.h"
29
30 #include "atsc_a53.h"
31 #include "avcodec.h"
32 #include "bytestream.h"
33 #include "decode.h"
34 #include "internal.h"
35
36 #define FF_DAV1D_VERSION_AT_LEAST(x,y) \
37 (DAV1D_API_VERSION_MAJOR > (x) || DAV1D_API_VERSION_MAJOR == (x) && DAV1D_API_VERSION_MINOR >= (y))
38
39 typedef struct Libdav1dContext {
40 AVClass *class;
41 Dav1dContext *c;
42 AVBufferPool *pool;
43 int pool_size;
44
45 Dav1dData data;
46 int tile_threads;
47 int frame_threads;
48 int apply_grain;
49 int operating_point;
50 int all_layers;
51 } Libdav1dContext;
52
53 static const enum AVPixelFormat pix_fmt[][3] = {
54 [DAV1D_PIXEL_LAYOUT_I400] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12 },
55 [DAV1D_PIXEL_LAYOUT_I420] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P12 },
56 [DAV1D_PIXEL_LAYOUT_I422] = { AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12 },
57 [DAV1D_PIXEL_LAYOUT_I444] = { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12 },
58 };
59
60 static const enum AVPixelFormat pix_fmt_rgb[3] = {
61 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12,
62 };
63
libdav1d_log_callback(void * opaque,const char * fmt,va_list vl)64 static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl)
65 {
66 AVCodecContext *c = opaque;
67
68 av_vlog(c, AV_LOG_ERROR, fmt, vl);
69 }
70
libdav1d_picture_allocator(Dav1dPicture * p,void * cookie)71 static int libdav1d_picture_allocator(Dav1dPicture *p, void *cookie)
72 {
73 Libdav1dContext *dav1d = cookie;
74 enum AVPixelFormat format = pix_fmt[p->p.layout][p->seq_hdr->hbd];
75 int ret, linesize[4], h = FFALIGN(p->p.h, 128), w = FFALIGN(p->p.w, 128);
76 uint8_t *aligned_ptr, *data[4];
77 AVBufferRef *buf;
78
79 ret = av_image_get_buffer_size(format, w, h, DAV1D_PICTURE_ALIGNMENT);
80 if (ret < 0)
81 return ret;
82
83 if (ret != dav1d->pool_size) {
84 av_buffer_pool_uninit(&dav1d->pool);
85 // Use twice the amount of required padding bytes for aligned_ptr below.
86 dav1d->pool = av_buffer_pool_init(ret + DAV1D_PICTURE_ALIGNMENT * 2, NULL);
87 if (!dav1d->pool) {
88 dav1d->pool_size = 0;
89 return AVERROR(ENOMEM);
90 }
91 dav1d->pool_size = ret;
92 }
93 buf = av_buffer_pool_get(dav1d->pool);
94 if (!buf)
95 return AVERROR(ENOMEM);
96
97 // libdav1d requires DAV1D_PICTURE_ALIGNMENT aligned buffers, which av_malloc()
98 // doesn't guarantee for example when AVX is disabled at configure time.
99 // Use the extra DAV1D_PICTURE_ALIGNMENT padding bytes in the buffer to align it
100 // if required.
101 aligned_ptr = (uint8_t *)FFALIGN((uintptr_t)buf->data, DAV1D_PICTURE_ALIGNMENT);
102 ret = av_image_fill_arrays(data, linesize, aligned_ptr, format, w, h,
103 DAV1D_PICTURE_ALIGNMENT);
104 if (ret < 0) {
105 av_buffer_unref(&buf);
106 return ret;
107 }
108
109 p->data[0] = data[0];
110 p->data[1] = data[1];
111 p->data[2] = data[2];
112 p->stride[0] = linesize[0];
113 p->stride[1] = linesize[1];
114 p->allocator_data = buf;
115
116 return 0;
117 }
118
libdav1d_picture_release(Dav1dPicture * p,void * cookie)119 static void libdav1d_picture_release(Dav1dPicture *p, void *cookie)
120 {
121 AVBufferRef *buf = p->allocator_data;
122
123 av_buffer_unref(&buf);
124 }
125
libdav1d_init(AVCodecContext * c)126 static av_cold int libdav1d_init(AVCodecContext *c)
127 {
128 Libdav1dContext *dav1d = c->priv_data;
129 Dav1dSettings s;
130 int threads = (c->thread_count ? c->thread_count : av_cpu_count()) * 3 / 2;
131 int res;
132
133 av_log(c, AV_LOG_INFO, "libdav1d %s\n", dav1d_version());
134
135 dav1d_default_settings(&s);
136 s.logger.cookie = c;
137 s.logger.callback = libdav1d_log_callback;
138 s.allocator.cookie = dav1d;
139 s.allocator.alloc_picture_callback = libdav1d_picture_allocator;
140 s.allocator.release_picture_callback = libdav1d_picture_release;
141 s.frame_size_limit = c->max_pixels;
142 if (dav1d->apply_grain >= 0)
143 s.apply_grain = dav1d->apply_grain;
144 else if (c->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN)
145 s.apply_grain = 0;
146
147 s.all_layers = dav1d->all_layers;
148 if (dav1d->operating_point >= 0)
149 s.operating_point = dav1d->operating_point;
150
151 #if FF_DAV1D_VERSION_AT_LEAST(6,0)
152 if (dav1d->frame_threads || dav1d->tile_threads)
153 s.n_threads = FFMAX(dav1d->frame_threads, dav1d->tile_threads);
154 else
155 s.n_threads = FFMIN(threads, DAV1D_MAX_THREADS);
156 s.max_frame_delay = (c->flags & AV_CODEC_FLAG_LOW_DELAY) ? 1 : s.n_threads;
157 av_log(c, AV_LOG_DEBUG, "Using %d threads, %d max_frame_delay\n",
158 s.n_threads, s.max_frame_delay);
159 #else
160 s.n_tile_threads = dav1d->tile_threads
161 ? dav1d->tile_threads
162 : FFMIN(floor(sqrt(threads)), DAV1D_MAX_TILE_THREADS);
163 s.n_frame_threads = dav1d->frame_threads
164 ? dav1d->frame_threads
165 : FFMIN(ceil(threads / s.n_tile_threads), DAV1D_MAX_FRAME_THREADS);
166 av_log(c, AV_LOG_DEBUG, "Using %d frame threads, %d tile threads\n",
167 s.n_frame_threads, s.n_tile_threads);
168 #endif
169
170 res = dav1d_open(&dav1d->c, &s);
171 if (res < 0)
172 return AVERROR(ENOMEM);
173
174 return 0;
175 }
176
libdav1d_flush(AVCodecContext * c)177 static void libdav1d_flush(AVCodecContext *c)
178 {
179 Libdav1dContext *dav1d = c->priv_data;
180
181 dav1d_data_unref(&dav1d->data);
182 dav1d_flush(dav1d->c);
183 }
184
libdav1d_data_free(const uint8_t * data,void * opaque)185 static void libdav1d_data_free(const uint8_t *data, void *opaque) {
186 AVBufferRef *buf = opaque;
187
188 av_buffer_unref(&buf);
189 }
190
libdav1d_user_data_free(const uint8_t * data,void * opaque)191 static void libdav1d_user_data_free(const uint8_t *data, void *opaque) {
192 av_assert0(data == opaque);
193 av_free(opaque);
194 }
195
libdav1d_receive_frame(AVCodecContext * c,AVFrame * frame)196 static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
197 {
198 Libdav1dContext *dav1d = c->priv_data;
199 Dav1dData *data = &dav1d->data;
200 Dav1dPicture pic = { 0 }, *p = &pic;
201 int res;
202
203 if (!data->sz) {
204 AVPacket pkt = { 0 };
205
206 res = ff_decode_get_packet(c, &pkt);
207 if (res < 0 && res != AVERROR_EOF)
208 return res;
209
210 if (pkt.size) {
211 res = dav1d_data_wrap(data, pkt.data, pkt.size, libdav1d_data_free, pkt.buf);
212 if (res < 0) {
213 av_packet_unref(&pkt);
214 return res;
215 }
216
217 data->m.timestamp = pkt.pts;
218 data->m.offset = pkt.pos;
219 data->m.duration = pkt.duration;
220
221 pkt.buf = NULL;
222 av_packet_unref(&pkt);
223
224 if (c->reordered_opaque != AV_NOPTS_VALUE) {
225 uint8_t *reordered_opaque = av_malloc(sizeof(c->reordered_opaque));
226 if (!reordered_opaque) {
227 dav1d_data_unref(data);
228 return AVERROR(ENOMEM);
229 }
230
231 memcpy(reordered_opaque, &c->reordered_opaque, sizeof(c->reordered_opaque));
232 res = dav1d_data_wrap_user_data(data, reordered_opaque,
233 libdav1d_user_data_free, reordered_opaque);
234 if (res < 0) {
235 av_free(reordered_opaque);
236 dav1d_data_unref(data);
237 return res;
238 }
239 }
240 }
241 }
242
243 res = dav1d_send_data(dav1d->c, data);
244 if (res < 0) {
245 if (res == AVERROR(EINVAL))
246 res = AVERROR_INVALIDDATA;
247 if (res != AVERROR(EAGAIN))
248 return res;
249 }
250
251 res = dav1d_get_picture(dav1d->c, p);
252 if (res < 0) {
253 if (res == AVERROR(EINVAL))
254 res = AVERROR_INVALIDDATA;
255 else if (res == AVERROR(EAGAIN) && c->internal->draining)
256 res = AVERROR_EOF;
257
258 return res;
259 }
260
261 av_assert0(p->data[0] && p->allocator_data);
262
263 // This requires the custom allocator above
264 frame->buf[0] = av_buffer_ref(p->allocator_data);
265 if (!frame->buf[0]) {
266 dav1d_picture_unref(p);
267 return AVERROR(ENOMEM);
268 }
269
270 frame->data[0] = p->data[0];
271 frame->data[1] = p->data[1];
272 frame->data[2] = p->data[2];
273 frame->linesize[0] = p->stride[0];
274 frame->linesize[1] = p->stride[1];
275 frame->linesize[2] = p->stride[1];
276
277 c->profile = p->seq_hdr->profile;
278 c->level = ((p->seq_hdr->operating_points[0].major_level - 2) << 2)
279 | p->seq_hdr->operating_points[0].minor_level;
280 frame->width = p->p.w;
281 frame->height = p->p.h;
282 if (c->width != p->p.w || c->height != p->p.h) {
283 res = ff_set_dimensions(c, p->p.w, p->p.h);
284 if (res < 0)
285 goto fail;
286 }
287
288 av_reduce(&frame->sample_aspect_ratio.num,
289 &frame->sample_aspect_ratio.den,
290 frame->height * (int64_t)p->frame_hdr->render_width,
291 frame->width * (int64_t)p->frame_hdr->render_height,
292 INT_MAX);
293 ff_set_sar(c, frame->sample_aspect_ratio);
294
295 switch (p->seq_hdr->chr) {
296 case DAV1D_CHR_VERTICAL:
297 frame->chroma_location = c->chroma_sample_location = AVCHROMA_LOC_LEFT;
298 break;
299 case DAV1D_CHR_COLOCATED:
300 frame->chroma_location = c->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
301 break;
302 }
303 frame->colorspace = c->colorspace = (enum AVColorSpace) p->seq_hdr->mtrx;
304 frame->color_primaries = c->color_primaries = (enum AVColorPrimaries) p->seq_hdr->pri;
305 frame->color_trc = c->color_trc = (enum AVColorTransferCharacteristic) p->seq_hdr->trc;
306 frame->color_range = c->color_range = p->seq_hdr->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
307
308 if (p->p.layout == DAV1D_PIXEL_LAYOUT_I444 &&
309 p->seq_hdr->mtrx == DAV1D_MC_IDENTITY &&
310 p->seq_hdr->pri == DAV1D_COLOR_PRI_BT709 &&
311 p->seq_hdr->trc == DAV1D_TRC_SRGB)
312 frame->format = c->pix_fmt = pix_fmt_rgb[p->seq_hdr->hbd];
313 else
314 frame->format = c->pix_fmt = pix_fmt[p->p.layout][p->seq_hdr->hbd];
315
316 if (p->m.user_data.data)
317 memcpy(&frame->reordered_opaque, p->m.user_data.data, sizeof(frame->reordered_opaque));
318 else
319 frame->reordered_opaque = AV_NOPTS_VALUE;
320
321 if (p->seq_hdr->num_units_in_tick && p->seq_hdr->time_scale) {
322 av_reduce(&c->framerate.den, &c->framerate.num,
323 p->seq_hdr->num_units_in_tick, p->seq_hdr->time_scale, INT_MAX);
324 if (p->seq_hdr->equal_picture_interval)
325 c->ticks_per_frame = p->seq_hdr->num_ticks_per_picture;
326 }
327
328 // match timestamps and packet size
329 frame->pts = p->m.timestamp;
330 #if FF_API_PKT_PTS
331 FF_DISABLE_DEPRECATION_WARNINGS
332 frame->pkt_pts = p->m.timestamp;
333 FF_ENABLE_DEPRECATION_WARNINGS
334 #endif
335 frame->pkt_dts = p->m.timestamp;
336 frame->pkt_pos = p->m.offset;
337 frame->pkt_size = p->m.size;
338 frame->pkt_duration = p->m.duration;
339 frame->key_frame = p->frame_hdr->frame_type == DAV1D_FRAME_TYPE_KEY;
340
341 switch (p->frame_hdr->frame_type) {
342 case DAV1D_FRAME_TYPE_KEY:
343 case DAV1D_FRAME_TYPE_INTRA:
344 frame->pict_type = AV_PICTURE_TYPE_I;
345 break;
346 case DAV1D_FRAME_TYPE_INTER:
347 frame->pict_type = AV_PICTURE_TYPE_P;
348 break;
349 case DAV1D_FRAME_TYPE_SWITCH:
350 frame->pict_type = AV_PICTURE_TYPE_SP;
351 break;
352 default:
353 res = AVERROR_INVALIDDATA;
354 goto fail;
355 }
356
357 if (p->mastering_display) {
358 AVMasteringDisplayMetadata *mastering = av_mastering_display_metadata_create_side_data(frame);
359 if (!mastering) {
360 res = AVERROR(ENOMEM);
361 goto fail;
362 }
363
364 for (int i = 0; i < 3; i++) {
365 mastering->display_primaries[i][0] = av_make_q(p->mastering_display->primaries[i][0], 1 << 16);
366 mastering->display_primaries[i][1] = av_make_q(p->mastering_display->primaries[i][1], 1 << 16);
367 }
368 mastering->white_point[0] = av_make_q(p->mastering_display->white_point[0], 1 << 16);
369 mastering->white_point[1] = av_make_q(p->mastering_display->white_point[1], 1 << 16);
370
371 mastering->max_luminance = av_make_q(p->mastering_display->max_luminance, 1 << 8);
372 mastering->min_luminance = av_make_q(p->mastering_display->min_luminance, 1 << 14);
373
374 mastering->has_primaries = 1;
375 mastering->has_luminance = 1;
376 }
377 if (p->content_light) {
378 AVContentLightMetadata *light = av_content_light_metadata_create_side_data(frame);
379 if (!light) {
380 res = AVERROR(ENOMEM);
381 goto fail;
382 }
383 light->MaxCLL = p->content_light->max_content_light_level;
384 light->MaxFALL = p->content_light->max_frame_average_light_level;
385 }
386 if (p->itut_t35) {
387 GetByteContext gb;
388 unsigned int user_identifier;
389
390 bytestream2_init(&gb, p->itut_t35->payload, p->itut_t35->payload_size);
391 bytestream2_skip(&gb, 1); // terminal provider code
392 bytestream2_skip(&gb, 1); // terminal provider oriented code
393 user_identifier = bytestream2_get_be32(&gb);
394 switch (user_identifier) {
395 case MKBETAG('G', 'A', '9', '4'): { // closed captions
396 AVBufferRef *buf = NULL;
397
398 res = ff_parse_a53_cc(&buf, gb.buffer, bytestream2_get_bytes_left(&gb));
399 if (res < 0)
400 goto fail;
401 if (!res)
402 break;
403
404 if (!av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_A53_CC, buf))
405 av_buffer_unref(&buf);
406
407 c->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
408 break;
409 }
410 default: // ignore unsupported identifiers
411 break;
412 }
413 }
414 if (p->frame_hdr->film_grain.present && (!dav1d->apply_grain ||
415 (c->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN))) {
416 AVFilmGrainParams *fgp = av_film_grain_params_create_side_data(frame);
417 if (!fgp) {
418 res = AVERROR(ENOMEM);
419 goto fail;
420 }
421
422 fgp->type = AV_FILM_GRAIN_PARAMS_AV1;
423 fgp->seed = p->frame_hdr->film_grain.data.seed;
424 fgp->codec.aom.num_y_points = p->frame_hdr->film_grain.data.num_y_points;
425 fgp->codec.aom.chroma_scaling_from_luma = p->frame_hdr->film_grain.data.chroma_scaling_from_luma;
426 fgp->codec.aom.scaling_shift = p->frame_hdr->film_grain.data.scaling_shift;
427 fgp->codec.aom.ar_coeff_lag = p->frame_hdr->film_grain.data.ar_coeff_lag;
428 fgp->codec.aom.ar_coeff_shift = p->frame_hdr->film_grain.data.ar_coeff_shift;
429 fgp->codec.aom.grain_scale_shift = p->frame_hdr->film_grain.data.grain_scale_shift;
430 fgp->codec.aom.overlap_flag = p->frame_hdr->film_grain.data.overlap_flag;
431 fgp->codec.aom.limit_output_range = p->frame_hdr->film_grain.data.clip_to_restricted_range;
432
433 memcpy(&fgp->codec.aom.y_points, &p->frame_hdr->film_grain.data.y_points,
434 sizeof(fgp->codec.aom.y_points));
435 memcpy(&fgp->codec.aom.num_uv_points, &p->frame_hdr->film_grain.data.num_uv_points,
436 sizeof(fgp->codec.aom.num_uv_points));
437 memcpy(&fgp->codec.aom.uv_points, &p->frame_hdr->film_grain.data.uv_points,
438 sizeof(fgp->codec.aom.uv_points));
439 memcpy(&fgp->codec.aom.ar_coeffs_y, &p->frame_hdr->film_grain.data.ar_coeffs_y,
440 sizeof(fgp->codec.aom.ar_coeffs_y));
441 memcpy(&fgp->codec.aom.ar_coeffs_uv[0], &p->frame_hdr->film_grain.data.ar_coeffs_uv[0],
442 sizeof(fgp->codec.aom.ar_coeffs_uv[0]));
443 memcpy(&fgp->codec.aom.ar_coeffs_uv[1], &p->frame_hdr->film_grain.data.ar_coeffs_uv[1],
444 sizeof(fgp->codec.aom.ar_coeffs_uv[1]));
445 memcpy(&fgp->codec.aom.uv_mult, &p->frame_hdr->film_grain.data.uv_mult,
446 sizeof(fgp->codec.aom.uv_mult));
447 memcpy(&fgp->codec.aom.uv_mult_luma, &p->frame_hdr->film_grain.data.uv_luma_mult,
448 sizeof(fgp->codec.aom.uv_mult_luma));
449 memcpy(&fgp->codec.aom.uv_offset, &p->frame_hdr->film_grain.data.uv_offset,
450 sizeof(fgp->codec.aom.uv_offset));
451 }
452
453 res = 0;
454 fail:
455 dav1d_picture_unref(p);
456 if (res < 0)
457 av_frame_unref(frame);
458 return res;
459 }
460
libdav1d_close(AVCodecContext * c)461 static av_cold int libdav1d_close(AVCodecContext *c)
462 {
463 Libdav1dContext *dav1d = c->priv_data;
464
465 av_buffer_pool_uninit(&dav1d->pool);
466 dav1d_data_unref(&dav1d->data);
467 dav1d_close(&dav1d->c);
468
469 return 0;
470 }
471
472 #ifndef DAV1D_MAX_FRAME_THREADS
473 #define DAV1D_MAX_FRAME_THREADS DAV1D_MAX_THREADS
474 #endif
475 #ifndef DAV1D_MAX_TILE_THREADS
476 #define DAV1D_MAX_TILE_THREADS DAV1D_MAX_THREADS
477 #endif
478
479 #define OFFSET(x) offsetof(Libdav1dContext, x)
480 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
481 static const AVOption libdav1d_options[] = {
482 { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_TILE_THREADS, VD },
483 { "framethreads", "Frame threads", OFFSET(frame_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_THREADS, VD },
484 { "filmgrain", "Apply Film Grain", OFFSET(apply_grain), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD | AV_OPT_FLAG_DEPRECATED },
485 { "oppoint", "Select an operating point of the scalable bitstream", OFFSET(operating_point), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 31, VD },
486 { "alllayers", "Output all spatial layers", OFFSET(all_layers), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
487 { NULL }
488 };
489
490 static const AVClass libdav1d_class = {
491 .class_name = "libdav1d decoder",
492 .item_name = av_default_item_name,
493 .option = libdav1d_options,
494 .version = LIBAVUTIL_VERSION_INT,
495 };
496
497 AVCodec ff_libdav1d_decoder = {
498 .name = "libdav1d",
499 .long_name = NULL_IF_CONFIG_SMALL("dav1d AV1 decoder by VideoLAN"),
500 .type = AVMEDIA_TYPE_VIDEO,
501 .id = AV_CODEC_ID_AV1,
502 .priv_data_size = sizeof(Libdav1dContext),
503 .init = libdav1d_init,
504 .close = libdav1d_close,
505 .flush = libdav1d_flush,
506 .receive_frame = libdav1d_receive_frame,
507 .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
508 .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SETS_PKT_DTS |
509 FF_CODEC_CAP_AUTO_THREADS,
510 .priv_class = &libdav1d_class,
511 .wrapper_name = "libdav1d",
512 };
513