-\subsection{True median filter n$\times$n}
-Shared memory can represent an efficient way to reduce global or texture loads, but it is also a limiting factor for performance.
-On Fermi GPUs (as C2070), a maximum of 48~kB of per block shared memory is avalaible. With 16-bit coded gray levels, that allows to store up to 24576 values, which can be organised as a square of 156$\times$156 pixels maximum.
-A point is that it is not efficient to use the shared memory at its maximum, as it would reduce the number of blocks beeing run in parallel on each SM.
-Another point is that it is not possible to avoid bank conflicts when designing a generic median kernel.
-Thus, the most efficient way to code a generic, large window, median filter, is to do without shared memory but use texture direct fetching.
-Listing \ref{lst:medianForgetGeneric} reproduce such a code, where the most interesting part is between lines XX and YY, where the forgetfull selection has been generalized to an arbitrary window size.
-Performance results summarized in table \ref{tab:medianForgetGeneric} demonstrate that such a method is far from beeing as efficient as small fixed-size implementations.
-
-\begin{table}[h]
-%\newlength\savedwidth
-\newcommand\whline{\noalign{\global\savedwidth
- \arrayrulewidth\global\arrayrulewidth 1.5pt}
- \hline \noalign{\global\arrayrulewidth
- \savedwidth}
-}
-\centering
-{\scriptsize
-\begin{tabular}{|l||c|c|c|c|}
-\hline
-\shortstack{\textbf{Window size}\\(in pixels)}&\textbf{121}&\textbf{169}&\textbf{225}&\textbf{441}\\\whline
- \shortstack{\textbf{Throughput}\\\textbf{(MP/s)}}& & & & \\\hline
-\end{tabular}
-}
-\caption{Performance of generic median kernel applied to various window sizes on 4096$\times$4096 pixel image.}
-\label{tab:medianForgetGeneric}
-\end{table}
-
-\lstinputlisting[label={lst:medianForgetGeneric},caption= generic median kernel by forgetfull selection.]{Chapters/chapter3/code/kernMedianForgetGeneric.cu}
+\subsection{Fast approximated n$\times$n median filter }
+Large window median filters are less widespread and used in more specific fields, such as digital microscopy: for example in \cite{paper_bio_background}, an estimation of the background gray-level intensity is achieved through a $111\times 111$ median filtering (processed in around 2s for a 4MPixel image). In such cases, a possible technique is to split median selection into two separate 1-D stages: one in the vertical direction and the other in the horizontal direction. Image processing specialists may object that this method does not select the actual median value. This is true but, in the case of large window sizes and \textit{real-life} images, the so selected value is statistically near the actual median value and often represents an acceptable approximation. Such a filter is sometimes called \textit{smoother}.