\copied{}
\section{Adding bookmarks into DASH NVE framework}\label{sec:bookmarks}

In this section, we explain how to include a new interaction in the system described in Section~\ref{sec:dash3d}.

\subsection{Interaction --- Visual}

We decide to add bookmarks of recommended viewpoints in the 3D scene.
A bookmark is defined by a camera position, orientation, and intrinsic parameters, and offers a particular view of the 3D virtual environment.
As such, it should be represented using a widget that (i) is attached to a particular position, therefore appearing small (respectively big) when it is far (respectively close), and (ii) points at a particular direction, allowing the user to predict what can be seen from this viewpoint.
Bookmarks have been already introduced in the literature, with various appearances \todo[inline]{figure of possible appearances}.
Since, no particular preeminence of one design on the others has been demonstrated in previous work, we arbitrarily choose to use \todo[inline]{type of bookmark} in this work.

Bookmarks can be created either automatically, or manually defined by an expert user (e.g.\ the 3D model designer, or administrator).
Bookmarks could even be derived from the observation of user behavior, by focusing on the most visited areas of the models.
Automated ways of defining bookmarks or adapting them to user behavior is beyond the scope of this paper; methods have been proposed in \todo[inline]{References}

We choose to implement two interactions with bookmarks.
The first, most obvious one, is to position the user camera on the bookmark's viewpoint when the user clicks on the bookmark.
In order to avoid users to lose context, clicking on a bookmark triggers an automatic, smooth, camera displacement that ends up at the bookmark.
% We use Hermite's polynomials to compute this displacement, as proposed in MMSYS16. Lol we don't :'(
We implement an additional interaction that displays a  preview of the bookmark's viewpoint while it is hovered by the user's mouse.
A small thumbnail of the viewport is displayed below the bookmark.

\subsection{Segments utility at bookmarked viewpoint}\label{sec:utility}
Introducing bookmarks is a way to make users navigation more predictable.
Indeed, since they are emphasized and, in a way, recommended viewpoints, bookmarks are more likely to be visited by a significant portion of users than any other viewpoint on the scene.
As such, bookmarks can be used as a way to optimize streaming by downloading segments in an optimal, pre-computed order.

More specifically, segment utility as introduced in Section~\ref{sec:dash3d} is only an approximation of the segment's true contribution to the current viewpoint rendering.
When bookmarks are defined, it is possible to obtain a perfect measure of segment utility by performing an offline rendering at each bookmark's viewpoint.
Then, by simply counting the number of pixels that are rendered using each segment, we can rank the segments by order of importance in the rendering.

We define $\mathcal{U}^{*} (s,B_i)$ as being the true utility of a segment $s$ in a viewpoint defined at bookmark $B_i$.
This utility is simply the ratio between the number of pixels displaying that segment on screen, and the total screen area (in pixels).
This utility definition is the same for geometry and texture segments, which allows all segments to be ranked by order of importance, i.e.\ of decreasing utility.

\begin{figure}[th]
    \centering
    \begin{tikzpicture}
        \begin{axis}[
                xlabel=Data downloaded (in B),
                ylabel=PSNR,
                no markers,
                cycle list name=mystyle,
                width=\tikzwidth,
                height=\tikzheight,
                legend pos=south east,
                xmin=0,
            ]

            \addplot table [x=x, y=y]{assets/system-bookmarks/precomputation/greedy.dat};
            \addlegendentry{\scriptsize Default order $\mathcal{U}$}
            \addplot table [x=x, y=y]{assets/system-bookmarks/precomputation/precomputed.dat};
            \addlegendentry{\scriptsize Proposed order $\mathcal{U}^*$}

        \end{axis}
    \end{tikzpicture}
    \caption{Impact of using the precomputed information of bookmarks to select segments to download\label{fig:precomputation}}
\end{figure}

\begin{figure}[th]
    \includegraphics[width=0.49\columnwidth]{assets/system-bookmarks/bookmark/ground-truth.png}
    \includegraphics[width=0.49\columnwidth]{assets/system-bookmarks/bookmark/geometry.png}
    \caption{A bookmarked viewpoint (left), and a pixel to geometry segment map (right)}\label{fig:bookmarks-utility}
\end{figure}

Figure~\ref{fig:bookmarks-utility} depicts a ``pixel to geometry segment'' map: all pixels of the same color in the right image display an element of the same geometry segment.
We render such maps offline, for each bookmark, and use it to compute the true utility $\mathcal{U}^*(s)$ of segment $s$.

\subsection{MPD modification}

We now present how to introduce bookmarks information in the Media Presentation Description (MPD) file, to be used in a DASH framework.
Bookmarks are fully defined by a viewport description, and the additional content needed to properly render and use a bookmark in a system consists in three images: a thumbnail of the point of view at the bookmark, along with two ``pixel to segment'' maps (see Figure~\ref{fig:bookmarks-utility}, right image).
For this reason, we create a separate adaptation set in the MPD\@.
The bookmarked viewport information is stored as a supplemental property.
Bookmarks adaptation set only contain one representation, composed of three segments corresponding to the three images described earlier.

\begin{figure}[th]
    \lstinputlisting[%
        language=XML,
        caption={MPD description of a geometry adaptation set, and a texture adaptation set.},
        label=listing:bookmark-as,
        emph={%
            MPD,
            Period,
            AdaptationSet,
            Representation,
            BaseURL,
            SegmentBase,
            Initialization,
            Role,
            SupplementalProperty,
            SegmentList,
            SegmentURL,
            Viewpoint
        }
    ]{assets/system-bookmarks/bookmark-as.xml}
\end{figure}

An example of a bookmark adaptation set is depicted on Listing~\ref{listing:bookmark-as}.
The three first values in the supplemental property are the camera position coordinates, and the three last values are the target point coordinates.

\subsection{System-aware bookmarks}

The information we include in the MPD to optimize streaming at bookmarked viewpoints can also be used to give a sense of the system state to the user.
Indeed, displaying a thumbnail of what can be seen from a bookmark might fool users into thinking that all necessary segments visible from the bookmarked viewpoint have been downloaded.
In case this would be not true, users' Quality of Experience would be unsatisfactory.

In order to give users a sense of the amount of information readily available at a given bookmarked viewpoint, we use the pixel to segment maps described in Section~\ref{sec:utility} to create a mask of segment availability.
Since we know which segments have been downloaded at any given time, we know which pixels in the thumbnail accurately depict what the user will see when clicking on the bookmark.
We thus render the thumbnail with the mask of already downloaded segments superimposed over it.

\todo[inline]{Figure of altered thumbnail}


\subsection{Loader modifications}

We build on the loader introduced in~\cite{forgione2018dash} (Algorithm 1) to implement a client adaptation logic.
We include a bookmark adaptation logic such that (i) when a bookmark is hovered for the first time, the corresponding images (see Listing~\ref{listing:bookmark-as}) are downloaded, and (ii) when a bookmark is clicked, we switch from utility $\mathcal{U}$ to true utility $\mathcal{U}^*$ to determine which segments to download next.

\begin{algorithm}[th]
    \SetKwInOut{Input}{input}
    \SetKwInOut{Output}{output}
    \Input{Current index $i$, time $t_i$, viewpoint $v(t_i)$, buffer of already downloaded  \texttt{segments} $\mathcal{B}_i$, MPD}
    \Output{Next segment $s^{*}_i$ to request, updated buffer $\mathcal{B}_{i+1}$}
    \SetAlgoLined%
    {- Estimate the bandwidth $\widehat{BW_i}$ and RTT $\widehat{\tau_i}$ \;}

    {-  Among all \texttt{segments} that are not already downloaded $s \in \mathcal{S} \backslash \mathcal{B}_i$, % \;}
   % {-
    keep the ones inside the upcoming viewing frustums $\mathcal{FC}=\mathbb{FC}(\widehat{v}(t_i)), t\in [t_i, t_i+\chi]$  thanks to a viewpoint predictor $t_i \rightarrow \hat{v}(t_i)$, a temporal horizon $\chi$ and a frustum culling operator $\mathbb{FC}$ \;}


    {- Optimize a criterion  $\Omega$ based on $\mathcal{U}$ values and well chosen viewpoint $v(t_i)$ to select the next segment to query }
   {\begin{equation*}
   s^{*}_i= \argmax{s \in \mathcal{S} \backslash \mathcal{B}_i \cap \mathcal{FC}}  \Omega_{\theta_i} \Big(\mathcal{U}(s,v(t_i))\Big) \label{eq1}
   \end{equation*} \\
   given parameters $\theta_i$ that gathers both online parameters $(i,t_i,v(t_i),\widehat{BW_i}, \widehat{\tau_i}, \mathcal{B}_i)$ and offline metadata;}

    {- Update the buffer $\mathcal{B}_{i+1}$  for the next decision: $s^{*}_i$ and lowest \texttt{representations} of $s^{*}_i$ are considered downloaded\;}
     {- \Return{segment  $s^{*}_i$, buffer $\mathcal{B}_{i+1}$}\;}

    {\caption{Algorithm to identify the next segment to query\label{algorithm:nextsegment}}}
\end{algorithm}

\todo[inline]{to be modified to include bookmarks}

