disable chroma subsampling in jpeg encoder for device inspection
Reported by
pdk...@gmail.com,
Jun 15 2016
|
||||||||||||
Issue descriptionChrome Version : 51.0.2704.84 I noticed in the remote debugging feature of the developer tools that the feed from the device is compressed badly and has signs of 4:2:0 (2x2) chroma subsampling. This severely limits the quality regardless of the general quality setting used. It's particularly bad for website-like images. https://groups.google.com/d/topic/google-chrome-developer-tools/ZRK3Ol2bSSc/discussion I assumed it's VP8, but it's actually sending JPEG images. The JPEG::Encoder is also used in other parts of the UI, apparently NTP and wallpapers on ChromeOS. https://cs.chromium.org/search/?q=jpegcodec::encode&sq=package:chromium&type=cs A simple patch, I think. https://cs.chromium.org/chromium/src/ui/gfx/codec/jpeg_codec.cc?l=264 jpeg_set_quality(&cinfo, quality, 1); // quality here is 0-100 + cinfo->comp_info[0].v_samp_factor = 1; + cinfo->comp_info[0].h_samp_factor = 1; From libjpeg.txt documentation. > [...] 2x2 > chrominance subsampling (AKA "4:2:0") is the default, but you can > explicitly disable subsampling as follows: > cinfo->comp_info[0].v_samp_factor = 1; > cinfo->comp_info[0].h_samp_factor = 1;
,
Jun 17 2016
,
Jun 23 2016
,
Jun 23 2016
You might need to control it with a parameter - not sure if other clients of jpec_codec will be happy otherwise. How does it affect the size of the payload / time to compress? jpeg use for remote debugging screencast is suboptimal, so if there is anything we can do to improve it - let us know. We don't need to use jpeg, it was just a poorman's solution that performed well-ish.
,
Jun 23 2016
It increases size by about 10-40% depending on the image. On websites, it's definitely towards the lower end of that scale due to uniformly colored areas. It increases encoding time by around the same percentage. As to the other question, I'm not familiar on how this feature even works, so I don't know. It'd be nice if uncompressed was an option.
,
Jul 1 2016
,
Jul 1 2016
,
Jul 1 2016
,
Jul 1 2016
The code lives in ui/gfx, so adding that label.
,
Jul 11 2016
,
Aug 21 2016
jpeg_set_quality(&cinfo, quality, 1); // quality here is 0-100 + cinfo.comp_info[0].v_samp_factor = 1; + cinfo.comp_info[0].h_samp_factor = 1; Works well. There is a noticeable improvement. I also tried PNG, which should work, but doesn't. It still sends JPG. I must be editing the wrong code.
,
Aug 21 2016
(I didn't change any labels. Might be a Monorail bug.)
,
Oct 4 2017
Not related to devtools.
,
Oct 6 2017
Updated patch for current version. --- a/ui/gfx/codec/jpeg_codec.cc +++ b/ui/gfx/codec/jpeg_codec.cc @@ -55,6 +55,7 @@ bool JPEGCodec::Encode(const SkPixmap& src, SkJpegEncoder::Options options; options.fQuality = quality; + options.fDownsample = SkJpegEncoder::Downsample::k444; return SkJpegEncoder::Encode(&dst, src, options); }
,
Mar 9 2018
Un-cc-ing me from all bugs on my final day.
,
Sep 13
Archiving old bugs that haven't been actively assigned in over 180 days. If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks!
,
Sep 13
Archiving old bugs that haven't been actively assigned in over 180 days. If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks!
,
Sep 13
Archiving old bugs that haven't been actively assigned in over 180 days. If you feel this issue should still be addressed, feel free to reopen it or to file a new issue. Thanks! |
||||||||||||
►
Sign in to add a comment |
||||||||||||
Comment 1 by ajha@chromium.org
, Jun 16 2016