[FFmpeg-devel] [PATCH] avcodec/libx265: allow 12bit input formats, update warnings
Steve Borho
steve at borho.org
Thu Jul 9 00:54:56 CEST 2015
The range extension profiles have been fully ratified so there
is no reason to require -strict experimental for them. However
Main12 support in x265 is experimental so I check for that
instead.
---
libavcodec/libx265.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index e9240f9..f67eb72 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -84,10 +84,9 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
if (!ctx->api)
ctx->api = x265_api_get(0);
- if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL &&
- !av_pix_fmt_desc_get(avctx->pix_fmt)->log2_chroma_w) {
+ if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL && ctx->api->bit_depth == 12) {
av_log(avctx, AV_LOG_ERROR,
- "4:2:2 and 4:4:4 support is not fully defined for HEVC yet. "
+ "Main12 support in x265 still experimental. "
"Set -strict experimental to encode anyway.\n");
return AVERROR(ENOSYS);
}
@@ -162,14 +161,17 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
switch (avctx->pix_fmt) {
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUV420P10:
+ case AV_PIX_FMT_YUV420P12:
ctx->params->internalCsp = X265_CSP_I420;
break;
case AV_PIX_FMT_YUV422P:
case AV_PIX_FMT_YUV422P10:
+ case AV_PIX_FMT_YUV422P12:
ctx->params->internalCsp = X265_CSP_I422;
break;
case AV_PIX_FMT_YUV444P:
case AV_PIX_FMT_YUV444P10:
+ case AV_PIX_FMT_YUV444P12:
ctx->params->internalCsp = X265_CSP_I444;
break;
}
@@ -330,6 +332,16 @@ static const enum AVPixelFormat x265_csp_eight[] = {
AV_PIX_FMT_NONE
};
+static const enum AVPixelFormat x265_csp_ten[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUV420P10,
+ AV_PIX_FMT_YUV422P10,
+ AV_PIX_FMT_YUV444P10,
+ AV_PIX_FMT_NONE
+};
+
static const enum AVPixelFormat x265_csp_twelve[] = {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P,
@@ -337,13 +349,19 @@ static const enum AVPixelFormat x265_csp_twelve[] = {
AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_YUV422P10,
AV_PIX_FMT_YUV444P10,
+ AV_PIX_FMT_YUV420P12,
+ AV_PIX_FMT_YUV422P12,
+ AV_PIX_FMT_YUV444P12,
AV_PIX_FMT_NONE
};
+
static av_cold void libx265_encode_init_csp(AVCodec *codec)
{
- if (x265_api_get(10))
+ if (x265_api_get(12))
codec->pix_fmts = x265_csp_twelve;
+ else if (x265_api_get(10))
+ codec->pix_fmts = x265_csp_ten;
else if (x265_api_get(8))
codec->pix_fmts = x265_csp_eight;
}
--
2.1.4
More information about the ffmpeg-devel
mailing list