No worries, let’s go through your example.

index window of input

Are you indexing it using x and y or something like x:x+width etc.
Intermediate output is just a scalar?
What happens in the last line?