New issue
Advanced search Search tips

Issue 620475 link

Starred by 3 users

Issue metadata

Status: Archived
Owner: ----
Closed: Sep 13
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

disable chroma subsampling in jpeg encoder for device inspection

Reported by pdk...@gmail.com, Jun 15 2016

Issue description

Chrome 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;

 

Comment 1 by ajha@chromium.org, Jun 16 2016

Cc: e...@chromium.org
Cc'ing erg@ for more inputs on this from the owners list:  https://cs.chromium.org/chromium/src/ui/gfx/codec/OWNERS
Cc: pfeldman@chromium.org
Labels: Te-NeedsFurtherTriage
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.

Comment 5 by pdk...@gmail.com, 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.
Components: Blink>Image

Comment 7 by f...@opera.com, Jul 1 2016

Components: -Blink>Image Platform>DevTools
Labels: OS-Chrome

Comment 8 by f...@opera.com, Jul 1 2016

Labels: -OS-Chrome
Components: UI>GFX
Summary: disable chroma subsampling in jpeg encoder for device inspection (was: disable chroma subsampling in jpeg encoder)
The code lives in ui/gfx, so adding that label.

Comment 10 by alph@chromium.org, Jul 11 2016

Cc: -pfeldman@chromium.org
Owner: pfeldman@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 11 by pdk...@gmail.com, Aug 21 2016

Labels: -Te-NeedsFurtherTriage TE-NeedsfurtherTriage
   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.

Comment 12 by pdk...@gmail.com, Aug 21 2016

(I didn't change any labels. Might be a Monorail bug.)
Components: -Platform>DevTools
Owner: ----
Status: Untriaged (was: Assigned)
Not related to devtools.

Comment 14 by pdk...@gmail.com, 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);
 }

Comment 15 by e...@chromium.org, Mar 9 2018

Cc: -e...@chromium.org
Un-cc-ing me from all bugs on my final day.
Status: Archived (was: Untriaged)
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!
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!
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