apertus-open-source-cinema / misc-tools-utilities

collection of scripts, tools and utilities not specific to a particular camera or hardware
GNU General Public License v3.0
13 stars 11 forks source link

raw2dng --swap-lines crash with corrupt input file #5

Open davidak opened 6 years ago

davidak commented 6 years ago
davidak@Latitude-E5470:~$ raw2dng --swap-lines ~/türkenschanzpark_wien/pictures/20171031_123752/20171031_123752.raw12
Active options:
--swap-lines        : Swap lines in the raw data

/home/davidak/türkenschanzpark_wien/pictures/20171031_123752/20171031_123752.raw12
Resolution  : 4096 x 1539
Frame size  : 9455616 bytes
Bayer Order : GBRG 
Black level : 128
White level : 4095
Line swap...
Segmentation fault (core dumped)
davidak@Latitude-E5470:~$ raw2dng ~/türkenschanzpark_wien/pictures/20171031_123752/20171031_123752.raw12

This is not a problem without --swap-lines:

/home/davidak/türkenschanzpark_wien/pictures/20171031_123752/20171031_123752.raw12
Resolution  : 4096 x 1539
Frame size  : 9455616 bytes
Bayer Order : GBRG 
Black level : 128
White level : 4095
Output file : /home/davidak/türkenschanzpark_wien/pictures/20171031_123752/20171031_123752.DNG
Done.

This is how the picture looks as PNG. You see the lower half is missing.

20171031_123752

Here is the RAW file: 20171031_123752.raw12.zip

cc @alexdu

alexdu commented 6 years ago

That's because of the odd vertical resolution...

davidak commented 6 years ago

@alexdu can we prevent it from segfaulting and just print an error?

alexdu commented 6 years ago

Try clearing the LSB here: https://github.com/apertus-open-source-cinema/misc-tools-utilities/blob/master/raw2dng/raw2dng.c#L1832

or override the height from the command line: https://github.com/apertus-open-source-cinema/misc-tools-utilities/blob/master/raw2dng/raw2dng.c#L101

davidak commented 6 years ago

I'm not able to do it mysqlf because i don't know C.