Le 2014-05-19 12:28, Anton Khirnov a écrit :
On Mon, 19 May 2014 10:25:54 +0800, Rémi Denis-Courmont
<[email protected]> wrote:
Le 2014-05-19 03:34, Anton Khirnov a écrit :
> +double av_display_rotation_get(const int32_t matrix[9])
> +{
> +    double rotationf, scale[2];
> +
> +    scale[0] = sqrt(CONV_FP(matrix[0]) * CONV_FP(matrix[0]) +
> +                    CONV_FP(matrix[3]) * CONV_FP(matrix[3]));
> +    scale[1] = sqrt(CONV_FP(matrix[1]) * CONV_FP(matrix[1]) +
> +                    CONV_FP(matrix[4]) * CONV_FP(matrix[4]));
> +
> +    rotationf = atan2(CONV_FP(matrix[1]) / scale[1],
> + CONV_FP(matrix[0]) / scale[0]) * 180 / M_PI;

Does libav assume that floating point divisions by zero are safe?


Hmm, I wonder what would be a proper value to return when the matrix is
singular.
NaN?

Signed infinites can be handled by atan2() unless the other argument is unsigned zero. However that is of dubious usefulness to the situation at hand. Other cases should fail.

I don't have any strong opinion on the error return value, so long as it is documented and outside the range of success return values.

--
Rémi Denis-Courmont
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to