FFmpeg
Data Structures | Macros | Functions | Variables
libxavs.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdint.h>
#include <float.h>
#include <xavs.h>
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include "packet_internal.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  XavsContext
 

Macros

#define END_OF_STREAM   0x001
 
#define XAVS_PART_I8X8   0x002 /* Analyze i8x8 (requires 8x8 transform) */
 
#define XAVS_PART_P8X8   0x010 /* Analyze p16x8, p8x16 and p8x8 */
 
#define XAVS_PART_B8X8   0x100 /* Analyze b16x8, b*/
 
#define OFFSET(x)   offsetof(XavsContext, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static void XAVS_log (void *p, int level, const char *fmt, va_list args)
 
static int encode_nals (AVCodecContext *ctx, AVPacket *pkt, xavs_nal_t *nals, int nnal)
 
static int XAVS_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static av_cold int XAVS_close (AVCodecContext *avctx)
 
static av_cold int XAVS_init (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass xavs_class
 
static const FFCodecDefault xavs_defaults []
 
const FFCodec ff_libxavs_encoder
 

Macro Definition Documentation

◆ END_OF_STREAM

#define END_OF_STREAM   0x001

Definition at line 37 of file libxavs.c.

◆ XAVS_PART_I8X8

#define XAVS_PART_I8X8   0x002 /* Analyze i8x8 (requires 8x8 transform) */

Definition at line 39 of file libxavs.c.

◆ XAVS_PART_P8X8

#define XAVS_PART_P8X8   0x010 /* Analyze p16x8, p8x16 and p8x8 */

Definition at line 40 of file libxavs.c.

◆ XAVS_PART_B8X8

#define XAVS_PART_B8X8   0x100 /* Analyze b16x8, b*/

Definition at line 41 of file libxavs.c.

◆ OFFSET

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

Definition at line 382 of file libxavs.c.

◆ VE

Definition at line 383 of file libxavs.c.

Function Documentation

◆ XAVS_log()

static void XAVS_log ( void *  p,
int  level,
const char *  fmt,
va_list  args 
)
static

Definition at line 70 of file libxavs.c.

Referenced by XAVS_init().

◆ encode_nals()

static int encode_nals ( AVCodecContext ctx,
AVPacket pkt,
xavs_nal_t *  nals,
int  nnal 
)
static

Definition at line 85 of file libxavs.c.

Referenced by XAVS_frame().

◆ XAVS_frame()

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

Definition at line 124 of file libxavs.c.

◆ XAVS_close()

static av_cold int XAVS_close ( AVCodecContext avctx)
static

Definition at line 211 of file libxavs.c.

◆ XAVS_init()

static av_cold int XAVS_init ( AVCodecContext avctx)
static

Definition at line 224 of file libxavs.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE },
{ "qp", "Constant quantization parameter rate control method",OFFSET(cqp), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, VE },
{ "b-bias", "Influences how often B-frames are used", OFFSET(b_bias), AV_OPT_TYPE_INT, {.i64 = INT_MIN}, INT_MIN, INT_MAX, VE },
{ "cplxblur", "Reduce fluctuations in QP (before curve compression)", OFFSET(cplxblur), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE},
{ "direct-pred", "Direct MV prediction mode", OFFSET(direct_pred), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, VE, "direct-pred" },
{ "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_NONE }, 0, 0, VE, "direct-pred" },
{ "spatial", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" },
{ "temporal", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" },
{ "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" },
{ "aud", "Use access unit delimiters.", OFFSET(aud), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
{ "mbtree", "Use macroblock tree ratecontrol.", OFFSET(mbtree), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
{ "mixed-refs", "One reference per partition, as opposed to one reference per macroblock", OFFSET(mixed_refs), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE },
{ "fast-pskip", NULL, OFFSET(fast_pskip), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
{ "motion-est", "Set motion estimation method", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = XAVS_ME_DIA }, -1, XAVS_ME_TESA, VE, "motion-est"},
{ "dia", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_DIA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "hex", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_HEX }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "umh", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_UMH }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "esa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_ESA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "tesa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_ME_TESA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, VE},
{ "chromaoffset", "QP difference between chroma and luma", OFFSET(chroma_offset), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE},
{ "sc_threshold", "Scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, VE},
{ "noise_reduction", "Noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, VE},
{ NULL },
}

Definition at line 384 of file libxavs.c.

◆ xavs_class

const AVClass xavs_class
static
Initial value:
= {
.class_name = "libxavs",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 412 of file libxavs.c.

◆ xavs_defaults

const FFCodecDefault xavs_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ NULL },
}

Definition at line 419 of file libxavs.c.

◆ ff_libxavs_encoder

const FFCodec ff_libxavs_encoder
Initial value:
= {
.p.name = "libxavs",
.p.long_name = NULL_IF_CONFIG_SMALL("libxavs Chinese AVS (Audio Video Standard)"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
.priv_data_size = sizeof(XavsContext),
.close = XAVS_close,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.p.priv_class = &xavs_class,
.defaults = xavs_defaults,
.p.wrapper_name = "libxavs",
}

Definition at line 424 of file libxavs.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
options
static const AVOption options[]
Definition: libxavs.c:384
XavsContext
Definition: libxavs.c:43
VE
#define VE
Definition: libxavs.c:383
OFFSET
#define OFFSET(x)
Definition: libxavs.c:382
init
static int init
Definition: av_tx.c:47
XAVS_init
static av_cold int XAVS_init(AVCodecContext *avctx)
Definition: libxavs.c:224
XAVS_close
static av_cold int XAVS_close(AVCodecContext *avctx)
Definition: libxavs.c:211
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:263
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:127
xavs_defaults
static const FFCodecDefault xavs_defaults[]
Definition: libxavs.c:419
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
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
aud
static int FUNC() aud(CodedBitstreamContext *ctx, RWContext *rw, H264RawAUD *current)
Definition: cbs_h264_syntax_template.c:842
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
XAVS_frame
static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: libxavs.c:124
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:117
xavs_class
static const AVClass xavs_class
Definition: libxavs.c:412
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
AV_CODEC_ID_CAVS
@ AV_CODEC_ID_CAVS
Definition: codec_id.h:137
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
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:82
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:70
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234