Energy and SpectralFlatnessMeasure taken for PCM audio VoiceActitivyDetection
The frame energy can be computed in the time domain as well as in the frequency domain. For a frame of $N$ samples, due to Parseval's theorem, you get for the frame energy

$$\sum_{n=0}^{N-1}|x[n]|^2=\frac{1}{N}\sum_{k=0}^{N-1}|X[k]|^2$$

where $x[n]$ are the time domain samples, and $X[k]$ are the complex DFT coefficients.

The spectral flatness is commonly computed from the power spectrum, or from the squared magnitudes of the DFT coefficients. I can't open the link to the paper, but unless otherwise stated, I would compute the means using all values $|X[k]|^2$ in the current frame.