If R is already initialized, please zero it out, but don't resize it.

On Jun 14, 2012, at 3:14 AM, Stefan Stavrev wrote:

> Take a look at this image http://postimage.org/image/pm5hhfi9x/.
> 
> Remember the function is:
> ImageBufAlgo::over (ImageBuf &R, const ImageBuf &A, const ImageBuf &B, ROI 
> roi, int nthreads)
> 
> I am not sure what to do if output image R is another valid image just like 
> input images A and B. 
> 
> The main issue is, what is R?
> 
> We have two cases, R can be initialized or not. By initialized I mean 
> (m_spec_valid || m_pixels_valid).
> 
> R is initialized: What about Case 1, should I leave R's pixels or should I 
> reset them to (0,0,...)? What about Case 4, should I overwrite R's pixels 
> with A over B, I should not do A over B over R? What about cases 2 and 3, 
> should I overwrite R's pixels with A and B?
> 
> R is not initialized: easy, we can initialize it with values (0,0,...) and 
> just write A over B.
> 
> My opinion:  We should consider R to be only a placeholder for the result of 
> A over B. Here is what I think more precisely for each case:
> Case 1: Initialize R to (0,0,...).
> Case 2 and 3: Overwrite R with A and B, appropriately for each case.
> Case 4: Overwrite R with A over B.
> 
> This way we would get an "atomic" and crystal clear operation. The programmer 
> should know that R is there only to store the result of A over B, we won't do 
> A over B over R or whatever. If he wants to do over for 3 images A, B and C, 
> he will have to do two operations separately (A over B) and then the result 
> of that over C. I am almost certain you guys will agree with this but I just 
> want to hear some opinions anyway.
> 
> Stefan
> 
> 

--
Larry Gritz
[email protected]


_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to