ffmpeg | branch: master | James Almer <jamr...@gmail.com> | Fri Apr 13 20:41:00 2018 -0300| [4339c94364f8ff143d051fcace3e5801625db607] | committer: James Almer
Merge commit 'cc06f7bd10c236539b4f6f87b795c459dd873770' * commit 'cc06f7bd10c236539b4f6f87b795c459dd873770': libx265: Support tiny video sizes Merged-by: James Almer <jamr...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4339c94364f8ff143d051fcace3e5801625db607 --- libavcodec/libx265.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 3c97800ccb..c208c0f2d3 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -115,6 +115,17 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) ctx->params->sourceHeight = avctx->height; ctx->params->bEnablePsnr = !!(avctx->flags & AV_CODEC_FLAG_PSNR); + /* Tune the CTU size based on input resolution. */ + if (ctx->params->sourceWidth < 64 || ctx->params->sourceHeight < 64) + ctx->params->maxCUSize = 32; + if (ctx->params->sourceWidth < 32 || ctx->params->sourceHeight < 32) + ctx->params->maxCUSize = 16; + if (ctx->params->sourceWidth < 16 || ctx->params->sourceHeight < 16) { + av_log(avctx, AV_LOG_ERROR, "Image size is too small (%dx%d).\n", + ctx->params->sourceWidth, ctx->params->sourceHeight); + return AVERROR(EINVAL); + } + if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 && avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) || (avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 && ====================================================================== diff --cc libavcodec/libx265.c index 3c97800ccb,8f1d60b4e5..c208c0f2d3 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@@ -115,11 -122,22 +115,22 @@@ static av_cold int libx265_encode_init( ctx->params->sourceHeight = avctx->height; ctx->params->bEnablePsnr = !!(avctx->flags & AV_CODEC_FLAG_PSNR); + /* Tune the CTU size based on input resolution. */ + if (ctx->params->sourceWidth < 64 || ctx->params->sourceHeight < 64) + ctx->params->maxCUSize = 32; + if (ctx->params->sourceWidth < 32 || ctx->params->sourceHeight < 32) + ctx->params->maxCUSize = 16; + if (ctx->params->sourceWidth < 16 || ctx->params->sourceHeight < 16) { + av_log(avctx, AV_LOG_ERROR, "Image size is too small (%dx%d).\n", + ctx->params->sourceWidth, ctx->params->sourceHeight); + return AVERROR(EINVAL); + } + - if ((avctx->color_primaries <= AVCOL_PRI_BT2020 && + if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 && avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) || - (avctx->color_trc <= AVCOL_TRC_BT2020_12 && + (avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 && avctx->color_trc != AVCOL_TRC_UNSPECIFIED) || - (avctx->colorspace <= AVCOL_SPC_BT2020_CL && + (avctx->colorspace <= AVCOL_SPC_ICTCP && avctx->colorspace != AVCOL_SPC_UNSPECIFIED)) { ctx->params->vui.bEnableVideoSignalTypePresentFlag = 1; _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog