Skip to content
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

get out of this range, from the mean vector #93

Open
buaapengbo opened this issue Jan 14, 2020 · 2 comments
Open

get out of this range, from the mean vector #93

buaapengbo opened this issue Jan 14, 2020 · 2 comments
Labels

Comments

@buaapengbo
Copy link

I think this line need change to:
if ((subtractMeans) && ((offset + colIdx) < subArraySizeLocal))

if not, index offset + colIdx will out of subArraySizeLocal, and will get the next line's mean value

@buaapengbo
Copy link
Author

buaapengbo commented Jan 14, 2020

if (subtractMeans)
{
xCol -= means[offset + colIdx + linearSampleIdx * subArraySize];
xRow -= means[offset + rowIdx + linearSampleIdx * subArraySize];
}

can this change to, not sure

if (subtractMeans)
{
    if ((offset + colIdx) < subArraySizeLocal)
        xCol -= means[offset + colIdx + linearSampleIdx * subArraySize];
    if ((offset + rowIdx) < subArraySizeLocal)
        xRow -= means[offset + rowIdx + linearSampleIdx * subArraySize];
}

@goeblr
Copy link
Member

goeblr commented Jan 14, 2020

Thanks for the feedback!

With how the means are computed

means[vectIdx + linearSampleIdx * subArraySize] = mean / static_cast<float>(num);

for each sample it computes the mean signal in the sliding subaperture. So it is of length subArraySize at max (per sample). (specifically of subArraySizeLocal, but the stride is subArraySize).

So the lines you mention are wrong indeed.
With above, it should be

    if (subtractMeans) 
    { 
        xCol -= means[colIdx + linearSampleIdx * subArraySize]; 
        xRow -= means[rowIdx + linearSampleIdx * subArraySize]; 
    }

@goeblr goeblr added the bug label Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants