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

Andrea 3000 andrea3000 at gmail.com
Sat Jan 13 15:19:51 UTC 2024


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/20240113/76bfba6b/attachment.htm>


More information about the x265-devel mailing list