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 "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 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_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 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_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_init_constant_bitrate (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h264_init_fixed_qp (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h264_init_internal (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_h264_init (AVCodecContext *avctx)
 

Variables

static 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

Definition at line 133 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_sps().

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

Definition at line 134 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_sps().

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

Definition at line 136 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_pps().

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

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

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

Definition at line 140 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_slice_header2().

#define OFFSET (   x)
Value:

Definition at line 950 of file vaapi_encode_h264.c.

Definition at line 952 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 33 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_sps ( PutBitContext pbc,
VAAPIEncodeContext ctx 
)
static

Definition at line 157 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 241 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 287 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_write_slice_header().

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

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

static int vaapi_encode_h264_init_sequence_params ( AVCodecContext avctx)
static

Definition at line 493 of file vaapi_encode_h264.c.

static int vaapi_encode_h264_init_picture_params ( AVCodecContext avctx,
VAAPIEncodePicture pic 
)
static

Definition at line 585 of file vaapi_encode_h264.c.

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

Definition at line 639 of file vaapi_encode_h264.c.

static av_cold int vaapi_encode_h264_init_constant_bitrate ( AVCodecContext avctx)
static

Definition at line 732 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_init_internal().

static av_cold int vaapi_encode_h264_init_fixed_qp ( AVCodecContext avctx)
static

Definition at line 788 of file vaapi_encode_h264.c.

Referenced by vaapi_encode_h264_init_internal().

static av_cold int vaapi_encode_h264_init_internal ( AVCodecContext avctx)
static

Definition at line 812 of file vaapi_encode_h264.c.

static av_cold int vaapi_encode_h264_init ( AVCodecContext avctx)
static

Definition at line 945 of file vaapi_encode_h264.c.

Variable Documentation

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,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
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 av_cold int vaapi_encode_h264_init_internal(AVCodecContext *avctx)
static int vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)

Definition at line 924 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 },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define FLAGS
#define OFFSET(x)

Definition at line 953 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.0" },
{ "i_qoffset", "0.0" },
{ "b_qfactor", "1.2" },
{ "b_qoffset", "0.0" },
{ NULL },
}
#define NULL
Definition: coverity.c:32

Definition at line 964 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:70
static const AVOption vaapi_encode_h264_options[]
av_default_item_name

Definition at line 977 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:981
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:788
#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 984 of file vaapi_encode_h264.c.