[x265] [PATCH 3 of 5] predict: remove check for reallocations, comment nits
Steve Borho
steve at borho.org
Thu Sep 25 05:32:06 CEST 2014
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1411598817 18000
# Wed Sep 24 17:46:57 2014 -0500
# Node ID 56633b36885a4df6d01b615c025286ed6b9d7fdf
# Parent 0cba55a31876374d3879e4bc568e0d5fa384f047
predict: remove check for reallocations, comment nits
we don't do this anywhere else; there would be huge leaks if the Search object
were initialized multiple times. there's no reason to check here.
diff -r 0cba55a31876 -r 56633b36885a source/encoder/predict.cpp
--- a/source/encoder/predict.cpp Wed Sep 24 17:41:55 2014 -0500
+++ b/source/encoder/predict.cpp Wed Sep 24 17:46:57 2014 -0500
@@ -58,26 +58,23 @@
m_predShortYuv[1].destroy();
}
-void Predict::initTempBuff(int csp)
+void Predict::allocBuffers(int csp)
{
m_csp = csp;
- if (!m_predBuf)
- {
- int predBufHeight = ((MAX_CU_SIZE + 2) << 4);
- int predBufStride = ((MAX_CU_SIZE + 8) << 4);
- m_predBuf = X265_MALLOC(pixel, predBufStride * predBufHeight);
+ int predBufHeight = ((MAX_CU_SIZE + 2) << 4);
+ int predBufStride = ((MAX_CU_SIZE + 8) << 4);
+ m_predBuf = X265_MALLOC(pixel, predBufStride * predBufHeight);
- m_refAbove = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
- m_refAboveFlt = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
- m_refLeft = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
- m_refLeftFlt = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
+ m_refAbove = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
+ m_refAboveFlt = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
+ m_refLeft = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
+ m_refLeftFlt = X265_MALLOC(pixel, 3 * MAX_CU_SIZE);
- m_predShortYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
- m_predShortYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
+ m_predShortYuv[0].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
+ m_predShortYuv[1].create(MAX_CU_SIZE, MAX_CU_SIZE, csp);
- m_immedVals = X265_MALLOC(int16_t, 64 * (64 + NTAPS_LUMA - 1));
- }
+ m_immedVals = X265_MALLOC(int16_t, 64 * (64 + NTAPS_LUMA - 1));
}
void Predict::predIntraLumaAng(uint32_t dirMode, pixel* dst, intptr_t stride, uint32_t log2TrSize)
diff -r 0cba55a31876 -r 56633b36885a source/encoder/predict.h
--- a/source/encoder/predict.h Wed Sep 24 17:41:55 2014 -0500
+++ b/source/encoder/predict.h Wed Sep 24 17:46:57 2014 -0500
@@ -38,7 +38,7 @@
{
protected:
- ShortYuv m_predShortYuv[2]; //temporary storage for weighted prediction
+ ShortYuv m_predShortYuv[2]; /* temporary storage for weighted prediction */
int16_t* m_immedVals;
/* Slice information */
@@ -68,11 +68,9 @@
void addWeightBi(ShortYuv* srcYuv0, ShortYuv* srcYuv1, WeightParam *wp0, WeightParam *wp1, TComYuv* outDstYuv, bool bLuma, bool bChroma);
void addWeightUni(ShortYuv* srcYuv0, WeightParam *wp0, TComYuv* outDstYuv, bool bLuma, bool bChroma);
- void getLLSPrediction(TComPattern* pcPattern, int* src0, int srcstride, pixel* dst0, int dststride, uint32_t width, uint32_t height, uint32_t ext0);
-
public:
- // Intra prediction buffers
+ /* Intra prediction buffers */
pixel* m_predBuf;
pixel* m_refAbove;
pixel* m_refAboveFlt;
@@ -82,13 +80,13 @@
Predict();
~Predict();
- void initTempBuff(int csp);
+ void allocBuffers(int csp);
- // prepMotionCompensation needs to be called to prepare MC with CU-relevant data */
+ /* prepMotionCompensation needs to be called to prepare MC with CU-relevant data */
void prepMotionCompensation(TComDataCU* cu, int partIdx);
void motionCompensation(TComYuv* predYuv, bool bLuma, bool bChroma);
- // Angular Intra
+ /* Angular Intra */
void predIntraLumaAng(uint32_t dirMode, pixel* pred, intptr_t stride, uint32_t log2TrSize);
void predIntraChromaAng(pixel* src, uint32_t dirMode, pixel* pred, intptr_t stride, uint32_t log2TrSizeC, int chFmt);
};
diff -r 0cba55a31876 -r 56633b36885a source/encoder/search.cpp
--- a/source/encoder/search.cpp Wed Sep 24 17:41:55 2014 -0500
+++ b/source/encoder/search.cpp Wed Sep 24 17:46:57 2014 -0500
@@ -77,7 +77,7 @@
m_rdCost.setPsyRdScale(param->psyRd);
- initTempBuff(param->internalCsp);
+ Predict::allocBuffers(param->internalCsp);
ok &= m_predTempYuv.create(MAX_CU_SIZE, MAX_CU_SIZE, param->internalCsp);
m_me.setSearchMethod(param->searchMethod);
m_me.setSubpelRefine(param->subpelRefine);
More information about the x265-devel
mailing list