FFmpeg  4.0
Data Structures | Macros | Enumerations | Functions | Variables
vaapi_encode_h264.c File Reference
#include <string.h>
#include <va/va.h>
#include <va/va_enc_h264.h>
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "cbs.h"
#include "cbs_h264.h"
#include "h264.h"
#include "h264_sei.h"
#include "internal.h"
#include "vaapi_encode.h"

Go to the source code of this file.

Data Structures

struct  VAAPIEncodeH264Context
 
struct  VAAPIEncodeH264Options
 

Macros

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

Enumerations

enum  { SEI_TIMING = 0x01, SEI_IDENTIFIER = 0x02, SEI_RECOVERY_POINT = 0x04 }
 

Functions

static int vaapi_encode_h264_write_access_unit (AVCodecContext *avctx, char *data, size_t *data_len, CodedBitstreamFragment *au)
 
static int vaapi_encode_h264_add_nal (AVCodecContext *avctx, CodedBitstreamFragment *au, void *nal_unit)
 
static int vaapi_encode_h264_write_sequence_header (AVCodecContext *avctx, char *data, size_t *data_len)
 
static int vaapi_encode_h264_write_slice_header (AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
 
static int vaapi_encode_h264_write_extra_header (AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
 
static int vaapi_encode_h264_init_sequence_params (AVCodecContext *avctx)
 
static int vaapi_encode_h264_init_picture_params (AVCodecContext *avctx, VAAPIEncodePicture *pic)
 
static int vaapi_encode_h264_init_slice_params (AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
 
static av_cold int vaapi_encode_h264_configure (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h264_init (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h264_close (AVCodecContext *avctx)
 

Variables

static const uint8_t vaapi_encode_h264_sei_identifier_uuid [16]
 
static const VAAPIEncodeType vaapi_encode_type_h264
 
static const AVOption vaapi_encode_h264_options []
 
static const AVCodecDefault vaapi_encode_h264_defaults []
 
static const AVClass vaapi_encode_h264_class
 
AVCodec ff_h264_vaapi_encoder
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)
Value:

Definition at line 986 of file vaapi_encode_h264.c.

◆ FLAGS

Definition at line 988 of file vaapi_encode_h264.c.

◆ PROFILE

#define PROFILE (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, "profile"
const char * name
Definition: avisynth_c.h:775
#define NULL
Definition: coverity.c:32
#define FLAGS
double value
Definition: eval.c:98

◆ LEVEL

#define LEVEL (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, "level"
const char * name
Definition: avisynth_c.h:775
#define NULL
Definition: coverity.c:32
#define FLAGS
double value
Definition: eval.c:98

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SEI_TIMING 
SEI_IDENTIFIER 
SEI_RECOVERY_POINT 

Definition at line 37 of file vaapi_encode_h264.c.

Function Documentation

◆ vaapi_encode_h264_write_access_unit()

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

◆ vaapi_encode_h264_add_nal()

static int vaapi_encode_h264_add_nal ( AVCodecContext avctx,
CodedBitstreamFragment au,
void nal_unit 
)
static

◆ vaapi_encode_h264_write_sequence_header()

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

Definition at line 148 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_write_slice_header()

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

Definition at line 177 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_write_extra_header()

static int vaapi_encode_h264_write_extra_header ( AVCodecContext avctx,
VAAPIEncodePicture pic,
int  index,
int type,
char *  data,
size_t *  data_len 
)
static

Definition at line 204 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_init_sequence_params()

static int vaapi_encode_h264_init_sequence_params ( AVCodecContext avctx)
static

Definition at line 286 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_init_picture_params()

static int vaapi_encode_h264_init_picture_params ( AVCodecContext avctx,
VAAPIEncodePicture pic 
)
static

Definition at line 576 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_init_slice_params()

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

Definition at line 697 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_configure()

static av_cold int vaapi_encode_h264_configure ( AVCodecContext avctx)
static

Definition at line 778 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_init()

static av_cold int vaapi_encode_h264_init ( AVCodecContext avctx)
static

Definition at line 883 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_close()

static av_cold int vaapi_encode_h264_close ( AVCodecContext avctx)
static

Definition at line 973 of file vaapi_encode_h264.c.

Variable Documentation

◆ vaapi_encode_h264_sei_identifier_uuid

const uint8_t vaapi_encode_h264_sei_identifier_uuid[16]
static
Initial value:
= {
0x59, 0x94, 0x8b, 0x28, 0x11, 0xec, 0x45, 0xaf,
0x96, 0x75, 0x19, 0xd4, 0x1f, 0xea, 0xa9, 0x4d,
}

Definition at line 44 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_configure().

◆ vaapi_encode_type_h264

const VAAPIEncodeType vaapi_encode_type_h264
static
Initial value:
= {
.priv_data_size = sizeof(VAAPIEncodeH264Context),
.sequence_params_size = sizeof(VAEncSequenceParameterBufferH264),
.init_sequence_params = &vaapi_encode_h264_init_sequence_params,
.picture_params_size = sizeof(VAEncPictureParameterBufferH264),
.init_picture_params = &vaapi_encode_h264_init_picture_params,
.slice_params_size = sizeof(VAEncSliceParameterBufferH264),
.init_slice_params = &vaapi_encode_h264_init_slice_params,
.sequence_header_type = VAEncPackedHeaderSequence,
.write_sequence_header = &vaapi_encode_h264_write_sequence_header,
.slice_header_type = VAEncPackedHeaderH264_Slice,
.write_slice_header = &vaapi_encode_h264_write_slice_header,
.write_extra_header = &vaapi_encode_h264_write_extra_header,
}
static av_cold int vaapi_encode_h264_configure(AVCodecContext *avctx)
static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
static int vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
static int vaapi_encode_h264_write_sequence_header(AVCodecContext *avctx, char *data, size_t *data_len)
static int vaapi_encode_h264_write_slice_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)

Definition at line 860 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_options

const AVOption vaapi_encode_h264_options[]
static

Definition at line 989 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_defaults

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

Definition at line 1062 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_class

const AVClass vaapi_encode_h264_class
static
Initial value:
= {
.class_name = "h264_vaapi",
.item_name = av_default_item_name,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
static const AVOption vaapi_encode_h264_options[]

Definition at line 1074 of file vaapi_encode_h264.c.

◆ ff_h264_vaapi_encoder

AVCodec ff_h264_vaapi_encoder
Initial value:
= {
.name = "h264_vaapi",
.long_name = NULL_IF_CONFIG_SMALL("H.264/AVC (VAAPI)"),
.priv_data_size = (sizeof(VAAPIEncodeContext) +
.encode2 = &ff_vaapi_encode2,
.priv_class = &vaapi_encode_h264_class,
.pix_fmts = (const enum AVPixelFormat[]) {
},
.wrapper_name = "vaapi",
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: avcodec.h:1056
static const AVClass vaapi_encode_h264_class
#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 const AVCodecDefault vaapi_encode_h264_defaults[]
static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static const AVCodecDefault defaults[]
Definition: amfenc_h264.c:361
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:266
int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *input_image, int *got_packet)
Definition: vaapi_encode.c:853
static av_cold int vaapi_encode_h264_close(AVCodecContext *avctx)
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60

Definition at line 1081 of file vaapi_encode_h264.c.