diff options
author | Sasi Inguva <isasi@google.com> | 2016-01-09 12:48:49 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2016-01-09 12:51:34 -0300 |
commit | cbcc88c0393f15512cbf06b895f3f58210376614 (patch) | |
tree | 25475e8c57f80e8ff8936058c6a4325e26c81fe1 /libavcodec/libvpxenc.c | |
parent | 2039b3e7511ef183dae206575114e15b6d99c134 (diff) | |
download | ffmpeg-cbcc88c0393f15512cbf06b895f3f58210376614.tar.gz |
libvpx: Support setting color range for vp9.
Pass through color range to vp9 encoder. Parse color range in libvpxdec.c.
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r-- | libavcodec/libvpxenc.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index edb842a55e..99c3f95699 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -125,6 +125,9 @@ static const char *const ctlidstr[] = { #if VPX_ENCODER_ABI_VERSION > 8 [VP9E_SET_COLOR_SPACE] = "VP9E_SET_COLOR_SPACE", #endif +#if VPX_ENCODER_ABI_VERSION >= 11 + [VP9E_SET_COLOR_RANGE] = "VP9E_SET_COLOR_RANGE", +#endif #endif }; @@ -368,6 +371,24 @@ static void set_colorspace(AVCodecContext *avctx) codecctl_int(avctx, VP9E_SET_COLOR_SPACE, vpx_cs); } #endif + +#if VPX_ENCODER_ABI_VERSION >= 11 +static void set_color_range(AVCodecContext *avctx) +{ + enum vpx_color_range vpx_cr; + switch (avctx->color_range) { + case AVCOL_RANGE_UNSPECIFIED: + case AVCOL_RANGE_MPEG: vpx_cr = VPX_CR_STUDIO_RANGE; break; + case AVCOL_RANGE_JPEG: vpx_cr = VPX_CR_FULL_RANGE; break; + default: + av_log(avctx, AV_LOG_WARNING, "Unsupported color range (%d)\n", + avctx->color_range); + return; + } + + codecctl_int(avctx, VP9E_SET_COLOR_RANGE, vpx_cr); +} +#endif #endif static av_cold int vpx_init(AVCodecContext *avctx, @@ -617,6 +638,9 @@ static av_cold int vpx_init(AVCodecContext *avctx, #if VPX_ENCODER_ABI_VERSION > 8 set_colorspace(avctx); #endif +#if VPX_ENCODER_ABI_VERSION >= 11 + set_color_range(avctx); +#endif } #endif |