[x265] ptl: RExt profiles
Steve Borho
steve at borho.org
Fri Oct 10 20:15:38 CEST 2014
On 10/10, Satoshi Nakagawa wrote:
> # HG changeset patch
> # User Satoshi Nakagawa <nakagawa424 at oki.com>
> # Date 1412935384 -32400
> # Fri Oct 10 19:03:04 2014 +0900
> # Node ID 95bb05fd7d143e7a123b6b1b475b35b5c2bf44f5
> # Parent 4495af3b30bb7a361c3252a8800f8dfa9f191145
> ptl: RExt profiles
queued with nit fixes and updated docs for --profile
> diff -r 4495af3b30bb -r 95bb05fd7d14 source/common/slice.h
> --- a/source/common/slice.h Thu Oct 09 14:28:14 2014 +0530
> +++ b/source/common/slice.h Fri Oct 10 19:03:04 2014 +0900
> @@ -63,6 +63,8 @@
> MAIN = 1,
> MAIN10 = 2,
> MAINSTILLPICTURE = 3,
> + MAINREXT = 4,
> + HIGHTHROUGHPUTREXT = 5
> };
> }
>
> @@ -100,10 +102,14 @@
> bool nonPackedConstraintFlag;
> bool frameOnlyConstraintFlag;
> bool profileCompatibilityFlag[32];
> + bool intraConstraintFlag;
> + bool lowerBitRateConstraintFlag;
> int profileIdc;
> int levelIdc;
> uint32_t minCrForLevel;
> uint32_t maxLumaSrForLevel;
> + uint32_t bitDepthConstraint;
> + int chromaFormatConstraint;
> };
>
> struct HRDInfo
> diff -r 4495af3b30bb -r 95bb05fd7d14 source/encoder/entropy.cpp
> --- a/source/encoder/entropy.cpp Thu Oct 09 14:28:14 2014 +0530
> +++ b/source/encoder/entropy.cpp Fri Oct 10 19:03:04 2014 +0900
> @@ -190,9 +190,29 @@
> WRITE_FLAG(ptl.nonPackedConstraintFlag, "general_non_packed_constraint_flag");
> WRITE_FLAG(ptl.frameOnlyConstraintFlag, "general_frame_only_constraint_flag");
>
> - WRITE_CODE(0, 16, "XXX_reserved_zero_44bits[0..15]");
> - WRITE_CODE(0, 16, "XXX_reserved_zero_44bits[16..31]");
> - WRITE_CODE(0, 12, "XXX_reserved_zero_44bits[32..43]");
> + if (ptl.profileIdc == Profile::MAINREXT || ptl.profileIdc == Profile::HIGHTHROUGHPUTREXT )
> + {
> + uint32_t bitDepthConstraint = ptl.bitDepthConstraint;
> + int csp = ptl.chromaFormatConstraint;
> + WRITE_FLAG(bitDepthConstraint<=12, "general_max_12bit_constraint_flag");
> + WRITE_FLAG(bitDepthConstraint<=10, "general_max_10bit_constraint_flag");
> + WRITE_FLAG(bitDepthConstraint<= 8 && csp != X265_CSP_I422 , "general_max_8bit_constraint_flag");
> + WRITE_FLAG(csp == X265_CSP_I422 || csp == X265_CSP_I420 || csp == X265_CSP_I400, "general_max_422chroma_constraint_flag");
> + WRITE_FLAG(csp == X265_CSP_I420 || csp == X265_CSP_I400, "general_max_420chroma_constraint_flag");
> + WRITE_FLAG(csp == X265_CSP_I400, "general_max_monochrome_constraint_flag");
> + WRITE_FLAG(ptl.intraConstraintFlag, "general_intra_constraint_flag");
> + WRITE_FLAG(0, "general_one_picture_only_constraint_flag");
> + WRITE_FLAG(ptl.lowerBitRateConstraintFlag, "general_lower_bit_rate_constraint_flag");
> + WRITE_CODE(0 , 16, "XXX_reserved_zero_35bits[0..15]");
> + WRITE_CODE(0 , 16, "XXX_reserved_zero_35bits[16..31]");
> + WRITE_CODE(0 , 3, "XXX_reserved_zero_35bits[32..34]");
> + }
> + else
> + {
> + WRITE_CODE(0, 16, "XXX_reserved_zero_44bits[0..15]");
> + WRITE_CODE(0, 16, "XXX_reserved_zero_44bits[16..31]");
> + WRITE_CODE(0, 12, "XXX_reserved_zero_44bits[32..43]");
> + }
>
> WRITE_CODE(ptl.levelIdc, 8, "general_level_idc");
> }
> diff -r 4495af3b30bb -r 95bb05fd7d14 source/encoder/level.cpp
> --- a/source/encoder/level.cpp Thu Oct 09 14:28:14 2014 +0530
> +++ b/source/encoder/level.cpp Fri Oct 10 19:03:04 2014 +0900
> @@ -77,7 +77,7 @@
> else
> {
> /* TODO: Range extension profiles */
> - vps.ptl.profileIdc = Profile::NONE;
> + vps.ptl.profileIdc = Profile::MAINREXT;
> }
>
> /* determine which profiles are compatible with this stream */
> @@ -93,6 +93,10 @@
> vps.ptl.profileCompatibilityFlag[Profile::MAIN] = true;
> vps.ptl.profileCompatibilityFlag[Profile::MAIN10] = true;
> }
> + else if (vps.ptl.profileIdc == Profile::MAINREXT)
> + {
> + vps.ptl.profileCompatibilityFlag[Profile::MAINREXT] = true;
> + }
>
> uint32_t lumaSamples = param.sourceWidth * param.sourceHeight;
> uint32_t samplesPerSec = (uint32_t)(lumaSamples * ((double)param.fpsNum / param.fpsDenom));
> @@ -167,10 +171,29 @@
> break;
> }
>
> - static const char *profiles[] = { "None", "Main", "Main10", "Mainstillpicture" };
> + vps.ptl.intraConstraintFlag = false;
> + vps.ptl.lowerBitRateConstraintFlag = true;
> + vps.ptl.bitDepthConstraint = param.internalBitDepth;
> + vps.ptl.chromaFormatConstraint = param.internalCsp;
> +
> + static const char *profiles[] = { "None", "Main", "Main 10", "Main Still Picture", "RExt" };
> static const char *tiers[] = { "Main", "High" };
> +
> + const char *profile = profiles[vps.ptl.profileIdc];
> + if (vps.ptl.profileIdc == Profile::MAINREXT)
> + {
> + if (param.internalCsp == X265_CSP_I422)
> + profile = "Main 4:2:2 10";
> + if (param.internalCsp == X265_CSP_I444)
> + {
> + if (vps.ptl.bitDepthConstraint <= 8)
> + profile = "Main 4:4:4 8";
> + else if (vps.ptl.bitDepthConstraint <= 10)
> + profile = "Main 4:4:4 10";
> + }
> + }
> x265_log(¶m, X265_LOG_INFO, "%s profile, Level-%s (%s tier)\n",
> - profiles[vps.ptl.profileIdc], levels[i].name, tiers[vps.ptl.tierFlag]);
> + profile, levels[i].name, tiers[vps.ptl.tierFlag]);
> }
>
> /* enforce a maximum decoder level requirement, in other words assure that a
> @@ -356,6 +379,22 @@
> return -1;
> #endif
> }
> + else if (!strcmp(profile, "main422-10"))
> + {
> + param->internalCsp = X265_CSP_I422;
> + }
> + else if (!strcmp(profile, "main444-8"))
> + {
> + param->internalCsp = X265_CSP_I444;
> +#if HIGH_BIT_DEPTH
> + x265_log(param, X265_LOG_ERROR, "Main 4:4:4 8 profile not supported, compiled for Main10.\n");
> + return -1;
> +#endif
> + }
> + else if (!strcmp(profile, "main444-10"))
> + {
> + param->internalCsp = X265_CSP_I444;
> + }
> else
> {
> x265_log(param, X265_LOG_ERROR, "unknown profile <%s>\n", profile);
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
--
Steve Borho
More information about the x265-devel
mailing list