[FFmpeg-cvslog] Merge commit 'b183abfb5b6366b177cf44f244c66156257a6fd6'

Clément Bœsch git at videolan.org
Wed Mar 15 13:30:08 EET 2017


ffmpeg | branch: master | Clément Bœsch <cboesch at gopro.com> | Wed Mar 15 12:23:18 2017 +0100| [89a032634b6edde1efa402d7deaa66fa25dd3e2b] | committer: Clément Bœsch

Merge commit 'b183abfb5b6366b177cf44f244c66156257a6fd6'

* commit 'b183abfb5b6366b177cf44f244c66156257a6fd6':
  vpx: Support color range

Decoder chunk not merged as the framework automatically copies avctx
color range to the frame color range. And we already set the avctx field
since cbcc88c039.

Merged-by: Clément Bœsch <cboesch at gopro.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=89a032634b6edde1efa402d7deaa66fa25dd3e2b
---

 libavcodec/libvpxenc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 7c567a0..b8e8d3a 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1020,6 +1020,16 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
             rawimg_alpha->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;
     }


======================================================================

diff --cc libavcodec/libvpxenc.c
index 7c567a0,bb4c98f..b8e8d3a
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@@ -1000,26 -551,17 +1000,36 @@@ static int vpx_encode(AVCodecContext *a
          rawimg->stride[VPX_PLANE_Y] = frame->linesize[0];
          rawimg->stride[VPX_PLANE_U] = frame->linesize[1];
          rawimg->stride[VPX_PLANE_V] = frame->linesize[2];
 +        if (ctx->is_alpha) {
 +            uint8_t *u_plane, *v_plane;
 +            rawimg_alpha = &ctx->rawimg_alpha;
 +            rawimg_alpha->planes[VPX_PLANE_Y] = frame->data[3];
 +            u_plane = av_malloc(frame->linesize[1] * frame->height);
 +            v_plane = av_malloc(frame->linesize[2] * frame->height);
 +            if (!u_plane || !v_plane) {
 +                av_free(u_plane);
 +                av_free(v_plane);
 +                return AVERROR(ENOMEM);
 +            }
 +            memset(u_plane, 0x80, frame->linesize[1] * frame->height);
 +            rawimg_alpha->planes[VPX_PLANE_U] = u_plane;
 +            memset(v_plane, 0x80, frame->linesize[2] * frame->height);
 +            rawimg_alpha->planes[VPX_PLANE_V] = v_plane;
 +            rawimg_alpha->stride[VPX_PLANE_Y] = frame->linesize[0];
 +            rawimg_alpha->stride[VPX_PLANE_U] = frame->linesize[1];
 +            rawimg_alpha->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