Commit 4339c943 authored by James Almer's avatar James Almer

Merge commit 'cc06f7bd'

* commit 'cc06f7bd':
  libx265: Support tiny video sizes
Merged-by: 's avatarJames Almer <jamrial@gmail.com>
parents bbe95ebd cc06f7bd
...@@ -115,6 +115,17 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) ...@@ -115,6 +115,17 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
ctx->params->sourceHeight = avctx->height; ctx->params->sourceHeight = avctx->height;
ctx->params->bEnablePsnr = !!(avctx->flags & AV_CODEC_FLAG_PSNR); 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 && if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 &&
avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) || avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) ||
(avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 && (avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment