FFmpeg
Data Structures | Macros | Functions | Variables
libdav1d.c File Reference
#include <dav1d/dav1d.h>
#include "libavutil/avassert.h"
#include "libavutil/cpu.h"
#include "libavutil/film_grain_params.h"
#include "libavutil/mastering_display_metadata.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "atsc_a53.h"
#include "avcodec.h"
#include "bytestream.h"
#include "decode.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  Libdav1dContext
 

Macros

#define FF_DAV1D_VERSION_AT_LEAST(x, y)   (DAV1D_API_VERSION_MAJOR > (x) || DAV1D_API_VERSION_MAJOR == (x) && DAV1D_API_VERSION_MINOR >= (y))
 
#define DAV1D_MAX_FRAME_THREADS   DAV1D_MAX_THREADS
 
#define DAV1D_MAX_TILE_THREADS   DAV1D_MAX_THREADS
 
#define OFFSET(x)   offsetof(Libdav1dContext, x)
 
#define VD   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 

Functions

static void libdav1d_log_callback (void *opaque, const char *fmt, va_list vl)
 
static int libdav1d_picture_allocator (Dav1dPicture *p, void *cookie)
 
static void libdav1d_picture_release (Dav1dPicture *p, void *cookie)
 
static void libdav1d_init_params (AVCodecContext *c, const Dav1dSequenceHeader *seq)
 
static av_cold int libdav1d_parse_extradata (AVCodecContext *c)
 
static av_cold int libdav1d_init (AVCodecContext *c)
 
static void libdav1d_flush (AVCodecContext *c)
 
static void libdav1d_data_free (const uint8_t *data, void *opaque)
 
static void libdav1d_user_data_free (const uint8_t *data, void *opaque)
 
static int libdav1d_receive_frame (AVCodecContext *c, AVFrame *frame)
 
static av_cold int libdav1d_close (AVCodecContext *c)
 

Variables

static enum AVPixelFormat pix_fmt [][3]
 
static enum AVPixelFormat pix_fmt_rgb [3]
 
static const AVOption libdav1d_options []
 
static const AVClass libdav1d_class
 
const AVCodec ff_libdav1d_decoder
 

Macro Definition Documentation

◆ FF_DAV1D_VERSION_AT_LEAST

#define FF_DAV1D_VERSION_AT_LEAST (   x,
 
)    (DAV1D_API_VERSION_MAJOR > (x) || DAV1D_API_VERSION_MAJOR == (x) && DAV1D_API_VERSION_MINOR >= (y))

Definition at line 37 of file libdav1d.c.

◆ DAV1D_MAX_FRAME_THREADS

#define DAV1D_MAX_FRAME_THREADS   DAV1D_MAX_THREADS

Definition at line 546 of file libdav1d.c.

◆ DAV1D_MAX_TILE_THREADS

#define DAV1D_MAX_TILE_THREADS   DAV1D_MAX_THREADS

Definition at line 549 of file libdav1d.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(Libdav1dContext, x)

Definition at line 552 of file libdav1d.c.

◆ VD

Definition at line 553 of file libdav1d.c.

Function Documentation

◆ libdav1d_log_callback()

static void libdav1d_log_callback ( void *  opaque,
const char *  fmt,
va_list  vl 
)
static

Definition at line 68 of file libdav1d.c.

Referenced by libdav1d_init().

◆ libdav1d_picture_allocator()

static int libdav1d_picture_allocator ( Dav1dPicture *  p,
void *  cookie 
)
static

Definition at line 75 of file libdav1d.c.

Referenced by libdav1d_init().

◆ libdav1d_picture_release()

static void libdav1d_picture_release ( Dav1dPicture *  p,
void *  cookie 
)
static

Definition at line 123 of file libdav1d.c.

Referenced by libdav1d_init().

◆ libdav1d_init_params()

static void libdav1d_init_params ( AVCodecContext c,
const Dav1dSequenceHeader *  seq 
)
static

Definition at line 130 of file libdav1d.c.

Referenced by libdav1d_parse_extradata(), and libdav1d_receive_frame().

◆ libdav1d_parse_extradata()

static av_cold int libdav1d_parse_extradata ( AVCodecContext c)
static

Definition at line 170 of file libdav1d.c.

Referenced by libdav1d_init().

◆ libdav1d_init()

static av_cold int libdav1d_init ( AVCodecContext c)
static

Definition at line 209 of file libdav1d.c.

◆ libdav1d_flush()

static void libdav1d_flush ( AVCodecContext c)
static

Definition at line 270 of file libdav1d.c.

◆ libdav1d_data_free()

static void libdav1d_data_free ( const uint8_t *  data,
void *  opaque 
)
static

Definition at line 278 of file libdav1d.c.

Referenced by libdav1d_receive_frame().

◆ libdav1d_user_data_free()

static void libdav1d_user_data_free ( const uint8_t *  data,
void *  opaque 
)
static

Definition at line 284 of file libdav1d.c.

Referenced by libdav1d_receive_frame().

◆ libdav1d_receive_frame()

static int libdav1d_receive_frame ( AVCodecContext c,
AVFrame frame 
)
static

Definition at line 289 of file libdav1d.c.

◆ libdav1d_close()

static av_cold int libdav1d_close ( AVCodecContext c)
static

Definition at line 534 of file libdav1d.c.

Variable Documentation

◆ pix_fmt

enum AVPixelFormat pix_fmt[][3]
static
Initial value:
= {
[DAV1D_PIXEL_LAYOUT_I400] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12 },
}

Definition at line 57 of file libdav1d.c.

Referenced by libdav1d_init_params(), and libdav1d_picture_allocator().

◆ pix_fmt_rgb

enum AVPixelFormat pix_fmt_rgb[3]
static
Initial value:

Definition at line 64 of file libdav1d.c.

Referenced by libdav1d_init_params(), and read_colorspace_details().

◆ libdav1d_options

const AVOption libdav1d_options[]
static
Initial value:
= {
{ "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_TILE_THREADS, VD | AV_OPT_FLAG_DEPRECATED },
{ "framethreads", "Frame threads", OFFSET(frame_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_THREADS, VD | AV_OPT_FLAG_DEPRECATED },
{ "filmgrain", "Apply Film Grain", OFFSET(apply_grain), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD | AV_OPT_FLAG_DEPRECATED },
{ "oppoint", "Select an operating point of the scalable bitstream", OFFSET(operating_point), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 31, VD },
{ "alllayers", "Output all spatial layers", OFFSET(all_layers), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
{ NULL }
}

Definition at line 554 of file libdav1d.c.

◆ libdav1d_class

const AVClass libdav1d_class
static
Initial value:
= {
.class_name = "libdav1d decoder",
.item_name = av_default_item_name,
.option = libdav1d_options,
}

Definition at line 563 of file libdav1d.c.

◆ ff_libdav1d_decoder

const AVCodec ff_libdav1d_decoder
Initial value:
= {
.name = "libdav1d",
.long_name = NULL_IF_CONFIG_SMALL("dav1d AV1 decoder by VideoLAN"),
.priv_data_size = sizeof(Libdav1dContext),
.close = libdav1d_close,
.priv_class = &libdav1d_class,
.wrapper_name = "libdav1d",
}

Definition at line 570 of file libdav1d.c.

FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:42
FF_CODEC_CAP_SETS_PKT_DTS
#define FF_CODEC_CAP_SETS_PKT_DTS
Decoders marked with FF_CODEC_CAP_SETS_PKT_DTS want to set AVFrame.pkt_dts manually.
Definition: internal.h:57
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
libdav1d_class
static const AVClass libdav1d_class
Definition: libdav1d.c:563
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:404
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:420
libdav1d_init
static av_cold int libdav1d_init(AVCodecContext *c)
Definition: libdav1d.c:209
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:407
DAV1D_MAX_FRAME_THREADS
#define DAV1D_MAX_FRAME_THREADS
Definition: libdav1d.c:546
AV_CODEC_CAP_OTHER_THREADS
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
Definition: codec.h:127
Libdav1dContext
Definition: libdav1d.c:40
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:385
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
flush
static void flush(AVCodecContext *avctx)
Definition: aacdec_template.c:593
NULL
#define NULL
Definition: coverity.c:32
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:279
receive_frame
static CopyRet receive_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame)
Definition: crystalhd.c:559
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:405
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: internal.h:81
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
libdav1d_receive_frame
static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
Definition: libdav1d.c:289
OFFSET
#define OFFSET(x)
Definition: libdav1d.c:552
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:409
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:411
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:421
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:408
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
AV_CODEC_CAP_DELAY
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:82
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
libdav1d_options
static const AVOption libdav1d_options[]
Definition: libdav1d.c:554
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
libdav1d_flush
static void libdav1d_flush(AVCodecContext *c)
Definition: libdav1d.c:270
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:386
VD
#define VD
Definition: libdav1d.c:553
DAV1D_MAX_TILE_THREADS
#define DAV1D_MAX_TILE_THREADS
Definition: libdav1d.c:549
libdav1d_close
static av_cold int libdav1d_close(AVCodecContext *c)
Definition: libdav1d.c:534
AV_OPT_FLAG_DEPRECATED
#define AV_OPT_FLAG_DEPRECATED
set if option is deprecated, users should refer to AVOption.help text for more information
Definition: opt.h:294