C++ - how to apply separate filter

[-1,0,1]
[-1
2
-1]

Thanks.