Good point.

Will
Code:

obuf[row * FOCPLWIDTH + col]

ever evaluate to 0 under normal circumstances? Or will it only get set to 0 if rule1 + rule2 are true?

If so, you can do:

Code:

if (obufs[1][row * FOCPLWIDTH + col] / obufs[0][row * FOCPLWIDTH + col] > 1.5)
{
sum = 0;
for ( i = -1; i < 2; i++)
{
for ( j = -1; j < 2; j++)
if (!(i == 0 && j == 0))
{
sum += obufs[1][(row - i) * FOCPLWIDTH + col - j];
}
}
}
if (2 * sum / 8 < obufs[1][row * FOCPLWIDTH + col])
{
obuf[row * FOCPLWIDTH + col] = 0;
}
}
if(obuf[row * FOCPLWIDTH + col] != 0)
{
for (i = 0; i < no_reads; i++)
}

Otherwise you can still reduce it to one variable:

Code:

bothRulesMatch = 0;
if (obufs[1][row * FOCPLWIDTH + col] / obufs[0][row * FOCPLWIDTH + col] > 1.5)
{
sum = 0;
for ( i = -1; i < 2; i++)
{
for ( j = -1; j < 2; j++)
if (!(i == 0 && j == 0))
{
sum += obufs[1][(row - i) * FOCPLWIDTH + col - j];
}
}
}
if (2 * sum / 8 < obufs[1][row * FOCPLWIDTH + col])
{
obuf[row * FOCPLWIDTH + col] = 0;
bothRulesMatch = 1;
}
}
if(bothRulesMatch == 0)
{
for (i = 0; i < no_reads; i++)
}