Skip to content

Conversation

@Hecklezz
Copy link
Contributor

@Hecklezz Hecklezz commented Sep 19, 2025

Description

The previous fix provided here- #3955 turned out to only be a partial fix.
There continued to be an issue where if either width or height was MIN_IMAGE_SIZE <= x <=16 it would also error out and fail to encode. The cause of this was opj_start_compress was failing internally and outputting the error "Number of resolutions is too high in comparison to the size of tiles". This is because the parameter.numresolution was never being changed and left the default 6, however the maximum number of resolutions cannot exceed the following formula-
1+lower(log2(min(width, height)))

This PR changes it so, if either dimension is <=64, it calculates the new maximum parameter.numresolution based on the formula mentioned above. This means the value will never exceed the default value of 6 that has always existed, but will lower it where necessary when either dimension is too low.

Related Issues

Testing steps:

  1. Use a Viewer without the fix and using OpenJPEG instead of KDU
  2. Attempt to upload a image where either width or height is <=16 (such as 128x16 or 16x16, etc)
  3. Observe it error out
  4. Use a viewer with the fix using OpenJPEG instead of KDU
  5. Attempt to upload a texture where either width or height is <=16 (such as 128x16 or 16x16, etc)
  6. Observe it correctly upload
  7. Test that the texture correctly applies to objects and is decoded properly on both an OpenJPEG and KDU viewer

@akleshchev akleshchev requested a review from marchcat September 19, 2025 09:31
@akleshchev
Copy link
Contributor

Please update from newer develop. We just updated build variables and your review arrived before we fixed develop to account for that, as is it doesn't build.

@Hecklezz Hecklezz force-pushed the fix/openjpeg_uploading_small_textures_2 branch from 32b89bd to c2284b3 Compare September 19, 2025 14:30
@Hecklezz
Copy link
Contributor Author

Rebased now, so should work this time.

@akleshchev akleshchev changed the base branch from develop to release/2025.07 September 19, 2025 16:14
@akleshchev akleshchev changed the base branch from release/2025.07 to develop September 19, 2025 16:16
@akleshchev
Copy link
Contributor

Thank you!

@akleshchev akleshchev merged commit 569d7c6 into secondlife:develop Sep 19, 2025
12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenJPEG issue uploading small textures can't convert to j2c

3 participants