version.h: add macros to extract version components

Signed-off-by: James Almer <jamrial@gmail.com>
diff --git a/include/dav1d/dav1d.h b/include/dav1d/dav1d.h
index e0137b2..e8f0705 100644
--- a/include/dav1d/dav1d.h
+++ b/include/dav1d/dav1d.h
@@ -108,6 +108,7 @@
  *
  * @return A value in the format 0x00XXYYZZ, where XX is the major version,
  *         YY the minor version, and ZZ the patch version.
+ * @see DAV1D_API_MAJOR, DAV1D_API_MINOR, DAV1D_API_PATCH
  */
 DAV1D_API unsigned dav1d_version_api(void);
 
diff --git a/include/dav1d/version.h.in b/include/dav1d/version.h.in
index 086428c..4fa420d 100644
--- a/include/dav1d/version.h.in
+++ b/include/dav1d/version.h.in
@@ -35,6 +35,14 @@
 #define DAV1D_API_VERSION_MINOR @DAV1D_API_VERSION_MINOR@
 #define DAV1D_API_VERSION_PATCH @DAV1D_API_VERSION_PATCH@
 
+/**
+ * Extract version components from the value returned by
+ * dav1d_version_int()
+ */
+#define DAV1D_API_MAJOR(v) (((v) >> 16) & 0xFF)
+#define DAV1D_API_MINOR(v) (((v) >>  8) & 0xFF)
+#define DAV1D_API_PATCH(v) (((v) >>  0) & 0xFF)
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif