Giter VIP home page Giter VIP logo

image_dds's People

Contributors

scanmountgoat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

image_dds's Issues

Support f32 and exr

This will require defining separate conversions to and from f32 data since some formats like BC6 use half precision floating point. Most logic can be shared with rgba8 conversions.

  • support encoding and decoding from rgba8
  • decode to f32
  • encode from f32
  • add examples using exr and f32

make encoding and decoding optional

Encoding currently requires precompiled kernels and may not be available on all targets. Decoding compiles C code and may not be required for projects just wanting to convert DDS files to and from surfaces.

Panic in img2ddsf32 when using Rgba16Float

Defualt format is ok, but when i try Rgba32Float format, get panic.

        _ => image_dds::dds_from_imagef32(
            &image,
            image_dds::ImageFormat::Rgba32Float,
            image_dds::Quality::Fast,
            image_dds::Mipmaps::GeneratedAutomatic,
        )
        .unwrap(),
thread 'main' panicked at C:\Users\zhouhang\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\bytemuck-1.15.0\src\allocation.rs:200:44:
called `Result::unwrap()` on an `Err` value: AlignmentMismatch
stack backtrace:
   0:     0x7ff7f6531e92 - std::sys_common::backtrace::_print::impl$0::fmt
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\sys_common\backtrace.rs:44
   1:     0x7ff7f6547e3d - core::fmt::rt::Argument::fmt
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\core\src\fmt\rt.rs:142
   2:     0x7ff7f6547e3d - core::fmt::write
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\core\src\fmt\mod.rs:1120
   3:     0x7ff7f652f7e1 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\io\mod.rs:1846
   4:     0x7ff7f6531cba - std::sys_common::backtrace::_print
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\sys_common\backtrace.rs:47
   5:     0x7ff7f6531cba - std::sys_common::backtrace::print
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\sys_common\backtrace.rs:34
   6:     0x7ff7f6533e69 - std::panicking::default_hook::closure$1
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\panicking.rs:272
   7:     0x7ff7f6533b25 - std::panicking::default_hook
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\panicking.rs:292
   8:     0x7ff7f6534384 - std::panicking::rust_panic_with_hook
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\panicking.rs:781
   9:     0x7ff7f6534259 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\panicking.rs:659
  10:     0x7ff7f6532539 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\sys_common\backtrace.rs:171
  11:     0x7ff7f6533f26 - std::panicking::begin_panic_handler
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\panicking.rs:647
  12:     0x7ff7f65546e7 - core::panicking::panic_fmt
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\core\src\panicking.rs:72
  13:     0x7ff7f6554d23 - core::result::unwrap_failed
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\core\src\result.rs:1649
  14:     0x7ff7f6021035 - enum2$<core::result::Result<alloc::vec::Vec<u8,alloc::alloc::Global>,bytemuck::PodCastError> >::unwrap
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\result.rs:1073
  15:     0x7ff7f6021035 - bytemuck::allocation::cast_vec<half::binary16::f16,u8>
                               at C:\Users\zhouhang\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\bytemuck-1.15.0\src\allocation.rs:200
  16:     0x7ff7f6018790 - core::ops::function::FnOnce::call_once<alloc::vec::Vec<u8,alloc::alloc::Global> (*)(alloc::vec::Vec<half::binary16::f16,alloc::alloc::Global>),tuple$<alloc::vec::Vec<half::binary16::f16,alloc::alloc::Global> > >
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\ops\function.rs:250
  17:     0x7ff7f601da40 - enum2$<core::result::Result<alloc::vec::Vec<half::binary16::f16,alloc::alloc::Global>,enum2$<image_dds::error::SurfaceError> > >::map<alloc::vec::Vec<half::binary16::f16,alloc::alloc::Global>,enum2$<image_dds::error::SurfaceError>,alloc::vec::Vec<u8,alloc
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\result.rs:746
  18:     0x7ff7f60240c7 - image_dds::encode::impl$7::encode
                               at D:\image_dds\image_dds\src\encode.rs:408
  19:     0x7ff7f60202f9 - image_dds::encode::MipData<f32>::encode<f32>
                               at D:\image_dds\image_dds\src\encode.rs:173
  20:     0x7ff7f601fbd9 - image_dds::encode::encode_mipmaps_rgba<image_dds::surface::SurfaceRgba32Float<ref$<slice2$<f32> > >,f32>
                               at D:\image_dds\image_dds\src\encode.rs:115
  21:     0x7ff7f601f8c9 - image_dds::encode::encode_surface<image_dds::surface::SurfaceRgba32Float<ref$<slice2$<f32> > >,f32>
                               at D:\image_dds\image_dds\src\encode.rs:72
  22:     0x7ff7f60182dc - image_dds::surface::SurfaceRgba32Float<ref$<slice2$<f32> > >::encode<ref$<slice2$<f32> > >
                               at D:\image_dds\image_dds\src\encode.rs:41
  23:     0x7ff7f601756c - image_dds::dds::dds_from_imagef32
                               at D:\image_dds\image_dds\src\dds.rs:50
  24:     0x7ff7f6014dbf - img2ddsf32::main
                               at D:\image_dds\image_dds\examples\img2ddsf32.rs:33
  25:     0x7ff7f6015c2b - core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\ops\function.rs:250
  26:     0x7ff7f60125fe - core::hint::black_box
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\hint.rs:334
  27:     0x7ff7f60125fe - std::sys_common::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\std\src\sys_common\backtrace.rs:155
  28:     0x7ff7f6015b31 - std::rt::lang_start::closure$0<tuple$<> >
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\std\src\rt.rs:166
  29:     0x7ff7f652ade2 - std::rt::lang_start_internal::closure$2
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\rt.rs:148
  30:     0x7ff7f652ade2 - std::panicking::try::do_call
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\panicking.rs:554
  31:     0x7ff7f652ade2 - std::panicking::try
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\panicking.rs:518
  32:     0x7ff7f652ade2 - std::panic::catch_unwind
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\panic.rs:142
  33:     0x7ff7f652ade2 - std::rt::lang_start_internal
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library\std\src\rt.rs:148
  34:     0x7ff7f6015b0a - std::rt::lang_start<tuple$<> >
                               at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\std\src\rt.rs:165
  35:     0x7ff7f6015759 - main
  36:     0x7ff7f65528d8 - invoke_main
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  37:     0x7ff7f65528d8 - __scrt_common_main_seh
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  38:     0x7ffe300a257d - BaseThreadInitThunk
  39:     0x7ffe3180aa48 - RtlUserThreadStart

Pure Rust encoding library

Similar to #11, this will make compilation easier for some use cases. This will be more involved than decoding since intel_tex_rs uses the intel ispc compiler and is fairly complex. It may be better to make bindings to a smaller library first like https://github.com/elasota/ConvectionKernels and fuzz the Rust port against the original C++ code. It's also worth investigating the potential performance loss since intel_tex_rs makes heavy use of SIMD.

Rust port of bcdec

While unlikely to improve performance, this will make the integration easier due to less required safety checks. This will also make the code easier to build on more targets due to not requiring the compilation and linking of C code.

  • bc1
  • bc2
  • bc3
  • bc4
  • bc5
  • bc6h
  • bc6h float
  • bc7

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.