1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00
FFmpeg/libavformat
Ico Doornekamp daa6dc0a3b avformat/rtpdec_jpeg: fix low contrast image on low quality setting
Original mail and my own followup on ffmpeg-user earlier today:

I have a device sending out a MJPEG/RTP stream on a low quality setting.
Decoding and displaying the video with libavformat results in a washed
out, low contrast, greyish image. Playing the same stream with VLC results
in proper color representation.

Screenshots for comparison:

  http://zevv.nl/div/libav/shot-ffplay.jpg
  http://zevv.nl/div/libav/shot-vlc.jpg

A pcap capture of a few seconds of video and SDP file for playing the
stream are available at

  http://zevv.nl/div/libav/mjpeg.pcap
  http://zevv.nl/div/libav/mjpeg.sdp

I believe the problem might be in the calculation of the quantization
tables in the function create_default_qtables(), the attached patch
solves the issue for me.

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. The
patch below uses a new variable 'S' (same name as in RFC2435) with the proper
range to store the result of the division.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e3e6a2cff4af9542455d416faec4584d5e823d5d)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-26 21:52:48 +01:00
..
2015-10-30 03:02:41 +01:00
2015-11-03 12:26:09 +01:00
2016-02-01 10:51:46 +01:00
2015-11-12 04:39:14 +01:00
2015-11-12 04:39:14 +01:00
2016-02-02 03:39:34 +01:00
2016-02-02 03:39:34 +01:00
2016-02-02 03:39:34 +01:00
2016-01-04 13:44:16 +01:00
2015-10-04 01:37:31 +02:00
2015-10-29 21:26:43 +01:00
2016-01-11 17:16:18 +01:00
2016-01-26 20:56:55 +01:00
2015-11-21 21:03:51 +01:00
2016-01-18 00:36:44 +01:00
2014-08-24 11:05:42 +00:00
2015-05-26 19:54:41 +02:00
2016-01-08 23:27:10 +01:00
2014-07-13 19:18:31 +02:00
2014-07-13 19:18:31 +02:00
2014-08-15 22:47:45 +02:00
2016-01-24 16:01:04 +00:00
2016-02-09 19:19:43 +01:00
2016-01-21 13:16:24 +01:00
2016-01-13 09:37:11 +01:00
2016-01-30 17:44:13 +00:00
2015-11-20 20:52:37 +01:00
2015-09-01 13:35:37 +02:00
2014-10-21 03:52:27 +02:00
2016-01-01 18:31:49 +01:00
2015-10-26 23:24:45 -07:00
2015-11-12 04:39:14 +01:00
2016-02-02 03:39:34 +01:00
2015-11-23 18:34:52 -08:00
2015-01-11 00:35:01 +01:00
2016-01-30 13:08:37 +01:00
2016-01-31 15:52:23 -08:00
2015-10-20 09:41:11 +02:00
2015-10-25 11:05:56 +01:00
2015-10-25 17:37:17 +01:00