move kernel buffer copying inside the row loop
add sorting and kernelMedian logic;