Browse Source

swscale/yuv2rgb: clip cy, avoid division by 0 with 0 contrast

Found-by: durandal_1707
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.1
Michael Niedermayer 11 years ago
parent
commit
d0a3bc1302
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      libswscale/yuv2rgb.c

+ 4
- 4
libswscale/yuv2rgb.c View File

@@ -768,10 +768,10 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
c->yuv2rgb_u2b_coeff = (int16_t)roundToInt16(cbu << 13);

//scale coefficients by cy
crv = ((crv << 16) + 0x8000) / cy;
cbu = ((cbu << 16) + 0x8000) / cy;
cgu = ((cgu << 16) + 0x8000) / cy;
cgv = ((cgv << 16) + 0x8000) / cy;
crv = ((crv << 16) + 0x8000) / FFMAX(cy, 1);
cbu = ((cbu << 16) + 0x8000) / FFMAX(cy, 1);
cgu = ((cgu << 16) + 0x8000) / FFMAX(cy, 1);
cgv = ((cgv << 16) + 0x8000) / FFMAX(cy, 1);

av_freep(&c->yuvTable);



Loading…
Cancel
Save