FFmpeg
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 "codec_internal.h"
#include "h264.h"
#include "h264_levels.h"
#include "h264_sei.h"
#include "vaapi_encode.h"
#include "version.h"

Go to the source code of this file.

Data Structures

struct  VAAPIEncodeH264Picture
 
struct  VAAPIEncodeH264Context
 

Macros

#define OFFSET(x)   offsetof(VAAPIEncodeH264Context, 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 void vaapi_encode_h264_default_ref_pic_list (AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodePicture **rpl0, VAAPIEncodePicture **rpl1, int *rpl_size)
 
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 VAAPIEncodeProfile vaapi_encode_h264_profiles []
 
static const VAAPIEncodeType vaapi_encode_type_h264
 
static const AVOption vaapi_encode_h264_options []
 
static const FFCodecDefault vaapi_encode_h264_defaults []
 
static const AVClass vaapi_encode_h264_class
 
const FFCodec ff_h264_vaapi_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 1233 of file vaapi_encode_h264.c.

◆ FLAGS

Definition at line 1234 of file vaapi_encode_h264.c.

◆ PROFILE

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

◆ LEVEL

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

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SEI_TIMING 
SEI_IDENTIFIER 
SEI_RECOVERY_POINT 

Definition at line 39 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 152 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 180 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 206 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 284 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 601 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_default_ref_pic_list()

static void vaapi_encode_h264_default_ref_pic_list ( AVCodecContext avctx,
VAAPIEncodePicture pic,
VAAPIEncodePicture **  rpl0,
VAAPIEncodePicture **  rpl1,
int rpl_size 
)
static

Definition at line 724 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_init_slice_params().

◆ vaapi_encode_h264_init_slice_params()

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

Definition at line 821 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_configure()

static av_cold int vaapi_encode_h264_configure ( AVCodecContext avctx)
static

Definition at line 1042 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_init()

static av_cold int vaapi_encode_h264_init ( AVCodecContext avctx)
static

Definition at line 1159 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_close()

static av_cold int vaapi_encode_h264_close ( AVCodecContext avctx)
static

Definition at line 1222 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 46 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_configure().

◆ vaapi_encode_h264_profiles

const VAAPIEncodeProfile vaapi_encode_h264_profiles[]
static
Initial value:
= {
{ FF_PROFILE_H264_HIGH, 8, 3, 1, 1, VAProfileH264High },
{ FF_PROFILE_H264_MAIN, 8, 3, 1, 1, VAProfileH264Main },
8, 3, 1, 1, VAProfileH264ConstrainedBaseline },
}

Definition at line 1119 of file vaapi_encode_h264.c.

◆ vaapi_encode_type_h264

const VAAPIEncodeType vaapi_encode_type_h264
static

Definition at line 1127 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_init().

◆ vaapi_encode_h264_options

const AVOption vaapi_encode_h264_options[]
static

Definition at line 1235 of file vaapi_encode_h264.c.

◆ vaapi_encode_h264_defaults

const FFCodecDefault 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", "-1" },
{ "qmax", "-1" },
{ NULL },
}

Definition at line 1308 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,
}

Definition at line 1321 of file vaapi_encode_h264.c.

◆ ff_h264_vaapi_encoder

const FFCodec ff_h264_vaapi_encoder
Initial value:
= {
.p.name = "h264_vaapi",
CODEC_LONG_NAME("H.264/AVC (VAAPI)"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(VAAPIEncodeH264Context),
.p.priv_class = &vaapi_encode_h264_class,
.p.pix_fmts = (const enum AVPixelFormat[]) {
},
.p.wrapper_name = "vaapi",
}

Definition at line 1328 of file vaapi_encode_h264.c.

FLAGS
#define FLAGS
Definition: vaapi_encode_h264.c:1234
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
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:42
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:162
FF_PROFILE_H264_CONSTRAINED_BASELINE
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
Definition: avcodec.h:1590
vaapi_encode_h264_class
static const AVClass vaapi_encode_h264_class
Definition: vaapi_encode_h264.c:1321
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:34
init
static int init
Definition: av_tx.c:47
VAAPIEncodeH264Context
Definition: vaapi_encode_h264.c:65
FF_PROFILE_H264_HIGH
#define FF_PROFILE_H264_HIGH
Definition: avcodec.h:1593
vaapi_encode_h264_init
static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx)
Definition: vaapi_encode_h264.c:1159
FF_PROFILE_UNKNOWN
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1551
vaapi_encode_h264_options
static const AVOption vaapi_encode_h264_options[]
Definition: vaapi_encode_h264.c:1235
ff_vaapi_encode_receive_packet
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: vaapi_encode.c:1185
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:264
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:294
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
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:119
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
vaapi_encode_h264_close
static av_cold int vaapi_encode_h264_close(AVCodecContext *avctx)
Definition: vaapi_encode_h264.c:1222
ff_vaapi_encode_hw_configs
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
Definition: vaapi_encode.c:34
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
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
FF_PROFILE_H264_MAIN
#define FF_PROFILE_H264_MAIN
Definition: avcodec.h:1591
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
vaapi_encode_h264_defaults
static const FFCodecDefault vaapi_encode_h264_defaults[]
Definition: vaapi_encode_h264.c:1308
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234