FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vaapi_encode_h265.c File Reference
#include <va/va.h>
#include <va/va_enc_hevc.h>
#include "libavutil/avassert.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"
#include "hevc.h"
#include "internal.h"
#include "put_bits.h"
#include "vaapi_encode.h"
#include "vaapi_encode_h26x.h"

Go to the source code of this file.

Data Structures

struct  VAAPIEncodeH265STRPS
 
struct  VAAPIEncodeH265MiscSequenceParams
 
struct  VAAPIEncodeH265MiscSliceParams
 
struct  VAAPIEncodeH265Slice
 
struct  VAAPIEncodeH265Context
 
struct  VAAPIEncodeH265Options
 

Macros

#define MAX_ST_REF_PIC_SETS   32
 
#define MAX_DPB_PICS   16
 
#define MAX_LAYERS   1
 
#define vseq_var(name)   vseq->name, name
 
#define vseq_field(name)   vseq->seq_fields.bits.name, name
 
#define vpic_var(name)   vpic->name, name
 
#define vpic_field(name)   vpic->pic_fields.bits.name, name
 
#define vslice_var(name)   vslice->name, name
 
#define vslice_field(name)   vslice->slice_fields.bits.name, name
 
#define mseq_var(name)   mseq->name, name
 
#define mslice_var(name)   mslice->name, name
 
#define mstrps_var(name)   mstrps->name, name
 
#define OFFSET(x)
 
#define FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
 

Functions

static void vaapi_encode_h265_write_nal_unit_header (PutBitContext *pbc, int nal_unit_type)
 
static void vaapi_encode_h265_write_rbsp_trailing_bits (PutBitContext *pbc)
 
static void vaapi_encode_h265_write_profile_tier_level (PutBitContext *pbc, VAAPIEncodeContext *ctx)
 
static void vaapi_encode_h265_write_vps (PutBitContext *pbc, VAAPIEncodeContext *ctx)
 
static void vaapi_encode_h265_write_st_ref_pic_set (PutBitContext *pbc, int st_rps_idx, VAAPIEncodeH265STRPS *mstrps)
 
static void vaapi_encode_h265_write_vui_parameters (PutBitContext *pbc, VAAPIEncodeContext *ctx)
 
static void vaapi_encode_h265_write_sps (PutBitContext *pbc, VAAPIEncodeContext *ctx)
 
static void vaapi_encode_h265_write_pps (PutBitContext *pbc, VAAPIEncodeContext *ctx)
 
static void vaapi_encode_h265_write_slice_header2 (PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
 
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_init_sequence_params (AVCodecContext *avctx)
 
static int vaapi_encode_h265_init_picture_params (AVCodecContext *avctx, VAAPIEncodePicture *pic)
 
static int vaapi_encode_h265_init_slice_params (AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
 
static av_cold int vaapi_encode_h265_init_constant_bitrate (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h265_init_fixed_qp (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h265_init_internal (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h265_init (AVCodecContext *avctx)
 

Variables

static VAAPIEncodeType vaapi_encode_type_h265
 
static const AVOption vaapi_encode_h265_options []
 
static const AVCodecDefault vaapi_encode_h265_defaults []
 
static const AVClass vaapi_encode_h265_class
 
AVCodec ff_hevc_vaapi_encoder
 

Macro Definition Documentation

#define MAX_ST_REF_PIC_SETS   32

Definition at line 35 of file vaapi_encode_h265.c.

#define MAX_DPB_PICS   16

Definition at line 36 of file vaapi_encode_h265.c.

#define MAX_LAYERS   1

Definition at line 37 of file vaapi_encode_h265.c.

#define vseq_var (   name)    vseq->name, name
#define vseq_field (   name)    vseq->seq_fields.bits.name, name

Definition at line 203 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_sps().

#define vpic_var (   name)    vpic->name, name

Definition at line 204 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_pps().

#define vpic_field (   name)    vpic->pic_fields.bits.name, name

Definition at line 205 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_pps().

#define vslice_var (   name)    vslice->name, name

Definition at line 206 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_slice_header2().

#define vslice_field (   name)    vslice->slice_fields.bits.name, name

Definition at line 207 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_slice_header2().

#define mseq_var (   name)    mseq->name, name
#define mslice_var (   name)    mslice->name, name

Definition at line 209 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_slice_header2().

#define mstrps_var (   name)    mstrps->name, name

Definition at line 210 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_st_ref_pic_set().

#define OFFSET (   x)
Value:

Definition at line 1329 of file vaapi_encode_h265.c.

Definition at line 1331 of file vaapi_encode_h265.c.

Function Documentation

static void vaapi_encode_h265_write_nal_unit_header ( PutBitContext pbc,
int  nal_unit_type 
)
static
static void vaapi_encode_h265_write_rbsp_trailing_bits ( PutBitContext pbc)
static
static void vaapi_encode_h265_write_profile_tier_level ( PutBitContext pbc,
VAAPIEncodeContext ctx 
)
static
static void vaapi_encode_h265_write_vps ( PutBitContext pbc,
VAAPIEncodeContext ctx 
)
static

Definition at line 271 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_sequence_header().

static void vaapi_encode_h265_write_st_ref_pic_set ( PutBitContext pbc,
int  st_rps_idx,
VAAPIEncodeH265STRPS mstrps 
)
static
static void vaapi_encode_h265_write_vui_parameters ( PutBitContext pbc,
VAAPIEncodeContext ctx 
)
static

Definition at line 352 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_sps().

static void vaapi_encode_h265_write_sps ( PutBitContext pbc,
VAAPIEncodeContext ctx 
)
static

Definition at line 390 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_sequence_header().

static void vaapi_encode_h265_write_pps ( PutBitContext pbc,
VAAPIEncodeContext ctx 
)
static

Definition at line 486 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_sequence_header().

static void vaapi_encode_h265_write_slice_header2 ( PutBitContext pbc,
VAAPIEncodeContext ctx,
VAAPIEncodePicture pic,
VAAPIEncodeSlice slice 
)
static

Definition at line 562 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_write_slice_header().

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

Definition at line 707 of file vaapi_encode_h265.c.

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

Definition at line 762 of file vaapi_encode_h265.c.

static int vaapi_encode_h265_init_sequence_params ( AVCodecContext avctx)
static

Definition at line 781 of file vaapi_encode_h265.c.

static int vaapi_encode_h265_init_picture_params ( AVCodecContext avctx,
VAAPIEncodePicture pic 
)
static

Definition at line 957 of file vaapi_encode_h265.c.

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

Definition at line 1031 of file vaapi_encode_h265.c.

static av_cold int vaapi_encode_h265_init_constant_bitrate ( AVCodecContext avctx)
static

Definition at line 1157 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_init_internal().

static av_cold int vaapi_encode_h265_init_fixed_qp ( AVCodecContext avctx)
static

Definition at line 1213 of file vaapi_encode_h265.c.

Referenced by vaapi_encode_h265_init_internal().

static av_cold int vaapi_encode_h265_init_internal ( AVCodecContext avctx)
static

Definition at line 1237 of file vaapi_encode_h265.c.

static av_cold int vaapi_encode_h265_init ( AVCodecContext avctx)
static

Definition at line 1324 of file vaapi_encode_h265.c.

Variable Documentation

VAAPIEncodeType vaapi_encode_type_h265
static
Initial value:
= {
.priv_data_size = sizeof(VAAPIEncodeH265Context),
.sequence_params_size = sizeof(VAEncSequenceParameterBufferHEVC),
.init_sequence_params = &vaapi_encode_h265_init_sequence_params,
.picture_params_size = sizeof(VAEncPictureParameterBufferHEVC),
.init_picture_params = &vaapi_encode_h265_init_picture_params,
.slice_params_size = sizeof(VAEncSliceParameterBufferHEVC),
.init_slice_params = &vaapi_encode_h265_init_slice_params,
.sequence_header_type = VAEncPackedHeaderSequence,
.write_sequence_header = &vaapi_encode_h265_write_sequence_header,
.slice_header_type = VAEncPackedHeaderHEVC_Slice,
.write_slice_header = &vaapi_encode_h265_write_slice_header,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
static av_cold int vaapi_encode_h265_init_internal(AVCodecContext *avctx)
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_sequence_header(AVCodecContext *avctx, char *data, size_t *data_len)

Definition at line 1303 of file vaapi_encode_h265.c.

const AVOption vaapi_encode_h265_options[]
static
Initial value:
= {
{ "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, 52, FLAGS },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define FLAGS
#define OFFSET(x)

Definition at line 1332 of file vaapi_encode_h265.c.

const AVCodecDefault vaapi_encode_h265_defaults[]
static
Initial value:
= {
{ "profile", "1" },
{ "level", "51" },
{ "b", "0" },
{ "bf", "2" },
{ "g", "120" },
{ "i_qfactor", "1" },
{ "i_qoffset", "0" },
{ "b_qfactor", "6/5" },
{ "b_qoffset", "0" },
{ NULL },
}
#define NULL
Definition: coverity.c:32

Definition at line 1338 of file vaapi_encode_h265.c.

const AVClass vaapi_encode_h265_class
static
Initial value:
= {
.class_name = "h265_vaapi",
.item_name = av_default_item_name,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_default_item_name
static const AVOption vaapi_encode_h265_options[]

Definition at line 1351 of file vaapi_encode_h265.c.

AVCodec ff_hevc_vaapi_encoder
Initial value:
= {
.name = "hevc_vaapi",
.long_name = NULL_IF_CONFIG_SMALL("H.265/HEVC (VAAPI)"),
.priv_data_size = (sizeof(VAAPIEncodeContext) +
.encode2 = &ff_vaapi_encode2,
.priv_class = &vaapi_encode_h265_class,
.capabilities = AV_CODEC_CAP_DELAY,
.pix_fmts = (const enum AVPixelFormat[]) {
},
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
static const AVClass vaapi_encode_h265_class
static const AVCodecDefault vaapi_encode_h265_defaults[]
#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: avcodec.h:984
static av_cold int vaapi_encode_h265_init(AVCodecContext *avctx)
int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *input_image, int *got_packet)
Definition: vaapi_encode.c:809
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:262
static const AVCodecDefault defaults[]
Definition: dcaenc.c:975
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60

Definition at line 1358 of file vaapi_encode_h265.c.