# Fuzzy-Based Quality Adaptation Algorithm for Improving QoE from MPEG-DASH Video
## 5 Proposed Fuzzy-Based Adaptation Scheme  
The DASH client downloads a video stream stored in multiple discrete video rates in the HTTP server. The set of video rates available for the video stream is denoted by \(R\). The client adaptively selects a video rate from the available video rates in set \(R\). This is achieved through the fuzzy logic controller. Based on the crisp output, \(F\), the proposed scheme first selects \(R_{s}\) as follows:  
\[R_{s}=\max\{r\in R\}<F\times T^{S} \tag{14}\] \begin{table}
\begin{tabular}{l l l l l} \hline \hline
**Rule (\(R_{i}\))** & \(B/\tau\) & \(\Delta B/\tau\) & \(T/R_{i}^{k}\) & \(O\) \\ \hline \(R_{1}\) & Dangerous & Decreasing & Low & \(LD\) \\ \(R_{2}\) & Dangerous & Decreasing & Steady & \(LD\) \\ \(R_{3}\) & Dangerous & Decreasing & High & \(LD\) \\ \(R_{4}\) & Dangerous & Stable & Low & \(LD\) \\ \(R_{5}\) & Dangerous & Stable & Steady & \(SD\) \\ \(R_{6}\) & Dangerous & Stable & High & \(SD\) \\ \(R_{7}\) & Dangerous & Increasing & Low & \(LD\) \\ \(R_{8}\) & Dangerous & Increasing & Steady & \(SD\) \\ \(R_{9}\) & Dangerous & Increasing & High & \(SD\) \\ \(R_{10}\) & Low & Decreasing & Low & \(SD\) \\ \(R_{11}\) & Low & Decreasing & Steady & \(NC\) \\ \(R_{12}\) & Low & Decreasing & High & \(NC\) \\ \(R_{13}\) & Low & Stable & Low & \(NC\) \\ \(R_{14}\) & Low & Stable & Steady & \(NC\) \\ \(R_{15}\) & Low & Stable & High & \(NC\) \\ \(R_{16}\) & Low & Increasing & Low & \(NC\) \\ \(R_{17}\) & Low & Increasing & Steady & \(NC\) \\ \(R_{18}\) & Low & Increasing & High & \(SI\) \\ \(R_{19}\) & Safe & Decreasing & Low & \(SI\) \\ \(R_{20}\) & Safe & Decreasing & Steady & \(SI\) \\ \(R_{21}\) & Safe & Decreasing & High & \(LI\) \\ \(R_{22}\) & Safe & Stable & Low & \(SI\) \\ \(R_{23}\) & Safe & Stable & Steady & \(SI\) \\ \(R_{24}\) & Safe & Stable & High & \(LI\) \\ \(R_{25}\) & Safe & Increasing & High & \(LI\) \\ \(R_{26}\) & Safe & Increasing & High & \(LI\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: FDASH fuzzy rules. where \(T^{s}\) is the smooth throughput calculated using Equation (1), in which the value of weighting factor \(\delta\) is set to 0.8. One of the challenges faced by ABR algorithms is that control decisions available to algorithms are coarse-grained because limited video rates are available for a given video. As seen in Equation (14), for the next video rate the proposed scheme selects the highest available video rate that is less than (\(F\times T^{5}\)). Next, to minimize video rate switches, Algorithm 1 is invoked after the selection of \(R_{s}\). This algorithm first determines if \(R_{s}\) is greater or smaller than the previously selected video rate, \(R_{prev}\). If \(R_{s}\) is greater than \(R_{prev}\), the algorithm checks the buffer level. If the buffer level is within the danger zone, (\(B^{k}<B_{dang}\)) (line 5), then the video rate remains unchanged (line 6). Since the buffer level is already low, increasing the video rate increases the risk of playback interruption. Otherwise, the algorithm selects \(R_{s}\) as the video rate for the next segment (line 8). The buffer threshold, \(B_{dang}\), is equal to the minimum segment duration and part of the buffer size, as follows:  
\[B_{dang}=\min\text{ (Segment duration, 20\% of buffer size)} \tag{15}\]  
```
1 Input:\(R_{s}\): Video rate selected based on crisp output of FLC; \(R_{prev}\): video rate of the last downloaded segment; \(B^{k}\): current buffer level; \(T^{s}\): smoothed throughput; D: segment duration; \(B_{max}\): buffer size; \(B_{prnd}\): predicted buffer level. 2 Output:\(R_{next}\): Video rate for next segment
3 if\(R_{s}>R_{prev}\)
4\(B_{pred}=B^{k}+(T^{5}/R_{s}-1)^{*}D\)
5 if\((B_{prev}<=B_{dang})\)
6\(R_{next}=R_{prev}\)
7 else
8\(R_{next}=R_{s}\)
9 elseif\(R_{s}<R_{prev}\)
10\(B_{pred}=B^{k}+(T^{5}/R_{s}-1)^{*}D\)
11 if\((B_{pred}\succeq 0.5\times B_{max})\)
12\(R_{next}=R_{prev}\)
13 else
14\(R_{next}=R_{s}\)
```  
**Algorithm 1**Video Rate Switch Minimization  
As explained in Section 1, video streaming services offer segments of different durations.