Cosmetics

Use C++ casting operator instead of C-style type casting.
Code cleanup.
Remove planes parameter because the result will be wrong in double rate
output.