• Ico Doornekamp's avatar
    rtpdec_jpeg: fix low contrast image on low quality setting · edf54887
    Ico Doornekamp authored
    The problem is that the argument 'q' is of the type uint8_t.
    According to the JPEG standard, if 1 <= q <= 50, the scale factor
    'S' should be 5000 / Q. Because the create_default_qtables() reuses
    the variable 'q' to store the result of this calculation, for small
    values of q < 19, q wil subsequently overflow and give wrong results
    in the calculated quantization tables.
    
    Instead, use a new variable 'S' (same name as in RFC2435) with the
    proper range to store the result of the division.
    Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
    edf54887
rtpdec_jpeg.c 12.6 KB