26 #define VPX_DISABLE_CTRL_TYPECHECKS 1
27 #define VPX_CODEC_DISABLE_COMPAT 1
28 #include <vpx/vpx_encoder.h>
29 #include <vpx/vp8cx.h>
93 #define VP8F_ERROR_RESILIENT 0x00000001
94 #define VP8F_AUTO_ALT_REF 0x00000002
137 #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT)
138 vpx_svc_ref_frame_config_t ref_frame_config;
144 [VP8E_SET_CPUUSED] =
"VP8E_SET_CPUUSED",
145 [VP8E_SET_ENABLEAUTOALTREF] =
"VP8E_SET_ENABLEAUTOALTREF",
146 [VP8E_SET_NOISE_SENSITIVITY] =
"VP8E_SET_NOISE_SENSITIVITY",
147 [VP8E_SET_STATIC_THRESHOLD] =
"VP8E_SET_STATIC_THRESHOLD",
148 [VP8E_SET_TOKEN_PARTITIONS] =
"VP8E_SET_TOKEN_PARTITIONS",
149 [VP8E_SET_ARNR_MAXFRAMES] =
"VP8E_SET_ARNR_MAXFRAMES",
150 [VP8E_SET_ARNR_STRENGTH] =
"VP8E_SET_ARNR_STRENGTH",
151 [VP8E_SET_ARNR_TYPE] =
"VP8E_SET_ARNR_TYPE",
152 [VP8E_SET_TUNING] =
"VP8E_SET_TUNING",
153 [VP8E_SET_CQ_LEVEL] =
"VP8E_SET_CQ_LEVEL",
154 [VP8E_SET_MAX_INTRA_BITRATE_PCT] =
"VP8E_SET_MAX_INTRA_BITRATE_PCT",
155 [VP8E_SET_SHARPNESS] =
"VP8E_SET_SHARPNESS",
156 [VP8E_SET_TEMPORAL_LAYER_ID] =
"VP8E_SET_TEMPORAL_LAYER_ID",
157 #if CONFIG_LIBVPX_VP9_ENCODER
158 [VP9E_SET_LOSSLESS] =
"VP9E_SET_LOSSLESS",
159 [VP9E_SET_TILE_COLUMNS] =
"VP9E_SET_TILE_COLUMNS",
160 [VP9E_SET_TILE_ROWS] =
"VP9E_SET_TILE_ROWS",
161 [VP9E_SET_FRAME_PARALLEL_DECODING] =
"VP9E_SET_FRAME_PARALLEL_DECODING",
162 [VP9E_SET_AQ_MODE] =
"VP9E_SET_AQ_MODE",
163 [VP9E_SET_COLOR_SPACE] =
"VP9E_SET_COLOR_SPACE",
164 [VP9E_SET_SVC_LAYER_ID] =
"VP9E_SET_SVC_LAYER_ID",
165 #if VPX_ENCODER_ABI_VERSION >= 12
166 [VP9E_SET_SVC_PARAMETERS] =
"VP9E_SET_SVC_PARAMETERS",
167 [VP9E_SET_SVC_REF_FRAME_CONFIG] =
"VP9E_SET_SVC_REF_FRAME_CONFIG",
169 [VP9E_SET_SVC] =
"VP9E_SET_SVC",
170 #if VPX_ENCODER_ABI_VERSION >= 11
171 [VP9E_SET_COLOR_RANGE] =
"VP9E_SET_COLOR_RANGE",
173 #if VPX_ENCODER_ABI_VERSION >= 12
174 [VP9E_SET_TARGET_LEVEL] =
"VP9E_SET_TARGET_LEVEL",
175 [VP9E_GET_LEVEL] =
"VP9E_GET_LEVEL",
177 #ifdef VPX_CTRL_VP9E_SET_ROW_MT
178 [VP9E_SET_ROW_MT] =
"VP9E_SET_ROW_MT",
180 #ifdef VPX_CTRL_VP9E_SET_TUNE_CONTENT
181 [VP9E_SET_TUNE_CONTENT] =
"VP9E_SET_TUNE_CONTENT",
183 #ifdef VPX_CTRL_VP9E_SET_TPL
184 [VP9E_SET_TPL] =
"VP9E_SET_TPL",
192 const char *
error = vpx_codec_error(&
ctx->encoder);
193 const char *detail = vpx_codec_error_detail(&
ctx->encoder);
201 const struct vpx_codec_enc_cfg *cfg,
209 " %*s%u\n %*s%u\n %*s%u\n %*s%u\n %*s%u\n"
210 #
if CONFIG_LIBVPX_VP9_ENCODER
213 " %*s{%u/%u}\n %*s%u\n %*s%d\n %*s%u\n",
214 width,
"g_usage:", cfg->g_usage,
215 width,
"g_threads:", cfg->g_threads,
216 width,
"g_profile:", cfg->g_profile,
217 width,
"g_w:", cfg->g_w,
218 width,
"g_h:", cfg->g_h,
219 #
if CONFIG_LIBVPX_VP9_ENCODER
220 width,
"g_bit_depth:", cfg->g_bit_depth,
221 width,
"g_input_bit_depth:", cfg->g_input_bit_depth,
223 width,
"g_timebase:", cfg->g_timebase.num, cfg->g_timebase.den,
224 width,
"g_error_resilient:", cfg->g_error_resilient,
225 width,
"g_pass:", cfg->g_pass,
226 width,
"g_lag_in_frames:", cfg->g_lag_in_frames);
228 " %*s%u\n %*s%u\n %*s%u\n %*s%u\n"
230 width,
"rc_dropframe_thresh:", cfg->rc_dropframe_thresh,
231 width,
"rc_resize_allowed:", cfg->rc_resize_allowed,
232 width,
"rc_resize_up_thresh:", cfg->rc_resize_up_thresh,
233 width,
"rc_resize_down_thresh:", cfg->rc_resize_down_thresh,
234 width,
"rc_end_usage:", cfg->rc_end_usage,
235 width,
"rc_twopass_stats_in:", cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz,
236 width,
"rc_target_bitrate:", cfg->rc_target_bitrate);
239 width,
"rc_min_quantizer:", cfg->rc_min_quantizer,
240 width,
"rc_max_quantizer:", cfg->rc_max_quantizer);
243 width,
"rc_undershoot_pct:", cfg->rc_undershoot_pct,
244 width,
"rc_overshoot_pct:", cfg->rc_overshoot_pct);
245 av_log(avctx,
level,
"temporal layering settings\n"
246 " %*s%u\n",
width,
"ts_number_layers:", cfg->ts_number_layers);
249 "\n %*s",
width,
"ts_target_bitrate:");
250 for (
i = 0;
i < VPX_TS_MAX_LAYERS;
i++)
252 "%u ", cfg->ts_target_bitrate[
i]);
254 #if (VPX_ENCODER_ABI_VERSION >= 12) && CONFIG_LIBVPX_VP9_ENCODER
257 "\n %*s",
width,
"layer_target_bitrate:");
258 for (
i = 0;
i < VPX_TS_MAX_LAYERS;
i++)
260 "%u ", cfg->layer_target_bitrate[
i]);
265 "\n %*s",
width,
"ts_rate_decimator:");
266 for (
i = 0;
i < VPX_TS_MAX_LAYERS;
i++)
270 "\n %*s%u\n",
width,
"ts_periodicity:", cfg->ts_periodicity);
272 "\n %*s",
width,
"ts_layer_id:");
273 for (
i = 0;
i < VPX_TS_MAX_PERIODICITY;
i++)
277 " %*s%u\n %*s%u\n %*s%u\n",
278 width,
"rc_buf_sz:", cfg->rc_buf_sz,
279 width,
"rc_buf_initial_sz:", cfg->rc_buf_initial_sz,
280 width,
"rc_buf_optimal_sz:", cfg->rc_buf_optimal_sz);
281 av_log(avctx,
level,
"2 pass rate control settings\n"
282 " %*s%u\n %*s%u\n %*s%u\n",
283 width,
"rc_2pass_vbr_bias_pct:", cfg->rc_2pass_vbr_bias_pct,
284 width,
"rc_2pass_vbr_minsection_pct:", cfg->rc_2pass_vbr_minsection_pct,
285 width,
"rc_2pass_vbr_maxsection_pct:", cfg->rc_2pass_vbr_maxsection_pct);
286 #if VPX_ENCODER_ABI_VERSION >= 14
288 width,
"rc_2pass_vbr_corpus_complexity:", cfg->rc_2pass_vbr_corpus_complexity);
291 " %*s%d\n %*s%u\n %*s%u\n",
292 width,
"kf_mode:", cfg->kf_mode,
293 width,
"kf_min_dist:", cfg->kf_min_dist,
294 width,
"kf_max_dist:", cfg->kf_max_dist);
339 while (
av_fifo_size(*fifo) >=
sizeof(frame_hdr10_plus)) {
373 enum vp8e_enc_control_id
id,
int val)
383 res = vpx_codec_control(&
ctx->encoder,
id,
val);
384 if (res != VPX_CODEC_OK) {
392 int res_alpha = vpx_codec_control(&
ctx->encoder_alpha,
id,
val);
393 if (res_alpha != VPX_CODEC_OK) {
394 snprintf(
buf,
sizeof(
buf),
"Failed to set %s alpha codec control",
404 #if VPX_ENCODER_ABI_VERSION >= 12
406 enum vp8e_enc_control_id
id,
int *
val)
416 res = vpx_codec_control(&
ctx->encoder,
id,
val);
417 if (res != VPX_CODEC_OK) {
425 int res_alpha = vpx_codec_control(&
ctx->encoder_alpha,
id,
val);
426 if (res_alpha != VPX_CODEC_OK) {
427 snprintf(
buf,
sizeof(
buf),
"Failed to set %s alpha codec control",
442 #if VPX_ENCODER_ABI_VERSION >= 12
446 if (!codecctl_intp(avctx, VP9E_GET_LEVEL, &level_out))
453 vpx_codec_destroy(&
ctx->encoder);
455 vpx_codec_destroy(&
ctx->encoder_alpha);
462 if (
ctx->hdr10_plus_fifo)
470 char *saveptr =
NULL;
473 while (token && dest_idx < max_entries) {
474 dest[dest_idx++] = strtoul(token,
NULL, 10);
479 #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT)
480 static void vp8_ts_parse_int64_array(int64_t *dest,
char *
value,
size_t value_len,
int max_entries)
483 char *saveptr =
NULL;
486 while (token && dest_idx < max_entries) {
487 dest[dest_idx++] = strtoull(token,
NULL, 10);
494 int *layer_flags,
int *flag_periodicity)
496 switch (layering_mode) {
501 static const int ids[2] = { 0, 1 };
502 cfg->ts_periodicity = 2;
503 *flag_periodicity = 2;
504 cfg->ts_number_layers = 2;
505 cfg->ts_rate_decimator[0] = 2;
506 cfg->ts_rate_decimator[1] = 1;
507 memcpy(cfg->ts_layer_id, ids,
sizeof(ids));
510 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
511 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
513 VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_GF |
514 VP8_EFLAG_NO_UPD_LAST |
515 VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_REF_GF;
525 static const int ids[4] = { 0, 2, 1, 2 };
526 cfg->ts_periodicity = 4;
527 *flag_periodicity = 4;
528 cfg->ts_number_layers = 3;
529 cfg->ts_rate_decimator[0] = 4;
530 cfg->ts_rate_decimator[1] = 2;
531 cfg->ts_rate_decimator[2] = 1;
532 memcpy(cfg->ts_layer_id, ids,
sizeof(ids));
539 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
540 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
542 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
543 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
544 VP8_EFLAG_NO_UPD_ARF;
546 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
547 VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
549 VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_ARF |
550 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
551 VP8_EFLAG_NO_UPD_ARF;
560 static const int ids[4] = { 0, 2, 1, 2 };
561 cfg->ts_periodicity = 4;
562 *flag_periodicity = 4;
563 cfg->ts_number_layers = 3;
564 cfg->ts_rate_decimator[0] = 4;
565 cfg->ts_rate_decimator[1] = 2;
566 cfg->ts_rate_decimator[2] = 1;
567 memcpy(cfg->ts_layer_id, ids,
sizeof(ids));
573 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
574 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
576 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
577 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF;
579 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
580 VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
582 VP8_EFLAG_NO_REF_LAST |
583 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
584 VP8_EFLAG_NO_UPD_ARF;
600 size_t value_len = strlen(
value);
601 int ts_layering_mode = 0;
606 if (!strcmp(
key,
"ts_number_layers"))
607 enccfg->ts_number_layers = strtoul(
value, &
value, 10);
608 else if (!strcmp(
key,
"ts_target_bitrate")) {
611 #if (VPX_ENCODER_ABI_VERSION >= 12) && CONFIG_LIBVPX_VP9_ENCODER
615 }
else if (!strcmp(
key,
"ts_rate_decimator")) {
617 }
else if (!strcmp(
key,
"ts_periodicity")) {
618 enccfg->ts_periodicity = strtoul(
value, &
value, 10);
619 }
else if (!strcmp(
key,
"ts_layer_id")) {
621 }
else if (!strcmp(
key,
"ts_layering_mode")) {
626 #if (VPX_ENCODER_ABI_VERSION >= 12) && CONFIG_LIBVPX_VP9_ENCODER
627 enccfg->temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_BYPASS;
628 enccfg->ss_number_layers = 1;
630 if (ts_layering_mode) {
640 #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT)
641 static int vpx_ref_frame_config_set_value(vpx_svc_ref_frame_config_t *ref_frame_config,
642 int ss_number_layers,
char *
key,
char *
value)
644 size_t value_len = strlen(
value);
649 if (!strcmp(
key,
"rfc_update_buffer_slot")) {
651 }
else if (!strcmp(
key,
"rfc_update_last")) {
653 }
else if (!strcmp(
key,
"rfc_update_golden")) {
655 }
else if (!strcmp(
key,
"rfc_update_alt_ref")) {
657 }
else if (!strcmp(
key,
"rfc_lst_fb_idx")) {
659 }
else if (!strcmp(
key,
"rfc_gld_fb_idx")) {
661 }
else if (!strcmp(
key,
"rfc_alt_fb_idx")) {
663 }
else if (!strcmp(
key,
"rfc_reference_last")) {
665 }
else if (!strcmp(
key,
"rfc_reference_golden")) {
667 }
else if (!strcmp(
key,
"rfc_reference_alt_ref")) {
669 }
else if (!strcmp(
key,
"rfc_reference_duration")) {
670 vp8_ts_parse_int64_array(ref_frame_config->duration,
value, value_len, ss_number_layers);
676 static int vpx_parse_ref_frame_config_element(vpx_svc_ref_frame_config_t *ref_frame_config,
677 int ss_number_layers,
const char **
buf)
679 const char key_val_sep[] =
"=";
680 const char pairs_sep[] =
":";
685 if (
key && *
key && strspn(*
buf, key_val_sep)) {
691 ret = vpx_ref_frame_config_set_value(ref_frame_config, ss_number_layers,
key,
val);
701 static int vpx_parse_ref_frame_config(vpx_svc_ref_frame_config_t *ref_frame_config,
702 int ss_number_layers,
const char *
str)
708 vpx_parse_ref_frame_config_element(ref_frame_config, ss_number_layers, &
str);
720 #if CONFIG_LIBVPX_VP9_ENCODER
722 struct vpx_codec_enc_cfg *enccfg, vpx_codec_flags_t *
flags,
723 vpx_img_fmt_t *img_fmt)
727 enccfg->g_bit_depth = enccfg->g_input_bit_depth =
desc->comp[0].depth;
731 enccfg->g_profile = 0;
732 *img_fmt = VPX_IMG_FMT_I420;
735 enccfg->g_profile = 1;
736 *img_fmt = VPX_IMG_FMT_I422;
739 enccfg->g_profile = 1;
740 *img_fmt = VPX_IMG_FMT_I440;
743 ctx->vpx_cs = VPX_CS_SRGB;
745 enccfg->g_profile = 1;
746 *img_fmt = VPX_IMG_FMT_I444;
750 if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
751 enccfg->g_profile = 2;
752 *img_fmt = VPX_IMG_FMT_I42016;
753 *
flags |= VPX_CODEC_USE_HIGHBITDEPTH;
759 if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
760 enccfg->g_profile = 3;
761 *img_fmt = VPX_IMG_FMT_I42216;
762 *
flags |= VPX_CODEC_USE_HIGHBITDEPTH;
768 if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
769 enccfg->g_profile = 3;
770 *img_fmt = VPX_IMG_FMT_I44016;
771 *
flags |= VPX_CODEC_USE_HIGHBITDEPTH;
777 ctx->vpx_cs = VPX_CS_SRGB;
780 if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
781 enccfg->g_profile = 3;
782 *img_fmt = VPX_IMG_FMT_I44416;
783 *
flags |= VPX_CODEC_USE_HIGHBITDEPTH;
796 enum vpx_color_space vpx_cs;
800 vpx_cs =
ctx->vpx_cs;
820 #if VPX_ENCODER_ABI_VERSION >= 11
823 enum vpx_color_range vpx_cr;
843 struct vpx_codec_enc_cfg *enccfg)
847 avctx->
bit_rate = enccfg->rc_target_bitrate * 1000;
848 if (enccfg->rc_end_usage == VPX_CQ) {
850 "Bitrate not specified for constrained quality mode, using default of %dkbit/sec\n",
851 enccfg->rc_target_bitrate);
853 enccfg->rc_end_usage = VPX_CQ;
856 "Neither bitrate nor constrained quality specified, using default CRF of %d and bitrate of %dkbit/sec\n",
857 ctx->crf, enccfg->rc_target_bitrate);
862 #if CONFIG_LIBVPX_VP9_ENCODER
868 struct vpx_codec_enc_cfg *enccfg)
872 if (enccfg->rc_end_usage != VPX_Q &&
ctx->lossless < 0) {
873 enccfg->rc_end_usage = VPX_Q;
876 "Neither bitrate nor constrained quality specified, using default CRF of %d\n",
887 struct vpx_codec_enc_cfg *enccfg)
890 #if CONFIG_LIBVPX_VP9_ENCODER
892 set_vp9_defaults(avctx, enccfg);
900 const struct vpx_codec_iface *iface)
903 struct vpx_codec_enc_cfg enccfg = { 0 };
904 struct vpx_codec_enc_cfg enccfg_alpha;
908 vpx_img_fmt_t img_fmt = VPX_IMG_FMT_I420;
909 #if CONFIG_LIBVPX_VP9_ENCODER
910 vpx_codec_caps_t codec_caps = vpx_codec_get_caps(iface);
911 vpx_svc_extra_cfg_t svc_params;
915 ctx->discard_hdr10_plus = 1;
922 if ((res = vpx_codec_enc_config_default(iface, &enccfg, 0)) != VPX_CODEC_OK) {
924 vpx_codec_err_to_string(res));
928 #if CONFIG_LIBVPX_VP9_ENCODER
935 ctx->discard_hdr10_plus = 0;
937 if (!
ctx->hdr10_plus_fifo)
951 enccfg.g_w = avctx->
width;
952 enccfg.g_h = avctx->
height;
957 enccfg.g_lag_in_frames=
ctx->lag_in_frames;
960 enccfg.g_pass = VPX_RC_FIRST_PASS;
962 enccfg.g_pass = VPX_RC_LAST_PASS;
964 enccfg.g_pass = VPX_RC_ONE_PASS;
968 enccfg.rc_end_usage = VPX_CBR;
969 }
else if (
ctx->crf >= 0) {
970 enccfg.rc_end_usage = VPX_CQ;
971 #if CONFIG_LIBVPX_VP9_ENCODER
973 enccfg.rc_end_usage = VPX_Q;
980 #if CONFIG_LIBVPX_VP9_ENCODER
981 enccfg.ss_target_bitrate[0] = enccfg.rc_target_bitrate;
989 enccfg.rc_min_quantizer =
990 enccfg.rc_max_quantizer = 0;
992 if (avctx->
qmin >= 0)
993 enccfg.rc_min_quantizer = avctx->
qmin;
994 if (avctx->
qmax >= 0)
995 enccfg.rc_max_quantizer = avctx->
qmax;
998 if (enccfg.rc_end_usage == VPX_CQ
999 #
if CONFIG_LIBVPX_VP9_ENCODER
1000 || enccfg.rc_end_usage == VPX_Q
1003 if (
ctx->crf < enccfg.rc_min_quantizer ||
ctx->crf > enccfg.rc_max_quantizer) {
1005 "CQ level %d must be between minimum and maximum quantizer value (%d-%d)\n",
1006 ctx->crf, enccfg.rc_min_quantizer, enccfg.rc_max_quantizer);
1011 enccfg.rc_dropframe_thresh =
ctx->drop_threshold;
1016 enccfg.rc_2pass_vbr_minsection_pct =
1019 enccfg.rc_2pass_vbr_maxsection_pct =
1021 #if CONFIG_LIBVPX_VP9_ENCODER
1023 #if VPX_ENCODER_ABI_VERSION >= 14
1024 if (
ctx->corpus_complexity >= 0)
1025 enccfg.rc_2pass_vbr_corpus_complexity =
ctx->corpus_complexity;
1034 enccfg.rc_buf_initial_sz =
1036 enccfg.rc_buf_optimal_sz = enccfg.rc_buf_sz * 5 / 6;
1037 if (
ctx->rc_undershoot_pct >= 0)
1038 enccfg.rc_undershoot_pct =
ctx->rc_undershoot_pct;
1039 if (
ctx->rc_overshoot_pct >= 0)
1040 enccfg.rc_overshoot_pct =
ctx->rc_overshoot_pct;
1046 enccfg.kf_max_dist = avctx->
gop_size;
1048 if (enccfg.g_pass == VPX_RC_FIRST_PASS)
1049 enccfg.g_lag_in_frames = 0;
1050 else if (enccfg.g_pass == VPX_RC_LAST_PASS) {
1051 int decode_size,
ret;
1058 ctx->twopass_stats.sz = strlen(avctx->
stats_in) * 3 / 4;
1063 ctx->twopass_stats.sz);
1064 ctx->twopass_stats.sz = 0;
1068 ctx->twopass_stats.sz);
1069 if (decode_size < 0) {
1074 ctx->twopass_stats.sz = decode_size;
1075 enccfg.rc_twopass_stats_in =
ctx->twopass_stats;
1082 enccfg.g_profile = avctx->
profile;
1089 "Error parsing option '%s = %s'.\n",
1094 res = vpx_codec_enc_init(&
ctx->encoder, iface, &enccfg,
flags);
1095 if (res != VPX_CODEC_OK) {
1102 #if CONFIG_LIBVPX_VP9_ENCODER
1104 memset(&svc_params, 0,
sizeof(svc_params));
1105 for (
int i = 0;
i < enccfg.ts_number_layers; ++
i) {
1106 svc_params.max_quantizers[
i] = enccfg.rc_max_quantizer;
1107 svc_params.min_quantizers[
i] = enccfg.rc_min_quantizer;
1109 svc_params.scaling_factor_num[0] = enccfg.g_h;
1110 svc_params.scaling_factor_den[0] = enccfg.g_h;
1111 #if VPX_ENCODER_ABI_VERSION >= 12
1113 codecctl_intp(avctx, VP9E_SET_SVC_PARAMETERS, (
int *)&svc_params);
1117 if (
ctx->is_alpha) {
1118 enccfg_alpha = enccfg;
1119 res = vpx_codec_enc_init(&
ctx->encoder_alpha, iface, &enccfg_alpha,
flags);
1120 if (res != VPX_CODEC_OK) {
1130 ctx->auto_alt_ref = 1;
1131 if (
ctx->auto_alt_ref >= 0)
1134 if (
ctx->arnr_max_frames >= 0)
1136 if (
ctx->arnr_strength >= 0)
1138 if (
ctx->arnr_type >= 0)
1144 av_log(avctx,
AV_LOG_ERROR,
"Transparency encoding with auto_alt_ref does not work\n");
1148 if (
ctx->sharpness >= 0)
1152 codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY,
ctx->noise_sensitivity);
1158 if (
ctx->max_intra_rate >= 0)
1159 codecctl_int(avctx, VP8E_SET_MAX_INTRA_BITRATE_PCT,
ctx->max_intra_rate);
1161 #if CONFIG_LIBVPX_VP9_ENCODER
1163 if (
ctx->lossless >= 0)
1165 if (
ctx->tile_columns >= 0)
1167 if (
ctx->tile_rows >= 0)
1169 if (
ctx->frame_parallel >= 0)
1170 codecctl_int(avctx, VP9E_SET_FRAME_PARALLEL_DECODING,
ctx->frame_parallel);
1171 if (
ctx->aq_mode >= 0)
1173 set_colorspace(avctx);
1174 #if VPX_ENCODER_ABI_VERSION >= 11
1177 #if VPX_ENCODER_ABI_VERSION >= 12
1180 #ifdef VPX_CTRL_VP9E_SET_ROW_MT
1181 if (
ctx->row_mt >= 0)
1184 #ifdef VPX_CTRL_VP9E_SET_TUNE_CONTENT
1185 if (
ctx->tune_content >= 0)
1188 #ifdef VPX_CTRL_VP9E_SET_TPL
1189 if (
ctx->tpl_model >= 0)
1198 vpx_img_wrap(&
ctx->rawimg, img_fmt, avctx->
width, avctx->
height, 1,
1200 #if CONFIG_LIBVPX_VP9_ENCODER
1202 ctx->rawimg.bit_depth = enccfg.g_bit_depth;
1209 if (enccfg.rc_end_usage == VPX_CBR ||
1210 enccfg.g_pass != VPX_RC_ONE_PASS) {
1221 const struct vpx_codec_cx_pkt *
src,
1222 const struct vpx_codec_cx_pkt *src_alpha,
1225 dst->
pts =
src->data.frame.pts;
1227 dst->
flags =
src->data.frame.flags;
1228 dst->
sz =
src->data.frame.sz;
1229 dst->
buf =
src->data.frame.buf;
1232 if (!(dst->
flags & VPX_FRAME_IS_INVISIBLE)) {
1235 if (
ctx->have_sse) {
1240 memcpy(dst->
sse,
ctx->sse,
sizeof(dst->
sse));
1247 dst->
buf_alpha = src_alpha->data.frame.buf;
1248 dst->
sz_alpha = src_alpha->data.frame.sz;
1275 if (!!(cx_frame->
flags & VPX_FRAME_IS_KEY)) {
1283 cx_frame->
have_sse ? 3 : 0, pict_type);
1287 for (
int i = 0;
i < 3; ++
i)
1304 if (!
ctx->discard_hdr10_plus) {
1325 const struct vpx_codec_cx_pkt *
pkt;
1326 const struct vpx_codec_cx_pkt *pkt_alpha =
NULL;
1327 const void *iter =
NULL;
1328 const void *iter_alpha =
NULL;
1331 if (
ctx->coded_frame_list) {
1337 ctx->coded_frame_list = cx_frame->
next;
1343 while ((
pkt = vpx_codec_get_cx_data(&
ctx->encoder, &iter)) &&
1345 (pkt_alpha = vpx_codec_get_cx_data(&
ctx->encoder_alpha, &iter_alpha)))) {
1346 switch (
pkt->kind) {
1347 case VPX_CODEC_CX_FRAME_PKT:
1363 "Frame queue element alloc failed\n");
1369 if (!cx_frame->
buf) {
1377 if (
ctx->is_alpha) {
1386 memcpy(cx_frame->
buf_alpha, pkt_alpha->data.frame.buf, pkt_alpha->data.frame.sz);
1391 case VPX_CODEC_STATS_PKT: {
1392 struct vpx_fixed_buf *
stats = &
ctx->twopass_stats;
1396 pkt->
data.twopass_stats.sz)) < 0) {
1406 case VPX_CODEC_PSNR_PKT:
1414 case VPX_CODEC_CUSTOM_PKT:
1424 vpx_roi_map_t *roi_map,
int block_size,
int segment_cnt)
1429 #define MAX_DELTA_Q 63
1444 memset(roi_map, 0,
sizeof(*roi_map));
1455 if (!self_size || sd->
size % self_size) {
1459 nb_rois = sd->
size / self_size;
1465 for (
int i = 0;
i < nb_rois;
i++) {
1479 if (!segment_mapping[mapping_index]) {
1480 if (segment_id == segment_cnt) {
1482 "ROI only supports %d segments (and segment 0 is reserved for non-ROIs), skipping the left ones.\n",
1487 segment_mapping[mapping_index] = segment_id + 1;
1488 roi_map->delta_q[segment_id] =
delta_q;
1493 roi_map->rows = (frame_height + block_size - 1) / block_size;
1494 roi_map->cols = (frame_width + block_size - 1) / block_size;
1495 roi_map->roi_map =
av_calloc(roi_map->rows * roi_map->cols,
sizeof(*roi_map->roi_map));
1496 if (!roi_map->roi_map) {
1504 for (
int i = nb_rois - 1;
i >= 0;
i--) {
1507 int starty, endy, startx, endx;
1511 starty =
av_clip(roi->
top / block_size, 0, roi_map->rows);
1512 endy =
av_clip((roi->
bottom + block_size - 1) / block_size, 0, roi_map->rows);
1513 startx =
av_clip(roi->
left / block_size, 0, roi_map->cols);
1514 endx =
av_clip((roi->
right + block_size - 1) / block_size, 0, roi_map->cols);
1520 if (mapping_value) {
1521 for (
int y = starty; y < endy; y++)
1522 for (
int x = startx; x < endx; x++)
1523 roi_map->roi_map[x + y * roi_map->cols] = mapping_value - 1;
1534 #ifdef VPX_CTRL_VP9E_SET_ROI_MAP
1535 int version = vpx_codec_version();
1538 int patch = VPX_VERSION_PATCH(
version);
1541 vpx_roi_map_t roi_map;
1542 const int segment_cnt = 8;
1543 const int block_size = 8;
1546 if (
ctx->aq_mode > 0 ||
ctx->cpu_used < 5 ||
ctx->deadline != VPX_DL_REALTIME) {
1547 if (!
ctx->roi_warned) {
1548 ctx->roi_warned = 1;
1550 "and deadline is REALTIME, so skipping ROI.\n");
1555 ret =
set_roi_map(avctx, sd, frame_width, frame_height, &roi_map, block_size, segment_cnt);
1561 memset(roi_map.ref_frame, -1,
sizeof(roi_map.ref_frame));
1563 if (vpx_codec_control(&
ctx->encoder, VP9E_SET_ROI_MAP, &roi_map)) {
1572 if (!
ctx->roi_warned) {
1573 ctx->roi_warned = 1;
1574 av_log(avctx,
AV_LOG_WARNING,
"ROI is not supported, please upgrade libvpx to version >= 1.8.1. "
1575 "You may need to rebuild ffmpeg.\n");
1582 vpx_roi_map_t roi_map;
1583 const int segment_cnt = 4;
1584 const int block_size = 16;
1587 int ret =
set_roi_map(avctx, sd, frame_width, frame_height, &roi_map, block_size, segment_cnt);
1593 if (vpx_codec_control(&
ctx->encoder, VP8E_SET_ROI_MAP, &roi_map)) {
1605 struct vpx_image *rawimg_alpha = &
ctx->rawimg_alpha;
1606 unsigned char **
planes = rawimg_alpha->planes;
1607 int *
stride = rawimg_alpha->stride;
1609 if (!
planes[VPX_PLANE_U] ||
1611 width != (
int)rawimg_alpha->d_w ||
1612 height != (
int)rawimg_alpha->d_h) {
1616 vpx_img_wrap(rawimg_alpha, VPX_IMG_FMT_I420,
width,
height, 1,
1634 struct vpx_image *rawimg =
NULL;
1635 struct vpx_image *rawimg_alpha =
NULL;
1636 int64_t timestamp = 0;
1637 int res, coded_size;
1638 vpx_enc_frame_flags_t
flags = 0;
1639 const struct vpx_codec_enc_cfg *enccfg =
ctx->encoder.config.enc;
1640 vpx_svc_layer_id_t layer_id;
1641 int layer_id_valid = 0;
1645 rawimg = &
ctx->rawimg;
1646 rawimg->planes[VPX_PLANE_Y] =
frame->data[0];
1647 rawimg->planes[VPX_PLANE_U] =
frame->data[1];
1648 rawimg->planes[VPX_PLANE_V] =
frame->data[2];
1649 rawimg->stride[VPX_PLANE_Y] =
frame->linesize[0];
1650 rawimg->stride[VPX_PLANE_U] =
frame->linesize[1];
1651 rawimg->stride[VPX_PLANE_V] =
frame->linesize[2];
1652 if (
ctx->is_alpha) {
1653 rawimg_alpha = &
ctx->rawimg_alpha;
1657 rawimg_alpha->planes[VPX_PLANE_Y] =
frame->data[3];
1658 rawimg_alpha->stride[VPX_PLANE_Y] =
frame->linesize[3];
1660 timestamp =
frame->pts;
1661 #if VPX_IMAGE_ABI_VERSION >= 4
1662 switch (
frame->color_range) {
1664 rawimg->range = VPX_CR_STUDIO_RANGE;
1667 rawimg->range = VPX_CR_FULL_RANGE;
1672 flags |= VPX_EFLAG_FORCE_KF;
1673 if (
frame->metadata) {
1679 memset(&layer_id, 0,
sizeof(layer_id));
1683 layer_id.temporal_layer_id = strtoul(en->
value,
NULL, 10);
1684 #ifdef VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT
1685 layer_id.temporal_layer_id_per_spatial[0] = layer_id.temporal_layer_id;
1689 #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT)
1694 int ret = vpx_parse_ref_frame_config(&
ctx->ref_frame_config,
1695 enccfg->ss_number_layers, en->
value);
1698 "Error parsing ref_frame_config option %s.\n", en->
value);
1702 codecctl_intp(avctx, VP9E_SET_SVC_REF_FRAME_CONFIG, (
int *)&
ctx->ref_frame_config);
1705 "Ignoring ref-frame-config for a non-VP9 codec\n");
1719 if (!
ctx->discard_hdr10_plus) {
1723 if (hdr10_plus_metadata) {
1728 if (!
data.hdr10_plus)
1741 if (enccfg->ts_number_layers > 1 &&
ctx->ts_layer_flags) {
1742 if (
flags & VPX_EFLAG_FORCE_KF) {
1744 ctx->current_temporal_idx = 0;
1745 flags = VPX_EFLAG_FORCE_KF;
1751 flags |=
ctx->ts_layer_flags[
ctx->current_temporal_idx];
1753 memset(&layer_id, 0,
sizeof(layer_id));
1754 #if VPX_ENCODER_ABI_VERSION >= 12
1755 layer_id.spatial_layer_id = 0;
1757 layer_id.temporal_layer_id = enccfg->ts_layer_id[
ctx->current_temporal_idx];
1758 #ifdef VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT
1759 layer_id.temporal_layer_id_per_spatial[0] = layer_id.temporal_layer_id;
1764 if (layer_id_valid) {
1766 codecctl_int(avctx, VP8E_SET_TEMPORAL_LAYER_ID, layer_id.temporal_layer_id);
1768 #if CONFIG_LIBVPX_VP9_ENCODER && VPX_ENCODER_ABI_VERSION >= 12
1770 codecctl_intp(avctx, VP9E_SET_SVC_LAYER_ID, (
int *)&layer_id);
1775 res = vpx_codec_encode(&
ctx->encoder, rawimg, timestamp,
1777 if (res != VPX_CODEC_OK) {
1782 if (
ctx->is_alpha) {
1783 res = vpx_codec_encode(&
ctx->encoder_alpha, rawimg_alpha, timestamp,
1785 if (res != VPX_CODEC_OK) {
1803 ctx->twopass_stats.sz);
1804 }
else if (enccfg->ts_number_layers > 1 &&
ctx->ts_layer_flags) {
1805 ctx->current_temporal_idx = (
ctx->current_temporal_idx + 1) % enccfg->ts_periodicity;
1808 *got_packet = !!coded_size;
1812 #define OFFSET(x) offsetof(VPxContext, x)
1813 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1815 #define COMMON_OPTIONS \
1816 { "lag-in-frames", "Number of frames to look ahead for " \
1817 "alternate reference frame selection", OFFSET(lag_in_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, \
1818 { "arnr-maxframes", "altref noise reduction max frame count", OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, \
1819 { "arnr-strength", "altref noise reduction filter strength", OFFSET(arnr_strength), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, \
1820 { "arnr-type", "altref noise reduction filter type", OFFSET(arnr_type), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE, "arnr_type"}, \
1821 { "backward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, VE, "arnr_type" }, \
1822 { "forward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, "arnr_type" }, \
1823 { "centered", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, "arnr_type" }, \
1824 { "tune", "Tune the encoding to a specific scenario", OFFSET(tune), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE, "tune"}, \
1825 { "psnr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VP8_TUNE_PSNR}, 0, 0, VE, "tune"}, \
1826 { "ssim", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VP8_TUNE_SSIM}, 0, 0, VE, "tune"}, \
1827 { "deadline", "Time to spend encoding, in microseconds.", OFFSET(deadline), AV_OPT_TYPE_INT, {.i64 = VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, "quality"}, \
1828 { "best", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_BEST_QUALITY}, 0, 0, VE, "quality"}, \
1829 { "good", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_GOOD_QUALITY}, 0, 0, VE, "quality"}, \
1830 { "realtime", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_REALTIME}, 0, 0, VE, "quality"}, \
1831 { "error-resilient", "Error resilience configuration", OFFSET(error_resilient), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, VE, "er"}, \
1832 { "max-intra-rate", "Maximum I-frame bitrate (pct) 0=unlimited", OFFSET(max_intra_rate), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, \
1833 { "default", "Improve resiliency against losses of whole frames", 0, AV_OPT_TYPE_CONST, {.i64 = VPX_ERROR_RESILIENT_DEFAULT}, 0, 0, VE, "er"}, \
1834 { "partitions", "The frame partitions are independently decodable " \
1835 "by the bool decoder, meaning that partitions can be decoded even " \
1836 "though earlier partitions have been lost. Note that intra prediction" \
1837 " is still done over the partition boundary.", 0, AV_OPT_TYPE_CONST, {.i64 = VPX_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, "er"}, \
1838 { "crf", "Select the quality for constant quality mode", offsetof(VPxContext, crf), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, VE }, \
1839 { "static-thresh", "A change threshold on blocks below which they will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, \
1840 { "drop-threshold", "Frame drop threshold", offsetof(VPxContext, drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE }, \
1841 { "noise-sensitivity", "Noise sensitivity", OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE}, \
1842 { "undershoot-pct", "Datarate undershoot (min) target (%)", OFFSET(rc_undershoot_pct), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 100, VE }, \
1843 { "overshoot-pct", "Datarate overshoot (max) target (%)", OFFSET(rc_overshoot_pct), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1000, VE }, \
1844 { "ts-parameters", "Temporal scaling configuration using a :-separated list of key=value parameters", OFFSET(vpx_ts_parameters), AV_OPT_TYPE_DICT, {.str=NULL}, 0, 0, VE}, \
1846 #define LEGACY_OPTIONS \
1847 {"speed", "", offsetof(VPxContext, cpu_used), AV_OPT_TYPE_INT, {.i64 = 1}, -16, 16, VE}, \
1848 {"quality", "", offsetof(VPxContext, deadline), AV_OPT_TYPE_INT, {.i64 = VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, "quality"}, \
1849 {"vp8flags", "", offsetof(VPxContext, flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, UINT_MAX, VE, "flags"}, \
1850 {"error_resilient", "enable error resilience", 0, AV_OPT_TYPE_CONST, {.i64 = VP8F_ERROR_RESILIENT}, INT_MIN, INT_MAX, VE, "flags"}, \
1851 {"altref", "enable use of alternate reference frames (VP8/2-pass only)", 0, AV_OPT_TYPE_CONST, {.i64 = VP8F_AUTO_ALT_REF}, INT_MIN, INT_MAX, VE, "flags"}, \
1852 {"arnr_max_frames", "altref noise reduction max frame count", offsetof(VPxContext, arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 15, VE}, \
1853 {"arnr_strength", "altref noise reduction filter strength", offsetof(VPxContext, arnr_strength), AV_OPT_TYPE_INT, {.i64 = 3}, 0, 6, VE}, \
1854 {"arnr_type", "altref noise reduction filter type", offsetof(VPxContext, arnr_type), AV_OPT_TYPE_INT, {.i64 = 3}, 1, 3, VE}, \
1855 {"rc_lookahead", "Number of frames to look ahead for alternate reference frame selection", offsetof(VPxContext, lag_in_frames), AV_OPT_TYPE_INT, {.i64 = 25}, 0, 25, VE}, \
1856 {"sharpness", "Increase sharpness at the expense of lower PSNR", offsetof(VPxContext, sharpness), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 7, VE},
1858 #if CONFIG_LIBVPX_VP8_ENCODER
1859 static const AVOption vp8_options[] = {
1861 {
"auto-alt-ref",
"Enable use of alternate reference "
1869 #if CONFIG_LIBVPX_VP9_ENCODER
1870 static const AVOption vp9_options[] = {
1872 {
"auto-alt-ref",
"Enable use of alternate reference "
1876 {
"tile-columns",
"Number of tile columns to use, log2",
OFFSET(tile_columns),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6,
VE},
1878 {
"frame-parallel",
"Enable frame parallel decodability features",
OFFSET(frame_parallel),
AV_OPT_TYPE_BOOL,{.i64 = -1}, -1, 1,
VE},
1879 #if VPX_ENCODER_ABI_VERSION >= 12
1880 {
"aq-mode",
"adaptive quantization mode",
OFFSET(aq_mode),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 4,
VE,
"aq_mode"},
1882 {
"aq-mode",
"adaptive quantization mode",
OFFSET(aq_mode),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 3,
VE,
"aq_mode"},
1885 {
"variance",
"Variance based Aq", 0,
AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0,
VE,
"aq_mode" },
1886 {
"complexity",
"Complexity based Aq", 0,
AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0,
VE,
"aq_mode" },
1888 #if VPX_ENCODER_ABI_VERSION >= 12
1892 #ifdef VPX_CTRL_VP9E_SET_ROW_MT
1895 #ifdef VPX_CTRL_VP9E_SET_TUNE_CONTENT
1896 #if VPX_ENCODER_ABI_VERSION >= 14
1897 {
"tune-content",
"Tune content type",
OFFSET(tune_content),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2,
VE,
"tune_content" },
1899 {
"tune-content",
"Tune content type",
OFFSET(tune_content),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1,
VE,
"tune_content" },
1901 {
"default",
"Regular video content", 0,
AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 0,
VE,
"tune_content" },
1902 {
"screen",
"Screen capture content", 0,
AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0,
VE,
"tune_content" },
1903 #if VPX_ENCODER_ABI_VERSION >= 14
1904 {
"film",
"Film content; improves grain retention", 0,
AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0,
VE,
"tune_content" },
1907 #if VPX_ENCODER_ABI_VERSION >= 14
1908 {
"corpus-complexity",
"corpus vbr complexity midpoint",
OFFSET(corpus_complexity),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 10000,
VE },
1910 #ifdef VPX_CTRL_VP9E_SET_TPL
1918 #undef COMMON_OPTIONS
1919 #undef LEGACY_OPTIONS
1926 {
"keyint_min",
"-1" },
1930 #if CONFIG_LIBVPX_VP8_ENCODER
1933 return vpx_init(avctx, vpx_codec_vp8_cx());
1936 static const AVClass class_vp8 = {
1939 .option = vp8_options,
1950 .priv_data_size =
sizeof(VPxContext),
1956 .priv_class = &class_vp8,
1958 .wrapper_name =
"libvpx",
1962 #if CONFIG_LIBVPX_VP9_ENCODER
1965 return vpx_init(avctx, vpx_codec_vp9_cx());
1968 static const AVClass class_vp9 = {
1971 .option = vp9_options,
1976 .
name =
"libvpx-vp9",
1982 .priv_data_size =
sizeof(VPxContext),
1988 .priv_class = &class_vp9,
1991 .wrapper_name =
"libvpx",