FFmpeg
libsvtav1.c
Go to the documentation of this file.
1 /*
2  * Scalable Video Technology for AV1 encoder library plugin
3  *
4  * Copyright (c) 2018 Intel Corporation
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 this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include <stdint.h>
24 #include <EbSvtAv1ErrorCodes.h>
25 #include <EbSvtAv1Enc.h>
26 
27 #include "libavutil/common.h"
28 #include "libavutil/frame.h"
29 #include "libavutil/imgutils.h"
30 #include "libavutil/opt.h"
31 #include "libavutil/pixdesc.h"
32 #include "libavutil/avassert.h"
33 
34 #include "codec_internal.h"
35 #include "internal.h"
36 #include "encode.h"
37 #include "packet_internal.h"
38 #include "avcodec.h"
39 #include "profiles.h"
40 
41 typedef enum eos_status {
45 }EOS_STATUS;
46 
47 typedef struct SvtContext {
48  const AVClass *class;
49 
50  EbSvtAv1EncConfiguration enc_params;
51  EbComponentType *svt_handle;
52 
53  EbBufferHeaderType *in_buf;
54  int raw_size;
56 
58 
60 
61  EOS_STATUS eos_flag;
62 
63  // User options.
65 #if FF_API_SVTAV1_OPTS
67  int la_depth;
68  int scd;
69 
70  int tier;
71 
73  int tile_rows;
74 #endif
75  int enc_mode;
76  int crf;
77  int qp;
78 } SvtContext;
79 
80 static const struct {
81  EbErrorType eb_err;
82  int av_err;
83  const char *desc;
84 } svt_errors[] = {
85  { EB_ErrorNone, 0, "success" },
86  { EB_ErrorInsufficientResources, AVERROR(ENOMEM), "insufficient resources" },
87  { EB_ErrorUndefined, AVERROR(EINVAL), "undefined error" },
88  { EB_ErrorInvalidComponent, AVERROR(EINVAL), "invalid component" },
89  { EB_ErrorBadParameter, AVERROR(EINVAL), "bad parameter" },
90  { EB_ErrorDestroyThreadFailed, AVERROR_EXTERNAL, "failed to destroy thread" },
91  { EB_ErrorSemaphoreUnresponsive, AVERROR_EXTERNAL, "semaphore unresponsive" },
92  { EB_ErrorDestroySemaphoreFailed, AVERROR_EXTERNAL, "failed to destroy semaphore"},
93  { EB_ErrorCreateMutexFailed, AVERROR_EXTERNAL, "failed to create mutex" },
94  { EB_ErrorMutexUnresponsive, AVERROR_EXTERNAL, "mutex unresponsive" },
95  { EB_ErrorDestroyMutexFailed, AVERROR_EXTERNAL, "failed to destroy mutex" },
96  { EB_NoErrorEmptyQueue, AVERROR(EAGAIN), "empty queue" },
97 };
98 
99 static int svt_map_error(EbErrorType eb_err, const char **desc)
100 {
101  int i;
102 
103  av_assert0(desc);
104  for (i = 0; i < FF_ARRAY_ELEMS(svt_errors); i++) {
105  if (svt_errors[i].eb_err == eb_err) {
106  *desc = svt_errors[i].desc;
107  return svt_errors[i].av_err;
108  }
109  }
110  *desc = "unknown error";
111  return AVERROR_UNKNOWN;
112 }
113 
114 static int svt_print_error(void *log_ctx, EbErrorType err,
115  const char *error_string)
116 {
117  const char *desc;
118  int ret = svt_map_error(err, &desc);
119 
120  av_log(log_ctx, AV_LOG_ERROR, "%s: %s (0x%x)\n", error_string, desc, err);
121 
122  return ret;
123 }
124 
125 static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc)
126 {
127  const size_t luma_size = config->source_width * config->source_height *
128  (config->encoder_bit_depth > 8 ? 2 : 1);
129 
130  EbSvtIOFormat *in_data;
131 
132  svt_enc->raw_size = luma_size * 3 / 2;
133 
134  // allocate buffer for in and out
135  svt_enc->in_buf = av_mallocz(sizeof(*svt_enc->in_buf));
136  if (!svt_enc->in_buf)
137  return AVERROR(ENOMEM);
138 
139  svt_enc->in_buf->p_buffer = av_mallocz(sizeof(*in_data));
140  if (!svt_enc->in_buf->p_buffer)
141  return AVERROR(ENOMEM);
142 
143  svt_enc->in_buf->size = sizeof(*svt_enc->in_buf);
144 
145  return 0;
146 
147 }
148 
149 static int config_enc_params(EbSvtAv1EncConfiguration *param,
150  AVCodecContext *avctx)
151 {
152  SvtContext *svt_enc = avctx->priv_data;
153  const AVPixFmtDescriptor *desc;
154  AVDictionaryEntry *en = NULL;
155 
156  // Update param from options
157 #if FF_API_SVTAV1_OPTS
158  if (svt_enc->hierarchical_level >= 0)
159  param->hierarchical_levels = svt_enc->hierarchical_level;
160  if (svt_enc->tier >= 0)
161  param->tier = svt_enc->tier;
162  if (svt_enc->scd >= 0)
163  param->scene_change_detection = svt_enc->scd;
164  if (svt_enc->tile_columns >= 0)
165  param->tile_columns = svt_enc->tile_columns;
166  if (svt_enc->tile_rows >= 0)
167  param->tile_rows = svt_enc->tile_rows;
168 
169  if (svt_enc->la_depth >= 0)
170  param->look_ahead_distance = svt_enc->la_depth;
171 #endif
172 
173  if (svt_enc->enc_mode >= -1)
174  param->enc_mode = svt_enc->enc_mode;
175 
176  if (avctx->bit_rate) {
177  param->target_bit_rate = avctx->bit_rate;
178  if (avctx->rc_max_rate != avctx->bit_rate)
179  param->rate_control_mode = 1;
180  else
181  param->rate_control_mode = 2;
182 
183  param->max_qp_allowed = avctx->qmax;
184  param->min_qp_allowed = avctx->qmin;
185  }
186  param->max_bit_rate = avctx->rc_max_rate;
187  if ((avctx->bit_rate > 0 || avctx->rc_max_rate > 0) && avctx->rc_buffer_size)
188  param->maximum_buffer_size_ms =
189  avctx->rc_buffer_size * 1000LL /
190  FFMAX(avctx->bit_rate, avctx->rc_max_rate);
191 
192  if (svt_enc->crf > 0) {
193  param->qp = svt_enc->crf;
194  param->rate_control_mode = 0;
195  } else if (svt_enc->qp > 0) {
196  param->qp = svt_enc->qp;
197  param->rate_control_mode = 0;
198  param->enable_adaptive_quantization = 0;
199  }
200 
201  desc = av_pix_fmt_desc_get(avctx->pix_fmt);
202  param->color_primaries = avctx->color_primaries;
203  param->matrix_coefficients = (desc->flags & AV_PIX_FMT_FLAG_RGB) ?
204  AVCOL_SPC_RGB : avctx->colorspace;
205  param->transfer_characteristics = avctx->color_trc;
206 
208  param->color_range = avctx->color_range == AVCOL_RANGE_JPEG;
209  else
210  param->color_range = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
211 
212 #if SVT_AV1_CHECK_VERSION(1, 0, 0)
214  const char *name =
216 
217  switch (avctx->chroma_sample_location) {
218  case AVCHROMA_LOC_LEFT:
219  param->chroma_sample_position = EB_CSP_VERTICAL;
220  break;
222  param->chroma_sample_position = EB_CSP_COLOCATED;
223  break;
224  default:
225  if (!name)
226  break;
227 
228  av_log(avctx, AV_LOG_WARNING,
229  "Specified chroma sample location %s is unsupported "
230  "on the AV1 bit stream level. Usage of a container that "
231  "allows passing this information - such as Matroska - "
232  "is recommended.\n",
233  name);
234  break;
235  }
236  }
237 #endif
238 
239  if (avctx->profile != AV_PROFILE_UNKNOWN)
240  param->profile = avctx->profile;
241 
242  if (avctx->level != AV_LEVEL_UNKNOWN)
243  param->level = avctx->level;
244 
245  // gop_size == 1 case is handled when encoding each frame by setting
246  // pic_type to EB_AV1_KEY_PICTURE. For gop_size > 1, set the
247  // intra_period_length. Even though setting intra_period_length to 0 should
248  // work in this case, it does not.
249  // See: https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2076
250  if (avctx->gop_size > 1)
251  param->intra_period_length = avctx->gop_size - 1;
252 
253  // In order for SVT-AV1 to force keyframes by setting pic_type to
254  // EB_AV1_KEY_PICTURE on any frame, force_key_frames has to be set. Note
255  // that this does not force all frames to be keyframes (it only forces a
256  // keyframe with pic_type is set to EB_AV1_KEY_PICTURE).
257  param->force_key_frames = 1;
258 
259  if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
260  param->frame_rate_numerator = avctx->framerate.num;
261  param->frame_rate_denominator = avctx->framerate.den;
262  } else {
263  param->frame_rate_numerator = avctx->time_base.den;
265  param->frame_rate_denominator = avctx->time_base.num
266 #if FF_API_TICKS_PER_FRAME
267  * avctx->ticks_per_frame
268 #endif
269  ;
271  }
272 
273  /* 2 = IDR, closed GOP, 1 = CRA, open GOP */
274  param->intra_refresh_type = avctx->flags & AV_CODEC_FLAG_CLOSED_GOP ? 2 : 1;
275 
276 #if SVT_AV1_CHECK_VERSION(0, 9, 1)
277  while ((en = av_dict_get(svt_enc->svtav1_opts, "", en, AV_DICT_IGNORE_SUFFIX))) {
278  EbErrorType ret = svt_av1_enc_parse_parameter(param, en->key, en->value);
279  if (ret != EB_ErrorNone) {
281  av_log(avctx, level, "Error parsing option %s: %s.\n", en->key, en->value);
282  if (avctx->err_recognition & AV_EF_EXPLODE)
283  return AVERROR(EINVAL);
284  }
285  }
286 #else
287  if ((en = av_dict_get(svt_enc->svtav1_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
289  av_log(avctx, level, "svt-params needs libavcodec to be compiled with SVT-AV1 "
290  "headers >= 0.9.1.\n");
291  if (avctx->err_recognition & AV_EF_EXPLODE)
292  return AVERROR(ENOSYS);
293  }
294 #endif
295 
296  param->source_width = avctx->width;
297  param->source_height = avctx->height;
298 
299  param->encoder_bit_depth = desc->comp[0].depth;
300 
301  if (desc->log2_chroma_w == 1 && desc->log2_chroma_h == 1)
302  param->encoder_color_format = EB_YUV420;
303  else if (desc->log2_chroma_w == 1 && desc->log2_chroma_h == 0)
304  param->encoder_color_format = EB_YUV422;
305  else if (!desc->log2_chroma_w && !desc->log2_chroma_h)
306  param->encoder_color_format = EB_YUV444;
307  else {
308  av_log(avctx, AV_LOG_ERROR , "Unsupported pixel format\n");
309  return AVERROR(EINVAL);
310  }
311 
312  if ((param->encoder_color_format == EB_YUV422 || param->encoder_bit_depth > 10)
313  && param->profile != AV_PROFILE_AV1_PROFESSIONAL ) {
314  av_log(avctx, AV_LOG_WARNING, "Forcing Professional profile\n");
315  param->profile = AV_PROFILE_AV1_PROFESSIONAL;
316  } else if (param->encoder_color_format == EB_YUV444 && param->profile != AV_PROFILE_AV1_HIGH) {
317  av_log(avctx, AV_LOG_WARNING, "Forcing High profile\n");
318  param->profile = AV_PROFILE_AV1_HIGH;
319  }
320 
321  avctx->bit_rate = param->rate_control_mode > 0 ?
322  param->target_bit_rate : 0;
323  avctx->rc_max_rate = param->max_bit_rate;
324  avctx->rc_buffer_size = param->maximum_buffer_size_ms *
325  FFMAX(avctx->bit_rate, avctx->rc_max_rate) / 1000LL;
326 
327  if (avctx->bit_rate || avctx->rc_max_rate || avctx->rc_buffer_size) {
328  AVCPBProperties *cpb_props = ff_encode_add_cpb_side_data(avctx);
329  if (!cpb_props)
330  return AVERROR(ENOMEM);
331 
332  cpb_props->buffer_size = avctx->rc_buffer_size;
333  cpb_props->max_bitrate = avctx->rc_max_rate;
334  cpb_props->avg_bitrate = avctx->bit_rate;
335  }
336 
337  return 0;
338 }
339 
340 static int read_in_data(EbSvtAv1EncConfiguration *param, const AVFrame *frame,
341  EbBufferHeaderType *header_ptr)
342 {
343  EbSvtIOFormat *in_data = (EbSvtIOFormat *)header_ptr->p_buffer;
344  ptrdiff_t linesizes[4];
345  size_t sizes[4];
346  int bytes_shift = param->encoder_bit_depth > 8 ? 1 : 0;
347  int ret, frame_size;
348 
349  for (int i = 0; i < 4; i++)
350  linesizes[i] = frame->linesize[i];
351 
352  ret = av_image_fill_plane_sizes(sizes, frame->format, frame->height,
353  linesizes);
354  if (ret < 0)
355  return ret;
356 
357  frame_size = 0;
358  for (int i = 0; i < 4; i++) {
359  if (sizes[i] > INT_MAX - frame_size)
360  return AVERROR(EINVAL);
361  frame_size += sizes[i];
362  }
363 
364  in_data->luma = frame->data[0];
365  in_data->cb = frame->data[1];
366  in_data->cr = frame->data[2];
367 
368  in_data->y_stride = AV_CEIL_RSHIFT(frame->linesize[0], bytes_shift);
369  in_data->cb_stride = AV_CEIL_RSHIFT(frame->linesize[1], bytes_shift);
370  in_data->cr_stride = AV_CEIL_RSHIFT(frame->linesize[2], bytes_shift);
371 
372  header_ptr->n_filled_len = frame_size;
373 
374  return 0;
375 }
376 
378 {
379  SvtContext *svt_enc = avctx->priv_data;
380  EbErrorType svt_ret;
381  int ret;
382 
383  svt_enc->eos_flag = EOS_NOT_REACHED;
384 
385  svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, svt_enc, &svt_enc->enc_params);
386  if (svt_ret != EB_ErrorNone) {
387  return svt_print_error(avctx, svt_ret, "Error initializing encoder handle");
388  }
389 
390  ret = config_enc_params(&svt_enc->enc_params, avctx);
391  if (ret < 0) {
392  av_log(avctx, AV_LOG_ERROR, "Error configuring encoder parameters\n");
393  return ret;
394  }
395 
396  svt_ret = svt_av1_enc_set_parameter(svt_enc->svt_handle, &svt_enc->enc_params);
397  if (svt_ret != EB_ErrorNone) {
398  return svt_print_error(avctx, svt_ret, "Error setting encoder parameters");
399  }
400 
401  svt_ret = svt_av1_enc_init(svt_enc->svt_handle);
402  if (svt_ret != EB_ErrorNone) {
403  return svt_print_error(avctx, svt_ret, "Error initializing encoder");
404  }
405 
406  if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
407  EbBufferHeaderType *headerPtr = NULL;
408 
409  svt_ret = svt_av1_enc_stream_header(svt_enc->svt_handle, &headerPtr);
410  if (svt_ret != EB_ErrorNone) {
411  return svt_print_error(avctx, svt_ret, "Error building stream header");
412  }
413 
414  avctx->extradata_size = headerPtr->n_filled_len;
416  if (!avctx->extradata) {
417  av_log(avctx, AV_LOG_ERROR,
418  "Cannot allocate AV1 header of size %d.\n", avctx->extradata_size);
419  return AVERROR(ENOMEM);
420  }
421 
422  memcpy(avctx->extradata, headerPtr->p_buffer, avctx->extradata_size);
423 
424  svt_ret = svt_av1_enc_stream_header_release(headerPtr);
425  if (svt_ret != EB_ErrorNone) {
426  return svt_print_error(avctx, svt_ret, "Error freeing stream header");
427  }
428  }
429 
430  svt_enc->frame = av_frame_alloc();
431  if (!svt_enc->frame)
432  return AVERROR(ENOMEM);
433 
434  return alloc_buffer(&svt_enc->enc_params, svt_enc);
435 }
436 
437 static int eb_send_frame(AVCodecContext *avctx, const AVFrame *frame)
438 {
439  SvtContext *svt_enc = avctx->priv_data;
440  EbBufferHeaderType *headerPtr = svt_enc->in_buf;
441  int ret;
442 
443  if (!frame) {
444  EbBufferHeaderType headerPtrLast;
445 
446  if (svt_enc->eos_flag == EOS_SENT)
447  return 0;
448 
449  memset(&headerPtrLast, 0, sizeof(headerPtrLast));
450  headerPtrLast.pic_type = EB_AV1_INVALID_PICTURE;
451  headerPtrLast.flags = EB_BUFFERFLAG_EOS;
452 
453  svt_av1_enc_send_picture(svt_enc->svt_handle, &headerPtrLast);
454  svt_enc->eos_flag = EOS_SENT;
455  return 0;
456  }
457 
458  ret = read_in_data(&svt_enc->enc_params, frame, headerPtr);
459  if (ret < 0)
460  return ret;
461 
462  headerPtr->flags = 0;
463  headerPtr->p_app_private = NULL;
464  headerPtr->pts = frame->pts;
465 
466  switch (frame->pict_type) {
467  case AV_PICTURE_TYPE_I:
468  headerPtr->pic_type = EB_AV1_KEY_PICTURE;
469  break;
470  default:
471  // Actually means auto, or default.
472  headerPtr->pic_type = EB_AV1_INVALID_PICTURE;
473  break;
474  }
475 
476  if (avctx->gop_size == 1)
477  headerPtr->pic_type = EB_AV1_KEY_PICTURE;
478 
479  svt_av1_enc_send_picture(svt_enc->svt_handle, headerPtr);
480 
481  return 0;
482 }
483 
484 static AVBufferRef *get_output_ref(AVCodecContext *avctx, SvtContext *svt_enc, int filled_len)
485 {
486  if (filled_len > svt_enc->max_tu_size) {
487  const int max_frames = 8;
488  int max_tu_size;
489 
490  if (filled_len > svt_enc->raw_size * max_frames) {
491  av_log(avctx, AV_LOG_ERROR, "TU size > %d raw frame size.\n", max_frames);
492  return NULL;
493  }
494 
495  max_tu_size = 1 << av_ceil_log2(filled_len);
496  av_buffer_pool_uninit(&svt_enc->pool);
497  svt_enc->pool = av_buffer_pool_init(max_tu_size + AV_INPUT_BUFFER_PADDING_SIZE, NULL);
498  if (!svt_enc->pool)
499  return NULL;
500 
501  svt_enc->max_tu_size = max_tu_size;
502  }
503  av_assert0(svt_enc->pool);
504 
505  return av_buffer_pool_get(svt_enc->pool);
506 }
507 
509 {
510  SvtContext *svt_enc = avctx->priv_data;
511  EbBufferHeaderType *headerPtr;
512  AVFrame *frame = svt_enc->frame;
513  EbErrorType svt_ret;
514  AVBufferRef *ref;
515  int ret = 0, pict_type;
516 
517  if (svt_enc->eos_flag == EOS_RECEIVED)
518  return AVERROR_EOF;
519 
520  ret = ff_encode_get_frame(avctx, frame);
521  if (ret < 0 && ret != AVERROR_EOF)
522  return ret;
523  if (ret == AVERROR_EOF)
524  frame = NULL;
525 
526  ret = eb_send_frame(avctx, frame);
527  if (ret < 0)
528  return ret;
529  av_frame_unref(svt_enc->frame);
530 
531  svt_ret = svt_av1_enc_get_packet(svt_enc->svt_handle, &headerPtr, svt_enc->eos_flag);
532  if (svt_ret == EB_NoErrorEmptyQueue)
533  return AVERROR(EAGAIN);
534 
535  ref = get_output_ref(avctx, svt_enc, headerPtr->n_filled_len);
536  if (!ref) {
537  av_log(avctx, AV_LOG_ERROR, "Failed to allocate output packet.\n");
538  svt_av1_enc_release_out_buffer(&headerPtr);
539  return AVERROR(ENOMEM);
540  }
541  pkt->buf = ref;
542  pkt->data = ref->data;
543 
544  memcpy(pkt->data, headerPtr->p_buffer, headerPtr->n_filled_len);
545  memset(pkt->data + headerPtr->n_filled_len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
546 
547  pkt->size = headerPtr->n_filled_len;
548  pkt->pts = headerPtr->pts;
549  pkt->dts = headerPtr->dts;
550 
551  switch (headerPtr->pic_type) {
552  case EB_AV1_KEY_PICTURE:
554  // fall-through
555  case EB_AV1_INTRA_ONLY_PICTURE:
556  pict_type = AV_PICTURE_TYPE_I;
557  break;
558  case EB_AV1_INVALID_PICTURE:
559  pict_type = AV_PICTURE_TYPE_NONE;
560  break;
561  default:
562  pict_type = AV_PICTURE_TYPE_P;
563  break;
564  }
565 
566  if (headerPtr->pic_type == EB_AV1_NON_REF_PICTURE)
568 
569  if (headerPtr->flags & EB_BUFFERFLAG_EOS)
570  svt_enc->eos_flag = EOS_RECEIVED;
571 
572  ff_side_data_set_encoder_stats(pkt, headerPtr->qp * FF_QP2LAMBDA, NULL, 0, pict_type);
573 
574  svt_av1_enc_release_out_buffer(&headerPtr);
575 
576  return 0;
577 }
578 
580 {
581  SvtContext *svt_enc = avctx->priv_data;
582 
583  if (svt_enc->svt_handle) {
584  svt_av1_enc_deinit(svt_enc->svt_handle);
585  svt_av1_enc_deinit_handle(svt_enc->svt_handle);
586  }
587  if (svt_enc->in_buf) {
588  av_free(svt_enc->in_buf->p_buffer);
589  av_freep(&svt_enc->in_buf);
590  }
591 
592  av_buffer_pool_uninit(&svt_enc->pool);
593  av_frame_free(&svt_enc->frame);
594 
595  return 0;
596 }
597 
598 #define OFFSET(x) offsetof(SvtContext, x)
599 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
600 static const AVOption options[] = {
601 #if FF_API_SVTAV1_OPTS
602  { "hielevel", "Hierarchical prediction levels setting (Deprecated, use svtav1-params)", OFFSET(hierarchical_level),
603  AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 4, VE | AV_OPT_FLAG_DEPRECATED , "hielevel"},
604  { "3level", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, INT_MIN, INT_MAX, VE, "hielevel" },
605  { "4level", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 4 }, INT_MIN, INT_MAX, VE, "hielevel" },
606 
607  { "la_depth", "Look ahead distance [0, 120] (Deprecated, use svtav1-params)", OFFSET(la_depth),
608  AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 120, VE | AV_OPT_FLAG_DEPRECATED },
609 
610  { "tier", "Set operating point tier (Deprecated, use svtav1-params)", OFFSET(tier),
611  AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE | AV_OPT_FLAG_DEPRECATED, "tier" },
612  { "main", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, VE, "tier" },
613  { "high", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, "tier" },
614 #endif
615  { "preset", "Encoding preset",
616  OFFSET(enc_mode), AV_OPT_TYPE_INT, { .i64 = -2 }, -2, MAX_ENC_PRESET, VE },
617 
619 
620 #define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
621  { .i64 = value }, 0, 0, VE, "avctx.level"
622  { LEVEL("2.0", 20) },
623  { LEVEL("2.1", 21) },
624  { LEVEL("2.2", 22) },
625  { LEVEL("2.3", 23) },
626  { LEVEL("3.0", 30) },
627  { LEVEL("3.1", 31) },
628  { LEVEL("3.2", 32) },
629  { LEVEL("3.3", 33) },
630  { LEVEL("4.0", 40) },
631  { LEVEL("4.1", 41) },
632  { LEVEL("4.2", 42) },
633  { LEVEL("4.3", 43) },
634  { LEVEL("5.0", 50) },
635  { LEVEL("5.1", 51) },
636  { LEVEL("5.2", 52) },
637  { LEVEL("5.3", 53) },
638  { LEVEL("6.0", 60) },
639  { LEVEL("6.1", 61) },
640  { LEVEL("6.2", 62) },
641  { LEVEL("6.3", 63) },
642  { LEVEL("7.0", 70) },
643  { LEVEL("7.1", 71) },
644  { LEVEL("7.2", 72) },
645  { LEVEL("7.3", 73) },
646 #undef LEVEL
647 
648  { "crf", "Constant Rate Factor value", OFFSET(crf),
649  AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE },
650  { "qp", "Initial Quantizer level value", OFFSET(qp),
651  AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 63, VE },
652 #if FF_API_SVTAV1_OPTS
653  { "sc_detection", "Scene change detection (Deprecated, use svtav1-params)", OFFSET(scd),
654  AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE | AV_OPT_FLAG_DEPRECATED },
655 
656  { "tile_columns", "Log2 of number of tile columns to use (Deprecated, use svtav1-params)", OFFSET(tile_columns), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 4, VE | AV_OPT_FLAG_DEPRECATED },
657  { "tile_rows", "Log2 of number of tile rows to use (Deprecated, use svtav1-params)", OFFSET(tile_rows), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 6, VE | AV_OPT_FLAG_DEPRECATED },
658 #endif
659 
660  { "svtav1-params", "Set the SVT-AV1 configuration using a :-separated list of key=value parameters", OFFSET(svtav1_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
661 
662  {NULL},
663 };
664 
665 static const AVClass class = {
666  .class_name = "libsvtav1",
667  .item_name = av_default_item_name,
668  .option = options,
670 };
671 
672 static const FFCodecDefault eb_enc_defaults[] = {
673  { "b", "0" },
674  { "flags", "+cgop" },
675  { "g", "-1" },
676  { "qmin", "1" },
677  { "qmax", "63" },
678  { NULL },
679 };
680 
682  .p.name = "libsvtav1",
683  CODEC_LONG_NAME("SVT-AV1(Scalable Video Technology for AV1) encoder"),
684  .priv_data_size = sizeof(SvtContext),
685  .p.type = AVMEDIA_TYPE_VIDEO,
686  .p.id = AV_CODEC_ID_AV1,
687  .init = eb_enc_init,
689  .close = eb_enc_close,
691  .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
693  .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
695  AV_PIX_FMT_NONE },
696  .p.priv_class = &class,
697  .defaults = eb_enc_defaults,
698  .p.wrapper_name = "libsvtav1",
699 };
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:73
av_buffer_pool_init
AVBufferPool * av_buffer_pool_init(size_t size, AVBufferRef *(*alloc)(size_t size))
Allocate and initialize a buffer pool.
Definition: buffer.c:280
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
level
uint8_t level
Definition: svq3.c:204
AV_EF_EXPLODE
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: defs.h:51
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:42
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:1025
eb_enc_defaults
static const FFCodecDefault eb_enc_defaults[]
Definition: libsvtav1.c:672
get_output_ref
static AVBufferRef * get_output_ref(AVCodecContext *avctx, SvtContext *svt_enc, int filled_len)
Definition: libsvtav1.c:484
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:88
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2936
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
ff_side_data_set_encoder_stats
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
Definition: avpacket.c:603
SvtContext
Definition: libsvtav1.c:47
AVCodecContext::err_recognition
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:1408
FF_AV1_PROFILE_OPTS
#define FF_AV1_PROFILE_OPTS
Definition: profiles.h:54
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:100
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
pixdesc.h
AVCodecContext::color_trc
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:1018
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:669
internal.h
AVPacket::data
uint8_t * data
Definition: packet.h:374
AVOption
AVOption.
Definition: opt.h:251
encode.h
SvtContext::frame
AVFrame * frame
Definition: libsvtav1.c:57
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:465
eb_receive_packet
static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: libsvtav1.c:508
AV_DICT_IGNORE_SUFFIX
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
Definition: dict.h:75
FF_CODEC_CAP_NOT_INIT_THREADSAFE
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
Definition: codec_internal.h:34
FFCodec
Definition: codec_internal.h:127
eb_enc_init
static av_cold int eb_enc_init(AVCodecContext *avctx)
Definition: libsvtav1.c:377
AVCOL_SPC_RGB
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition: pixfmt.h:596
AVDictionary
Definition: dict.c:34
eb_enc_close
static av_cold int eb_enc_close(AVCodecContext *avctx)
Definition: libsvtav1.c:579
AV_PKT_FLAG_DISPOSABLE
#define AV_PKT_FLAG_DISPOSABLE
Flag is used to indicate packets that contain frames that can be discarded by the decoder.
Definition: packet.h:448
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AV_PROFILE_AV1_PROFESSIONAL
#define AV_PROFILE_AV1_PROFESSIONAL
Definition: defs.h:169
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:73
AVCodecContext::qmax
int qmax
maximum quantizer
Definition: avcodec.h:1251
tf_sess_config.config
config
Definition: tf_sess_config.py:33
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:429
av_chroma_location_name
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition: pixdesc.c:3333
AV_CODEC_FLAG_GLOBAL_HEADER
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
Definition: avcodec.h:330
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:1797
FFCodecDefault
Definition: codec_internal.h:97
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
av_ceil_log2
#define av_ceil_log2
Definition: common.h:93
eb_err
EbErrorType eb_err
Definition: libsvtav1.c:81
eb_send_frame
static int eb_send_frame(AVCodecContext *avctx, const AVFrame *frame)
Definition: libsvtav1.c:437
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:517
AVRational::num
int num
Numerator.
Definition: rational.h:59
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:88
SvtContext::tile_rows
int tile_rows
Definition: libsvtav1.c:73
avassert.h
AVCodecContext::color_primaries
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:1011
EOS_RECEIVED
@ EOS_RECEIVED
Definition: libsvtav1.c:44
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
av_dict_get
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:62
av_buffer_pool_get
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available.
Definition: buffer.c:384
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:539
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:51
AVDictionaryEntry::key
char * key
Definition: dict.h:90
frame_size
int frame_size
Definition: mxfenc.c:2307
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
tile_rows
int tile_rows
Definition: h265_levels.c:217
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
SvtContext::enc_mode
int enc_mode
Definition: libsvtav1.c:75
SvtContext::hierarchical_level
int hierarchical_level
Definition: libsvtav1.c:66
tier
int tier
Definition: av1_levels.c:48
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
AVCodecContext::rc_max_rate
int64_t rc_max_rate
maximum bitrate
Definition: avcodec.h:1280
AVCPBProperties
This structure describes the bitrate properties of an encoded bitstream.
Definition: defs.h:261
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
if
if(ret)
Definition: filter_design.txt:179
AVCodecContext::rc_buffer_size
int rc_buffer_size
decoder bitstream buffer size
Definition: avcodec.h:1265
AVPacket::buf
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
Definition: packet.h:357
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
sizes
static const int sizes[][2]
Definition: img2dec.c:58
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:1035
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:283
AVCHROMA_LOC_LEFT
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
Definition: pixfmt.h:690
AV_LEVEL_UNKNOWN
#define AV_LEVEL_UNKNOWN
Definition: defs.h:196
av_image_fill_plane_sizes
int av_image_fill_plane_sizes(size_t sizes[4], enum AVPixelFormat pix_fmt, int height, const ptrdiff_t linesizes[4])
Fill plane sizes for an image with pixel format pix_fmt and height height.
Definition: imgutils.c:111
AVCHROMA_LOC_TOPLEFT
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
Definition: pixfmt.h:692
FF_CODEC_RECEIVE_PACKET_CB
#define FF_CODEC_RECEIVE_PACKET_CB(func)
Definition: codec_internal.h:321
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:487
AV_OPT_TYPE_DICT
@ AV_OPT_TYPE_DICT
Definition: opt.h:232
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:279
profiles.h
av_buffer_pool_uninit
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
Definition: buffer.c:322
SvtContext::pool
AVBufferPool * pool
Definition: libsvtav1.c:59
AVCodecContext::level
int level
level
Definition: avcodec.h:1734
ff_libsvtav1_encoder
const FFCodec ff_libsvtav1_encoder
Definition: libsvtav1.c:681
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:635
LEVEL
#define LEVEL(name, value)
svt_errors
static const struct @103 svt_errors[]
SvtContext::tile_columns
int tile_columns
Definition: libsvtav1.c:72
SvtContext::scd
int scd
Definition: libsvtav1.c:68
AVCodecContext::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avcodec.h:559
AVPacket::size
int size
Definition: packet.h:375
AVCodecContext::gop_size
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
Definition: avcodec.h:639
codec_internal.h
AV_PIX_FMT_FLAG_RGB
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:136
EOS_NOT_REACHED
@ EOS_NOT_REACHED
Definition: libsvtav1.c:42
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
SvtContext::crf
int crf
Definition: libsvtav1.c:76
config_enc_params
static int config_enc_params(EbSvtAv1EncConfiguration *param, AVCodecContext *avctx)
Definition: libsvtav1.c:149
SvtContext::svt_handle
EbComponentType * svt_handle
Definition: libsvtav1.c:51
SvtContext::svtav1_opts
AVDictionary * svtav1_opts
Definition: libsvtav1.c:64
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:689
AV_PICTURE_TYPE_NONE
@ AV_PICTURE_TYPE_NONE
Undefined.
Definition: avutil.h:278
alloc_buffer
static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc)
Definition: libsvtav1.c:125
frame.h
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:373
options
static const AVOption options[]
Definition: libsvtav1.c:600
VE
#define VE
Definition: libsvtav1.c:599
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
AV_PROFILE_AV1_HIGH
#define AV_PROFILE_AV1_HIGH
Definition: defs.h:168
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:380
svt_map_error
static int svt_map_error(EbErrorType eb_err, const char **desc)
Definition: libsvtav1.c:99
AVCPBProperties::avg_bitrate
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
Definition: defs.h:276
SvtContext::eos_flag
EOS_STATUS eos_flag
Definition: libsvtav1.c:61
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:244
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:367
eos_status
eos_status
Definition: libsvtav1.c:41
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:538
OFFSET
#define OFFSET(x)
Definition: libsvtav1.c:598
av_err
int av_err
Definition: libsvtav1.c:82
SvtContext::max_tu_size
int max_tu_size
Definition: libsvtav1.c:55
common.h
AVCPBProperties::max_bitrate
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition: defs.h:266
SvtContext::raw_size
int raw_size
Definition: libsvtav1.c:54
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:622
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:254
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AVCodecContext::chroma_sample_location
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
Definition: avcodec.h:1042
AVCodecContext::height
int height
Definition: avcodec.h:617
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:654
SvtContext::enc_params
EbSvtAv1EncConfiguration enc_params
Definition: libsvtav1.c:50
avcodec.h
AV_CODEC_FLAG_CLOSED_GOP
#define AV_CODEC_FLAG_CLOSED_GOP
Definition: avcodec.h:344
ret
ret
Definition: filter_design.txt:187
AVClass::class_name
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:71
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
AVCPBProperties::buffer_size
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition: defs.h:282
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
svt_print_error
static int svt_print_error(void *log_ctx, EbErrorType err, const char *error_string)
Definition: libsvtav1.c:114
AVCodecContext
main external API structure.
Definition: avcodec.h:437
SvtContext::la_depth
int la_depth
Definition: libsvtav1.c:67
AVCodecContext::qmin
int qmin
minimum quantizer
Definition: avcodec.h:1244
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1592
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:112
AVCodecContext::ticks_per_frame
attribute_deprecated int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
Definition: avcodec.h:575
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
SvtContext::in_buf
EbBufferHeaderType * in_buf
Definition: libsvtav1.c:53
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:72
desc
const char * desc
Definition: libsvtav1.c:83
AV_PICTURE_TYPE_P
@ AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:280
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
ff_encode_get_frame
int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
Called by encoders to get the next frame for encoding.
Definition: encode.c:208
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
packet_internal.h
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: codec_internal.h:73
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
SvtContext::tier
int tier
Definition: libsvtav1.c:70
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVDictionaryEntry
Definition: dict.h:89
AVPacket
This structure stores compressed data.
Definition: packet.h:351
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:464
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:617
EOS_SENT
@ EOS_SENT
Definition: libsvtav1.c:43
imgutils.h
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
SvtContext::qp
int qp
Definition: libsvtav1.c:77
ff_encode_add_cpb_side_data
AVCPBProperties * ff_encode_add_cpb_side_data(AVCodecContext *avctx)
Add a CPB properties side data to an encoding context.
Definition: encode.c:869
AVDictionaryEntry::value
char * value
Definition: dict.h:91
FF_QP2LAMBDA
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
Definition: avutil.h:227
read_in_data
static int read_in_data(EbSvtAv1EncConfiguration *param, const AVFrame *frame, EbBufferHeaderType *header_ptr)
Definition: libsvtav1.c:340
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
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