35 lines
1.5 KiB
Diff
35 lines
1.5 KiB
Diff
From 8c68f4d42349aa3ba87ec3700a12e7fb38867748 Mon Sep 17 00:00:00 2001
|
|
From: Fredrik Mellbin <fredrik.mellbin@gmail.com>
|
|
Date: Wed, 27 Sep 2023 18:37:08 +0200
|
|
Subject: [PATCH] Fix SAR calculation for real
|
|
|
|
---
|
|
ChangeLog | 3 +++
|
|
src/core/vsresize.cpp | 2 +-
|
|
2 files changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/ChangeLog b/ChangeLog
|
|
index cde13add..fa88776b 100644
|
|
--- a/ChangeLog
|
|
+++ b/ChangeLog
|
|
@@ -1,3 +1,6 @@
|
|
+r65:
|
|
+fixed the sar adjustment for real this time
|
|
+
|
|
r64:
|
|
fixed compilation on osx where the default standard library doesn't have a full implementation of std::from_chars
|
|
fixed SAR adjustment in resizer when source cropping is used
|
|
diff --git a/src/core/vsresize.cpp b/src/core/vsresize.cpp
|
|
index b0962580..380f76a1 100644
|
|
--- a/src/core/vsresize.cpp
|
|
+++ b/src/core/vsresize.cpp
|
|
@@ -336,7 +336,7 @@ void propagate_sar(const VSMap *src_props, VSMap *dst_props, const zimg_image_fo
|
|
muldivRational(&sar_num, &sar_den, src_format.width, dst_format.width);
|
|
|
|
if (!std::isnan(src_format.active_region.height) && src_format.active_region.height != src_format.height)
|
|
- muldivRational(&sar_num, &sar_den, std::llround(src_format.active_region.height * 16), static_cast<int64_t>(dst_format.height) * 16);
|
|
+ muldivRational(&sar_num, &sar_den, static_cast<int64_t>(dst_format.height) * 16, std::llround(src_format.active_region.height * 16));
|
|
else
|
|
muldivRational(&sar_num, &sar_den, dst_format.height, src_format.height);
|
|
|