>From 001f6eb747eccbabc352c802ba6ef466145d649b Mon Sep 17 00:00:00 2001 From: Shashank Pathipati <[email protected]> Date: Fri, 2 May 2025 10:01:57 +0530 Subject: [PATCH] Fix crash in hist-scenecut for high bit-depth builds
---
source/encoder/slicetype.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/source/encoder/slicetype.cpp b/source/encoder/slicetype.cpp
index 2cbf95237..edf2b00d9 100644
--- a/source/encoder/slicetype.cpp
+++ b/source/encoder/slicetype.cpp
@@ -1562,13 +1562,16 @@ void LookaheadTLD::calculateHistogram(
{
*sum = 0;
+ uint8_t shift = X265_DEPTH - 8;
for (uint32_t verticalIdx = 0; verticalIdx < inputHeight; verticalIdx +=
dsFactor)
{
for (uint32_t horizontalIdx = 0; horizontalIdx < inputWidth;
horizontalIdx += dsFactor)
{
- ++(histogram[inputSrc[horizontalIdx]]);
- *sum += inputSrc[horizontalIdx];
+ pixel val = inputSrc[horizontalIdx] >> shift;
+ X265_CHECK(val < HISTOGRAM_NUMBER_OF_BINS, "Pixel value out of
allocated histogram range. This will lead to memory corruption.\n");
+ ++(histogram[val]);
+ *sum += val;
}
inputSrc += (stride << (dsFactor >> 1));
}
--
2.49.0
0001-Fix-crash-in-hist-scenecut-for-high-bit-depth-builds.patch
Description: 0001-Fix-crash-in-hist-scenecut-for-high-bit-depth-builds.patch
_______________________________________________ x265-devel mailing list [email protected] https://mailman.videolan.org/listinfo/x265-devel
