thosoo / cr2hdr64

magic lantern's canon raw (cr2) to high dynamic range output dng (dual iso) compiled for 64-bits
1 stars 0 forks source link

Segmentation Fault on save_dng() on Android #1

Open thosoo opened 3 years ago

thosoo commented 3 years ago

A segmentation fault is coming up when trying to save a dng using chdk_dng.c on android. This was compiled and executed using termux.

thosoo commented 3 years ago

After running with lldb

➜  A lldb ~/cr2hdr ./FV9A0405.CR2
(lldb) target create "/data/data/com.termux/files/home/cr2hdr"
Current executable set to '/data/data/com.termux/files/home/cr2hdr' (aarch64).
(lldb) settings set -- target.run-args  "./FV9A0405.CR2"
(lldb) run
Process 10849 launched: '/data/data/com.termux/files/home/cr2hdr' (aarch64)
cr2hdr: a post processing tool for Dual ISO images

Active options:
--amaze-edge    : use a temporary demosaic step (AMaZE) followed by edge-directed interpolation (default)
--cs2x2         : apply 2x2 chroma smoothing in noisy and aliased areas (default)
--wb=graymax    : set AsShotNeutral by maximizing the number of gray pixels (default)

Input file      : ./FV9A0405.CR2
Process 10849 stopped and restarted: thread 1 received signal: SIGCHLD
Process 10849 stopped and restarted: thread 1 received signal: SIGCHLD
Camera          : Canon EOS 5D Mark III
Full size       : 5920 x 3950
Active area     : 5796 x 3870
Process 10849 stopped and restarted: thread 1 received signal: SIGCHLD
Black borders   : 124 left, 80 top
Black level     : 2045
ISO pattern     : BddB RGGB
White levels    : 15167 13803
Noise levels    : 18.06 7.32 7.30 17.99 (14-bit)
Linear fit      : y = 7.7086*x - 1.14
Linear fit      : y = 7.7187*x - 0.95
Linear fit      : y = 7.7222*x - 0.96
Linear fit      : y = 7.7241*x - 0.97
Linear fit      : y = 7.7258*x - 0.98
ISO difference  : 2.95 EV (773)
Black delta     : 3.59
Black adjust    : 0.0
Dynamic range   : 10.81 (+) 9.35 => 12.30 EV (in theory)
Looking for hot/cold pixels...
Hot pixels      : 45
Cold pixels     : 2340
AMaZE interpolation ...
Amaze took 4.58 s
Edge-directed interpolation...
Semi-overexposed: 17.48%
Deep shadows    : 47.75%
Horizontal stripe fix...
Full-res reconstruction...
ISO overlap     : 4.9 EV (approx)
Half-res blending...
Chroma smoothing...
Building alias map...
Filtering alias map...
Smoothing alias map...
Final blending...
Noise level     : 121.02 (20-bit), ideally 120.06
Dynamic range   : 12.76 EV (cooked)
Black adjust    : -0.2
AsShotNeutral   : 0.49 1 0.62, 5285K/g=1.02 (gray max)
Output file     : ./FV9A0405.DNG (already exists, overwriting)
Process 10849 stopped
* thread #1, name = 'cr2hdr', stop reason = signal SIGSEGV: invalid address (fault address: 0x56571ba0)
    frame #0: 0x0000005555565dcc cr2hdr`save_dng [inlined] add_to_buf(var=0x0000000056571ba0, size=4) at chdk-dng.c:258:5
   255
   256  static void add_to_buf(void* var, int size)
   257  {
-> 258      memcpy(dng_header_buf+dng_header_buf_offset,var,size);
   259      dng_header_buf_offset += size;
   260  }
   261
(lldb)