gopro / gpr

General Purpose Raw image format
Apache License 2.0
116 stars 33 forks source link

Fix: added new dng sdk 1.5.x #30

Open Jamaika1 opened 4 years ago

Jamaika1 commented 4 years ago

I don't know will library have update? I am adding patches to the latest dng sdk 1.5.x. Maybe it will be useful to someone. https://github.com/Jamaika1/dng_sdk_1.5.1_-_gpr_sdk_1.0.0

OgreTransporter commented 4 years ago

Wonderful! Thank you very much! Why not create a PR to update the gpr library? I have already started updating expat, zlib, xmp, and cJSON. I have also included your changes to dng and gpr. But you obviously also changed VC5. For example VC5_ENCODER_PIXEL_FORMAT_RGGB_16 (https://github.com/Jamaika1/dng_sdk_1.5.1_-_gpr_sdk_1.0.0/blob/f9a54f80c5bd8eefa8f906824198d1b1628febeb/gpr_sdk/gpr.cpp#L157) is not included in the official code.

    typedef enum
    {
        VC5_ENCODER_PIXEL_FORMAT_RGGB_12 = 0,           // RGGB 14bit pixels packed into 16bits

        VC5_ENCODER_PIXEL_FORMAT_RGGB_12P = 1,           // RGGB 14bit pixels packed into 16bits

        VC5_ENCODER_PIXEL_FORMAT_RGGB_14 = 2,           // RGGB 14bit pixels packed into 16bits

        VC5_ENCODER_PIXEL_FORMAT_GBRG_12 = 3,           // GBRG 12bit pixels packed into 16bits

        VC5_ENCODER_PIXEL_FORMAT_GBRG_12P = 4,          // GBRG 12bit pixels packed into 12bits

        VC5_ENCODER_PIXEL_FORMAT_DEFAULT = VC5_ENCODER_PIXEL_FORMAT_RGGB_14,

    } VC5_ENCODER_PIXEL_FORMAT;

I guess you took the codec from the CineForm SDK and then rewrote the functions vc5_encoder_process (vc5_encoder.c) and vc5_decoder_process (vc5_decoder.c)? I am stuck at that point.

Jamaika1 commented 4 years ago

I shouldn't admit, but I'm not a programmer. As a programming hobbyist, I wanted to run the libraw library from DNG SDK and GPR SDK. The creator of libraw added camera Rapsberry Pi RAW+JPEG format (if USE_6BY9RPI defined) 8/12/14/16bit.

#ifdef USE_6BY9RPI
    void        rpi_load_raw8();
    void        rpi_load_raw12();
    void        rpi_load_raw14();
    void        rpi_load_raw16();
    void        parse_raspberrypi();
#endif

I also added GoPro GPR bayerphase 8/12/14/16bit. I realize that it isn't connected. https://github.com/gopro/gpr/tree/bayerphase The new jpegXL codec 8/10/12/16bit is very much advertised. What is the libraw problem. The converter has bad colormatrix for DNG SDK, but dng_validate seems to be valid. Fix: Adobe XMP SDK 2020 https://github.com/adobe/XMP-Toolkit-SDK/ https://github.com/adobe/XMP-Toolkit-SDK/pull/2 https://github.com/adobe/XMP-Toolkit-SDK/pull/3 … Other info Warming. This may be due to the imperfections of the gcc 10/11 software.

In file included from dng_negative.h:28,
                 from dng_negative.cpp:9:
In member function 'dng_mosaic_info& dng_mosaic_info::operator=(const dng_mosaic_info&)',
    inlined from 'void dng_negative::SetFujiMosaic6x6(uint32)' at dng_negative.cpp:2884:10:
dng_mosaic_info.h:32:7: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   32 | class dng_mosaic_info
      |       ^~~~~~~~~~~~~~~
dng_string.cpp: In member function 'bool dng_string::Replace(const char*, const char*, bool)':
dng_string.cpp:1608:12: warning: 'char* strncpy(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Wstringop-overflow=]
 1608 |    strncpy (fData.Buffer_char () + match_offset,
      |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1609 |       new_string,
      |       ~~~~~~~~~~~
 1610 |       len3);
      |       ~~~~~
dng_string.cpp:44:18: note: length computed here
   44 |  ConvertUnsigned (strlen (s), &lengthAsUint32);
      |  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PNG_Support.cpp:89:16: warning: multi-character character constant [-Wmultichar]
   89 |         IHDR = 'IHDR',
      |                ^~~~~~
XMPScanner.cpp: In member function 'void XMPScanner::Scan(const void*, XMP_Int64, XMP_Int64)':
XMPScanner.cpp:1267:5: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
 1267 |     auto_ptr<PacketMachine> ap ( pm );
      |     ^~~~~~~~
In file included from c:\msys1100\include\c++\11.0.0\memory:83,
                 from c:\msys1100\x86_64-w64-mingw32\include\xmpfiles\source\formatsupport\xmpscanner.hpp:22,
                 from XMPScanner.cpp:27:
c:\msys1100\include\c++\11.0.0\bits\unique_ptr.h:56:28: note: declared here
   56 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
OgreTransporter commented 4 years ago

This may be due to the imperfections of the gcc 10/11 software.

Not necessarily. The code is partly written very sloppily and contains numerous errors.

Example: https://github.com/gopro/gpr/blob/e956c5961b5f046a6fda1b2f428b7718e9008122/source/app/common/argument_parser/argument_parser.cpp#L88

The function get_application_path returns the variable application_path: https://github.com/gopro/gpr/blob/e956c5961b5f046a6fda1b2f428b7718e9008122/source/app/common/argument_parser/argument_parser.h#L39

However, this variable is not set anywhere, which means that there are memory access errors. Actually all member variables of a class should be set in the constructor to avoid such errors. Alternatively you can use STL data types. Bugfix: https://github.com/OgreTransporter/gpr/commit/10d7e9c77854d62cd0e3c61fcf601f1ebf752e19

I used your code and did a complete upgrade of GPR. Thanks again for that! Probably there are still some minor corrections to be made.

https://github.com/OgreTransporter/gpr