[FFmpeg-cvslog] vpx: Support color range
Luca Barbato
git at videolan.org
Wed Mar 15 13:30:08 EET 2017
ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Fri Jul 22 09:33:04 2016 +0200| [b183abfb5b6366b177cf44f244c66156257a6fd6] | committer: Luca Barbato
vpx: Support color range
The range field has been introduced in version 1.6.0
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b183abfb5b6366b177cf44f244c66156257a6fd6
---
libavcodec/libvpxdec.c | 10 ++++++++++
libavcodec/libvpxenc.c | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 28b7733..93a720f 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -99,6 +99,16 @@ static int vp8_decode(AVCodecContext *avctx,
return ret;
av_image_copy(picture->data, picture->linesize, img->planes,
img->stride, avctx->pix_fmt, img->d_w, img->d_h);
+#if VPX_IMAGE_ABI_VERSION >= 4
+ switch (img->range) {
+ case VPX_CR_STUDIO_RANGE:
+ picture->color_range = AVCOL_RANGE_MPEG;
+ break;
+ case VPX_CR_FULL_RANGE:
+ picture->color_range = AVCOL_RANGE_JPEG;
+ break;
+ }
+#endif
*got_frame = 1;
}
return avpkt->size;
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 26afaf5..bb4c98f 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;
}
More information about the ffmpeg-cvslog
mailing list