Code Monkey home page Code Monkey logo

basis-universal-rs's People

Contributors

aclysma avatar athosvk avatar fintelia avatar julhe avatar superdump avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

basis-universal-rs's Issues

Make CompressorImageRef safer

It's possible to get a CompressorImageRef from CompressorParams, drop CompressorParams, and cause undefined behavior by using CompressorImageRef. Some API improvements would enable rust borrow checking to catch this at compile time.

Support for `wasm32-unknown-unknown` via binding with the provided emscripten wasm file

CC @superdump

I've been working on writing bindings for the transcoder wasm that basis_universal provides so that I can parse and transcode basis files in wasm. I've got a repo for this here:
https://github.com/expenses/basis-universal-rs-wasm

It'd be fantastic if we could get support for this into this crate, so that wasm support just works. A couple of notes:

This will all take a while, but I'll try to create good bindings for the .basisu transcoder and work from there.

Support KTX2 transcoding

Upstream basis-universal now supports ktx2 files. It would be good if this library did as well.

Multi-threading doesn't seem to work

When comparing the performance against the original CLI / basisu.exe version, it appears that multithreading doesn't work.

The timings in get on my machine with a test image:

  • CLI (no flags): 3.111 secs
  • CLI (-no_multithreading flag): 13.649 secs
  • Rust (see code below): 12.135 secs

I'm on Windows 10 x64 with this toolchain:

stable-x86_64-pc-windows-msvc (default)
rustc 1.68.0 (2c8cc3432 2023-03-06)

My code for reference

use basis_universal::*;
let img = image::open("test_image.png").unwrap();
basis_universal::encoder_init();

let mut params = CompressorParams::new();
params.set_print_status_to_stdout(true);

let mut compressor_image = params.source_image_mut(0);
compressor_image.init(&img.to_rgba8(), img.width(), img.height(), 4);

let mut compressor = encoding::Compressor::new(24); //explicit multi-threading
let compression_time = unsafe {
    compressor.init(&params);
    let t0 = std::time::Instant::now();
    compressor.process().unwrap();
    let t1 = std::time::Instant::now();
    t1 - t0
};

println!("compression took {}secs", compression_time.as_secs_f32());

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.