# Fuzzy-Based Quality Adaptation Algorithm for Improving QoE from MPEG-DASH Video
## 4 The Fuzzy Logic Controller  
The goal of the proposed fuzzy-based scheme is to select a video rate from \(R=\{R_{1},R_{2},\)\(R_{3},\)\(\ldots,\)\(R_{m}\}\) to improve the user experience. Video rates and playback interruptions are important factors when improving QoE [2,3,32]. In addition, a lot of video rate switches were found to annoy viewers [33]. We consider the following parameters to improve QoE:  
1. Maximize the video rates;
2. Minimize playback interruptions;
3. Minimize the frequency of video rate switches. In this section, we discuss the details of the proposed buffer- and segment-aware fuzzy-based quality adaptation algorithm. We also discuss how a fuzzy logic controller (FLC) is incorporated in the client in order to select the most feasible video rate. In this work, we used an FLC based on the Mamdani model [34]. The structure of the fuzzy logic controller is shown in Figure 3. It consists of four components: a fuzzification module, a fuzzy interference engine, a fuzzy rule base, and a defuzzification module. The controller operates by repeating a cycle of following steps:  
* Step 1: Crisp measurements (inputs) are taken of all variables that represent the conditions of the controller process. * Step 2: These measurements are mapped into corresponding fuzzy sets to express measurement uncertainties. This step is called fuzzification. * Step 3: The fuzzified measurements are then used by the interference engine. The interference engine evaluates the control rules stored in the fuzzy rule base. The output of this evaluation is a fuzzy set. * Step 4: The defuzzification module converts the fuzzy set into a single crisp value. This is the final step, called defuzzification. In this work, the FLC applies three variables as input: (1) the ratio of the client's playback buffer level to the segment duration (\(B/\tau\)), (2) the ratio of \(\Delta B\) to the segment duration, (\(\Delta B/\tau\)) where \(\Delta B=B^{k}-B^{k-1}\) is the difference in the buffer level upon download of the last two segments, and (3) the ratio of throughput to the selected video rate (\(T/R_{i}^{k}\)). The existing algorithms select video rates based on the available buffer level. As explained in Section 1, buffer level alone does not give us complete information. It is important to note here that segment durations change from one video content provider to the next. If the available playback buffer level is eight seconds, and the segment duration is two seconds, four segments can fit in the buffer. However, if the segment duration is four seconds, it means only two segments can fit into the buffer. Therefore, in this work, we consider the ratio of buffer level to segment duration. Figure 3: Structure of the fuzzy logic controller. The change in the buffer level (\(\Delta B\)) is the result of a mismatch between available throughput and the video rate. \(\Delta B\) helps the algorithm determine whether to increase or decrease the video rate. However, \(\Delta B\) alone does not accurately capture the variations in the buffer level during the download of a segment. Let us understand this by using an example. If the segment duration is two seconds, and the change in the buffer level during the download of a segment is four seconds, it means that during the download of the segment, a portion of the buffer equal to twice the segment duration gets filled up. However, if the segment duration is four seconds and the change in the buffer level is also four seconds, the portion of the buffer level that gets filled up is equal to one segment. Therefore, we consider the ratio of \(\Delta B\) to segment duration as input for the FLC. In addition to \(B/\tau\) and \(\Delta B/\tau\), the ratio of throughput to video rate helps to determine if the video rate should be switched abruptly or gradually. Therefore, the FLC applies the ratio of throughput to video rate as input. Figure 4a shows the membership functions of the ratio of buffer level to segment duration, in which three linguistic variables are considered: Dangerous, Low, and Safe.