Source: libraw
Version: 0.21.1-7
Severity: normal
Tags: upstream patch

Hi,

the libraw git repository has a fix for compressed CR3 files. The fix can be
found here:

https://github.com/LibRaw/LibRaw/commit/e231b01a49ce37d2add75e2a8f7ece5602f00457

The issue can be found here:

https://github.com/LibRaw/LibRaw/issues/624

It would be nice if you can include this patch into the 0.21.2 package.

Regards,
Tino

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.6.10 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
commit e231b01a49ce37d2add75e2a8f7ece5602f00457
Author: Alex Tutubalin <l...@lexa.ru>
Date:   Thu Jan 4 15:36:38 2024 +0300

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

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);
 

Reply via email to