rawspeed icon indicating copy to clipboard operation
rawspeed copied to clipboard

src/librawspeed/README.md is out of date

Open mallman opened this issue 2 years ago • 4 comments

I recently attempted to update my version of rawspeed and found that certain APIs I used before have changed. Some I don't know how to replace. For example, I used to use the RawImageData->getData() and RawImageData->getData(int, int) apis, but those are gone. I don't know how to update my code. Would you please go through that file and update it for usage with the current API?

Thank you.

mallman avatar Jun 30 '23 17:06 mallman

Yup, docs are not up to date.

For example, I used to use the RawImageData->getData() and RawImageData->getData(int, int) apis, but those are gone. I don't know how to update my code.

You want get{U16,F32}DataAs{Uncropped,Cropped}Array2DRef(), which returns a thin 2d view.

LebedevRI avatar Jun 30 '23 17:06 LebedevRI

Yup, docs are not up to date.

For example, I used to use the RawImageData->getData() and RawImageData->getData(int, int) apis, but those are gone. I don't know how to update my code.

You want get{U16,F32}DataAs{Uncropped,Cropped}Array2DRef(), which returns a thin 2d view.

Hi @LebedevRI. Thank you for the guidance. I could use a little more help.

The API I'm integrating with requires a linear uint16_t* buffer (of the decoded raw data), similar to what RawImageData->getData() provided. Is it still possible to get the underlying uint8_t* or uint16_t* from the new API?

If not, what would you recommend as the most efficient way to alloc and populate a uint16_t* from the values returned by getU16DataAs{Uncropped,Cropped}Array2DRef()?

Thank you.

mallman avatar Jul 02 '23 08:07 mallman

See e.g. https://github.com/darktable-org/darktable/blob/6cfcb0b5344a75d2b51e683abbe0c5bd8ffcbda2/src/imageio/imageio_rawspeed.cc#L395-L405 Just taking address of the first column gives that address.

LebedevRI avatar Jul 02 '23 11:07 LebedevRI

Thank you. This has helped very much.

mallman avatar Jul 03 '23 20:07 mallman