26#include "config_components.h"
28#define VPX_DISABLE_CTRL_TYPECHECKS 1
29#define VPX_CODEC_DISABLE_COMPAT 1
30#include <vpx/vpx_encoder.h>
51#define IS_VP9(avctx) (CONFIG_LIBVPX_VP9_ENCODER && avctx->codec_id == AV_CODEC_ID_VP9)
52#define IS_VP8(avctx) (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8)
80typedef struct VPxEncoderContext {
101#define VP8F_ERROR_RESILIENT 0x00000001
102#define VP8F_AUTO_ALT_REF 0x00000002
150#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT)
151 vpx_svc_ref_frame_config_t ref_frame_config;
157 [VP8E_SET_CPUUSED] =
"VP8E_SET_CPUUSED",
158 [VP8E_SET_ENABLEAUTOALTREF] =
"VP8E_SET_ENABLEAUTOALTREF",
159 [VP8E_SET_NOISE_SENSITIVITY] =
"VP8E_SET_NOISE_SENSITIVITY",
160 [VP8E_SET_STATIC_THRESHOLD] =
"VP8E_SET_STATIC_THRESHOLD",
161 [VP8E_SET_TOKEN_PARTITIONS] =
"VP8E_SET_TOKEN_PARTITIONS",
162 [VP8E_SET_ARNR_MAXFRAMES] =
"VP8E_SET_ARNR_MAXFRAMES",
163 [VP8E_SET_ARNR_STRENGTH] =
"VP8E_SET_ARNR_STRENGTH",
164 [VP8E_SET_ARNR_TYPE] =
"VP8E_SET_ARNR_TYPE",
165 [VP8E_SET_TUNING] =
"VP8E_SET_TUNING",
166 [VP8E_SET_CQ_LEVEL] =
"VP8E_SET_CQ_LEVEL",
167 [VP8E_SET_MAX_INTRA_BITRATE_PCT] =
"VP8E_SET_MAX_INTRA_BITRATE_PCT",
168 [VP8E_SET_SHARPNESS] =
"VP8E_SET_SHARPNESS",
169 [VP8E_SET_TEMPORAL_LAYER_ID] =
"VP8E_SET_TEMPORAL_LAYER_ID",
170 [VP8E_SET_SCREEN_CONTENT_MODE] =
"VP8E_SET_SCREEN_CONTENT_MODE",
171#if CONFIG_LIBVPX_VP9_ENCODER
172 [VP9E_SET_LOSSLESS] =
"VP9E_SET_LOSSLESS",
173 [VP9E_SET_TILE_COLUMNS] =
"VP9E_SET_TILE_COLUMNS",
174 [VP9E_SET_TILE_ROWS] =
"VP9E_SET_TILE_ROWS",
175 [VP9E_SET_FRAME_PARALLEL_DECODING] =
"VP9E_SET_FRAME_PARALLEL_DECODING",
176 [VP9E_SET_AQ_MODE] =
"VP9E_SET_AQ_MODE",
177 [VP9E_SET_COLOR_SPACE] =
"VP9E_SET_COLOR_SPACE",
178 [VP9E_SET_SVC_LAYER_ID] =
"VP9E_SET_SVC_LAYER_ID",
179#if VPX_ENCODER_ABI_VERSION >= 12
180 [VP9E_SET_SVC_PARAMETERS] =
"VP9E_SET_SVC_PARAMETERS",
181 [VP9E_SET_SVC_REF_FRAME_CONFIG] =
"VP9E_SET_SVC_REF_FRAME_CONFIG",
183 [VP9E_SET_SVC] =
"VP9E_SET_SVC",
184#if VPX_ENCODER_ABI_VERSION >= 11
185 [VP9E_SET_COLOR_RANGE] =
"VP9E_SET_COLOR_RANGE",
187#if VPX_ENCODER_ABI_VERSION >= 12
188 [VP9E_SET_TARGET_LEVEL] =
"VP9E_SET_TARGET_LEVEL",
189 [VP9E_GET_LEVEL] =
"VP9E_GET_LEVEL",
191#ifdef VPX_CTRL_VP9E_SET_ROW_MT
192 [VP9E_SET_ROW_MT] =
"VP9E_SET_ROW_MT",
194#ifdef VPX_CTRL_VP9E_SET_TUNE_CONTENT
195 [VP9E_SET_TUNE_CONTENT] =
"VP9E_SET_TUNE_CONTENT",
197#ifdef VPX_CTRL_VP9E_SET_TPL
198 [VP9E_SET_TPL] =
"VP9E_SET_TPL",
200#ifdef VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
201 [VP9E_SET_MIN_GF_INTERVAL] =
"VP9E_SET_MIN_GF_INTERVAL",
208 const char *
error = vpx_codec_error(encoder);
209 const char *detail = vpx_codec_error_detail(encoder);
217 const struct vpx_codec_enc_cfg *
cfg,
225 " %*s%u\n %*s%u\n %*s%u\n %*s%u\n %*s%u\n"
226#
if CONFIG_LIBVPX_VP9_ENCODER
229 " %*s{%u/%u}\n %*s%u\n %*s%d\n %*s%u\n",
231 width,
"g_threads:",
cfg->g_threads,
232 width,
"g_profile:",
cfg->g_profile,
235#
if CONFIG_LIBVPX_VP9_ENCODER
236 width,
"g_bit_depth:",
cfg->g_bit_depth,
237 width,
"g_input_bit_depth:",
cfg->g_input_bit_depth,
239 width,
"g_timebase:",
cfg->g_timebase.num,
cfg->g_timebase.den,
240 width,
"g_error_resilient:",
cfg->g_error_resilient,
242 width,
"g_lag_in_frames:",
cfg->g_lag_in_frames);
244 " %*s%u\n %*s%u\n %*s%u\n %*s%u\n"
245 " %*s%d\n %*s%p(%zu)\n %*s%u\n",
246 width,
"rc_dropframe_thresh:",
cfg->rc_dropframe_thresh,
247 width,
"rc_resize_allowed:",
cfg->rc_resize_allowed,
248 width,
"rc_resize_up_thresh:",
cfg->rc_resize_up_thresh,
249 width,
"rc_resize_down_thresh:",
cfg->rc_resize_down_thresh,
250 width,
"rc_end_usage:",
cfg->rc_end_usage,
251 width,
"rc_twopass_stats_in:",
cfg->rc_twopass_stats_in.buf,
cfg->rc_twopass_stats_in.sz,
252 width,
"rc_target_bitrate:",
cfg->rc_target_bitrate);
255 width,
"rc_min_quantizer:",
cfg->rc_min_quantizer,
256 width,
"rc_max_quantizer:",
cfg->rc_max_quantizer);
259 width,
"rc_undershoot_pct:",
cfg->rc_undershoot_pct,
260 width,
"rc_overshoot_pct:",
cfg->rc_overshoot_pct);
261 av_log(avctx,
level,
"temporal layering settings\n"
262 " %*s%u\n",
width,
"ts_number_layers:",
cfg->ts_number_layers);
265 "\n %*s",
width,
"ts_target_bitrate:");
266 for (
i = 0;
i < VPX_TS_MAX_LAYERS;
i++)
268 "%u ",
cfg->ts_target_bitrate[
i]);
270#if (VPX_ENCODER_ABI_VERSION >= 12) && CONFIG_LIBVPX_VP9_ENCODER
273 "\n %*s",
width,
"layer_target_bitrate:");
274 for (
i = 0;
i < VPX_TS_MAX_LAYERS;
i++)
276 "%u ",
cfg->layer_target_bitrate[
i]);
281 "\n %*s",
width,
"ts_rate_decimator:");
282 for (
i = 0;
i < VPX_TS_MAX_LAYERS;
i++)
286 "\n %*s%u\n",
width,
"ts_periodicity:",
cfg->ts_periodicity);
288 "\n %*s",
width,
"ts_layer_id:");
289 for (
i = 0;
i < VPX_TS_MAX_PERIODICITY;
i++)
293 " %*s%u\n %*s%u\n %*s%u\n",
294 width,
"rc_buf_sz:",
cfg->rc_buf_sz,
295 width,
"rc_buf_initial_sz:",
cfg->rc_buf_initial_sz,
296 width,
"rc_buf_optimal_sz:",
cfg->rc_buf_optimal_sz);
297 av_log(avctx,
level,
"2 pass rate control settings\n"
298 " %*s%u\n %*s%u\n %*s%u\n",
299 width,
"rc_2pass_vbr_bias_pct:",
cfg->rc_2pass_vbr_bias_pct,
300 width,
"rc_2pass_vbr_minsection_pct:",
cfg->rc_2pass_vbr_minsection_pct,
301 width,
"rc_2pass_vbr_maxsection_pct:",
cfg->rc_2pass_vbr_maxsection_pct);
302#if VPX_ENCODER_ABI_VERSION >= 14
304 width,
"rc_2pass_vbr_corpus_complexity:",
cfg->rc_2pass_vbr_corpus_complexity);
307 " %*s%d\n %*s%u\n %*s%u\n",
309 width,
"kf_min_dist:",
cfg->kf_min_dist,
310 width,
"kf_max_dist:",
cfg->kf_max_dist);
360 return (
ctx->drop_threshold > 0) || (
ctx->screen_content_mode == 2);
367 const struct vpx_codec_enc_cfg *enccfg =
ctx->encoder.config.enc;
442 "Mismatching timestamps: libvpx %"PRId64
" queued %"PRId64
"; "
443 "this is a bug, please report it\n",
pkt->pts, fd.
pts);
488 enum vp8e_enc_control_id
id,
int val)
495 snprintf(buf,
sizeof(buf),
"%s:",
ctlidstr[
id]);
498 res = vpx_codec_control(&
ctx->encoder,
id,
val);
499 if (res != VPX_CODEC_OK) {
500 snprintf(buf,
sizeof(buf),
"Failed to set %s codec control",
506 if (
ctx->is_alpha &&
id != VP9E_SET_COLOR_SPACE) {
507 int res_alpha = vpx_codec_control(&
ctx->encoder_alpha,
id,
val);
508 if (res_alpha != VPX_CODEC_OK) {
509 snprintf(buf,
sizeof(buf),
"Failed to set %s alpha codec control",
519#if VPX_ENCODER_ABI_VERSION >= 12
521 enum vp8e_enc_control_id
id,
int *
val)
528 snprintf(buf,
sizeof(buf),
"%s:",
ctlidstr[
id]);
531 res = vpx_codec_control(&
ctx->encoder,
id,
val);
532 if (res != VPX_CODEC_OK) {
533 snprintf(buf,
sizeof(buf),
"Failed to set %s codec control",
540 int res_alpha = vpx_codec_control(&
ctx->encoder_alpha,
id,
val);
541 if (res_alpha != VPX_CODEC_OK) {
542 snprintf(buf,
sizeof(buf),
"Failed to set %s alpha codec control",
557#if VPX_ENCODER_ABI_VERSION >= 12
561 if (!codecctl_intp(avctx, VP9E_GET_LEVEL, &level_out))
568 vpx_codec_destroy(&
ctx->encoder);
570 vpx_codec_destroy(&
ctx->encoder_alpha);
586 char *saveptr =
NULL;
589 while (token && dest_idx < max_entries) {
590 dest[dest_idx++] = strtoul(token,
NULL, 10);
595#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT)
596static void vp8_ts_parse_int64_array(
int64_t *dest,
char *
value,
size_t value_len,
int max_entries)
599 char *saveptr =
NULL;
602 while (token && dest_idx < max_entries) {
603 dest[dest_idx++] = strtoull(token,
NULL, 10);
610 int *layer_flags,
int *flag_periodicity)
612 switch (layering_mode) {
617 static const int ids[2] = { 0, 1 };
618 cfg->ts_periodicity = 2;
619 *flag_periodicity = 2;
620 cfg->ts_number_layers = 2;
621 cfg->ts_rate_decimator[0] = 2;
622 cfg->ts_rate_decimator[1] = 1;
623 memcpy(
cfg->ts_layer_id, ids,
sizeof(ids));
626 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
627 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
629 VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_GF |
630 VP8_EFLAG_NO_UPD_LAST |
631 VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_REF_GF;
641 static const int ids[4] = { 0, 2, 1, 2 };
642 cfg->ts_periodicity = 4;
643 *flag_periodicity = 4;
644 cfg->ts_number_layers = 3;
645 cfg->ts_rate_decimator[0] = 4;
646 cfg->ts_rate_decimator[1] = 2;
647 cfg->ts_rate_decimator[2] = 1;
648 memcpy(
cfg->ts_layer_id, ids,
sizeof(ids));
655 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
656 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
658 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
659 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
660 VP8_EFLAG_NO_UPD_ARF;
662 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
663 VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
665 VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_ARF |
666 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
667 VP8_EFLAG_NO_UPD_ARF;
676 static const int ids[4] = { 0, 2, 1, 2 };
677 cfg->ts_periodicity = 4;
678 *flag_periodicity = 4;
679 cfg->ts_number_layers = 3;
680 cfg->ts_rate_decimator[0] = 4;
681 cfg->ts_rate_decimator[1] = 2;
682 cfg->ts_rate_decimator[2] = 1;
683 memcpy(
cfg->ts_layer_id, ids,
sizeof(ids));
689 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
690 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
692 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
693 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF;
695 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF |
696 VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
698 VP8_EFLAG_NO_REF_LAST |
699 VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
700 VP8_EFLAG_NO_UPD_ARF;
716 size_t value_len = strlen(
value);
717 int ts_layering_mode = 0;
722 if (!strcmp(
key,
"ts_number_layers"))
723 enccfg->ts_number_layers = strtoul(
value, &
value, 10);
724 else if (!strcmp(
key,
"ts_target_bitrate")) {
727#if (VPX_ENCODER_ABI_VERSION >= 12) && CONFIG_LIBVPX_VP9_ENCODER
731 }
else if (!strcmp(
key,
"ts_rate_decimator")) {
733 }
else if (!strcmp(
key,
"ts_periodicity")) {
734 enccfg->ts_periodicity = strtoul(
value, &
value, 10);
735 }
else if (!strcmp(
key,
"ts_layer_id")) {
737 }
else if (!strcmp(
key,
"ts_layering_mode")) {
739 ts_layering_mode = strtoul(
value, &
value, 10);
742#if (VPX_ENCODER_ABI_VERSION >= 12) && CONFIG_LIBVPX_VP9_ENCODER
743 enccfg->temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_BYPASS;
744 enccfg->ss_number_layers = 1;
746 if (ts_layering_mode) {
756#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT)
757static int vpx_ref_frame_config_set_value(vpx_svc_ref_frame_config_t *ref_frame_config,
758 int ss_number_layers,
char *
key,
char *
value)
760 size_t value_len = strlen(
value);
765 if (!strcmp(
key,
"rfc_update_buffer_slot")) {
767 }
else if (!strcmp(
key,
"rfc_update_last")) {
769 }
else if (!strcmp(
key,
"rfc_update_golden")) {
771 }
else if (!strcmp(
key,
"rfc_update_alt_ref")) {
773 }
else if (!strcmp(
key,
"rfc_lst_fb_idx")) {
775 }
else if (!strcmp(
key,
"rfc_gld_fb_idx")) {
777 }
else if (!strcmp(
key,
"rfc_alt_fb_idx")) {
779 }
else if (!strcmp(
key,
"rfc_reference_last")) {
781 }
else if (!strcmp(
key,
"rfc_reference_golden")) {
783 }
else if (!strcmp(
key,
"rfc_reference_alt_ref")) {
785 }
else if (!strcmp(
key,
"rfc_reference_duration")) {
786 vp8_ts_parse_int64_array(ref_frame_config->duration,
value, value_len, ss_number_layers);
792static int vpx_parse_ref_frame_config_element(vpx_svc_ref_frame_config_t *ref_frame_config,
793 int ss_number_layers,
const char **buf)
795 const char key_val_sep[] =
"=";
796 const char pairs_sep[] =
":";
801 if (
key && *
key && strspn(*buf, key_val_sep)) {
807 ret = vpx_ref_frame_config_set_value(ref_frame_config, ss_number_layers,
key,
val);
817static int vpx_parse_ref_frame_config(vpx_svc_ref_frame_config_t *ref_frame_config,
818 int ss_number_layers,
const char *str)
824 vpx_parse_ref_frame_config_element(ref_frame_config, ss_number_layers, &str);
836#if CONFIG_LIBVPX_VP9_ENCODER
838 struct vpx_codec_enc_cfg *enccfg, vpx_codec_flags_t *
flags,
839 vpx_img_fmt_t *img_fmt)
843 enccfg->g_bit_depth = enccfg->g_input_bit_depth =
desc->comp[0].depth;
847 enccfg->g_profile = 0;
848 *img_fmt = VPX_IMG_FMT_I420;
852 enccfg->g_profile = 1;
853 *img_fmt = VPX_IMG_FMT_I422;
856 enccfg->g_profile = 1;
857 *img_fmt = VPX_IMG_FMT_I440;
861 ctx->vpx_cs = VPX_CS_SRGB;
866 ctx->vpx_cs = VPX_CS_SRGB;
867 enccfg->g_profile = 1;
868 *img_fmt = VPX_IMG_FMT_I444;
873 if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
874 enccfg->g_profile = 2;
875 *img_fmt = VPX_IMG_FMT_I42016;
876 *
flags |= VPX_CODEC_USE_HIGHBITDEPTH;
883 if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
884 enccfg->g_profile = 3;
885 *img_fmt = VPX_IMG_FMT_I42216;
886 *
flags |= VPX_CODEC_USE_HIGHBITDEPTH;
892 if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
893 enccfg->g_profile = 3;
894 *img_fmt = VPX_IMG_FMT_I44016;
895 *
flags |= VPX_CODEC_USE_HIGHBITDEPTH;
903 ctx->vpx_cs = VPX_CS_SRGB;
910 ctx->vpx_cs = VPX_CS_SRGB;
911 if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
912 enccfg->g_profile = 3;
913 *img_fmt = VPX_IMG_FMT_I44416;
914 *
flags |= VPX_CODEC_USE_HIGHBITDEPTH;
927 enum vpx_color_space vpx_cs;
931 vpx_cs =
ctx->vpx_cs;
936 "RGB colorspace is not compatible with pixel format %s.\n",
956#if VPX_ENCODER_ABI_VERSION >= 11
959 enum vpx_color_range vpx_cr;
979 struct vpx_codec_enc_cfg *enccfg)
983 avctx->
bit_rate = enccfg->rc_target_bitrate * 1000;
984 if (enccfg->rc_end_usage == VPX_CQ) {
986 "Bitrate not specified for constrained quality mode, using default of %dkbit/sec\n",
987 enccfg->rc_target_bitrate);
989 enccfg->rc_end_usage = VPX_CQ;
992 "Neither bitrate nor constrained quality specified, using default CRF of %d and bitrate of %dkbit/sec\n",
993 ctx->crf, enccfg->rc_target_bitrate);
998#if CONFIG_LIBVPX_VP9_ENCODER
1004 struct vpx_codec_enc_cfg *enccfg)
1008 if (enccfg->rc_end_usage != VPX_Q &&
ctx->lossless < 0) {
1009 enccfg->rc_end_usage = VPX_Q;
1012 "Neither bitrate nor constrained quality specified, using default CRF of %d\n",
1023 struct vpx_codec_enc_cfg *enccfg)
1026#if CONFIG_LIBVPX_VP9_ENCODER
1028 set_vp9_defaults(avctx, enccfg);
1036 const struct vpx_codec_iface *iface)
1039 struct vpx_codec_enc_cfg enccfg = { 0 };
1040 struct vpx_codec_enc_cfg enccfg_alpha;
1044 vpx_img_fmt_t img_fmt = VPX_IMG_FMT_I420;
1045#if CONFIG_LIBVPX_VP9_ENCODER
1046 vpx_codec_caps_t codec_caps = vpx_codec_get_caps(iface);
1047 vpx_svc_extra_cfg_t svc_params;
1059 "Pixel format '%s' is not widely supported. "
1060 "Use -strict experimental to use it anyway, or use 'yuva420p' pixel format instead.\n",
1066 if ((res = vpx_codec_enc_config_default(iface, &enccfg, 0)) != VPX_CODEC_OK) {
1068 vpx_codec_err_to_string(res));
1076#if CONFIG_LIBVPX_VP9_ENCODER
1091 enccfg.g_w = avctx->
width;
1092 enccfg.g_h = avctx->
height;
1097 enccfg.g_lag_in_frames=
ctx->lag_in_frames;
1100 enccfg.g_pass = VPX_RC_FIRST_PASS;
1102 enccfg.g_pass = VPX_RC_LAST_PASS;
1104 enccfg.g_pass = VPX_RC_ONE_PASS;
1108 enccfg.rc_end_usage = VPX_CBR;
1109 }
else if (
ctx->crf >= 0) {
1110 enccfg.rc_end_usage = VPX_CQ;
1111#if CONFIG_LIBVPX_VP9_ENCODER
1113 enccfg.rc_end_usage = VPX_Q;
1120#if CONFIG_LIBVPX_VP9_ENCODER
1121 enccfg.ss_target_bitrate[0] = enccfg.rc_target_bitrate;
1129 enccfg.rc_min_quantizer =
1130 enccfg.rc_max_quantizer = 0;
1132 if (avctx->
qmin >= 0)
1133 enccfg.rc_min_quantizer = avctx->
qmin;
1134 if (avctx->
qmax >= 0)
1135 enccfg.rc_max_quantizer = avctx->
qmax;
1138 if (enccfg.rc_end_usage == VPX_CQ
1139#
if CONFIG_LIBVPX_VP9_ENCODER
1140 || enccfg.rc_end_usage == VPX_Q
1143 if (
ctx->crf < enccfg.rc_min_quantizer ||
ctx->crf > enccfg.rc_max_quantizer) {
1145 "CQ level %d must be between minimum and maximum quantizer value (%d-%d)\n",
1146 ctx->crf, enccfg.rc_min_quantizer, enccfg.rc_max_quantizer);
1151 enccfg.rc_dropframe_thresh =
ctx->drop_threshold;
1156 enccfg.rc_2pass_vbr_minsection_pct =
1159 enccfg.rc_2pass_vbr_maxsection_pct =
1161#if CONFIG_LIBVPX_VP9_ENCODER
1163#if VPX_ENCODER_ABI_VERSION >= 14
1164 if (
ctx->corpus_complexity >= 0)
1165 enccfg.rc_2pass_vbr_corpus_complexity =
ctx->corpus_complexity;
1174 enccfg.rc_buf_initial_sz =
1176 enccfg.rc_buf_optimal_sz = enccfg.rc_buf_sz * 5 / 6;
1177 if (
ctx->rc_undershoot_pct >= 0)
1178 enccfg.rc_undershoot_pct =
ctx->rc_undershoot_pct;
1179 if (
ctx->rc_overshoot_pct >= 0)
1180 enccfg.rc_overshoot_pct =
ctx->rc_overshoot_pct;
1186 enccfg.kf_max_dist = avctx->
gop_size;
1188 if (enccfg.g_pass == VPX_RC_FIRST_PASS)
1189 enccfg.g_lag_in_frames = 0;
1190 else if (enccfg.g_pass == VPX_RC_LAST_PASS) {
1191 int decode_size,
ret;
1198 ctx->twopass_stats.sz = strlen(avctx->
stats_in) * 3 / 4;
1202 "Stat buffer alloc (%zu bytes) failed\n",
1203 ctx->twopass_stats.sz);
1204 ctx->twopass_stats.sz = 0;
1208 ctx->twopass_stats.sz);
1209 if (decode_size < 0) {
1214 ctx->twopass_stats.sz = decode_size;
1215 enccfg.rc_twopass_stats_in =
ctx->twopass_stats;
1222 enccfg.g_profile = avctx->
profile;
1229 "Error parsing option '%s = %s'.\n",
1234 res = vpx_codec_enc_init(&
ctx->encoder, iface, &enccfg,
flags);
1235 if (res != VPX_CODEC_OK) {
1242#if CONFIG_LIBVPX_VP9_ENCODER
1244 memset(&svc_params, 0,
sizeof(svc_params));
1245 for (
int i = 0;
i < enccfg.ts_number_layers; ++
i) {
1246 svc_params.max_quantizers[
i] = enccfg.rc_max_quantizer;
1247 svc_params.min_quantizers[
i] = enccfg.rc_min_quantizer;
1249 svc_params.scaling_factor_num[0] = enccfg.g_h;
1250 svc_params.scaling_factor_den[0] = enccfg.g_h;
1251#if VPX_ENCODER_ABI_VERSION >= 12
1253 codecctl_intp(avctx, VP9E_SET_SVC_PARAMETERS, (
int *)&svc_params);
1257 if (
ctx->is_alpha) {
1258 enccfg_alpha = enccfg;
1259 enccfg_alpha.g_profile = (
flags & VPX_CODEC_USE_HIGHBITDEPTH) ? 2 : 0;
1260 res = vpx_codec_enc_init(&
ctx->encoder_alpha, iface, &enccfg_alpha,
flags);
1261 if (res != VPX_CODEC_OK) {
1271 ctx->auto_alt_ref = 1;
1272 if (
ctx->auto_alt_ref >= 0)
1275 if (
ctx->arnr_max_frames >= 0)
1277 if (
ctx->arnr_strength >= 0)
1279 if (
ctx->arnr_type >= 0)
1285 av_log(avctx,
AV_LOG_ERROR,
"Transparency encoding with auto_alt_ref does not work\n");
1289 if (
ctx->sharpness >= 0)
1293 codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY,
ctx->noise_sensitivity);
1299 if (
ctx->max_intra_rate >= 0)
1300 codecctl_int(avctx, VP8E_SET_MAX_INTRA_BITRATE_PCT,
ctx->max_intra_rate);
1302#if CONFIG_LIBVPX_VP9_ENCODER
1304 if (
ctx->lossless >= 0)
1306 if (
ctx->tile_columns >= 0)
1308 if (
ctx->tile_rows >= 0)
1310 if (
ctx->frame_parallel >= 0)
1311 codecctl_int(avctx, VP9E_SET_FRAME_PARALLEL_DECODING,
ctx->frame_parallel);
1312 if (
ctx->aq_mode >= 0)
1314 res = set_colorspace(avctx);
1317#if VPX_ENCODER_ABI_VERSION >= 11
1320#if VPX_ENCODER_ABI_VERSION >= 12
1323#ifdef VPX_CTRL_VP9E_SET_ROW_MT
1324 if (
ctx->row_mt >= 0)
1327#ifdef VPX_CTRL_VP9E_SET_TUNE_CONTENT
1328 if (
ctx->tune_content >= 0)
1331#ifdef VPX_CTRL_VP9E_SET_TPL
1332 if (
ctx->tpl_model >= 0)
1335#ifdef VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
1336 if (
ctx->min_gf_interval >= 0)
1342 if (
ctx->screen_content_mode == 2 &&
ctx->is_alpha) {
1344 "Transparency encoding with screen mode with aggressive rate control not supported\n");
1347 codecctl_int(avctx, VP8E_SET_SCREEN_CONTENT_MODE,
ctx->screen_content_mode);
1353 vpx_img_wrap(&
ctx->rawimg, img_fmt, avctx->
width, avctx->
height, 1,
1355#if CONFIG_LIBVPX_VP9_ENCODER
1357 ctx->rawimg.bit_depth = enccfg.g_bit_depth;
1364 if (enccfg.rc_end_usage == VPX_CBR ||
1365 enccfg.g_pass != VPX_RC_ONE_PASS) {
1376 const struct vpx_codec_cx_pkt *
src,
1379 dst->pts =
src->data.frame.pts;
1380 dst->flags =
src->data.frame.flags;
1381 dst->sz =
src->data.frame.sz;
1382 dst->buf =
src->data.frame.buf;
1385 if (!(
dst->flags & VPX_FRAME_IS_INVISIBLE)) {
1386 dst->have_sse =
ctx->have_sse;
1387 if (
ctx->have_sse) {
1392 memcpy(
dst->sse,
ctx->sse,
sizeof(
dst->sse));
1417 memcpy(
pkt->data, cx_frame->
buf,
pkt->size);
1420 if (!!(cx_frame->
flags & VPX_FRAME_IS_KEY)) {
1427 ret = vpx_codec_control(&
ctx->encoder, VP8E_GET_LAST_QUANTIZER_64, &
quality);
1428 if (
ret != VPX_CODEC_OK)
1431 cx_frame->
have_sse ? 3 : 0, pict_type);
1435 for (
int i = 0;
i < 3; ++
i)
1439 if (alpha_cx_frame) {
1442 alpha_cx_frame->
sz + 8);
1448 memcpy(side_data + 8, alpha_cx_frame->
buf, alpha_cx_frame->
sz);
1469 const struct vpx_codec_cx_pkt *
pkt;
1470 const void *iter =
NULL;
1473 if (!
ctx->is_alpha && *frame_list) {
1479 *frame_list = cx_frame->
next;
1485 while (
pkt = vpx_codec_get_cx_data(encoder, &iter)) {
1486 switch (
pkt->kind) {
1487 case VPX_CODEC_CX_FRAME_PKT:
1488 if (!
ctx->is_alpha && !
size) {
1503 "Frame queue element alloc failed\n");
1509 if (!cx_frame->
buf) {
1511 "Data buffer alloc (%zu bytes) failed\n",
1516 memcpy(cx_frame->
buf,
pkt->data.frame.buf,
pkt->data.frame.sz);
1520 case VPX_CODEC_STATS_PKT: {
1521 struct vpx_fixed_buf *
stats = &
ctx->twopass_stats;
1526 &
ctx->twopass_stats_size,
1528 pkt->data.twopass_stats.sz);
1537 pkt->data.twopass_stats.buf,
pkt->data.twopass_stats.sz);
1538 stats->sz +=
pkt->data.twopass_stats.sz;
1541 case VPX_CODEC_PSNR_PKT:
1545 ctx->sse[0] =
pkt->data.psnr.sse[0];
1546 ctx->sse[1] =
pkt->data.psnr.sse[1];
1547 ctx->sse[2] =
pkt->data.psnr.sse[2];
1548 ctx->sse[3] =
pkt->data.psnr.sse[3];
1551 case VPX_CODEC_CUSTOM_PKT:
1561 vpx_roi_map_t *roi_map,
int block_size,
int segment_cnt)
1566#define MAX_DELTA_Q 63
1581 memset(roi_map, 0,
sizeof(*roi_map));
1592 if (!self_size || sd->
size % self_size) {
1596 nb_rois = sd->
size / self_size;
1602 for (
int i = 0;
i < nb_rois;
i++) {
1616 if (!segment_mapping[mapping_index]) {
1617 if (segment_id == segment_cnt) {
1619 "ROI only supports %d segments (and segment 0 is reserved for non-ROIs), skipping the left ones.\n",
1624 segment_mapping[mapping_index] = segment_id + 1;
1625 roi_map->delta_q[segment_id] =
delta_q;
1630 roi_map->rows = (frame_height + block_size - 1) / block_size;
1631 roi_map->cols = (frame_width + block_size - 1) / block_size;
1632 roi_map->roi_map =
av_calloc(roi_map->rows * roi_map->cols,
sizeof(*roi_map->roi_map));
1633 if (!roi_map->roi_map) {
1641 for (
int i = nb_rois - 1;
i >= 0;
i--) {
1644 int starty, endy, startx, endx;
1648 starty =
av_clip(roi->
top / block_size, 0, roi_map->rows);
1649 endy =
av_clip((roi->
bottom + block_size - 1) / block_size, 0, roi_map->rows);
1650 startx =
av_clip(roi->
left / block_size, 0, roi_map->cols);
1651 endx =
av_clip((roi->
right + block_size - 1) / block_size, 0, roi_map->cols);
1657 if (mapping_value) {
1658 for (
int y = starty; y < endy; y++)
1659 for (
int x = startx; x < endx; x++)
1660 roi_map->roi_map[x + y * roi_map->cols] = mapping_value - 1;
1671#ifdef VPX_CTRL_VP9E_SET_ROI_MAP
1672 int version = vpx_codec_version();
1673 int major = VPX_VERSION_MAJOR(
version);
1674 int minor = VPX_VERSION_MINOR(
version);
1675 int patch = VPX_VERSION_PATCH(
version);
1677 if (major > 1 || (major == 1 && minor > 8) || (major == 1 && minor == 8 && patch >= 1)) {
1678 vpx_roi_map_t roi_map;
1679 const int segment_cnt = 8;
1680 const int block_size = 8;
1683 if (
ctx->aq_mode > 0 ||
ctx->cpu_used < 5 ||
ctx->deadline != VPX_DL_REALTIME) {
1684 if (!
ctx->roi_warned) {
1685 ctx->roi_warned = 1;
1687 "and deadline is REALTIME, so skipping ROI.\n");
1692 ret =
set_roi_map(avctx, sd, frame_width, frame_height, &roi_map, block_size, segment_cnt);
1698 memset(roi_map.ref_frame, -1,
sizeof(roi_map.ref_frame));
1700 if (vpx_codec_control(&
ctx->encoder, VP9E_SET_ROI_MAP, &roi_map)) {
1709 if (!
ctx->roi_warned) {
1710 ctx->roi_warned = 1;
1711 av_log(avctx,
AV_LOG_WARNING,
"ROI is not supported, please upgrade libvpx to version >= 1.8.1. "
1712 "You may need to rebuild ffmpeg.\n");
1719 vpx_roi_map_t roi_map;
1720 const int segment_cnt = 4;
1721 const int block_size = 16;
1724 int ret =
set_roi_map(avctx, sd, frame_width, frame_height, &roi_map, block_size, segment_cnt);
1730 if (vpx_codec_control(&
ctx->encoder, VP8E_SET_ROI_MAP, &roi_map)) {
1742 struct vpx_image *rawimg_alpha = &
ctx->rawimg_alpha;
1743 unsigned char **
planes = rawimg_alpha->planes;
1744 int *
stride = rawimg_alpha->stride;
1746 if (!
planes[VPX_PLANE_U] ||
1748 width != (
int)rawimg_alpha->d_w ||
1749 height != (
int)rawimg_alpha->d_h) {
1750 vpx_img_fmt_t alpha_fmt =
ctx->rawimg.bit_depth > 8 ?
1751 VPX_IMG_FMT_I42016 : VPX_IMG_FMT_I420;
1755 vpx_img_wrap(rawimg_alpha, alpha_fmt,
width,
height, 1,
1762 if (
ctx->rawimg.bit_depth > 8) {
1763 int val = 0x80 << (
ctx->rawimg.bit_depth - 8);
1781 struct vpx_image *rawimg =
NULL;
1782 struct vpx_image *rawimg_alpha =
NULL;
1784 int res, coded_size;
1785 vpx_enc_frame_flags_t
flags = 0;
1786 const struct vpx_codec_enc_cfg *enccfg =
ctx->encoder.config.enc;
1787 vpx_svc_layer_id_t layer_id;
1788 int layer_id_valid = 0;
1791 if (avctx->
qmax >= 0 && enccfg->rc_max_quantizer != avctx->
qmax) {
1792 struct vpx_codec_enc_cfg
cfg = *enccfg;
1793 cfg.rc_max_quantizer = avctx->
qmax;
1794 res = vpx_codec_enc_config_set(&
ctx->encoder, &
cfg);
1795 if (res != VPX_CODEC_OK) {
1803 rawimg = &
ctx->rawimg;
1804 rawimg->planes[VPX_PLANE_Y] =
frame->data[0];
1805 rawimg->planes[VPX_PLANE_U] =
frame->data[1];
1806 rawimg->planes[VPX_PLANE_V] =
frame->data[2];
1807 rawimg->stride[VPX_PLANE_Y] =
frame->linesize[0];
1808 rawimg->stride[VPX_PLANE_U] =
frame->linesize[1];
1809 rawimg->stride[VPX_PLANE_V] =
frame->linesize[2];
1810 if (
ctx->is_alpha) {
1811 rawimg_alpha = &
ctx->rawimg_alpha;
1815 rawimg_alpha->planes[VPX_PLANE_Y] =
frame->data[3];
1816 rawimg_alpha->stride[VPX_PLANE_Y] =
frame->linesize[3];
1818 timestamp =
frame->pts;
1819#if VPX_IMAGE_ABI_VERSION >= 4
1820 switch (
frame->color_range) {
1822 rawimg->range = VPX_CR_STUDIO_RANGE;
1825 rawimg->range = VPX_CR_FULL_RANGE;
1830 flags |= VPX_EFLAG_FORCE_KF;
1831 if (
frame->metadata) {
1837 memset(&layer_id, 0,
sizeof(layer_id));
1841 layer_id.temporal_layer_id = strtoul(en->
value,
NULL, 10);
1842#ifdef VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT
1843 layer_id.temporal_layer_id_per_spatial[0] = layer_id.temporal_layer_id;
1847#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT)
1852 int ret = vpx_parse_ref_frame_config(&
ctx->ref_frame_config,
1853 enccfg->ss_number_layers, en->
value);
1856 "Error parsing ref_frame_config option %s.\n", en->
value);
1860 codecctl_intp(avctx, VP9E_SET_SVC_REF_FRAME_CONFIG, (
int *)&
ctx->ref_frame_config);
1863 "Ignoring ref-frame-config for a non-VP9 codec\n");
1886 if (enccfg->ts_number_layers > 1 &&
ctx->ts_layer_flags) {
1887 if (
flags & VPX_EFLAG_FORCE_KF) {
1889 ctx->current_temporal_idx = 0;
1890 flags = VPX_EFLAG_FORCE_KF;
1896 flags |=
ctx->ts_layer_flags[
ctx->current_temporal_idx];
1898 memset(&layer_id, 0,
sizeof(layer_id));
1899#if VPX_ENCODER_ABI_VERSION >= 12
1900 layer_id.spatial_layer_id = 0;
1902 layer_id.temporal_layer_id = enccfg->ts_layer_id[
ctx->current_temporal_idx];
1903#ifdef VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT
1904 layer_id.temporal_layer_id_per_spatial[0] = layer_id.temporal_layer_id;
1909 if (layer_id_valid) {
1911 codecctl_int(avctx, VP8E_SET_TEMPORAL_LAYER_ID, layer_id.temporal_layer_id);
1913#if CONFIG_LIBVPX_VP9_ENCODER && VPX_ENCODER_ABI_VERSION >= 12
1915 codecctl_intp(avctx, VP9E_SET_SVC_LAYER_ID, (
int *)&layer_id);
1922 "Frame duration too large: %"PRId64
"\n",
frame->duration);
1931 res = vpx_codec_encode(&
ctx->encoder, rawimg, timestamp,
1933 if (res != VPX_CODEC_OK) {
1938 if (
ctx->is_alpha) {
1939 res = vpx_codec_encode(&
ctx->encoder_alpha, rawimg_alpha, timestamp,
1941 if (res != VPX_CODEC_OK) {
1948 if (
ctx->is_alpha) {
1951 if (
ctx->coded_frame_list &&
ctx->alpha_coded_frame_list) {
1956 coded_size =
storeframe(avctx, cx_frame, alpha_cx_frame,
pkt);
1959 ctx->coded_frame_list = cx_frame->
next;
1960 ctx->alpha_coded_frame_list = alpha_cx_frame->
next;
1976 ctx->twopass_stats.sz);
1977 }
else if (enccfg->ts_number_layers > 1 &&
ctx->ts_layer_flags) {
1978 ctx->current_temporal_idx = (
ctx->current_temporal_idx + 1) % enccfg->ts_periodicity;
1981 *got_packet = !!coded_size;
1985#define OFFSET(x) offsetof(VPxContext, x)
1986#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1988#define COMMON_OPTIONS \
1989 { "lag-in-frames", "Number of frames to look ahead for " \
1990 "alternate reference frame selection", OFFSET(lag_in_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, \
1991 { "arnr-maxframes", "altref noise reduction max frame count", OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, \
1992 { "arnr-strength", "altref noise reduction filter strength", OFFSET(arnr_strength), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, \
1993 { "arnr-type", "altref noise reduction filter type", OFFSET(arnr_type), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE, .unit = "arnr_type"}, \
1994 { "backward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, VE, .unit = "arnr_type" }, \
1995 { "forward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, .unit = "arnr_type" }, \
1996 { "centered", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, .unit = "arnr_type" }, \
1997 { "tune", "Tune the encoding to a specific scenario", OFFSET(tune), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE, .unit = "tune"}, \
1998 { "psnr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VP8_TUNE_PSNR}, 0, 0, VE, .unit = "tune"}, \
1999 { "ssim", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VP8_TUNE_SSIM}, 0, 0, VE, .unit = "tune"}, \
2000 { "deadline", "Time to spend encoding, in microseconds.", OFFSET(deadline), AV_OPT_TYPE_INT, {.i64 = VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, .unit = "quality"}, \
2001 { "best", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_BEST_QUALITY}, 0, 0, VE, .unit = "quality"}, \
2002 { "good", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_GOOD_QUALITY}, 0, 0, VE, .unit = "quality"}, \
2003 { "realtime", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_REALTIME}, 0, 0, VE, .unit = "quality"}, \
2004 { "error-resilient", "Error resilience configuration", OFFSET(error_resilient), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, VE, .unit = "er"}, \
2005 { "max-intra-rate", "Maximum I-frame bitrate (pct) 0=unlimited", OFFSET(max_intra_rate), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, \
2006 { "default", "Improve resiliency against losses of whole frames", 0, AV_OPT_TYPE_CONST, {.i64 = VPX_ERROR_RESILIENT_DEFAULT}, 0, 0, VE, .unit = "er"}, \
2007 { "partitions", "The frame partitions are independently decodable " \
2008 "by the bool decoder, meaning that partitions can be decoded even " \
2009 "though earlier partitions have been lost. Note that intra prediction" \
2010 " is still done over the partition boundary.", 0, AV_OPT_TYPE_CONST, {.i64 = VPX_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, .unit = "er"}, \
2011 { "crf", "Select the quality for constant quality mode", offsetof(VPxContext, crf), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, VE }, \
2012 { "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 }, \
2013 { "drop-threshold", "Frame drop threshold", offsetof(VPxContext, drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE }, \
2014 { "noise-sensitivity", "Noise sensitivity", OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE}, \
2015 { "undershoot-pct", "Datarate undershoot (min) target (%)", OFFSET(rc_undershoot_pct), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 100, VE }, \
2016 { "overshoot-pct", "Datarate overshoot (max) target (%)", OFFSET(rc_overshoot_pct), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1000, VE }, \
2017 { "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}, \
2019#define LEGACY_OPTIONS \
2020 {"speed", "", offsetof(VPxContext, cpu_used), AV_OPT_TYPE_INT, {.i64 = 1}, -16, 16, VE}, \
2021 {"quality", "", offsetof(VPxContext, deadline), AV_OPT_TYPE_INT, {.i64 = VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, .unit = "quality"}, \
2022 {"vp8flags", "", offsetof(VPxContext, flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, UINT_MAX, VE, .unit = "flags"}, \
2023 {"error_resilient", "enable error resilience", 0, AV_OPT_TYPE_CONST, {.i64 = VP8F_ERROR_RESILIENT}, INT_MIN, INT_MAX, VE, .unit = "flags"}, \
2024 {"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, .unit = "flags"}, \
2025 {"arnr_max_frames", "altref noise reduction max frame count", offsetof(VPxContext, arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 15, VE}, \
2026 {"arnr_strength", "altref noise reduction filter strength", offsetof(VPxContext, arnr_strength), AV_OPT_TYPE_INT, {.i64 = 3}, 0, 6, VE}, \
2027 {"arnr_type", "altref noise reduction filter type", offsetof(VPxContext, arnr_type), AV_OPT_TYPE_INT, {.i64 = 3}, 1, 3, VE}, \
2028 {"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}, \
2029 {"sharpness", "Increase sharpness at the expense of lower PSNR", offsetof(VPxContext, sharpness), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 7, VE},
2031#if CONFIG_LIBVPX_VP8_ENCODER
2032static const AVOption vp8_options[] = {
2034 {
"auto-alt-ref",
"Enable use of alternate reference "
2037 {
"screen-content-mode",
"Encoder screen content mode",
OFFSET(screen_content_mode),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2,
VE},
2043#if CONFIG_LIBVPX_VP9_ENCODER
2044static const AVOption vp9_options[] = {
2046 {
"auto-alt-ref",
"Enable use of alternate reference "
2050 {
"tile-columns",
"Number of tile columns to use, log2",
OFFSET(tile_columns),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6,
VE},
2052 {
"frame-parallel",
"Enable frame parallel decodability features",
OFFSET(frame_parallel),
AV_OPT_TYPE_BOOL,{.i64 = -1}, -1, 1,
VE},
2053#if VPX_ENCODER_ABI_VERSION >= 12
2054 {
"aq-mode",
"adaptive quantization mode",
OFFSET(aq_mode),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 4,
VE, .unit =
"aq_mode"},
2056 {
"aq-mode",
"adaptive quantization mode",
OFFSET(aq_mode),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 3,
VE, .unit =
"aq_mode"},
2059 {
"variance",
"Variance based Aq", 0,
AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0,
VE, .unit =
"aq_mode" },
2060 {
"complexity",
"Complexity based Aq", 0,
AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0,
VE, .unit =
"aq_mode" },
2061 {
"cyclic",
"Cyclic Refresh Aq", 0,
AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0,
VE, .unit =
"aq_mode" },
2062#if VPX_ENCODER_ABI_VERSION >= 12
2063 {
"equator360",
"360 video Aq", 0,
AV_OPT_TYPE_CONST, {.i64 = 4}, 0, 0,
VE, .unit =
"aq_mode" },
2066#ifdef VPX_CTRL_VP9E_SET_ROW_MT
2069#ifdef VPX_CTRL_VP9E_SET_TUNE_CONTENT
2070#if VPX_ENCODER_ABI_VERSION >= 14
2071 {
"tune-content",
"Tune content type",
OFFSET(tune_content),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2,
VE, .unit =
"tune_content" },
2073 {
"tune-content",
"Tune content type",
OFFSET(tune_content),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1,
VE, .unit =
"tune_content" },
2075 {
"default",
"Regular video content", 0,
AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 0,
VE, .unit =
"tune_content" },
2076 {
"screen",
"Screen capture content", 0,
AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0,
VE, .unit =
"tune_content" },
2077#if VPX_ENCODER_ABI_VERSION >= 14
2078 {
"film",
"Film content; improves grain retention", 0,
AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0,
VE, .unit =
"tune_content" },
2081#if VPX_ENCODER_ABI_VERSION >= 14
2082 {
"corpus-complexity",
"corpus vbr complexity midpoint",
OFFSET(corpus_complexity),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 10000,
VE },
2084#ifdef VPX_CTRL_VP9E_SET_TPL
2087#ifdef VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
2088 {
"min-gf-interval",
"Minimum golden/alternate reference frame interval",
OFFSET(min_gf_interval),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
VE },
2095#undef COMMON_OPTIONS
2096#undef LEGACY_OPTIONS
2103 {
"keyint_min",
"-1" },
2107#if CONFIG_LIBVPX_VP8_ENCODER
2110 return vpx_init(avctx, vpx_codec_vp8_cx());
2113static const AVClass class_vp8 = {
2114 .class_name =
"libvpx-vp8 encoder",
2116 .option = vp8_options,
2137 .p.priv_class = &class_vp8,
2139 .p.wrapper_name =
"libvpx",
2143#if CONFIG_LIBVPX_VP9_ENCODER
2146 return vpx_init(avctx, vpx_codec_vp9_cx());
2198 vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx());
2199 if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
2200 *
out = vp9_pix_fmts_highbd;
2203 *
out = vp9_pix_fmts_highcol;
2212static const AVClass class_vp9 = {
2213 .class_name =
"libvpx-vp9 encoder",
2215 .option = vp9_options,
2220 .p.name =
"libvpx-vp9",
2228 .p.priv_class = &class_vp9,
2229 .p.wrapper_name =
"libvpx",
2239 .get_supported_config = vp9_get_supported_config,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
const FFCodec ff_libvpx_vp8_encoder
const FFCodec ff_libvpx_vp9_encoder
static const FFCodecDefault defaults[]
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_default_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, const void **out_configs, int *out_num_configs)
Libavcodec external API header.
static void BS_FUNC skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define CODEC_PIXFMTS(...)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
common internal and external API header
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
#define AV_PROFILE_UNKNOWN
int(* init)(AVBSFContext *ctx)
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
AVCPBProperties * ff_encode_add_cpb_side_data(AVCodecContext *avctx)
Add a CPB properties side data to an encoding context.
int ff_encode_add_stats_side_data(AVPacket *pkt, int quality, const int64_t error[], int error_count, enum AVPictureType pict_type)
static CheckasmStats stats
static CheckasmConfig cfg
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
#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_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_CODEC_FLAG_PSNR
error[?
#define AV_CODEC_FLAG_COPY_OPAQUE
@ AV_CODEC_CONFIG_PIX_FORMAT
AVPixelFormat, terminated by AV_PIX_FMT_NONE.
@ AV_PKT_DATA_DYNAMIC_HDR10_PLUS
HDR10+ dynamic metadata associated with a video frame.
@ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
Data found in BlockAdditional element of matroska container.
@ AV_PKT_DATA_DYNAMIC_HDR_SMPTE_2094_APP5
HDR dynamic metadata associated with a video frame.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
char * av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
Encode data to base64 and null-terminate.
#define AV_BASE64_SIZE(x)
Calculate the output size needed to base64-encode x bytes to a null-terminated string.
int av_base64_decode(uint8_t *out, const char *in_str, int out_size)
Decode a base64-encoded string.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src)
Ensure dst refers to the same data as src.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
int av_fifo_peek(const AVFifo *f, void *buf, size_t nb_elems, size_t offset)
Read data from a FIFO without modifying FIFO state.
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
void av_fifo_drain2(AVFifo *f, size_t size)
Discard the specified amount of data from an AVFifo.
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
@ AV_FRAME_DATA_DYNAMIC_HDR_SMPTE_2094_APP5
HDR dynamic metadata associated with a video frame.
@ AV_FRAME_DATA_REGIONS_OF_INTEREST
Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of array element is ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AV_ROUND_NEAR_INF
Round to nearest and halfway cases away from zero.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_P
Predicted.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
#define LIBAVUTIL_VERSION_INT
static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
static const char *const ctlidstr[]
static void set_color_range(AVCodecContext *avctx)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int vpx_free(AVCodecContext *avctx)
static int vpx_ts_param_parse(VPxContext *ctx, struct vpx_codec_enc_cfg *enccfg, char *key, char *value, enum AVCodecID codec_id)
#define VP8F_ERROR_RESILIENT
Enable measures appropriate for streaming over lossy links.
static int queue_frames(AVCodecContext *avctx, struct vpx_codec_ctx *encoder, struct FrameListData **frame_list, AVPacket *pkt_out)
Queue multiple output frames from the encoder, returning the front-most.
#define VP8F_AUTO_ALT_REF
Enable automatic alternate reference frame generation.
static av_cold void fifo_free(AVFifo **fifo)
static av_cold int vpx_init(AVCodecContext *avctx, const struct vpx_codec_iface *iface)
static int frame_data_apply(AVCodecContext *avctx, AVFifo *fifo, AVPacket *pkt)
static av_cold void dump_enc_cfg(AVCodecContext *avctx, const struct vpx_codec_enc_cfg *cfg, int level)
static av_cold void free_coded_frame(struct FrameListData *cx_frame)
static void set_temporal_layer_pattern(int layering_mode, vpx_codec_enc_cfg_t *cfg, int *layer_flags, int *flag_periodicity)
static int vp9_encode_set_roi(AVCodecContext *avctx, int frame_width, int frame_height, const AVFrameSideData *sd)
static av_cold int vpx_free(AVCodecContext *avctx)
static void set_vpx_defaults(AVCodecContext *avctx, struct vpx_codec_enc_cfg *enccfg)
Called when the bitrate is not set.
static int encoder_can_drop_frames(AVCodecContext *avctx)
static int set_roi_map(AVCodecContext *avctx, const AVFrameSideData *sd, int frame_width, int frame_height, vpx_roi_map_t *roi_map, int block_size, int segment_cnt)
static void frame_data_uninit(FrameData *fd)
static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, const AVFrame *frame)
static void set_vp8_defaults(AVCodecContext *avctx, struct vpx_codec_enc_cfg *enccfg)
Set the target bitrate to VPX library default.
static int realloc_alpha_uv(AVCodecContext *avctx, int width, int height)
static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, struct FrameListData *alpha_cx_frame, AVPacket *pkt)
Store coded frame information in format suitable for return from encode2().
static void vp8_ts_parse_int_array(int *dest, char *value, size_t value_len, int max_entries)
static int vp8_encode_set_roi(AVCodecContext *avctx, int frame_width, int frame_height, const AVFrameSideData *sd)
static void cx_pktcpy(struct FrameListData *dst, const struct vpx_codec_cx_pkt *src, VPxContext *ctx)
static void coded_frame_add(void *list, struct FrameListData *cx_frame)
static av_cold void log_encoder_error(void *logctx, struct vpx_codec_ctx *encoder, const char *desc)
static av_cold void free_frame_list(struct FrameListData *list)
static av_cold int codecctl_int(AVCodecContext *avctx, enum vp8e_enc_control_id id, int val)
static const struct @257111027162314367033347246032313251342043035002 planes[]
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
static int sse(const MPVEncContext *const s, const uint8_t *src1, const uint8_t *src2, int w, int h, int stride)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV440P12
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_JPEG
Full range content.
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUVA422P10
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
#define AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_GBRAP10
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUV444P10
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
@ AVCOL_SPC_RESERVED
reserved for future use by ITU-T and ISO/IEC just like 15-255 are
const AVProfile ff_vp9_profiles[]
static av_cold int vp9_init(AVFormatContext *ctx, int st_index, PayloadContext *data)
#define FF_ARRAY_ELEMS(a)
A reference to a data buffer.
uint8_t * data
The data buffer.
size_t size
Size of data in bytes.
This structure describes the bitrate properties of an encoded bitstream.
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
Describe the class of an AVClass context structure.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
char * stats_out
pass1 encoding statistics output buffer
int rc_buffer_size
decoder bitstream buffer size
enum AVColorRange color_range
MPEG vs JPEG YUV range.
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
int qmin
minimum quantizer
int keyint_min
minimum GOP size
char * stats_in
pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed he...
int64_t bit_rate
the average bitrate
int rc_initial_buffer_occupancy
Number of bits which should be loaded into the rc buffer before decoding starts.
enum AVColorSpace colorspace
YUV colorspace type.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
int64_t rc_max_rate
maximum bitrate
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
int qmax
maximum quantizer
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int flags
AV_CODEC_FLAG_*.
int64_t rc_min_rate
minimum bitrate
uint64_t error[AV_NUM_DATA_POINTERS]
error
float qcompress
amount of qscale change between easy & hard scenes (0.0-1.0)
int slices
Number of slices.
Structure to hold side data for an AVFrame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Structure describing a single Region Of Interest.
uint32_t self_size
Must be set to the size of this data structure (that is, sizeof(AVRegionOfInterest)).
AVRational qoffset
Quantisation offset.
int top
Distance in pixels from the top edge of the frame to the top and bottom edges and from the left edge ...
AVBufferRef * hdr_smpte2094_app5
AVBufferRef * frame_opaque_ref
Portion of struct vpx_codec_cx_pkt from vpx_encoder.h.
int64_t pts
time stamp to show frame (in timebase units)
struct FrameListData * next
size_t sz
length of compressed data
void * buf
compressed data buffer
int have_sse
true if we have pending sse[]
uint32_t flags
flags for this frame
unsigned twopass_stats_size
struct vpx_codec_ctx encoder_alpha
struct vpx_fixed_buf twopass_stats
struct vpx_image rawimg_alpha
struct vpx_codec_ctx encoder
int roi_warned
If the driver does not support ROI then warn the first time we encounter a frame with ROI side data.
AVDictionary * vpx_ts_parameters
struct FrameListData * alpha_coded_frame_list
int have_sse
true if we have pending sse[]
struct FrameListData * coded_frame_list
int flags
VP8 specific flags, see VP8F_* below.
#define av_malloc_array(a, b)
static void error(const char *err)
static const uint8_t quality[]