summaryrefslogtreecommitdiff
path: root/libavcodec/libvpxenc.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2016-07-22 09:33:04 +0200
committerLuca Barbato <lu_zero@gentoo.org>2016-07-23 08:27:29 +0200
commitb183abfb5b6366b177cf44f244c66156257a6fd6 (patch)
treed22b568fe2941d2067ada1b09fe71ad191a59393 /libavcodec/libvpxenc.c
parentad71d3276fef0ee7e791e62bbfe9c4e540047417 (diff)
vpx: Support color range
The range field has been introduced in version 1.6.0
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r--libavcodec/libvpxenc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 26afaf5f1c..bb4c98fea5 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -552,6 +552,16 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
rawimg->stride[VPX_PLANE_U] = frame->linesize[1];
rawimg->stride[VPX_PLANE_V] = frame->linesize[2];
timestamp = frame->pts;
+#if VPX_IMAGE_ABI_VERSION >= 4
+ switch (frame->color_range) {
+ case AVCOL_RANGE_MPEG:
+ rawimg->range = VPX_CR_STUDIO_RANGE;
+ break;
+ case AVCOL_RANGE_JPEG:
+ rawimg->range = VPX_CR_FULL_RANGE;
+ break;
+ }
+#endif
if (frame->pict_type == AV_PICTURE_TYPE_I)
flags |= VPX_EFLAG_FORCE_KF;
}