1 // 2 // SPDX-License-Identifier: BSD-3-Clause 3 // Copyright (c) Contributors to the OpenEXR Project. 4 // 5 6 #ifndef INCLUDED_IMF_ZIP_H 7 #define INCLUDED_IMF_ZIP_H 8 9 #include "ImfNamespace.h" 10 #include "ImfExport.h" 11 12 #include <cstddef> 13 14 OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER 15 16 class Zip 17 { 18 public: 19 explicit Zip (size_t rawMaxSize, int level); 20 Zip (size_t maxScanlineSize, size_t numScanLines, int level); 21 ~Zip(); 22 23 Zip (const Zip& other) = delete; 24 Zip& operator = (const Zip& other) = delete; 25 Zip (Zip&& other) = delete; 26 Zip& operator = (Zip&& other) = delete; 27 28 size_t maxRawSize(); 29 size_t maxCompressedSize(); 30 31 // 32 // Compress the raw data into the provided buffer. 33 // Returns the amount of compressed data. 34 // 35 int compress(const char *raw, int rawSize, char *compressed); 36 37 // 38 // Uncompress the compressed data into the provided 39 // buffer. Returns the amount of raw data actually decoded. 40 // 41 int uncompress(const char *compressed, int compressedSize, 42 char *raw); 43 44 private: 45 size_t _maxRawSize; 46 char *_tmpBuffer; 47 int _zipLevel; 48 }; 49 50 OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT 51 52 #endif 53