summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2012-06-09 14:40:51 -0700
committerMichael Niedermayer <michaelni@gmx.at>2012-06-10 01:18:42 +0200
commit695e85f1895da2faf7dbc68ab8bf20add1562eed (patch)
treedfdd557994090684718a678f08af33657b8edc07
parent53dfc3845220a13dd969f9dd31e6938b2565e003 (diff)
libvpxenc: add VP8E_SET_MAX_INTRA_BITRATE_PCT mapping
defines 'max-intra-rate' in line with vpxenc param Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rwxr-xr-xconfigure4
-rw-r--r--libavcodec/libvpxenc.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/configure b/configure
index 7a60f29f43..673645faf1 100755
--- a/configure
+++ b/configure
@@ -3229,8 +3229,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 VPX_CQ" -lvpx ||
- die "ERROR: libvpx encoder version must be >=0.9.6"; } }
+ enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
+ die "ERROR: libvpx encoder version must be >=0.9.7"; } }
enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
{ check_cpp_condition x264.h "X264_BUILD >= 118" ||
die "ERROR: libx264 version must be >= 0.118."; }
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 58a44ec497..b3ec17d1ce 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -74,6 +74,7 @@ typedef struct VP8EncoderContext {
int lag_in_frames;
int error_resilient;
int crf;
+ int max_intra_rate;
} VP8Context;
/** String mappings for enum vp8e_enc_control_id */
@@ -95,6 +96,7 @@ static const char *const ctlidstr[] = {
[VP8E_SET_ARNR_STRENGTH] = "VP8E_SET_ARNR_STRENGTH",
[VP8E_SET_ARNR_TYPE] = "VP8E_SET_ARNR_TYPE",
[VP8E_SET_CQ_LEVEL] = "VP8E_SET_CQ_LEVEL",
+ [VP8E_SET_MAX_INTRA_BITRATE_PCT] = "VP8E_SET_MAX_INTRA_BITRATE_PCT",
};
static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -353,6 +355,8 @@ static av_cold int vp8_init(AVCodecContext *avctx)
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, ctx->crf);
+ if (ctx->max_intra_rate >= 0)
+ codecctl_int(avctx, VP8E_SET_MAX_INTRA_BITRATE_PCT, ctx->max_intra_rate);
av_log(avctx, AV_LOG_DEBUG, "Using deadline: %d\n", ctx->deadline);
@@ -556,6 +560,7 @@ static const AVOption options[] = {
{ "good", NULL, 0, AV_OPT_TYPE_CONST, {VPX_DL_GOOD_QUALITY}, 0, 0, VE, "quality"},
{ "realtime", NULL, 0, AV_OPT_TYPE_CONST, {VPX_DL_REALTIME}, 0, 0, VE, "quality"},
{ "error-resilient", "Error resilience configuration", OFFSET(error_resilient), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, VE, "er"},
+ { "max-intra-rate", "Maximum I-frame bitrate (pct) 0=unlimited", OFFSET(max_intra_rate), AV_OPT_TYPE_INT, {-1}, -1, INT_MAX, VE},
#ifdef VPX_ERROR_RESILIENT_DEFAULT
{ "default", "Improve resiliency against losses of whole frames", 0, AV_OPT_TYPE_CONST, {VPX_ERROR_RESILIENT_DEFAULT}, 0, 0, VE, "er"},
{ "partitions", "The frame partitions are independently decodable "