avcodec/ivi: Only clip samples when needed in ivi_output_plane()

435740 -> 396078 dezicycles

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2018-08-04 02:31:58 +02:00
parent 6d8a289c98
commit 82920bf494
1 changed files with 9 additions and 2 deletions

View File

@ -913,8 +913,15 @@ static void ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, ptrdiff_t dst_pi
return; return;
for (y = 0; y < plane->height; y++) { for (y = 0; y < plane->height; y++) {
for (x = 0; x < plane->width; x++) int m = 0;
dst[x] = av_clip_uint8(src[x] + 128); for (x = 0; x < plane->width; x++) {
int t = src[x] + 128;
dst[x] = t;
m |= t;
}
if (m & ~255)
for (x = 0; x < plane->width; x++)
dst[x] = av_clip_uint8(src[x] + 128);
src += pitch; src += pitch;
dst += dst_pitch; dst += dst_pitch;
} }