Reading the JM 18.4 reference software code I stumbled upon the following expression:
return ((int) floor(nbits * p_quad->m_Qc + 0.5))
The types are:
int nbits
int p_quad->m_Qc
Why would you add 0.5 and then floor the multiplication of two integers? Inspecting the results, they are the same as the multiplication alone.
In general,
floor(x + 0.5)can be used to emulateround(x). However, this is only useful ifxcan take on non-integer values, so it seems superfluous in your case!