2018-06-09 00:44:03 +00:00
|
|
|
/**
|
|
|
|
* \file bitpack.hh
|
|
|
|
* \brief Header for bit-packing functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LZW_SRC_BITPACK_H_
|
|
|
|
#define LZW_SRC_BITPACK_H_
|
|
|
|
|
|
|
|
#include <cstdint>
|
2018-06-10 19:21:06 +00:00
|
|
|
#include <string>
|
2018-06-09 00:44:03 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2018-06-09 20:59:11 +00:00
|
|
|
/// \brief Bat-packs the input dynamically
|
|
|
|
[[nodiscard]] std::vector<unsigned char>
|
|
|
|
pack(const std::vector<std::uint16_t> &);
|
|
|
|
|
2018-06-09 00:44:03 +00:00
|
|
|
/// \brief Packs std::uint16_t of n bits into unsigned char
|
2018-06-09 20:59:11 +00:00
|
|
|
[[nodiscard]] std::vector<unsigned char>
|
2018-06-09 00:50:14 +00:00
|
|
|
pack_n(const std::vector<std::uint16_t>::const_iterator,
|
2018-06-09 20:59:11 +00:00
|
|
|
const std::vector<std::uint16_t>::const_iterator, const int);
|
2018-06-09 00:44:03 +00:00
|
|
|
|
|
|
|
/// \brief Specialization of \ref pack_n for 16bits
|
2018-06-09 20:59:11 +00:00
|
|
|
[[nodiscard]] std::vector<unsigned char>
|
2018-06-09 00:50:14 +00:00
|
|
|
pack_16(const std::vector<std::uint16_t>::const_iterator,
|
|
|
|
const std::vector<std::uint16_t>::const_iterator);
|
2018-06-09 00:44:03 +00:00
|
|
|
|
2018-06-09 20:59:11 +00:00
|
|
|
[[nodiscard]] std::vector<std::uint16_t>
|
2018-06-10 19:21:06 +00:00
|
|
|
unpack(std::basic_string<unsigned char> &&);
|
2018-06-09 20:59:11 +00:00
|
|
|
|
|
|
|
[[nodiscard]] std::vector<std::uint16_t>
|
2018-06-10 19:21:06 +00:00
|
|
|
unpack_n(const std::basic_string<unsigned char>::const_iterator,
|
|
|
|
const std::basic_string<unsigned char>::const_iterator, const int t_n);
|
2018-06-09 20:59:11 +00:00
|
|
|
|
|
|
|
[[nodiscard]] std::vector<std::uint16_t>
|
2018-06-10 19:21:06 +00:00
|
|
|
unpack_16(const std::basic_string<unsigned char>::const_iterator,
|
|
|
|
const std::basic_string<unsigned char>::const_iterator);
|
2018-06-09 01:18:28 +00:00
|
|
|
|
2018-06-09 00:44:03 +00:00
|
|
|
#endif /* LZW_SRC_BITPACK_H_ */
|