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:                  chen         chenm...@163.com                 
Sent Time:         2025-02-4- 23:06 
To:                  Richard         ccc7...@foxmail.com                 
Cc:                  Development for x265         x265-devel@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&gt; wrote:
Which should be correct. This is MaxCPB size, MaxBR is in Table A.9.


         Original
         
       
From:                  chen         chenm...@163.com                 
Sent Time:         2025-02-4- 12:10 
To:                  Development for x265         x265-devel@videolan.org       
  ,                ccc7922         ccc7...@foxmail.com                 
Subject:         Re:Re: [x265] [PATCH] Add new Levels 







This?














At 2025-02-04 02:07:58, "Richard" <ccc7...@foxmail.com&gt; 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:                  chen         chenm...@163.com                 
Sent Time:         2025-02-3- 23:47 
To:                  Development for x265         x265-devel@videolan.org       
  ,                ccc7922         ccc7...@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&gt;

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

Subject: [PATCH] Add new Levels




&nbsp;LevelSpec levels[] =

&nbsp;{

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

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

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

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

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

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

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

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

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

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

-&nbsp; &nbsp; { 35651584, 1069547520, 60000,&nbsp; &nbsp; 240000,&nbsp; 
&nbsp;60000,&nbsp; 240000,&nbsp; &nbsp;8, Level::LEVEL6,&nbsp; &nbsp;"6",&nbsp; 
&nbsp;60 },

-&nbsp; &nbsp; { 35651584, 2139095040, 120000,&nbsp; &nbsp;480000,&nbsp; 
&nbsp;120000, 480000,&nbsp; &nbsp;8, Level::LEVEL6_1, "6.1", 61 },

-&nbsp; &nbsp; { 35651584, 4278190080U, 240000,&nbsp; 800000,&nbsp; 
&nbsp;240000, 800000,&nbsp; &nbsp;6, Level::LEVEL6_2, "6.2", 62 },

-&nbsp; &nbsp; { MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, MAX_UINT, 1, 
Level::LEVEL8_5, "8.5", 85 },

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

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

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

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

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

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

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

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

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

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

+&nbsp; &nbsp; { 35651584,&nbsp; &nbsp;1069547520,&nbsp; &nbsp; 
&nbsp;60000,&nbsp; &nbsp; 240000,&nbsp; &nbsp;60000,&nbsp; &nbsp;240000,&nbsp; 
&nbsp;8, Level::LEVEL6,&nbsp; &nbsp;"6",&nbsp; &nbsp;60 },

+&nbsp; &nbsp; { 35651584,&nbsp; &nbsp;2139095040,&nbsp; &nbsp; 
&nbsp;120000,&nbsp; &nbsp;480000,&nbsp; &nbsp;120000,&nbsp; 480000,&nbsp; 
&nbsp;8, Level::LEVEL6_1, "6.1", 61 },

+&nbsp; &nbsp; { 35651584,&nbsp; &nbsp;4278190080U,&nbsp; &nbsp; 240000,&nbsp; 
&nbsp;800000,&nbsp; &nbsp;240000,&nbsp; 800000,&nbsp; &nbsp;6, Level::LEVEL6_2, 
"6.2", 62 },

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

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




mismatch to HEVC spec, 240000?







&nbsp;

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

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

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

&nbsp;#endif

&nbsp;

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

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

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




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

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

Attachment: 0001-Add-new-Levels.patch
Description: Binary data

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

Reply via email to