<div dir="ltr"><div>x265 is not a decoder, so decoder requirements do not apply to it, other than conformance to at least one profile.</div><div><br></div><div>True monochrome support has come up as a request a few times over the years, and it's basically a sponsored or contributor feature at this point. Active feature development has mostly ceased. So otherwise you just fake it by adding empty chroma planes, which only add a few bytes overall. Libraries like libheif will automatically do this.<br></div><div><br></div><div>It's a lot more than that one line, since there are various parts of the code that assume chroma planes exist. IIRC there was an initial stab at it a while back that someone could start from.<br></div><div><br></div><div>-Emily<br></div><br><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi,<br>
<br>
As far as I understand, the h265 specification states that the Main 12 profile allows for a bit depth of 8 bits to 12 bits per sample with support for 4:0:0 and 4:2:0 chroma sampling. HEVC decoders that conform to the Main 12 profile must be capable of decoding bitstreams made with the following profiles: Monochrome, Monochrome 12, Main, Main 10, and Main 12.<br>
<br>
I?m trying to encode 12bit grayscale images into a 12bit monochrome h265 video stream using x265 (via FFmpeg). I?m specifying the profile as Main12 and the chroma subsampling as 4:0:0.<br>
When I try to launch the encoding, I get the following error:<br>
?main12 profile not compatible with i400 input chroma subsampling?<br>
<br>
I traced the error to line 527 of level.ccp: <a href="https://bitbucket.org/multicoreware/x265_git/src/ce8642f22123f0b8cf105c88fc1e8af9888bd345/source/encoder/level.cpp#lines-527" rel="noreferrer" target="_blank">https://bitbucket.org/multicoreware/x265_git/src/ce8642f22123f0b8cf105c88fc1e8af9888bd345/source/encoder/level.cpp#lines-527</a> <<a href="https://bitbucket.org/multicoreware/x265_git/src/ce8642f22123f0b8cf105c88fc1e8af9888bd345/source/encoder/level.cpp#lines-527" rel="noreferrer" target="_blank">https://bitbucket.org/multicoreware/x265_git/src/ce8642f22123f0b8cf105c88fc1e8af9888bd345/source/encoder/level.cpp#lines-527</a>><br>
<br>
> /* check that input color space is supported by profile */<br>
> if (!strcmp(profile, "main") || !strcmp(profile, "main-intra") ||<br>
> !strcmp(profile, "main10") || !strcmp(profile, "main10-intra") ||<br>
> !strcmp(profile, "main12") || !strcmp(profile, "main12-intra") ||<br>
> !strcmp(profile, "mainstillpicture") || !strcmp(profile, "msp"))<br>
> {<br>
> if (param->internalCsp != X265_CSP_I420)<br>
> {<br>
> x265_log(param, X265_LOG_ERROR, "%s profile not compatible with %s input chroma subsampling.\n",<br>
> profile, x265_source_csp_names[param->internalCsp]);<br>
> return -1;<br>
> }<br>
> }<br>
<br>
<br>
Based on what the h265 specification says, the Main12 profile should support 4:0:0 (i400) 12bit monochrome chroma subsampling.<br>
<br>
Shouldn?t the check of chroma subsampling at line 525 allow for both X265_CSP_I420 and X265_CSP_I400?<br>
<br>
Thanks<br>
Andrea<br><br>
</blockquote></div></div>