-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Cimg::get_warp output CImg to be provided #414
Comments
Well, if I understand well, you will get this kind of issues with all the |
I haven't really dug that deep to see if this is a general issue with all The question still stands: would such a patch be welcomed? I wouldn't be able to provide a patch for all |
Considering that it is not really a issue with the |
Thanks @dtschump for that feedback. I agree that this is a wider problem and not specific to the OTOH I don't think there's a solution that will allow you to offer this functionality in a generic way for all functions, given how their outputs' sizes depend so heavily on the input values of each operation. If anything, I think the "generic" solution would be something along the lines of implementing three variants for each method, just like there are two at the moment:
This is obviously a big effort that I wouldn't be able to undertake, and probably neither would you without some clear incentive. If that's the situation, and you'd want to have an all-or-nothing solution, then I'll stick to my patch on our local copy; otherwise if you would consider adding this functionality on a function-by-function basis then I'd be happy to upstream this patch, and others that might come. |
I do actually think there is a generic solution.
Wouldn't it be something like this that you are looking for? |
While doing some profiling on our R imager package that uses CImg underneath, I found that the fundamental
CImg::get_warp
operation allocates the outputCImg
object internally, then returns it. This prevents us from saving an allocation when returning the data back to R, which needs to be done on a different buffer.Locally I have the following patch that allows me to avoid this, and I was wondering whether this would be something that would be considered as a desired feature upstream. In other words: would such a PR be welcome?
The way I'm then using this is (very roughly) like this:
The text was updated successfully, but these errors were encountered: