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/hdr_dynamic_metadata.h"
#include "libavutil/mastering_display_metadata.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "atsc_a53.h"
#include "av1_parse.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "dovi_rpu.h"
#include "internal.h"
#include "itut35.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 DAV1D_MAX_FRAME_DELAY   DAV1D_MAX_FRAME_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_internal (AVCodecContext *c, Dav1dPicture *p)
 
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 FFCodec 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 42 of file libdav1d.c.

◆ DAV1D_MAX_FRAME_THREADS

#define DAV1D_MAX_FRAME_THREADS   DAV1D_MAX_THREADS

Definition at line 659 of file libdav1d.c.

◆ DAV1D_MAX_TILE_THREADS

#define DAV1D_MAX_TILE_THREADS   DAV1D_MAX_THREADS

Definition at line 662 of file libdav1d.c.

◆ DAV1D_MAX_FRAME_DELAY

#define DAV1D_MAX_FRAME_DELAY   DAV1D_MAX_FRAME_THREADS

Definition at line 665 of file libdav1d.c.

◆ OFFSET

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

Definition at line 668 of file libdav1d.c.

◆ VD

Definition at line 669 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 72 of file libdav1d.c.

Referenced by libdav1d_init().

◆ libdav1d_picture_allocator()

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

Definition at line 79 of file libdav1d.c.

Referenced by libdav1d_init().

◆ libdav1d_picture_release()

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

Definition at line 127 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 134 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 171 of file libdav1d.c.

Referenced by libdav1d_init().

◆ libdav1d_init()

static av_cold int libdav1d_init ( AVCodecContext c)
static

Definition at line 210 of file libdav1d.c.

◆ libdav1d_flush()

static void libdav1d_flush ( AVCodecContext c)
static

Definition at line 300 of file libdav1d.c.

◆ libdav1d_data_free()

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

Definition at line 308 of file libdav1d.c.

Referenced by libdav1d_receive_frame_internal().

◆ libdav1d_user_data_free()

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

Definition at line 314 of file libdav1d.c.

Referenced by libdav1d_receive_frame_internal().

◆ libdav1d_receive_frame_internal()

static int libdav1d_receive_frame_internal ( AVCodecContext c,
Dav1dPicture *  p 
)
static

Definition at line 320 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 384 of file libdav1d.c.

◆ libdav1d_close()

static av_cold int libdav1d_close ( AVCodecContext c)
static

Definition at line 646 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 61 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 68 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 },
{ "max_frame_delay", "Max frame delay", OFFSET(max_frame_delay), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_DELAY, VD },
{ "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 670 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 680 of file libdav1d.c.

◆ ff_libdav1d_decoder

const FFCodec ff_libdav1d_decoder
Initial value:
= {
.p.name = "libdav1d",
CODEC_LONG_NAME("dav1d AV1 decoder by VideoLAN"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_AV1,
.priv_data_size = sizeof(Libdav1dContext),
.close = libdav1d_close,
.caps_internal = FF_CODEC_CAP_SETS_FRAME_PROPS |
.p.priv_class = &libdav1d_class,
.p.wrapper_name = "libdav1d",
}

Definition at line 687 of file libdav1d.c.

libdav1d_class
static const AVClass libdav1d_class
Definition: libdav1d.c:680
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:487
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:503
libdav1d_init
static av_cold int libdav1d_init(AVCodecContext *c)
Definition: libdav1d.c:210
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:490
DAV1D_MAX_FRAME_THREADS
#define DAV1D_MAX_FRAME_THREADS
Definition: libdav1d.c:659
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:124
Libdav1dContext
Definition: libdav1d.c:45
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:73
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:468
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:280
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts.c:370
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:488
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
DAV1D_MAX_FRAME_DELAY
#define DAV1D_MAX_FRAME_DELAY
Definition: libdav1d.c:665
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
libdav1d_receive_frame
static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
Definition: libdav1d.c:384
OFFSET
#define OFFSET(x)
Definition: libdav1d.c:668
FF_CODEC_CAP_SETS_FRAME_PROPS
#define FF_CODEC_CAP_SETS_FRAME_PROPS
Codec handles output frame properties internally instead of letting the internal logic derive them fr...
Definition: codec_internal.h:78
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:492
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:494
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:386
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:504
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:491
FF_CODEC_RECEIVE_FRAME_CB
#define FF_CODEC_RECEIVE_FRAME_CB(func)
Definition: codec_internal.h:317
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
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:76
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:78
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
libdav1d_options
static const AVOption libdav1d_options[]
Definition: libdav1d.c:670
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
libdav1d_flush
static void libdav1d_flush(AVCodecContext *c)
Definition: libdav1d.c:300
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:77
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: codec_internal.h:73
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:469
VD
#define VD
Definition: libdav1d.c:669
DAV1D_MAX_TILE_THREADS
#define DAV1D_MAX_TILE_THREADS
Definition: libdav1d.c:662
libdav1d_close
static av_cold int libdav1d_close(AVCodecContext *c)
Definition: libdav1d.c:646