- else \
- { \
- for(int chan = 0; chan < comps; chan++) \
- { \
-/* load kernel */ \
- for(int kernel_y = 0; kernel_y < 3; kernel_y++) \
- { \
- for(int kernel_x = 0; kernel_x < 3; kernel_x++) \
- { \
- int in_y = y - 1 + kernel_y; \
- int in_x = x - 1 + kernel_x; \
- CLAMP(in_y, 0, h - 1); \
- CLAMP(in_x, 0, w - 1); \
- kernel[3 * kernel_y + kernel_x] = \
- (type)input_rows[in_y][in_x * components + chan]; \
- if(is_yuv && chan > 0) \
- { \
- kernel[3 * kernel_y + kernel_x] -= 0x80; \
- } \
- } \
- } \
-/* do the business */ \
- output_rows[y][x * components + chan] = edge_detect(kernel, max, sizeof(type) < 4); \
- if(is_yuv && chan > 0) \
- { \
- output_rows[y][x * components + chan] += 0x80; \
- } \
- } \
- if(components == 4) output_rows[y][x * components + 3] = \
- input_rows[y][x * components + 3]; \
+ float v = (h_grad + v_grad) * amounts; \
+ type t = v > max ? max : v; \
+ if( is_yuv ) { \
+ *op++ = t; *op++ = 0x80; *op++ = 0x80; \