FFmpeg
Loading...
Searching...
No Matches
libxavs2.c File Reference
#include "xavs2.h"
#include "codec_internal.h"
#include "encode.h"
#include "mpeg12.h"
#include "libavutil/avstring.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  XAVS2EContext
 

Macros

#define xavs2_opt_set2(name, format, ...)
 
#define OFFSET(x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static av_cold int xavs2_init (AVCodecContext *avctx)
 
static void xavs2_copy_frame_with_shift (xavs2_picture_t *pic, const AVFrame *frame, const int shift_in)
 
static void xavs2_copy_frame (xavs2_picture_t *pic, const AVFrame *frame)
 
static int xavs2_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static av_cold int xavs2_close (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass libxavs2
 
static const FFCodecDefault xavs2_defaults []
 
const FFCodec ff_libxavs2_encoder
 

Macro Definition Documentation

◆ xavs2_opt_set2

#define xavs2_opt_set2 ( name,
format,
... )
Value:
do{ \
char opt_str[16] = {0}; \
int err; \
av_strlcatf(opt_str, sizeof(opt_str), format, __VA_ARGS__); \
err = cae->api->opt_set2(cae->param, name, opt_str); \
if (err < 0) {\
av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s\n", name, opt_str);\
}\
} while(0);
static const char *const format[]
Definition af_aiir.c:444
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
const char * name
Definition qsvenc.c:142

Definition at line 32 of file libxavs2.c.

Referenced by xavs2_init().

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(XAVS2EContext, x)

Definition at line 261 of file libxavs2.c.

◆ VE

Definition at line 262 of file libxavs2.c.

Function Documentation

◆ xavs2_init()

static av_cold int xavs2_init ( AVCodecContext * avctx)
static

Definition at line 63 of file libxavs2.c.

◆ xavs2_copy_frame_with_shift()

static void xavs2_copy_frame_with_shift ( xavs2_picture_t * pic,
const AVFrame * frame,
const int shift_in )
static

Definition at line 128 of file libxavs2.c.

Referenced by xavs2_encode_frame().

◆ xavs2_copy_frame()

static void xavs2_copy_frame ( xavs2_picture_t * pic,
const AVFrame * frame )
static

Definition at line 150 of file libxavs2.c.

Referenced by xavs2_encode_frame().

◆ xavs2_encode_frame()

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

Definition at line 170 of file libxavs2.c.

◆ xavs2_close()

static av_cold int xavs2_close ( AVCodecContext * avctx)
static

Definition at line 247 of file libxavs2.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "lcu_row_threads" , "number of parallel threads for rows" , OFFSET(lcu_row_threads) , AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, VE },
{ "initial_qp" , "Quantization initial parameter" , OFFSET(initial_qp) , AV_OPT_TYPE_INT, {.i64 = 34 }, 1, 63, VE },
{ "qp" , "Quantization parameter" , OFFSET(qp) , AV_OPT_TYPE_INT, {.i64 = 34 }, 1, 63, VE },
{ "max_qp" , "max qp for rate control" , OFFSET(max_qp) , AV_OPT_TYPE_INT, {.i64 = 55 }, 0, 63, VE },
{ "min_qp" , "min qp for rate control" , OFFSET(min_qp) , AV_OPT_TYPE_INT, {.i64 = 20 }, 0, 63, VE },
{ "speed_level" , "Speed level, higher is better but slower", OFFSET(preset_level) , AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 9, VE },
{ "log_level" , "log level: -1: none, 0: error, 1: warning, 2: info, 3: debug", OFFSET(log_level) , AV_OPT_TYPE_INT, {.i64 = 0 }, -1, 3, VE },
{ "xavs2-params" , "set the xavs2 configuration using a :-separated list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
{ NULL },
}
#define VE
Definition amfenc_av1.c:30
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ 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

Definition at line 264 of file libxavs2.c.

◆ libxavs2

const AVClass libxavs2
static
Initial value:
= {
.class_name = "XAVS2EContext",
.item_name = av_default_item_name,
.option = options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 276 of file libxavs2.c.

◆ xavs2_defaults

const FFCodecDefault xavs2_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ "g", "48"},
{ "bf", "7" },
{ NULL },
}

Definition at line 283 of file libxavs2.c.

◆ ff_libxavs2_encoder

const FFCodec ff_libxavs2_encoder
Initial value:
= {
.p.name = "libxavs2",
CODEC_LONG_NAME("libxavs2 AVS2-P2/IEEE1857.4"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
.priv_data_size = sizeof(XAVS2EContext),
.close = xavs2_close,
.color_ranges = AVCOL_RANGE_MPEG,
.p.priv_class = &libxavs2,
.defaults = xavs2_defaults,
.p.wrapper_name = "libxavs2",
}
#define CODEC_PIXFMTS(...)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#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_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_AVS2
Definition codec_id.h:243
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold int xavs2_init(AVCodecContext *avctx)
Definition libxavs2.c:63
static const FFCodecDefault xavs2_defaults[]
Definition libxavs2.c:283
static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition libxavs2.c:170
static av_cold int xavs2_close(AVCodecContext *avctx)
Definition libxavs2.c:247
static const AVClass libxavs2
Definition libxavs2.c:276
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:766
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73

Definition at line 290 of file libxavs2.c.