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

Go to the source code of this file.

Data Structures

struct  VAAPIEncodeH264MiscSequenceParams
 
struct  VAAPIEncodeH264MiscSliceParams
 
struct  VAAPIEncodeH264Slice
 
struct  VAAPIEncodeH264Context
 
struct  VAAPIEncodeH264Options
 

Macros

#define vseq_var(name)   vseq->name, name
 
#define vseq_field(name)   vseq->seq_fields.bits.name, name
 
#define vvui_field(name)   vseq->vui_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 OFFSET(x)
 
#define FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
 

Enumerations

enum  {
  SLICE_TYPE_P = 0, SLICE_TYPE_B = 1, SLICE_TYPE_I = 2, SLICE_TYPE_SP = 3,
  SLICE_TYPE_SI = 4
}
 

Functions

static void vaapi_encode_h264_write_nal_header (PutBitContext *pbc, int nal_unit_type, int nal_ref_idc)
 
static void vaapi_encode_h264_write_trailing_rbsp (PutBitContext *pbc)
 
static void vaapi_encode_h264_write_vui (PutBitContext *pbc, VAAPIEncodeContext *ctx)
 
static void vaapi_encode_h264_write_sps (PutBitContext *pbc, VAAPIEncodeContext *ctx)
 
static void vaapi_encode_h264_write_pps (PutBitContext *pbc, VAAPIEncodeContext *ctx)
 
static void vaapi_encode_h264_write_slice_header2 (PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
 
static void vaapi_encode_h264_write_buffering_period (PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic)
 
static void vaapi_encode_h264_write_pic_timing (PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic)
 
static void vaapi_encode_h264_write_identifier (PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic)
 
static void vaapi_encode_h264_write_sei (PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic)
 
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)
 

Variables

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

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

Definition at line 169 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_sps().

#define vvui_field (   name)    vseq->vui_fields.bits.name, name

Definition at line 170 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_vui().

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

Definition at line 172 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_pps().

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

Definition at line 173 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_slice_header2().

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

Definition at line 174 of file vaapi_encode_h264.c.

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

Definition at line 176 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_slice_header2().

#define OFFSET (   x)
Value:

Definition at line 1254 of file vaapi_encode_h264.c.

Definition at line 1256 of file vaapi_encode_h264.c.

Enumeration Type Documentation

anonymous enum
Enumerator
SLICE_TYPE_P 
SLICE_TYPE_B 
SLICE_TYPE_I 
SLICE_TYPE_SP 
SLICE_TYPE_SI 

Definition at line 34 of file vaapi_encode_h264.c.

Function Documentation

static void vaapi_encode_h264_write_nal_header ( PutBitContext pbc,
int  nal_unit_type,
int  nal_ref_idc 
)
static
static void vaapi_encode_h264_write_trailing_rbsp ( PutBitContext pbc)
static
static void vaapi_encode_h264_write_vui ( PutBitContext pbc,
VAAPIEncodeContext ctx 
)
static

Definition at line 193 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_sps().

static void vaapi_encode_h264_write_sps ( PutBitContext pbc,
VAAPIEncodeContext ctx 
)
static

Definition at line 276 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_sequence_header().

static void vaapi_encode_h264_write_pps ( PutBitContext pbc,
VAAPIEncodeContext ctx 
)
static

Definition at line 362 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_sequence_header().

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

Definition at line 408 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_slice_header().

static void vaapi_encode_h264_write_buffering_period ( PutBitContext pbc,
VAAPIEncodeContext ctx,
VAAPIEncodePicture pic 
)
static

Definition at line 553 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_sei().

static void vaapi_encode_h264_write_pic_timing ( PutBitContext pbc,
VAAPIEncodeContext ctx,
VAAPIEncodePicture pic 
)
static

Definition at line 577 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_sei().

static void vaapi_encode_h264_write_identifier ( PutBitContext pbc,
VAAPIEncodeContext ctx,
VAAPIEncodePicture pic 
)
static

Definition at line 607 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_sei().

static void vaapi_encode_h264_write_sei ( PutBitContext pbc,
VAAPIEncodeContext ctx,
VAAPIEncodePicture pic 
)
static

Definition at line 631 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_extra_header().

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

Definition at line 686 of file vaapi_encode_h264.c.

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

Definition at line 728 of file vaapi_encode_h264.c.

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 747 of file vaapi_encode_h264.c.

static int vaapi_encode_h264_init_sequence_params ( AVCodecContext avctx)
static

Definition at line 773 of file vaapi_encode_h264.c.

static int vaapi_encode_h264_init_picture_params ( AVCodecContext avctx,
VAAPIEncodePicture pic 
)
static

Definition at line 948 of file vaapi_encode_h264.c.

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

Definition at line 1006 of file vaapi_encode_h264.c.

static av_cold int vaapi_encode_h264_configure ( AVCodecContext avctx)
static

Definition at line 1099 of file vaapi_encode_h264.c.

static av_cold int vaapi_encode_h264_init ( AVCodecContext avctx)
static

Definition at line 1169 of file vaapi_encode_h264.c.

Variable Documentation

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 1146 of file vaapi_encode_h264.c.

const AVOption vaapi_encode_h264_options[]
static
Initial value:
= {
{ "qp", "Constant QP (for P-frames; scaled by qfactor/qoffset for I/B)",
OFFSET(qp), AV_OPT_TYPE_INT, { .i64 = 20 }, 0, 52, FLAGS },
{ "quality", "Set encode quality (trades off against speed, higher is faster)",
OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8, FLAGS },
{ "low_power", "Use low-power encoding mode (experimental: only supported "
"on some platforms, does not support all features)",
OFFSET(low_power), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },
{ "coder", "Entropy coder type",
OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "coder" },
{ "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS, "coder" },
{ "cabac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, FLAGS, "coder" },
{ "vlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS, "coder" },
{ "ac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, FLAGS, "coder" },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define FLAGS
#define OFFSET(x)

Definition at line 1257 of file vaapi_encode_h264.c.

const AVCodecDefault vaapi_encode_h264_defaults[]
static
Initial value:
= {
{ "profile", "100" },
{ "level", "51" },
{ "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 1274 of file vaapi_encode_h264.c.

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:86
static const AVOption vaapi_encode_h264_options[]
av_default_item_name

Definition at line 1288 of file vaapi_encode_h264.c.

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,
.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_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:1027
static const AVCodecDefault vaapi_encode_h264_defaults[]
static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx)
int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *input_image, int *got_packet)
Definition: vaapi_encode.c:851
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:266
static const AVCodecDefault defaults[]
Definition: dcaenc.c:1275
AVPixelFormat
Pixel format.
Definition: pixfmt.h:60

Definition at line 1295 of file vaapi_encode_h264.c.