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 "codec_internal.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 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 38 of file libdav1d.c.

◆ DAV1D_MAX_FRAME_THREADS

#define DAV1D_MAX_FRAME_THREADS   DAV1D_MAX_THREADS

Definition at line 553 of file libdav1d.c.

◆ DAV1D_MAX_TILE_THREADS

#define DAV1D_MAX_TILE_THREADS   DAV1D_MAX_THREADS

Definition at line 556 of file libdav1d.c.

◆ OFFSET

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

Definition at line 559 of file libdav1d.c.

◆ VD

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

◆ libdav1d_data_free()

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

Definition at line 282 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 288 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 293 of file libdav1d.c.

◆ libdav1d_close()

static av_cold int libdav1d_close ( AVCodecContext c)
static

Definition at line 541 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 },
{ "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 561 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 570 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_PKT_DTS |
.p.priv_class = &libdav1d_class,
.p.wrapper_name = "libdav1d",
}

Definition at line 577 of file libdav1d.c.

libdav1d_class
static const AVClass libdav1d_class
Definition: libdav1d.c:570
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:431
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:447
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:434
DAV1D_MAX_FRAME_THREADS
#define DAV1D_MAX_FRAME_THREADS
Definition: libdav1d.c:553
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
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:363
Libdav1dContext
Definition: libdav1d.c:41
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:264
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:412
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:432
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
libdav1d_receive_frame
static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
Definition: libdav1d.c:293
OFFSET
#define OFFSET(x)
Definition: libdav1d.c:559
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:436
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:438
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:448
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: codec_internal.h:49
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:435
FF_CODEC_RECEIVE_FRAME_CB
#define FF_CODEC_RECEIVE_FRAME_CB(func)
Definition: codec_internal.h:304
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: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:561
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
libdav1d_flush
static void libdav1d_flush(AVCodecContext *c)
Definition: libdav1d.c:274
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:365
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:413
VD
#define VD
Definition: libdav1d.c:560
DAV1D_MAX_TILE_THREADS
#define DAV1D_MAX_TILE_THREADS
Definition: libdav1d.c:556
libdav1d_close
static av_cold int libdav1d_close(AVCodecContext *c)
Definition: libdav1d.c:541
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