aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorWonkap Jang <wonkap-at-google.com@ffmpeg.org>2020-02-10 10:30:09 -0800
committerJames Zern <jzern@google.com>2020-02-11 11:55:36 -0800
commitf3bb59209f255aa0376937edbee48c2ac7782dc6 (patch)
treefb7c80d627bd897b1e3139e7175e6d538b238a86 /libavcodec
parentcf92f42672b1d696e0a17dbb9cda56b6a80c1466 (diff)
downloadffmpeg-f3bb59209f255aa0376937edbee48c2ac7782dc6.tar.gz
avcodec/libvpxenc: add a way to explicitly set temporal layer id
In order for rate control to correctly allocate bitrate to each temporal layer, correct temporal layer id has to be set to each frame. This commit provides the ability to set correct temporal layer id for each frame. Signed-off-by: James Zern <jzern@google.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libvpxenc.c13
-rw-r--r--libavcodec/version.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index d522c43928..60a858853d 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1519,11 +1519,22 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
#endif
if (frame->pict_type == AV_PICTURE_TYPE_I)
flags |= VPX_EFLAG_FORCE_KF;
- if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8 && frame->metadata) {
+ if (frame->metadata) {
AVDictionaryEntry* en = av_dict_get(frame->metadata, "vp8-flags", NULL, 0);
if (en) {
flags |= strtoul(en->value, NULL, 10);
}
+
+ memset(&layer_id, 0, sizeof(layer_id));
+
+ en = av_dict_get(frame->metadata, "temporal_id", NULL, 0);
+ if (en) {
+ layer_id.temporal_layer_id = strtoul(en->value, NULL, 10);
+#ifdef VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT
+ layer_id.temporal_layer_id_per_spatial[0] = layer_id.temporal_layer_id;
+#endif
+ layer_id_valid = 1;
+ }
}
if (sd) {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index bc6630ea42..6bf2a05145 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 68
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \