<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Sun, Sep 9, 2018 at 7:00 PM Ma0 <<a href="mailto:mateuszb@poczta.onet.pl">mateuszb@poczta.onet.pl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Ma0 <<a href="mailto:mateuszb@poczta.onet.pl" target="_blank">mateuszb@poczta.onet.pl</a>><br>
# Date 1536497279 -7200<br>
# Sun Sep 09 14:47:59 2018 +0200<br>
# Node ID deb35c64bdc56e4c9405d34bff516dc5bdaae5ae<br>
# Parent 88ee12651e3031dc1fc2f3f6a8bbac5f67839579<br>
api: fix memory allocation of distortionData<br>
<br>
sse_t type depends of x265 default bit-depth<br>
if 8bit x265 try to allocate distortionData for 10bit encoding<br>
(possible in multilib build) we need double memory size for<br>
sse_t type tables (uint32_t -> uint64_t)<br>
<br>
diff -r 88ee12651e30 -r deb35c64bdc5 source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp Thu Aug 16 18:27:01 2018 +0530<br>
+++ b/source/encoder/api.cpp Sun Sep 09 14:47:59 2018 +0200<br>
@@ -412,12 +412,20 @@<br>
int numDir = 2; //irrespective of P or B slices set direction as 2<br>
uint32_t numPlanes = param->internalCsp == X265_CSP_I400 ? 1 : 3;<br>
<br>
+#if X265_DEPTH < 10 && (LINKED_10BIT || LINKED_12BIT)<br>
+ uint32_t numCUs_sse_t = param->internalBitDepth > 8 ? analysis->numCUsInFrame << 1 : analysis->numCUsInFrame;<br>
+#elif X265_DEPTH >= 10 && LINKED_8BIT<br>
+ uint32_t numCUs_sse_t = param->internalBitDepth > 8 ? analysis->numCUsInFrame : (analysis->numCUsInFrame + 1U) >> 1;<br>
+#else<br>
+ uint32_t numCUs_sse_t = analysis->numCUsInFrame;<br>
+#endif<br>
+<br>
//Allocate memory for distortionData pointer<br>
CHECKED_MALLOC_ZERO(distortionData, x265_analysis_distortion_data, 1);<br>
- CHECKED_MALLOC_ZERO(distortionData->distortion, sse_t, analysis->numPartitions * analysis->numCUsInFrame);<br>
+ CHECKED_MALLOC_ZERO(distortionData->distortion, sse_t, analysis->numPartitions * numCUs_sse_t);<br>
if (param->rc.bStatRead)<br>
{<br>
- CHECKED_MALLOC_ZERO(distortionData->ctuDistortion, sse_t, analysis->numCUsInFrame);<br>
+ CHECKED_MALLOC_ZERO(distortionData->ctuDistortion, sse_t, numCUs_sse_t);<br>
CHECKED_MALLOC_ZERO(distortionData->scaledDistortion, double, analysis->numCUsInFrame);<br>
CHECKED_MALLOC_ZERO(distortionData->offset, double, analysis->numCUsInFrame);<br>
CHECKED_MALLOC_ZERO(distortionData->threshold, double, analysis->numCUsInFrame);<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a></blockquote><div><br></div><div>Pushed to default. </div></div></div>