summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-05-27 08:05:53 -0600
committerJohn Stebbins <[email protected]>2016-05-27 13:53:16 -0600
commitfe32414aef3a21fc7f42b38cc1f8eea8a62476a3 (patch)
tree6273f6cd63bee65f02555c825d3915aed2337f1f
parent9ec150b5461cc59eda93c5d3b3199fd97809972d (diff)
enable libvpx VP9 encoder
-rw-r--r--contrib/ffmpeg/module.defs2
-rw-r--r--contrib/libvpx/module.defs3
-rw-r--r--gtk/src/callbacks.c1
-rw-r--r--gtk/src/makedeps.py4
-rw-r--r--libhb/common.c5
-rw-r--r--libhb/common.h1
-rw-r--r--libhb/encavcodec.c7
-rw-r--r--libhb/muxavformat.c6
-rw-r--r--libhb/work.c4
9 files changed, 29 insertions, 4 deletions
diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs
index 4360cdf6b..6b0a73c51 100644
--- a/contrib/ffmpeg/module.defs
+++ b/contrib/ffmpeg/module.defs
@@ -43,6 +43,8 @@ FFMPEG.CONFIGURE.extra = \
--enable-libvpx \
--enable-encoder=libvpx_vp8 \
--disable-decoder=libvpx_vp8 \
+ --enable-encoder=libvpx_vp9 \
+ --disable-decoder=libvpx_vp9 \
--enable-zlib \
--enable-bzlib \
--cc="$(FFMPEG.GCC.gcc)" \
diff --git a/contrib/libvpx/module.defs b/contrib/libvpx/module.defs
index a0a249f64..351179f65 100644
--- a/contrib/libvpx/module.defs
+++ b/contrib/libvpx/module.defs
@@ -13,7 +13,8 @@ LIBVPX.CONFIGURE.args.host =
LIBVPX.CONFIGURE.deps =
LIBVPX.CONFIGURE.extra = \
--enable-vp8-encoder \
- --disable-vp9 \
+ --enable-vp9-encoder \
+ --disable-vp9-decoder \
--disable-vp8-decoder \
--disable-examples \
--disable-docs \
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index e55441996..1b2e9b8c1 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -5178,6 +5178,7 @@ format_vquality_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
case HB_VCODEC_FFMPEG_MPEG4:
case HB_VCODEC_FFMPEG_MPEG2:
case HB_VCODEC_FFMPEG_VP8:
+ case HB_VCODEC_FFMPEG_VP9:
case HB_VCODEC_THEORA:
{
return g_strdup_printf("%s: %d", vqname, (int)val);
diff --git a/gtk/src/makedeps.py b/gtk/src/makedeps.py
index fa6463e1d..3641b79e8 100644
--- a/gtk/src/makedeps.py
+++ b/gtk/src/makedeps.py
@@ -57,8 +57,8 @@ dep_map = (
DepEntry("VideoEncoder", "x264FastDecode", "x264|x264_10bit", False, True),
DepEntry("VideoEncoder", "x264UseAdvancedOptions", "x264|x264_10bit", False, True),
DepEntry("HideAdvancedVideoSettings", "x264UseAdvancedOptions", "1", True, True),
- DepEntry("VideoEncoder", "VideoOptionExtraWindow", "x264|x264_10bit|x265|x265_10bit|x265_12bit|x265_16bit|mpeg4|mpeg2|VP8", False, True),
- DepEntry("VideoEncoder", "VideoOptionExtraLabel", "x264|x264_10bit|x265|x265_10bit|x265_12bit|x265_16bit|mpeg4|mpeg2|VP8", False, True),
+ DepEntry("VideoEncoder", "VideoOptionExtraWindow", "x264|x264_10bit|x265|x265_10bit|x265_12bit|x265_16bit|mpeg4|mpeg2|VP8|VP9", False, True),
+ DepEntry("VideoEncoder", "VideoOptionExtraLabel", "x264|x264_10bit|x265|x265_10bit|x265_12bit|x265_16bit|mpeg4|mpeg2|VP8|VP9", False, True),
DepEntry("x264UseAdvancedOptions", "VideoSettingsTable", "1", True, False),
DepEntry("VideoEncoder", "x264_box", "x264|x264_10bit", False, True),
DepEntry("x264UseAdvancedOptions", "x264_box", "0", True, False),
diff --git a/libhb/common.c b/libhb/common.c
index 32e0bc49a..c6a272cae 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -46,6 +46,7 @@ enum
HB_GID_VCODEC_MPEG4,
HB_GID_VCODEC_THEORA,
HB_GID_VCODEC_VP8,
+ HB_GID_VCODEC_VP9,
HB_GID_ACODEC_AAC,
HB_GID_ACODEC_AAC_HE,
HB_GID_ACODEC_AAC_PASS,
@@ -240,6 +241,7 @@ hb_encoder_internal_t hb_video_encoders[] =
{ { "MPEG-4", "mpeg4", "MPEG-4 (libavcodec)", HB_VCODEC_FFMPEG_MPEG4, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_MPEG4, },
{ { "MPEG-2", "mpeg2", "MPEG-2 (libavcodec)", HB_VCODEC_FFMPEG_MPEG2, HB_MUX_MASK_MP4|HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_MPEG2, },
{ { "VP8", "VP8", "VP8 (libvpx)", HB_VCODEC_FFMPEG_VP8, HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_VP8, },
+ { { "VP9", "VP9", "VP9 (libvpx)", HB_VCODEC_FFMPEG_VP9, HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_VP9, },
{ { "Theora", "theora", "Theora (libtheora)", HB_VCODEC_THEORA, HB_MUX_MASK_MKV, }, NULL, 1, HB_GID_VCODEC_THEORA, },
};
int hb_video_encoders_count = sizeof(hb_video_encoders) / sizeof(hb_video_encoders[0]);
@@ -258,6 +260,7 @@ static int hb_video_encoder_is_enabled(int encoder)
case HB_VCODEC_FFMPEG_MPEG4:
case HB_VCODEC_FFMPEG_MPEG2:
case HB_VCODEC_FFMPEG_VP8:
+ case HB_VCODEC_FFMPEG_VP9:
return 1;
#ifdef USE_X265
@@ -1258,6 +1261,7 @@ void hb_video_quality_get_limits(uint32_t codec, float *low, float *high,
break;
case HB_VCODEC_FFMPEG_VP8:
+ case HB_VCODEC_FFMPEG_VP9:
*direction = 1;
*granularity = 1.;
*low = 0.;
@@ -1295,6 +1299,7 @@ const char* hb_video_quality_get_name(uint32_t codec)
return "RF";
case HB_VCODEC_FFMPEG_VP8:
+ case HB_VCODEC_FFMPEG_VP9:
return "CQ";
default:
diff --git a/libhb/common.h b/libhb/common.h
index 1b4cbc3fe..92cc1dadf 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -494,6 +494,7 @@ struct hb_job_s
#define HB_VCODEC_FFMPEG_MPEG4 0x0000010
#define HB_VCODEC_FFMPEG_MPEG2 0x0000020
#define HB_VCODEC_FFMPEG_VP8 0x0000040
+#define HB_VCODEC_FFMPEG_VP9 0x0000080
#define HB_VCODEC_FFMPEG_MASK 0x00000F0
#define HB_VCODEC_QSV_H264 0x0000100
#define HB_VCODEC_QSV_H265 0x0000200
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c
index 59c787326..677f8a22e 100644
--- a/libhb/encavcodec.c
+++ b/libhb/encavcodec.c
@@ -87,6 +87,10 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job )
{
hb_log("encavcodecInit: VP8 encoder");
} break;
+ case AV_CODEC_ID_VP9:
+ {
+ hb_log("encavcodecInit: VP9 encoder");
+ } break;
default:
{
hb_error("encavcodecInit: unsupported encoder!");
@@ -201,7 +205,8 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job )
context->flags |= CODEC_FLAG_QSCALE;
context->global_quality = FF_QP2LAMBDA * job->vquality + 0.5;
//Set constant quality for libvpx
- if ( w->codec_param == AV_CODEC_ID_VP8 )
+ if ( w->codec_param == AV_CODEC_ID_VP8 ||
+ w->codec_param == AV_CODEC_ID_VP9 )
{
char quality[7];
snprintf(quality, 7, "%.2f", job->vquality);
diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c
index 0a69d83f8..b7533d4dc 100644
--- a/libhb/muxavformat.c
+++ b/libhb/muxavformat.c
@@ -290,6 +290,12 @@ static int avformatInit( hb_mux_object_t * m )
priv_size = 0;
break;
+ case HB_VCODEC_FFMPEG_VP9:
+ track->st->codec->codec_id = AV_CODEC_ID_VP9;
+ priv_data = NULL;
+ priv_size = 0;
+ break;
+
case HB_VCODEC_THEORA:
{
track->st->codec->codec_id = AV_CODEC_ID_THEORA;
diff --git a/libhb/work.c b/libhb/work.c
index 00573fce1..d318fe447 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -215,6 +215,10 @@ hb_work_object_t* hb_video_encoder(hb_handle_t *h, int vcodec)
w = hb_get_work(h, WORK_ENCAVCODEC);
w->codec_param = AV_CODEC_ID_VP8;
break;
+ case HB_VCODEC_FFMPEG_VP9:
+ w = hb_get_work(h, WORK_ENCAVCODEC);
+ w->codec_param = AV_CODEC_ID_VP9;
+ break;
case HB_VCODEC_X264_8BIT:
case HB_VCODEC_X264_10BIT:
w = hb_get_work(h, WORK_ENCX264);