forked from HandBrake/HandBrake
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
123 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
From c5ba94be92cc687ee36b321b7143d58393aca055 Mon Sep 17 00:00:00 2001 | ||
From f069ed8e59da8d89b771e9f9fe7e7a39ae9d8f5b Mon Sep 17 00:00:00 2001 | ||
From: Max Dmitrichenko <[email protected]> | ||
Date: Thu, 22 Aug 2024 07:40:48 +0200 | ||
Subject: [PATCH 1/6] Do not set thread priority on Windows | ||
Subject: [PATCH 1/5] Do not set thread priority on Windows | ||
|
||
--- | ||
source/common/threadpool.cpp | 6 ------ | ||
1 file changed, 6 deletions(-) | ||
|
||
diff --git a/source/common/threadpool.cpp b/source/common/threadpool.cpp | ||
index 9c27be783..4d7918033 100644 | ||
index b3505e5c0..1dec78b8d 100644 | ||
--- a/source/common/threadpool.cpp | ||
+++ b/source/common/threadpool.cpp | ||
@@ -115,12 +115,6 @@ void WorkerThread::threadMain() | ||
|
@@ -25,5 +25,5 @@ index 9c27be783..4d7918033 100644 | |
|
||
sleepbitmap_t idBit = (sleepbitmap_t)1 << m_id; | ||
-- | ||
2.39.3 (Apple Git-146) | ||
2.39.5 (Apple Git-154) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
From b6f8695658dc8f5e0d3759a65ae37a8efefef4e4 Mon Sep 17 00:00:00 2001 | ||
From a7921f411ee52f1f77cbdfea20d982351483eb7e Mon Sep 17 00:00:00 2001 | ||
From: Damiano Galassi <[email protected]> | ||
Date: Fri, 13 Sep 2024 16:08:25 +0200 | ||
Subject: [PATCH 2/6] Apple Silicon tuning | ||
Subject: [PATCH 2/5] Apple Silicon tuning | ||
|
||
--- | ||
source/common/threadpool.cpp | 8 +++++++- | ||
1 file changed, 7 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/source/common/threadpool.cpp b/source/common/threadpool.cpp | ||
index 4d7918033..7b53cb84e 100644 | ||
index 1dec78b8d..2c28fceea 100644 | ||
--- a/source/common/threadpool.cpp | ||
+++ b/source/common/threadpool.cpp | ||
@@ -661,10 +661,16 @@ void ThreadPool::getFrameThreadsCount(x265_param* p, int cpuCount) | ||
|
@@ -30,5 +30,5 @@ index 4d7918033..7b53cb84e 100644 | |
p->frameNumThreads = 3; | ||
#endif | ||
-- | ||
2.39.3 (Apple Git-146) | ||
2.39.5 (Apple Git-154) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
From 9711f557a2e9ab6e0511e18f03835f733a0bfcbc Mon Sep 17 00:00:00 2001 | ||
From d0e5dc02fbf21b66abec2a7dd6302a522bcd468b Mon Sep 17 00:00:00 2001 | ||
From: harlanc <[email protected]> | ||
Date: Thu, 1 Dec 2022 07:46:13 +0000 | ||
Subject: [PATCH 3/6] fix crash when SEI length is variable | ||
Subject: [PATCH 3/5] fix crash when SEI length is variable | ||
|
||
--- | ||
source/encoder/encoder.cpp | 6 ++++++ | ||
1 file changed, 6 insertions(+) | ||
|
||
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp | ||
index 65c247aba..13d65655f 100644 | ||
index 2e65cb1a9..6670c814d 100644 | ||
--- a/source/encoder/encoder.cpp | ||
+++ b/source/encoder/encoder.cpp | ||
@@ -1113,6 +1113,12 @@ void Encoder::copyUserSEIMessages(Frame *frame, const x265_picture* pic_in) | ||
@@ -1102,6 +1102,12 @@ void Encoder::copyUserSEIMessages(Frame *frame, const x265_picture* pic_in) | ||
else | ||
input = pic_in->userSEI.payloads[i]; | ||
|
||
|
@@ -25,5 +25,5 @@ index 65c247aba..13d65655f 100644 | |
frame->m_userSEI.payloads[i].payload = new uint8_t[input.payloadSize]; | ||
memcpy(frame->m_userSEI.payloads[i].payload, input.payload, input.payloadSize); | ||
-- | ||
2.39.3 (Apple Git-146) | ||
2.39.5 (Apple Git-154) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
From 2d918078c803c774f828f7f070f0d345cd1a3e82 Mon Sep 17 00:00:00 2001 | ||
From 39f1065dc6e6c85780c42123033391233f7104af Mon Sep 17 00:00:00 2001 | ||
From: Damiano Galassi <[email protected]> | ||
Date: Thu, 22 Aug 2024 07:46:30 +0200 | ||
Subject: [PATCH 4/6] implement ambient viewing environment sei | ||
Date: Fri, 22 Nov 2024 10:49:10 +0100 | ||
Subject: [PATCH 4/5] Implement ambient viewing environment sei | ||
|
||
Defined in ISO/IEC 23008-2:2017, D.2.39. | ||
--- | ||
source/common/param.cpp | 6 ++++++ | ||
source/encoder/encoder.cpp | 9 +++++++++ | ||
|
@@ -11,26 +12,26 @@ Subject: [PATCH 4/6] implement ambient viewing environment sei | |
4 files changed, 43 insertions(+) | ||
|
||
diff --git a/source/common/param.cpp b/source/common/param.cpp | ||
index d08bb604e..68f7f84fe 100755 | ||
index a35b06339..92f70b6bf 100755 | ||
--- a/source/common/param.cpp | ||
+++ b/source/common/param.cpp | ||
@@ -380,6 +380,7 @@ void x265_param_default(x265_param* param) | ||
@@ -408,6 +408,7 @@ void x265_param_default(x265_param* param) | ||
param->preferredTransferCharacteristics = -1; | ||
param->pictureStructure = -1; | ||
param->bEmitCLL = 1; | ||
+ param->bEmitAmbientViewingEnvironment = 0; | ||
|
||
param->bEnableFrameDuplication = 0; | ||
param->dupThreshold = 70; | ||
@@ -1929,6 +1930,7 @@ int x265_check_params(x265_param* param) | ||
@@ -1963,6 +1964,7 @@ int x265_check_params(x265_param* param) | ||
|| param->bEmitIDRRecoverySEI | ||
|| !!param->interlaceMode | ||
|| param->preferredTransferCharacteristics > 1 | ||
+ || param->bEmitAmbientViewingEnvironment | ||
|| param->toneMapFile | ||
|| param->naluFile); | ||
|| strlen(param->toneMapFile) | ||
|| strlen(param->naluFile)); | ||
|
||
@@ -2850,6 +2852,10 @@ void x265_copy_params(x265_param* dst, x265_param* src) | ||
@@ -2910,6 +2912,10 @@ void x265_copy_params(x265_param* dst, x265_param* src) | ||
dst->bEmitCLL = src->bEmitCLL; | ||
dst->maxCLL = src->maxCLL; | ||
dst->maxFALL = src->maxFALL; | ||
|
@@ -42,10 +43,10 @@ index d08bb604e..68f7f84fe 100755 | |
dst->bEmitVUIHRDInfo = src->bEmitVUIHRDInfo; | ||
dst->bEmitVUITimingInfo = src->bEmitVUITimingInfo; | ||
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp | ||
index 13d65655f..e7dd30fa7 100644 | ||
index 6670c814d..752e41a8a 100644 | ||
--- a/source/encoder/encoder.cpp | ||
+++ b/source/encoder/encoder.cpp | ||
@@ -3429,6 +3429,15 @@ void Encoder::getStreamHeaders(NALList& list, Entropy& sbacCoder, Bitstream& bs) | ||
@@ -3367,6 +3367,15 @@ void Encoder::getStreamHeaders(NALList& list, Entropy& sbacCoder, Bitstream& bs) | ||
} | ||
} | ||
|
||
|
@@ -62,10 +63,10 @@ index 13d65655f..e7dd30fa7 100644 | |
{ | ||
char *opts = x265_param2string(m_param, m_sps.conformanceWindow.rightOffset, m_sps.conformanceWindow.bottomOffset); | ||
diff --git a/source/encoder/sei.h b/source/encoder/sei.h | ||
index e357a1bf5..ab6086a2c 100644 | ||
index 3ed957058..9d3e74c63 100644 | ||
--- a/source/encoder/sei.h | ||
+++ b/source/encoder/sei.h | ||
@@ -464,6 +464,25 @@ public: | ||
@@ -638,6 +638,25 @@ public: | ||
} | ||
}; | ||
|
||
|
@@ -92,18 +93,18 @@ index e357a1bf5..ab6086a2c 100644 | |
{ | ||
public: | ||
diff --git a/source/x265.h b/source/x265.h | ||
index 08ccb4b74..f2981cea2 100644 | ||
index 7241beda2..c9fd99984 100644 | ||
--- a/source/x265.h | ||
+++ b/source/x265.h | ||
@@ -371,6 +371,7 @@ typedef enum | ||
@@ -376,6 +376,7 @@ typedef enum | ||
MASTERING_DISPLAY_INFO = 137, | ||
CONTENT_LIGHT_LEVEL_INFO = 144, | ||
ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147, | ||
+ AMBIENT_VIEWING_ENVIRONMENT = 148, | ||
ALPHA_CHANNEL_INFO = 165, | ||
THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO = 176, | ||
MULTIVIEW_SCENE_INFO = 178, | ||
@@ -1956,6 +1957,11 @@ typedef struct x265_param | ||
@@ -1962,6 +1963,11 @@ typedef struct x265_param | ||
* value to that value. */ | ||
uint16_t maxLuma; | ||
|
||
|
@@ -115,7 +116,7 @@ index 08ccb4b74..f2981cea2 100644 | |
/* Maximum of the picture order count */ | ||
int log2MaxPocLsb; | ||
|
||
@@ -2167,6 +2173,9 @@ typedef struct x265_param | ||
@@ -2173,6 +2179,9 @@ typedef struct x265_param | ||
/*Emit content light level info SEI*/ | ||
int bEmitCLL; | ||
|
||
|
@@ -126,5 +127,5 @@ index 08ccb4b74..f2981cea2 100644 | |
* Signals picture structure SEI timing message for every frame | ||
* picture structure 7 is signalled for frame doubling | ||
-- | ||
2.39.3 (Apple Git-146) | ||
2.39.5 (Apple Git-154) | ||
|
56 changes: 56 additions & 0 deletions
56
contrib/x265/A05-Fix-Dolby-Vision-RPU-memory-management.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
From 3a71553731ce49117397ada92ffd858cc550195a Mon Sep 17 00:00:00 2001 | ||
From: Damiano Galassi <[email protected]> | ||
Date: Fri, 22 Nov 2024 10:51:25 +0100 | ||
Subject: [PATCH 5/5] Fix Dolby Vision RPU memory management | ||
|
||
--- | ||
source/common/frame.cpp | 5 +++++ | ||
source/encoder/encoder.cpp | 13 +++++++++++-- | ||
2 files changed, 16 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/source/common/frame.cpp b/source/common/frame.cpp | ||
index 200717425..1244fdc24 100644 | ||
--- a/source/common/frame.cpp | ||
+++ b/source/common/frame.cpp | ||
@@ -370,6 +370,11 @@ void Frame::destroy() | ||
delete[] m_userSEI.payloads; | ||
} | ||
|
||
+ if (m_rpu.payloadSize) | ||
+ { | ||
+ delete[] m_rpu.payload; | ||
+ } | ||
+ | ||
if (m_ctuInfo) | ||
{ | ||
uint32_t widthInCU = (m_param->sourceWidth + m_param->maxCUSize - 1) >> m_param->maxLog2CUSize; | ||
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp | ||
index 752e41a8a..8117a90b2 100644 | ||
--- a/source/encoder/encoder.cpp | ||
+++ b/source/encoder/encoder.cpp | ||
@@ -1681,11 +1681,20 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out) | ||
} | ||
copyUserSEIMessages(inFrame[0], inputPic[0]); | ||
|
||
- /*Copy Dolby Vision RPU from inputPic to frame*/ | ||
+ /* Copy Dolby Vision RPU from inputPic to frame. */ | ||
+ if (inFrame[0]->m_rpu.payload && inFrame[0]->m_rpu.payloadSize < inputPic[0]->rpu.payloadSize) | ||
+ { | ||
+ delete[] inFrame[0]->m_rpu.payload; | ||
+ inFrame[0]->m_rpu.payload = NULL; | ||
+ } | ||
+ | ||
if (inputPic[0]->rpu.payloadSize) | ||
{ | ||
+ if (inFrame[0]->m_rpu.payload == NULL) | ||
+ { | ||
+ inFrame[0]->m_rpu.payload = new uint8_t[inputPic[0]->rpu.payloadSize]; | ||
+ } | ||
inFrame[0]->m_rpu.payloadSize = inputPic[0]->rpu.payloadSize; | ||
- inFrame[0]->m_rpu.payload = new uint8_t[inputPic[0]->rpu.payloadSize]; | ||
memcpy(inFrame[0]->m_rpu.payload, inputPic[0]->rpu.payload, inputPic[0]->rpu.payloadSize); | ||
} | ||
|
||
-- | ||
2.39.5 (Apple Git-154) | ||
|
Oops, something went wrong.