-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.setDownsampleEnabled(true) then resize don't work for webp with at least Android API =17 #1310
Comments
Hello, I think it's a bug related to webp usage : If I prefetch a jpg picture, then display it, downsample is well done for API 17 :
If I prefetch a webp picture (named img.jpg and not img.webp), then display it, downsample is not done : I use mod_pagespeed (https://developers.google.com/speed/pagespeed/module/):
A curl example of a request : The server response : exiftool img.jpg : So, the response is always a webp, from API 10 to ... I stiil have to try with one pictures simply named img.webp ... Thanks, Eric ` |
Hello,
Test KO : no log for downsampling, and DecodeProducer is longest for about x4 compare to API 10
Looking at this :
I have tryed to force lossy webp request (as it's API 17) and see if downsample is done : No change : KO. Full fresco logs from combined tests with API 10 vs API 17 (picture is the same for all runs): logs_fresco_downsample_webp.txt two android API 17 debug info : But image is wrap with aspect ratio :
build draweeView with params : request picture Then set aspect ratio :
|
Hello, Setting fixed values to width and height for layout does not solved - "webp pictures are not downsampled for API 17":
`06-21 18:16:09.826 21639-22178//tld.domain.app W/dalvikvm: VFY: unable to resolve virtual method 626: Landroid/graphics/Bitmap;.getAllocationByteCount ()I`` The diff from API10/API17 is that all off previous logs are not present. For API 10 the logs are only:
and the picture is downsampled :
and deco |
|
Hello, As request is made with same headers with okHttp (3 now), the same picture send to both device with API 10 and API 17 have same size : The .ext is .jpg, but it's a webp :
The server response : exiftool img.jpg : But files stores in Android app cache are different in size, encoding ... API 10 stored file (.cnt) : ExifTool Version Number : 9.16 API 17 stored file (.cnt) : ExifTool Version Number : 9.16 Should it be the I will check. If So EncodedImage.isMetaDataAvailable(encodedImage) will always be false for API 17. |
Thank you very much for the very detailed description @eldk , that is amazing! As you've mentioned previously this is still experimental and has a couple of issues. |
@oprisnik , thanks. Should you have a look here : https://groups.google.com/forum/#!topic/mod-pagespeed-discuss/GbntPnwiGTU that's not a direct matter but should enhance the use of Fresco and the app user respect on "get what you need, for what you should expect from what your device can do". |
Hello, I don't know if that should be opened in another topic, "mod_pagespeed/ngx_pagespeed : Provide support for image-resizing in-place " : From Fresco side, that would be done with oKHttp backend that can modify request headers. apache/incubator-pagespeed-mod#1329 preambule : https://groups.google.com/forum/#!topic/mod-pagespeed-discuss/GbntPnwiGTU Thanks, Eric PS : @tyronen ... , should you have a look |
Hello, API 17 : When webp pictures are used, downsample, nor resize are done.
with setDownSampleEnabled(true) :
without //setDownSampleEnabled(true) :
With jpg : |
Hello, API 17 :
remove static-webp from build change nothing (picture is displayed), except :
|
Hello, API 17 :
Enable downsample for webp to test : Have you some pictures ... info, on what is https://github.com/eldk/fresco/blob/9730761f004f819f7d18f2b38e5b778664b16747/imagepipeline-base/src/main/java/com/facebook/imagepipeline/image/EncodedImage.java#L282 ? I have tryed with a set of 50 webp pictures (WEBP_SIMPLE) but no error and all webps are "downsampled". And no more :
`06-21 18:16:09.826 21639-22178//tld.domain.app W/dalvikvm: VFY: unable to resolve virtual method 626: Landroid/graphics/Bitmap;.getAllocationByteCount ()I`` Thanks, Eric https://chromium.googlesource.com/webm/libwebp/+/master/doc/ |
Create a branch with update to libwebp 0.5.1 (static-webp) with downsample enabled (commented if statement master...eldk:mlibwebp0.5.1+downsampleWebp#diff-834406681de434c4151758dd5d280b43R285) for webp : About to publish one app version with listener on producer ... to build stats on times to fetch, transcode, decode ... |
@eldk you are great! |
Hello, as libwebp 0.5.1 is now merged in Fresco/Master (#1388). I deleted all branches, from my repository, with previous libwebp versions. Branche with downsample enable for webp (to test) is here : https://github.com/eldk/fresco/tree/mDownSample (diff is here : eldk@8e91c71) |
Hello, Fresco master branch handle now the size of webp pictures (474f62a). Thanks, Eric |
Hello, Here are/will be some datas about times to display pictures with Fresco : https://neptune.opalesurfcasting.net/
So datas are :
Times are in milliseconds (converted from nanos). The next step will be to request and build adapted device dpi pictures on the fly. Thanks, PS :
|
Hello,
Testing Fresco with .setDownsampleEnabled(true) on one API 17 device, I don't have the downsample fresco logs (RequestLoggingListener).
With another device, that is API 10, files are well downsampled. I could see the RequestLoggingListener lines.
The API 10 device, with same Fresco settings (downsample and resize to same size) is fastest (about x2 to x4 ) to decode picture that the API 17 one.
API 10 :
RequestLoggingListener: time 210302582: onProducerFinishWithSuccess: {requestId: 11, producer: DecodeProducer, elapsedTime: 273 ms, extraMap: {bitmapSize=1600x1067, queueTime=0, imageType=DEFAULT, isFinal=true, hasGoodQuality=true}}
API 17 :
RequestLoggingListener: time 89545018: onProducerFinishWithSuccess: {requestId: 52, producer: DecodeProducer, elapsedTime: 928 ms, extraMap: {bitmapSize=1600x1067, queueTime=2, imageType=DEFAULT, isFinal=true, hasGoodQuality=true}}
On API 10, I can find the Downsample log line :
DownsampleUtil: Downsample - Specified size: 2048x2048, image size: 1600x1067 ratio: 1.3 x 1.9, ratio: 1.919 for http://domain.tl/picture.jpg
Thus I can't in API 17.
I have read this (http://frescolib.org/docs/configure-image-pipeline.html#_) and see downsample is experimental, but which Android version are supported, and which are not ?
This have been tested with fresco 0.10.0, 0.11.0.
All tested pictures are prefetch to disk and stored there before to be displayed.
Greatings,
Eric
The text was updated successfully, but these errors were encountered: