1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

swscale: fix gray -> grayf32 SIGFPE

swscale internals don't distinguish between 16-bit and higher bit depth
output formats internally when it comes to the choice of intermediate
representation.

Clamping this value both prevents a SIGFPE and also aligns the check
with reality.
This commit is contained in:
Niklas Haas
2025-03-07 19:36:29 +01:00
parent 9e857e1f8a
commit 8ab40ca984

View File

@ -586,7 +586,7 @@ static void solve_range_convert(uint16_t src_min, uint16_t src_max,
static void init_range_convert_constants(SwsInternal *c) static void init_range_convert_constants(SwsInternal *c)
{ {
const int bit_depth = c->dstBpc ? c->dstBpc : 8; const int bit_depth = c->dstBpc ? FFMIN(c->dstBpc, 16) : 8;
const int src_bits = bit_depth <= 14 ? 15 : 19; const int src_bits = bit_depth <= 14 ? 15 : 19;
const int src_shift = src_bits - bit_depth; const int src_shift = src_bits - bit_depth;
const int mult_shift = bit_depth <= 14 ? 14 : 18; const int mult_shift = bit_depth <= 14 ? 14 : 18;