summaryrefslogtreecommitdiff
path: root/libavutil/imgutils.h
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2014-04-28 16:08:33 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2014-06-20 10:39:33 -0400
commit9e500efdbe0deeff1602500ebc229a0a6b6bb1a2 (patch)
treeab9fefcc3d3bab4d2a75f427e96587fd61ec2770 /libavutil/imgutils.h
parentd349afb07bacccb62eb5369c38d6406d2909d792 (diff)
Add av_image_check_sar() and use it to validate SAR
Diffstat (limited to 'libavutil/imgutils.h')
-rw-r--r--libavutil/imgutils.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h
index 71510132ae..313037ae76 100644
--- a/libavutil/imgutils.h
+++ b/libavutil/imgutils.h
@@ -29,6 +29,7 @@
#include "avutil.h"
#include "pixdesc.h"
+#include "rational.h"
/**
* Compute the max pixel step for each plane of an image with a
@@ -128,6 +129,20 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
*/
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
+/**
+ * Check if the given sample aspect ratio of an image is valid.
+ *
+ * It is considered invalid if the denominator is 0 or if applying the ratio
+ * to the image size would make the smaller dimension less than 1. If the
+ * sar numerator is 0, it is considered unknown and will return as valid.
+ *
+ * @param w width of the image
+ * @param h height of the image
+ * @param sar sample aspect ratio of the image
+ * @return 0 if valid, a negative AVERROR code otherwise
+ */
+int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar);
+
int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt);
/**