Working Sobel CPU code