diff options
author | James Zern <jzern@google.com> | 2011-04-11 17:00:35 -0700 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-12 03:54:28 +0200 |
commit | 8eeed0db05966e94bfff53b2010b8c7d4e52e3f9 (patch) | |
tree | b101ba746167b11ec948958fd1af9542dfefdbf8 | |
parent | a299a261de798ddc694111e539c32f0413a02bd8 (diff) | |
download | ffmpeg-8eeed0db05966e94bfff53b2010b8c7d4e52e3f9.tar.gz |
vpxenc: add CQ_LEVEL mapping
via the equivalent AVCodecContext::crf modifying the range allowed by
options.c (0-51 -> 0-63)
update configure check to require libvpx 0.9.6 (Bali)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rwxr-xr-x | configure | 4 | ||||
-rw-r--r-- | libavcodec/libvpxenc.c | 4 | ||||
-rw-r--r-- | libavcodec/options.c | 2 |
3 files changed, 7 insertions, 3 deletions
@@ -2910,8 +2910,8 @@ enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lv enabled libvpx && { enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || die "ERROR: libvpx decoder version must be >=0.9.1"; } - enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx || - die "ERROR: libvpx encoder version must be >=0.9.1"; } } + enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx || + die "ERROR: libvpx encoder version must be >=0.9.6"; } } enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && { check_cpp_condition x264.h "X264_BUILD >= 99" || die "ERROR: libx264 version must be >= 0.99."; } diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 8097b67bf2..1cdac740b4 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -72,6 +72,7 @@ static const char *ctlidstr[] = { [VP8E_SET_ARNR_MAXFRAMES] = "VP8E_SET_ARNR_MAXFRAMES", [VP8E_SET_ARNR_STRENGTH] = "VP8E_SET_ARNR_STRENGTH", [VP8E_SET_ARNR_TYPE] = "VP8E_SET_ARNR_TYPE", + [VP8E_SET_CQ_LEVEL] = "VP8E_SET_CQ_LEVEL", }; static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) @@ -234,6 +235,8 @@ static av_cold int vp8_init(AVCodecContext *avctx) if (avctx->rc_min_rate == avctx->rc_max_rate && avctx->rc_min_rate == avctx->bit_rate) enccfg.rc_end_usage = VPX_CBR; + else if (avctx->crf) + enccfg.rc_end_usage = VPX_CQ; enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000, AV_ROUND_NEAR_INF); @@ -312,6 +315,7 @@ static av_cold int vp8_init(AVCodecContext *avctx) codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction); codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices)); codecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD, avctx->mb_threshold); + codecctl_int(avctx, VP8E_SET_CQ_LEVEL, (int)avctx->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, diff --git a/libavcodec/options.c b/libavcodec/options.c index 404398fed6..c749f437d7 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -367,7 +367,7 @@ static const AVOption options[]={ {"all" , NULL, 0, FF_OPT_TYPE_CONST, AVDISCARD_ALL , INT_MIN, INT_MAX, V|D, "avdiscard"}, {"bidir_refine", "refine the two motion vectors used in bidirectional macroblocks", OFFSET(bidir_refine), FF_OPT_TYPE_INT, 1, 0, 4, V|E}, {"brd_scale", "downscales frames for dynamic B-frame decision", OFFSET(brd_scale), FF_OPT_TYPE_INT, DEFAULT, 0, 10, V|E}, -{"crf", "enables constant quality mode, and selects the quality (x264)", OFFSET(crf), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 51, V|E}, +{"crf", "enables constant quality mode, and selects the quality (x264/VP8)", OFFSET(crf), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 63, V|E}, {"cqp", "constant quantization parameter rate control method", OFFSET(cqp), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, V|E}, {"keyint_min", "minimum interval between IDR-frames (x264)", OFFSET(keyint_min), FF_OPT_TYPE_INT, 25, INT_MIN, INT_MAX, V|E}, {"refs", "reference frames to consider for motion compensation (Snow)", OFFSET(refs), FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E}, |