// w, h - MAXIMUM image dimentions of final product. Set as 0 to be automatic
//
// version history:
-// v1.03 - Added quality switch
+// v1.03 - Added quality switch, moved init (major api revision)
// v1.02 - Improved box filtering, small bug fixes
// v1.01 - switch to OpenGL normal format for input
// v1.00 - (hgn) first release
return 0;
}
-void nbvtf_dxt_block( uint8_t *dest, uint8_t *src, int alpha, int qual )
+#ifdef NBVTF_AS_SO
+__attribute__((visibility("default")))
+#endif
+void nbvtf_init(void)
{
#ifdef USE_LIBRGBCX
- // TODO: move this somewehre else
- static int init = 0;
- if( !init )
- {
- rgbcx__init();
- init = 1;
- }
+ rgbcx__init();
+#endif
+}
+void nbvtf_dxt_block( uint8_t *dest, uint8_t *src, int alpha, int qual )
+{
+#ifdef USE_LIBRGBCX
if( alpha )
{
rgbcx__encode_bc3( qual, dest, src );
return 0;
}
- // Image size needs retargeting
+ // Image size needs to be made smaller
if( (w && h) && ( x > w || y > h ) )
+ {
nbvtf_downscale( data, x, y, w, h, data );
+ x = w;
+ y = h;
+ }
- int status = nbvtf_write( data, w, h, mipmap, format, qual,
- usr_flags, dest );
+ int status = nbvtf_write( data, x,y, mipmap, format, qual, usr_flags, dest );
stbi_image_free( data );