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?

> > +
> > +    return (int) floor(rotationf);
> 
> I think rounding to nearest makes more sense here.

Right, this is a remnant from the previous version where the return value was
int.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to