diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index a876ee4625..c0a62bc4ec 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -52,7 +52,7 @@ static void FUNC(transquant_bypass4x4)(uint8_t *_dst, int16_t *coeffs, for (y = 0; y < 4; y++) { for (x = 0; x < 4; x++) { - dst[x] += *coeffs; + dst[x] = av_clip_pixel(dst[x] + *coeffs); coeffs++; } dst += stride; @@ -69,7 +69,7 @@ static void FUNC(transquant_bypass8x8)(uint8_t *_dst, int16_t *coeffs, for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) { - dst[x] += *coeffs; + dst[x] = av_clip_pixel(dst[x] + *coeffs); coeffs++; } dst += stride; @@ -86,7 +86,7 @@ static void FUNC(transquant_bypass16x16)(uint8_t *_dst, int16_t *coeffs, for (y = 0; y < 16; y++) { for (x = 0; x < 16; x++) { - dst[x] += *coeffs; + dst[x] = av_clip_pixel(dst[x] + *coeffs); coeffs++; } dst += stride; @@ -103,7 +103,7 @@ static void FUNC(transquant_bypass32x32)(uint8_t *_dst, int16_t *coeffs, for (y = 0; y < 32; y++) { for (x = 0; x < 32; x++) { - dst[x] += *coeffs; + dst[x] = av_clip_pixel(dst[x] + *coeffs); coeffs++; } dst += stride;