[FFmpeg-cvslog] lavc/libx265: Support gray encoding.

Carl Eugen Hoyos git at videolan.org
Wed Jul 6 18:57:44 CEST 2016


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Wed Jul  6 18:56:19 2016 +0200| [3e4357eb822c8bcaf9743dde008f5774d1356e74] | committer: Carl Eugen Hoyos

lavc/libx265: Support gray encoding.

Gray encoding crashes with libx265 <= 84, so check the library version.

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

 libavcodec/libx265.c |   12 ++++++++++++
 libavcodec/version.h |    2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 11088b2..d25be70 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -165,6 +165,15 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
     case AV_PIX_FMT_YUV444P12:
         ctx->params->internalCsp = X265_CSP_I444;
         break;
+    case AV_PIX_FMT_GRAY8:
+        if (ctx->api->api_build_number < 85) {
+            av_log(avctx, AV_LOG_ERROR,
+                   "libx265 version is %d, must be at least 85 for gray encoding.\n",
+                   ctx->api->api_build_number);
+            return AVERROR_INVALIDDATA;
+        }
+        ctx->params->internalCsp = X265_CSP_I400;
+        break;
     }
 
     if (ctx->crf >= 0) {
@@ -325,6 +334,7 @@ static const enum AVPixelFormat x265_csp_eight[] = {
     AV_PIX_FMT_YUV422P,
     AV_PIX_FMT_YUV444P,
     AV_PIX_FMT_GBRP,
+    AV_PIX_FMT_GRAY8,
     AV_PIX_FMT_NONE
 };
 
@@ -337,6 +347,7 @@ static const enum AVPixelFormat x265_csp_ten[] = {
     AV_PIX_FMT_YUV422P10,
     AV_PIX_FMT_YUV444P10,
     AV_PIX_FMT_GBRP10,
+    AV_PIX_FMT_GRAY8,
     AV_PIX_FMT_NONE
 };
 
@@ -353,6 +364,7 @@ static const enum AVPixelFormat x265_csp_twelve[] = {
     AV_PIX_FMT_YUV422P12,
     AV_PIX_FMT_YUV444P12,
     AV_PIX_FMT_GBRP12,
+    AV_PIX_FMT_GRAY8,
     AV_PIX_FMT_NONE
 };
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5e04754..310aa95 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR  48
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MICRO 103
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list