Twinklebear / oidn-rs

Rust bindings to Intel's OpenImageDenoise Library
MIT License
24 stars 12 forks source link

Use of CString #9

Closed virtualritz closed 3 years ago

virtualritz commented 3 years ago

I was just wondering. Is there any reason to prefer:

                let buf_name = CString::new("normal").unwrap();
                unsafe {
                    oidnSetSharedFilterImage(
                        self.handle,
                        buf_name.as_ptr(),
                        ...

Over

                unsafe {
                    oidnSetSharedFilterImage(
                        self.handle,
                        &b"normal\0" as *const _ as _,
                        ...

I'm still a Rust n00b but my gut tells me the latter will produce less code/have no runtime overhead.

Twinklebear commented 3 years ago

I didn't know about the byte string stuff actually, this might be nicer to migrate too

virtualritz commented 3 years ago

I have a PR for you then later today. I also added set_hdr_scale() since I needed that.

Twinklebear commented 3 years ago

Resolved in #10