[x265] [PATCH] correct slicetype passed to writeAnalysis2PassFile. Fixes memory leak

santhoshini at multicorewareinc.com santhoshini at multicorewareinc.com
Thu Dec 29 08:10:14 CET 2016


# HG changeset patch
# User Santhoshini Sekar <santhoshini at multicorewareinc.com>
# Date 1482994947 -19800
#      Thu Dec 29 12:32:27 2016 +0530
# Node ID 7a269cfc67dff0e53872f738d0c7430e17fe0ec5
# Parent  93fd14d86372368f7120e8999b9eb45247f849fd
correct slicetype passed to writeAnalysis2PassFile. Fixes memory leak

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -818,10 +818,10 @@
                     pic_out->analysis2Pass.poc = pic_out->poc;
                     pic_out->analysis2Pass.analysisFramedata = outFrame->m_analysis2Pass.analysisFramedata;
                 }
-                writeAnalysis2PassFile(&outFrame->m_analysis2Pass, *outFrame->m_encData);
+                writeAnalysis2PassFile(&outFrame->m_analysis2Pass, *outFrame->m_encData, outFrame->m_lowres.sliceType);
             }
             if (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion)
-                freeAnalysis2Pass(&outFrame->m_analysis2Pass, slice->m_sliceType);
+                freeAnalysis2Pass(&outFrame->m_analysis2Pass, outFrame->m_lowres.sliceType);
             if (m_param->internalCsp == X265_CSP_I400)
             {
                 if (slice->m_sliceType == P_SLICE)
@@ -2772,13 +2772,13 @@
 #undef X265_FWRITE
 }
 
-void Encoder::writeAnalysis2PassFile(x265_analysis_2Pass* analysis2Pass, FrameData &curEncData)
+void Encoder::writeAnalysis2PassFile(x265_analysis_2Pass* analysis2Pass, FrameData &curEncData, int slicetype)
 {
 #define X265_FWRITE(val, size, writeSize, fileOffset)\
     if (fwrite(val, size, writeSize, fileOffset) < writeSize)\
     {\
     x265_log(NULL, X265_LOG_ERROR, "Error writing analysis 2 pass data\n"); \
-    freeAnalysis2Pass(analysis2Pass, curEncData.m_slice->m_sliceType); \
+    freeAnalysis2Pass(analysis2Pass, slicetype); \
     m_aborted = true; \
     return; \
 }\
diff --git a/source/encoder/encoder.h b/source/encoder/encoder.h
--- a/source/encoder/encoder.h
+++ b/source/encoder/encoder.h
@@ -210,7 +210,7 @@
 
     void readAnalysis2PassFile(x265_analysis_2Pass* analysis2Pass, int poc, int sliceType);
 
-    void writeAnalysis2PassFile(x265_analysis_2Pass* analysis2Pass, FrameData &curEncData);
+    void writeAnalysis2PassFile(x265_analysis_2Pass* analysis2Pass, FrameData &curEncData, int slicetype);
 
     void finishFrameStats(Frame* pic, FrameEncoder *curEncoder, x265_frame_stats* frameStats, int inPoc);
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 2479 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20161229/ef4c17e7/attachment.bin>


More information about the x265-devel mailing list