[x265] [PATCH 3 of 4] fix bugs in free up of analysis data
kavitha at multicorewareinc.com
kavitha at multicorewareinc.com
Fri Jun 2 19:28:58 CEST 2017
# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1495620591 -19800
# Wed May 24 15:39:51 2017 +0530
# Node ID 629696c46ab60328d846424dd71e9bb7567450c9
# Parent 802bb7ead1e0151a604bc293451c735990656162
fix bugs in free up of analysis data
diff -r 802bb7ead1e0 -r 629696c46ab6 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed May 24 14:14:23 2017 +0530
+++ b/source/encoder/encoder.cpp Wed May 24 15:39:51 2017 +0530
@@ -2647,7 +2647,7 @@
{
CHECKED_MALLOC(interData->mvpIdx[dir], uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
CHECKED_MALLOC(interData->refIdx[dir], int8_t, analysis->numPartitions * analysis->numCUsInFrame);
- CHECKED_MALLOC(interData->mv[dir], MV, analysis->numPartitions * analysis->numCUsInFrame);
+ CHECKED_MALLOC(interData->mv[dir], MV, analysis->numPartitions * analysis->numCUsInFrame);
}
/* Allocate intra in inter */
@@ -2680,48 +2680,53 @@
if (m_param->analysisRefineLevel < 2)
return;
- if (analysis->intraData)
+ if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)
{
- if (m_param->analysisRefineLevel < 2)
- return;
-
- X265_FREE(((analysis_intra_data*)analysis->intraData)->depth);
- X265_FREE(((analysis_intra_data*)analysis->intraData)->modes);
- X265_FREE(((analysis_intra_data*)analysis->intraData)->partSizes);
- X265_FREE(((analysis_intra_data*)analysis->intraData)->chromaModes);
- X265_FREE(analysis->intraData);
- }
- else if (analysis->interData)
- {
- X265_FREE(((analysis_inter_data*)analysis->interData)->depth);
- X265_FREE(((analysis_inter_data*)analysis->interData)->modes);
- if (m_param->analysisRefineLevel > 4)
+ if (analysis->intraData)
{
- X265_FREE(((analysis_inter_data*)analysis->interData)->mergeFlag);
- X265_FREE(((analysis_inter_data*)analysis->interData)->partSize);
+ X265_FREE(((analysis_intra_data*)analysis->intraData)->depth);
+ X265_FREE(((analysis_intra_data*)analysis->intraData)->modes);
+ X265_FREE(((analysis_intra_data*)analysis->intraData)->partSizes);
+ X265_FREE(((analysis_intra_data*)analysis->intraData)->chromaModes);
+ X265_FREE(analysis->intraData);
+ analysis->intraData = NULL;
}
-
- if (m_param->analysisRefineLevel == 10)
+ }
+ else
+ {
+ if (analysis->intraData)
{
- X265_FREE(((analysis_inter_data*)analysis->interData)->interDir);
- int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
- for (int dir = 0; dir < numDir; dir++)
+ X265_FREE(((analysis_intra_data*)analysis->intraData)->modes);
+ X265_FREE(((analysis_intra_data*)analysis->intraData)->chromaModes);
+ X265_FREE(analysis->intraData);
+ analysis->intraData = NULL;
+ }
+ if (analysis->interData)
+ {
+ X265_FREE(((analysis_inter_data*)analysis->interData)->depth);
+ X265_FREE(((analysis_inter_data*)analysis->interData)->modes);
+ if (m_param->analysisRefineLevel > 4)
{
- X265_FREE(((analysis_inter_data*)analysis->interData)->mvpIdx[dir]);
- X265_FREE(((analysis_inter_data*)analysis->interData)->refIdx[dir]);
- X265_FREE(((analysis_inter_data*)analysis->interData)->mv[dir]);
+ X265_FREE(((analysis_inter_data*)analysis->interData)->mergeFlag);
+ X265_FREE(((analysis_inter_data*)analysis->interData)->partSize);
}
- if (analysis->sliceType == P_SLICE || m_param->bIntraInBFrames)
+ if (m_param->analysisRefineLevel == 10)
{
- X265_FREE(((analysis_intra_data*)analysis->intraData)->modes);
- X265_FREE(((analysis_intra_data*)analysis->intraData)->chromaModes);
- X265_FREE(analysis->intraData);
+ X265_FREE(((analysis_inter_data*)analysis->interData)->interDir);
+ int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
+ for (int dir = 0; dir < numDir; dir++)
+ {
+ X265_FREE(((analysis_inter_data*)analysis->interData)->mvpIdx[dir]);
+ X265_FREE(((analysis_inter_data*)analysis->interData)->refIdx[dir]);
+ X265_FREE(((analysis_inter_data*)analysis->interData)->mv[dir]);
+ }
}
+ else
+ X265_FREE(((analysis_inter_data*)analysis->interData)->ref);
+
+ X265_FREE(analysis->interData);
+ analysis->interData = NULL;
}
- else
- X265_FREE(((analysis_inter_data*)analysis->interData)->ref);
-
- X265_FREE(analysis->interData);
}
}
More information about the x265-devel
mailing list