[x265] keep TComPic until next call when recpic is exported as pic_out
Satoshi Nakagawa
nakagawa424 at oki.com
Thu Jun 19 15:49:47 CEST 2014
# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1403183616 -32400
# Thu Jun 19 22:13:36 2014 +0900
# Node ID 17b083a024a2ed2b209cc0e8f1fbd3cf90956bd5
# Parent d2a13e8541f45fcd4c7d554e0b7c89a82f2a0ff9
keep TComPic until next call when recpic is exported as pic_out
diff -r d2a13e8541f4 -r 17b083a024a2 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Thu Jun 19 10:28:47 2014 +0530
+++ b/source/encoder/encoder.cpp Thu Jun 19 22:13:36 2014 +0900
@@ -59,6 +59,7 @@
m_frameEncoder = NULL;
m_rateControl = NULL;
m_dpb = NULL;
+ m_exportedPic = NULL;
m_nals = NULL;
m_packetData = NULL;
m_outputCount = 0;
@@ -132,6 +133,12 @@
void Encoder::destroy()
{
+ if (m_exportedPic)
+ {
+ ATOMIC_DEC(&m_exportedPic->m_countRefEncoders);
+ m_exportedPic = NULL;
+ }
+
if (m_frameEncoder)
{
for (int i = 0; i < m_totalFrameThreads; i++)
@@ -255,6 +262,13 @@
if (m_aborted)
return -1;
+ if (m_exportedPic)
+ {
+ ATOMIC_DEC(&m_exportedPic->m_countRefEncoders);
+ m_exportedPic = NULL;
+ m_dpb->recycleUnreferenced();
+ }
+
if (pic_in)
{
if (pic_in->colorSpace != m_param->internalCsp)
@@ -434,8 +448,14 @@
finishFrameStats(out, curEncoder, bits);
// Allow this frame to be recycled if no frame encoders are using it for reference
- ATOMIC_DEC(&out->m_countRefEncoders);
- m_dpb->recycleUnreferenced();
+ if (!pic_out)
+ {
+ ATOMIC_DEC(&out->m_countRefEncoders);
+ m_dpb->recycleUnreferenced();
+ }
+ else
+ m_exportedPic = out;
+
ret = 1;
}
diff -r d2a13e8541f4 -r 17b083a024a2 source/encoder/encoder.h
--- a/source/encoder/encoder.h Thu Jun 19 10:28:47 2014 +0530
+++ b/source/encoder/encoder.h Thu Jun 19 22:13:36 2014 +0900
@@ -87,6 +87,8 @@
FrameEncoder* m_frameEncoder;
DPB* m_dpb;
+ TComPic* m_exportedPic;
+
/* frame parallelism */
int m_curEncoder;
More information about the x265-devel
mailing list