[x265] [PATCH] level: allow unbounded level 8.5 to be used for lossless encodes
Steve Borho
steve at borho.org
Tue Apr 7 04:02:46 CEST 2015
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1428372156 18000
# Mon Apr 06 21:02:36 2015 -0500
# Node ID 0ce13ce29304296b9684668e628ae09f9ee8aed0
# Parent e35d7fe9e97451c07e7225311c0b34ad51ad5299
level: allow unbounded level 8.5 to be used for lossless encodes
Lossless has no rate control, obviously, so it does not generally fit in any of
the given levels but I think it is better to signal a valid profile (main,
main10, main10 4:4:4, etc) together with level 8.5 than to signal profile and
level as NONE. If anyone knows a better solution for this, please enlighten me.
This workaround prevents the need for --allow-non-conformance with --lossless
diff -r e35d7fe9e974 -r 0ce13ce29304 source/common/slice.h
--- a/source/common/slice.h Mon Apr 06 15:39:24 2015 -0700
+++ b/source/common/slice.h Mon Apr 06 21:02:36 2015 -0500
@@ -98,6 +98,7 @@
LEVEL6 = 180,
LEVEL6_1 = 183,
LEVEL6_2 = 186,
+ LEVEL8_5 = 255,
};
}
diff -r e35d7fe9e974 -r 0ce13ce29304 source/encoder/level.cpp
--- a/source/encoder/level.cpp Mon Apr 06 15:39:24 2015 -0700
+++ b/source/encoder/level.cpp Mon Apr 06 21:02:36 2015 -0500
@@ -55,15 +55,14 @@
{ 35651584, 1069547520, 60000, 240000, 60000, 240000, 8, Level::LEVEL6, "6", 60 },
{ 35651584, 2139095040, 120000, 480000, 120000, 480000, 8, Level::LEVEL6_1, "6.1", 61 },
{ 35651584, 4278190080U, 240000, 800000, 240000, 800000, 6, Level::LEVEL6_2, "6.2", 62 },
+ { MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, 1, Level::LEVEL8_5, "8.5", 85 },
};
/* determine minimum decoder level required to decode the described video */
void determineLevel(const x265_param ¶m, VPS& vps)
{
vps.maxTempSubLayers = param.bEnableTemporalSubLayers ? 2 : 1;
- if (param.bLossless)
- vps.ptl.profileIdc = Profile::NONE;
- else if (param.internalCsp == X265_CSP_I420)
+ if (param.internalCsp == X265_CSP_I420)
{
if (param.internalBitDepth == 8)
{
@@ -104,7 +103,15 @@
const size_t NumLevels = sizeof(levels) / sizeof(levels[0]);
uint32_t i;
- for (i = 0; i < NumLevels; i++)
+ if (param.bLossless)
+ {
+ i = 13;
+ vps.ptl.minCrForLevel = 1;
+ vps.ptl.maxLumaSrForLevel = MAX_UINT;
+ vps.ptl.levelIdc = Level::LEVEL8_5;
+ vps.ptl.tierFlag = Level::MAIN;
+ }
+ else for (i = 0; i < NumLevels; i++)
{
if (lumaSamples > levels[i].maxLumaSamples)
continue;
More information about the x265-devel
mailing list