My Project
|
Functions | |
MMAL_RATIONAL_T | mmal_rational_add (MMAL_RATIONAL_T a, MMAL_RATIONAL_T b) |
MMAL_RATIONAL_T | mmal_rational_subtract (MMAL_RATIONAL_T a, MMAL_RATIONAL_T b) |
MMAL_RATIONAL_T | mmal_rational_multiply (MMAL_RATIONAL_T a, MMAL_RATIONAL_T b) |
MMAL_RATIONAL_T | mmal_rational_divide (MMAL_RATIONAL_T a, MMAL_RATIONAL_T b) |
int32_t | mmal_rational_to_fixed_16_16 (MMAL_RATIONAL_T rational) |
MMAL_RATIONAL_T | mmal_rational_from_fixed_16_16 (int32_t fixed) |
void | mmal_rational_simplify (MMAL_RATIONAL_T *rational) |
The rational utility functions allow easy manipulation of rational numbers.
Add 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.
a | First operand |
b | Second operand |
Calculate a + b.
Divide 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.
a | First operand |
b | Second operand |
Calculate a / b
MMAL_RATIONAL_T mmal_rational_from_fixed_16_16 | ( | int32_t | fixed | ) |
Convert a signed 32-bit Q16 number to a rational number.
fixed | Signed 32-bit Q16 number to convert |
Convert a rational number to a signed 32-bit Q16 number.
Multiply 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.
a | First operand |
b | Second operand |
Calculate a * b
void mmal_rational_simplify | ( | MMAL_RATIONAL_T * | rational | ) |
Reduce a rational number to it's simplest form.
rational | Rational number to simplify |
Reduce a rational number to it's simplest form.
Subtract 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.
a | First operand |
b | Second operand |
Calculate a - b.
int32_t mmal_rational_to_fixed_16_16 | ( | MMAL_RATIONAL_T | rational | ) |
Convert a rational number to a 32-bit signed Q16 number. Saturation will occur for rational numbers with an absolute value greater than 32768.
rational | Rational number to convert |
Convert a rational number to a signed 32-bit Q16 number.