FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vaapi_encode_h265.c File Reference
#include <string.h>
#include <va/va.h>
#include <va/va_enc_hevc.h>
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "libavutil/mastering_display_metadata.h"
#include "atsc_a53.h"
#include "avcodec.h"
#include "cbs.h"
#include "cbs_h265.h"
#include "hw_base_encode_h265.h"
#include "codec_internal.h"
#include "h2645data.h"
#include "h265_profile_level.h"
#include "vaapi_encode.h"
#include "hevc/hevc.h"

Go to the source code of this file.

Data Structures

struct  VAAPIEncodeH265Picture
 
struct  VAAPIEncodeH265Context
 

Macros

#define OFFSET(x)   offsetof(VAAPIEncodeH265Context, x)
 
#define FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
 
#define PROFILE(name, value)
 
#define LEVEL(name, value)
 

Enumerations

enum  { SEI_MASTERING_DISPLAY = 0x08, SEI_CONTENT_LIGHT_LEVEL = 0x10, SEI_A53_CC = 0x20 }
 

Functions

static int vaapi_encode_h265_write_access_unit (AVCodecContext *avctx, char *data, size_t *data_len, CodedBitstreamFragment *au)
 
static int vaapi_encode_h265_add_nal (AVCodecContext *avctx, CodedBitstreamFragment *au, void *nal_unit)
 
static int vaapi_encode_h265_write_sequence_header (AVCodecContext *avctx, char *data, size_t *data_len)
 
static int vaapi_encode_h265_write_slice_header (AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
 
static int vaapi_encode_h265_write_extra_header (AVCodecContext *avctx, FFHWBaseEncodePicture *base, int index, int *type, char *data, size_t *data_len)
 
static int vaapi_encode_h265_init_sequence_params (AVCodecContext *avctx)
 
static int vaapi_encode_h265_init_picture_params (AVCodecContext *avctx, FFHWBaseEncodePicture *pic)
 
static int vaapi_encode_h265_init_slice_params (AVCodecContext *avctx, FFHWBaseEncodePicture *pic, VAAPIEncodeSlice *slice)
 
static av_cold int vaapi_encode_h265_get_encoder_caps (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h265_configure (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h265_init (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h265_close (AVCodecContext *avctx)
 

Variables

static const VAAPIEncodeProfile vaapi_encode_h265_profiles []
 
static const VAAPIEncodeType vaapi_encode_type_h265
 
static const AVOption vaapi_encode_h265_options []
 
static const FFCodecDefault vaapi_encode_h265_defaults []
 
static const AVClass vaapi_encode_h265_class
 
const FFCodec ff_hevc_vaapi_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 1101 of file vaapi_encode_h265.c.

◆ FLAGS

Definition at line 1102 of file vaapi_encode_h265.c.

◆ PROFILE

#define PROFILE (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, .unit = "profile"

◆ LEVEL

#define LEVEL (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, .unit = "level"

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SEI_MASTERING_DISPLAY 
SEI_CONTENT_LIGHT_LEVEL 
SEI_A53_CC 

Definition at line 43 of file vaapi_encode_h265.c.

Function Documentation

◆ vaapi_encode_h265_write_access_unit()

static int vaapi_encode_h265_write_access_unit ( AVCodecContext avctx,
char *  data,
size_t *  data_len,
CodedBitstreamFragment au 
)
static

◆ vaapi_encode_h265_add_nal()

static int vaapi_encode_h265_add_nal ( AVCodecContext avctx,
CodedBitstreamFragment au,
void *  nal_unit 
)
static

◆ vaapi_encode_h265_write_sequence_header()

static int vaapi_encode_h265_write_sequence_header ( AVCodecContext avctx,
char *  data,
size_t *  data_len 
)
static

Definition at line 142 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_write_slice_header()

static int vaapi_encode_h265_write_slice_header ( AVCodecContext avctx,
VAAPIEncodePicture pic,
VAAPIEncodeSlice slice,
char *  data,
size_t *  data_len 
)
static

Definition at line 174 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_write_extra_header()

static int vaapi_encode_h265_write_extra_header ( AVCodecContext avctx,
FFHWBaseEncodePicture base,
int  index,
int *  type,
char *  data,
size_t *  data_len 
)
static

Definition at line 200 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_init_sequence_params()

static int vaapi_encode_h265_init_sequence_params ( AVCodecContext avctx)
static

Definition at line 259 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_init_picture_params()

static int vaapi_encode_h265_init_picture_params ( AVCodecContext avctx,
FFHWBaseEncodePicture pic 
)
static

Definition at line 459 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_init_slice_params()

static int vaapi_encode_h265_init_slice_params ( AVCodecContext avctx,
FFHWBaseEncodePicture pic,
VAAPIEncodeSlice slice 
)
static

Definition at line 675 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_get_encoder_caps()

static av_cold int vaapi_encode_h265_get_encoder_caps ( AVCodecContext avctx)
static

Definition at line 899 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_configure()

static av_cold int vaapi_encode_h265_configure ( AVCodecContext avctx)
static

Definition at line 964 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_init()

static av_cold int vaapi_encode_h265_init ( AVCodecContext avctx)
static

Definition at line 1061 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_close()

static av_cold int vaapi_encode_h265_close ( AVCodecContext avctx)
static

Definition at line 1090 of file vaapi_encode_h265.c.

Variable Documentation

◆ vaapi_encode_h265_profiles

const VAAPIEncodeProfile vaapi_encode_h265_profiles[]
static
Initial value:
= {
{ AV_PROFILE_HEVC_MAIN, 8, 3, 1, 1, VAProfileHEVCMain },
{ AV_PROFILE_HEVC_REXT, 8, 3, 1, 1, VAProfileHEVCMain },
}

Definition at line 1009 of file vaapi_encode_h265.c.

◆ vaapi_encode_type_h265

const VAAPIEncodeType vaapi_encode_type_h265
static

Definition at line 1028 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_init().

◆ vaapi_encode_h265_options

const AVOption vaapi_encode_h265_options[]
static

Definition at line 1103 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_defaults

const FFCodecDefault vaapi_encode_h265_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ "bf", "2" },
{ "g", "120" },
{ "i_qfactor", "1" },
{ "i_qoffset", "0" },
{ "b_qfactor", "6/5" },
{ "b_qoffset", "0" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ NULL },
}

Definition at line 1177 of file vaapi_encode_h265.c.

◆ vaapi_encode_h265_class

const AVClass vaapi_encode_h265_class
static
Initial value:
= {
.class_name = "h265_vaapi",
.item_name = av_default_item_name,
}

Definition at line 1190 of file vaapi_encode_h265.c.

◆ ff_hevc_vaapi_encoder

const FFCodec ff_hevc_vaapi_encoder
Initial value:

Definition at line 1197 of file vaapi_encode_h265.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
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
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:43
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:145
AV_PROFILE_HEVC_MAIN
#define AV_PROFILE_HEVC_MAIN
Definition: defs.h:159
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:717
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:35
vaapi_encode_h265_close
static av_cold int vaapi_encode_h265_close(AVCodecContext *avctx)
Definition: vaapi_encode_h265.c:1090
vaapi_encode_h265_class
static const AVClass vaapi_encode_h265_class
Definition: vaapi_encode_h265.c:1190
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
FLAGS
#define FLAGS
Definition: vaapi_encode_h265.c:1102
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
ff_vaapi_encode_receive_packet
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: vaapi_encode.c:2148
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
FF_CODEC_RECEIVE_PACKET_CB
#define FF_CODEC_RECEIVE_PACKET_CB(func)
Definition: codec_internal.h:326
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
vaapi_encode_h265_options
static const AVOption vaapi_encode_h265_options[]
Definition: vaapi_encode_h265.c:1103
AV_PROFILE_HEVC_REXT
#define AV_PROFILE_HEVC_REXT
Definition: defs.h:162
vaapi_encode_h265_init
static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx)
Definition: vaapi_encode_h265.c:1061
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
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
AV_PIX_FMT_VAAPI
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition: pixfmt.h:126
VAAPIEncodeH265Context
Definition: vaapi_encode_h265.c:59
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:228
value
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 value
Definition: writing_filters.txt:86
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:700
ff_vaapi_encode_hw_configs
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
Definition: vaapi_encode.c:36
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
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
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
vaapi_encode_h265_defaults
static const FFCodecDefault vaapi_encode_h265_defaults[]
Definition: vaapi_encode_h265.c:1177