Ico Doornekamp
e112096885
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-04-28 03:47:13 +02:00
..
2015-05-23 22:36:02 +02:00
2015-11-26 01:37:09 +01:00
2015-03-05 15:57:48 +01:00
2015-03-19 01:44:14 +01:00
2015-06-08 03:36:22 +02:00
2015-04-07 22:50:07 +02:00
2015-05-04 17:49:36 +02:00
2015-11-26 01:37:09 +01:00
2016-01-15 16:00:31 +01:00
2015-04-19 12:41:59 +01:00
2015-04-16 21:09:32 +02:00
2015-06-08 22:37:41 +02:00
2016-01-31 00:23:46 +01:00
2015-11-26 01:37:09 +01:00
2015-05-29 00:04:41 +02:00
2015-06-01 00:43:50 +02:00
2016-01-31 00:23:45 +01:00
2015-06-18 22:09:01 +02:00
2016-01-15 16:00:31 +01:00
2015-04-17 20:03:16 +02:00
2015-04-22 20:22:19 +02:00
2015-02-26 23:19:39 +01:00
2016-01-28 01:05:04 +01:00
2016-04-28 03:47:13 +02:00
2015-05-13 20:11:37 +02:00
2015-03-16 15:40:10 +01:00
2016-01-31 00:23:46 +01:00
2016-04-28 03:47:13 +02:00
2015-05-11 01:56:11 +02:00
2015-05-26 00:29:36 +02:00
2015-02-26 02:06:10 +01:00
2015-04-28 19:29:47 +02:00
2015-12-14 16:51:00 +01:00
2015-03-26 03:10:27 +01:00
2015-03-15 13:45:31 +01:00
2015-11-26 01:37:09 +01:00
2016-01-28 00:49:08 +01:00
2015-02-27 13:38:43 +01:00
2015-04-10 12:35:02 +02:00
2015-05-11 15:31:55 +02:00
2015-06-05 21:56:09 +02:00
2015-06-18 22:09:01 +02:00
2015-04-25 03:43:59 +02:00
2015-04-03 00:10:09 +02:00
2015-03-29 12:31:00 +02:00
2015-05-30 03:57:20 +02:00
2015-06-08 00:35:43 +02:00
2015-11-12 02:55:45 +01:00
2016-01-15 16:00:32 +01:00
2015-05-17 17:15:03 +02:00
2015-06-06 09:24:50 +02:00
2015-11-12 02:55:46 +01:00
2015-04-06 14:44:33 +02:00
2015-05-11 20:21:48 +02:00
2015-05-12 18:40:16 +02:00
2015-05-06 21:05:16 +02:00
2016-01-31 00:23:45 +01:00
2016-01-31 00:23:45 +01:00
2015-05-22 15:30:31 +02:00
2016-01-28 00:48:51 +01:00
2015-05-26 19:54:41 +02:00
2015-04-20 03:19:47 +02:00
2016-01-31 00:23:45 +01:00
2015-04-16 13:06:35 +02:00
2015-11-12 02:55:47 +01:00
2016-01-31 00:23:46 +01:00
2015-04-06 01:59:04 +02:00
2015-03-11 01:34:37 +01:00
2015-06-08 03:36:22 +02:00
2015-04-08 12:36:53 +02:00
2015-04-08 12:36:53 +02:00
2015-11-26 01:37:09 +01:00
2015-12-14 16:51:01 +01:00
2015-04-08 20:58:25 +02:00
2015-12-20 14:18:04 +01:00
2015-03-22 03:52:37 +01:00
2015-04-20 03:19:47 +02:00
2015-04-20 03:19:47 +02:00
2015-05-31 13:05:12 +02:00
2016-04-28 03:47:13 +02:00
2015-06-01 17:54:58 +02:00
2015-03-19 13:38:25 +01:00
2015-02-25 00:48:50 +01:00
2015-10-20 12:46:22 +02:00
2015-05-17 12:57:27 +02:00
2015-05-25 13:34:34 +02:00
2015-05-26 12:02:44 +02:00
2015-12-14 16:51:00 +01:00
2015-03-15 13:39:56 +01:00
2015-06-09 10:07:11 +02:00
2015-05-27 17:29:18 +02:00
2015-11-12 02:55:45 +01:00
2015-04-03 13:26:39 +02:00
2015-05-10 14:39:27 +02:00
2015-11-26 01:37:13 +01:00
2015-12-14 16:51:01 +01:00
2015-11-12 02:55:46 +01:00
2015-05-31 10:10:16 +03:00
2015-04-21 02:19:07 +02:00
2015-05-20 19:07:26 +02:00
2015-12-20 14:17:59 +01:00
2015-05-10 16:26:58 +02:00
2015-12-20 14:18:11 +01:00
2015-04-20 22:12:08 +02:00
2015-10-09 21:35:11 +02:00
2015-07-18 20:23:45 +02:00
2015-04-22 22:27:05 +02:00
2015-05-10 08:47:53 +02:00
2015-04-20 03:19:47 +02:00
2015-11-12 02:55:45 +01:00
2015-06-18 16:39:09 -03:00
2015-03-05 01:40:03 +01:00
2015-05-25 23:39:56 +02:00
2015-11-26 01:37:09 +01:00
2015-11-26 01:37:12 +01:00
2015-06-04 17:03:34 +02:00
2015-04-20 03:19:47 +02:00
2015-06-07 21:55:46 +02:00
2015-11-18 19:33:32 +01:00
2015-06-01 11:29:05 +02:00
2015-06-01 11:29:05 +02:00
2015-04-20 03:19:47 +02:00
2015-02-25 00:58:39 +01:00
2015-02-25 00:03:52 +01:00
2015-06-08 23:05:01 +02:00
2015-02-25 00:58:39 +01:00
2015-03-05 10:05:44 +02:00
2015-02-25 00:58:39 +01:00
2015-02-25 00:58:39 +01:00
2015-02-24 22:34:08 +01:00
2015-02-25 00:58:39 +01:00
2015-04-20 03:19:47 +02:00
2015-02-24 23:44:25 +01:00
2016-04-28 03:47:13 +02:00
2015-02-25 00:58:39 +01:00
2015-03-04 11:31:55 +01:00
2015-02-25 00:58:39 +01:00
2015-02-24 22:34:08 +01:00
2015-02-25 00:58:39 +01:00
2015-02-24 22:55:20 +01:00
2015-02-24 22:55:20 +01:00
2015-03-05 01:20:25 +01:00
2015-02-25 00:58:39 +01:00
2015-02-25 00:58:39 +01:00
2015-03-11 20:28:45 +01:00
2015-05-12 18:07:32 +02:00
2015-04-20 03:19:47 +02:00
2015-02-25 00:58:39 +01:00
2015-03-01 01:31:49 +01:00
2015-03-01 01:31:49 +01:00
2015-02-25 00:48:50 +01:00
2015-02-24 23:30:51 +01:00
2015-05-12 17:55:40 +02:00
2015-03-10 11:17:37 +01:00
2015-03-01 01:31:49 +01:00
2016-04-28 03:47:13 +02:00
2015-02-24 23:30:51 +01:00
2015-04-11 18:53:54 +02:00
2015-05-15 20:21:37 +02:00
2015-04-01 21:34:20 +02:00
2015-05-27 21:48:47 +02:00
2015-06-02 16:42:33 +02:00
2015-06-08 22:35:53 +02:00
2015-04-23 12:56:31 +02:00
2015-04-12 17:14:20 +02:00
2015-10-09 21:34:38 +02:00
2015-04-12 17:14:20 +02:00
2015-03-09 21:05:29 +01:00
2015-12-14 16:51:00 +01:00
2015-03-04 19:28:53 +01:00
2015-10-09 21:28:20 +02:00
2015-05-11 12:42:38 +02:00
2015-05-11 12:42:38 +02:00
2015-07-08 12:40:10 +02:00
2015-05-24 13:32:53 +02:00
2015-04-09 20:58:11 +02:00
2015-06-18 22:09:01 +02:00
2015-05-27 22:24:00 +02:00
2015-06-09 01:06:32 +02:00
2015-06-08 14:08:52 +02:00
2015-06-08 14:08:52 +02:00
2015-03-29 22:10:05 +02:00
2015-04-09 20:58:11 +02:00
2015-05-11 03:50:01 +02:00
2015-03-27 18:29:46 +01:00
2016-04-28 03:47:13 +02:00
2015-06-08 04:00:45 +02:00
2015-05-11 15:56:16 +02:00
2015-05-11 15:56:16 +02:00
2015-11-26 01:37:09 +01:00
2015-05-17 02:08:58 +02:00
2015-06-09 21:19:57 +02:00
2015-05-15 00:56:43 +02:00
2015-05-22 00:17:53 +02:00
2015-11-12 02:55:46 +01:00
2015-11-26 01:37:09 +01:00
2015-04-11 13:50:50 +02:00
2015-04-24 03:43:56 +02:00
2015-11-12 02:55:47 +01:00
2015-11-26 01:37:09 +01:00