[FFmpeg-cvslog] libvpx: add support for yuv440p and yuv440p10/12 encoding

James Almer git at videolan.org
Thu May 21 01:09:24 CEST 2015


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed May 20 17:52:47 2015 -0300| [40bf3687a1c12dc859ad9e76a53c79dd15d99ed6] | committer: James Almer

libvpx: add support for yuv440p and yuv440p10/12 encoding

Reviewed-by: James Zern <jzern at google.com>
Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/libvpx.c    |    4 ++++
 libavcodec/libvpxenc.c |   24 +++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
index b432fe9..e0f9df3 100644
--- a/libavcodec/libvpx.c
+++ b/libavcodec/libvpx.c
@@ -36,6 +36,7 @@ static const enum AVPixelFormat vp9_pix_fmts_def[] = {
 static const enum AVPixelFormat vp9_pix_fmts_highcol[] = {
     AV_PIX_FMT_YUV420P,
     AV_PIX_FMT_YUV422P,
+    AV_PIX_FMT_YUV440P,
     AV_PIX_FMT_YUV444P,
     AV_PIX_FMT_NONE
 };
@@ -43,12 +44,15 @@ static const enum AVPixelFormat vp9_pix_fmts_highcol[] = {
 static const enum AVPixelFormat vp9_pix_fmts_highbd[] = {
     AV_PIX_FMT_YUV420P,
     AV_PIX_FMT_YUV422P,
+    AV_PIX_FMT_YUV440P,
     AV_PIX_FMT_YUV444P,
     AV_PIX_FMT_YUV420P10LE,
     AV_PIX_FMT_YUV422P10LE,
+    AV_PIX_FMT_YUV440P10LE,
     AV_PIX_FMT_YUV444P10LE,
     AV_PIX_FMT_YUV420P12LE,
     AV_PIX_FMT_YUV422P12LE,
+    AV_PIX_FMT_YUV440P12LE,
     AV_PIX_FMT_YUV444P12LE,
     AV_PIX_FMT_NONE
 };
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index c2408a5..adf4b2e 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -280,9 +280,18 @@ static int set_pix_fmt(AVCodecContext *avctx, vpx_codec_caps_t codec_caps,
         *img_fmt = VPX_IMG_FMT_I420;
         return 0;
     case AV_PIX_FMT_YUV422P:
+        enccfg->g_profile = 1;
+        *img_fmt = VPX_IMG_FMT_I422;
+        return 0;
+#if VPX_IMAGE_ABI_VERSION >= 3
+    case AV_PIX_FMT_YUV440P:
+        enccfg->g_profile = 1;
+        *img_fmt = VPX_IMG_FMT_I440;
+        return 0;
+#endif
     case AV_PIX_FMT_YUV444P:
         enccfg->g_profile = 1;
-        *img_fmt = avctx->pix_fmt == AV_PIX_FMT_YUV422P ? VPX_IMG_FMT_I422 : VPX_IMG_FMT_I444;
+        *img_fmt = VPX_IMG_FMT_I444;
         return 0;
 #ifdef VPX_IMG_FMT_HIGHBITDEPTH
     case AV_PIX_FMT_YUV420P10LE:
@@ -307,6 +316,19 @@ static int set_pix_fmt(AVCodecContext *avctx, vpx_codec_caps_t codec_caps,
             return 0;
         }
         break;
+#if VPX_IMAGE_ABI_VERSION >= 3
+    case AV_PIX_FMT_YUV440P10LE:
+    case AV_PIX_FMT_YUV440P12LE:
+        if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {
+            enccfg->g_bit_depth = enccfg->g_input_bit_depth =
+                avctx->pix_fmt == AV_PIX_FMT_YUV440P10LE ? 10 : 12;
+            enccfg->g_profile = 3;
+            *img_fmt = VPX_IMG_FMT_I44016;
+            *flags |= VPX_CODEC_USE_HIGHBITDEPTH;
+            return 0;
+        }
+        break;
+#endif
     case AV_PIX_FMT_YUV444P10LE:
     case AV_PIX_FMT_YUV444P12LE:
         if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) {



More information about the ffmpeg-cvslog mailing list