CR3-Qstep table: avoid wrong 64-bit code generation patch

This commit is contained in:
Gwyn Ciesla 2024-01-09 12:46:15 -06:00
parent d7e52c7b1b
commit 5f095ba305
2 changed files with 46 additions and 2 deletions

View File

@ -3,11 +3,12 @@
Summary: Library for reading RAW files obtained from digital photo cameras
Name: LibRaw
Version: 0.21.2
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD-3-Clause and (CDDL-1.0 or LGPL-2.1-only)
URL: https://www.libraw.org
Source0: %{url}/data/%{name}-%{version}.tar.gz
Patch0: LibRaw-pkgconfig.patch
Patch1: e231b01a49ce37d2add75e2a8f7ece5602f00457.patch
BuildRequires: gcc-c++
BuildRequires: pkgconfig(lcms2)
@ -108,7 +109,10 @@ rm -fv %{buildroot}%{_libdir}/lib*.la
%changelog
* Thu Dec 21 2023 Gwyn Ciesla <gwync@protonmail.com> - 0.21.2
* Tue Jan 09 2024 Gwyn Ciesla <gwync@protonmail.com> - 0.21.2-2
- CR3-Qstep table: avoid wrong 64-bit code generation patch
* Thu Dec 21 2023 Gwyn Ciesla <gwync@protonmail.com> - 0.21.2-1
- 0.21.2, enable zlib support.
* Tue Nov 28 2023 Orion Poplawski <orion@nwra.com> - 0.21.1-7

View File

@ -0,0 +1,40 @@
From e231b01a49ce37d2add75e2a8f7ece5602f00457 Mon Sep 17 00:00:00 2001
From: Alex Tutubalin <lexa@lexa.ru>
Date: Thu, 4 Jan 2024 15:36:38 +0300
Subject: [PATCH] CR3-Qstep table: avoid wrong 64-bit code generation
---
src/decoders/crx.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/decoders/crx.cpp b/src/decoders/crx.cpp
index 30a70205..0289c075 100644
--- a/src/decoders/crx.cpp
+++ b/src/decoders/crx.cpp
@@ -2032,7 +2032,7 @@ int crxMakeQStep(CrxImage *img, CrxTile *tile, int32_t *qpTable, uint32_t /*tota
// not sure about this nonsense - why is it not just avg like with 2 levels?
quantVal = ((quantVal < 0) * 3 + quantVal) >> 2;
if (quantVal / 6 >= 6)
- *qStepTbl = q_step_tbl[quantVal % 6] * (1 << (quantVal / 6 + 26));
+ *qStepTbl = q_step_tbl[quantVal % 6] << ((quantVal / 6 - 6 ) & 0x1f);
else
*qStepTbl = q_step_tbl[quantVal % 6] >> (6 - quantVal / 6);
}
@@ -2052,7 +2052,7 @@ int crxMakeQStep(CrxImage *img, CrxTile *tile, int32_t *qpTable, uint32_t /*tota
{
int32_t quantVal = (qpTable[row0Idx++] + qpTable[row1Idx++]) / 2;
if (quantVal / 6 >= 6)
- *qStepTbl = q_step_tbl[quantVal % 6] * (1 << (quantVal / 6 + 26));
+ *qStepTbl = q_step_tbl[quantVal % 6] << ((quantVal / 6 - 6) & 0x1f);
else
*qStepTbl = q_step_tbl[quantVal % 6] >> (6 - quantVal / 6);
}
@@ -2066,7 +2066,7 @@ int crxMakeQStep(CrxImage *img, CrxTile *tile, int32_t *qpTable, uint32_t /*tota
for (int qpRow = 0; qpRow < qpHeight; ++qpRow)
for (int qpCol = 0; qpCol < qpWidth; ++qpCol, ++qStepTbl, ++qpTable)
if (*qpTable / 6 >= 6)
- *qStepTbl = q_step_tbl[*qpTable % 6] * (1 << (*qpTable / 6 + 26));
+ *qStepTbl = q_step_tbl[*qpTable % 6] << ((*qpTable / 6 - 6) & 0x1f);
else
*qStepTbl = q_step_tbl[*qpTable % 6] >> (6 - *qpTable / 6);