Skip to content

Commit

Permalink
Degrain: fix integer overflow with 16 bit input
Browse files Browse the repository at this point in the history
With large enough thsad, the filter would become a very slow no-op.
  • Loading branch information
cantabile committed Jan 4, 2016
1 parent b2ed212 commit dec5b64
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/MVDegrains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,8 @@ static void VS_CC mvdegrainCreate(const VSMap *in, VSMap *out, void *userData, V
return;
}

d.thSAD[0] = d.thSAD[0] * d.mvClips[Backward1]->GetThSCD1() / d.nSCD1; // normalize to block SAD
d.thSAD[1] = d.thSAD[2] = d.thSAD[1] * d.mvClips[Backward1]->GetThSCD1() / d.nSCD1; // chroma threshold, normalized to block SAD

d.thSAD[0] = (int64_t)d.thSAD[0] * d.mvClips[Backward1]->GetThSCD1() / d.nSCD1; // normalize to block SAD
d.thSAD[1] = d.thSAD[2] = (int64_t)d.thSAD[1] * d.mvClips[Backward1]->GetThSCD1() / d.nSCD1; // chroma threshold, normalized to block SAD


d.node = vsapi->propGetNode(in, "clip", 0, 0);
Expand Down

0 comments on commit dec5b64

Please sign in to comment.