20 #include <va/va_enc_vp9.h>
32 #define VP9_MAX_QUANT 255
52 #define vseq_var(name) vseq->name, name
53 #define vseq_field(name) vseq->seq_fields.bits.name, name
54 #define vpic_var(name) vpic->name, name
55 #define vpic_field(name) vpic->pic_fields.bits.name, name
64 vseq->max_frame_width = avctx->
width;
65 vseq->max_frame_height = avctx->
height;
70 vseq->bits_per_second = avctx->
bit_rate;
71 vseq->intra_period = avctx->
gop_size;
74 vpic->frame_width_src = avctx->
width;
75 vpic->frame_height_src = avctx->
height;
76 vpic->frame_width_dst = avctx->
width;
77 vpic->frame_height_dst = avctx->
height;
97 vpic->ref_flags.bits.force_kf = 1;
98 vpic->refresh_frame_flags = 0x01;
105 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 2;
106 vpic->ref_flags.bits.ref_gf_idx = 1;
107 vpic->ref_flags.bits.ref_gf_sign_bias = 1;
108 vpic->refresh_frame_flags = 0x01;
110 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 1;
111 vpic->ref_flags.bits.ref_last_idx = 0;
112 vpic->ref_flags.bits.ref_last_sign_bias = 1;
113 vpic->refresh_frame_flags = 0x02;
116 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 1;
117 vpic->ref_flags.bits.ref_last_idx = 0;
118 vpic->ref_flags.bits.ref_last_sign_bias = 1;
119 vpic->refresh_frame_flags = 0x01;
125 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 1;
126 vpic->ref_flags.bits.ref_frame_ctrl_l1 = 2;
127 vpic->ref_flags.bits.ref_last_idx = 0;
128 vpic->ref_flags.bits.ref_last_sign_bias = 1;
129 vpic->ref_flags.bits.ref_gf_idx = 1;
130 vpic->ref_flags.bits.ref_gf_sign_bias = 0;
132 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 2;
133 vpic->ref_flags.bits.ref_frame_ctrl_l1 = 1;
134 vpic->ref_flags.bits.ref_last_idx = 0;
135 vpic->ref_flags.bits.ref_last_sign_bias = 0;
136 vpic->ref_flags.bits.ref_gf_idx = 1;
137 vpic->ref_flags.bits.ref_gf_sign_bias = 1;
139 vpic->refresh_frame_flags = 0x00;
146 vpic->reference_frames[i] = VA_INVALID_SURFACE;
165 vpic->luma_ac_qindex = priv->
q_idx_p;
167 vpic->luma_ac_qindex = priv->
q_idx_b;
168 vpic->luma_dc_qindex_delta = 0;
169 vpic->chroma_ac_qindex_delta = 0;
170 vpic->chroma_dc_qindex_delta = 0;
210 .sequence_params_size =
sizeof(VAEncSequenceParameterBufferVP9),
213 .picture_params_size =
sizeof(VAEncPictureParameterBufferVP9),
269 #define OFFSET(x) (offsetof(VAAPIEncodeContext, codec_options_data) + \
270 offsetof(VAAPIEncodeVP9Options, x))
271 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
273 {
"loop_filter_level",
"Loop filter level",
275 {
"loop_filter_sharpness",
"Loop filter sharpness",
285 {
"global_quality",
"100" },
306 .priv_class = &vaapi_encode_vp9_class,
308 .
defaults = vaapi_encode_vp9_defaults,
static av_cold int vaapi_encode_vp9_init(AVCodecContext *avctx)
VAEntrypoint va_entrypoint
int64_t bit_rate
the average bitrate
#define LIBAVUTIL_VERSION_INT
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
static av_cold int init(AVCodecContext *avctx)
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
static int vaapi_encode_vp9_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
void * codec_sequence_params
float i_quant_offset
qscale offset between P and I-frames
unsigned int va_packed_headers
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.
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
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const AVCodecDefault vaapi_encode_vp9_defaults[]
int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *input_image, int *got_packet)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int(* configure)(AVCodecContext *avctx)
int flags
AV_CODEC_FLAG_*.
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_...
void * codec_picture_params
common internal API header
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
int width
picture width / height.
#define FF_PROFILE_UNKNOWN
unsigned int va_rt_format
void * codec_picture_params
#define FF_ARRAY_ELEMS(a)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
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.
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.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
common internal api header.
common internal and external API header
static const AVOption vaapi_encode_vp9_options[]
static int vaapi_encode_vp9_init_sequence_params(AVCodecContext *avctx)
static const AVCodecDefault defaults[]
int loop_filter_sharpness
AVPixelFormat
Pixel format.
int64_t rc_max_rate
maximum bitrate