FFmpeg
Data Structures | Macros | Functions | Variables
libvvenc.c File Reference
#include <vvenc/vvenc.h>
#include <vvenc/vvencCfg.h>
#include <vvenc/version.h>
#include "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/common.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include "internal.h"
#include "packet_internal.h"
#include "profiles.h"

Go to the source code of this file.

Data Structures

struct  VVenCContext
 

Macros

#define VVENC_VERSION_INT
 
#define OFFSET(x)   offsetof(VVenCContext, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static void vvenc_log_callback (void *ctx, int level, const char *fmt, va_list args)
 
static void vvenc_set_verbository (vvenc_config *params)
 
static void vvenc_set_pic_format (AVCodecContext *avctx, vvenc_config *params)
 
static void vvenc_set_color_format (AVCodecContext *avctx, vvenc_config *params)
 
static void vvenc_set_framerate (AVCodecContext *avctx, vvenc_config *params)
 
static int vvenc_parse_vvenc_params (AVCodecContext *avctx, vvenc_config *params)
 
static int vvenc_set_rc_mode (AVCodecContext *avctx, vvenc_config *params)
 
static int vvenc_init_extradata (AVCodecContext *avctx, VVenCContext *s)
 
static av_cold int vvenc_init (AVCodecContext *avctx)
 
static av_cold int vvenc_close (AVCodecContext *avctx)
 
static av_cold int vvenc_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 

Variables

static enum AVPixelFormat pix_fmts_vvenc []
 
static const AVOption options []
 
class {
      class_name = "libvvenc"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
static const FFCodecDefault vvenc_defaults []
 
const FFCodec ff_libvvenc_encoder
 

Macro Definition Documentation

◆ VVENC_VERSION_INT

#define VVENC_VERSION_INT
Value:
AV_VERSION_INT(VVENC_VERSION_MAJOR, \
VVENC_VERSION_MINOR, \
VVENC_VERSION_PATCH)

Definition at line 44 of file libvvenc.c.

◆ OFFSET

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

Definition at line 439 of file libvvenc.c.

◆ VE

Definition at line 440 of file libvvenc.c.

Function Documentation

◆ vvenc_log_callback()

static void vvenc_log_callback ( void *  ctx,
int  level,
const char *  fmt,
va_list  args 
)
static

Definition at line 63 of file libvvenc.c.

Referenced by vvenc_init().

◆ vvenc_set_verbository()

static void vvenc_set_verbository ( vvenc_config *  params)
static

Definition at line 76 of file libvvenc.c.

Referenced by vvenc_init().

◆ vvenc_set_pic_format()

static void vvenc_set_pic_format ( AVCodecContext avctx,
vvenc_config *  params 
)
static

Definition at line 88 of file libvvenc.c.

Referenced by vvenc_init().

◆ vvenc_set_color_format()

static void vvenc_set_color_format ( AVCodecContext avctx,
vvenc_config *  params 
)
static

Definition at line 94 of file libvvenc.c.

Referenced by vvenc_init().

◆ vvenc_set_framerate()

static void vvenc_set_framerate ( AVCodecContext avctx,
vvenc_config *  params 
)
static

Definition at line 121 of file libvvenc.c.

Referenced by vvenc_init().

◆ vvenc_parse_vvenc_params()

static int vvenc_parse_vvenc_params ( AVCodecContext avctx,
vvenc_config *  params 
)
static

Definition at line 147 of file libvvenc.c.

Referenced by vvenc_init().

◆ vvenc_set_rc_mode()

static int vvenc_set_rc_mode ( AVCodecContext avctx,
vvenc_config *  params 
)
static

Definition at line 185 of file libvvenc.c.

Referenced by vvenc_init().

◆ vvenc_init_extradata()

static int vvenc_init_extradata ( AVCodecContext avctx,
VVenCContext s 
)
static

Definition at line 218 of file libvvenc.c.

Referenced by vvenc_init().

◆ vvenc_init()

static av_cold int vvenc_init ( AVCodecContext avctx)
static

Definition at line 244 of file libvvenc.c.

◆ vvenc_close()

static av_cold int vvenc_close ( AVCodecContext avctx)
static

Definition at line 359 of file libvvenc.c.

◆ vvenc_frame()

static av_cold int vvenc_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame frame,
int *  got_packet 
)
static

Definition at line 376 of file libvvenc.c.

Variable Documentation

◆ pix_fmts_vvenc

enum AVPixelFormat pix_fmts_vvenc[]
static
Initial value:

Definition at line 434 of file libvvenc.c.

◆ options

const AVOption options[]
static
Initial value:
= {
{ "preset", "set encoding preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64 = 2}, 0, 4, VE, "preset"},
{ "faster", "0", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_FASTER}, INT_MIN, INT_MAX, VE, "preset" },
{ "fast", "1", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_FAST}, INT_MIN, INT_MAX, VE, "preset" },
{ "medium", "2", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_MEDIUM}, INT_MIN, INT_MAX, VE, "preset" },
{ "slow", "3", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_SLOW}, INT_MIN, INT_MAX, VE, "preset" },
{ "slower", "4", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_SLOWER}, INT_MIN, INT_MAX, VE, "preset" },
{ "qp", "set quantization", OFFSET(qp), AV_OPT_TYPE_INT, {.i64 = 32}, -1, 63, VE },
{ "qpa", "set subjective (perceptually motivated) optimization", OFFSET(qpa), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, VE},
{ "passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VE},
{ "stats", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VE},
{ "period", "set (intra) refresh period in seconds", OFFSET(intra_refresh_sec), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, VE },
{ "vvenc-params", "set the vvenc configuration using a :-separated list of key=value parameters", OFFSET(vvenc_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
{ "level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VE},
{ "tier", "set vvc tier", OFFSET(tier), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VE, "tier"},
{ "main", "main", 0, AV_OPT_TYPE_CONST, {.i64 = 0}, INT_MIN, INT_MAX, VE, "tier"},
{ "high", "high", 0, AV_OPT_TYPE_CONST, {.i64 = 1}, INT_MIN, INT_MAX, VE, "tier"},
{NULL}
}

Definition at line 441 of file libvvenc.c.

◆ class_name

class_name = "libvvenc"
private

Definition at line 462 of file libvvenc.c.

◆ item_name

item_name = av_default_item_name
private

Definition at line 463 of file libvvenc.c.

◆ option

option = options
private

Definition at line 464 of file libvvenc.c.

◆ version

version = LIBAVUTIL_VERSION_INT
private

Definition at line 465 of file libvvenc.c.

◆ @163

const { ... }

◆ vvenc_defaults

const FFCodecDefault vvenc_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ "g", "-1" },
{ NULL },
}

Definition at line 468 of file libvvenc.c.

◆ ff_libvvenc_encoder

const FFCodec ff_libvvenc_encoder
Initial value:
= {
.p.name = "libvvenc",
CODEC_LONG_NAME("libvvenc H.266 / VVC"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_VVC,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
.p.priv_class = &class,
.p.wrapper_name = "libvvenc",
.priv_data_size = sizeof(VVenCContext),
.p.pix_fmts = pix_fmts_vvenc,
.init = vvenc_init,
.close = vvenc_close,
.defaults = vvenc_defaults,
}

Definition at line 474 of file libvvenc.c.

level
uint8_t level
Definition: svq3.c:205
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:502
vvenc_defaults
static const FFCodecDefault vvenc_defaults[]
Definition: libvvenc.c:468
VE
#define VE
Definition: libvvenc.c:440
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:320
preset
preset
Definition: vf_curves.c:47
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
AV_VERSION_INT
#define AV_VERSION_INT(a, b, c)
Definition: version.h:56
tier
int tier
Definition: av1_levels.c:48
VVenCContext
Definition: libvvenc.c:48
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: libvvenc.c:439
vvenc_frame
static av_cold int vvenc_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: libvvenc.c:376
AV_OPT_TYPE_DICT
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
Definition: opt.h:290
stats
static void stats(AVPacket *const *in, int n_in, unsigned *_max, unsigned *_sum)
Definition: vp9_superframe.c:34
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
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:94
pix_fmts_vvenc
static enum AVPixelFormat pix_fmts_vvenc[]
Definition: libvvenc.c:434
AV_CODEC_ID_VVC
@ AV_CODEC_ID_VVC
Definition: codec_id.h:252
vvenc_close
static av_cold int vvenc_close(AVCodecContext *avctx)
Definition: libvvenc.c:359
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
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
vvenc_init
static av_cold int vvenc_init(AVCodecContext *avctx)
Definition: libvvenc.c:244
ff_vvc_profiles
const AVProfile ff_vvc_profiles[]
Definition: profiles.c:91
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
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_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299