[libav-devel] [PATCH 1/3] display: add translation and flip api

Vittorio Giovara vittorio.giovara at gmail.com
Thu Jun 19 00:08:20 CEST 2014


---
 doc/APIchanges      |  3 +++
 libavutil/display.c | 10 ++++++++++
 libavutil/display.h |  9 +++++++++
 libavutil/version.h |  2 +-
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 51a2ff5..22acf95 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2013-12-xx
 
 API changes, most recent first:
 
+2014-05-xx - xxxxxxx - lavu 53.17.0 - display.h
+  Add av_display_matrix_flip() to flip the transformation matrix.
+
 2014-xx-xx - xxxxxxx - lavf 55.20.0 - avformat.h
   The proper way for providing a hint about the desired timebase to the muxers
   is now setting AVStream.time_base, instead of AVStream.codec.time_base as was
diff --git a/libavutil/display.c b/libavutil/display.c
index b2b9832..74aceb2 100644
--- a/libavutil/display.c
+++ b/libavutil/display.c
@@ -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];
+}
diff --git a/libavutil/display.h b/libavutil/display.h
index ea762a4..7e37627 100644
--- a/libavutil/display.h
+++ b/libavutil/display.h
@@ -74,4 +74,13 @@ double av_display_rotation_get(const int32_t matrix[9]);
  */
 void av_display_rotation_set(int32_t matrix[9], double angle);
 
+/**
+ * Flip the input matrix horizontally and/or vertically.
+ *
+ * @param matrix an allocated transformation matrix
+ * @param hflip whether the matrix should be flipped horizontally
+ * @param vflip whether the matrix should be flipped vertically
+ */
+void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip);
+
 #endif /* AVUTIL_DISPLAY_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index 427409f..a4384b3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 53
-#define LIBAVUTIL_VERSION_MINOR 16
+#define LIBAVUTIL_VERSION_MINOR 17
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
1.8.3.2



More information about the libav-devel mailing list