diff options
author | luxagraf <sng@luxagraf.net> | 2023-06-15 15:58:59 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-06-15 15:58:59 -0500 |
commit | ab987e10f154f5536bb8fd936ae0966e909fa969 (patch) | |
tree | 9de5076f38b71ececb1bc94f8d9d19170898d603 /gpr/source/lib/common/public |
added all my scriptssynced/master
Diffstat (limited to 'gpr/source/lib/common/public')
-rwxr-xr-x | gpr/source/lib/common/public/gpr_allocator.h | 50 | ||||
-rwxr-xr-x | gpr/source/lib/common/public/gpr_buffer.h | 47 | ||||
-rwxr-xr-x | gpr/source/lib/common/public/gpr_platform.h | 162 | ||||
-rwxr-xr-x | gpr/source/lib/common/public/gpr_rgb_buffer.h | 77 |
4 files changed, 336 insertions, 0 deletions
diff --git a/gpr/source/lib/common/public/gpr_allocator.h b/gpr/source/lib/common/public/gpr_allocator.h new file mode 100755 index 0000000..0f002a0 --- /dev/null +++ b/gpr/source/lib/common/public/gpr_allocator.h @@ -0,0 +1,50 @@ +/*! @file gpr_allocator.h + * + * @brief The API for memory allocation and deallocation functions. + * + * @version 1.0.0 + * + * (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_ALLOCATOR_H +#define GPR_ALLOCATOR_H + +#include "gpr_platform.h" + +#ifdef __cplusplus +extern "C" { +#endif + + extern void* gpr_global_malloc(size_t size); + + extern void gpr_global_free(void *block); + + typedef void* (*gpr_malloc)(size_t size); /* Malloc callback function typedef */ + + typedef void (*gpr_free)(void* p); /* Free callback function typedef */ + + typedef struct + { + gpr_malloc Alloc; // Callback function to allocate memory + + gpr_free Free; // Callback function to free memory + + } gpr_allocator; + +#ifdef __cplusplus +} +#endif + +#endif // GPR_ALLOCATOR_H diff --git a/gpr/source/lib/common/public/gpr_buffer.h b/gpr/source/lib/common/public/gpr_buffer.h new file mode 100755 index 0000000..beefb23 --- /dev/null +++ b/gpr/source/lib/common/public/gpr_buffer.h @@ -0,0 +1,47 @@ +/*! @file gpr_buffer.h + * + * @brief Declaration of gpr_buffer object and functions that work on buffer + * + * @version 1.0.0 + * + * (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_BUFFER_H +#define GPR_BUFFER_H + +#include "gpr_allocator.h" +#include "gpr_platform.h" + +#ifdef __cplusplus + extern "C" { +#endif + + typedef struct + { + void* buffer; /* Address to the memory location that this buffer points to */ + + size_t size; /* Size of the memory block */ + + } gpr_buffer; + + int read_from_file(gpr_buffer* buffer, const char* file_path, gpr_malloc malloc_function, gpr_free free_function); + + int write_to_file(const gpr_buffer* buffer, const char* file_path); + +#ifdef __cplusplus + } +#endif + +#endif // GPR_BUFFER_H diff --git a/gpr/source/lib/common/public/gpr_platform.h b/gpr/source/lib/common/public/gpr_platform.h new file mode 100755 index 0000000..14ffcc5 --- /dev/null +++ b/gpr/source/lib/common/public/gpr_platform.h @@ -0,0 +1,162 @@ +/*! @file gpr_platform.h + * + * @brief Definitions of platform related settings + * + * @version 1.0.0 + * + * (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_PLATFORM_H +#define GPR_PLATFORM_H + +// ================================================================================================= +// Timing output. Define to: +// 0 for applications (disabled all timing code) +// 1 to enable top level timing +// 2 to enable low level timing +// ================================================================================================= + +#ifndef GPR_TIMING + #define GPR_TIMING 1 +#endif + +// ================================================================================================= +// Defines to enable encoder and decoder API in GPR-SDK +// ================================================================================================= + +#ifndef GPR_WRITING + #define GPR_WRITING 1 +#endif + +#ifndef GPR_READING + #define GPR_READING 1 +#endif + +#ifndef GPR_JPEG_AVAILABLE + #define GPR_JPEG_AVAILABLE 1 +#endif + +// ================================================================================================= +// Flags to enable/disable SIMD code +// ================================================================================================= + +// Neon code is implemented for encoder +#ifndef NEON + #define NEON 0 +#endif + +// SSE code is not implemented yet +#ifndef SSE + #define SSE 0 +#endif + +// ================================================================================================= +// Do not change lines below +// ================================================================================================= + +// ================================================================================================= +// Common header files needed by GPR-SDK +// ================================================================================================= +#include <stdlib.h> +#include <stdint.h> + +#ifndef float_t +typedef float float_t; +#endif + +#ifdef _WIN32 + +// Turn off warnings about deprecated functions +#pragma warning(disable: 4996) + +#define INLINE __inline + +#else + +#define INLINE inline + +#endif // _WIN32 + +#define STATIC static + +#define STATIC_INLINE STATIC INLINE + +#define ENABLED(x) (x) + +// ================================================================================================= +// Determine the Platform +// ================================================================================================= + +#ifdef _WIN32 + + #define qWinOS 1 + #define qMacOS 0 + #define qLinux 0 + #define qiPhone 0 + #define qAndroid 0 + +#elif __APPLE__ + + #include "TargetConditionals.h" + + #define qEnableCarbon 0 // Disable Carbon API because it is old and deprecated by Apple + + #if TARGET_OS_IPHONE + + #define qWinOS 0 + #define qMacOS 0 + #define qLinux 0 + #define qiPhone 1 + #define qAndroid 0 + + #else + + #define qWinOS 0 + #define qMacOS 1 + #define qLinux 0 + #define qiPhone 0 + #define qAndroid 0 + + #endif + +#elif __ANDROID__ + + #define qWinOS 0 + #define qMacOS 0 + #define qLinux 0 + #define qiPhone 0 + #define qAndroid 1 + +#elif __linux__ || __unix__ + + #define qWinOS 0 + #define qMacOS 0 + #define qLinux 1 + #define qiPhone 0 + #define qAndroid 0 + +#else + #error "XMP environment error - Unknown compiler" +#endif + +// ================================================================================================= +// GPR version numbering +// ================================================================================================= + +#define GPR_VERSION_MAJOR 1 +#define GPR_VERSION_MINOR 0 +#define GPR_VERSION_REVISION 0 + +#endif // GPR_PLATFORM_H diff --git a/gpr/source/lib/common/public/gpr_rgb_buffer.h b/gpr/source/lib/common/public/gpr_rgb_buffer.h new file mode 100755 index 0000000..6fcbb8d --- /dev/null +++ b/gpr/source/lib/common/public/gpr_rgb_buffer.h @@ -0,0 +1,77 @@ +/*! @file gpr_buffer.h + * + * @brief Declaration of gpr_rgb_buffer object and enums/functions that work on it + * + * @version 1.0.0 + * + * (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_RGB_BUFFER_H +#define GPR_RGB_BUFFER_H + +#include "gpr_allocator.h" +#include "gpr_platform.h" + +#ifdef __cplusplus + extern "C" { +#endif + + typedef enum + { + GPR_RGB_RESOLUTION_SIXTEENTH = 1, + GPR_RGB_RESOLUTION_EIGHTH = 2, + GPR_RGB_RESOLUTION_QUARTER = 3, + GPR_RGB_RESOLUTION_HALF = 4, + GPR_RGB_RESOLUTION_FULL = 5, + + GPR_RGB_RESOLUTION_NONE = 6, + + GPR_RGB_RESOLUTION_DEFAULT = GPR_RGB_RESOLUTION_QUARTER, + + } GPR_RGB_RESOLUTION; + + + typedef struct + { + int r_gain_num; + int r_gain_pow2_den; + + int g_gain_num; + int g_gain_pow2_den; + + int b_gain_num; + int b_gain_pow2_den; + + } gpr_rgb_gain; + + void gpr_rgb_gain_set_defaults(gpr_rgb_gain* x); + + typedef struct + { + void* buffer; /* Address to the memory location that this buffer points to */ + + size_t size; /* Size of the memory block */ + + size_t width; + + size_t height; + + } gpr_rgb_buffer; + +#ifdef __cplusplus + } +#endif + +#endif // GPR_RGB_BUFFER_H |