Lines 35-40
Link Here
|
35 |
#include "bytestream.h" |
35 |
#include "bytestream.h" |
36 |
#include "codec_internal.h" |
36 |
#include "codec_internal.h" |
37 |
#include "decode.h" |
37 |
#include "decode.h" |
|
|
38 |
#include "dovi_rpu.h" |
38 |
#include "internal.h" |
39 |
#include "internal.h" |
39 |
|
40 |
|
40 |
#define FF_DAV1D_VERSION_AT_LEAST(x,y) \ |
41 |
#define FF_DAV1D_VERSION_AT_LEAST(x,y) \ |
Lines 44-49
typedef struct Libdav1dContext {
Link Here
|
44 |
AVClass *class; |
45 |
AVClass *class; |
45 |
Dav1dContext *c; |
46 |
Dav1dContext *c; |
46 |
AVBufferPool *pool; |
47 |
AVBufferPool *pool; |
|
|
48 |
DOVIContext dovi; |
47 |
int pool_size; |
49 |
int pool_size; |
48 |
|
50 |
|
49 |
Dav1dData data; |
51 |
Dav1dData data; |
Lines 213-218
static av_cold int libdav1d_init(AVCodecContext *c)
Link Here
|
213 |
#else |
215 |
#else |
214 |
int threads = (c->thread_count ? c->thread_count : av_cpu_count()) * 3 / 2; |
216 |
int threads = (c->thread_count ? c->thread_count : av_cpu_count()) * 3 / 2; |
215 |
#endif |
217 |
#endif |
|
|
218 |
const AVPacketSideData *sd; |
216 |
int res; |
219 |
int res; |
217 |
|
220 |
|
218 |
av_log(c, AV_LOG_VERBOSE, "libdav1d %s\n", dav1d_version()); |
221 |
av_log(c, AV_LOG_VERBOSE, "libdav1d %s\n", dav1d_version()); |
Lines 285-290
static av_cold int libdav1d_init(AVCodecContext *c)
Link Here
|
285 |
c->delay = res > 1 ? res : 0; |
288 |
c->delay = res > 1 ? res : 0; |
286 |
#endif |
289 |
#endif |
287 |
|
290 |
|
|
|
291 |
dav1d->dovi.logctx = c; |
292 |
dav1d->dovi.dv_profile = 10; // default for AV1 |
293 |
sd = ff_get_coded_side_data(c, AV_PKT_DATA_DOVI_CONF); |
294 |
if (sd && sd->size > 0) |
295 |
ff_dovi_update_cfg(&dav1d->dovi, (AVDOVIDecoderConfigurationRecord *) sd->data); |
288 |
return 0; |
296 |
return 0; |
289 |
} |
297 |
} |
290 |
|
298 |
|
Lines 579-584
static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
Link Here
|
579 |
goto fail; |
587 |
goto fail; |
580 |
break; |
588 |
break; |
581 |
} |
589 |
} |
|
|
590 |
case 0x3B: { // dolby_provider_code |
591 |
int provider_oriented_code = bytestream2_get_be32(&gb); |
592 |
if (itut_t35->country_code != 0xB5 || provider_oriented_code != 0x800) |
593 |
break; |
594 |
|
595 |
res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, gb.buffer_end - gb.buffer); |
596 |
if (res < 0) { |
597 |
av_log(c, AV_LOG_WARNING, "Error parsing DOVI OBU.\n"); |
598 |
break; // ignore |
599 |
} |
600 |
|
601 |
res = ff_dovi_attach_side_data(&dav1d->dovi, frame); |
602 |
if (res < 0) |
603 |
goto fail; |
604 |
break; |
605 |
} |
582 |
default: // ignore unsupported provider codes |
606 |
default: // ignore unsupported provider codes |
583 |
break; |
607 |
break; |
584 |
} |
608 |
} |
Lines 638-643
static av_cold int libdav1d_close(AVCodecContext *c)
Link Here
|
638 |
Libdav1dContext *dav1d = c->priv_data; |
662 |
Libdav1dContext *dav1d = c->priv_data; |
639 |
|
663 |
|
640 |
av_buffer_pool_uninit(&dav1d->pool); |
664 |
av_buffer_pool_uninit(&dav1d->pool); |
|
|
665 |
ff_dovi_ctx_unref(&dav1d->dovi); |
641 |
dav1d_data_unref(&dav1d->data); |
666 |
dav1d_data_unref(&dav1d->data); |
642 |
dav1d_close(&dav1d->c); |
667 |
dav1d_close(&dav1d->c); |
643 |
|
668 |
|
644 |
- |
|
|