ffmpeg/libavformat
Ico Doornekamp e3e6a2cff4 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>
2016-03-24 15:40:10 +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-03-11 11:19:10 -05:00
2016-03-13 16:06:09 +01:00
2016-01-04 13:44:16 +01:00
2016-03-12 02:08:45 +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
2015-11-21 21:03:51 +01:00
2014-08-24 11:05:42 +00:00
2015-05-26 19:54:41 +02:00
2016-03-06 17:29:32 +01:00
2014-07-13 19:18:31 +02:00
2014-07-13 19:18:31 +02:00
2016-03-10 18:42:27 +01:00
2016-03-11 11:19:10 -05:00
2016-02-26 21:34:33 +01:00
2016-01-13 09:37:11 +01:00
2016-02-19 15:47:33 +01: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-03-01 20:52:33 +01:00
2016-03-17 16:50:15 +01:00
2015-10-26 23:24:45 -07:00
2015-11-12 04:39:14 +01:00
2015-11-23 18:34:52 -08:00
2016-03-24 12:35:19 +01:00
2015-01-11 00:35:01 +01:00
2016-01-30 13:08:37 +01: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