Data Structures | Macros | Enumerations | Functions | Variables
libsvtav1.c File Reference
#include <stdint.h>
#include <EbSvtAv1ErrorCodes.h>
#include <EbSvtAv1Enc.h>
#include "libavutil/common.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avassert.h"
#include "internal.h"
#include "encode.h"
#include "packet_internal.h"
#include "avcodec.h"
#include "profiles.h"

Go to the source code of this file.

Data Structures

struct  SvtContext


#define OFFSET(x)   offsetof(SvtContext, x)
#define LEVEL(name, value)




static int svt_map_error (EbErrorType eb_err, const char **desc)
static int svt_print_error (void *log_ctx, EbErrorType err, const char *error_string)
static int alloc_buffer (EbSvtAv1EncConfiguration *config, SvtContext *svt_enc)
static int config_enc_params (EbSvtAv1EncConfiguration *param, AVCodecContext *avctx)
static int read_in_data (EbSvtAv1EncConfiguration *param, const AVFrame *frame, EbBufferHeaderType *header_ptr)
static av_cold int eb_enc_init (AVCodecContext *avctx)
static int eb_send_frame (AVCodecContext *avctx, const AVFrame *frame)
static AVBufferRefget_output_ref (AVCodecContext *avctx, SvtContext *svt_enc, int filled_len)
static int eb_receive_packet (AVCodecContext *avctx, AVPacket *pkt)
static av_cold int eb_enc_close (AVCodecContext *avctx)


struct {
   EbErrorType   eb_err
   int   av_err
   const char *   desc
svt_errors []
static const AVOption options []
class {
      class_name = "libsvtav1"
      item_name = av_default_item_name
      option = options
static const AVCodecDefault eb_enc_defaults []
AVCodec ff_libsvtav1_encoder

Macro Definition Documentation

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

Definition at line 472 of file libsvtav1.c.

Definition at line 473 of file libsvtav1.c.

#define LEVEL (   name,
{ .i64 = value }, 0, 0, VE, "avctx.level"
#define NULL
Definition: coverity.c:32
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:108
#define VE
Definition: libsvtav1.c:473
const char * name
Definition: opengl_enc.c:102

Enumeration Type Documentation


Definition at line 40 of file libsvtav1.c.

Function Documentation

static int svt_map_error ( EbErrorType  eb_err,
const char **  desc 

Definition at line 95 of file libsvtav1.c.

Referenced by svt_print_error().

static int svt_print_error ( void log_ctx,
EbErrorType  err,
const char *  error_string 

Definition at line 110 of file libsvtav1.c.

Referenced by eb_enc_init().

static int alloc_buffer ( EbSvtAv1EncConfiguration *  config,
SvtContext svt_enc 

Definition at line 121 of file libsvtav1.c.

Referenced by eb_enc_init().

static int config_enc_params ( EbSvtAv1EncConfiguration *  param,
AVCodecContext avctx 

Definition at line 149 of file libsvtav1.c.

Referenced by eb_enc_init().

static int read_in_data ( EbSvtAv1EncConfiguration *  param,
const AVFrame frame,
EbBufferHeaderType *  header_ptr 

Definition at line 224 of file libsvtav1.c.

Referenced by eb_send_frame().

static av_cold int eb_enc_init ( AVCodecContext avctx)

Definition at line 261 of file libsvtav1.c.

static int eb_send_frame ( AVCodecContext avctx,
const AVFrame frame 

Definition at line 321 of file libsvtav1.c.

Referenced by eb_receive_packet().

static AVBufferRef* get_output_ref ( AVCodecContext avctx,
SvtContext svt_enc,
int  filled_len 

Definition at line 358 of file libsvtav1.c.

Referenced by eb_receive_packet().

static int eb_receive_packet ( AVCodecContext avctx,
AVPacket pkt 

Definition at line 382 of file libsvtav1.c.

static av_cold int eb_enc_close ( AVCodecContext avctx)

Definition at line 453 of file libsvtav1.c.

Variable Documentation

EbErrorType eb_err

Definition at line 77 of file libsvtav1.c.

int av_err

Definition at line 78 of file libsvtav1.c.

const char* desc

Definition at line 79 of file libsvtav1.c.

Referenced by activate(), aom_init(), asf_read_picture(), asf_write_header1(), av_bsf_init(), av_frame_apply_cropping(), av_image_alloc(), av_image_copy_to_buffer(), av_image_fill_black(), av_image_fill_linesizes(), av_image_fill_plane_sizes(), av_image_get_buffer_size(), av_image_get_linesize(), av_picture_crop(), av_picture_pad(), av_pix_fmt_count_planes(), av_pix_fmt_get_chroma_sub_sample(), av_pix_fmt_swap_endianness(), avcodec_align_dimensions(), avcodec_align_dimensions2(), avcodec_default_get_format(), avcodec_descriptor_get_by_name(), avcodec_get_chroma_sub_sample(), avcodec_get_type(), avcodec_profile_name(), bufref_wrap_interface(), cbs_default_free_unit_content(), cbs_find_unit_type_desc(), check_image_pointers(), choose_pixel_fmt(), config_enc_params(), config_input(), config_input0(), config_input1(), config_input_main(), config_input_ref(), config_inputx(), config_inputy(), config_out_props(), config_output(), config_props(), config_props_output(), copy_picture_field(), copy_uv_planes(), create_all_formats(), d3d11va_device_create(), d3d11va_get_buffer(), d3d11va_transfer_data(), decode(), decode_frame(), descriptor_compare(), deshake_opencl_init(), drm_map_frame(), encode_frame(), encode_init(), ff_all_formats(), ff_boxblur_eval_filter_params(), ff_cbs_alloc_unit_content2(), ff_cbs_make_unit_refcounted(), ff_cbs_make_unit_writable(), ff_cbs_sei_add_message(), ff_color_frame(), ff_draw_color(), ff_draw_horiz_band(), ff_draw_init(), ff_flac_parse_picture(), ff_formats_pixdesc_filter(), ff_frame_pool_get(), ff_frame_pool_video_init(), ff_get_format(), ff_guess_coded_bitrate(), ff_h264_draw_horiz_band(), ff_id3v2_write_apic(), ff_mediacodec_dec_init(), ff_scale_eval_dimensions(), ff_sws_alphablendaway(), ff_sws_init_output_funcs(), ff_vk_shader_rep_fmt(), ff_vmafmotion_init(), filter_frame(), find_codec_or_die(), flac_write_picture(), flush_encoders(), frame_end(), geq_config_props(), get_aspect_ratio(), get_bit_depth(), get_codecs_sorted(), get_deinterleaved_format(), get_format(), get_mimetype(), get_pix_fmt_depth(), get_plane_wh(), get_sockaddr(), get_video_buffer(), h264_metadata_update_sps(), h265_metadata_guess_level(), have_alpha_planar(), hScale16To15_c(), hScale16To19_c(), hwmap_config_output(), image_copy(), image_copy_16_to_8(), init(), init_filter(), init_image(), init_muxer(), init_video_param(), init_video_param_jpeg(), isPlanarYUV(), kmsgrab_free_desc(), kmsgrab_get_fb(), libopenjpeg_copy_to_packed16(), libopenjpeg_copyto16(), libopenjpeg_decode_frame(), libopenjpeg_ispacked(), libopenjpeg_matches_pix_fmt(), librav1e_encode_init(), librav1e_receive_packet(), list_formats(), lut2_config_output(), main(), map_pixel_format(), message(), mj2_create_image(), nlmeans_opencl_filter_frame(), opencl_frames_uninit(), opencl_get_buffer(), opencl_get_plane_format(), opencl_map_frame(), opencl_mem_flags_for_mapping(), opencl_pool_alloc(), opencl_pool_free(), opengl_draw(), opengl_fill_color_map(), opengl_init_context(), pad_opencl_init(), pix_fmt_match(), prepare_uv_scale(), print_codecs(), print_digraph(), process_command(), qsv_init_surface(), qsv_map_from(), query_formats(), raw_decode(), raw_encode_init(), raw_init_decoder(), read_gab2_sub(), read_packet_vs(), rgb48Toxyz12(), rkmpp_release_frame(), rkmpp_retrieve_frame(), rv10_write_header(), scale_eval_dimensions(), scale_frame(), set_pix_fmt(), show_codecs(), show_help_codec(), show_help_muxer(), svt_print_error(), swscale(), tiff_unpack_strip(), tonemap_slice(), transcode_init(), transfer_image_buf(), unsharp_opencl_make_filter_params(), unsupported_codec(), v4l2_buffer_swframe_to_buf(), v4l2_encode_init(), v4l2_read_header(), vaapi_encode_h265_init_sequence_params(), vaapi_encode_mjpeg_init_picture_params(), vaapi_encode_profile_entrypoint(), vaapi_frames_init(), vaapi_map_frame(), vaapi_map_to_memory(), vaapi_pix_fmt_from_fourcc(), vaapi_vpp_frame_is_rgb(), validate_avframe_allocation(), verify_md5(), video_frame_cksum(), video_get_buffer(), vpx_ts_param_parse(), vulkan_map_frame_to_mem(), vulkan_transfer_data_to(), wrap_texture_buf(), write_header(), write_packet(), xwd_encode_frame(), xyz12Torgb48(), yuv2gbrp16_full_X_c(), yuv2gbrp_full_X_c(), and yuv2gbrpf32_full_X_c().

const { ... } svt_errors[]
Initial value:
= {
{ EB_ErrorNone, 0, "success" },
{ EB_ErrorInsufficientResources, AVERROR(ENOMEM), "insufficient resources" },
{ EB_ErrorUndefined, AVERROR(EINVAL), "undefined error" },
{ EB_ErrorInvalidComponent, AVERROR(EINVAL), "invalid component" },
{ EB_ErrorBadParameter, AVERROR(EINVAL), "bad parameter" },
{ EB_ErrorDestroyThreadFailed, AVERROR_EXTERNAL, "failed to destroy thread" },
{ EB_ErrorSemaphoreUnresponsive, AVERROR_EXTERNAL, "semaphore unresponsive" },
{ EB_ErrorDestroySemaphoreFailed, AVERROR_EXTERNAL, "failed to destroy semaphore"},
{ EB_ErrorCreateMutexFailed, AVERROR_EXTERNAL, "failed to create mutex" },
{ EB_ErrorMutexUnresponsive, AVERROR_EXTERNAL, "mutex unresponsive" },
{ EB_ErrorDestroyMutexFailed, AVERROR_EXTERNAL, "failed to destroy mutex" },
{ EB_NoErrorEmptyQueue, AVERROR(EAGAIN), "empty queue" },
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
Generic error in an external library.
Definition: error.h:57

Referenced by svt_map_error().

const AVOption options[]

Definition at line 474 of file libsvtav1.c.

class_name = "libsvtav1"

Definition at line 540 of file libsvtav1.c.

item_name = av_default_item_name

Definition at line 541 of file libsvtav1.c.

option = options

Definition at line 542 of file libsvtav1.c.


Definition at line 543 of file libsvtav1.c.

const { ... }
const AVCodecDefault eb_enc_defaults[]
Initial value:
= {
{ "b", "7M" },
{ "g", "-1" },
{ "qmin", "0" },
{ "qmax", "63" },
{ NULL },
#define NULL
Definition: coverity.c:32

Definition at line 546 of file libsvtav1.c.

AVCodec ff_libsvtav1_encoder
Initial value:
= {
.name = "libsvtav1",
.long_name = NULL_IF_CONFIG_SMALL("SVT-AV1(Scalable Video Technology for AV1) encoder"),
.priv_data_size = sizeof(SvtContext),
.receive_packet = eb_receive_packet,
.close = eb_enc_close,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.priv_class = &class,
.defaults = eb_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.wrapper_name = "libsvtav1",
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:49
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: internal.h:80
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
GLint GLenum type
Definition: opengl_enc.c:104
Codec supports multithreading through a method other than slice- or frame-level multithreading.
Definition: codec.h:122
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:77
static av_cold int eb_enc_init(AVCodecContext *avctx)
Definition: libsvtav1.c:261
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:117
static const AVCodecDefault eb_enc_defaults[]
Definition: libsvtav1.c:546
static av_cold int eb_enc_close(AVCodecContext *avctx)
Definition: libsvtav1.c:453
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:399
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:303
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: libsvtav1.c:382
Pixel format.
Definition: pixfmt.h:64

Definition at line 554 of file libsvtav1.c.