Thank for the revised patch, it looks good to me.






a comment, below code has no problem, however, constant 142606336 in 32-bits 
range, it is compare without postfix 'ULL'.

+    CHECK((uint64_t)param->sourceWidth * param->sourceHeight > 142606336,







Regards,

Chen

At 2025-02-05 04:09:17, "Richard" <ccc7...@foxmail.com> wrote:

Here's the new patch.
lumaSamples and maxLumaSamples are now changed back to uint32.
Since the range is now smaller (relatively to uint64), I think allowing 
override in resolution check with --allow-non-conformance is not safe, so I 
removed it.
And since the override is removed, the limit is changed to Level 7.2 value to 
make new levels actually available.
The calculation in the resolution check is kept at uint64, so that the results 
exceeding uint32 range can be correctly refused.


Original
|
From:chenchenm...@163.com
Sent Time:2025-02-4- 23:06
To:richardccc7...@foxmail.com
Cc:Development for x265x265-de...@videolan.org
Subject:Re:Re:Re: [x265] [PATCH] Add new Levels
|



Thanks, it is my fault, I look into incorrect table.




Now, the only comment is,

-    uint32_t lumaSamples = param.sourceWidth * param.sourceHeight;

-    uint32_t samplesPerSec = (uint32_t)(lumaSamples * ((double)param.fpsNum / 
param.fpsDenom));

+    uint64_t lumaSamples = param.sourceWidth * param.sourceHeight;

1) unnecessary 64 bits for resolution

2) I double checked output assembly, the statement is (32b * 32b) -> 32b -> 
64b, so result is 32 bits.




+    uint64_t samplesPerSec = (uint64_t)(lumaSamples * ((double)param.fpsNum / 
param.fpsDenom));

we can convert lumaSamples to 64bits here.



Regards,

Chen

At 2025-02-04 20:37:58, "Richard" <ccc7...@foxmail.com> wrote:

Which should be correct. This is MaxCPB size, MaxBR is in Table A.9.


Original
|
From:chenchenm...@163.com
Sent Time:2025-02-4- 12:10
To:Development for x265x265-de...@videolan.org,ccc7922ccc7...@foxmail.com
Subject:Re:Re: [x265] [PATCH] Add new Levels
|






This?












At 2025-02-04 02:07:58, "Richard" <ccc7...@foxmail.com> wrote:

I think I read the spec (PDF version) correct, but exactly which 240000?


The reason of using uint64 for lumaSamples is that I also changed the 
resolution check so it can be bypassed by --allow-non-conformance, and the 
value can potentially exceed uint32.


Original
|
From:chenchenm...@163.com
Sent Time:2025-02-3- 23:47
To:Development for x265x265-de...@videolan.org,ccc7922ccc7...@foxmail.com
Subject:Re:[x265] [PATCH] Add new Levels
|



Thank for the patch, I have some comments







From 249a2dd99de9edfd16867430deb0670f35e74941 Mon Sep 17 00:00:00 2001

From: Mr-Z-2697 <74594146+mr-z-2...@users.noreply.github.com>

Date: Sun, 12 Jan 2025 12:35:38 +0800

Subject: [PATCH] Add new Levels




 LevelSpec levels[] =

 {

-    { 36864,    552960,     128,      MAX_UINT, 350,    MAX_UINT, 2, 
Level::LEVEL1,   "1",   10 },

-    { 122880,   3686400,    1500,     MAX_UINT, 1500,   MAX_UINT, 2, 
Level::LEVEL2,   "2",   20 },

-    { 245760,   7372800,    3000,     MAX_UINT, 3000,   MAX_UINT, 2, 
Level::LEVEL2_1, "2.1", 21 },

-    { 552960,   16588800,   6000,     MAX_UINT, 6000,   MAX_UINT, 2, 
Level::LEVEL3,   "3",   30 },

-    { 983040,   33177600,   10000,    MAX_UINT, 10000,  MAX_UINT, 2, 
Level::LEVEL3_1, "3.1", 31 },

-    { 2228224,  66846720,   12000,    30000,    12000,  30000,    4, 
Level::LEVEL4,   "4",   40 },

-    { 2228224,  133693440,  20000,    50000,    20000,  50000,    4, 
Level::LEVEL4_1, "4.1", 41 },

-    { 8912896,  267386880,  25000,    100000,   25000,  100000,   6, 
Level::LEVEL5,   "5",   50 },

-    { 8912896,  534773760,  40000,    160000,   40000,  160000,   8, 
Level::LEVEL5_1, "5.1", 51 },

-    { 8912896,  1069547520, 60000,    240000,   60000,  240000,   8, 
Level::LEVEL5_2, "5.2", 52 },

-    { 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 },

+    { 36864,      552960,         128,      MAX_UINT, 350,     MAX_UINT, 2, 
Level::LEVEL1,   "1",   10 },

+    { 122880,     3686400,        1500,     MAX_UINT, 1500,    MAX_UINT, 2, 
Level::LEVEL2,   "2",   20 },

+    { 245760,     7372800,        3000,     MAX_UINT, 3000,    MAX_UINT, 2, 
Level::LEVEL2_1, "2.1", 21 },

+    { 552960,     16588800,       6000,     MAX_UINT, 6000,    MAX_UINT, 2, 
Level::LEVEL3,   "3",   30 },

+    { 983040,     33177600,       10000,    MAX_UINT, 10000,   MAX_UINT, 2, 
Level::LEVEL3_1, "3.1", 31 },

+    { 2228224,    66846720,       12000,    30000,    12000,   30000,    4, 
Level::LEVEL4,   "4",   40 },

+    { 2228224,    133693440,      20000,    50000,    20000,   50000,    4, 
Level::LEVEL4_1, "4.1", 41 },

+    { 8912896,    267386880,      25000,    100000,   25000,   100000,   6, 
Level::LEVEL5,   "5",   50 },

+    { 8912896,    534773760,      40000,    160000,   40000,   160000,   8, 
Level::LEVEL5_1, "5.1", 51 },

+    { 8912896,    1069547520,     60000,    240000,   60000,   240000,   8, 
Level::LEVEL5_2, "5.2", 52 },

+    { 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 },

+    { 80216064,   4812963840ULL,  320000,   1600000,  240000,  1600000,  6, 
Level::LEVEL6_3, "6.3", 63 },

+    { 142606336,  4812963840ULL,  320000,   1600000,  240000,  1600000,  6, 
Level::LEVEL7,   "7",   70 },




mismatch to HEVC spec, 240000?







 

 static inline int _confirm(x265_param* param, bool bflag, const char* message)

@@ -152,8 +156,8 @@ void determineLevel(const x265_param &param, VPS& vps)

         vps.ptl.profileCompatibilityFlag[Profile::MAINSCC] = true;

 #endif

 

-    uint32_t lumaSamples = param.sourceWidth * param.sourceHeight;

-    uint32_t samplesPerSec = (uint32_t)(lumaSamples * ((double)param.fpsNum / 
param.fpsDenom));

+    uint64_t lumaSamples = param.sourceWidth * param.sourceHeight;




Maximum picture size is 142,606,336, it is in 32-bits range









Attachment: 2E363300@44A2AF16.ED73A26700000000.png
Description: Binary data

_______________________________________________
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to