2 * This file is part of FFmpeg.
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <va/va_enc_mpeg2.h>
22 #include "libavutil/avassert.h"
26 #include "cbs_mpeg2.h"
28 #include "vaapi_encode.h"
30 typedef struct VAAPIEncodeMPEG2Context {
31 VAAPIEncodeContext common;
42 unsigned int bit_rate;
43 unsigned int vbv_buffer_size;
45 AVRational frame_rate;
47 unsigned int f_code_horizontal;
48 unsigned int f_code_vertical;
54 MPEG2RawSequenceHeader sequence_header;
55 MPEG2RawExtensionData sequence_extension;
56 MPEG2RawExtensionData sequence_display_extension;
57 MPEG2RawGroupOfPicturesHeader gop_header;
58 MPEG2RawPictureHeader picture_header;
59 MPEG2RawExtensionData picture_coding_extension;
61 CodedBitstreamContext *cbc;
62 CodedBitstreamFragment current_fragment;
63 } VAAPIEncodeMPEG2Context;
66 static int vaapi_encode_mpeg2_write_fragment(AVCodecContext *avctx,
67 char *data, size_t *data_len,
68 CodedBitstreamFragment *frag)
70 VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
73 err = ff_cbs_write_fragment_data(priv->cbc, frag);
75 av_log(avctx, AV_LOG_ERROR, "Failed to write packed header.\n");
79 if (*data_len < 8 * frag->data_size - frag->data_bit_padding) {
80 av_log(avctx, AV_LOG_ERROR, "Access unit too large: "
81 "%zu < %zu.\n", *data_len,
82 8 * frag->data_size - frag->data_bit_padding);
83 return AVERROR(ENOSPC);
86 memcpy(data, frag->data, frag->data_size);
87 *data_len = 8 * frag->data_size - frag->data_bit_padding;
92 static int vaapi_encode_mpeg2_add_header(AVCodecContext *avctx,
93 CodedBitstreamFragment *frag,
94 int type, void *header)
98 err = ff_cbs_insert_unit_content(frag, -1, type, header, NULL);
100 av_log(avctx, AV_LOG_ERROR, "Failed to add header: "
101 "type = %d.\n", type);
108 static int vaapi_encode_mpeg2_write_sequence_header(AVCodecContext *avctx,
109 char *data, size_t *data_len)
111 VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
112 CodedBitstreamFragment *frag = &priv->current_fragment;
115 err = vaapi_encode_mpeg2_add_header(avctx, frag, MPEG2_START_SEQUENCE_HEADER,
116 &priv->sequence_header);
120 err = vaapi_encode_mpeg2_add_header(avctx, frag, MPEG2_START_EXTENSION,
121 &priv->sequence_extension);
125 err = vaapi_encode_mpeg2_add_header(avctx, frag, MPEG2_START_EXTENSION,
126 &priv->sequence_display_extension);
130 err = vaapi_encode_mpeg2_add_header(avctx, frag, MPEG2_START_GROUP,
135 err = vaapi_encode_mpeg2_write_fragment(avctx, data, data_len, frag);
137 ff_cbs_fragment_reset(frag);
141 static int vaapi_encode_mpeg2_write_picture_header(AVCodecContext *avctx,
142 VAAPIEncodePicture *pic,
143 char *data, size_t *data_len)
145 VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
146 CodedBitstreamFragment *frag = &priv->current_fragment;
149 err = vaapi_encode_mpeg2_add_header(avctx, frag, MPEG2_START_PICTURE,
150 &priv->picture_header);
154 err = vaapi_encode_mpeg2_add_header(avctx, frag, MPEG2_START_EXTENSION,
155 &priv->picture_coding_extension);
159 err = vaapi_encode_mpeg2_write_fragment(avctx, data, data_len, frag);
161 ff_cbs_fragment_reset(frag);
165 static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx)
167 VAAPIEncodeContext *ctx = avctx->priv_data;
168 VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
169 MPEG2RawSequenceHeader *sh = &priv->sequence_header;
170 MPEG2RawSequenceExtension *se = &priv->sequence_extension.data.sequence;
171 MPEG2RawSequenceDisplayExtension *sde = &priv->sequence_display_extension.data.sequence_display;
172 MPEG2RawGroupOfPicturesHeader *goph = &priv->gop_header;
173 MPEG2RawPictureHeader *ph = &priv->picture_header;
174 MPEG2RawPictureCodingExtension *pce = &priv->picture_coding_extension.data.picture_coding;
175 VAEncSequenceParameterBufferMPEG2 *vseq = ctx->codec_sequence_params;
176 VAEncPictureParameterBufferMPEG2 *vpic = ctx->codec_picture_params;
177 int code, ext_n, ext_d;
179 memset(sh, 0, sizeof(*sh));
180 memset(se, 0, sizeof(*se));
181 memset(sde, 0, sizeof(*sde));
182 memset(goph, 0, sizeof(*goph));
183 memset(ph, 0, sizeof(*ph));
184 memset(pce, 0, sizeof(*pce));
187 if (ctx->va_bit_rate > 0) {
188 priv->bit_rate = (ctx->va_bit_rate + 399) / 400;
190 // Unknown (not a bitrate-targetting mode), so just use the
192 priv->bit_rate = 0x3fffffff;
194 if (avctx->rc_buffer_size > 0) {
195 priv->vbv_buffer_size = (avctx->rc_buffer_size + (1 << 14) - 1) >> 14;
197 // Unknown, so guess a value from the bitrate.
198 priv->vbv_buffer_size = priv->bit_rate >> 14;
201 switch (avctx->level) {
203 case 6: // High 1440.
204 priv->f_code_horizontal = 9;
205 priv->f_code_vertical = 5;
208 priv->f_code_horizontal = 8;
209 priv->f_code_vertical = 5;
213 priv->f_code_horizontal = 7;
214 priv->f_code_vertical = 4;
221 sh->sequence_header_code = MPEG2_START_SEQUENCE_HEADER;
223 sh->horizontal_size_value = avctx->width & 0xfff;
224 sh->vertical_size_value = avctx->height & 0xfff;
226 if (avctx->sample_aspect_ratio.num != 0 &&
227 avctx->sample_aspect_ratio.den != 0) {
228 AVRational dar = av_div_q(avctx->sample_aspect_ratio,
229 (AVRational) { avctx->width, avctx->height });
231 if (av_cmp_q(avctx->sample_aspect_ratio, (AVRational) { 1, 1 }) == 0) {
232 sh->aspect_ratio_information = 1;
233 } else if (av_cmp_q(dar, (AVRational) { 3, 4 }) == 0) {
234 sh->aspect_ratio_information = 2;
235 } else if (av_cmp_q(dar, (AVRational) { 9, 16 }) == 0) {
236 sh->aspect_ratio_information = 3;
237 } else if (av_cmp_q(dar, (AVRational) { 100, 221 }) == 0) {
238 sh->aspect_ratio_information = 4;
240 av_log(avctx, AV_LOG_WARNING, "Sample aspect ratio %d:%d is not "
241 "representable, signalling square pixels instead.\n",
242 avctx->sample_aspect_ratio.num,
243 avctx->sample_aspect_ratio.den);
244 sh->aspect_ratio_information = 1;
247 // Unknown - assume square pixels.
248 sh->aspect_ratio_information = 1;
251 if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
252 priv->frame_rate = avctx->framerate;
254 priv->frame_rate = av_inv_q(avctx->time_base);
255 ff_mpeg12_find_best_frame_rate(priv->frame_rate,
256 &code, &ext_n, &ext_d, 0);
257 sh->frame_rate_code = code;
259 sh->bit_rate_value = priv->bit_rate & 0x3ffff;
260 sh->vbv_buffer_size_value = priv->vbv_buffer_size & 0x3ff;
262 sh->constrained_parameters_flag = 0;
263 sh->load_intra_quantiser_matrix = 0;
264 sh->load_non_intra_quantiser_matrix = 0;
267 // Sequence extension
269 priv->sequence_extension.extension_start_code = MPEG2_START_EXTENSION;
270 priv->sequence_extension.extension_start_code_identifier =
271 MPEG2_EXTENSION_SEQUENCE;
273 se->profile_and_level_indication = avctx->profile << 4 | avctx->level;
274 se->progressive_sequence = 1;
275 se->chroma_format = 1;
277 se->horizontal_size_extension = avctx->width >> 12;
278 se->vertical_size_extension = avctx->height >> 12;
280 se->bit_rate_extension = priv->bit_rate >> 18;
281 se->vbv_buffer_size_extension = priv->vbv_buffer_size >> 10;
282 se->low_delay = ctx->b_per_p == 0;
284 se->frame_rate_extension_n = ext_n;
285 se->frame_rate_extension_d = ext_d;
288 // Sequence display extension
290 priv->sequence_display_extension.extension_start_code =
291 MPEG2_START_EXTENSION;
292 priv->sequence_display_extension.extension_start_code_identifier =
293 MPEG2_EXTENSION_SEQUENCE_DISPLAY;
295 sde->video_format = 5;
296 if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
297 avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
298 avctx->colorspace != AVCOL_SPC_UNSPECIFIED) {
299 sde->colour_description = 1;
300 sde->colour_primaries = avctx->color_primaries;
301 sde->transfer_characteristics = avctx->color_trc;
302 sde->matrix_coefficients = avctx->colorspace;
304 sde->colour_description = 0;
307 sde->display_horizontal_size = avctx->width;
308 sde->display_vertical_size = avctx->height;
313 goph->group_start_code = MPEG2_START_GROUP;
315 // Marker bit in the middle of time_code.
316 goph->time_code = 1 << 12;
317 goph->closed_gop = 1;
318 goph->broken_link = 0;
321 // Defaults for picture header
323 ph->picture_start_code = MPEG2_START_PICTURE;
325 ph->vbv_delay = 0xffff; // Not currently calculated.
327 ph->full_pel_forward_vector = 0;
328 ph->forward_f_code = 7;
329 ph->full_pel_backward_vector = 0;
330 ph->forward_f_code = 7;
333 // Defaults for picture coding extension
335 priv->picture_coding_extension.extension_start_code =
336 MPEG2_START_EXTENSION;
337 priv->picture_coding_extension.extension_start_code_identifier =
338 MPEG2_EXTENSION_PICTURE_CODING;
340 pce->intra_dc_precision = 0;
341 pce->picture_structure = 3;
342 pce->top_field_first = 0;
343 pce->frame_pred_frame_dct = 1;
344 pce->concealment_motion_vectors = 0;
345 pce->q_scale_type = 0;
346 pce->intra_vlc_format = 0;
347 pce->alternate_scan = 0;
348 pce->repeat_first_field = 0;
349 pce->progressive_frame = 1;
350 pce->composite_display_flag = 0;
354 *vseq = (VAEncSequenceParameterBufferMPEG2) {
355 .intra_period = ctx->gop_size,
356 .ip_period = ctx->b_per_p + 1,
358 .picture_width = avctx->width,
359 .picture_height = avctx->height,
361 .bits_per_second = ctx->va_bit_rate,
362 .frame_rate = av_q2d(priv->frame_rate),
363 .aspect_ratio_information = sh->aspect_ratio_information,
364 .vbv_buffer_size = priv->vbv_buffer_size,
366 .sequence_extension.bits = {
367 .profile_and_level_indication = se->profile_and_level_indication,
368 .progressive_sequence = se->progressive_sequence,
369 .chroma_format = se->chroma_format,
370 .low_delay = se->low_delay,
371 .frame_rate_extension_n = se->frame_rate_extension_n,
372 .frame_rate_extension_d = se->frame_rate_extension_d,
377 .time_code = goph->time_code,
378 .closed_gop = goph->closed_gop,
379 .broken_link = goph->broken_link,
383 *vpic = (VAEncPictureParameterBufferMPEG2) {
384 .forward_reference_picture = VA_INVALID_ID,
385 .backward_reference_picture = VA_INVALID_ID,
386 .reconstructed_picture = VA_INVALID_ID,
387 .coded_buf = VA_INVALID_ID,
390 .f_code = { { 15, 15 }, { 15, 15 } },
392 .picture_coding_extension.bits = {
393 .intra_dc_precision = pce->intra_dc_precision,
394 .picture_structure = pce->picture_structure,
395 .top_field_first = pce->top_field_first,
396 .frame_pred_frame_dct = pce->frame_pred_frame_dct,
397 .concealment_motion_vectors = pce->concealment_motion_vectors,
398 .q_scale_type = pce->q_scale_type,
399 .intra_vlc_format = pce->intra_vlc_format,
400 .alternate_scan = pce->alternate_scan,
401 .repeat_first_field = pce->repeat_first_field,
402 .progressive_frame = pce->progressive_frame,
403 .composite_display_flag = pce->composite_display_flag,
406 .composite_display.bits = {
407 .v_axis = pce->v_axis,
408 .field_sequence = pce->field_sequence,
409 .sub_carrier = pce->sub_carrier,
410 .burst_amplitude = pce->burst_amplitude,
411 .sub_carrier_phase = pce->sub_carrier_phase,
418 static int vaapi_encode_mpeg2_init_picture_params(AVCodecContext *avctx,
419 VAAPIEncodePicture *pic)
421 VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
422 MPEG2RawPictureHeader *ph = &priv->picture_header;
423 MPEG2RawPictureCodingExtension *pce = &priv->picture_coding_extension.data.picture_coding;
424 VAEncPictureParameterBufferMPEG2 *vpic = pic->codec_picture_params;
426 if (pic->type == PICTURE_TYPE_IDR || pic->type == PICTURE_TYPE_I) {
427 ph->temporal_reference = 0;
428 ph->picture_coding_type = 1;
429 priv->last_i_frame = pic->display_order;
431 ph->temporal_reference = pic->display_order - priv->last_i_frame;
432 ph->picture_coding_type = pic->type == PICTURE_TYPE_B ? 3 : 2;
435 if (pic->type == PICTURE_TYPE_P || pic->type == PICTURE_TYPE_B) {
436 pce->f_code[0][0] = priv->f_code_horizontal;
437 pce->f_code[0][1] = priv->f_code_vertical;
439 pce->f_code[0][0] = 15;
440 pce->f_code[0][1] = 15;
442 if (pic->type == PICTURE_TYPE_B) {
443 pce->f_code[1][0] = priv->f_code_horizontal;
444 pce->f_code[1][1] = priv->f_code_vertical;
446 pce->f_code[1][0] = 15;
447 pce->f_code[1][1] = 15;
450 vpic->reconstructed_picture = pic->recon_surface;
451 vpic->coded_buf = pic->output_buffer;
454 case PICTURE_TYPE_IDR:
456 vpic->picture_type = VAEncPictureTypeIntra;
459 vpic->picture_type = VAEncPictureTypePredictive;
460 vpic->forward_reference_picture = pic->refs[0]->recon_surface;
463 vpic->picture_type = VAEncPictureTypeBidirectional;
464 vpic->forward_reference_picture = pic->refs[0]->recon_surface;
465 vpic->backward_reference_picture = pic->refs[1]->recon_surface;
468 av_assert0(0 && "invalid picture type");
471 vpic->temporal_reference = ph->temporal_reference;
472 vpic->f_code[0][0] = pce->f_code[0][0];
473 vpic->f_code[0][1] = pce->f_code[0][1];
474 vpic->f_code[1][0] = pce->f_code[1][0];
475 vpic->f_code[1][1] = pce->f_code[1][1];
480 static int vaapi_encode_mpeg2_init_slice_params(AVCodecContext *avctx,
481 VAAPIEncodePicture *pic,
482 VAAPIEncodeSlice *slice)
484 VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
485 VAEncSliceParameterBufferMPEG2 *vslice = slice->codec_slice_params;
488 vslice->macroblock_address = slice->block_start;
489 vslice->num_macroblocks = slice->block_size;
492 case PICTURE_TYPE_IDR:
503 av_assert0(0 && "invalid picture type");
506 vslice->quantiser_scale_code = qp;
507 vslice->is_intra_slice = (pic->type == PICTURE_TYPE_IDR ||
508 pic->type == PICTURE_TYPE_I);
513 static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx)
515 VAAPIEncodeContext *ctx = avctx->priv_data;
516 VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
519 err = ff_cbs_init(&priv->cbc, AV_CODEC_ID_MPEG2VIDEO, avctx);
523 if (ctx->va_rc_mode == VA_RC_CQP) {
524 priv->quant_p = av_clip(ctx->rc_quality, 1, 31);
525 if (avctx->i_quant_factor > 0.0)
527 av_clip((avctx->i_quant_factor * priv->quant_p +
528 avctx->i_quant_offset) + 0.5, 1, 31);
530 priv->quant_i = priv->quant_p;
531 if (avctx->b_quant_factor > 0.0)
533 av_clip((avctx->b_quant_factor * priv->quant_p +
534 avctx->b_quant_offset) + 0.5, 1, 31);
536 priv->quant_b = priv->quant_p;
538 av_log(avctx, AV_LOG_DEBUG, "Using fixed quantiser "
539 "%d / %d / %d for I- / P- / B-frames.\n",
540 priv->quant_i, priv->quant_p, priv->quant_b);
548 ctx->slice_block_rows = FFALIGN(avctx->height, 16) / 16;
549 ctx->slice_block_cols = FFALIGN(avctx->width, 16) / 16;
551 ctx->nb_slices = ctx->slice_block_rows;
554 ctx->roi_quant_range = 31;
559 static const VAAPIEncodeProfile vaapi_encode_mpeg2_profiles[] = {
560 { FF_PROFILE_MPEG2_MAIN, 8, 3, 1, 1, VAProfileMPEG2Main },
561 { FF_PROFILE_MPEG2_SIMPLE, 8, 3, 1, 1, VAProfileMPEG2Simple },
562 { FF_PROFILE_UNKNOWN }
565 static const VAAPIEncodeType vaapi_encode_type_mpeg2 = {
566 .profiles = vaapi_encode_mpeg2_profiles,
568 .flags = FLAG_B_PICTURES,
570 .configure = &vaapi_encode_mpeg2_configure,
572 .default_quality = 10,
574 .sequence_params_size = sizeof(VAEncSequenceParameterBufferMPEG2),
575 .init_sequence_params = &vaapi_encode_mpeg2_init_sequence_params,
577 .picture_params_size = sizeof(VAEncPictureParameterBufferMPEG2),
578 .init_picture_params = &vaapi_encode_mpeg2_init_picture_params,
580 .slice_params_size = sizeof(VAEncSliceParameterBufferMPEG2),
581 .init_slice_params = &vaapi_encode_mpeg2_init_slice_params,
583 .sequence_header_type = VAEncPackedHeaderSequence,
584 .write_sequence_header = &vaapi_encode_mpeg2_write_sequence_header,
586 .picture_header_type = VAEncPackedHeaderPicture,
587 .write_picture_header = &vaapi_encode_mpeg2_write_picture_header,
590 static av_cold int vaapi_encode_mpeg2_init(AVCodecContext *avctx)
592 VAAPIEncodeContext *ctx = avctx->priv_data;
593 VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
595 ctx->codec = &vaapi_encode_type_mpeg2;
597 if (avctx->profile == FF_PROFILE_UNKNOWN)
598 avctx->profile = priv->profile;
599 if (avctx->level == FF_LEVEL_UNKNOWN)
600 avctx->level = priv->level;
602 // Reject unknown levels (these are required to set f_code for
603 // motion vector encoding).
604 switch (avctx->level) {
611 av_log(avctx, AV_LOG_ERROR, "Unknown MPEG-2 level %d.\n",
613 return AVERROR(EINVAL);
616 if (avctx->height % 4096 == 0 || avctx->width % 4096 == 0) {
617 av_log(avctx, AV_LOG_ERROR, "MPEG-2 does not support picture "
618 "height or width divisible by 4096.\n");
619 return AVERROR(EINVAL);
622 ctx->desired_packed_headers = VA_ENC_PACKED_HEADER_SEQUENCE |
623 VA_ENC_PACKED_HEADER_PICTURE;
625 ctx->surface_width = FFALIGN(avctx->width, 16);
626 ctx->surface_height = FFALIGN(avctx->height, 16);
628 return ff_vaapi_encode_init(avctx);
631 static av_cold int vaapi_encode_mpeg2_close(AVCodecContext *avctx)
633 VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
635 ff_cbs_fragment_free(&priv->current_fragment);
636 ff_cbs_close(&priv->cbc);
638 return ff_vaapi_encode_close(avctx);
641 #define OFFSET(x) offsetof(VAAPIEncodeMPEG2Context, x)
642 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
643 static const AVOption vaapi_encode_mpeg2_options[] = {
644 VAAPI_ENCODE_COMMON_OPTIONS,
645 VAAPI_ENCODE_RC_OPTIONS,
647 { "profile", "Set profile (in profile_and_level_indication)",
648 OFFSET(profile), AV_OPT_TYPE_INT,
649 { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 7, FLAGS, "profile" },
651 #define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
652 { .i64 = value }, 0, 0, FLAGS, "profile"
653 { PROFILE("simple", FF_PROFILE_MPEG2_SIMPLE) },
654 { PROFILE("main", FF_PROFILE_MPEG2_MAIN) },
657 { "level", "Set level (in profile_and_level_indication)",
658 OFFSET(level), AV_OPT_TYPE_INT,
659 { .i64 = 4 }, 0, 15, FLAGS, "level" },
661 #define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
662 { .i64 = value }, 0, 0, FLAGS, "level"
663 { LEVEL("low", 10) },
664 { LEVEL("main", 8) },
665 { LEVEL("high_1440", 6) },
666 { LEVEL("high", 4) },
672 static const AVCodecDefault vaapi_encode_mpeg2_defaults[] = {
676 { "i_qfactor", "1" },
677 { "i_qoffset", "0" },
678 { "b_qfactor", "6/5" },
679 { "b_qoffset", "0" },
685 static const AVClass vaapi_encode_mpeg2_class = {
686 .class_name = "mpeg2_vaapi",
687 .item_name = av_default_item_name,
688 .option = vaapi_encode_mpeg2_options,
689 .version = LIBAVUTIL_VERSION_INT,
692 AVCodec ff_mpeg2_vaapi_encoder = {
693 .name = "mpeg2_vaapi",
694 .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 (VAAPI)"),
695 .type = AVMEDIA_TYPE_VIDEO,
696 .id = AV_CODEC_ID_MPEG2VIDEO,
697 .priv_data_size = sizeof(VAAPIEncodeMPEG2Context),
698 .init = &vaapi_encode_mpeg2_init,
699 .receive_packet = &ff_vaapi_encode_receive_packet,
700 .close = &vaapi_encode_mpeg2_close,
701 .priv_class = &vaapi_encode_mpeg2_class,
702 .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE,
703 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
704 .defaults = vaapi_encode_mpeg2_defaults,
705 .pix_fmts = (const enum AVPixelFormat[]) {
709 .hw_configs = ff_vaapi_encode_hw_configs,
710 .wrapper_name = "vaapi",