On 05/30/2014 03:23 PM, Diego Biurrun wrote:
On Fri, May 30, 2014 at 02:43:38PM -0400, Justin Ruggles wrote:
On 05/30/2014 02:20 PM, Diego Biurrun wrote:
On Fri, May 30, 2014 at 01:20:36PM -0400, Justin Ruggles wrote:
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -228,6 +230,27 @@ int av_image_check_size(unsigned int w, unsigned int h, 
int log_offset, void *lo
+int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar)
+{
+    int64_t scaled_dim;
+
+    if (!sar.den)
+        return AVERROR(EINVAL);
+
+    if (!sar.num || sar.num == sar.den)
+        return 0;
+
+    if (sar.num < sar.den) {
+        scaled_dim = av_rescale_rnd(w, sar.num, sar.den, AV_ROUND_ZERO);
+    } else {
+        scaled_dim = av_rescale_rnd(h, sar.den, sar.num, AV_ROUND_ZERO);
+    }
+    if (scaled_dim > 0) {
+        return 0;
+    }
nit: extra parentheses
Where?
.. extra {} for some, but not all if-blocks ..

Parentheses?  Brackets?  Braces?  They keep confusing me :)


Ah, ok. That's probably too much Go programming at work influencing my C coding style. :) I'll change it.

-Justin

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

Reply via email to