proresenc_ks: use chroma sampling in autoselection
authorChristophe Gisquet <christophe.gisquet@gmail.com>
Sat, 30 Aug 2014 13:04:03 +0000 (15:04 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 11 Oct 2014 14:47:19 +0000 (16:47 +0200)
If the chroma planes aren't subsampled, automatically select
the 4:4:4:4 profile.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/proresenc_kostya.c

index ad27e16..5f432a9 100644 (file)
@@ -1148,11 +1148,13 @@ static av_cold int encode_init(AVCodecContext *avctx)
         return AVERROR(EINVAL);
     }
     if (ctx->profile == PRORES_PROFILE_AUTO) {
-        ctx->profile = av_pix_fmt_desc_get(avctx->pix_fmt)->flags & AV_PIX_FMT_FLAG_ALPHA
+        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+        ctx->profile = (desc->flags & AV_PIX_FMT_FLAG_ALPHA ||
+                        !(desc->log2_chroma_w + desc->log2_chroma_h))
                      ? PRORES_PROFILE_4444 : PRORES_PROFILE_HQ;
         av_log(avctx, AV_LOG_INFO, "Autoselected %s. It can be overridden "
                "through -profile option.\n", ctx->profile == PRORES_PROFILE_4444
-               ? "4:4:4:4 profile because of the alpha channel"
+               ? "4:4:4:4 profile because of the used input colorspace"
                : "HQ profile to keep best quality");
     }
     if (av_pix_fmt_desc_get(avctx->pix_fmt)->flags & AV_PIX_FMT_FLAG_ALPHA) {