Are you asking what is the difference between those two?

`(f1+f2+f3+...+fn)/n - (d1+d2+d3+...+dn)/n`

(f1-d1 + f2-d2 + f3-d3 + ... + fn-dn) / n

The only difference would be in round-off errors (one does two integer divisions, other does one). I doubt you'll be able to see it in practice (maybe only if you are stacking a lot of frames).

In this case, you may also want to add some rounding to the integer division:

`-value /= average_samples;`

+value = (value + average_samples/2) / average_samples;

Or you may want to work with higher bit depths.