FFmpeg
Data Structures | Macros | Functions | Variables
libx265.c File Reference
#include <x265.h>
#include <float.h>
#include "libavutil/internal.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "internal.h"
#include "packet_internal.h"

Go to the source code of this file.

Data Structures

struct  libx265Context
 

Macros

#define OFFSET(x)   offsetof(libx265Context, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int is_keyframe (NalUnitType naltype)
 
static av_cold int libx265_encode_close (AVCodecContext *avctx)
 
static av_cold int libx265_param_parse_float (AVCodecContext *avctx, const char *key, float value)
 
static av_cold int libx265_param_parse_int (AVCodecContext *avctx, const char *key, int value)
 
static av_cold int libx265_encode_init (AVCodecContext *avctx)
 
static av_cold int libx265_encode_set_roi (libx265Context *ctx, const AVFrame *frame, x265_picture *pic)
 
static int libx265_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet)
 
static av_cold void libx265_encode_init_csp (AVCodec *codec)
 

Variables

static enum AVPixelFormat x265_csp_eight []
 
static enum AVPixelFormat x265_csp_ten []
 
static enum AVPixelFormat x265_csp_twelve []
 
static const AVOption options []
 
class {
      class_name = "libx265"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
static const AVCodecDefault x265_defaults []
 
AVCodec ff_libx265_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 655 of file libx265.c.

◆ VE

Definition at line 656 of file libx265.c.

Function Documentation

◆ is_keyframe()

static int is_keyframe ( NalUnitType  naltype)
static

Definition at line 60 of file libx265.c.

Referenced by ff_rdt_parse_packet(), and libx265_encode_frame().

◆ libx265_encode_close()

static av_cold int libx265_encode_close ( AVCodecContext avctx)
static

Definition at line 75 of file libx265.c.

Referenced by libx265_encode_init().

◆ libx265_param_parse_float()

static av_cold int libx265_param_parse_float ( AVCodecContext avctx,
const char *  key,
float  value 
)
static

Definition at line 87 of file libx265.c.

Referenced by libx265_encode_init().

◆ libx265_param_parse_int()

static av_cold int libx265_param_parse_int ( AVCodecContext avctx,
const char *  key,
int  value 
)
static

Definition at line 102 of file libx265.c.

Referenced by libx265_encode_init().

◆ libx265_encode_init()

static av_cold int libx265_encode_init ( AVCodecContext avctx)
static

Definition at line 117 of file libx265.c.

◆ libx265_encode_set_roi()

static av_cold int libx265_encode_set_roi ( libx265Context ctx,
const AVFrame frame,
x265_picture *  pic 
)
static

Definition at line 410 of file libx265.c.

Referenced by libx265_encode_frame().

◆ libx265_encode_frame()

static int libx265_encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame pic,
int got_packet 
)
static

Definition at line 474 of file libx265.c.

◆ libx265_encode_init_csp()

static av_cold void libx265_encode_init_csp ( AVCodec codec)
static

Definition at line 645 of file libx265.c.

Variable Documentation

◆ x265_csp_eight

enum AVPixelFormat x265_csp_eight[]
static

◆ x265_csp_ten

enum AVPixelFormat x265_csp_ten[]
static

◆ x265_csp_twelve

enum AVPixelFormat x265_csp_twelve[]
static

◆ options

const AVOption options[]
static
Initial value:
= {
{ "crf", "set the x265 crf", OFFSET(crf), AV_OPT_TYPE_FLOAT, { .dbl = -1 }, -1, FLT_MAX, VE },
{ "qp", "set the x265 qp", OFFSET(cqp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE },
{ "forced-idr", "if forcing keyframes, force them as IDR frames", OFFSET(forced_idr),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "preset", "set the x265 preset", OFFSET(preset), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "tune", "set the x265 tune parameter", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "profile", "set the x265 profile", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE },
{ NULL }
}

Definition at line 657 of file libx265.c.

◆ class_name

class_name = "libx265"
private

Definition at line 669 of file libx265.c.

◆ item_name

item_name = av_default_item_name
private

Definition at line 670 of file libx265.c.

◆ option

option = options
private

Definition at line 671 of file libx265.c.

◆ version

version = LIBAVUTIL_VERSION_INT
private

Definition at line 672 of file libx265.c.

◆ @93

const { ... }

◆ x265_defaults

const AVCodecDefault x265_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ "bf", "-1" },
{ "g", "-1" },
{ "keyint_min", "-1" },
{ "refs", "-1" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ "qdiff", "-1" },
{ "qblur", "-1" },
{ "qcomp", "-1" },
{ "i_qfactor", "-1" },
{ "b_qfactor", "-1" },
{ NULL },
}

Definition at line 675 of file libx265.c.

◆ ff_libx265_encoder

AVCodec ff_libx265_encoder
Initial value:
= {
.name = "libx265",
.long_name = NULL_IF_CONFIG_SMALL("libx265 H.265 / HEVC"),
.init_static_data = libx265_encode_init_csp,
.priv_data_size = sizeof(libx265Context),
.priv_class = &class,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.wrapper_name = "libx265",
}

Definition at line 691 of file libx265.c.

x265_defaults
static const AVCodecDefault x265_defaults[]
Definition: libx265.c:675
profile
mfxU16 profile
Definition: qsvenc.c:45
VE
#define VE
Definition: libx265.c:656
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:399
libx265_encode_frame
static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet)
Definition: libx265.c:474
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:415
defaults
static const AVCodecDefault defaults[]
Definition: amfenc_h264.c:361
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:402
preset
preset
Definition: vf_curves.c:46
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
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:122
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This codec takes the reordered_opaque field from input AVFrames and returns it in the corresponding f...
Definition: codec.h:171
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
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:380
NULL
#define NULL
Definition: coverity.c:32
libx265_encode_init_csp
static av_cold void libx265_encode_init_csp(AVCodec *codec)
Definition: libx265.c:645
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
libx265_encode_init
static av_cold int libx265_encode_init(AVCodecContext *avctx)
Definition: libx265.c:117
AV_OPT_TYPE_DICT
@ AV_OPT_TYPE_DICT
Definition: opt.h:232
OFFSET
#define OFFSET(x)
Definition: libx265.c:655
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:400
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: internal.h:80
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
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:404
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:406
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:416
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:223
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:403
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:77
libx265_encode_close
static av_cold int libx265_encode_close(AVCodecContext *avctx)
Definition: libx265.c:75
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:242
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:381
libx265Context
Definition: libx265.c:38