3b4ff42365a3906f69644fde174faf3bf76bf7ce
[libav.git] / libavcodec / pixlet.c
1 /*
2 * Apple Pixlet decoder
3 * Copyright (c) 2016 Paul B Mahol
4 *
5 * This file is part of Libav.
6 *
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.
11 *
12 * Libav 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 Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include <stdint.h>
23
24 #include "libavutil/imgutils.h"
25 #include "libavutil/intmath.h"
26 #include "libavutil/opt.h"
27
28 #include "avcodec.h"
29 #include "bitstream.h"
30 #include "bytestream.h"
31 #include "internal.h"
32 #include "thread.h"
33 #include "unary.h"
34
35 #define NB_LEVELS 4
36
37 #define PIXLET_MAGIC 0xDEADBEEF
38
39 #define H 0
40 #define V 1
41
42 #define SQR(x) ((x) * (x))
43
44 typedef struct SubBand {
45 size_t width, height;
46 size_t size;
47 size_t x, y;
48 } SubBand;
49
50 typedef struct PixletContext {
51 AVClass *class;
52
53 GetByteContext gb;
54 BitstreamContext bc;
55
56 int levels;
57 int depth;
58 size_t w, h;
59
60 int16_t *filter[2];
61 int16_t *prediction;
62 float scaling[4][2][NB_LEVELS];
63 SubBand band[4][NB_LEVELS * 3 + 1];
64 } PixletContext;
65
66 static av_cold int pixlet_init(AVCodecContext *avctx)
67 {
68 avctx->pix_fmt = AV_PIX_FMT_YUV420P16;
69 avctx->color_range = AVCOL_RANGE_JPEG;
70 return 0;
71 }
72
73 static av_cold int pixlet_close(AVCodecContext *avctx)
74 {
75 PixletContext *ctx = avctx->priv_data;
76
77 av_freep(&ctx->filter[0]);
78 av_freep(&ctx->filter[1]);
79 av_freep(&ctx->prediction);
80
81 return 0;
82 }
83
84 static int init_decoder(AVCodecContext *avctx)
85 {
86 PixletContext *ctx = avctx->priv_data;
87 int i, plane;
88
89 ctx->filter[0] = av_malloc_array(ctx->h, sizeof(int16_t));
90 ctx->filter[1] = av_malloc_array(FFMAX(ctx->h, ctx->w) + 16, sizeof(int16_t));
91 ctx->prediction = av_malloc_array((ctx->w >> NB_LEVELS), sizeof(int16_t));
92 if (!ctx->filter[0] || !ctx->filter[1] || !ctx->prediction)
93 return AVERROR(ENOMEM);
94
95 for (plane = 0; plane < 3; plane++) {
96 unsigned shift = plane > 0;
97 size_t w = ctx->w >> shift;
98 size_t h = ctx->h >> shift;
99
100 ctx->band[plane][0].width = w >> NB_LEVELS;
101 ctx->band[plane][0].height = h >> NB_LEVELS;
102 ctx->band[plane][0].size = (w >> NB_LEVELS) * (h >> NB_LEVELS);
103
104 for (i = 0; i < NB_LEVELS * 3; i++) {
105 unsigned scale = ctx->levels - (i / 3);
106
107 ctx->band[plane][i + 1].width = w >> scale;
108 ctx->band[plane][i + 1].height = h >> scale;
109 ctx->band[plane][i + 1].size = (w >> scale) * (h >> scale);
110
111 ctx->band[plane][i + 1].x = (w >> scale) * (((i + 1) % 3) != 2);
112 ctx->band[plane][i + 1].y = (h >> scale) * (((i + 1) % 3) != 1);
113 }
114 }
115
116 return 0;
117 }
118
119 static int read_low_coeffs(AVCodecContext *avctx, int16_t *dst, size_t size,
120 size_t width, ptrdiff_t stride)
121 {
122 PixletContext *ctx = avctx->priv_data;
123 BitstreamContext *bc = &ctx->bc;
124 unsigned cnt1, nbits, k, j = 0, i = 0;
125 int64_t value, state = 3;
126 int rlen, escape, flag = 0;
127
128 while (i < size) {
129 nbits = FFMIN(ff_clz((state >> 8) + 3) ^ 0x1F, 14);
130
131 cnt1 = get_unary(bc, 0, 8);
132 if (cnt1 < 8) {
133 value = bitstream_read(bc, nbits);
134 if (value <= 1) {
135 bitstream_unget(bc, value & 1, 1);
136 value = 1;
137 }
138 escape = value + ((1 << nbits) - 1) * cnt1 - 1;
139 } else {
140 escape = bitstream_read(bc, 16);
141 }
142
143 value = -((escape + flag) & 1) | 1;
144 dst[j++] = value * ((escape + flag + 1) >> 1);
145 i++;
146 if (j == width) {
147 j = 0;
148 dst += stride;
149 }
150 state = 120 * (escape + flag) + state - (120 * state >> 8);
151 flag = 0;
152
153 if (state * 4 > 0xFF || i >= size)
154 continue;
155
156 nbits = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;
157 escape = av_mod_uintp2(16383, nbits);
158 cnt1 = get_unary(bc, 0, 8);
159 if (cnt1 > 7) {
160 rlen = bitstream_read(bc, 16);
161 } else {
162 value = bitstream_read(bc, nbits);
163 if (value <= 1) {
164 bitstream_unget(bc, value & 1, 1);
165 value = 1;
166 }
167 rlen = value + escape * cnt1 - 1;
168 }
169
170 if (i + rlen > size)
171 return AVERROR_INVALIDDATA;
172 i += rlen;
173
174 for (k = 0; k < rlen; k++) {
175 dst[j++] = 0;
176 if (j == width) {
177 j = 0;
178 dst += stride;
179 }
180 }
181
182 state = 0;
183 flag = rlen < 0xFFFF ? 1 : 0;
184 }
185
186 bitstream_align(bc);
187 return bitstream_tell(bc) >> 3;
188 }
189
190 static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst,
191 int size, int64_t c, int a, int64_t d,
192 int width, ptrdiff_t stride)
193 {
194 PixletContext *ctx = avctx->priv_data;
195 BitstreamContext *bc = &ctx->bc;
196 unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k;
197 int ret, escape, pfx, cthulu, yflag, xflag, flag = 0;
198 int64_t state = 3, value, tmp;
199
200 ret = bitstream_init8(bc, src, bytestream2_get_bytes_left(&ctx->gb));
201 if (ret < 0)
202 return ret;
203
204 cthulu = (a >= 0) + (a ^ (a >> 31)) - (a >> 31);
205 if (cthulu != 1) {
206 nbits = 33 - ff_clz(cthulu - 1);
207 if (nbits > 16)
208 return AVERROR_INVALIDDATA;
209 } else {
210 nbits = 1;
211 }
212
213 length = 25 - nbits;
214
215 while (i < size) {
216 if (state >> 8 != -3)
217 value = ff_clz((state >> 8) + 3) ^ 0x1F;
218 else
219 value = -1;
220
221 cnt1 = get_unary(bc, 0, length);
222 if (cnt1 >= length) {
223 cnt1 = bitstream_read(bc, nbits);
224 } else {
225 pfx = 14 + (((value - 14) >> 32) & (value - 14));
226 cnt1 *= (1 << pfx) - 1;
227
228 shbits = bitstream_read(bc, pfx);
229 if (shbits <= 1) {
230 bitstream_unget(bc, shbits & 1, 1);
231 shbits = 1;
232 }
233 cnt1 += shbits - 1;
234 }
235
236 xflag = flag + cnt1;
237 yflag = xflag;
238
239 if (flag + cnt1 == 0) {
240 value = 0;
241 } else {
242 xflag &= 1u;
243 tmp = c * ((yflag + 1) >> 1) + (c >> 1);
244 value = xflag + (tmp ^ -xflag);
245 }
246
247 i++;
248 dst[j++] = value;
249 if (j == width) {
250 j = 0;
251 dst += stride;
252 }
253 state += d * yflag - (d * state >> 8);
254
255 flag = 0;
256
257 if (state * 4 > 0xFF || i >= size)
258 continue;
259
260 pfx = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;
261 escape = av_mod_uintp2(16383, pfx);
262 cnt1 = get_unary(bc, 0, 8);
263 if (cnt1 < 8) {
264 if (pfx < 1 || pfx > 25)
265 return AVERROR_INVALIDDATA;
266
267 value = bitstream_read(bc, pfx);
268 if (value <= 1) {
269 bitstream_unget(bc, value & 1, 1);
270 value = 1;
271 }
272 rlen = value + escape * cnt1 - 1;
273 } else {
274 if (bitstream_read_bit(bc))
275 value = bitstream_read(bc, 16);
276 else
277 value = bitstream_read(bc, 8);
278
279 rlen = value + 8 * escape;
280 }
281
282 if (rlen > 0xFFFF || i + rlen > size)
283 return AVERROR_INVALIDDATA;
284 i += rlen;
285
286 for (k = 0; k < rlen; k++) {
287 dst[j++] = 0;
288 if (j == width) {
289 j = 0;
290 dst += stride;
291 }
292 }
293
294 state = 0;
295 flag = rlen < 0xFFFF ? 1 : 0;
296 }
297
298 bitstream_align(bc);
299 return bitstream_tell(bc) >> 3;
300 }
301
302 static int read_highpass(AVCodecContext *avctx, uint8_t *ptr,
303 int plane, AVFrame *frame)
304 {
305 PixletContext *ctx = avctx->priv_data;
306 ptrdiff_t stride = frame->linesize[plane] / 2;
307 int i, ret;
308
309 for (i = 0; i < ctx->levels * 3; i++) {
310 int32_t a = bytestream2_get_be32(&ctx->gb);
311 int32_t b = bytestream2_get_be32(&ctx->gb);
312 int32_t c = bytestream2_get_be32(&ctx->gb);
313 int32_t d = bytestream2_get_be32(&ctx->gb);
314 int16_t *dest = (int16_t *)frame->data[plane] +
315 ctx->band[plane][i + 1].x +
316 ctx->band[plane][i + 1].y * stride;
317 size_t size = ctx->band[plane][i + 1].size;
318 uint32_t magic = bytestream2_get_be32(&ctx->gb);
319
320 if (magic != PIXLET_MAGIC) {
321 av_log(avctx, AV_LOG_ERROR,
322 "wrong magic number: 0x%"PRIX32" for plane %d, band %d\n",
323 magic, plane, i);
324 return AVERROR_INVALIDDATA;
325 }
326
327 ret = read_high_coeffs(avctx, ptr + bytestream2_tell(&ctx->gb), dest,
328 size, c, (b >= FFABS(a)) ? b : a, d,
329 ctx->band[plane][i + 1].width, stride);
330 if (ret < 0) {
331 av_log(avctx, AV_LOG_ERROR,
332 "error in highpass coefficients for plane %d, band %d\n",
333 plane, i);
334 return ret;
335 }
336 bytestream2_skip(&ctx->gb, ret);
337 }
338
339 return 0;
340 }
341
342 static void line_add_sat_s16(int16_t *dst, const int16_t *src, size_t len)
343 {
344 int i;
345 for (i = 0; i < len; i++) {
346 int val = dst[i] + src[i];
347 dst[i] = av_clip_int16(val);
348 }
349 }
350
351 static void lowpass_prediction(int16_t *dst, int16_t *pred,
352 size_t width, size_t height, ptrdiff_t stride)
353 {
354 int i, j;
355
356 memset(pred, 0, width * sizeof(*pred));
357
358 for (i = 0; i < height; i++) {
359 line_add_sat_s16(pred, dst, width);
360 dst[0] = pred[0];
361 for (j = 1; j < width; j++)
362 dst[j] = pred[j] + dst[j - 1];
363 dst += stride;
364 }
365 }
366
367 static void filterfn(int16_t *dest, int16_t *tmp, size_t size, float SCALE)
368 {
369 int16_t *low, *high, *ll, *lh, *hl, *hh;
370 int hsize, i, j;
371 float value;
372
373 hsize = size >> 1;
374 low = tmp + 4;
375 high = &low[hsize + 8];
376
377 memcpy(low, dest, size);
378 memcpy(high, dest + hsize, size);
379
380 ll = &low[hsize];
381 lh = &low[hsize];
382 hl = &high[hsize];
383 hh = hl;
384 for (i = 4, j = 2; i; i--, j++, ll--, hh++, lh++, hl--) {
385 low[i - 5] = low[j - 1];
386 lh[0] = ll[-1];
387 high[i - 5] = high[j - 2];
388 hh[0] = hl[-2];
389 }
390
391 for (i = 0; i < hsize; i++) {
392 value = low [i + 1] * -0.07576144003329376f +
393 low [i + 0] * 0.8586296626673486f +
394 low [i - 1] * -0.07576144003329376f +
395 high[i + 0] * 0.3535533905932737f +
396 high[i - 1] * 0.3535533905932737f;
397 dest[i * 2] = av_clipf(value * SCALE, INT16_MIN, INT16_MAX);
398 }
399
400 for (i = 0; i < hsize; i++) {
401 value = low [i + 2] * -0.01515228715813062f +
402 low [i + 1] * 0.3687056777514043f +
403 low [i + 0] * 0.3687056777514043f +
404 low [i - 1] * -0.01515228715813062f +
405 high[i + 1] * 0.07071067811865475f +
406 high[i + 0] * -0.8485281374238569f +
407 high[i - 1] * 0.07071067811865475f;
408 dest[i * 2 + 1] = av_clipf(value * SCALE, INT16_MIN, INT16_MAX);
409 }
410 }
411
412 static void reconstruction(AVCodecContext *avctx, int16_t *dest,
413 size_t width, size_t height, ptrdiff_t stride,
414 float *scaling_h, float *scaling_v)
415 {
416 PixletContext *ctx = avctx->priv_data;
417 unsigned scaled_width, scaled_height;
418 int16_t *ptr, *tmp;
419 int i, j, k;
420
421 scaled_width = width >> NB_LEVELS;
422 scaled_height = height >> NB_LEVELS;
423 tmp = ctx->filter[0];
424
425 for (i = 0; i < NB_LEVELS; i++) {
426 float scale_v = scaling_v[i];
427 float scale_h = scaling_h[i];
428 scaled_width <<= 1;
429 scaled_height <<= 1;
430
431 ptr = dest;
432 for (j = 0; j < scaled_height; j++) {
433 filterfn(ptr, ctx->filter[1], scaled_width, scale_v);
434 ptr += stride;
435 }
436
437 for (j = 0; j < scaled_width; j++) {
438 ptr = dest + j;
439 for (k = 0; k < scaled_height; k++) {
440 tmp[k] = *ptr;
441 ptr += stride;
442 }
443
444 filterfn(tmp, ctx->filter[1], scaled_height, scale_h);
445
446 ptr = dest + j;
447 for (k = 0; k < scaled_height; k++) {
448 *ptr = tmp[k];
449 ptr += stride;
450 }
451 }
452 }
453 }
454
455 static void postprocess_luma(AVFrame *frame, size_t w, size_t h, int depth)
456 {
457 uint16_t *dsty = (uint16_t *)frame->data[0];
458 int16_t *srcy = (int16_t *)frame->data[0];
459 ptrdiff_t stridey = frame->linesize[0] / 2;
460 const float factor = 1.0f / ((1 << depth) - 1);
461 int i, j;
462
463 for (j = 0; j < h; j++) {
464 for (i = 0; i < w; i++)
465 dsty[i] = SQR(FFMAX(srcy[i], 0) * factor) * 65535;
466 dsty += stridey;
467 srcy += stridey;
468 }
469 }
470
471 static void postprocess_chroma(AVFrame *frame, int w, int h, int depth)
472 {
473 uint16_t *dstu = (uint16_t *)frame->data[1];
474 uint16_t *dstv = (uint16_t *)frame->data[2];
475 int16_t *srcu = (int16_t *)frame->data[1];
476 int16_t *srcv = (int16_t *)frame->data[2];
477 ptrdiff_t strideu = frame->linesize[1] / 2;
478 ptrdiff_t stridev = frame->linesize[2] / 2;
479 const unsigned add = 1 << (depth - 1);
480 const unsigned shift = 16 - depth;
481 int i, j;
482
483 for (j = 0; j < h; j++) {
484 for (i = 0; i < w; i++) {
485 dstu[i] = av_clip_uintp2_c(add + srcu[i], depth) << shift;
486 dstv[i] = av_clip_uintp2_c(add + srcv[i], depth) << shift;
487 }
488 dstu += strideu;
489 dstv += stridev;
490 srcu += strideu;
491 srcv += stridev;
492 }
493 }
494
495 static int decode_plane(AVCodecContext *avctx, int plane,
496 AVPacket *avpkt, AVFrame *frame)
497 {
498 PixletContext *ctx = avctx->priv_data;
499 ptrdiff_t stride = frame->linesize[plane] / 2;
500 unsigned shift = plane > 0;
501 int16_t *dst;
502 int i, ret;
503
504 for (i = ctx->levels - 1; i >= 0; i--) {
505 int32_t h = sign_extend(bytestream2_get_be32(&ctx->gb), 32);
506 int32_t v = sign_extend(bytestream2_get_be32(&ctx->gb), 32);
507
508 if (!h || !v)
509 return AVERROR_INVALIDDATA;
510
511 ctx->scaling[plane][H][i] = 1000000.0f / h;
512 ctx->scaling[plane][V][i] = 1000000.0f / v;
513 }
514
515 bytestream2_skip(&ctx->gb, 4);
516
517 dst = (int16_t *)frame->data[plane];
518 dst[0] = sign_extend(bytestream2_get_be16(&ctx->gb), 16);
519
520 ret = bitstream_init8(&ctx->bc, avpkt->data + bytestream2_tell(&ctx->gb),
521 bytestream2_get_bytes_left(&ctx->gb));
522 if (ret < 0)
523 return ret;
524
525 ret = read_low_coeffs(avctx, dst + 1, ctx->band[plane][0].width - 1,
526 ctx->band[plane][0].width - 1, 0);
527 if (ret < 0) {
528 av_log(avctx, AV_LOG_ERROR,
529 "error in lowpass coefficients for plane %d, top row\n", plane);
530 return ret;
531 }
532
533 ret = read_low_coeffs(avctx, dst + stride,
534 ctx->band[plane][0].height - 1, 1, stride);
535 if (ret < 0) {
536 av_log(avctx, AV_LOG_ERROR,
537 "error in lowpass coefficients for plane %d, left column\n",
538 plane);
539 return ret;
540 }
541
542 ret = read_low_coeffs(avctx, dst + stride + 1,
543 (ctx->band[plane][0].width - 1) * (ctx->band[plane][0].height - 1),
544 ctx->band[plane][0].width - 1, stride);
545 if (ret < 0) {
546 av_log(avctx, AV_LOG_ERROR,
547 "error in lowpass coefficients for plane %d, rest\n", plane);
548 return ret;
549 }
550
551 bytestream2_skip(&ctx->gb, ret);
552 if (bytestream2_get_bytes_left(&ctx->gb) <= 0) {
553 av_log(avctx, AV_LOG_ERROR, "no bytes left\n");
554 return AVERROR_INVALIDDATA;
555 }
556
557 ret = read_highpass(avctx, avpkt->data, plane, frame);
558 if (ret < 0)
559 return ret;
560
561 lowpass_prediction(dst, ctx->prediction, ctx->band[plane][0].width,
562 ctx->band[plane][0].height, stride);
563
564 reconstruction(avctx, (int16_t *)frame->data[plane], ctx->w >> shift,
565 ctx->h >> shift, stride, ctx->scaling[plane][H],
566 ctx->scaling[plane][V]);
567
568 return 0;
569 }
570
571 static int pixlet_decode_frame(AVCodecContext *avctx, void *data,
572 int *got_frame, AVPacket *avpkt)
573 {
574 PixletContext *ctx = avctx->priv_data;
575 int i, w, h, width, height, ret, version;
576 AVFrame *p = data;
577 ThreadFrame frame = { .f = data };
578 uint32_t pktsize;
579
580 bytestream2_init(&ctx->gb, avpkt->data, avpkt->size);
581
582 pktsize = bytestream2_get_be32(&ctx->gb);
583 if (pktsize <= 44 || pktsize - 4 > bytestream2_get_bytes_left(&ctx->gb)) {
584 av_log(avctx, AV_LOG_ERROR, "Invalid packet size %"PRIu32".\n", pktsize);
585 return AVERROR_INVALIDDATA;
586 }
587
588 version = bytestream2_get_le32(&ctx->gb);
589 if (version != 1)
590 avpriv_request_sample(avctx, "Version %d", version);
591
592 bytestream2_skip(&ctx->gb, 4);
593 if (bytestream2_get_be32(&ctx->gb) != 1)
594 return AVERROR_INVALIDDATA;
595 bytestream2_skip(&ctx->gb, 4);
596
597 width = bytestream2_get_be32(&ctx->gb);
598 height = bytestream2_get_be32(&ctx->gb);
599
600 w = FFALIGN(width, 1 << (NB_LEVELS + 1));
601 h = FFALIGN(height, 1 << (NB_LEVELS + 1));
602
603 ctx->levels = bytestream2_get_be32(&ctx->gb);
604 if (ctx->levels != NB_LEVELS)
605 return AVERROR_INVALIDDATA;
606 ctx->depth = bytestream2_get_be32(&ctx->gb);
607 if (ctx->depth < 8 || ctx->depth > 15) {
608 avpriv_request_sample(avctx, "Depth %d", ctx->depth);
609 return AVERROR_INVALIDDATA;
610 }
611
612 ret = ff_set_dimensions(avctx, w, h);
613 if (ret < 0)
614 return ret;
615 avctx->width = width;
616 avctx->height = height;
617
618 /* reinit should dimensions change */
619 if (ctx->w != w || ctx->h != h) {
620 pixlet_close(avctx);
621 ctx->w = w;
622 ctx->h = h;
623
624 ret = init_decoder(avctx);
625 if (ret < 0) {
626 pixlet_close(avctx);
627 ctx->w = 0;
628 ctx->h = 0;
629 return ret;
630 }
631 }
632
633 bytestream2_skip(&ctx->gb, 8);
634
635 ret = ff_thread_get_buffer(avctx, &frame, 0);
636 if (ret < 0)
637 return ret;
638
639 for (i = 0; i < 3; i++) {
640 ret = decode_plane(avctx, i, avpkt, frame.f);
641 if (ret < 0)
642 return ret;
643 if (avctx->flags & AV_CODEC_FLAG_GRAY)
644 break;
645 }
646
647 postprocess_luma(frame.f, ctx->w, ctx->h, ctx->depth);
648 postprocess_chroma(frame.f, ctx->w >> 1, ctx->h >> 1, ctx->depth);
649
650 p->pict_type = AV_PICTURE_TYPE_I;
651 p->color_range = AVCOL_RANGE_JPEG;
652 p->key_frame = 1;
653
654 *got_frame = 1;
655
656 return pktsize;
657 }
658
659 #if HAVE_THREADS
660 static int pixlet_init_thread_copy(AVCodecContext *avctx)
661 {
662 PixletContext *ctx = avctx->priv_data;
663
664 ctx->filter[0] = NULL;
665 ctx->filter[1] = NULL;
666 ctx->prediction = NULL;
667 ctx->w = 0;
668 ctx->h = 0;
669
670 return 0;
671 }
672 #endif /* HAVE_THREADS */
673
674 AVCodec ff_pixlet_decoder = {
675 .name = "pixlet",
676 .long_name = NULL_IF_CONFIG_SMALL("Apple Pixlet"),
677 .type = AVMEDIA_TYPE_VIDEO,
678 .id = AV_CODEC_ID_PIXLET,
679 .init = pixlet_init,
680 .init_thread_copy = ONLY_IF_THREADS_ENABLED(pixlet_init_thread_copy),
681 .close = pixlet_close,
682 .decode = pixlet_decode_frame,
683 .priv_data_size = sizeof(PixletContext),
684 .capabilities = AV_CODEC_CAP_DR1 |
685 AV_CODEC_CAP_FRAME_THREADS,
686 .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
687 FF_CODEC_CAP_INIT_CLEANUP,
688 };