-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use SSE/MMX/Altivec for faster CTMF #432
Conversation
* Modified from code | ||
* Copyright (C) 2006 Simon Perreault | ||
* | ||
* Reference: S. Perreault and P. Hébert, "Median Filtering in Constant Time", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UTF 8
Is anyone able to test this on Windows? /cc @blink1073 |
Will do, tonight |
@@ -17,6 +17,11 @@ cimport cython | |||
from libc.stdlib cimport malloc, free | |||
from libc.string cimport memset | |||
|
|||
cdef extern from "_histogram.h": | |||
ctypedef unsigned short int uint16_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use np.uint16_t here and below?
Good to go, but failed the following two unrelated tests: |
ping @thouis |
I think I got everything above (plus cleaned up compilation a bit with some casts). |
@@ -323,33 +327,17 @@ cdef void set_stride(Histograms *ph, SCoord *psc): | |||
# | |||
############################################################################ | |||
cdef inline np.int32_t tl_br_colidx(Histograms *ph, np.int32_t colidx): | |||
return (colidx + 3*ph.radius + ph.current_row) % ph.stripe_length | |||
return <np.int32_t> (colidx + 3*ph.radius + ph.current_row) % ph.stripe_length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP8
This looks good to me! Thanks, @thouis . If you can, just do a pass through the PEP8 checker, otherwise I can do that when I merge. |
Bah. I accidentally deleted the branch instead of pushing a new version to it. Anyway, fixed the pep8. Some long lines remain, but I thought they were more readable than breaking them up. |
Merged. |
Use SSE/MMX/Altivec for faster CTMF
This speeds up CTMF by about a factor of 2 on my machine.
I don't have access to a non SSE machine, so some testing is in order.