[FFmpeg-devel] [PATCH] avcodec/pngenc: cast double to integer type to avoid problems with some AV_WB32() implementations

Michael Niedermayer michaelni at gmx.at
Mon Mar 2 01:38:33 CET 2015


alternatively lrint(f)() could be used
or various other options

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/pngenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 9fd8eef..3a94366 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -231,7 +231,7 @@ static int png_write_row(PNGEncContext *s, const uint8_t *data, int size)
     return 0;
 }
 
-#define AV_WB32_PNG(buf, n) (AV_WB32(buf, round((n) * 100000)))
+#define AV_WB32_PNG(buf, n) (AV_WB32(buf, (unsigned int)round((n) * 100000)))
 static int png_get_chrm(enum AVColorPrimaries prim,  uint8_t *buf)
 {
     double rx, ry, gx, gy, bx, by, wx = 0.3127, wy = 0.3290;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list