mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-11 06:58:18 +00:00
avcodec/libvpxenc: Apply codec options to alpha codec context
When encoding yuva420 (alpha) frames, the vpx encoder uses a second vpx_codec_ctx to encode the alpha stream. However, codec options were only being applied to the primary encoder. This patch updates codecctl_int and codecctl_intp to also apply codec options to the alpha codec context when encoding frames with alpha. This is necessary to take advantage of libvpx speed optimizations such as 'row-mt' and 'cpu-used' when encoding videos with alpha. Without this patch, the speed optimizations are only applied to the primary stream encoding, and the overall encoding is just as slow as it would be without the options specified. Signed-off-by: Adam Chelminski <chelminski.adam@gmail.com> Signed-off-by: James Zern <jzern@google.com>
This commit is contained in:
parent
3008a93b4d
commit
715f63232f
@ -385,9 +385,20 @@ static av_cold int codecctl_int(AVCodecContext *avctx,
|
||||
snprintf(buf, sizeof(buf), "Failed to set %s codec control",
|
||||
ctlidstr[id]);
|
||||
log_encoder_error(avctx, buf);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
return res == VPX_CODEC_OK ? 0 : AVERROR(EINVAL);
|
||||
if (ctx->is_alpha) {
|
||||
int res_alpha = vpx_codec_control(&ctx->encoder_alpha, id, val);
|
||||
if (res_alpha != VPX_CODEC_OK) {
|
||||
snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control",
|
||||
ctlidstr[id]);
|
||||
log_encoder_error(avctx, buf);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if VPX_ENCODER_ABI_VERSION >= 12
|
||||
@ -407,9 +418,20 @@ static av_cold int codecctl_intp(AVCodecContext *avctx,
|
||||
snprintf(buf, sizeof(buf), "Failed to set %s codec control",
|
||||
ctlidstr[id]);
|
||||
log_encoder_error(avctx, buf);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
return res == VPX_CODEC_OK ? 0 : AVERROR(EINVAL);
|
||||
if (ctx->is_alpha) {
|
||||
int res_alpha = vpx_codec_control(&ctx->encoder_alpha, id, val);
|
||||
if (res_alpha != VPX_CODEC_OK) {
|
||||
snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control",
|
||||
ctlidstr[id]);
|
||||
log_encoder_error(avctx, buf);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 59
|
||||
#define LIBAVCODEC_VERSION_MINOR 7
|
||||
#define LIBAVCODEC_VERSION_MICRO 102
|
||||
#define LIBAVCODEC_VERSION_MICRO 103
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
LIBAVCODEC_VERSION_MINOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user