]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/display.c
build: Generate pkg-config files from Make and not from configure
[ffmpeg] / libavutil / display.c
index b2b98329a0dcd4e1b82f682759a6943d37de768e..f7500948ff1ba8324f38482fc448b1bd91249b0d 100644 (file)
@@ -46,12 +46,12 @@ double av_display_rotation_get(const int32_t matrix[9])
     rotation = atan2(CONV_FP(matrix[1]) / scale[1],
                      CONV_FP(matrix[0]) / scale[0]) * 180 / M_PI;
 
-    return rotation;
+    return -rotation;
 }
 
 void av_display_rotation_set(int32_t matrix[9], double angle)
 {
-    double radians = angle * M_PI / 180.0f;
+    double radians = -angle * M_PI / 180.0f;
     double c = cos(radians);
     double s = sin(radians);
 
@@ -63,3 +63,13 @@ void av_display_rotation_set(int32_t matrix[9], double angle)
     matrix[4] = CONV_DB(c);
     matrix[8] = 1 << 30;
 }
+
+void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
+{
+    int i;
+    const int flip[] = { 1 - 2 * (!!hflip), 1 - 2 * (!!vflip), 1 };
+
+    if (hflip || vflip)
+        for (i = 0; i < 9; i++)
+            matrix[i] *= flip[i % 3];
+}