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