Git Product home page Git Product logo

renderscript_texture_compressor's People

Contributors

ndorigatti avatar nicastel avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

renderscript_texture_compressor's Issues

ETC2 encoding

ETC2 is the improved successor of ETC1 and it will be soon available on all new Android terminals. It will be interesting to add a compressor for this format. The algorithm basic principle are very similar so it should not be too much difficult to implement it.

Reference :
http://www.jacobstrom.com/publications/StromPetterssonGH07.pdf
http://www.graphicshardware.org/previous/www_2007/presentations/strom-etc2-gh07.pdf
https://www.khronos.org/assets/uploads/developers/library/2012-siggraph-opengl-es-bof/Ericsson-ETC2-SIGGRAPH_Aug12.pdf

Integration of a DDS writer in addition of the PKM one

The DDS format can perfectly handle an ETC1 texture (with the FOURCC "ETC1" in the header) since the size and structure (4x4 pixel block encoded as 64 bit) is exactly the same as DXT1.

The DDS format as some advantages over PKM : mipmap in the same file, texture array (to have 2 textures ETC1 in the same file : 1 RGB / 1 ALPHA).

Better handling of mipmap generation within the renderscript compressor

The addition of mipmap could be easily added but it comes with an important degradation of performance in the renderscript implementation (remark : not in the Java one).

The simple solution is to call the renderscript kernel for each mipmap level but each call have a cost that become prohibitive and even bring lower performance than the Java implementation for smaller level.

[QUESTION] Write ETC1 Compressed Texture in a Swing Application

Hi @nicastel , I'm looking at this wonderful repo to find out if it could be possibile to write to a file the ETC1 compressed texture as pkm format instead of writing the PNGs.

I have done a swing application that from a GEOTIFF creates the tiles for worldwind but it writes PNG files.
Since in the worldwind app, PNGs must be read, compressed and then showed, I'd prefer to compress the tiles in the desktop app since it is made one time only (the app will be offline, so tiles are prepared in desktop app).
I am looking at the pure Java implementation but i see that in the file ETC1Benchmarck.testJavaETC1ImageCompressor
you have a "testing purpose" file writing that states:

if (texture != null) {
int estimatedMemorySize = ETC1.ETC_PKM_HEADER_SIZE+ texture.getHeight() * texture.getWidth() / 2;
File f = new
File(Environment.getExternalStorageDirectory(),"bmngpkm.pkm");
f.delete();
f.createNewFile();
ETC1Util.writeTexture(texture, new FileOutputStream(f));
System.out.println("Texture PKM created ");
}

Do you think we can make ETC1Util.writeTexture available for Swing Application too?
I was looking at what the method does
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.2_r1/android/opengl/ETC1Util.java#ETC1Util.writeTexture%28android.opengl.ETC1Util.ETC1Texture%2Cjava.io.OutputStream%29
and it seems to rely on "convertable" code, but two functions are native:
ETC1.formatHeader and ETC1.getEncodedDataSize

from your expertees and knowledge, do you think is feasible or do you have already tried/done it?

The signature method of ETC1Util can be changed from:
(ETC1Texture texture, OutputStream output)
to
(ByteBuffer dataBuffer, int width, int height, OutputStream output)
and all the references to ETC1Texture on desktop are removed, but I'm scared about those native methods.

Many Thanks,
Nicola

Texture corruption problem into DDS/Renderscript

Here is the problem found during integration with WorldWind :

I have found some texture corruption problem when using the client side renderscript compressor. They are mostly visible when you tilt the view (with a very strange effect) wich means this is mot likely due to some problems during mipmap compression. For the time being it is better to deactivate client side texture compression by putting :
.jpg in BMNGWMSLayer.xml and EarthElevationModelAsBil16.xml

There is no such problem with server side on the fly compression with Geoserver (based on my JavaETC1) and Mapserver (based on gdal/crunch)

Add of a DXT1/3 to ETC1 renderscript transcoder

The DDS with DXT1/3 texture compression is a format already available on some WMS. It will be cheaper and more efficient to trans-code from this format directly in the renderscript kernel at block level instead of using JPEG/PNG source that needs to be completely decoded then re-encoded.
The only drawback is that this can cause some additional artifact.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.