diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2015-06-11 16:56:31 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-06-21 16:27:18 +0300 |
commit | 8655c54160767de1a6b96f8bc310d6e4eaceff48 (patch) | |
tree | b3804040d919fb5a124323c01977e1f57e800181 /libavcodec/libvpxenc.c | |
parent | 05bf3f54e6078716f6267df530bf1d474ca3d606 (diff) | |
download | ffmpeg-8655c54160767de1a6b96f8bc310d6e4eaceff48.tar.gz |
libvpx: Support the vp9 extended profiles
Bump the minimum libvpx version to 1.3.0 and rework the configure logic
to fail only if no decoders and encoders are found.
Based on the original patch from Vittorio.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r-- | libavcodec/libvpxenc.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 0f4bd61239..f690de145c 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -220,7 +220,7 @@ static av_cold int vpx_init(AVCodecContext *avctx, const struct vpx_codec_iface *iface) { VP8Context *ctx = avctx->priv_data; - struct vpx_codec_enc_cfg enccfg; + struct vpx_codec_enc_cfg enccfg = { 0 }; int res; av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str()); @@ -321,8 +321,12 @@ static av_cold int vpx_init(AVCodecContext *avctx, /* 0-3: For non-zero values the encoder increasingly optimizes for reduced complexity playback on low powered devices at the expense of encode quality. */ - if (avctx->profile != FF_PROFILE_UNKNOWN) - enccfg.g_profile = avctx->profile; + if (avctx->profile != FF_PROFILE_UNKNOWN) + enccfg.g_profile = avctx->profile; + else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) + avctx->profile = enccfg.g_profile = FF_PROFILE_VP9_0; + else + avctx->profile = enccfg.g_profile = FF_PROFILE_VP9_1; enccfg.g_error_resilient = ctx->error_resilient; @@ -364,8 +368,8 @@ static av_cold int vpx_init(AVCodecContext *avctx, codecctl_int(avctx, VP8E_SET_CQ_LEVEL, ctx->crf); //provide dummy value to initialize wrapper, values will be updated each _encode() - vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1, - (unsigned char*)1); + vpx_img_wrap(&ctx->rawimg, ff_vpx_pixfmt_to_imgfmt(avctx->pix_fmt), + avctx->width, avctx->height, 1, (unsigned char *)1); avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { @@ -623,9 +627,6 @@ AVCodec ff_libvpx_vp8_encoder = { #if CONFIG_LIBVPX_VP9_ENCODER static av_cold int vp9_init(AVCodecContext *avctx) { - int ret; - if ((ret = ff_vp9_check_experimental(avctx))) - return ret; return vpx_init(avctx, &vpx_codec_vp9_cx_algo); } @@ -636,6 +637,14 @@ static const AVClass class_vp9 = { .version = LIBAVUTIL_VERSION_INT, }; +static const AVProfile profiles[] = { + { FF_PROFILE_VP9_0, "Profile 0" }, + { FF_PROFILE_VP9_1, "Profile 1" }, + { FF_PROFILE_VP9_2, "Profile 2" }, + { FF_PROFILE_VP9_3, "Profile 3" }, + { FF_PROFILE_UNKNOWN }, +}; + AVCodec ff_libvpx_vp9_encoder = { .name = "libvpx-vp9", .long_name = NULL_IF_CONFIG_SMALL("libvpx VP9"), @@ -646,7 +655,16 @@ AVCodec ff_libvpx_vp9_encoder = { .encode2 = vp8_encode, .close = vp8_free, .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS, - .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, + .pix_fmts = (const enum AVPixelFormat[]) { + AV_PIX_FMT_YUV420P, +#if VPX_IMAGE_ABI_VERSION >= 3 + AV_PIX_FMT_YUV422P, + AV_PIX_FMT_YUV444P, + AV_PIX_FMT_YUV440P, +#endif + AV_PIX_FMT_NONE, + }, + .profiles = NULL_IF_CONFIG_SMALL(profiles), .priv_class = &class_vp9, .defaults = defaults, }; |