Commit 125b9c43 authored by Taoran Lu's avatar Taoran Lu
Browse files

add clipping in chroma residue scaling to avoid potential overflow

parent 65f5a45f
......@@ -448,7 +448,7 @@ void AreaBuf<Pel>::scaleSignal(const int scale, const bool dir, const ClpRng& cl
{
sign = src[x] >= 0 ? 1 : -1;
absval = sign * src[x];
dst[x] = sign * ((absval * scale + (1 << (CSCALE_FP_PREC - 1))) >> CSCALE_FP_PREC);
dst[x] = (Pel)Clip3(-maxAbsclipBD, maxAbsclipBD, sign * ((absval * scale + (1 << (CSCALE_FP_PREC - 1))) >> CSCALE_FP_PREC));
}
dst += stride;
src += stride;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment