FFmpeg
Data Structures | Macros | Functions | Variables
vaapi_encode_mpeg2.c File Reference
#include <va/va.h>
#include <va/va_enc_mpeg2.h>
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "cbs.h"
#include "cbs_mpeg2.h"
#include "mpeg12.h"
#include "vaapi_encode.h"

Go to the source code of this file.

Data Structures

struct  VAAPIEncodeMPEG2Context
 

Macros

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

Functions

static int vaapi_encode_mpeg2_write_fragment (AVCodecContext *avctx, char *data, size_t *data_len, CodedBitstreamFragment *frag)
 
static int vaapi_encode_mpeg2_add_header (AVCodecContext *avctx, CodedBitstreamFragment *frag, int type, void *header)
 
static int vaapi_encode_mpeg2_write_sequence_header (AVCodecContext *avctx, char *data, size_t *data_len)
 
static int vaapi_encode_mpeg2_write_picture_header (AVCodecContext *avctx, VAAPIEncodePicture *pic, char *data, size_t *data_len)
 
static int vaapi_encode_mpeg2_init_sequence_params (AVCodecContext *avctx)
 
static int vaapi_encode_mpeg2_init_picture_params (AVCodecContext *avctx, VAAPIEncodePicture *pic)
 
static int vaapi_encode_mpeg2_init_slice_params (AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
 
static av_cold int vaapi_encode_mpeg2_configure (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_mpeg2_init (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_mpeg2_close (AVCodecContext *avctx)
 

Variables

static const VAAPIEncodeProfile vaapi_encode_mpeg2_profiles []
 
static const VAAPIEncodeType vaapi_encode_type_mpeg2
 
static const AVOption vaapi_encode_mpeg2_options []
 
static const AVCodecDefault vaapi_encode_mpeg2_defaults []
 
static const AVClass vaapi_encode_mpeg2_class
 
AVCodec ff_mpeg2_vaapi_encoder
 

Macro Definition Documentation

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

Definition at line 642 of file vaapi_encode_mpeg2.c.

Definition at line 643 of file vaapi_encode_mpeg2.c.

#define PROFILE (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, "profile"
#define NULL
Definition: coverity.c:32
#define FLAGS
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:108
const char * name
Definition: opengl_enc.c:102
#define LEVEL (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, "level"
#define NULL
Definition: coverity.c:32
#define FLAGS
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:108
const char * name
Definition: opengl_enc.c:102

Function Documentation

static int vaapi_encode_mpeg2_write_fragment ( AVCodecContext avctx,
char *  data,
size_t *  data_len,
CodedBitstreamFragment frag 
)
static
static int vaapi_encode_mpeg2_add_header ( AVCodecContext avctx,
CodedBitstreamFragment frag,
int  type,
void header 
)
static
static int vaapi_encode_mpeg2_write_sequence_header ( AVCodecContext avctx,
char *  data,
size_t *  data_len 
)
static

Definition at line 109 of file vaapi_encode_mpeg2.c.

static int vaapi_encode_mpeg2_write_picture_header ( AVCodecContext avctx,
VAAPIEncodePicture pic,
char *  data,
size_t *  data_len 
)
static

Definition at line 142 of file vaapi_encode_mpeg2.c.

static int vaapi_encode_mpeg2_init_sequence_params ( AVCodecContext avctx)
static

Definition at line 166 of file vaapi_encode_mpeg2.c.

static int vaapi_encode_mpeg2_init_picture_params ( AVCodecContext avctx,
VAAPIEncodePicture pic 
)
static

Definition at line 419 of file vaapi_encode_mpeg2.c.

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

Definition at line 481 of file vaapi_encode_mpeg2.c.

static av_cold int vaapi_encode_mpeg2_configure ( AVCodecContext avctx)
static

Definition at line 514 of file vaapi_encode_mpeg2.c.

static av_cold int vaapi_encode_mpeg2_init ( AVCodecContext avctx)
static

Definition at line 591 of file vaapi_encode_mpeg2.c.

static av_cold int vaapi_encode_mpeg2_close ( AVCodecContext avctx)
static

Definition at line 632 of file vaapi_encode_mpeg2.c.

Variable Documentation

const VAAPIEncodeProfile vaapi_encode_mpeg2_profiles[]
static
Initial value:
= {
{ FF_PROFILE_MPEG2_MAIN, 8, 3, 1, 1, VAProfileMPEG2Main },
{ FF_PROFILE_MPEG2_SIMPLE, 8, 3, 1, 1, VAProfileMPEG2Simple },
}
#define FF_PROFILE_MPEG2_MAIN
Definition: avcodec.h:2023
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1991
#define FF_PROFILE_MPEG2_SIMPLE
Definition: avcodec.h:2024

Definition at line 560 of file vaapi_encode_mpeg2.c.

const VAAPIEncodeType vaapi_encode_type_mpeg2
static
Initial value:
= {
.flags = FLAG_B_PICTURES,
.default_quality = 10,
.sequence_params_size = sizeof(VAEncSequenceParameterBufferMPEG2),
.init_sequence_params = &vaapi_encode_mpeg2_init_sequence_params,
.picture_params_size = sizeof(VAEncPictureParameterBufferMPEG2),
.init_picture_params = &vaapi_encode_mpeg2_init_picture_params,
.slice_params_size = sizeof(VAEncSliceParameterBufferMPEG2),
.init_slice_params = &vaapi_encode_mpeg2_init_slice_params,
.sequence_header_type = VAEncPackedHeaderSequence,
.write_sequence_header = &vaapi_encode_mpeg2_write_sequence_header,
.picture_header_type = VAEncPackedHeaderPicture,
.write_picture_header = &vaapi_encode_mpeg2_write_picture_header,
}
static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx)
static const VAAPIEncodeProfile vaapi_encode_mpeg2_profiles[]
static int vaapi_encode_mpeg2_write_picture_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, char *data, size_t *data_len)
static int vaapi_encode_mpeg2_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx)
static int vaapi_encode_mpeg2_init_slice_params(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
static int vaapi_encode_mpeg2_write_sequence_header(AVCodecContext *avctx, char *data, size_t *data_len)

Definition at line 566 of file vaapi_encode_mpeg2.c.

Referenced by vaapi_encode_mpeg2_init().

const AVOption vaapi_encode_mpeg2_options[]
static
Initial value:
= {
{ "profile", "Set profile (in profile_and_level_indication)",
{ .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 7, FLAGS, "profile" },
#define PROFILE(name, value)
{ "level", "Set level (in profile_and_level_indication)",
{ .i64 = 4 }, 0, 15, FLAGS, "level" },
#define LEVEL(name, value)
{ LEVEL("low", 10) },
{ LEVEL("main", 8) },
{ LEVEL("high_1440", 6) },
{ LEVEL("high", 4) },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define FF_PROFILE_MPEG2_MAIN
Definition: avcodec.h:2023
#define FLAGS
#define PROFILE(name, value)
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1991
#define VAAPI_ENCODE_RC_OPTIONS
Definition: vaapi_encode.h:447
#define LEVEL(name, value)
mfxU16 profile
Definition: qsvenc.c:44
#define VAAPI_ENCODE_COMMON_OPTIONS
Definition: vaapi_encode.h:429
uint8_t level
Definition: svq3.c:209
#define OFFSET(x)
#define FF_PROFILE_MPEG2_SIMPLE
Definition: avcodec.h:2024

Definition at line 644 of file vaapi_encode_mpeg2.c.

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

Definition at line 673 of file vaapi_encode_mpeg2.c.

const AVClass vaapi_encode_mpeg2_class
static
Initial value:
= {
.class_name = "mpeg2_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:235
static const AVOption vaapi_encode_mpeg2_options[]

Definition at line 686 of file vaapi_encode_mpeg2.c.

AVCodec ff_mpeg2_vaapi_encoder
Initial value:
= {
.name = "mpeg2_vaapi",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 (VAAPI)"),
.priv_data_size = sizeof(VAAPIEncodeMPEG2Context),
.receive_packet = &ff_vaapi_encode_receive_packet,
.priv_class = &vaapi_encode_mpeg2_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = (const enum AVPixelFormat[]) {
},
.wrapper_name = "vaapi",
}
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:48
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:505
static av_cold int vaapi_encode_mpeg2_init(AVCodecContext *avctx)
#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:430
int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame)
static const AVClass vaapi_encode_mpeg2_class
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
const AVCodecHWConfigInternal * ff_vaapi_encode_hw_configs[]
Definition: vaapi_encode.c:30
static const AVCodecDefault vaapi_encode_mpeg2_defaults[]
static const AVCodecDefault defaults[]
Definition: amfenc_h264.c:361
static av_cold int vaapi_encode_mpeg2_close(AVCodecContext *avctx)
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
preferred ID for MPEG-1/2 video decoding
Definition: codec_id.h:49
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:275
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64

Definition at line 693 of file vaapi_encode_mpeg2.c.