Well, you're using rsGetElementAt_uchar(inp,x_,y_), but what is "inp"?

Also, can you show the code near 

sc_ebab->forEach_ccl_initlabel(LAlloc); // call 1
sc_ebab->forEach_ccl_initlabel(RAlloc); // call 2


? Thank you


On Friday, 8 July 2016 11:52:41 UTC+2, Ruppesh Nalwaya wrote:
>
> Hi
> Actually that return 0; statement was commented. I made mistake while copy 
> pasting .. the code exact code is this :
>
> int __attribute__((kernel)) ccl_initlabel(uint32_t x, uint32_t y) {
>
>     int x_ = (int)x;
>
>     int y_ = (int)y;
>
>     int width = (int)rsAllocationGetDimX(inp);
>
>     int height = (int)rsAllocationGetDimY(inp);
>
>     int index = y_ * width + x_;
>
>     int flag = (int)step(1.0f, (float)rsGetElementAt_uchar(inp,x_,y_));
>
>     return (index*(1-flag) - flag);
>
> }
>
>
>
> Regards
>
> Ruppesh
>
> On Friday, 8 July 2016 14:00:59 UTC+5:30, Alberto Marchetti wrote:
>>
>> There can be a chance that, if the kernel has been written to return 
>> always a constant, modifying the contents of the kernel does not let 
>> RenderScript invalidate the cache (the code, being translated to bitcode, 
>> gets highly optimized, so a constant is always a constant and, if the code 
>> that comes earlier makes no changes to the "outer world", it can be just 
>> stripped out).
>> Can you post the exact code you were using, without returning 0?
>>
>> On Thursday, 7 July 2016 14:25:31 UTC+2, Ruppesh Nalwaya wrote:
>>>
>>> Hi
>>> I wrote the following kernel to label a 2-D matrix/image with its 1-D 
>>> index. In an earlier build I had written code for 1-indexing, which I 
>>> updated later on to 0-indexing as follows. 
>>>
>>> int __attribute__((kernel)) ccl_initlabel(uint32_t x, uint32_t y) {
>>>
>>>     int x_ = (int)x;
>>>
>>>     int y_ = (int)y;
>>>
>>>     int width = (int)rsAllocationGetDimX(inp);
>>>
>>>     int height = (int)rsAllocationGetDimY(inp);
>>>
>>>     int index = y_ * width + x_;                       // in an earlier 
>>> version, it was 1 indexed
>>>
>>>     return 0;
>>>
>>>     int flag = (int)step(1.0f, (float)rsGetElementAt_uchar(inp,x_,y_));
>>>
>>>     return (index*(1-flag) - flag);
>>>
>>> }
>>>
>>>
>>> I call this kernel on 2 different allocations one after the other like 
>>> this:
>>>
>>> sc_ebab->forEach_ccl_initlabel(LAlloc); // call 1
>>> sc_ebab->forEach_ccl_initlabel(RAlloc); // call 2
>>>
>>>
>>> When I updated the code from 1-indexing to 0-indexing, the behaviour of 
>>> call 1 got updated but not of call 2. Interestingly this kind of sticky 
>>> behaviour of 2nd call is visible only when the app reinstalled without 
>>> uninstalling (If I uninstall manually and then install the updated build 
>>> both calls' behaviour is updated). What could be the possible reason? 
>>>
>>> *Note: I am working on Nexus 6*
>>>
>>> Regards
>>> Ruppesh
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/2ba35a13-c65e-4f7e-aa10-d49c26c37064%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to