[x265] [PATCH] cli: rewrite pts_queue to use new/delete
Xinyue Lu
maillist at 7086.in
Tue Apr 7 00:47:57 CEST 2015
# HG changeset patch
# User Xinyue Lu <i at 7086.in>
# Date 1428359964 25200
# Mon Apr 06 15:39:24 2015 -0700
# Branch Yuuki
# Node ID 6de8cdf3795b7fbdfc2df5ae34cbc211676a561a
# Parent ebe5e57c4b45b45338035a1009b64585f21d66d5
cli: rewrite pts_queue to use new/delete, not to confuse the leak tool
diff -r ebe5e57c4b45 -r 6de8cdf3795b source/x265.cpp
--- a/source/x265.cpp Sat Apr 04 15:11:39 2015 -0500
+++ b/source/x265.cpp Mon Apr 06 15:39:24 2015 -0700
@@ -507,8 +507,8 @@
x265_picture pic_orig, pic_out;
x265_picture *pic_in = &pic_orig;
/* Allocate recon picture if analysisMode is enabled */
- bool usePTS = cliopt.output->needPTS();
- x265_picture *pic_recon = (cliopt.recon || !!param->analysisMode || usePTS) ? &pic_out : NULL;
+ std::priority_queue<int64_t>* pts_queue = cliopt.output->needPTS() ? new std::priority_queue<int64_t>() : NULL;
+ x265_picture *pic_recon = (cliopt.recon || !!param->analysisMode || pts_queue) ? &pic_out : NULL;
uint32_t inFrameCount = 0;
uint32_t outFrameCount = 0;
x265_nal *p_nal;
@@ -516,7 +516,6 @@
uint32_t nal;
int16_t *errorBuf = NULL;
int ret = 0;
- std::priority_queue<int64_t> pts_queue;
if (!param->bRepeatHeaders)
{
@@ -590,11 +589,11 @@
if (nal)
{
cliopt.totalbytes += cliopt.output->writeFrame(p_nal, nal, pic_out);
- if (usePTS)
+ if (pts_queue)
{
- pts_queue.push(-pic_out.pts);
- if (pts_queue.size() > 2)
- pts_queue.pop();
+ pts_queue->push(-pic_out.pts);
+ if (pts_queue->size() > 2)
+ pts_queue->pop();
}
}
@@ -616,11 +615,11 @@
if (nal)
{
cliopt.totalbytes += cliopt.output->writeFrame(p_nal, nal, pic_out);
- if (usePTS)
+ if (pts_queue)
{
- pts_queue.push(-pic_out.pts);
- if (pts_queue.size() > 2)
- pts_queue.pop();
+ pts_queue->push(-pic_out.pts);
+ if (pts_queue->size() > 2)
+ pts_queue->pop();
}
}
@@ -642,12 +641,14 @@
int64_t second_largest_pts = 0;
int64_t largest_pts = 0;
- if (usePTS && pts_queue.size() >= 2)
+ if (pts_queue && pts_queue->size() >= 2)
{
- second_largest_pts = -pts_queue.top();
- pts_queue.pop();
- largest_pts = -pts_queue.top();
- pts_queue.pop();
+ second_largest_pts = -pts_queue->top();
+ pts_queue->pop();
+ largest_pts = -pts_queue->top();
+ pts_queue->pop();
+ delete pts_queue;
+ pts_queue = NULL;
}
cliopt.output->closeFile(largest_pts, second_largest_pts);
More information about the x265-devel
mailing list