Skip to content

Commit

Permalink
Initialise some variables
Browse files Browse the repository at this point in the history
Found with valgrind's uninitialised memory detector.
  • Loading branch information
cantabile committed Jan 18, 2016
1 parent 98807a2 commit ba58c96
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 25 deletions.
10 changes: 5 additions & 5 deletions src/MVAnalyse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ static const VSFrameRef *VS_CC mvanalyseGetFrame(int n, int activationReason, vo
GroupOfPlanes *vectorFields = new GroupOfPlanes(d->analysisData.nBlkSizeX, d->analysisData.nBlkSizeY, d->analysisData.nLvCount, d->analysisData.nPel, d->analysisData.nMotionFlags, d->analysisData.nCPUFlags, d->analysisData.nOverlapX, d->analysisData.nOverlapY, d->analysisData.nBlkX, d->analysisData.nBlkY, d->analysisData.xRatioUV, d->analysisData.yRatioUV, d->divideExtra, d->supervi->format->bitsPerSample);


const uint8_t *pSrc[3];
const uint8_t *pRef[3];
uint8_t *pDst;
int nSrcPitch[3];
int nRefPitch[3];
const uint8_t *pSrc[3] = { nullptr };
const uint8_t *pRef[3] = { nullptr };
uint8_t *pDst = { nullptr };
int nSrcPitch[3] = { 0 };
int nRefPitch[3] = { 0 };

int nref;

Expand Down
10 changes: 5 additions & 5 deletions src/MVRecalculate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ static const VSFrameRef *VS_CC mvrecalculateGetFrame(int n, int activationReason
GroupOfPlanes *vectorFields = new GroupOfPlanes(d->analysisData.nBlkSizeX, d->analysisData.nBlkSizeY, d->analysisData.nLvCount, d->analysisData.nPel, d->analysisData.nMotionFlags, d->analysisData.nCPUFlags, d->analysisData.nOverlapX, d->analysisData.nOverlapY, d->analysisData.nBlkX, d->analysisData.nBlkY, d->analysisData.xRatioUV, d->analysisData.yRatioUV, d->divideExtra, d->supervi->format->bitsPerSample);


const uint8_t *pSrc[3];
const uint8_t *pRef[3];
uint8_t *pDst;
int nSrcPitch[3];
int nRefPitch[3];
const uint8_t *pSrc[3] = { nullptr };
const uint8_t *pRef[3] = { nullptr };
uint8_t *pDst = { nullptr };
int nSrcPitch[3] = { 0 };
int nRefPitch[3] = { 0 };

int offset = ( d->analysisData.isBackward ) ? d->analysisData.nDeltaFrame : -d->analysisData.nDeltaFrame;
int nref = n + offset;
Expand Down
12 changes: 6 additions & 6 deletions src/MVSuper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ static const VSFrameRef *VS_CC mvsuperGetFrame(int n, int activationReason, void
} else if (activationReason == arAllFramesReady) {
const VSFrameRef *src = vsapi->getFrameFilter(n, d->node, frameCtx);

const uint8_t *pSrc[3];
uint8_t *pDst[3];
const uint8_t *pSrcPel[3];
int nSrcPitch[3];
int nDstPitch[3];
int nSrcPelPitch[3];
const uint8_t *pSrc[3] = { nullptr };
uint8_t *pDst[3] = { nullptr };
const uint8_t *pSrcPel[3] = { nullptr };
int nSrcPitch[3] = { 0 };
int nDstPitch[3] = { 0 };
int nSrcPelPitch[3] = { 0 };

const VSFrameRef *srcPel = NULL;
if (d->usePelClip)
Expand Down
25 changes: 16 additions & 9 deletions src/PlaneOfBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,17 +517,21 @@ void PlaneOfBlocks::SearchMVs(MVFrame *_pSrcFrame, MVFrame *_pRefFrame,
if ( iblkx < nBlkX-1 )
{
x[0] += (nBlkSizeX - nOverlapX) * blkScanDir;
x[1] += ((nBlkSizeX - nOverlapX) >> nLogxRatioUV) * blkScanDir;
x[2] += ((nBlkSizeX - nOverlapX) >> nLogxRatioUV) * blkScanDir;
if (pSrcFrame->GetMode() & UPLANE)
x[1] += ((nBlkSizeX - nOverlapX) >> nLogxRatioUV) * blkScanDir;
if (pSrcFrame->GetMode() & VPLANE)
x[2] += ((nBlkSizeX - nOverlapX) >> nLogxRatioUV) * blkScanDir;
}
}
pBlkData += nBlkX*N_PER_BLOCK;
if (outfilebuf != NULL) // write vector to outfile
outfilebuf += nBlkX*4;// 4 short word per block

y[0] += (nBlkSizeY - nOverlapY);
y[1] += ((nBlkSizeY - nOverlapY) >> nLogyRatioUV );
y[2] += ((nBlkSizeY - nOverlapY) >> nLogyRatioUV );
if (pSrcFrame->GetMode() & UPLANE)
y[1] += ((nBlkSizeY - nOverlapY) >> nLogyRatioUV );
if (pSrcFrame->GetMode() & VPLANE)
y[2] += ((nBlkSizeY - nOverlapY) >> nLogyRatioUV );
}
if (smallestPlane)
*pmeanLumaChange = sumLumaChange/nBlkCount; // for all finer planes
Expand Down Expand Up @@ -752,7 +756,6 @@ void PlaneOfBlocks::RecalculateMVs(MVClipBalls & mvClip, MVFrame *_pSrcFrame, MV
bestMV.sad = sad;
nMinCost = sad;


if (bestMV.sad > thSAD)// if old interpolated vector is bad
{
// then, we refine, according to the search type
Expand Down Expand Up @@ -831,17 +834,21 @@ void PlaneOfBlocks::RecalculateMVs(MVClipBalls & mvClip, MVFrame *_pSrcFrame, MV
if ( iblkx < nBlkX-1 )
{
x[0] += (nBlkSizeX - nOverlapX) * blkScanDir;
x[1] += ((nBlkSizeX - nOverlapX) >> nLogxRatioUV) * blkScanDir;
x[2] += ((nBlkSizeX - nOverlapX) >> nLogxRatioUV) * blkScanDir;
if (pSrcFrame->GetMode() & UPLANE)
x[1] += ((nBlkSizeX - nOverlapX) >> nLogxRatioUV) * blkScanDir;
if (pSrcFrame->GetMode() & VPLANE)
x[2] += ((nBlkSizeX - nOverlapX) >> nLogxRatioUV) * blkScanDir;
}
}
pBlkData += nBlkX*N_PER_BLOCK;
if (outfilebuf != NULL) // write vector to outfile
outfilebuf += nBlkX*4;// 4 short word per block

y[0] += (nBlkSizeY - nOverlapY);
y[1] += ((nBlkSizeY - nOverlapY) >> nLogyRatioUV );
y[2] += ((nBlkSizeY - nOverlapY) >> nLogyRatioUV );
if (pSrcFrame->GetMode() & UPLANE)
y[1] += ((nBlkSizeY - nOverlapY) >> nLogyRatioUV );
if (pSrcFrame->GetMode() & VPLANE)
y[2] += ((nBlkSizeY - nOverlapY) >> nLogyRatioUV );
}
}

Expand Down

0 comments on commit ba58c96

Please sign in to comment.