Commit 8eeed0db authored by James Zern's avatar James Zern Committed by Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent a299a261
...@@ -2910,8 +2910,8 @@ enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lv ...@@ -2910,8 +2910,8 @@ enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lv
enabled libvpx && { enabled libvpx && {
enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || 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"; } 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 || 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.1"; } } die "ERROR: libvpx encoder version must be >=0.9.6"; } }
enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
{ check_cpp_condition x264.h "X264_BUILD >= 99" || { check_cpp_condition x264.h "X264_BUILD >= 99" ||
die "ERROR: libx264 version must be >= 0.99."; } die "ERROR: libx264 version must be >= 0.99."; }
......
...@@ -72,6 +72,7 @@ static const char *ctlidstr[] = { ...@@ -72,6 +72,7 @@ static const char *ctlidstr[] = {
[VP8E_SET_ARNR_MAXFRAMES] = "VP8E_SET_ARNR_MAXFRAMES", [VP8E_SET_ARNR_MAXFRAMES] = "VP8E_SET_ARNR_MAXFRAMES",
[VP8E_SET_ARNR_STRENGTH] = "VP8E_SET_ARNR_STRENGTH", [VP8E_SET_ARNR_STRENGTH] = "VP8E_SET_ARNR_STRENGTH",
[VP8E_SET_ARNR_TYPE] = "VP8E_SET_ARNR_TYPE", [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) static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
...@@ -234,6 +235,8 @@ static av_cold int vp8_init(AVCodecContext *avctx) ...@@ -234,6 +235,8 @@ static av_cold int vp8_init(AVCodecContext *avctx)
if (avctx->rc_min_rate == avctx->rc_max_rate && if (avctx->rc_min_rate == avctx->rc_max_rate &&
avctx->rc_min_rate == avctx->bit_rate) avctx->rc_min_rate == avctx->bit_rate)
enccfg.rc_end_usage = VPX_CBR; 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, enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
AV_ROUND_NEAR_INF); AV_ROUND_NEAR_INF);
...@@ -312,6 +315,7 @@ static av_cold int vp8_init(AVCodecContext *avctx) ...@@ -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_NOISE_SENSITIVITY, avctx->noise_reduction);
codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices)); 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_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() //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, vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1,
......
...@@ -367,7 +367,7 @@ static const AVOption options[]={ ...@@ -367,7 +367,7 @@ static const AVOption options[]={
{"all" , NULL, 0, FF_OPT_TYPE_CONST, AVDISCARD_ALL , INT_MIN, INT_MAX, V|D, "avdiscard"}, {"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}, {"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}, {"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}, {"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}, {"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}, {"refs", "reference frames to consider for motion compensation (Snow)", OFFSET(refs), FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment