20 #include <va/va_enc_vp9.h>
32 #define VP9_MAX_QUANT 255
56 #define vseq_var(name) vseq->name, name
57 #define vseq_field(name) vseq->seq_fields.bits.name, name
58 #define vpic_var(name) vpic->name, name
59 #define vpic_field(name) vpic->pic_fields.bits.name, name
68 vseq->max_frame_width = avctx->
width;
69 vseq->max_frame_height = avctx->
height;
78 vpic->frame_width_src = avctx->
width;
79 vpic->frame_height_src = avctx->
height;
80 vpic->frame_width_dst = avctx->
width;
81 vpic->frame_height_dst = avctx->
height;
100 vpic->ref_flags.bits.force_kf = 1;
101 vpic->refresh_frame_flags = 0x01;
108 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 2;
109 vpic->ref_flags.bits.ref_gf_idx = 1;
110 vpic->ref_flags.bits.ref_gf_sign_bias = 1;
111 vpic->refresh_frame_flags = 0x01;
113 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 1;
114 vpic->ref_flags.bits.ref_last_idx = 0;
115 vpic->ref_flags.bits.ref_last_sign_bias = 1;
116 vpic->refresh_frame_flags = 0x02;
119 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 1;
120 vpic->ref_flags.bits.ref_last_idx = 0;
121 vpic->ref_flags.bits.ref_last_sign_bias = 1;
122 vpic->refresh_frame_flags = 0x01;
128 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 1;
129 vpic->ref_flags.bits.ref_frame_ctrl_l1 = 2;
130 vpic->ref_flags.bits.ref_last_idx = 0;
131 vpic->ref_flags.bits.ref_last_sign_bias = 1;
132 vpic->ref_flags.bits.ref_gf_idx = 1;
133 vpic->ref_flags.bits.ref_gf_sign_bias = 0;
135 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 2;
136 vpic->ref_flags.bits.ref_frame_ctrl_l1 = 1;
137 vpic->ref_flags.bits.ref_last_idx = 0;
138 vpic->ref_flags.bits.ref_last_sign_bias = 0;
139 vpic->ref_flags.bits.ref_gf_idx = 1;
140 vpic->ref_flags.bits.ref_gf_sign_bias = 1;
142 vpic->refresh_frame_flags = 0x00;
149 vpic->reference_frames[i] = VA_INVALID_SURFACE;
168 vpic->luma_ac_qindex = priv->
q_idx_p;
170 vpic->luma_ac_qindex = priv->
q_idx_b;
171 vpic->luma_dc_qindex_delta = 0;
172 vpic->chroma_ac_qindex_delta = 0;
173 vpic->chroma_dc_qindex_delta = 0;
218 .sequence_params_size =
sizeof(VAEncSequenceParameterBufferVP9),
221 .picture_params_size =
sizeof(VAEncPictureParameterBufferVP9),
243 #define OFFSET(x) offsetof(VAAPIEncodeVP9Context, x)
244 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
247 {
"loop_filter_level",
"Loop filter level",
249 {
"loop_filter_sharpness",
"Loop filter sharpness",
258 {
"global_quality",
"100" },
280 .priv_class = &vaapi_encode_vp9_class,
282 .
defaults = vaapi_encode_vp9_defaults,
287 .wrapper_name =
"vaapi",
static av_cold int vaapi_encode_vp9_init(AVCodecContext *avctx)
#define LIBAVUTIL_VERSION_INT
static av_cold int init(AVCodecContext *avctx)
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
const char * av_default_item_name(void *ptr)
Return the context name.
void * codec_sequence_params
float i_quant_offset
qscale offset between P and I-frames
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
VAAPIEncodeContext common
float b_quant_factor
qscale factor between IP and B-frames If > 0 then the last P-frame quantizer will be used (q= lastp_q...
VASurfaceID recon_surface
static const VAAPIEncodeType vaapi_encode_type_vp9
int loop_filter_sharpness
static const AVCodecDefault vaapi_encode_vp9_defaults[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
float i_quant_factor
qscale factor between P- and I-frames If > 0 then the last P-frame quantizer will be used (q = lastp_...
static const AVCodecDefault defaults[]
void * codec_picture_params
common internal API header
int width
picture width / height.
#define FF_PROFILE_UNKNOWN
const VAAPIEncodeProfile * profiles
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
void * codec_picture_params
#define FF_ARRAY_ELEMS(a)
struct VAAPIEncodePicture * refs[MAX_PICTURE_REFERENCES]
const struct VAAPIEncodeType * codec
Libavcodec external API header.
main external API structure.
Describe the class of an AVClass context structure.
static const VAAPIEncodeProfile vaapi_encode_vp9_profiles[]
float b_quant_offset
qscale offset between IP and B-frames
static av_cold int vaapi_encode_vp9_configure(AVCodecContext *avctx)
AVCodec ff_vp9_vaapi_encoder
static const AVClass vaapi_encode_vp9_class
static enum AVPixelFormat pix_fmts[]
int global_quality
Global quality for codecs which cannot change it per frame.
#define VAAPI_ENCODE_COMMON_OPTIONS
common internal api header.
common internal and external API header
static const AVOption vaapi_encode_vp9_options[]
int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *input_image, int *got_packet)
static int vaapi_encode_vp9_init_sequence_params(AVCodecContext *avctx)
unsigned int desired_packed_headers
AVPixelFormat
Pixel format.
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)