 			prevaov.ptr(),
 			m_mtxs.ptr(),
 			outputSurf,
+			m_tmpBuf.ptr(),
 			width, height);
 
 		checkCudaKernel(temporalReprojection);
 
+#ifdef ENABLE_MEDIAN_FILTER
+		medianFilter << <grid, block >> > (
+			outputSurf,
+			m_tmpBuf.ptr(),
+			curaov.ptr(),
+			prevaov.ptr(),
+			m_mtxs.ptr(),
+			m_paths.ptr(),
+			width, height);
+
+		checkCudaKernel(medianFilter);
+#endif
+
 		m_mtxs.reset();
 	}
 }

#include "cuda/cudamemory.h"

#include "aten4idaten.h"

inline __device__ void computePrevScreenPos(
	int ix, int iy,

	idaten::SVGFPathTracing::AOV* prevAovs,
	const aten::mat4* __restrict__ mtxs,
	cudaSurfaceObject_t dst,
	float4* tmpBuffer,
	int width, int height)
{
	int ix = blockIdx.x * blockDim.x + threadIdx.x;
