20 #include <va/va_enc_vp9.h>
32 #define VP9_MAX_QUANT 255
56 VAEncSequenceParameterBufferVP9 *vseq =
ctx->codec_sequence_params;
57 VAEncPictureParameterBufferVP9 *vpic =
ctx->codec_picture_params;
59 vseq->max_frame_width = avctx->
width;
60 vseq->max_frame_height = avctx->
height;
64 if (!(
ctx->va_rc_mode & VA_RC_CQP)) {
65 vseq->bits_per_second =
ctx->va_bit_rate;
66 vseq->intra_period =
ctx->gop_size;
69 vpic->frame_width_src = avctx->
width;
70 vpic->frame_height_src = avctx->
height;
71 vpic->frame_width_dst = avctx->
width;
72 vpic->frame_height_dst = avctx->
height;
92 vpic->ref_flags.bits.force_kf = 1;
93 vpic->refresh_frame_flags = 0xff;
102 if (
ctx->max_b_depth > 0) {
104 vpic->refresh_frame_flags = 1 << hpic->
slot | 0xfc;
107 vpic->refresh_frame_flags = 0xff;
109 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 1;
110 vpic->ref_flags.bits.ref_last_idx = href->
slot;
111 vpic->ref_flags.bits.ref_last_sign_bias = 1;
120 href1->slot < pic->
b_depth + 1);
124 vpic->refresh_frame_flags = 0x00;
127 vpic->refresh_frame_flags = 0xfe << pic->
b_depth & 0xff;
130 vpic->ref_flags.bits.ref_frame_ctrl_l0 = 1;
131 vpic->ref_flags.bits.ref_frame_ctrl_l1 = 2;
132 vpic->ref_flags.bits.ref_last_idx = href0->
slot;
133 vpic->ref_flags.bits.ref_last_sign_bias = 1;
134 vpic->ref_flags.bits.ref_gf_idx = href1->slot;
135 vpic->ref_flags.bits.ref_gf_sign_bias = 0;
141 if (vpic->refresh_frame_flags == 0x00) {
150 vpic->reference_frames[
i] = VA_INVALID_SURFACE;
156 av_assert0(vpic->reference_frames[slot] == VA_INVALID_SURFACE);
166 vpic->luma_ac_qindex = priv->
q_idx_p;
168 vpic->luma_ac_qindex = priv->
q_idx_b;
169 vpic->luma_dc_qindex_delta = 0;
170 vpic->chroma_ac_qindex_delta = 0;
171 vpic->chroma_dc_qindex_delta = 0;
184 if (
ctx->rc_mode->quality) {
220 .default_quality = 100,
226 .sequence_params_size =
sizeof(VAEncSequenceParameterBufferVP9),
229 .picture_params_size =
sizeof(VAEncPictureParameterBufferVP9),
242 ctx->desired_packed_headers = 0;
251 #define OFFSET(x) offsetof(VAAPIEncodeVP9Context, x)
252 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
257 {
"loop_filter_level",
"Loop filter level",
259 {
"loop_filter_sharpness",
"Loop filter sharpness",
297 .wrapper_name =
"vaapi",