## 3 Materials and Methods
### Method for Extracting the Watermark  
#### 3.3.1 Extracting the Chirp Signals and the Enf Information  
If stationary white Gaussian noise is considered to be the perturbator signal, the optimal detector for a chirp signal is a matched filter succeeded by a threshold comparator, as demonstrated in [33]. The detection of chirp signals is also thoroughly studied in [23]. The detection of the chirp signal illustrated in Figure 4a in harsh SNR conditions (SNR \(=-10\) dB) using a matched filter is demonstrated in Figure 10.  
Figure 10: Chirp signal detection in harsh SNR conditions using a matched filter: (**a**) The chirp signal heavily affected by noise; (**b**) The impulse response of the matched filter; (**c**) The output of the matched filter.  
Figure 9: The functioning of the controlled delay line. When active (i.e., input bit equal to “1”), it delays the input signal with \(\Delta t=20\) ms.  
Mathematically, considering a signal denoted with \(z(t)\), the filter matched to this signal, denoted with \(h_{z-\text{matched}}(t)\) can be written as \(h_{z-\text{matched}}(t)=z(T_{z}-t)\), where \(T_{z}\) is the duration of the \(z(t)\) signal. In the example shown in Figure 10, the duration of the chirp signal is one second, it is located from second 1 to second 2 in Figure 10a but cannot be observed directly because it is drowned in noise. The impulse response of the matched filter can be observed in Figure 10b, and the response of this filter to the signal illustrated in Figure 10a is shown in Figure 10c. Even in this harsh SNR condition, the matched filter can sense the presence of the signal that it is matched to [34]. It can be observed in Figure 10c that a large value is obtained after exactly 2 s, indicating that the chirp signal corresponding to the matched filter was detected, and it is located from second 1 to second 2 in the input signal. The detector of the chirp signals was designed based on this principle. Its block diagram is shown in Figure 11.  
The values \(\widetilde{b_{i}},\ i=\overline{0,8}\) are the estimates of the bits encoding the ENF value, and \(\ ht_{i},\ i=\overline{0,8}\) are the comparators' threshold values.  
The recorded signal is filtered using the nine matched filters corresponding to the nine chirp signals. The output signal of a matched filter will be large if the corresponding chirp signal was present in the input signal, as demonstrated in Figure 10. Its presence can be detected using a comparator. If the signal is larger than the threshold, the output of the comparator is \"1\", and \"0\" otherwise. Two ways in which \(\ ht_{i},\ i=\overline{0,8}\) can be set are:  
1. The system can be remote controlled to emit all the chirp signals with the next ticking sound, bypassing the measured ENF value for that second, and encoding a value equal to 50.255 Hz which has a very low probability of occurrence in a real power grid. This will determine maximum values at the output of the matched filters in the receiver. The threshold can be set slightly lower than the maximum value. It was determined through experiments that threshold values 5 dB lower than each maximum can be used.
2. The detector can exploit the property that maxima in the output signal of the matched filters can occur at most once per second. The global maximum value of each signal can be found, and the threshold set 5 dB lower than it. After this, the temporal distances between the peaks that were greater than the set threshold can be evaluated. If those are smaller than 1 s it results in that the respective chirp signal was never sent, and what is sensed is the effect of noise and speech signals, because the threshold is set too low. In this case, all the bits corresponding to that chirp signal should be set to \"0\".  
Finally, the estimated ENF value can be found using:  
\[\widetilde{ENF}=50+(-1)^{1-b_{0}}\cdot 10^{-3}\sum_{i=1}^{8}\widetilde{b_{i}} \cdot 2^{i-1}. \tag{6}\]  
Figure 11: The block diagram of the chirp signals detector.