[x265] 12bit monochrome encoding error: is this a bug?

Emily Bowman silverbacknet at gmail.com
Sun Jan 14 23:39:21 UTC 2024


x265 is not a decoder, so decoder requirements do not apply to it, other
than conformance to at least one profile.

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.

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.

-Emily


Hi,
>
> 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.
>
> 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.
> When I try to launch the encoding, I get the following error:
> ?main12 profile not compatible with i400 input chroma subsampling?
>
> I traced the error to line 527 of level.ccp:
> https://bitbucket.org/multicoreware/x265_git/src/ce8642f22123f0b8cf105c88fc1e8af9888bd345/source/encoder/level.cpp#lines-527
> <
> https://bitbucket.org/multicoreware/x265_git/src/ce8642f22123f0b8cf105c88fc1e8af9888bd345/source/encoder/level.cpp#lines-527
> >
>
> > /* check that input color space is supported by profile */
> >     if (!strcmp(profile, "main") || !strcmp(profile, "main-intra") ||
> >         !strcmp(profile, "main10") || !strcmp(profile, "main10-intra") ||
> >         !strcmp(profile, "main12") || !strcmp(profile, "main12-intra") ||
> >         !strcmp(profile, "mainstillpicture") || !strcmp(profile, "msp"))
> >     {
> >         if (param->internalCsp != X265_CSP_I420)
> >         {
> >             x265_log(param, X265_LOG_ERROR, "%s profile not compatible
> with %s input chroma subsampling.\n",
> >                      profile, x265_source_csp_names[param->internalCsp]);
> >             return -1;
> >         }
> >     }
>
>
> Based on what the h265 specification says, the Main12 profile should
> support 4:0:0 (i400) 12bit monochrome chroma subsampling.
>
> Shouldn?t the check of chroma subsampling at line 525 allow for both
> X265_CSP_I420 and X265_CSP_I400?
>
> Thanks
> Andrea
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240114/f0230eb6/attachment.htm>


More information about the x265-devel mailing list