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 "internal.h"

Go to the source code of this file.

Data Structures

struct  Libdav1dContext
 
struct  OpaqueData
 

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 40 of file libdav1d.c.

◆ DAV1D_MAX_FRAME_THREADS

#define DAV1D_MAX_FRAME_THREADS   DAV1D_MAX_THREADS

Definition at line 662 of file libdav1d.c.

◆ DAV1D_MAX_TILE_THREADS

#define DAV1D_MAX_TILE_THREADS   DAV1D_MAX_THREADS

Definition at line 665 of file libdav1d.c.

◆ DAV1D_MAX_FRAME_DELAY

#define DAV1D_MAX_FRAME_DELAY   DAV1D_MAX_FRAME_THREADS

Definition at line 668 of file libdav1d.c.

◆ OFFSET

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

Definition at line 671 of file libdav1d.c.

◆ VD

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

Referenced by libdav1d_init().

◆ libdav1d_picture_allocator()

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

Definition at line 76 of file libdav1d.c.

Referenced by libdav1d_init().

◆ libdav1d_picture_release()

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

Definition at line 124 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 131 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 168 of file libdav1d.c.

Referenced by libdav1d_init().

◆ libdav1d_init()

static av_cold int libdav1d_init ( AVCodecContext c)
static

Definition at line 207 of file libdav1d.c.

◆ libdav1d_flush()

static void libdav1d_flush ( AVCodecContext c)
static

Definition at line 291 of file libdav1d.c.

◆ libdav1d_data_free()

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

Definition at line 306 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 312 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 319 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 406 of file libdav1d.c.

◆ libdav1d_close()

static av_cold int libdav1d_close ( AVCodecContext c)
static

Definition at line 650 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 58 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 65 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 673 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 683 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 690 of file libdav1d.c.

libdav1d_class
static const AVClass libdav1d_class
Definition: libdav1d.c:683
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:468
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:484
libdav1d_init
static av_cold int libdav1d_init(AVCodecContext *c)
Definition: libdav1d.c:207
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:471
DAV1D_MAX_FRAME_THREADS
#define DAV1D_MAX_FRAME_THREADS
Definition: libdav1d.c:662
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
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
Libdav1dContext
Definition: libdav1d.c:43
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
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:449
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:283
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:469
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
DAV1D_MAX_FRAME_DELAY
#define DAV1D_MAX_FRAME_DELAY
Definition: libdav1d.c:668
libdav1d_receive_frame
static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
Definition: libdav1d.c:406
OFFSET
#define OFFSET(x)
Definition: libdav1d.c:671
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:473
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:475
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:485
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:472
FF_CODEC_RECEIVE_FRAME_CB
#define FF_CODEC_RECEIVE_FRAME_CB(func)
Definition: codec_internal.h:312
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
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: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:673
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
libdav1d_flush
static void libdav1d_flush(AVCodecContext *c)
Definition: libdav1d.c:291
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
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:367
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
Definition: opt.h:244
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:450
VD
#define VD
Definition: libdav1d.c:672
DAV1D_MAX_TILE_THREADS
#define DAV1D_MAX_TILE_THREADS
Definition: libdav1d.c:665
libdav1d_close
static av_cold int libdav1d_close(AVCodecContext *c)
Definition: libdav1d.c:650
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:298