# Fuzzy-Based Quality Adaptation Algorithm for Improving QoE from MPEG-DASH Video
## 4 The Fuzzy Logic Controller
When the buffer level is close to empty, video quality is compromised in order to mitigate the risk of playback interruption. As the playback buffer fills up, video quality is increased to improve the user experience. Figure 4b shows the membership functions of the ratio of \(\Delta B\) to segment duration in which three more linguistic variables are considered: Decreasing, Stable, and Increasing. Figure 4: Membership functions for (**a**) the ratio of buffer level to segment duration, \(B/\tau\); (**b**) the ratio of \(\Delta B\) to segment duration, \(\Delta B/\tau\); and (**c**) the ratio of throughput to the selected video rate, \(T/R_{i}^{k}\). These linguistic variables describe the behavior from the rate of change in the buffer between subsequent segment downloads. Ideally, the buffer level should remain stable. A decrease in the buffer level forces the adaptation algorithm to decrease the video rate, whereas an increase in the buffer level suggests that the available throughput is not being utilized completely. That provides an opportunity to increase the video rate and improve video quality. Figure 4c shows the membership functions of the ratio of throughput to selected video rate, in which three more linguistic variables are considered: Low, Steady, and High. These linguistic variables describe the extent of the mismatch between throughput and video rate. The adaptation algorithm adapts the video quality as the throughput fluctuates over time. Ideally, the adaptation algorithm selects the highest available video rate that is less than the throughput in order to efficiently utilize bandwidth. The output of the fuzzy logic controller, \(F\), represents an increase or decrease in the video rate of the next segment. As shown in Figure 5, the linguistic variables for the output are Large Decrease (LD), Small Decrease (SD), No Change (NC), Small Increase (SI), and Large Increase (LI). The fuzzy rules provided in Table 1 are applied to map fuzzy output to fuzzy input. Each rule represents a fuzzy if-then statement. The output of the rules is aggregated into a fuzzy set. As shown in Table 1, when \(B/\tau\) is in the dangerous zone, FLC decreases the video rate to minimize the risk of buffer underflow. The FLC observes \(\Delta B/\tau\) and \(T/R_{i}^{k}\) to determine whether to decrease the video rate abruptly or gradually. The FLC decreases the video rate gradually only when both \(\Delta B/\tau\) and \(T/R_{i}^{k}\) are not in the decreasing zone or the low zone, respectively. Figure 5: Output of the fuzzy logic controller. As \(B/\tau\) enters the low zone, the FLC focuses on staying at the current video rate to minimize the frequency of video rate changes. However, when \(\Delta B/\tau\) and \(T/R_{i}^{k}\) are in the decreasing zone and low zone, respectively, the FLC decides to slowly decrease the video rate. When \(\Delta B/\tau\) and \(T/R_{i}^{k}\) are in the increasing zone and high zone, respectively, the FLC decides to slowly increase the video rate. Finally, when \(B/\tau\) enters the safe zone, there are enough segments available in the buffer to increase video quality. However, if \(\Delta B/\tau\) and \(T/R_{i}^{k}\) are in the decreasing zone and low zone, respectively, the FLC decides to keep the current quality. That mitigates the risk of the buffer level dropping to the low zone or dangerous zone, and it minimizes video rate switches. The output, \(F\), is de-fuzzified to a crisp value using the center of sum method and is calculated as:  
\[F=\frac{\sum_{j}A_{j}\times x_{j}}{\sum_{j}A_{j}} \tag{13}\]  
where \(A_{j}\) represents the areas of the respective output membership functions, \(j\) represents the number of output membership functions, and \(x_{j}\) represents the center of the area.