summaryrefslogtreecommitdiffstats
path: root/libavcodec/libvpx.c
diff options
context:
space:
mode:
authorDeb Mukherjee <debargha@google.com>2015-03-25 17:10:16 -0700
committerJames Zern <jzern@google.com>2015-04-20 15:24:13 -0700
commit26a0bcb15b83c926eb2688b145900a94ca851a26 (patch)
tree5d76d1ecc36a9357ef4a9dec8f81a2641ca5b473 /libavcodec/libvpx.c
parente6e8cc8ce9c2a398fbb51254a5067f4bd3c4fa8a (diff)
downloadffmpeg-streaming-26a0bcb15b83c926eb2688b145900a94ca851a26.zip
ffmpeg-streaming-26a0bcb15b83c926eb2688b145900a94ca851a26.tar.gz
Support for VP9 high-color/high-bit-depth encoding
Patch to support VP9 encoding with new profiles 1-3. Profile 1 (8-bit 422/444) should work with default libvpx configuration. However you will need to configure libvpx with --enable-vp9-highbitdepth before building and linking with ffmpeg for profile 2 (10-/12-bit 420) and profile 3 (10-/12-bit 422/444) encoding. You may use the appropriate profile option on the command line: -profile:v 1 for 422/444 8-bit encoding -profile:v 2 for 420 10-/12- bit encoding -profile:v 3 for 422/444 10-/12-bit encoding If you do not use the -profile:v option, it will be deduced from the source format. Signed-off-by: James Zern <jzern@google.com>
Diffstat (limited to 'libavcodec/libvpx.c')
-rw-r--r--libavcodec/libvpx.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
index 5d29893..b432fe9 100644
--- a/libavcodec/libvpx.c
+++ b/libavcodec/libvpx.c
@@ -19,12 +19,57 @@
*/
#include <vpx/vpx_codec.h>
-
#include "libvpx.h"
+#include "config.h"
+
+#if CONFIG_LIBVPX_VP9_ENCODER
+#include <vpx/vpx_encoder.h>
+#include <vpx/vp8cx.h>
+#endif
+
+static const enum AVPixelFormat vp9_pix_fmts_def[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_NONE
+};
+
+#if CONFIG_LIBVPX_VP9_ENCODER
+static const enum AVPixelFormat vp9_pix_fmts_highcol[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat vp9_pix_fmts_highbd[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUV420P10LE,
+ AV_PIX_FMT_YUV422P10LE,
+ AV_PIX_FMT_YUV444P10LE,
+ AV_PIX_FMT_YUV420P12LE,
+ AV_PIX_FMT_YUV422P12LE,
+ AV_PIX_FMT_YUV444P12LE,
+ AV_PIX_FMT_NONE
+};
+#endif
av_cold void ff_vp9_init_static(AVCodec *codec)
{
if ( vpx_codec_version_major() < 1
|| (vpx_codec_version_major() == 1 && vpx_codec_version_minor() < 3))
codec->capabilities |= CODEC_CAP_EXPERIMENTAL;
+ codec->pix_fmts = vp9_pix_fmts_def;
+#if CONFIG_LIBVPX_VP9_ENCODER
+ if ( vpx_codec_version_major() > 1
+ || (vpx_codec_version_major() == 1 && vpx_codec_version_minor() >= 4)) {
+#ifdef VPX_CODEC_CAP_HIGHBITDEPTH
+ vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx());
+ if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH)
+ codec->pix_fmts = vp9_pix_fmts_highbd;
+ else
+#endif
+ codec->pix_fmts = vp9_pix_fmts_highcol;
+ }
+#endif
}
OpenPOWER on IntegriCloud