FFmpeg
Loading...
Searching...
No Matches
libvvenc.c
Go to the documentation of this file.
1/*
2 * H.266 encoding using the VVenC library
3 *
4 * Copyright (C) 2022, Thomas Siedel
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include <vvenc/vvenc.h>
24#include <vvenc/vvencCfg.h>
25#include <vvenc/version.h>
26
27#include "libavutil/avstring.h"
28#include "libavutil/avutil.h"
29#include "libavutil/common.h"
30#include "libavutil/frame.h"
31#include "libavutil/imgutils.h"
32#include "libavutil/log.h"
33#include "libavutil/mem.h"
34#include "libavutil/pixdesc.h"
35#include "libavutil/opt.h"
36
37#include "avcodec.h"
38#include "codec_internal.h"
39#include "encode.h"
40#include "internal.h"
41#include "packet_internal.h"
42#include "profiles.h"
43
44#define VVENC_VERSION_INT AV_VERSION_INT(VVENC_VERSION_MAJOR, \
45 VVENC_VERSION_MINOR, \
46 VVENC_VERSION_PATCH)
47
48typedef struct VVenCContext {
49 AVClass *class;
50 vvencEncoder *encoder;
51 vvencAccessUnit *au;
53 int preset;
54 int qp;
55 int qpa;
57 char *level;
58 int tier;
59 char *stats;
62
63static void vvenc_log_callback(void *ctx, int level,
64 const char *fmt, va_list args)
65{
66 vvenc_config params;
67 vvencEncoder *encoder = ctx;
68 if (encoder) {
69 vvenc_config_default(&params);
70 vvenc_get_config(encoder, &params);
71 if ((int)params.m_verbosity >= level)
72 vfprintf(level == 1 ? stderr : stdout, fmt, args);
73 }
74}
75
76static void vvenc_set_verbository(vvenc_config *params)
77{
78 int loglevel = av_log_get_level();
79 params->m_verbosity = VVENC_SILENT;
80 if (loglevel >= AV_LOG_DEBUG)
81 params->m_verbosity = VVENC_DETAILS;
82 else if (loglevel >= AV_LOG_VERBOSE)
83 params->m_verbosity = VVENC_NOTICE;
84 else if (loglevel >= AV_LOG_INFO)
85 params->m_verbosity = VVENC_WARNING;
86}
87
88static void vvenc_set_pic_format(AVCodecContext *avctx, vvenc_config *params)
89{
90 params->m_internChromaFormat = VVENC_CHROMA_420;
91 params->m_inputBitDepth[0] = 10;
92}
93
94static void vvenc_set_color_format(AVCodecContext *avctx, vvenc_config *params)
95{
97 params->m_colourPrimaries = (int) avctx->color_primaries;
99 params->m_matrixCoefficients = (int) avctx->colorspace;
100 if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED) {
101 params->m_transferCharacteristics = (int) avctx->color_trc;
102
103 if (avctx->color_trc == AVCOL_TRC_SMPTE2084)
104 params->m_HdrMode = (avctx->color_primaries == AVCOL_PRI_BT2020) ?
105 VVENC_HDR_PQ_BT2020 : VVENC_HDR_PQ;
106 else if (avctx->color_trc == AVCOL_TRC_BT2020_10 || avctx->color_trc == AVCOL_TRC_ARIB_STD_B67)
107 params->m_HdrMode = (avctx->color_trc == AVCOL_TRC_BT2020_10 ||
111 VVENC_HDR_HLG_BT2020 : VVENC_HDR_HLG;
112 }
113
114 if (params->m_HdrMode == VVENC_HDR_OFF &&
116 params->m_vuiParametersPresent = 1;
117 params->m_colourDescriptionPresent = true;
118 }
119}
120
121static void vvenc_set_framerate(AVCodecContext *avctx, vvenc_config *params)
122{
123 if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
124 params->m_FrameRate = avctx->framerate.num;
125 params->m_FrameScale = avctx->framerate.den;
126 } else {
127 params->m_FrameRate = avctx->time_base.den;
128 params->m_FrameScale = avctx->time_base.num;
129 }
130
131 params->m_TicksPerSecond = -1; /* auto mode for ticks per frame = 1 */
132}
133
134static int vvenc_parse_vvenc_params(AVCodecContext *avctx, vvenc_config *params)
135{
136 VVenCContext *s = avctx->priv_data;
137 const AVDictionaryEntry *en = NULL;
138 int parse_ret;
139 int ret = 0;
140
141 while ((en = av_dict_iterate(s->vvenc_opts, en))) {
142 av_log(avctx, AV_LOG_DEBUG, "vvenc_set_param: '%s:%s'\n", en->key,
143 en->value);
144 parse_ret = vvenc_set_param(params, en->key, en->value);
145 switch (parse_ret) {
146 case VVENC_PARAM_BAD_NAME:
147 av_log(avctx, AV_LOG_ERROR, "Unknown vvenc option: %s.\n", en->key);
148 ret = AVERROR(EINVAL);
149 break;
150 case VVENC_PARAM_BAD_VALUE:
151 av_log(avctx, AV_LOG_ERROR, "Invalid vvenc value for %s: %s.\n", en->key, en->value);
152 ret = AVERROR(EINVAL);
153 break;
154 default:
155 break;
156 }
157
158 if (!av_strcasecmp(en->key, "rcstatsfile")) {
159 av_log(avctx, AV_LOG_ERROR, "vvenc-params 2pass option 'rcstatsfile' "
160 "not available. Use option 'passlogfile'\n");
161 ret = AVERROR(EINVAL);
162 }
163 if (!av_strcasecmp(en->key, "passes") || !av_strcasecmp(en->key, "pass")) {
164 av_log(avctx, AV_LOG_ERROR, "vvenc-params 2pass option '%s' "
165 "not available. Use option 'pass'\n", en->key);
166 ret = AVERROR(EINVAL);
167 }
168 }
169 return ret;
170}
171
172static int vvenc_set_rc_mode(AVCodecContext *avctx, vvenc_config *params)
173{
174 params->m_RCNumPasses = 1;
175 if ((avctx->flags & AV_CODEC_FLAG_PASS1 || avctx->flags & AV_CODEC_FLAG_PASS2)) {
176 if (!avctx->bit_rate) {
177 av_log(avctx, AV_LOG_ERROR, "A bitrate must be set to use two pass mode.\n");
178 return AVERROR(EINVAL);
179 }
180 params->m_RCNumPasses = 2;
181 if (avctx->flags & AV_CODEC_FLAG_PASS1)
182 params->m_RCPass = 1;
183 else
184 params->m_RCPass = 2;
185 }
186
187 if (avctx->rc_max_rate) {
188#if VVENC_VERSION_INT >= AV_VERSION_INT(1,8,0)
189 params->m_RCMaxBitrate = avctx->rc_max_rate;
190#endif
191
192#if VVENC_VERSION_INT < AV_VERSION_INT(1,11,0)
193 /* rc_max_rate without a bit_rate enables capped CQF mode.
194 (QP + subj. optimization + max. bitrate) */
195 if (!avctx->bit_rate) {
196 av_log(avctx, AV_LOG_ERROR, "Capped Constant Quality Factor mode (capped CQF) "
197 "needs at least vvenc version >= 1.11.0 (current version %s)\n", vvenc_get_version());
198 return AVERROR(EINVAL);
199 }
200#endif
201 }
202 return 0;
203}
204
206{
207 int ret;
208 if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
209 ret = vvenc_get_headers(s->encoder, s->au);
210 if (0 != ret) {
211 av_log(avctx, AV_LOG_ERROR, "cannot get (SPS,PPS) headers: %s\n",
212 vvenc_get_last_error(s->encoder));
213 return AVERROR(EINVAL);
214 }
215
216 if (s->au->payloadUsedSize <= 0) {
217 return AVERROR_INVALIDDATA;
218 }
219
220 avctx->extradata_size = s->au->payloadUsedSize;
222 if (!avctx->extradata) {
223 return AVERROR(ENOMEM);
224 }
225
226 memcpy(avctx->extradata, s->au->payload, avctx->extradata_size);
227 }
228 return 0;
229}
230
232{
233 int ret;
234 int framerate;
235 VVenCContext *s = avctx->priv_data;
236 vvenc_config params;
237 vvencPresetMode preset = (vvencPresetMode) s->preset;
238
239 if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
240 av_log(avctx, AV_LOG_ERROR, "interlaced not supported\n");
241 return AVERROR(EINVAL);
242 }
243
244 vvenc_config_default(&params);
245
246 if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
247 framerate = avctx->framerate.num / avctx->framerate.den;
248 else
249 framerate = avctx->time_base.den / avctx->time_base.num;
250
251 vvenc_init_default(&params, avctx->width, avctx->height, framerate,
252 avctx->bit_rate, s->qp, preset);
253
255
256 if (avctx->thread_count > 0)
257 params.m_numThreads = avctx->thread_count;
258
259 /* GOP settings (IDR/CRA) */
260 if (avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)
261 params.m_DecodingRefreshType = VVENC_DRT_IDR;
262
263 if (avctx->gop_size == 1) {
264 params.m_GOPSize = 1;
265 params.m_IntraPeriod = 1;
266 } else
267 params.m_IntraPeriodSec = s->intra_refresh_sec;
268
269 params.m_AccessUnitDelimiter = true;
270 params.m_usePerceptQPA = s->qpa;
271 params.m_levelTier = (vvencTier) s->tier;
272
273 if (avctx->level > 0)
274 params.m_level = (vvencLevel)avctx->level;
275
276 if (s->level) {
277 if (VVENC_PARAM_BAD_VALUE == vvenc_set_param(&params, "level", s->level)) {
278 av_log(avctx, AV_LOG_ERROR, "Invalid level_idc: %s.\n", s->level);
279 return AVERROR(EINVAL);
280 }
281 }
282
284
286
288
289 ret = vvenc_parse_vvenc_params(avctx, &params);
290 if (ret != 0)
291 return ret;
292
293 ret = vvenc_set_rc_mode(avctx, &params);
294 if (ret != 0)
295 return ret;
296
297 s->encoder = vvenc_encoder_create();
298 if (!s->encoder) {
299 av_log(avctx, AV_LOG_ERROR, "cannot create libvvenc encoder\n");
300 return AVERROR(ENOMEM);
301 }
302
303 vvenc_set_msg_callback(&params, s->encoder, vvenc_log_callback);
304 ret = vvenc_encoder_open(s->encoder, &params);
305 if (ret != 0) {
306 av_log(avctx, AV_LOG_ERROR, "cannot open libvvenc encoder: %s\n",
307 vvenc_get_last_error(s->encoder));
308 return AVERROR_EXTERNAL;
309 }
310
311 vvenc_get_config(s->encoder, &params); /* get the adapted config */
312
313 av_log(avctx, AV_LOG_INFO, "libvvenc version: %s\n", vvenc_get_version());
315 av_log(avctx, AV_LOG_INFO, "%s\n", vvenc_get_config_as_string(&params, params.m_verbosity));
316
317 if (params.m_RCNumPasses == 2) {
318 ret = vvenc_init_pass(s->encoder, params.m_RCPass - 1, s->stats);
319 if (ret != 0) {
320 av_log(avctx, AV_LOG_ERROR, "cannot init pass %d: %s\n", params.m_RCPass,
321 vvenc_get_last_error(s->encoder));
322 return AVERROR_EXTERNAL;
323 }
324 }
325
326 s->au = vvenc_accessUnit_alloc();
327 if (!s->au) {
328 av_log(avctx, AV_LOG_FATAL, "cannot allocate memory for AU payload\n");
329 return AVERROR(ENOMEM);
330 }
331 vvenc_accessUnit_alloc_payload(s->au, avctx->width * avctx->height);
332 if (!s->au->payload) {
333 av_log(avctx, AV_LOG_FATAL, "cannot allocate payload memory of size %d\n",
334 avctx->width * avctx->height);
335 return AVERROR(ENOMEM);
336 }
337
338 ret = vvenc_init_extradata(avctx, s);
339 if (ret != 0)
340 return ret;
341
342 s->encode_done = false;
343 return 0;
344}
345
347{
348 VVenCContext *s = avctx->priv_data;
349
350 if (s->au)
351 vvenc_accessUnit_free(s->au, true);
352
353 if (s->encoder) {
354 vvenc_print_summary(s->encoder);
355
356 if (0 != vvenc_encoder_close(s->encoder))
357 return AVERROR_EXTERNAL;
358 }
359
360 return 0;
361}
362
364 int *got_packet)
365{
366 VVenCContext *s = avctx->priv_data;
367 vvencYUVBuffer *pyuvbuf;
368 vvencYUVBuffer yuvbuf;
369 int ret;
370
371 pyuvbuf = NULL;
372 if (frame) {
373 vvenc_YUVBuffer_default(&yuvbuf);
374 yuvbuf.planes[0].ptr = (int16_t *) frame->data[0];
375 yuvbuf.planes[1].ptr = (int16_t *) frame->data[1];
376 yuvbuf.planes[2].ptr = (int16_t *) frame->data[2];
377
378 yuvbuf.planes[0].width = frame->width;
379 yuvbuf.planes[0].height = frame->height;
380 yuvbuf.planes[0].stride = frame->linesize[0] >> 1; /* stride is used in 16bit samples in vvenc */
381
382 yuvbuf.planes[1].width = frame->width >> 1;
383 yuvbuf.planes[1].height = frame->height >> 1;
384 yuvbuf.planes[1].stride = frame->linesize[1] >> 1;
385
386 yuvbuf.planes[2].width = frame->width >> 1;
387 yuvbuf.planes[2].height = frame->height >> 1;
388 yuvbuf.planes[2].stride = frame->linesize[2] >> 1;
389
390 yuvbuf.cts = frame->pts;
391 yuvbuf.ctsValid = true;
392 pyuvbuf = &yuvbuf;
393 }
394
395 if (!s->encode_done) {
396 if (vvenc_encode(s->encoder, pyuvbuf, s->au, &s->encode_done) != 0)
397 return AVERROR_EXTERNAL;
398 } else
399 return 0;
400
401 if (s->au->payloadUsedSize > 0) {
402 ret = ff_get_encode_buffer(avctx, pkt, s->au->payloadUsedSize, 0);
403 if (ret < 0)
404 return ret;
405
406 memcpy(pkt->data, s->au->payload, s->au->payloadUsedSize);
407
408 if (s->au->ctsValid)
409 pkt->pts = s->au->cts;
410 if (s->au->dtsValid)
411 pkt->dts = s->au->dts;
412 pkt->flags |= AV_PKT_FLAG_KEY * s->au->rap;
413
414 *got_packet = 1;
415 return 0;
416 }
417
418 return 0;
419}
420
425
426#define OFFSET(x) offsetof(VVenCContext, x)
427#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
428static const AVOption options[] = {
429 { "preset", "set encoding preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64 = 2}, 0, 4, VE, "preset"},
430 { "faster", "0", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_FASTER}, INT_MIN, INT_MAX, VE, "preset" },
431 { "fast", "1", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_FAST}, INT_MIN, INT_MAX, VE, "preset" },
432 { "medium", "2", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_MEDIUM}, INT_MIN, INT_MAX, VE, "preset" },
433 { "slow", "3", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_SLOW}, INT_MIN, INT_MAX, VE, "preset" },
434 { "slower", "4", 0, AV_OPT_TYPE_CONST, {.i64 = VVENC_SLOWER}, INT_MIN, INT_MAX, VE, "preset" },
435 { "qp", "set quantization", OFFSET(qp), AV_OPT_TYPE_INT, {.i64 = 32}, -1, 63, VE },
436 { "qpa", "set subjective (perceptually motivated) optimization", OFFSET(qpa), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, VE},
437 { "passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VE},
438 { "stats", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VE},
439 { "period", "set (intra) refresh period in seconds", OFFSET(intra_refresh_sec), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, VE },
440 { "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 },
441 { "level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VE},
442 { "tier", "set vvc tier", OFFSET(tier), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VE, "tier"},
443 { "main", "main", 0, AV_OPT_TYPE_CONST, {.i64 = 0}, INT_MIN, INT_MAX, VE, "tier"},
444 { "high", "high", 0, AV_OPT_TYPE_CONST, {.i64 = 1}, INT_MIN, INT_MAX, VE, "tier"},
445 {NULL}
446};
447
448static const AVClass class = {
449 .class_name = "libvvenc",
451 .option = options,
453};
454
456 { "b", "0" },
457 { "g", "-1" },
458 { NULL },
459};
460
462 .p.name = "libvvenc",
463 CODEC_LONG_NAME("libvvenc H.266 / VVC"),
464 .p.type = AVMEDIA_TYPE_VIDEO,
465 .p.id = AV_CODEC_ID_VVC,
466 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
469 .p.priv_class = &class,
470 .p.wrapper_name = "libvvenc",
471 .priv_data_size = sizeof(VVenCContext),
473 .init = vvenc_init,
475 .close = vvenc_close,
476 .defaults = vvenc_defaults,
478};
SwsAArch64OpImplParams params
Definition ops.c:51
const FFCodec ff_libvvenc_encoder
Definition libvvenc.c:461
#define VE
Definition amfenc_av1.c:30
static AVFormatContext * ctx
Libavcodec external API header.
Convenience header that includes libavutil's core.
#define s(width, name)
Definition cbs_vp9.c:198
#define CODEC_PIXFMTS_ARRAY(array)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
common internal and external API header
#define NULL
Definition coverity.c:32
static AVPacket * pkt
static AVFrame * frame
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
Definition encode.c:106
static CheckasmStats stats
Definition checkasm.c:75
reference-counted frame API
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
Definition opt.h:289
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
@ 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:275
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
Definition avcodec.h:294
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
Definition codec.h:112
#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:79
#define AV_CODEC_FLAG_CLOSED_GOP
Definition avcodec.h:332
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
Definition avcodec.h:310
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
Definition avcodec.h:290
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
Definition avcodec.h:318
@ AV_CODEC_ID_VVC
Definition codec_id.h:247
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
Definition defs.h:40
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition packet.h:650
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
Definition dict.c:42
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition error.h:59
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AVERROR(e)
Definition error.h:45
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition log.h:204
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
#define AV_LOG_INFO
Standard information.
Definition log.h:221
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
int av_log_get_level(void)
Get the current log level.
Definition log.c:471
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition avstring.c:208
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
misc image utilities
common internal api header.
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static void vvenc_set_color_format(AVCodecContext *avctx, vvenc_config *params)
Definition libvvenc.c:94
static enum AVPixelFormat pix_fmts_vvenc[]
Definition libvvenc.c:421
static const FFCodecDefault vvenc_defaults[]
Definition libvvenc.c:455
static av_cold int vvenc_init(AVCodecContext *avctx)
Definition libvvenc.c:231
static int vvenc_init_extradata(AVCodecContext *avctx, VVenCContext *s)
Definition libvvenc.c:205
static void vvenc_set_verbository(vvenc_config *params)
Definition libvvenc.c:76
static av_cold int vvenc_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition libvvenc.c:363
static void vvenc_log_callback(void *ctx, int level, const char *fmt, va_list args)
Definition libvvenc.c:63
static void vvenc_set_framerate(AVCodecContext *avctx, vvenc_config *params)
Definition libvvenc.c:121
#define OFFSET(x)
Definition libvvenc.c:426
static int vvenc_set_rc_mode(AVCodecContext *avctx, vvenc_config *params)
Definition libvvenc.c:172
static int vvenc_parse_vvenc_params(AVCodecContext *avctx, vvenc_config *params)
Definition libvvenc.c:134
static void vvenc_set_pic_format(AVCodecContext *avctx, vvenc_config *params)
Definition libvvenc.c:88
static av_cold int vvenc_close(AVCodecContext *avctx)
Definition libvvenc.c:346
Memory handling functions.
AVOptions.
#define AV_PIX_FMT_YUV420P10
Definition pixfmt.h:545
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AVCOL_PRI_UNSPECIFIED
Definition pixfmt.h:645
@ AVCOL_PRI_BT2020
ITU-R BT2020.
Definition pixfmt.h:653
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition pixfmt.h:689
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
Definition pixfmt.h:693
@ AVCOL_TRC_BT2020_10
ITU-R BT2020 for 10-bit system.
Definition pixfmt.h:687
@ AVCOL_TRC_UNSPECIFIED
Definition pixfmt.h:675
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
Definition pixfmt.h:718
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition pixfmt.h:717
@ AVCOL_SPC_UNSPECIFIED
Definition pixfmt.h:709
const AVProfile ff_vvc_profiles[]
Definition profiles.c:91
Describe the class of an AVClass context structure.
Definition log.h:76
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition log.h:81
main external API structure.
Definition avcodec.h:443
int width
picture width / height.
Definition avcodec.h:604
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition avcodec.h:657
AVRational framerate
Definition avcodec.h:563
int level
Encoding level descriptor.
Definition avcodec.h:1646
int64_t bit_rate
the average bitrate
Definition avcodec.h:493
enum AVColorSpace colorspace
YUV colorspace type.
Definition avcodec.h:671
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
Definition avcodec.h:1021
int64_t rc_max_rate
maximum bitrate
Definition avcodec.h:1288
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
Definition avcodec.h:1579
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition avcodec.h:664
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition avcodec.h:547
int flags
AV_CODEC_FLAG_*.
Definition avcodec.h:500
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
Definition avcodec.h:526
int extradata_size
Definition avcodec.h:527
void * priv_data
Definition avcodec.h:470
char * key
Definition dict.h:91
char * value
Definition dict.h:92
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
AVOption.
Definition opt.h:428
This structure stores compressed data.
Definition packet.h:580
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
vvencEncoder * encoder
Definition libvvenc.c:50
char * level
Definition libvvenc.c:57
vvencAccessUnit * au
Definition libvvenc.c:51
bool encode_done
Definition libvvenc.c:52
int intra_refresh_sec
Definition libvvenc.c:56
char * stats
Definition libvvenc.c:59
AVDictionary * vvenc_opts
Definition libvvenc.c:60
uint8_t level
Definition svq3.c:208
#define av_mallocz(s)
#define av_log(a,...)
float framerate
Definition av1_levels.c:29
int tier
Definition av1_levels.c:48
preset
Definition vf_curves.c:47