Comments (5)
BC4 and BC5 are very easy to implement even if you don't know ISPC.
inline void load_block_interleaved_alpha(float block[16], uniform rgba_surface* uniform src, int xx, uniform int yy)
{
for (uniform int y = 0; y<4; y++)
for (uniform int x = 0; x<4; x++)
{
uniform uint8* uniform src_ptr = &src->ptr[min((yy * 4 + y), src->height-1)*src->stride];
uint8* rgb = src_ptr + min((xx * 4 + x), src->width-1);
block[y*4+x] = (int)rgb[0];
}
}
inline void CompressBlockBC4(uniform rgba_surface src[], int xx, uniform int yy, uniform uint8 dst[])
{
float block[16];
uint32 data[2];
load_block_interleaved_alpha(block, src, xx, yy);
CompressBlockBC3_alpha(block, data);
store_data(dst, (src->width+3)&~3, xx, yy, data, 2);
}
export void CompressBlocksBC4_ispc(uniform rgba_surface src[], uniform uint8 dst[])
{
for (uniform int yy = 0; yy<(src->height+3)/4; yy++)
foreach (xx = 0 ... (src->width+3)/4)
{
CompressBlockBC4(src, xx, yy, dst);
}
}
This also support non multiple of 4 textures
from ispctexturecompressor.
These are missing from the binary builds, and result in an incomplete BC compressor. These formats are important, and as suggested the change is small since BC3 alpha can be reused. Also the BC3 alpha compression issue reported in another Issue should be fixed prior to re-using that code for BC4/BC5.
from ispctexturecompressor.
Made a pull-request with BC4 and BC5 API.
#31
from ispctexturecompressor.
The pull request was merged. Can this be closed?
from ispctexturecompressor.
@tbdbj @ivalylo It applied here too https://github.com/telecran-telecrit/ISPCTextureCompressor (for BC4 and BC5).
from ispctexturecompressor.
Related Issues (20)
- Looks like BC7 doesn't encode alpha properly.
- Mac Static Library
- replace #include "memory.h" with #include <memory.h>
- BC7 encoder could convert completely transparent block (alpha=0) to non-transparent
- Possible bug with the bc6h encoder HOT 1
- Feature Request: BC6H Signed Float Support (DXGI_FORMAT_BC6H_SF16) HOT 3
- ISPC HDR Texture Compressor still has Apache 2 license headers. HOT 1
- Wrong bytes/block values in ispc_texcomp.h comment HOT 1
- DXT1 compression on images with smooth gradients results in banding HOT 2
- ETC2 support? HOT 1
- How to specify a fixed mode for BC7 encoding?
- Command line parameters? HOT 3
- Nondeterministic results in ASTC w/ varying partitions
- ISPC 1.14 issues and suggested fixes/workarounds HOT 3
- bad code generation causing incorrect encoding in when compiling with clang optimization. HOT 2
- Compile error on Ubuntu 16.04: ‘numeric_limits’ is not a member of ‘std’ HOT 4
- Support non-sRGB LDR compression
- if programCount==1 then ASTC compression fails (PURPLE color)
- ispc file support
- "Error: Unsupported value for --arch" when building on Fedora
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ispctexturecompressor.