Skip to content

Commit

Permalink
Fix broken output with overlap > 0
Browse files Browse the repository at this point in the history
Bug introduced in d40773c.
  • Loading branch information
cantabile committed Jan 30, 2015
1 parent e3b4bca commit eb931b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/MVCompensate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,22 +320,22 @@ static const VSFrameRef *VS_CC mvcompensateGetFrame(int n, int activationReason,
if (block.GetSAD() < thSAD)
{
// luma
d->OVERSLUMA(pDstTemp + xx, dstTempPitch, pPlanes[0]->GetPointer(blx, bly), pPlanes[0]->GetPitch(), winOver, nBlkSizeX);
d->OVERSLUMA(pDstTemp + xx*2, dstTempPitch, pPlanes[0]->GetPointer(blx, bly), pPlanes[0]->GetPitch(), winOver, nBlkSizeX);
// chroma u
if(pPlanes[1]) d->OVERSCHROMA(pDstTempU + (xx >> xSubUV), dstTempPitchUV, pPlanes[1]->GetPointer(blx >> xSubUV, bly>>ySubUV), pPlanes[1]->GetPitch(), winOverUV, nBlkSizeX >> xSubUV);
if(pPlanes[1]) d->OVERSCHROMA(pDstTempU + (xx >> xSubUV)*2, dstTempPitchUV, pPlanes[1]->GetPointer(blx >> xSubUV, bly>>ySubUV), pPlanes[1]->GetPitch(), winOverUV, nBlkSizeX >> xSubUV);
// chroma v
if(pPlanes[2]) d->OVERSCHROMA(pDstTempV + (xx >> xSubUV), dstTempPitchUV, pPlanes[2]->GetPointer(blx >> xSubUV, bly>>ySubUV), pPlanes[2]->GetPitch(), winOverUV, nBlkSizeX >> xSubUV);
if(pPlanes[2]) d->OVERSCHROMA(pDstTempV + (xx >> xSubUV)*2, dstTempPitchUV, pPlanes[2]->GetPointer(blx >> xSubUV, bly>>ySubUV), pPlanes[2]->GetPitch(), winOverUV, nBlkSizeX >> xSubUV);
}
else // bad compensation, use src
{
int blxsrc = bx * (nBlkSizeX - nOverlapX) * nPel;
int blysrc = by * (nBlkSizeY - nOverlapY) * nPel + fieldShift;

d->OVERSLUMA(pDstTemp + xx, dstTempPitch, pSrcPlanes[0]->GetPointer(blxsrc, blysrc), pSrcPlanes[0]->GetPitch(), winOver, nBlkSizeX);
d->OVERSLUMA(pDstTemp + xx*2, dstTempPitch, pSrcPlanes[0]->GetPointer(blxsrc, blysrc), pSrcPlanes[0]->GetPitch(), winOver, nBlkSizeX);
// chroma u
if(pSrcPlanes[1]) d->OVERSCHROMA(pDstTempU + (xx >> xSubUV), dstTempPitchUV, pSrcPlanes[1]->GetPointer(blxsrc >> xSubUV, blysrc>>ySubUV), pSrcPlanes[1]->GetPitch(), winOverUV, nBlkSizeX >> xSubUV);
if(pSrcPlanes[1]) d->OVERSCHROMA(pDstTempU + (xx >> xSubUV)*2, dstTempPitchUV, pSrcPlanes[1]->GetPointer(blxsrc >> xSubUV, blysrc>>ySubUV), pSrcPlanes[1]->GetPitch(), winOverUV, nBlkSizeX >> xSubUV);
// chroma v
if(pSrcPlanes[2]) d->OVERSCHROMA(pDstTempV + (xx >> xSubUV), dstTempPitchUV, pSrcPlanes[2]->GetPointer(blxsrc >> xSubUV, blysrc>>ySubUV), pSrcPlanes[2]->GetPitch(), winOverUV, nBlkSizeX >> xSubUV);
if(pSrcPlanes[2]) d->OVERSCHROMA(pDstTempV + (xx >> xSubUV)*2, dstTempPitchUV, pSrcPlanes[2]->GetPointer(blxsrc >> xSubUV, blysrc>>ySubUV), pSrcPlanes[2]->GetPitch(), winOverUV, nBlkSizeX >> xSubUV);
}

xx += (nBlkSizeX - nOverlapX) * bytesPerSample;
Expand Down
2 changes: 1 addition & 1 deletion src/MVDegrains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ static const VSFrameRef *VS_CC mvdegrainGetFrame(int n, int activationReason, vo
d->DEGRAIN[plane](tmpBlock, tmpBlockPitch, pSrcCur[plane] + xx, nSrcPitches[plane],
pointers, strides,
WSrc, WRefs);
d->OVERS[plane](pDstTemp + xx, dstTempPitch, tmpBlock, tmpBlockPitch, winOver, nBlkSizeX[plane]);
d->OVERS[plane](pDstTemp + xx*2, dstTempPitch, tmpBlock, tmpBlockPitch, winOver, nBlkSizeX[plane]);

xx += (nBlkSizeX[plane] - nOverlapX[plane]) * bytesPerSample;

Expand Down

0 comments on commit eb931b1

Please sign in to comment.