# Low Power EEG Data Encoding for Brain Neurostimulation Implants +
## 2 Materials and Methods
### Materials
#### 2.1.2 Encoding Algorithm  
Biosignals may be encoded in a medical application for various reasons, which include reduction of the required memory size, low-power processing, reduction of the time needed to transmit data to a network node, or a combination of the previously mentioned. In order to encode biosignals and especially brain electrical signals, several algorithms may be applied. These encoding and compression algorithms have various characteristics and differ in terms of methodology and in terms of the result they produce. A data encoding approach, based on [PERSON] and [PERSON]'s scientific work [18; 19], was presented, on the premise that characters in information streams are encoded according to their frequency of appearance. A few years later, [PERSON] proposed a coding algorithm that appears to be similar to Shannon-Fano at first glance [20]. This belief stems from the fact that both techniques rely on keeping entropy low, which means that the more frequently a symbol appears in the coded message, the fewer digits are required to encode it. Following this, the Lempel Ziv Welch technique was introduced. In this case, the time-repeated sequences are detected and replaced with new ones until the compressed data is complete. Among the lossless encoding techniques that create dictionaries, there are methods based on sliding windows. These methods enable the return to previously encoded data and relate it to the data to be compressed (Lempel Ziv 77 and Lempel Ziv 78) [21; 22; 23]. These algorithms introduced implementation complexity, and although they achieved reduction of the memory size to store data and reduction of data to be transmitted, they increased power dissipation during their application on data. Less complex compression algorithms frequently used in medical applications do not manage to keep a trade-off between power consumption and processing power. Even algorithms that apply simple functions, like matrix multiplication, require an increased memory size and long processing time for calculating the partial products. Such an example is the Compressive sensing (CS) method [24; 25]. A main drawback is the recursive application of calculation steps, which increases time to produce the result, occupy for a long time the system's resources, and dissipate significant energy, which is crucial for implanted devices. Considering the above mentioned requirements, the Delta encoding algorithm was selected as a suitable algorithm for achieving low-power data encoding, keeping the system's resources occupied for limited time, maintaining the same memory size of the device, keeping entropy low, and minimizing application code penalty for embedding the encoding function. In detail, when a data sequence is available for encoding in the input buffer, calculating the differences between successive values is performed by a simple subtraction in one instruction clock and stored directly in memory. Thus, the encoding process is simple without recursive calculations to a set of data for the calculation of each encoding value. In other words, the final result is a series of numbers that represent the interval between one value and the next. When the values are close, the bits of higher order of their result are most probable to be zero, requiring in fact fewer bits for encoding. This also affects power consumption during memory write since higher order bits have a significant probability to be zero, and data bus lines transitions from 0 to 1 are reduced (affecting dynamic power dissipation). This method can maintain data quality when compressed, mainly when applied to brain signals (lossless). Furthermore, its implementation does not necessitate complex and costly energy calculations because finding differences requires only one operation, namely, the subtraction, introducing a low penalty to the application code.