浏览代码

Introducing the Compression Interface Gem (#9532)

* Introducing the Compression Interface Gem

The Compression Interface Gem exposes the Compression API and Archive API that will be used by the new O3DE Archive System.

Signed-off-by: lumberyard-employee-dm <[email protected]>

* Added implementation of the CompressionFactoryInterface for the Editor module

Separated the Runtime and Editor code into Clients and Tools folders

Signed-off-by: lumberyard-employee-dm <[email protected]>

* Added missing include to identity.h

AZStd::identity call operator requires access to AZStd::forward

Signed-off-by: lumberyard-employee-dm <[email protected]>

* Removing unneeded <platform>_gem.cmake files from the gem's top level Platform directory

Signed-off-by: lumberyard-employee-dm <[email protected]>

* Moved the CompressionResultData/DecompressionResultData implementation to a .inl file

Changed the search algorithm for the CompressionFactoryImpl to use an index vector for searching entries within the m_compressionInterfaces vector.

Signed-off-by: lumberyard-employee-dm <[email protected]>

* Changined the Compression private libraries from OBJECT to STATIC libraries.

Correct Android and iOS PAL trait to indicate that running Editor test are not supported.

Signed-off-by: lumberyard-employee-dm <[email protected]>

* Moved the Arithmetic and Relational operator overloads for enums from TypeSafeIntegral to AzCore/base.h.

Those operator overloads are not behind a macro that is used being used by the TypeSafeIntegral(`AZ_TYPE_SAFE_INTEGRAL`) macro.

The new macros are `AZ_DEFINE_ENUM_ARITHMETIC_OPERATORS` and `AZ_DEFINE_ENUM_RELATIONAL_OPERATORS`

Signed-off-by: lumberyard-employee-dm <[email protected]>
lumberyard-employee-dm 3 年之前
父节点
当前提交
95e270d28b
共有 58 个文件被更改,包括 1591 次插入35 次删除
  1. 2 24
      Code/Framework/AzCore/AzCore/RTTI/TypeSafeIntegral.h
  2. 144 11
      Code/Framework/AzCore/AzCore/base.h
  3. 4 0
      Code/Framework/AzCore/AzCore/std/function/identity.h
  4. 0 0
      Gems/Compression/.gitignore
  5. 15 0
      Gems/Compression/CMakeLists.txt
  6. 206 0
      Gems/Compression/Code/CMakeLists.txt
  7. 38 0
      Gems/Compression/Code/Include/Compression/CompressionBus.h
  8. 95 0
      Gems/Compression/Code/Include/Compression/CompressionInterfaceAPI.h
  9. 30 0
      Gems/Compression/Code/Include/Compression/CompressionInterfaceAPI.inl
  10. 21 0
      Gems/Compression/Code/Include/Compression/CompressionInterfaceStructs.h
  11. 96 0
      Gems/Compression/Code/Include/Compression/DecompressionInterfaceAPI.h
  12. 32 0
      Gems/Compression/Code/Include/Compression/DecompressionInterfaceAPI.inl
  13. 9 0
      Gems/Compression/Code/Platform/Android/PAL_android.cmake
  14. 8 0
      Gems/Compression/Code/Platform/Android/compression_api_files.cmake
  15. 13 0
      Gems/Compression/Code/Platform/Android/compression_private_files.cmake
  16. 13 0
      Gems/Compression/Code/Platform/Android/compression_shared_files.cmake
  17. 9 0
      Gems/Compression/Code/Platform/Linux/PAL_linux.cmake
  18. 8 0
      Gems/Compression/Code/Platform/Linux/compression_api_files.cmake
  19. 8 0
      Gems/Compression/Code/Platform/Linux/compression_editor_api_files.cmake
  20. 13 0
      Gems/Compression/Code/Platform/Linux/compression_private_files.cmake
  21. 13 0
      Gems/Compression/Code/Platform/Linux/compression_shared_files.cmake
  22. 9 0
      Gems/Compression/Code/Platform/Mac/PAL_mac.cmake
  23. 8 0
      Gems/Compression/Code/Platform/Mac/compression_api_files.cmake
  24. 8 0
      Gems/Compression/Code/Platform/Mac/compression_editor_api_files.cmake
  25. 13 0
      Gems/Compression/Code/Platform/Mac/compression_private_files.cmake
  26. 13 0
      Gems/Compression/Code/Platform/Mac/compression_shared_files.cmake
  27. 9 0
      Gems/Compression/Code/Platform/Windows/PAL_windows.cmake
  28. 8 0
      Gems/Compression/Code/Platform/Windows/compression_api_files.cmake
  29. 8 0
      Gems/Compression/Code/Platform/Windows/compression_editor_api_files.cmake
  30. 13 0
      Gems/Compression/Code/Platform/Windows/compression_private_files.cmake
  31. 13 0
      Gems/Compression/Code/Platform/Windows/compression_shared_files.cmake
  32. 9 0
      Gems/Compression/Code/Platform/iOS/PAL_ios.cmake
  33. 8 0
      Gems/Compression/Code/Platform/iOS/compression_api_files.cmake
  34. 13 0
      Gems/Compression/Code/Platform/iOS/compression_private_files.cmake
  35. 13 0
      Gems/Compression/Code/Platform/iOS/compression_shared_files.cmake
  36. 46 0
      Gems/Compression/Code/Source/Clients/CompressionModule.cpp
  37. 84 0
      Gems/Compression/Code/Source/Clients/CompressionSystemComponent.cpp
  38. 48 0
      Gems/Compression/Code/Source/Clients/CompressionSystemComponent.h
  39. 43 0
      Gems/Compression/Code/Source/CompressionModuleInterface.h
  40. 65 0
      Gems/Compression/Code/Source/Tools/CompressionEditorModule.cpp
  41. 59 0
      Gems/Compression/Code/Source/Tools/CompressionEditorSystemComponent.cpp
  42. 37 0
      Gems/Compression/Code/Source/Tools/CompressionEditorSystemComponent.h
  43. 100 0
      Gems/Compression/Code/Source/Tools/CompressionFactoryImpl.cpp
  44. 40 0
      Gems/Compression/Code/Source/Tools/CompressionFactoryImpl.h
  45. 11 0
      Gems/Compression/Code/Tests/Clients/CompressionTest.cpp
  46. 11 0
      Gems/Compression/Code/Tests/Tools/CompressionEditorTest.cpp
  47. 14 0
      Gems/Compression/Code/compression_api_files.cmake
  48. 9 0
      Gems/Compression/Code/compression_editor_api_files.cmake
  49. 12 0
      Gems/Compression/Code/compression_editor_private_files.cmake
  50. 9 0
      Gems/Compression/Code/compression_editor_shared_files.cmake
  51. 9 0
      Gems/Compression/Code/compression_editor_tests_files.cmake
  52. 11 0
      Gems/Compression/Code/compression_private_files.cmake
  53. 9 0
      Gems/Compression/Code/compression_shared_files.cmake
  54. 9 0
      Gems/Compression/Code/compression_tests_files.cmake
  55. 18 0
      Gems/Compression/Registry/assetprocessor_settings.setreg
  56. 21 0
      Gems/Compression/gem.json
  57. 3 0
      Gems/Compression/preview.png
  58. 1 0
      engine.json

+ 2 - 24
Code/Framework/AzCore/AzCore/RTTI/TypeSafeIntegral.h

@@ -28,30 +28,8 @@ namespace AZStd
 #define AZ_TYPE_SAFE_INTEGRAL(TYPE_NAME, BASE_TYPE)                                                                                                 \
     static_assert(AZStd::is_integral<BASE_TYPE>::value, "Underlying type must be an integral");                                                     \
     enum class TYPE_NAME : BASE_TYPE {};                                                                                                            \
-    inline constexpr TYPE_NAME operator+(TYPE_NAME lhs, TYPE_NAME rhs) { return TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs + (BASE_TYPE)rhs) }; }          \
-    inline constexpr TYPE_NAME operator-(TYPE_NAME lhs, TYPE_NAME rhs) { return TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs - (BASE_TYPE)rhs) }; }          \
-    inline constexpr TYPE_NAME operator*(TYPE_NAME lhs, TYPE_NAME rhs) { return TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs * (BASE_TYPE)rhs) }; }          \
-    inline constexpr TYPE_NAME operator/(TYPE_NAME lhs, TYPE_NAME rhs) { return TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs / (BASE_TYPE)rhs) }; }          \
-    inline constexpr TYPE_NAME operator%(TYPE_NAME lhs, TYPE_NAME rhs) { return TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs % (BASE_TYPE)rhs) }; }          \
-    inline constexpr TYPE_NAME operator>>(TYPE_NAME value, int32_t shift) { return TYPE_NAME{ BASE_TYPE((BASE_TYPE)value >> shift) }; }             \
-    inline constexpr TYPE_NAME operator<<(TYPE_NAME value, int32_t shift) { return TYPE_NAME{ BASE_TYPE((BASE_TYPE)value << shift) }; }             \
-    inline constexpr TYPE_NAME& operator+=(TYPE_NAME& lhs, TYPE_NAME rhs) { return lhs = TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs + (BASE_TYPE)rhs) }; } \
-    inline constexpr TYPE_NAME& operator-=(TYPE_NAME& lhs, TYPE_NAME rhs) { return lhs = TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs - (BASE_TYPE)rhs) }; } \
-    inline constexpr TYPE_NAME& operator*=(TYPE_NAME& lhs, TYPE_NAME rhs) { return lhs = TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs * (BASE_TYPE)rhs) }; } \
-    inline constexpr TYPE_NAME& operator/=(TYPE_NAME& lhs, TYPE_NAME rhs) { return lhs = TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs / (BASE_TYPE)rhs) }; } \
-    inline constexpr TYPE_NAME& operator%=(TYPE_NAME& lhs, TYPE_NAME rhs) { return lhs = TYPE_NAME{ BASE_TYPE((BASE_TYPE)lhs % (BASE_TYPE)rhs) }; } \
-    inline constexpr TYPE_NAME& operator>>=(TYPE_NAME& value, int32_t shift) { return value = TYPE_NAME{ BASE_TYPE((BASE_TYPE)value >> shift) }; }  \
-    inline constexpr TYPE_NAME& operator<<=(TYPE_NAME& value, int32_t shift) { return value = TYPE_NAME{ BASE_TYPE((BASE_TYPE)value << shift) }; }  \
-    inline constexpr TYPE_NAME& operator++(TYPE_NAME& value) { return value = TYPE_NAME{ BASE_TYPE((BASE_TYPE)value + 1) }; }                       \
-    inline constexpr TYPE_NAME& operator--(TYPE_NAME& value) { return value = TYPE_NAME{ BASE_TYPE((BASE_TYPE)value - 1) }; }                       \
-    inline constexpr TYPE_NAME operator++(TYPE_NAME& value, int) { const TYPE_NAME result = value; ++value; return result; }                        \
-    inline constexpr TYPE_NAME operator--(TYPE_NAME& value, int) { const TYPE_NAME result = value; --value; return result; }                        \
-    inline constexpr bool operator>(TYPE_NAME lhs, TYPE_NAME rhs) { return (BASE_TYPE)lhs > (BASE_TYPE)rhs; }                                       \
-    inline constexpr bool operator<(TYPE_NAME lhs, TYPE_NAME rhs) { return (BASE_TYPE)lhs < (BASE_TYPE)rhs; }                                       \
-    inline constexpr bool operator>=(TYPE_NAME lhs, TYPE_NAME rhs) { return (BASE_TYPE)lhs >= (BASE_TYPE)rhs; }                                     \
-    inline constexpr bool operator<=(TYPE_NAME lhs, TYPE_NAME rhs) { return (BASE_TYPE)lhs <= (BASE_TYPE)rhs; }                                     \
-    inline constexpr bool operator==(TYPE_NAME lhs, TYPE_NAME rhs) { return (BASE_TYPE)lhs == (BASE_TYPE)rhs; }                                     \
-    inline constexpr bool operator!=(TYPE_NAME lhs, TYPE_NAME rhs) { return (BASE_TYPE)lhs != (BASE_TYPE)rhs; }                                     \
+    AZ_DEFINE_ENUM_ARITHMETIC_OPERATORS(TYPE_NAME)                                                                                                  \
+    AZ_DEFINE_ENUM_RELATIONAL_OPERATORS(TYPE_NAME)                                                                                                  \
     AZ_DEFINE_ENUM_BITWISE_OPERATORS(TYPE_NAME)
 
 //! This implements cvar binding methods for a type safe integral alias.

+ 144 - 11
Code/Framework/AzCore/AzCore/base.h

@@ -260,18 +260,151 @@ namespace AZ
 
 #define AZ_UNUSED(...) AZ_MACRO_SPECIALIZE(AZ_UNUSED_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__))
 
+// Overload bitwise operators(|, &, ^) for enum types
 #define AZ_DEFINE_ENUM_BITWISE_OPERATORS(EnumType) \
-inline constexpr EnumType operator | (EnumType a, EnumType b) \
-    { return EnumType(((AZStd::underlying_type<EnumType>::type)a) | ((AZStd::underlying_type<EnumType>::type)b)); } \
-inline constexpr EnumType& operator |= (EnumType &a, EnumType b) \
+constexpr EnumType operator | (EnumType a, EnumType b) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType(static_cast<UnderlyingType>(a) | static_cast<UnderlyingType>(b)); \
+    } \
+constexpr EnumType& operator |= (EnumType &a, EnumType b) \
     { return a = a | b; } \
-inline constexpr EnumType operator & (EnumType a, EnumType b) \
-    { return EnumType(((AZStd::underlying_type<EnumType>::type)a) & ((AZStd::underlying_type<EnumType>::type)b)); } \
-inline constexpr EnumType& operator &= (EnumType &a, EnumType b) \
+constexpr EnumType operator & (EnumType a, EnumType b) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType(static_cast<UnderlyingType>(a) & static_cast<UnderlyingType>(b)); \
+    } \
+constexpr EnumType& operator &= (EnumType &a, EnumType b) \
     { return a = a & b; } \
-inline constexpr EnumType operator ~ (EnumType a) \
-    { return EnumType(~((AZStd::underlying_type<EnumType>::type)a)); } \
-inline constexpr EnumType operator ^ (EnumType a, EnumType b) \
-    { return EnumType(((AZStd::underlying_type<EnumType>::type)a) ^ ((AZStd::underlying_type<EnumType>::type)b)); } \
-inline constexpr EnumType& operator ^= (EnumType &a, EnumType b) \
+constexpr EnumType operator ~ (EnumType a) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType(~static_cast<UnderlyingType>(a)); \
+    } \
+constexpr EnumType operator ^ (EnumType a, EnumType b) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType(static_cast<UnderlyingType>(a) ^ static_cast<UnderlyingType>(b)); \
+    } \
+constexpr EnumType& operator ^= (EnumType &a, EnumType b) \
     { return a = a ^ b; }
+
+// Overload arithmetic operators(+, -, *, /, %, <<, >>,++, --) for enum types
+#define AZ_DEFINE_ENUM_ARITHMETIC_OPERATORS(EnumType) \
+constexpr EnumType operator+(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) + static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType operator-(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) - static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType operator*(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) * static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType operator/(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) / static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType operator%(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) % static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType operator>>(EnumType value, int32_t shift) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(value) >> shift) }; \
+    } \
+constexpr EnumType operator<<(EnumType value, int32_t shift) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(value) << shift) }; \
+    } \
+constexpr EnumType& operator+=(EnumType& lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return lhs = EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) + static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType& operator-=(EnumType& lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return lhs = EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) - static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType& operator*=(EnumType& lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return lhs = EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) * static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType& operator/=(EnumType& lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return lhs = EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) / static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType& operator%=(EnumType& lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return lhs = EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(lhs) % static_cast<UnderlyingType>(rhs)) }; \
+    } \
+constexpr EnumType& operator>>=(EnumType& value, int32_t shift) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return value = EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(value) >> shift) }; \
+    } \
+constexpr EnumType& operator<<=(EnumType& value, int32_t shift) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return value = EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(value) << shift) }; \
+    } \
+constexpr EnumType& operator++(EnumType& value) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return value = EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(value) + 1) }; \
+    } \
+constexpr EnumType& operator--(EnumType& value) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return value = EnumType{ static_cast<UnderlyingType>(static_cast<UnderlyingType>(value) - 1) }; \
+    } \
+constexpr EnumType operator++(EnumType& value, int) \
+    { const EnumType result = value; ++value; return result; } \
+constexpr EnumType operator--(EnumType& value, int) \
+    { const EnumType result = value; --value; return result; }
+
+// Overload relational operators(==, !=, <, >, <=, >=) for enum types
+#define AZ_DEFINE_ENUM_RELATIONAL_OPERATORS(EnumType) \
+constexpr bool operator>(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return static_cast<UnderlyingType>(lhs) > static_cast<UnderlyingType>(rhs); \
+    } \
+constexpr bool operator<(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return static_cast<UnderlyingType>(lhs) < static_cast<UnderlyingType>(rhs); \
+    } \
+constexpr bool operator>=(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return static_cast<UnderlyingType>(lhs) >= static_cast<UnderlyingType>(rhs); \
+    } \
+constexpr bool operator<=(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return static_cast<UnderlyingType>(lhs) <= static_cast<UnderlyingType>(rhs); \
+    } \
+constexpr bool operator==(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return static_cast<UnderlyingType>(lhs) == static_cast<UnderlyingType>(rhs); \
+    } \
+constexpr bool operator!=(EnumType lhs, EnumType rhs) \
+    { \
+        using UnderlyingType = AZStd::underlying_type_t<EnumType>; \
+        return static_cast<UnderlyingType>(lhs) != static_cast<UnderlyingType>(rhs); \
+    }

+ 4 - 0
Code/Framework/AzCore/AzCore/std/function/identity.h

@@ -7,9 +7,13 @@
  */
 #pragma once
 
+#include <utility>
 
 namespace AZStd
 {
+    // Bring std::forward into the AZStd namespace
+    using std::forward;
+
     /// Implements the C++20 std::identity type trait
     /// Note: The member type is_transparent indicates to the caller that this function object is a transparent function object:
     /// it accepts arguments of arbitrary types and uses perfect forwarding, which avoids unnecessary copying and conversion

+ 0 - 0
Gems/Compression/.gitignore


+ 15 - 0
Gems/Compression/CMakeLists.txt

@@ -0,0 +1,15 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(gem_path ${CMAKE_CURRENT_LIST_DIR})
+set(gem_json ${gem_path}/gem.json)
+o3de_restricted_path(${gem_json} gem_restricted_path gem_parent_relative_path)
+
+o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
+
+ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
+
+add_subdirectory(Code)

+ 206 - 0
Gems/Compression/Code/CMakeLists.txt

@@ -0,0 +1,206 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
+# Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
+# Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
+#       in which case it will see if that platform is present here or in the restricted folder.
+#       i.e. It could here in our gem : Gems/Compression/Code/Platform/<platorm_name>  or
+#            <restricted_folder>/<platform_name>/Gems/Compression/Code
+o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
+
+# Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
+# traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
+# is supported by this platform.
+include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
+
+# The Compression.API target declares the common interface that users of this gem should depend on in their targets
+ly_add_target(
+    NAME Compression.API INTERFACE
+    NAMESPACE Gem
+    FILES_CMAKE
+        compression_api_files.cmake
+        ${pal_dir}/compression_api_files.cmake
+    INCLUDE_DIRECTORIES
+        INTERFACE
+            Include
+    BUILD_DEPENDENCIES
+        INTERFACE
+           AZ::AzCore
+)
+
+# Add the Compression.Private.Object target
+# Note: We include the common files and the platform specific files which are set in
+# 1.compression_private_files.cmake
+# 2.${pal_dir}/compression_private_files.cmake
+ly_add_target(
+    NAME Compression.Private.Object STATIC
+    NAMESPACE Gem
+    FILES_CMAKE
+        compression_private_files.cmake
+        ${pal_dir}/compression_private_files.cmake
+    INCLUDE_DIRECTORIES
+        PRIVATE
+            Include
+            Source
+    BUILD_DEPENDENCIES
+        PUBLIC
+            AZ::AzCore
+            AZ::AzFramework
+)
+
+# Here add Compression target, it depends on the Private Object library and Public API interface
+ly_add_target(
+    NAME Compression ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
+    NAMESPACE Gem
+    FILES_CMAKE
+        compression_shared_files.cmake
+        ${pal_dir}/compression_shared_files.cmake
+    INCLUDE_DIRECTORIES
+        PUBLIC
+            Include
+        PRIVATE
+            Source
+    BUILD_DEPENDENCIES
+        PUBLIC
+            Gem::Compression.API
+        PRIVATE
+            Gem::Compression.Private.Object
+)
+
+# By default, we will specify that the above target Compression would be used by
+# Client and Server type targets when this gem is enabled.  If you don't want it
+# active in Clients or Servers by default, delete one of both of the following lines:
+ly_create_alias(NAME Compression.Clients NAMESPACE Gem TARGETS Gem::Compression)
+ly_create_alias(NAME Compression.Servers NAMESPACE Gem TARGETS Gem::Compression)
+
+# For the Client and Server variants of Compression Gem, an alias to the Compression.API target will be made
+ly_create_alias(NAME Compression.Clients.API NAMESPACE Gem TARGETS Gem::Compression.API)
+ly_create_alias(NAME Compression.Servers.API NAMESPACE Gem TARGETS Gem::Compression.API)
+
+# If we are on a host platform, we want to add the host tools targets like the Compression.Editor MODULE target
+if(PAL_TRAIT_BUILD_HOST_TOOLS)
+    # The Compression.Editor.API target can be used by other gems that want to interact with the Compression.Editor module
+    ly_add_target(
+        NAME Compression.Editor.API INTERFACE
+        NAMESPACE Gem
+        FILES_CMAKE
+            compression_editor_api_files.cmake
+            ${pal_dir}/compression_editor_api_files.cmake
+        INCLUDE_DIRECTORIES
+            INTERFACE
+                Include
+        BUILD_DEPENDENCIES
+            INTERFACE
+                AZ::AzToolsFramework
+    )
+
+    # The Compression.Editor.Private.Object target is an internal target
+    # which is only to be used by this Gem's CMakeLists.txt and any Subdirectories
+    # Other Gems should not use this target
+    ly_add_target(
+        NAME Compression.Editor.Private.Object STATIC
+        NAMESPACE Gem
+        FILES_CMAKE
+            compression_editor_private_files.cmake
+        INCLUDE_DIRECTORIES
+            PRIVATE
+                Include
+                Source
+        BUILD_DEPENDENCIES
+            PUBLIC
+                AZ::AzToolsFramework
+                $<TARGET_OBJECTS:Gem::Compression.Private.Object>
+    )
+
+    ly_add_target(
+        NAME Compression.Editor GEM_MODULE
+        NAMESPACE Gem
+        AUTOMOC
+        FILES_CMAKE
+            compression_editor_shared_files.cmake
+        INCLUDE_DIRECTORIES
+            PRIVATE
+                Source
+            PUBLIC
+                Include
+        BUILD_DEPENDENCIES
+            PUBLIC
+                Gem::Compression.Editor.API
+            PRIVATE
+                Gem::Compression.Editor.Private.Object
+    )
+
+    # By default, we will specify that the above target Compression would be used by
+    # Tool and Builder type targets when this gem is enabled.  If you don't want it
+    # active in Tools or Builders by default, delete one of both of the following lines:
+    ly_create_alias(NAME Compression.Tools    NAMESPACE Gem TARGETS Gem::Compression.Editor)
+    ly_create_alias(NAME Compression.Builders NAMESPACE Gem TARGETS Gem::Compression.Editor)
+
+    # For the Tools and Builders variants of Compression Gem, an alias to the Compression.Editor API target will be made
+    ly_create_alias(NAME Compression.Tools.API NAMESPACE Gem TARGETS Gem::Compression.Editor.API)
+    ly_create_alias(NAME Compression.Builders.API NAMESPACE Gem TARGETS Gem::Compression.Editor.API)
+
+endif()
+
+################################################################################
+# Tests
+################################################################################
+# See if globally, tests are supported
+if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
+    # We globally support tests, see if we support tests on this platform for Compression.Tests
+    if(PAL_TRAIT_COMPRESSION_TEST_SUPPORTED)
+        # We support Compression.Tests on this platform, add dependency on the Private Object target
+        ly_add_target(
+            NAME Compression.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
+            NAMESPACE Gem
+            FILES_CMAKE
+                compression_tests_files.cmake
+            INCLUDE_DIRECTORIES
+                PRIVATE
+                    Tests
+                    Source
+            BUILD_DEPENDENCIES
+                PRIVATE
+                    AZ::AzTest
+                    AZ::AzFramework
+                    Gem::Compression.Private.Object
+        )
+
+        # Add Compression.Tests to googletest
+        ly_add_googletest(
+            NAME Gem::Compression.Tests
+        )
+    endif()
+
+    # If we are a host platform we want to add tools test like editor tests here
+    if(PAL_TRAIT_BUILD_HOST_TOOLS)
+        # We are a host platform, see if Editor tests are supported on this platform
+        if(PAL_TRAIT_COMPRESSION_EDITOR_TEST_SUPPORTED)
+            # We support Compression.Editor.Tests on this platform, add Compression.Editor.Tests target which depends on
+            # private Compression.Editor.Private.Object target
+            ly_add_target(
+                NAME Compression.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
+                NAMESPACE Gem
+                FILES_CMAKE
+                    compression_editor_tests_files.cmake
+                INCLUDE_DIRECTORIES
+                    PRIVATE
+                        Tests
+                        Source
+                BUILD_DEPENDENCIES
+                    PRIVATE
+                        AZ::AzTest
+                        Gem::Compression.Private.Object
+            )
+
+            # Add Compression.Editor.Tests to googletest
+            ly_add_googletest(
+                NAME Gem::Compression.Editor.Tests
+            )
+        endif()
+    endif()
+endif()

+ 38 - 0
Gems/Compression/Code/Include/Compression/CompressionBus.h

@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <AzCore/EBus/EBus.h>
+#include <AzCore/Interface/Interface.h>
+
+namespace Compression
+{
+    class CompressionRequests
+    {
+    public:
+        AZ_RTTI(CompressionRequests, "{40076ED8-6AC5-498B-AF61-C5CD7136750E}");
+        virtual ~CompressionRequests() = default;
+        // Put your public methods here
+    };
+    
+    class CompressionBusTraits
+        : public AZ::EBusTraits
+    {
+    public:
+        //////////////////////////////////////////////////////////////////////////
+        // EBusTraits overrides
+        static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
+        static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
+        //////////////////////////////////////////////////////////////////////////
+    };
+
+    using CompressionRequestBus = AZ::EBus<CompressionRequests, CompressionBusTraits>;
+    using CompressionInterface = AZ::Interface<CompressionRequests>;
+
+} // namespace Compression

+ 95 - 0
Gems/Compression/Code/Include/Compression/CompressionInterfaceAPI.h

@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <AzCore/Interface/Interface.h>
+#include <AzCore/RTTI/RTTI.h>
+#include <AzCore/std/containers/span.h>
+#include <AzCore/std/smart_ptr/unique_ptr.h>
+#include <Compression/CompressionInterfaceStructs.h>
+
+namespace Compression
+{
+    enum class CompressionResult : AZ::u8
+    {
+        PendingStart,
+        Started,
+        Complete,
+        Failed,
+    };
+
+    struct CompressionResultData
+    {
+        //! Returns a boolean true if compression has completed
+        explicit constexpr operator bool() const;
+
+        //! Retrieves the compressed byte size
+        AZ::u64 GetCompressedByteCount() const;
+
+        //! Retrieves the memory address of the compressed data
+        AZStd::byte* GetCompressedByteData() const;
+
+        //! Will be set to the memory address of the compressed buffer
+        //! supplied to the compression interface CompressBlock command
+        //! The size of the span will be set to actual uncompressed size
+        AZStd::span<AZStd::byte> m_compressedBuffer;
+
+        //! Stores result code of whether the operation succeeded
+        CompressionResult m_result{ CompressionResult::PendingStart };
+    };
+
+    struct ICompressionInterface
+    {
+        virtual ~ICompressionInterface() = default;
+
+        //! Retrieves the 32-bit compression algorithm ID associated with this interface
+        virtual CompressionAlgorithmId GetCompressionAlgorithmId() const = 0;
+        //! Compresses the uncompressed data into the compressed buffer
+        //! @return a CompressionResultData instance to indicate if compression operation has succeeded
+        [[nodiscard]] virtual CompressionResultData CompressBlock(
+            AZStd::span<AZStd::byte> compressedBuffer, const AZStd::span<const AZStd::byte>& uncompressedData) = 0;
+    };
+
+    class CompressionFactoryInterface
+    {
+    public:
+        AZ_RTTI(CompressionFactoryInterface, "{92251FE8-9D19-4A23-9A2B-F91D99D9491B}");
+        virtual ~CompressionFactoryInterface() = default;
+
+        //! Returns a span containing all registered Compression Interfaces
+        //! @return view of registered Compression Interfaces.
+        virtual AZStd::span<ICompressionInterface* const> GetCompressionInterfaces() const = 0;
+
+        //! Registers a compression interface with the compression factory.
+        //! If a compression interface with a CompressionAlgorithmId is registered that
+        //! matches the input compression interface, then registration does not occur
+        //! and the unique_ptr refererence is unmodified and can be re-used by the caller
+        //!
+        //! @param compressionInterface unique pointer to compression interface to register
+        //! @return true if the ICompressionInterface was successfully registered, otherwise false
+        virtual bool RegisterCompressionInterface(AZStd::unique_ptr<ICompressionInterface>&&) = 0;
+
+        //! Unregisters the Compression Interface with the specified Id if it is registered with the factory
+        //!
+        //! @param compressionAlgorithmId unique Id that identifies the Compression Interface
+        //! @return true if the ICompressionInterface was unregistered, otherwise false
+        virtual bool UnregisterCompressionInterface(CompressionAlgorithmId) = 0;
+
+        //! Queries the Compression Interface with the compression algorithmd Id
+        //! @param compressionAlgorithmId unique Id of Compression Interface to query
+        //! @return pointer to the Compression Interface or nullptr if not found
+        virtual ICompressionInterface* FindCompressionInterface(CompressionAlgorithmId) const = 0;
+    };
+
+    using CompressionFactory = AZ::Interface<CompressionFactoryInterface>;
+
+} // namespace Compression
+
+// Provides implementations of the CompressionResultData struct
+#include "CompressionInterfaceAPI.inl"

+ 30 - 0
Gems/Compression/Code/Include/Compression/CompressionInterfaceAPI.inl

@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+namespace Compression
+{
+    //! Returns a boolean true if decompression has completed
+    constexpr inline CompressionResultData::operator bool() const
+    {
+        return m_result == CompressionResult::Complete;
+    }
+
+    //! Retrieves the compressed data size
+    inline AZ::u64 CompressionResultData::GetCompressedByteCount() const
+    {
+        return m_compressedBuffer.size();
+    }
+
+    //! Retrieves the memory address of the compressed data
+    inline AZStd::byte* CompressionResultData::GetCompressedByteData() const
+    {
+        return m_compressedBuffer.data();
+    }
+} // namespace Compression

+ 21 - 0
Gems/Compression/Code/Include/Compression/CompressionInterfaceStructs.h

@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <AzCore/base.h>
+#include <AzCore/std/limits.h>
+
+namespace Compression
+{
+    // Structure represent a compression algorithmId
+    enum class CompressionAlgorithmId : AZ::u32 {};
+    constexpr CompressionAlgorithmId Uncompressed{};
+    constexpr CompressionAlgorithmId Invalid{ AZStd::numeric_limits<AZ::u32>::max() };
+
+} // namespace Compression

+ 96 - 0
Gems/Compression/Code/Include/Compression/DecompressionInterfaceAPI.h

@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <AzCore/Interface/Interface.h>
+#include <AzCore/RTTI/RTTI.h>
+#include <AzCore/std/containers/span.h>
+#include <AzCore/std/smart_ptr/unique_ptr.h>
+#include <Compression/CompressionInterfaceStructs.h>
+
+namespace Compression
+{
+    enum class DecompressionResult : AZ::u8
+    {
+        PendingStart,
+        Started,
+        Complete,
+        Failed,
+    };
+
+    struct DecompressionResultData
+    {
+        //! Returns a boolean true if decompression has succeeded
+        explicit constexpr operator bool() const;
+
+        //! Retrieves the uncompressed size of the decompression data
+        //! from the span
+        AZ::u64 GetUncompressedByteCount() const;
+
+        //! Retrieves the memory address where the uncompressed data
+        //! is stored
+        AZStd::byte* GetUncompressedByteData() const;
+
+        //! Will be set to the memory address of the uncompressed buffer
+        //! The size of the span will be set to actual uncompressed size
+        AZStd::span<AZStd::byte> m_uncompressedBuffer;
+
+        //! Stores result code of whether the operation succeeded
+        DecompressionResult m_result{ DecompressionResult::PendingStart };
+    };
+
+    struct IDecompressionInterface
+    {
+        virtual ~IDecompressionInterface() = default;
+
+        //! Retrieves the 32-bit compression algorithm ID associated with this interface
+        virtual CompressionAlgorithmId GetCompressionAlgorithmId() const = 0;
+        //! Decompresses the input compressed data into the uncompressed buffer
+        //! Both parameters are specified as spans which encapsulates the contiguous buffer and it's size.
+        [[nodiscard]] virtual DecompressionResultData DecompressBlock(
+            AZStd::span<AZStd::byte> uncompressedBuffer, const AZStd::span<const AZStd::byte>& compressedData) = 0;
+    };
+
+    class DecompressionFactoryInterface
+    {
+    public:
+        AZ_RTTI(DecompressionFactoryInterface, "{DB1ACA55-B36F-469B-9704-EC486D9FC810}");
+        virtual ~DecompressionFactoryInterface() = default;
+
+        //! Returns a span containing all registered Decompression Interfaces
+        //! @return view of registered Decompression Interfaces.
+        virtual AZStd::span<IDecompressionInterface* const> GetDecompressionInterfaces() const= 0;
+
+        //! Registers a decompression interface with the decompression factory.
+        //! If a decompression interface with a CompressionAlgorithmId is registered that
+        //! matches the input decompression interface, then registration does not occur
+        //! and the unique_ptr refererence is unmodified and can be re-used by the caller
+        //!
+        //! @param decompressionInterface unique pointer to decompression interface to register
+        //! @return true if the IDecompressionInterface was successfully registered, otherwise false
+        virtual bool RegisterDecompressionInterface(AZStd::unique_ptr<IDecompressionInterface>&&) = 0;
+
+        //! Unregisters the Decompression Interface with the specified Id if it is registered with the factory
+        //!
+        //! @param compressionAlgorithmId unique Id that identifies the Decompression Interface
+        //! @return true if the IDecompressionInterface was unregistered, otherwise false
+        virtual bool UnregisterCompressionInterface(CompressionAlgorithmId) = 0;
+
+        //! Queries the Decompression Interface with the compression algorithmd Id
+        //! @param compressionAlgorithmId unique Id of Decompression Interface to query
+        //! @return pointer to the DeCompression Interface or nullptr if not found
+        virtual IDecompressionInterface* FindDecompressionInterface(CompressionAlgorithmId) const = 0;
+    };
+
+    using DecompressionFactory = AZ::Interface<DecompressionFactoryInterface>;
+
+} // namespace Compression
+
+// Provides implemenation of the DecompressionResultData struct
+#include "DecompressionInterfaceAPI.inl"

+ 32 - 0
Gems/Compression/Code/Include/Compression/DecompressionInterfaceAPI.inl

@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+
+namespace Compression
+{
+    //! Returns a boolean true if decompression has succeeded
+    constexpr inline DecompressionResultData::operator bool() const
+    {
+        return m_result == DecompressionResult::Complete;
+    }
+
+    //! Retrieves the uncompressed size of the decompressed data
+    inline AZ::u64 DecompressionResultData::GetUncompressedByteCount() const
+    {
+        return m_uncompressedBuffer.size();
+    }
+
+    //! Retrieves the memory address where the uncompressed data
+    //! is stored
+    inline AZStd::byte* DecompressionResultData::GetUncompressedByteData() const
+    {
+        return m_uncompressedBuffer.data();
+    }
+} // namespace Compression

+ 9 - 0
Gems/Compression/Code/Platform/Android/PAL_android.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(PAL_TRAIT_COMPRESSION_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_EDITOR_TEST_SUPPORTED FALSE)

+ 8 - 0
Gems/Compression/Code/Platform/Android/compression_api_files.cmake

@@ -0,0 +1,8 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/Android/compression_private_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for Android
+# i.e. ../Source/Android/CompressionAndroid.cpp
+#      ../Source/Android/CompressionAndroid.h
+#      ../Include/Android/CompressionAndroid.h
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/Android/compression_shared_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for Android
+# i.e. ../Source/Android/CompressionAndroid.cpp
+#      ../Source/Android/CompressionAndroid.h
+#      ../Include/Android/CompressionAndroid.h
+
+set(FILES
+)

+ 9 - 0
Gems/Compression/Code/Platform/Linux/PAL_linux.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(PAL_TRAIT_COMPRESSION_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_EDITOR_TEST_SUPPORTED TRUE)

+ 8 - 0
Gems/Compression/Code/Platform/Linux/compression_api_files.cmake

@@ -0,0 +1,8 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+)

+ 8 - 0
Gems/Compression/Code/Platform/Linux/compression_editor_api_files.cmake

@@ -0,0 +1,8 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/Linux/compression_private_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for Linux
+# i.e. ../Source/Linux/CompressionLinux.cpp
+#      ../Source/Linux/CompressionLinux.h
+#      ../Include/Linux/CompressionLinux.h
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/Linux/compression_shared_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for Linux
+# i.e. ../Source/Linux/CompressionLinux.cpp
+#      ../Source/Linux/CompressionLinux.h
+#      ../Include/Linux/CompressionLinux.h
+
+set(FILES
+)

+ 9 - 0
Gems/Compression/Code/Platform/Mac/PAL_mac.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(PAL_TRAIT_COMPRESSION_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_EDITOR_TEST_SUPPORTED TRUE)

+ 8 - 0
Gems/Compression/Code/Platform/Mac/compression_api_files.cmake

@@ -0,0 +1,8 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+)

+ 8 - 0
Gems/Compression/Code/Platform/Mac/compression_editor_api_files.cmake

@@ -0,0 +1,8 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/Mac/compression_private_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for Mac
+# i.e. ../Source/Mac/CompressionMac.cpp
+#      ../Source/Mac/CompressionMac.h
+#      ../Include/Mac/CompressionMac.h
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/Mac/compression_shared_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for Mac
+# i.e. ../Source/Mac/CompressionMac.cpp
+#      ../Source/Mac/CompressionMac.h
+#      ../Include/Mac/CompressionMac.h
+
+set(FILES
+)

+ 9 - 0
Gems/Compression/Code/Platform/Windows/PAL_windows.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(PAL_TRAIT_COMPRESSION_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_EDITOR_TEST_SUPPORTED TRUE)

+ 8 - 0
Gems/Compression/Code/Platform/Windows/compression_api_files.cmake

@@ -0,0 +1,8 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+)

+ 8 - 0
Gems/Compression/Code/Platform/Windows/compression_editor_api_files.cmake

@@ -0,0 +1,8 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/Windows/compression_private_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for Windows
+# i.e. ../Source/Windows/CompressionWindows.cpp
+#      ../Source/Windows/CompressionWindows.h
+#      ../Include/Windows/CompressionWindows.h
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/Windows/compression_shared_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for Windows
+# i.e. ../Source/Windows/CompressionWindows.cpp
+#      ../Source/Windows/CompressionWindows.h
+#      ../Include/Windows/CompressionWindows.h
+
+set(FILES
+)

+ 9 - 0
Gems/Compression/Code/Platform/iOS/PAL_ios.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(PAL_TRAIT_COMPRESSION_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_COMPRESSION_EDITOR_TEST_SUPPORTED FALSE)

+ 8 - 0
Gems/Compression/Code/Platform/iOS/compression_api_files.cmake

@@ -0,0 +1,8 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/iOS/compression_private_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for iOS
+# i.e. ../Source/iOS/CompressioniOS.cpp
+#      ../Source/iOS/CompressioniOS.h
+#      ../Include/iOS/CompressioniOS.h
+
+set(FILES
+)

+ 13 - 0
Gems/Compression/Code/Platform/iOS/compression_shared_files.cmake

@@ -0,0 +1,13 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Platform specific files for iOS
+# i.e. ../Source/iOS/CompressioniOS.cpp
+#      ../Source/iOS/CompressioniOS.h
+#      ../Include/iOS/CompressioniOS.h
+
+set(FILES
+)

+ 46 - 0
Gems/Compression/Code/Source/Clients/CompressionModule.cpp

@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+
+#include <CompressionModuleInterface.h>
+#include "CompressionSystemComponent.h"
+#include <Compression/DecompressionInterfaceAPI.h>
+
+namespace Compression
+{
+    class CompressionModule
+        : public CompressionModuleInterface
+    {
+    public:
+        AZ_RTTI(CompressionModule, "{6D256D91-6F1F-4132-B78E-6C24BA9D688C}", CompressionModuleInterface);
+        AZ_CLASS_ALLOCATOR(CompressionModule, AZ::SystemAllocator, 0);
+
+         CompressionModule()
+        {
+            // Create and Register the Decompression Factory
+            if (DecompressionFactory::Get() == nullptr)
+            {
+                DecompressionFactory::Register(m_decompressionFactoryInterface.get());
+            }
+        }
+
+        ~CompressionModule()
+        {
+            if (DecompressionFactory::Get() == m_decompressionFactoryInterface.get())
+            {
+                DecompressionFactory::Unregister(m_decompressionFactoryInterface.get());
+            }
+        }
+    private:
+        // DecompressionFactory interface used to register Decompression interfaces
+        // Available in ALL applications to allow decompression to occur
+        AZStd::unique_ptr<DecompressionFactoryInterface> m_decompressionFactoryInterface;
+    };
+}// namespace Compression
+
+AZ_DECLARE_MODULE_CLASS(Gem_Compression, Compression::CompressionModule)

+ 84 - 0
Gems/Compression/Code/Source/Clients/CompressionSystemComponent.cpp

@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include "CompressionSystemComponent.h"
+
+#include <AzCore/Serialization/SerializeContext.h>
+#include <AzCore/Serialization/EditContext.h>
+#include <AzCore/Serialization/EditContextConstants.inl>
+
+namespace Compression
+{
+    void CompressionSystemComponent::Reflect(AZ::ReflectContext* context)
+    {
+        if (auto serialize = azrtti_cast<AZ::SerializeContext*>(context))
+        {
+            serialize->Class<CompressionSystemComponent, AZ::Component>()
+                ->Version(0)
+                ;
+
+            if (AZ::EditContext* ec = serialize->GetEditContext())
+            {
+                ec->Class<CompressionSystemComponent>("Compression", "[Description of functionality provided by this System Component]")
+                    ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
+                        ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
+                        ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
+                    ;
+            }
+        }
+    }
+
+    void CompressionSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
+    {
+        provided.push_back(AZ_CRC_CE("CompressionService"));
+    }
+
+    void CompressionSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
+    {
+        incompatible.push_back(AZ_CRC_CE("CompressionService"));
+    }
+
+    void CompressionSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
+    {
+    }
+
+    void CompressionSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
+    {
+    }
+
+    CompressionSystemComponent::CompressionSystemComponent()
+    {
+        if (CompressionInterface::Get() == nullptr)
+        {
+            CompressionInterface::Register(this);
+        }
+    }
+
+    CompressionSystemComponent::~CompressionSystemComponent()
+    {
+        if (CompressionInterface::Get() == this)
+        {
+            CompressionInterface::Unregister(this);
+        }
+    }
+
+    void CompressionSystemComponent::Init()
+    {
+    }
+
+    void CompressionSystemComponent::Activate()
+    {
+        CompressionRequestBus::Handler::BusConnect();
+    }
+
+    void CompressionSystemComponent::Deactivate()
+    {
+        CompressionRequestBus::Handler::BusDisconnect();
+    }
+
+} // namespace Compression

+ 48 - 0
Gems/Compression/Code/Source/Clients/CompressionSystemComponent.h

@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <AzCore/Component/Component.h>
+#include <AzCore/Component/TickBus.h>
+#include <Compression/CompressionBus.h>
+
+namespace Compression
+{
+    class CompressionSystemComponent
+        : public AZ::Component
+        , protected CompressionRequestBus::Handler
+    {
+    public:
+        AZ_COMPONENT(CompressionSystemComponent, "{7E220BA3-B665-4225-9023-F0520E4B436E}");
+
+        static void Reflect(AZ::ReflectContext* context);
+
+        static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
+        static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
+        static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
+        static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
+
+        CompressionSystemComponent();
+        ~CompressionSystemComponent();
+
+    protected:
+        ////////////////////////////////////////////////////////////////////////
+        // CompressionRequestBus interface implementation
+
+        ////////////////////////////////////////////////////////////////////////
+
+        ////////////////////////////////////////////////////////////////////////
+        // AZ::Component interface implementation
+        void Init() override;
+        void Activate() override;
+        void Deactivate() override;
+        ////////////////////////////////////////////////////////////////////////
+    };
+
+} // namespace Compression

+ 43 - 0
Gems/Compression/Code/Source/CompressionModuleInterface.h

@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <AzCore/Memory/SystemAllocator.h>
+#include <AzCore/Module/Module.h>
+#include <Clients/CompressionSystemComponent.h>
+
+namespace Compression
+{
+    class CompressionModuleInterface
+        : public AZ::Module
+    {
+    public:
+        AZ_RTTI(CompressionModuleInterface, "{89158BD2-EAC1-4CBF-9F05-9237034FF28E}", AZ::Module);
+        AZ_CLASS_ALLOCATOR(CompressionModuleInterface, AZ::SystemAllocator, 0);
+
+        CompressionModuleInterface()
+        {
+            // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
+            // Add ALL components descriptors associated with this gem to m_descriptors.
+            // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
+            // This happens through the [MyComponent]::Reflect() function.
+            m_descriptors.insert(m_descriptors.end(), {
+                CompressionSystemComponent::CreateDescriptor(),
+                });
+        }
+
+        /**
+         * Add required SystemComponents to the SystemEntity.
+         */
+        AZ::ComponentTypeList GetRequiredSystemComponents() const override
+        {
+            return AZ::ComponentTypeList{
+                azrtti_typeid<CompressionSystemComponent>(),
+            };
+        }
+    };
+}// namespace Compression

+ 65 - 0
Gems/Compression/Code/Source/Tools/CompressionEditorModule.cpp

@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include "CompressionFactoryImpl.h"
+#include <CompressionModuleInterface.h>
+#include "CompressionEditorSystemComponent.h"
+
+namespace Compression
+{
+    class CompressionEditorModule
+        : public CompressionModuleInterface
+    {
+    public:
+        AZ_RTTI(CompressionEditorModule, "{6D256D91-6F1F-4132-B78E-6C24BA9D688C}", CompressionModuleInterface);
+        AZ_CLASS_ALLOCATOR(CompressionEditorModule, AZ::SystemAllocator, 0);
+
+        CompressionEditorModule()
+        {
+            // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
+            // Add ALL components descriptors associated with this gem to m_descriptors.
+            // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
+            // This happens through the [MyComponent]::Reflect() function.
+            m_descriptors.insert(m_descriptors.end(), {
+                CompressionEditorSystemComponent::CreateDescriptor(),
+            });
+
+            m_compressionFactoryInterface = AZStd::make_unique<CompressionFactoryImpl>();
+            if (CompressionFactory::Get() == nullptr)
+            {
+                CompressionFactory::Register(m_compressionFactoryInterface.get());
+            }
+        }
+
+        ~CompressionEditorModule()
+        {
+            if (CompressionFactory::Get() == m_compressionFactoryInterface.get())
+            {
+                CompressionFactory::Unregister(m_compressionFactoryInterface.get());
+            }
+        }
+
+        /**
+         * Add required SystemComponents to the SystemEntity.
+         * Non-SystemComponents should not be added here
+         */
+        AZ::ComponentTypeList GetRequiredSystemComponents() const override
+        {
+            return AZ::ComponentTypeList {
+                azrtti_typeid<CompressionEditorSystemComponent>(),
+            };
+        }
+
+    private:
+        // CompressionFactory interface used to register Compression interfaces
+        // Available in tooling applications to allow compression algorithms to run
+        AZStd::unique_ptr<CompressionFactoryInterface> m_compressionFactoryInterface;
+    };
+}// namespace Compression
+
+AZ_DECLARE_MODULE_CLASS(Gem_Compression, Compression::CompressionEditorModule)

+ 59 - 0
Gems/Compression/Code/Source/Tools/CompressionEditorSystemComponent.cpp

@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <AzCore/Serialization/SerializeContext.h>
+#include "CompressionEditorSystemComponent.h"
+
+namespace Compression
+{
+    void CompressionEditorSystemComponent::Reflect(AZ::ReflectContext* context)
+    {
+        if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
+        {
+            serializeContext->Class<CompressionEditorSystemComponent, CompressionSystemComponent>()
+                ->Version(0);
+        }
+    }
+
+    CompressionEditorSystemComponent::CompressionEditorSystemComponent() = default;
+
+    CompressionEditorSystemComponent::~CompressionEditorSystemComponent() = default;
+
+    void CompressionEditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
+    {
+        BaseSystemComponent::GetProvidedServices(provided);
+        provided.push_back(AZ_CRC_CE("CompressionEditorService"));
+    }
+
+    void CompressionEditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
+    {
+        BaseSystemComponent::GetIncompatibleServices(incompatible);
+        incompatible.push_back(AZ_CRC_CE("CompressionEditorService"));
+    }
+
+    void CompressionEditorSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
+    {
+        BaseSystemComponent::GetRequiredServices(required);
+    }
+
+    void CompressionEditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
+    {
+        BaseSystemComponent::GetDependentServices(dependent);
+    }
+
+    void CompressionEditorSystemComponent::Activate()
+    {
+        CompressionSystemComponent::Activate();
+    }
+
+    void CompressionEditorSystemComponent::Deactivate()
+    {
+        CompressionSystemComponent::Deactivate();
+    }
+
+} // namespace Compression

+ 37 - 0
Gems/Compression/Code/Source/Tools/CompressionEditorSystemComponent.h

@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Clients/CompressionSystemComponent.h>
+
+namespace Compression
+{
+    /// System component for Compression editor
+    class CompressionEditorSystemComponent
+        : public CompressionSystemComponent
+    {
+        using BaseSystemComponent = CompressionSystemComponent;
+    public:
+        AZ_COMPONENT(CompressionEditorSystemComponent, "{82C6760D-5C0C-435F-BC1B-F7B9632DE7C5}", BaseSystemComponent);
+        static void Reflect(AZ::ReflectContext* context);
+
+        CompressionEditorSystemComponent();
+        ~CompressionEditorSystemComponent();
+
+    private:
+        static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
+        static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
+        static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
+        static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
+
+        // AZ::Component
+        void Activate() override;
+        void Deactivate() override;
+    };
+} // namespace Compression

+ 100 - 0
Gems/Compression/Code/Source/Tools/CompressionFactoryImpl.cpp

@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <AzCore/std/ranges/ranges_algorithm.h>
+#include "CompressionFactoryImpl.h"
+
+namespace Compression
+{
+    // Implements the Relational Operators for the CompressionAlgorithmId class
+    // only for use in  the CompressionFactoryImply class to allow it to be used in
+    // less than(<) operations
+    AZ_DEFINE_ENUM_RELATIONAL_OPERATORS(CompressionAlgorithmId);
+
+    CompressionFactoryImpl::~CompressionFactoryImpl()
+    {
+        for (ICompressionInterface* compressionInterface : m_compressionInterfaces)
+        {
+            delete compressionInterface;
+        }
+    }
+    AZStd::span<ICompressionInterface* const> CompressionFactoryImpl::GetCompressionInterfaces() const
+    {
+        return m_compressionInterfaces;
+    }
+
+    // registration into interfaces vector
+    bool CompressionFactoryImpl::RegisterCompressionInterface(AZStd::unique_ptr<ICompressionInterface>&& compressionInterface)
+    {
+        if (compressionInterface == nullptr)
+        {
+            return false;
+        }
+
+        CompressionAlgorithmId compressionAlgorithmId = compressionInterface->GetCompressionAlgorithmId();
+        const size_t compressionIndex = FindCompressionIndex(compressionAlgorithmId);
+        if (compressionIndex < m_compressionInterfaces.size())
+        {
+            return false;
+        }
+
+        // Insert new compression interface since it is not registered
+        m_compressionInterfaces.emplace_back(compressionInterface.release());
+        const size_t emplaceIndex = m_compressionInterfaces.size() - 1;
+
+        // Use UpperBound to find the insertion slot for the new entry within the compression index set
+        auto FindIdIndexEntry = [](const CompressionIdIndexEntry& lhs, const CompressionIdIndexEntry& rhs)
+        {
+            return lhs.m_id < rhs.m_id;
+        };
+        CompressionIdIndexEntry newEntry{ compressionAlgorithmId, emplaceIndex };
+        m_compressionIdIndexSet.insert(AZStd::upper_bound(m_compressionIdIndexSet.begin(), m_compressionIdIndexSet.end(),
+            newEntry, AZStd::move(FindIdIndexEntry)),
+            AZStd::move(newEntry));
+        return true;
+    }
+
+    bool CompressionFactoryImpl::UnregisterCompressionInterface(CompressionAlgorithmId compressionAlgorithmId)
+    {
+        const size_t compressionIndex = FindCompressionIndex(compressionAlgorithmId);
+        if (compressionIndex < m_compressionInterfaces.size())
+        {
+            auto oldInterfaceIter = m_compressionInterfaces.begin() + compressionIndex;
+            // Delete the allocated member for he compression inteface
+            delete *oldInterfaceIter;
+            m_compressionInterfaces.erase(oldInterfaceIter);
+            return true;
+        }
+
+        return false;
+    }
+
+    ICompressionInterface* CompressionFactoryImpl::FindCompressionInterface(CompressionAlgorithmId compressionAlgorithmId) const
+    {
+        const size_t compressionIndex = FindCompressionIndex(compressionAlgorithmId);
+        return compressionIndex < m_compressionInterfaces.size()
+            ? m_compressionInterfaces[compressionIndex] : nullptr;
+    }
+
+    // find compression index entry in vector
+    // returns the index into the m_compressionInterfaces vector that matches the compression algorithm Id
+    // otherwise returns the size of the m_compressionInterfaces container to indicate out of bounds
+    size_t CompressionFactoryImpl::FindCompressionIndex(CompressionAlgorithmId compressionAlgorithmId) const
+    {
+        auto FindIdIndexEntry = [](const CompressionIdIndexEntry& lhs, const CompressionIdIndexEntry& rhs)
+        {
+            return lhs.m_id < rhs.m_id;
+        };
+        auto searchIter = AZStd::lower_bound(m_compressionIdIndexSet.begin(), m_compressionIdIndexSet.end(),
+            CompressionIdIndexEntry{ compressionAlgorithmId }, FindIdIndexEntry);
+
+        return searchIter != m_compressionIdIndexSet.end() && !FindIdIndexEntry(
+            CompressionIdIndexEntry{ compressionAlgorithmId }, *searchIter) ?
+            searchIter->m_index : m_compressionInterfaces.size();
+    }
+}// namespace Compression

+ 40 - 0
Gems/Compression/Code/Source/Tools/CompressionFactoryImpl.h

@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <AzCore/std/containers/vector.h>
+#include <AzCore/Memory/SystemAllocator.h>
+#include <Compression/CompressionInterfaceAPI.h>
+
+namespace Compression
+{
+    class CompressionFactoryImpl final
+        : public CompressionFactoryInterface
+    {
+    public:
+        AZ_RTTI(CompressionFactoryImpl, "{9F3B8418-4BEB-4249-BAAF-6653A8F511A3}", CompressionFactoryInterface);
+        AZ_CLASS_ALLOCATOR(CompressionFactoryImpl, AZ::SystemAllocator, 0);
+
+        ~CompressionFactoryImpl();
+
+        AZStd::span<ICompressionInterface* const> GetCompressionInterfaces() const override;
+        bool RegisterCompressionInterface(AZStd::unique_ptr<ICompressionInterface>&&) override;
+        bool UnregisterCompressionInterface(CompressionAlgorithmId) override;
+        ICompressionInterface* FindCompressionInterface(CompressionAlgorithmId) const override;
+
+    private:
+        size_t FindCompressionIndex(CompressionAlgorithmId) const;
+        struct CompressionIdIndexEntry
+        {
+            CompressionAlgorithmId m_id;
+            size_t m_index;
+        };
+        //! Index into the Compression Interfaces vector
+        AZStd::vector<CompressionIdIndexEntry> m_compressionIdIndexSet;
+        AZStd::vector<ICompressionInterface*> m_compressionInterfaces;
+    };
+}// namespace Compression

+ 11 - 0
Gems/Compression/Code/Tests/Clients/CompressionTest.cpp

@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <AzTest/AzTest.h>
+
+AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);

+ 11 - 0
Gems/Compression/Code/Tests/Tools/CompressionEditorTest.cpp

@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <AzTest/AzTest.h>
+
+AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);

+ 14 - 0
Gems/Compression/Code/compression_api_files.cmake

@@ -0,0 +1,14 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+    Include/Compression/CompressionBus.h
+    Include/Compression/CompressionInterfaceAPI.h
+    Include/Compression/CompressionInterfaceAPI.inl
+    Include/Compression/CompressionInterfaceStructs.h
+    Include/Compression/DecompressionInterfaceAPI.h
+    Include/Compression/DecompressionInterfaceAPI.inl
+)

+ 9 - 0
Gems/Compression/Code/compression_editor_api_files.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+
+set(FILES
+)

+ 12 - 0
Gems/Compression/Code/compression_editor_private_files.cmake

@@ -0,0 +1,12 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+    Source/Tools/CompressionEditorSystemComponent.cpp
+    Source/Tools/CompressionEditorSystemComponent.h
+    Source/Tools/CompressionFactoryImpl.h
+    Source/Tools/CompressionFactoryImpl.cpp
+)

+ 9 - 0
Gems/Compression/Code/compression_editor_shared_files.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+    Source/Tools/CompressionEditorModule.cpp
+)

+ 9 - 0
Gems/Compression/Code/compression_editor_tests_files.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+    Tests/Tools/CompressionEditorTest.cpp
+)

+ 11 - 0
Gems/Compression/Code/compression_private_files.cmake

@@ -0,0 +1,11 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+    Source/CompressionModuleInterface.h
+    Source/Clients/CompressionSystemComponent.cpp
+    Source/Clients/CompressionSystemComponent.h
+)

+ 9 - 0
Gems/Compression/Code/compression_shared_files.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+    Source/Clients/CompressionModule.cpp
+)

+ 9 - 0
Gems/Compression/Code/compression_tests_files.cmake

@@ -0,0 +1,9 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+set(FILES
+    Tests/Clients/CompressionTest.cpp
+)

+ 18 - 0
Gems/Compression/Registry/assetprocessor_settings.setreg

@@ -0,0 +1,18 @@
+{
+    "Amazon": {
+        "AssetProcessor": {
+            "Settings": {
+                "ScanFolder Compression/Assets": {
+                    "watch": "@GEMROOT:Compression@/Assets",
+                    "recursive": 1,
+                    "order": 101
+                },
+                "ScanFolder Compression/Registry": {
+                    "watch": "@GEMROOT:Compression@/Registry",
+                    "recursive": 1,
+                    "order": 102
+                }
+            }
+        }
+    }
+}

+ 21 - 0
Gems/Compression/gem.json

@@ -0,0 +1,21 @@
+{
+    "gem_name": "Compression",
+    "display_name": "Compression",
+    "license": "Apache-2.0 Or MIT",
+    "license_url": "https://github.com/o3de/o3de/blob/development/LICENSE.txt",
+    "origin": "Open 3D Engine - o3de.org",
+    "origin_url": "https://github.com/o3de/o3de",
+    "type": "Code",
+    "summary": "Compression Interface Gem which provides an API for registering Compression Algoirithms interfaces with. Comes with a sub gem implementation for LZ4 Compression",
+    "canonical_tags": [
+        "Gem"
+    ],
+    "user_tags": [
+        "Compression"
+    ],
+    "icon_path": "preview.png",
+    "requirements": "",
+    "documentation_url": "",
+    "dependencies": [],
+    "restricted": "Compression"
+}

+ 3 - 0
Gems/Compression/preview.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b178bfaa147fbbd7ceb58dc5a384f670769997f95b7f430eb130ba8503b662e0
+size 4326

+ 1 - 0
engine.json

@@ -24,6 +24,7 @@
         "Gems/Camera",
         "Gems/CameraFramework",
         "Gems/CertificateManager",
+        "Gems/Compression",
         "Gems/CrashReporting",
         "Gems/CustomAssetExample",
         "Gems/DebugDraw",