Open fasteque opened 7 years ago
Additional remarks
I also observed this issue using Glide 4.0.0 on Nvidia Shield, Android 7.0 when loading the following images:
https://i.redd.it/i6e3jrhi5idz.jpg https://i.redditmedia.com/dKnJGi2Wmv1QiMzMlaUQPQFEtwiSwTpu9dQ58Z-VOgo.jpg?s=ef28188c88f5d493351ed73f9795cd01 https://i.redditmedia.com/Wuau4sxxknMXKjgxBxmtYeMhMFzdHJ8a4Y123ye5X2M.jpg?s=f4fdb5983a2250b265dd3eed99a60230
Glide.with(this)
.load(path)
.listener(this)
.apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.DATA))
.into(mImageView);
The same images are not skewed when using Glide 3.8.0. I guess this is because the DecodeFormat default changed to ARGB_8888 in 4.0.0?
This still occurs using Glide 4.1.0. Is there any workaround for this issue (while still using ARGB_8888)?
I checked the dimensions of images for which the skewing occurs, and noticed that at least one of the dimensions is always odd.
5345×3563 5101×3401 5297×2988 5257×3505 5298×6623 10481×3882 2963×2527 3957×2408 3162×4743 3162×4743 3877×5255 2699×3374
Does forcing DownsampleStrategy.AT_MOST or DownsampleStrategy.AT_LEAST (needs to be applied after all transformations) fix the issue?
It's probably not ARGB_8888, but you could test that as well by changing the decode type to ARGB_8888 in Glide v3 and verifying whether or not you see the issue.
Forcing DownsampleStrategy.AT_MOST or DownsampleStrategy.AT_LEAST does not fix the issue.
Using Glide 3.8.0 with ARGB_8888 does cause some images to skew (as noted by the original reporter, fasteque). What's interesting is that Glide 4.1.1 with ARGB_8888 caused some images to be skewed that were not skewed on Glide 3.8.0 with ARGB_8888. Details below.
Glide 4.1.1 with ARGB_8888 - skew (groups A and B) Glide 4.1.1 with ARGB_8888 with DownsampleStrategy.AT_MOST - skew (groups A and B) Glide 4.1.1 with ARGB_8888 with DownsampleStrategy.AT_LEAST - skew (groups A and B) Glide 4.1.1 with RGB_565 - no skew
Glide 3.8.0 with ARGB_8888 - skew (group A only) Glide 3.8.0 with RGB_565 - no skew
Group A: https://i.redd.it/6ayuikn2jgnz.jpg https://i.redd.it/bnvtlpk11inz.jpg
Group B: https://i.redd.it/g06rxz5nrhnz.jpg https://i.redd.it/308kn8c5tenz.jpg https://i.redd.it/dg0yypsw8gnz.jpg https://i.redd.it/kubm438msinz.jpg
The skewing occurs on Nvidia Shield, but not on Nexus Player or the Android TV emulator.
Just wanted to comment quickly that I believe there should be a fix for this in the next shield OS update.
Thanks for the info! It would be great to hear any more details you have about this. According to the original reporter it's also reproducible on the Mi Box. Even if this was fixed for the Nvidia Shield, I wouldn't be able to switch my app over to use ARGB_8888 without understanding the cause of this and which other devices are affected.
This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.
I can confirm that this issue no longer occurs with Shield Experience 6.2. I'd still like to know the cause of this and which other devices are affected.
Yeah me too actually. There was one older instance of this: https://github.com/bumptech/glide/issues/129.
If we can figure out exactly what the cause is we might be able to work around it in the library.
For the attached images above, does loading them in any size skew? Or only at specific sizes? If it's specific, could you provide a couple of example sizes?
If you disable Bitmap re-use (use BitmapPoolAdapter) do you still see this?
Yep, I can confirm as well with Shield Experience 6.2 (main Android version is still 7.0, where the original issue was occurring) is not reproducible anymore.
Using BitmapPoolAdapter did not fix the issue. Tested by putting the following in my AppGlideModule:
@Override
public void applyOptions(Context context, GlideBuilder builder) {
builder.setBitmapPool(new BitmapPoolAdapter());
}
Testing with https://i.redd.it/nppva79db5zz.jpg which is 3601×4646, I tried resizing to a number of different heights (837×1080, 837×1079, 836×1078, 835×1077, 834×1076) but the result was always skewed. It seems like it's the source image dimensions which causes the skew, since one of those dimensions is always odd.
I uploaded a few test images: https://imgur.com/KbaV1T8, 2699×3374, skew https://imgur.com/CX8cdO2, 2699×3373, skew https://imgur.com/jRE4IMI, 2698×3374, no skew https://imgur.com/t56FtCz, 2698×3373, no skew
When I try to load this particular image, it gets skewed as you can see. That's the first time I see this issue on Android TV, I've never had this issue before (I'm also using images with the same resolution).
Test image: https://www.mycloud.ch/s/S00339A78D4B53E687A5F536B4AD90FD3B91180FC81D086F523D7813A130C2F1 Result on screen: https://www.mycloud.ch/s/S002854C7D41ACC6A035E5DDFADE5B3037098A1DC071E13E413AD251DE8EFFFA
I've observed that if I don't change the format, then the image is correctly rendered on screen.
Originally the image was loaded from the network (see logs), but it occurs also when used as a drawable.
Please notice that if I try to use this image on a sample application running on a mobile (S7 Edge, Android 7.0), everything works fine.
Glide Version: 3.7.0 and 3.8.0-SNAPSHOT Integration libraries: okhttp3-integration:1.4.0@aar Device/Android Version: Nvidia Shield TV, Android 7.0 Issue details / Repro steps / Use case background: loading an image in a ImageView
Glide load line /
GlideModule
(if any) / list Adapter code (if any):Layout XML:
Stack trace / LogCat: