The branch, master has been updated
via a75b15a4ab88ae26427b7dd518983cdc13a4b4b5 (commit)
from 1d84ab331cb75a1c21d2705b24448b9971380697 (commit)
- Log -----------------------------------------------------------------
commit a75b15a4ab88ae26427b7dd518983cdc13a4b4b5
Author: Kacper MichajÅow <[email protected]>
AuthorDate: Tue Nov 25 18:06:33 2025 +0100
Commit: Kacper MichajÅow <[email protected]>
CommitDate: Tue Nov 25 22:32:50 2025 +0100
avfilter/vf_drawvg: round color values to avoid differences on some
platforms
This ensures consistent color conversion between double and u8 and
guarantees that values remain consistent across different platforms,
especially when x87 math is used.
Note that libcairo also performs rounding internally when converting
doubles to integers, see _cairo_color_double_to_short().
Fixes: fate-filter-drawvg-interpreter
Signed-off-by: Kacper MichajÅow <[email protected]>
diff --git a/libavfilter/tests/drawvg.c b/libavfilter/tests/drawvg.c
index 2d151bf4d2..9fb233d969 100644
--- a/libavfilter/tests/drawvg.c
+++ b/libavfilter/tests/drawvg.c
@@ -167,7 +167,7 @@ void cairo_set_source(cairo_t *cr, cairo_pattern_t *source)
{
printf("%s", __func__);
#define PRINT_COLOR(prefix) \
- printf(prefix "#%02x%02x%02x%02x", (int)(r*255), (int)(g*255),
(int)(b*255), (int)(a*255))
+ printf(prefix "#%02lx%02lx%02lx%02lx", lround(r*255), lround(g*255),
lround(b*255), lround(a*255))
switch (cairo_pattern_get_type(source)) {
case CAIRO_PATTERN_TYPE_SOLID:
diff --git a/libavfilter/vf_drawvg.c b/libavfilter/vf_drawvg.c
index fd9270ee13..5d3008084c 100644
--- a/libavfilter/vf_drawvg.c
+++ b/libavfilter/vf_drawvg.c
@@ -1981,7 +1981,7 @@ static int vgs_eval(
b = numerics[3];
}
- #define C(v, o) ((uint32_t)(av_clipd(v, 0, 1) * 255) << o)
+ #define C(v, o) ((uint32_t)lround(av_clipd(v, 0, 1) * 255) << o)
state->vars[user_var] = (double)(
C(r, 24)
diff --git a/tests/ref/fate/filter-drawvg-interpreter
b/tests/ref/fate/filter-drawvg-interpreter
index 21c6ccd848..3fc33e9c07 100644
--- a/tests/ref/fate/filter-drawvg-interpreter
+++ b/tests/ref/fate/filter-drawvg-interpreter
@@ -64,16 +64,16 @@ cairo_set_dash [ -1.0 ] 4.0
cairo_set_dash [ ] 0.0
cairo_move_to 1.0 2.0
cairo_rel_line_to -1.0 -2.0
-cairo_set_source #19334c66
+cairo_set_source #1a334d66
cairo_set_fill_rule 0
cairo_fill
-cairo_set_source #475b3d66
+cairo_set_source #475c3d66
cairo_set_fill_rule 0
cairo_fill
-cairo_set_source #7f99b2cc
+cairo_set_source #8099b3cc
cairo_set_fill_rule 0
cairo_fill
-cairo_set_source #a8d7efe5
+cairo_set_source #a8d8f0e6
cairo_set_fill_rule 0
cairo_fill
cairo_rel_line_to 1.0 3.0
-----------------------------------------------------------------------
Summary of changes:
libavfilter/tests/drawvg.c | 2 +-
libavfilter/vf_drawvg.c | 2 +-
tests/ref/fate/filter-drawvg-interpreter | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]