diff options
Diffstat (limited to 'gpr/source/lib/gpr_sdk/public')
-rwxr-xr-x | gpr/source/lib/gpr_sdk/public/gpr.h | 169 | ||||
-rwxr-xr-x | gpr/source/lib/gpr_sdk/public/gpr_exif_info.h | 352 | ||||
-rwxr-xr-x | gpr/source/lib/gpr_sdk/public/gpr_profile_info.h | 60 | ||||
-rwxr-xr-x | gpr/source/lib/gpr_sdk/public/gpr_tuning_info.h | 149 |
4 files changed, 730 insertions, 0 deletions
diff --git a/gpr/source/lib/gpr_sdk/public/gpr.h b/gpr/source/lib/gpr_sdk/public/gpr.h new file mode 100755 index 0000000..666e727 --- /dev/null +++ b/gpr/source/lib/gpr_sdk/public/gpr.h @@ -0,0 +1,169 @@ +/*! @file gpr.h + * + * @brief Declaration of the GPR-SDK objects and functions + * + * GPR API can be invoked by simply including this header file. + * This file includes all other header files that are needed. + * + * (C) Copyright 2018 GoPro Inc (http://gopro.com/). + * + * Licensed under either: + * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0 + * - MIT license, http://opensource.org/licenses/MIT + * at your option. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GPR_H +#define GPR_H + +#include "gpr_platform.h" +#include "gpr_exif_info.h" +#include "gpr_profile_info.h" +#include "gpr_tuning_info.h" +#include "gpr_allocator.h" +#include "gpr_buffer.h" +#include "gpr_rgb_buffer.h" + +#ifdef __cplusplus + extern "C" { +#endif + + typedef struct + { + gpr_buffer jpg_preview; /* Address to the memory location that this buffer points to */ + + unsigned int preview_width; /* Width of input source in pixels (only applies to raw input) */ + + unsigned int preview_height; /* Height of input source in pixels (only applies to raw input) */ + + } gpr_preview_image; + + typedef struct + { + unsigned int input_width; /* Width of input source in pixels (only applies to raw input) */ + + unsigned int input_height; /* Height of input source in pixels (only applies to raw input) */ + + unsigned int input_pitch; /* Pitch of input source in pixels (only applies to raw input) */ + + bool fast_encoding; + + bool compute_md5sum; + + gpr_buffer gpmf_payload; /* GPMF payload of image file */ + + gpr_preview_image preview_image; /* Preview JPG image */ + + bool enable_preview; + + gpr_exif_info exif_info; /* Exif info object */ + + gpr_profile_info profile_info; /* Camera color profile info object */ + + gpr_tuning_info tuning_info; /* Camera tuning info object */ + + } gpr_parameters; + + void gpr_parameters_set_defaults(gpr_parameters* x); + + void gpr_parameters_construct_copy(const gpr_parameters* y, gpr_parameters* x); + + void gpr_parameters_destroy(gpr_parameters* x, gpr_free mem_free); + + //!< Parse Metadata of DNG File and return in gpr_parameters struct + bool gpr_parse_metadata(const gpr_allocator* allocator, + gpr_buffer* inp_dng_buffer, + gpr_parameters* parameters); + + //!< CHECK IF DNG IS VC5 COMPRESSED + bool gpr_check_vc5( gpr_buffer* inp_dng_buffer, gpr_malloc mem_alloc, gpr_free mem_free ); + + //!< CONVERSION FUNCTIONS + + //!< raw to dng conversion + bool gpr_convert_raw_to_dng(const gpr_allocator* allocator, + const gpr_parameters* parameters, + gpr_buffer* inp_raw_buffer, + gpr_buffer* out_dng_buffer); + + //!< dng to raw conversion + bool gpr_convert_dng_to_raw(const gpr_allocator* allocator, + gpr_buffer* inp_dng_buffer, + gpr_buffer* out_raw_buffer); + + //!< dng to raw conversion + bool gpr_convert_dng_to_dng(const gpr_allocator* allocator, + const gpr_parameters* parameters, + gpr_buffer* inp_dng_buffer, + gpr_buffer* out_dng_buffer); + + //!< vc5 to gpr conversion + bool gpr_convert_vc5_to_gpr(const gpr_allocator* allocator, + const gpr_parameters* parameters, + gpr_buffer* inp_vc5_buffer, + gpr_buffer* out_gpr_buffer); + + //!< gpr to vc5 conversion + bool gpr_convert_gpr_to_vc5(const gpr_allocator* allocator, + gpr_buffer* inp_gpr_buffer, + gpr_buffer* out_vc5_buffer); + +#if GPR_WRITING + + //!< raw to gpr conversion + bool gpr_convert_raw_to_gpr(const gpr_allocator* allocator, + const gpr_parameters* parameters, + gpr_buffer* inp_raw_buffer, + gpr_buffer* out_gpr_buffer); + + //!< dng to gpr conversion + bool gpr_convert_dng_to_gpr(const gpr_allocator* allocator, + const gpr_parameters* parameters, + gpr_buffer* inp_dng_buffer, + gpr_buffer* out_gpr_buffer); + + //!< dng to vc5 conversion + bool gpr_convert_dng_to_vc5(const gpr_allocator* allocator, + gpr_buffer* inp_dng_buffer, + gpr_buffer* out_vc5_buffer); +#endif // GPR_WRITING + + +#if GPR_READING + + //!< gpr to rgb conversion + bool gpr_convert_gpr_to_rgb(const gpr_allocator* allocator, + GPR_RGB_RESOLUTION rgb_resolution, + int rgb_bits, + gpr_buffer* inp_gpr_buffer, + gpr_rgb_buffer* out_rgb_buffer); + + //!< gpr to dng conversion + bool gpr_convert_gpr_to_dng(const gpr_allocator* allocator, + const gpr_parameters* parameters, + gpr_buffer* inp_gpr_buffer, + gpr_buffer* out_dng_buffer); + + //!< vc5 to dng conversion + bool gpr_convert_vc5_to_dng(const gpr_allocator* allocator, + const gpr_parameters* parameters, + gpr_buffer* inp_vc5_buffer, + gpr_buffer* out_dng_buffer); + + //!< gpr to raw conversion + bool gpr_convert_gpr_to_raw(const gpr_allocator* allocator, + gpr_buffer* inp_gpr_buffer, + gpr_buffer* out_raw_buffer); +#endif + +#ifdef __cplusplus + } +#endif + +#endif // GPR_H diff --git a/gpr/source/lib/gpr_sdk/public/gpr_exif_info.h b/gpr/source/lib/gpr_sdk/public/gpr_exif_info.h new file mode 100755 index 0000000..2917b25 --- /dev/null +++ b/gpr/source/lib/gpr_sdk/public/gpr_exif_info.h @@ -0,0 +1,352 @@ +/*! @file gpr_exif_info.h + * + * @brief Declaration of gpr_exif_info object and associated functions + * + * GPR API can be invoked by simply including this header file. + * This file includes all other header files that are needed. + * + * (C) Copyright 2018 GoPro Inc (http://gopro.com/). + * + * Licensed under either: + * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0 + * - MIT license, http://opensource.org/licenses/MIT + * at your option. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GPR_EXIF_INFO +#define GPR_EXIF_INFO + +#define CAMERA_MAKE_SIZE 32 +#define CAMERA_MODEL_SIZE 32 +#define CAMERA_SERIAL_SIZE 32 +#define SOFTWARE_VERSION_SIZE 32 +#define USER_COMMENT_SIZE 64 +#define SATELLITES_USED_SIZE 32 +#define SURVEY_DATA_SIZE 32 +#define PROCESSING_METHOD_SIZE 32 +#define AREA_INFORMATION_SIZE 32 +#define IMAGE_DESCRIPTION_SIZE 32 + +#include "gpr_platform.h" + +#ifdef __cplusplus + extern "C" { +#endif + + typedef enum + { + gpr_sensing_method_chip_color_area = 2, + + } gpr_sensing_method; + + typedef enum + { + gpr_file_source_digital_still = 3, + + } gpr_file_source; + + typedef enum + { + gpr_scene_type_directly_photographed = 1, + + } gpr_scene_type; + + typedef enum + { + gpr_white_balance_auto = 0, + + gpr_white_balance_manual = 1, + + } gpr_white_balance; + + typedef enum + { + gpr_exposure_mode_auto = 0, + + gpr_exposure_mode_manual = 1, + + gpr_exposure_mode_auto_bracket = 2, + + } gpr_exposure_mode; + + typedef enum + { + gpr_scene_capture_type_standard = 0, + + gpr_scene_capture_type_landscape = 1, + + gpr_scene_capture_type_portrait = 2, + + gpr_scene_capture_type_night = 3, + + } gpr_scene_capture_type; + + typedef enum + { + gpr_contrast_normal = 0, + + } gpr_contrast; + + typedef enum + { + gpr_gain_control_normal = 0, + + } gpr_gain_control; + + typedef enum + { + gpr_saturation_normal = 0, + + } gpr_saturation; + + typedef enum + { + gpr_sharpness_normal = 0, + + gpr_sharpness_soft = 1, + + gpr_sharpness_hard = 2, + + } gpr_sharpness; + + typedef enum + { + gpr_flash_not_used = 0, + + gpr_flash_used = 1, + + gpr_flash_not_supported = 32, + + } gpr_flash; + + typedef enum + { + gpr_exposure_program_manual_control = 1, + + gpr_exposure_program_normal = 2, + + gpr_exposure_program_aperture_priority = 3, + + gpr_exposure_program_shutter_priority = 4, + + gpr_exposure_program_creative = 5, + + gpr_exposure_program_action = 6, + + gpr_exposure_program_portrait_mode = 7, + + gpr_exposure_program_landscape_mode = 8, + + } gpr_exposure_program; + + typedef enum + { + gpr_metering_mode_average = 1, + + gpr_metering_mode_center_weighted_average = 2, + + gpr_metering_mode_spot = 3, + + gpr_metering_mode_multi_spot = 4, + + gpr_metering_mode_multi_segment = 5, + + } gpr_metering_mode; + + typedef enum + { + gpr_light_source_auto = 0, + + gpr_light_source_daylight = 1, + + gpr_light_source_fuorescent = 2, + + gpr_light_source_tungsten = 3, + + } gpr_light_source; // See this link for more info: http://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif/lightsource.html + + /*****************************************************************************/ + + typedef struct + { + int32_t numerator; // Numerator + + int32_t denominator; // Denominator + + } gpr_signed_rational; + + typedef struct + { + uint32_t numerator; // Numerator + + uint32_t denominator; // Denominator + + } gpr_unsigned_rational; + + typedef struct + { + uint32_t year; + + uint32_t month; + + uint32_t day; + + uint32_t hour; + + uint32_t minute; + + uint32_t second; + + } gpr_date_and_time; + + typedef struct + { + bool gps_info_valid; + + uint32_t version_id; + + char latitude_ref[2]; + + gpr_unsigned_rational latitude[3]; + + char longitude_ref[2]; + + gpr_unsigned_rational longitude[3]; + + uint8_t altitude_ref; + + gpr_unsigned_rational altitude; + + gpr_unsigned_rational time_stamp[3]; + + char satellites[SATELLITES_USED_SIZE]; + + char status[2]; + + char measure_mode[2]; + + gpr_unsigned_rational dop; + + char speed_ref[2]; + + gpr_unsigned_rational speed; + + char track_ref[2]; + + gpr_unsigned_rational track; + + char img_direction_ref[2]; + + gpr_unsigned_rational img_direction; + + char map_datum[SURVEY_DATA_SIZE]; + + char dest_latitude_ref[2]; + + gpr_unsigned_rational dest_latitude[3]; + + char dest_longitude_ref[2]; + + gpr_unsigned_rational dest_longitude[3]; + + char dest_bearing_ref[2]; + + gpr_unsigned_rational dest_bearing; + + char dest_distance_ref[2]; + + gpr_unsigned_rational dest_distance; + + char processing_method[PROCESSING_METHOD_SIZE]; + + char area_information[AREA_INFORMATION_SIZE]; + + char date_stamp[11]; + + unsigned short differential; + + } gpr_gps_info; + + typedef struct + { + char camera_make[CAMERA_MAKE_SIZE]; + + char camera_model[CAMERA_MODEL_SIZE]; + + char camera_serial[CAMERA_SERIAL_SIZE]; + + char software_version[SOFTWARE_VERSION_SIZE]; + + char user_comment[USER_COMMENT_SIZE]; + + char image_description[IMAGE_DESCRIPTION_SIZE]; + + gpr_unsigned_rational exposure_time; /* exposure time (as fraction) */ + + gpr_unsigned_rational f_stop_number; /* f-stop number (as fraction) */ + + gpr_unsigned_rational aperture; /* aperture */ + + gpr_exposure_program exposure_program; + + uint16_t iso_speed_rating; + + gpr_date_and_time date_time_original; + + gpr_date_and_time date_time_digitized; + + gpr_signed_rational exposure_bias; + + gpr_metering_mode metering_mode; + + gpr_light_source light_source; + + gpr_flash flash; + + gpr_unsigned_rational focal_length; + + gpr_sharpness sharpness; + + uint16_t saturation; + + gpr_gain_control gain_control; + + gpr_contrast contrast; + + gpr_scene_capture_type scene_capture_type; + + gpr_exposure_mode exposure_mode; + + uint16_t focal_length_in_35mm_film; + + gpr_unsigned_rational digital_zoom; + + gpr_white_balance white_balance; + + gpr_scene_type scene_type; + + gpr_file_source file_source; + + gpr_sensing_method sensing_method; + + gpr_gps_info gps_info; + + } gpr_exif_info; + + void gpr_exif_info_set_defaults( gpr_exif_info* x ); + + void gpr_exif_info_get_camera_make_and_model( const gpr_exif_info* x, char camera_make_and_model[256] ); + + gpr_date_and_time construct_gpr_date_and_time (uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t minute, uint32_t second); + +#ifdef __cplusplus + } +#endif + +#endif // GPR_EXIF_INFO diff --git a/gpr/source/lib/gpr_sdk/public/gpr_profile_info.h b/gpr/source/lib/gpr_sdk/public/gpr_profile_info.h new file mode 100755 index 0000000..5fc37b3 --- /dev/null +++ b/gpr/source/lib/gpr_sdk/public/gpr_profile_info.h @@ -0,0 +1,60 @@ +/*! @file gpr_profile_info.h + * + * @brief Declaration of gpr_profile_info object and associated functions + * + * GPR API can be invoked by simply including this header file. + * This file includes all other header files that are needed. + * + * (C) Copyright 2018 GoPro Inc (http://gopro.com/). + * + * Licensed under either: + * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0 + * - MIT license, http://opensource.org/licenses/MIT + * at your option. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GPR_PROFILE_INFO_H +#define GPR_PROFILE_INFO_H + +#include "gpr_platform.h" + +#ifdef __cplusplus + extern "C" { +#endif + + typedef double Matrix[3][3]; + + typedef struct + { + + bool compute_color_matrix; + + double matrix_weighting; + + double wb1[3]; + double wb2[3]; + + Matrix cam_to_srgb_1; + Matrix cam_to_srgb_2; + + Matrix color_matrix_1; + Matrix color_matrix_2; + + uint16_t illuminant1; + uint16_t illuminant2; + + } gpr_profile_info; + + void gpr_profile_info_set_defaults(gpr_profile_info* x); + +#ifdef __cplusplus + } +#endif + +#endif // GPR_PROFILE_INFO_H diff --git a/gpr/source/lib/gpr_sdk/public/gpr_tuning_info.h b/gpr/source/lib/gpr_sdk/public/gpr_tuning_info.h new file mode 100755 index 0000000..677d68d --- /dev/null +++ b/gpr/source/lib/gpr_sdk/public/gpr_tuning_info.h @@ -0,0 +1,149 @@ +/*! @file gpr_tuning_info.h + * + * @brief Declaration of gpr_tuning_info object and associated functions + * + * GPR API can be invoked by simply including this header file. + * This file includes all other header files that are needed. + * + * (C) Copyright 2018 GoPro Inc (http://gopro.com/). + * + * Licensed under either: + * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0 + * - MIT license, http://opensource.org/licenses/MIT + * at your option. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GPR_TUNING_INFO_H +#define GPR_TUNING_INFO_H + +#include "gpr_platform.h" + +#ifdef __cplusplus + extern "C" { +#endif + + typedef enum + { + RAW_CHANNEL_RED = 0, + + RAW_CHANNEL_GREEN_EVEN = 1, + + RAW_CHANNEL_GREEN_ODD = 2, + + RAW_CHANNEL_BLUE = 3, + + } GPR_RAW_CHANNEL; + + typedef enum + { + PIXEL_FORMAT_RGGB_12 = 0, // RGGB 12bit pixels packed into 16bits + + PIXEL_FORMAT_RGGB_12P = 1, // RGGB 12bit pixels packed into 12bits + + PIXEL_FORMAT_RGGB_14 = 2, // RGGB 14bit pixels packed into 16bits + + PIXEL_FORMAT_GBRG_12 = 3, // GBRG 12bit pixels packed into 16bits + + PIXEL_FORMAT_GBRG_12P = 4, // GBRG 12bit pixels packed into 12bits + + } GPR_PIXEL_FORMAT; + + typedef enum + { + ORIENTATION_NORMAL = 0, + + ORIENTATION_MIRROR = 4, + + ORIENTATION_DEFAULT = ORIENTATION_MIRROR, + + } GPR_ORIENTATION; + + typedef struct + { + int32_t r_black; + + int32_t g_r_black; + + int32_t g_b_black; + + int32_t b_black; + + } gpr_static_black_level; + + typedef struct + { + uint16_t iso_value; + + uint32_t shutter_time; + + } gpr_auto_exposure_info; + + typedef struct + { + int32_t level_red; + + int32_t level_green_even; + + int32_t level_green_odd; + + int32_t level_blue; + + } gpr_saturation_level; + + typedef struct + { + float_t r_gain; + + float_t g_gain; + + float_t b_gain; + + } gpr_white_balance_gains; + + typedef struct + { + char *buffers[4]; + + uint32_t size; + + } gpr_gain_map; + + typedef struct + { + GPR_ORIENTATION orientation; + + gpr_static_black_level static_black_level; + + gpr_saturation_level dgain_saturation_level; + + gpr_white_balance_gains wb_gains; + + gpr_auto_exposure_info ae_info; + + double noise_scale; + double noise_offset; + + double warp_red_coefficient; + double warp_blue_coefficient; + + gpr_gain_map gain_map; + + GPR_PIXEL_FORMAT pixel_format; + + } gpr_tuning_info; + + int32_t gpr_tuning_info_get_dgain_saturation_level(const gpr_tuning_info* x, GPR_RAW_CHANNEL channel); + + void gpr_tuning_info_set_defaults( gpr_tuning_info* x ); + +#ifdef __cplusplus + } +#endif + +#endif // GPR_TUNING_INFO_H |