[x265] [PATCH] quantOffsets: move allocation to frame::create
deepthi at multicorewareinc.com
deepthi at multicorewareinc.com
Thu Aug 13 12:03:11 CEST 2015
# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1439460179 -19800
# Thu Aug 13 15:32:59 2015 +0530
# Node ID 9d6ab81073afab38821da2f0b3f9c31fd77df93a
# Parent bc5a7c2ac38b06d2a232b983f10bc0394d252ad7
quantOffsets: move allocation to frame::create
diff -r bc5a7c2ac38b -r 9d6ab81073af source/common/frame.cpp
--- a/source/common/frame.cpp Wed Aug 12 15:13:51 2015 +0530
+++ b/source/common/frame.cpp Thu Aug 13 15:32:59 2015 +0530
@@ -43,13 +43,22 @@
memset(&m_lowres, 0, sizeof(m_lowres));
}
-bool Frame::create(x265_param *param)
+bool Frame::create(x265_param *param, float* quantOffsets)
{
m_fencPic = new PicYuv;
m_param = param;
- return m_fencPic->create(param->sourceWidth, param->sourceHeight, param->internalCsp) &&
- m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode);
+ if (m_fencPic->create(param->sourceWidth, param->sourceHeight, param->internalCsp) &&
+ m_lowres.create(m_fencPic, param->bframes, !!param->rc.aqMode))
+ {
+ if (quantOffsets)
+ {
+ int32_t cuCount = m_lowres.maxBlocksInRow * m_lowres.maxBlocksInCol;
+ m_quantOffsets = new float[cuCount];
+ }
+ return true;
+ }
+ return false;
}
bool Frame::allocEncodeData(x265_param *param, const SPS& sps)
diff -r bc5a7c2ac38b -r 9d6ab81073af source/common/frame.h
--- a/source/common/frame.h Wed Aug 12 15:13:51 2015 +0530
+++ b/source/common/frame.h Thu Aug 13 15:32:59 2015 +0530
@@ -71,7 +71,7 @@
x265_analysis_data m_analysisData;
Frame();
- bool create(x265_param *param);
+ bool create(x265_param *param, float* quantOffsets);
bool allocEncodeData(x265_param *param, const SPS& sps);
void reinit(const SPS& sps);
void destroy();
diff -r bc5a7c2ac38b -r 9d6ab81073af source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed Aug 12 15:13:51 2015 +0530
+++ b/source/encoder/encoder.cpp Thu Aug 13 15:32:59 2015 +0530
@@ -403,7 +403,7 @@
{
inFrame = new Frame;
x265_param* p = m_reconfigured? m_latestParam : m_param;
- if (inFrame->create(p))
+ if (inFrame->create(p, pic_in->quantOffsets))
{
/* the first PicYuv created is asked to generate the CU and block unit offset
* arrays which are then shared with all subsequent PicYuv (orig and recon)
@@ -433,11 +433,6 @@
m_sps.buOffsetY = inFrame->m_fencPic->m_buOffsetY;
}
}
- if (pic_in->quantOffsets != NULL)
- {
- cuCount = inFrame->m_lowres.maxBlocksInRow * inFrame->m_lowres.maxBlocksInCol;
- inFrame->m_quantOffsets = new float[cuCount];
- }
}
else
{
More information about the x265-devel
mailing list