diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2014-02-21 11:59:13 -0500 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2014-02-24 11:10:17 -0500 |
commit | d102925a6d4ac1c6fb901fe2df052811e5814d60 (patch) | |
tree | 96171d0865040c172e2447ff05c0b49f8ed1cf49 /libavcodec/libx265.c | |
parent | d3736471948cd06851f6b3aef352ef285b7c6480 (diff) | |
download | ffmpeg-d102925a6d4ac1c6fb901fe2df052811e5814d60.tar.gz |
libx265: Support 4:4:4
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/libx265.c')
-rw-r--r-- | libavcodec/libx265.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 01833d99d6..27c3fbfec5 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -81,6 +81,15 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) int ret; int i; + if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL && + !av_pix_fmt_desc_get(avctx->pix_fmt)->log2_chroma_w && + !av_pix_fmt_desc_get(avctx->pix_fmt)->log2_chroma_h) { + av_log(avctx, AV_LOG_ERROR, + "4:4:4 support is not fully defined for HEVC yet. " + "Set -strict experimental to encode anyway.\n"); + return AVERROR(ENOSYS); + } + avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); @@ -109,6 +118,17 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) else if (x265_max_bit_depth == 12) ctx->params->internalBitDepth = 10; + switch (avctx->pix_fmt) { + case AV_PIX_FMT_YUV420P: + case AV_PIX_FMT_YUV420P10: + ctx->params->internalCsp = X265_CSP_I420; + break; + case AV_PIX_FMT_YUV444P: + case AV_PIX_FMT_YUV444P10: + ctx->params->internalCsp = X265_CSP_I444; + break; + } + if (avctx->bit_rate > 0) { ctx->params->rc.bitrate = avctx->bit_rate / 1000; ctx->params->rc.rateControlMode = X265_RC_ABR; @@ -243,12 +263,15 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, static const enum AVPixelFormat x265_csp_eight[] = { AV_PIX_FMT_YUV420P, + AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE }; static const enum AVPixelFormat x265_csp_twelve[] = { AV_PIX_FMT_YUV420P, + AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV420P10, + AV_PIX_FMT_YUV444P10, AV_PIX_FMT_NONE }; |