Contains the LC_LZ2 compression algorithm. More...
Classes | |
struct | CompressionCommand |
struct | CompressionContext |
struct | CompressionPiece |
Typedefs | |
using | CommandArgumentArray = std::array<std::array<char, 2>, 5> |
using | CommandSizeArray = std::array<uint, 5> |
using | DataSizeArray = std::array<uint, 5> |
using | CompressionPiece = struct CompressionPiece |
using | CompressionPiecePointer = std::shared_ptr<CompressionPiece> |
Functions | |
void | PrintCompressionPiece (const CompressionPiecePointer &piece) |
void | PrintCompressionChain (const CompressionPiecePointer &chain_head) |
void | CheckByteRepeat (const uchar *rom_data, DataSizeArray &data_size_taken, CommandArgumentArray &cmd_args, uint &src_data_pos, const uint last_pos) |
void | CheckWordRepeat (const uchar *rom_data, DataSizeArray &data_size_taken, CommandArgumentArray &cmd_args, uint &src_data_pos, const uint last_pos) |
void | CheckIncByte (const uchar *rom_data, DataSizeArray &data_size_taken, CommandArgumentArray &cmd_args, uint &src_data_pos, const uint last_pos) |
void | CheckIntraCopy (const uchar *rom_data, DataSizeArray &data_size_taken, CommandArgumentArray &cmd_args, uint &src_data_pos, const uint last_pos, uint start) |
void | ValidateForByteGain (const DataSizeArray &data_size_taken, const CommandSizeArray &cmd_size, uint &max_win, uint &cmd_with_max) |
void | CompressionCommandAlternative (const uchar *rom_data, CompressionPiecePointer &compressed_chain, const CommandSizeArray &cmd_size, const CommandArgumentArray &cmd_args, uint &src_data_pos, uint &comp_accumulator, uint &cmd_with_max, uint &max_win) |
void | CheckByteRepeatV2 (const uchar *data, uint &src_pos, const uint last_pos, CompressionCommand &cmd) |
void | CheckWordRepeatV2 (const uchar *data, uint &src_pos, const uint last_pos, CompressionCommand &cmd) |
void | CheckIncByteV2 (const uchar *rom_data, uint &src_data_pos, const uint last_pos, CompressionCommand &cmd) |
void | CheckIntraCopyV2 (const uchar *rom_data, uint &src_data_pos, const uint last_pos, uint start, CompressionCommand &cmd) |
void | ValidateForByteGainV2 (const CompressionCommand &cmd, uint &max_win, uint &cmd_with_max) |
void | CompressionCommandAlternativeV2 (const uchar *rom_data, const CompressionCommand &cmd, CompressionPiecePointer &compressed_chain, uint &src_data_pos, uint &comp_accumulator, uint &cmd_with_max, uint &max_win) |
void | AddAlternativeCompressionCommand (const uchar *rom_data, CompressionPiecePointer &compressed_chain, const CompressionCommand &command, uint &source_data_position, uint &uncompressed_data_size, uint &best_command, uint &best_command_gain) |
absl::StatusOr< CompressionPiecePointer > | SplitCompressionPiece (CompressionPiecePointer &piece, int mode) |
std::vector< uint8_t > | CreateCompressionString (CompressionPiecePointer &start, int mode) |
absl::Status | ValidateCompressionResult (CompressionPiecePointer &chain_head, int mode, int start, int src_data_pos) |
CompressionPiecePointer | MergeCopy (CompressionPiecePointer &start) |
absl::StatusOr< std::vector< uint8_t > > | CompressV2 (const uchar *data, const int start, const int length, int mode=1, bool check=false) |
Compresses a buffer of data using the LC_LZ2 algorithm. | |
uint8_t * | Compress (uint8_t const *const src, int const oldsize, int *const size, int const flag) |
uint8_t * | Uncompress (uint8_t const *src, int *const size, int const p_big_endian) |
absl::StatusOr< std::vector< uint8_t > > | CompressGraphics (const uchar *data, const int pos, const int length) |
absl::StatusOr< std::vector< uint8_t > > | CompressOverworld (const uchar *data, const int pos, const int length) |
absl::StatusOr< std::vector< uint8_t > > | CompressOverworld (const std::vector< uint8_t > data, const int pos, const int length) |
void | CheckByteRepeatV3 (CompressionContext &context) |
void | CheckWordRepeatV3 (CompressionContext &context) |
void | CheckIncByteV3 (CompressionContext &context) |
void | CheckIntraCopyV3 (CompressionContext &context) |
void | InitializeCompression (CompressionContext &context) |
void | CheckAvailableCompressionCommands (CompressionContext &context) |
void | DetermineBestCompression (CompressionContext &context) |
void | HandleDirectCopy (CompressionContext &context) |
void | AddCompressionToChain (CompressionContext &context) |
absl::Status | ValidateCompressionResultV3 (const CompressionContext &context) |
absl::StatusOr< CompressionPiece > | SplitCompressionPieceV3 (CompressionPiece &piece, int mode) |
void | FinalizeCompression (CompressionContext &context) |
absl::StatusOr< std::vector< uint8_t > > | CompressV3 (const std::vector< uint8_t > &data, const int start, const int length, int mode=1, bool check=false) |
Compresses a buffer of data using the LC_LZ2 algorithm. | |
std::string | SetBuffer (const uchar *data, int src_pos, int comp_accumulator) |
std::string | SetBuffer (const std::vector< uint8_t > &data, int src_pos, int comp_accumulator) |
void | memfill (const uchar *data, std::vector< uint8_t > &buffer, int buffer_pos, int offset, int length) |
absl::StatusOr< std::vector< uint8_t > > | DecompressV2 (const uchar *data, int offset, int size=0x800, int mode=1) |
Decompresses a buffer of data using the LC_LZ2 algorithm. | |
absl::StatusOr< std::vector< uint8_t > > | DecompressGraphics (const uchar *data, int pos, int size) |
absl::StatusOr< std::vector< uint8_t > > | DecompressOverworld (const uchar *data, int pos, int size) |
absl::StatusOr< std::vector< uint8_t > > | DecompressOverworld (const std::vector< uint8_t > data, int pos, int size) |
Variables | |
const std::array< int, 5 > | kCommandSizes = {1, 2, 2, 2, 3} |
const int | D_NINTENDO_C_MODE1 = 0 |
const int | D_NINTENDO_C_MODE2 = 1 |
const int | D_CMD_COPY = 0 |
const int | D_CMD_BYTE_REPEAT = 1 |
const int | D_CMD_WORD_REPEAT = 2 |
const int | D_CMD_BYTE_INC = 3 |
const int | D_CMD_COPY_EXISTING = 4 |
const int | D_MAX_NORMAL_LENGTH = 32 |
const int | D_MAX_LENGTH = 1024 |
const int | INITIAL_ALLOC_SIZE = 1024 |
constexpr int | kCommandDirectCopy = 0 |
constexpr int | kCommandByteFill = 1 |
constexpr int | kCommandWordFill = 2 |
constexpr int | kCommandIncreasingFill = 3 |
constexpr int | kCommandRepeatingBytes = 4 |
constexpr int | kCommandLongLength = 7 |
constexpr int | kMaxLengthNormalHeader = 32 |
constexpr int | kMaxLengthCompression = 1024 |
constexpr int | kNintendoMode1 = 0 |
constexpr int | kNintendoMode2 = 1 |
constexpr int | kSnesByteMax = 0xFF |
constexpr int | kCommandMod = 0x07 |
constexpr int | kExpandedMod = 0xE0 |
constexpr int | kExpandedLengthMod = 0x3FF |
constexpr int | kNormalLengthMod = 0x1F |
constexpr int | kCompressionStringMod = 7 << 5 |
Contains the LC_LZ2 compression algorithm.
using yaze::app::gfx::lc_lz2::CommandArgumentArray = std::array<std::array<char, 2>, 5> |
Definition at line 66 of file compression.h.
using yaze::app::gfx::lc_lz2::CommandSizeArray = std::array<uint, 5> |
Definition at line 67 of file compression.h.
using yaze::app::gfx::lc_lz2::DataSizeArray = std::array<uint, 5> |
Definition at line 68 of file compression.h.
using yaze::app::gfx::lc_lz2::CompressionPiece = struct CompressionPiece |
Definition at line 81 of file compression.h.
using yaze::app::gfx::lc_lz2::CompressionPiecePointer = std::shared_ptr<CompressionPiece> |
Definition at line 82 of file compression.h.
void yaze::app::gfx::lc_lz2::PrintCompressionPiece | ( | const CompressionPiecePointer & | piece | ) |
Definition at line 23 of file compression.cc.
Referenced by AddAlternativeCompressionCommand(), CompressionCommandAlternative(), CompressionCommandAlternativeV2(), CreateCompressionString(), MergeCopy(), and PrintCompressionChain().
void yaze::app::gfx::lc_lz2::PrintCompressionChain | ( | const CompressionPiecePointer & | chain_head | ) |
Definition at line 34 of file compression.cc.
References PrintCompressionPiece().
Referenced by CompressV2().
void yaze::app::gfx::lc_lz2::CheckByteRepeat | ( | const uchar * | rom_data, |
DataSizeArray & | data_size_taken, | ||
CommandArgumentArray & | cmd_args, | ||
uint & | src_data_pos, | ||
const uint | last_pos ) |
Definition at line 43 of file compression.cc.
References kCommandByteFill.
void yaze::app::gfx::lc_lz2::CheckWordRepeat | ( | const uchar * | rom_data, |
DataSizeArray & | data_size_taken, | ||
CommandArgumentArray & | cmd_args, | ||
uint & | src_data_pos, | ||
const uint | last_pos ) |
Definition at line 55 of file compression.cc.
References kCommandWordFill.
void yaze::app::gfx::lc_lz2::CheckIncByte | ( | const uchar * | rom_data, |
DataSizeArray & | data_size_taken, | ||
CommandArgumentArray & | cmd_args, | ||
uint & | src_data_pos, | ||
const uint | last_pos ) |
Definition at line 77 of file compression.cc.
References kCommandIncreasingFill.
void yaze::app::gfx::lc_lz2::CheckIntraCopy | ( | const uchar * | rom_data, |
DataSizeArray & | data_size_taken, | ||
CommandArgumentArray & | cmd_args, | ||
uint & | src_data_pos, | ||
const uint | last_pos, | ||
uint | start ) |
Definition at line 93 of file compression.cc.
References kCommandRepeatingBytes, and kSnesByteMax.
void yaze::app::gfx::lc_lz2::ValidateForByteGain | ( | const DataSizeArray & | data_size_taken, |
const CommandSizeArray & | cmd_size, | ||
uint & | max_win, | ||
uint & | cmd_with_max ) |
Definition at line 129 of file compression.cc.
Referenced by CompressV2().
void yaze::app::gfx::lc_lz2::CompressionCommandAlternative | ( | const uchar * | rom_data, |
CompressionPiecePointer & | compressed_chain, | ||
const CommandSizeArray & | cmd_size, | ||
const CommandArgumentArray & | cmd_args, | ||
uint & | src_data_pos, | ||
uint & | comp_accumulator, | ||
uint & | cmd_with_max, | ||
uint & | max_win ) |
Definition at line 147 of file compression.cc.
References PrintCompressionPiece().
void yaze::app::gfx::lc_lz2::CheckByteRepeatV2 | ( | const uchar * | data, |
uint & | src_pos, | ||
const uint | last_pos, | ||
CompressionCommand & | cmd ) |
Definition at line 185 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, and kCommandByteFill.
Referenced by CompressV2().
void yaze::app::gfx::lc_lz2::CheckWordRepeatV2 | ( | const uchar * | data, |
uint & | src_pos, | ||
const uint | last_pos, | ||
CompressionCommand & | cmd ) |
Definition at line 195 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, and kCommandWordFill.
Referenced by CompressV2().
void yaze::app::gfx::lc_lz2::CheckIncByteV2 | ( | const uchar * | rom_data, |
uint & | src_data_pos, | ||
const uint | last_pos, | ||
CompressionCommand & | cmd ) |
Definition at line 215 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, and kCommandIncreasingFill.
Referenced by CompressV2().
void yaze::app::gfx::lc_lz2::CheckIntraCopyV2 | ( | const uchar * | rom_data, |
uint & | src_data_pos, | ||
const uint | last_pos, | ||
uint | start, | ||
CompressionCommand & | cmd ) |
Definition at line 230 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, kCommandRepeatingBytes, and kSnesByteMax.
Referenced by CompressV2().
void yaze::app::gfx::lc_lz2::ValidateForByteGainV2 | ( | const CompressionCommand & | cmd, |
uint & | max_win, | ||
uint & | cmd_with_max ) |
Definition at line 268 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::data_size, and kCommandSizes.
void yaze::app::gfx::lc_lz2::CompressionCommandAlternativeV2 | ( | const uchar * | rom_data, |
const CompressionCommand & | cmd, | ||
CompressionPiecePointer & | compressed_chain, | ||
uint & | src_data_pos, | ||
uint & | comp_accumulator, | ||
uint & | cmd_with_max, | ||
uint & | max_win ) |
Definition at line 284 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionCommand::cmd_size, and PrintCompressionPiece().
void yaze::app::gfx::lc_lz2::AddAlternativeCompressionCommand | ( | const uchar * | rom_data, |
CompressionPiecePointer & | compressed_chain, | ||
const CompressionCommand & | command, | ||
uint & | source_data_position, | ||
uint & | uncompressed_data_size, | ||
uint & | best_command, | ||
uint & | best_command_gain ) |
Definition at line 318 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionCommand::cmd_size, and PrintCompressionPiece().
Referenced by CompressV2().
absl::StatusOr< CompressionPiecePointer > yaze::app::gfx::lc_lz2::SplitCompressionPiece | ( | CompressionPiecePointer & | piece, |
int | mode ) |
Definition at line 365 of file compression.cc.
References kCommandByteFill, kCommandDirectCopy, kCommandIncreasingFill, kCommandRepeatingBytes, kCommandWordFill, kMaxLengthCompression, kNintendoMode1, kNintendoMode2, and kSnesByteMax.
Referenced by CreateCompressionString().
std::vector< uint8_t > yaze::app::gfx::lc_lz2::CreateCompressionString | ( | CompressionPiecePointer & | start, |
int | mode ) |
Definition at line 416 of file compression.cc.
References BUILD_HEADER, kCompressionStringMod, kMaxLengthCompression, kMaxLengthNormalHeader, kNintendoMode1, kSnesByteMax, PrintCompressionPiece(), and SplitCompressionPiece().
Referenced by CompressV2(), and ValidateCompressionResult().
absl::Status yaze::app::gfx::lc_lz2::ValidateCompressionResult | ( | CompressionPiecePointer & | chain_head, |
int | mode, | ||
int | start, | ||
int | src_data_pos ) |
Definition at line 475 of file compression.cc.
References ASSIGN_OR_RETURN, yaze::app::Rom::begin(), CreateCompressionString(), yaze::app::Rom::data(), DecompressV2(), yaze::app::Rom::LoadFromBytes(), RETURN_IF_ERROR, and yaze::app::Rom::size().
Referenced by CompressV2().
CompressionPiecePointer yaze::app::gfx::lc_lz2::MergeCopy | ( | CompressionPiecePointer & | start | ) |
Definition at line 494 of file compression.cc.
References kMaxLengthCompression, and PrintCompressionPiece().
Referenced by CompressV2().
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::CompressV2 | ( | const uchar * | data, |
const int | start, | ||
const int | length, | ||
int | mode = 1, | ||
bool | check = false ) |
Compresses a buffer of data using the LC_LZ2 algorithm.
Definition at line 519 of file compression.cc.
References AddAlternativeCompressionCommand(), yaze::app::gfx::lc_lz2::CompressionCommand::arguments, CheckByteRepeatV2(), CheckIncByteV2(), CheckIntraCopyV2(), CheckWordRepeatV2(), yaze::app::gfx::lc_lz2::CompressionCommand::cmd_size, CreateCompressionString(), yaze::app::gfx::lc_lz2::CompressionCommand::data_size, kCommandDirectCopy, MergeCopy(), PrintCompressionChain(), RETURN_IF_ERROR, SetBuffer(), ValidateCompressionResult(), and ValidateForByteGain().
Referenced by CompressGraphics(), CompressOverworld(), and yaze::app::Rom::SaveAllGraphicsData().
uint8_t * yaze::app::gfx::lc_lz2::Compress | ( | uint8_t const *const | src, |
int const | oldsize, | ||
int *const | size, | ||
int const | flag ) |
Definition at line 594 of file compression.cc.
Referenced by yaze::app::zelda3::overworld::Overworld::SaveOverworldMaps().
uint8_t * yaze::app::gfx::lc_lz2::Uncompress | ( | uint8_t const * | src, |
int *const | size, | ||
int const | p_big_endian ) |
Definition at line 740 of file compression.cc.
References yaze::app::core::ldle16b(), and yaze::app::core::stle16b().
Referenced by yaze::app::zelda3::overworld::Overworld::DecompressAllMapTiles().
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::CompressGraphics | ( | const uchar * | data, |
const int | pos, | ||
const int | length ) |
Definition at line 873 of file compression.cc.
References CompressV2(), and kNintendoMode2.
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::CompressOverworld | ( | const uchar * | data, |
const int | pos, | ||
const int | length ) |
Definition at line 879 of file compression.cc.
References CompressV2(), and kNintendoMode1.
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::CompressOverworld | ( | const std::vector< uint8_t > | data, |
const int | pos, | ||
const int | length ) |
Definition at line 885 of file compression.cc.
References CompressV3(), and kNintendoMode1.
void yaze::app::gfx::lc_lz2::CheckByteRepeatV3 | ( | CompressionContext & | context | ) |
Definition at line 893 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionContext::current_cmd, yaze::app::gfx::lc_lz2::CompressionContext::data, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, DEBUG_LOG, kCommandByteFill, yaze::app::gfx::lc_lz2::CompressionContext::last_pos, and yaze::app::gfx::lc_lz2::CompressionContext::src_pos.
Referenced by CheckAvailableCompressionCommands().
void yaze::app::gfx::lc_lz2::CheckWordRepeatV3 | ( | CompressionContext & | context | ) |
Definition at line 913 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionContext::current_cmd, yaze::app::gfx::lc_lz2::CompressionContext::data, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, DEBUG_LOG, kCommandWordFill, yaze::app::gfx::lc_lz2::CompressionContext::last_pos, and yaze::app::gfx::lc_lz2::CompressionContext::src_pos.
Referenced by CheckAvailableCompressionCommands().
void yaze::app::gfx::lc_lz2::CheckIncByteV3 | ( | CompressionContext & | context | ) |
Definition at line 939 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionContext::current_cmd, yaze::app::gfx::lc_lz2::CompressionContext::data, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, DEBUG_LOG, kCommandIncreasingFill, yaze::app::gfx::lc_lz2::CompressionContext::last_pos, and yaze::app::gfx::lc_lz2::CompressionContext::src_pos.
Referenced by CheckAvailableCompressionCommands().
void yaze::app::gfx::lc_lz2::CheckIntraCopyV3 | ( | CompressionContext & | context | ) |
Definition at line 971 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, yaze::app::gfx::lc_lz2::CompressionContext::current_cmd, yaze::app::gfx::lc_lz2::CompressionContext::data, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, DEBUG_LOG, kCommandRepeatingBytes, kSnesByteMax, and yaze::app::gfx::lc_lz2::CompressionContext::src_pos.
Referenced by CheckAvailableCompressionCommands().
void yaze::app::gfx::lc_lz2::InitializeCompression | ( | CompressionContext & | context | ) |
Definition at line 1026 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionContext::current_cmd.
Referenced by CompressV3().
void yaze::app::gfx::lc_lz2::CheckAvailableCompressionCommands | ( | CompressionContext & | context | ) |
Definition at line 1033 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, CheckByteRepeatV3(), CheckIncByteV3(), CheckIntraCopyV3(), CheckWordRepeatV3(), yaze::app::gfx::lc_lz2::CompressionContext::current_cmd, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, DEBUG_LOG, and yaze::app::gfx::lc_lz2::CompressionContext::src_pos.
Referenced by CompressV3().
void yaze::app::gfx::lc_lz2::DetermineBestCompression | ( | CompressionContext & | context | ) |
Definition at line 1046 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::cmd_size, yaze::app::gfx::lc_lz2::CompressionContext::cmd_with_max, yaze::app::gfx::lc_lz2::CompressionContext::current_cmd, yaze::app::gfx::lc_lz2::CompressionContext::data, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, DEBUG_LOG, kCommandDirectCopy, and yaze::app::gfx::lc_lz2::CompressionContext::src_pos.
Referenced by CompressV3().
void yaze::app::gfx::lc_lz2::HandleDirectCopy | ( | CompressionContext & | context | ) |
Definition at line 1083 of file compression.cc.
References BUILD_HEADER, yaze::app::gfx::lc_lz2::CompressionContext::cmd_with_max, yaze::app::gfx::lc_lz2::CompressionContext::comp_accumulator, yaze::app::gfx::lc_lz2::CompressionContext::compressed_data, yaze::app::gfx::lc_lz2::CompressionContext::data, DEBUG_LOG, yaze::app::gfx::lc_lz2::CompressionContext::last_pos, and yaze::app::gfx::lc_lz2::CompressionContext::src_pos.
Referenced by CompressV3().
void yaze::app::gfx::lc_lz2::AddCompressionToChain | ( | CompressionContext & | context | ) |
Definition at line 1135 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionCommand::arguments, BUILD_HEADER, yaze::app::gfx::lc_lz2::CompressionCommand::cmd_size, yaze::app::gfx::lc_lz2::CompressionContext::cmd_with_max, yaze::app::gfx::lc_lz2::CompressionContext::comp_accumulator, yaze::app::gfx::lc_lz2::CompressionContext::compressed_data, yaze::app::gfx::lc_lz2::CompressionContext::current_cmd, yaze::app::gfx::lc_lz2::CompressionContext::data, yaze::app::gfx::lc_lz2::CompressionCommand::data_size, DEBUG_LOG, and yaze::app::gfx::lc_lz2::CompressionContext::src_pos.
Referenced by CompressV3().
absl::Status yaze::app::gfx::lc_lz2::ValidateCompressionResultV3 | ( | const CompressionContext & | context | ) |
Definition at line 1178 of file compression.cc.
References ASSIGN_OR_RETURN, yaze::app::Rom::begin(), yaze::app::gfx::lc_lz2::CompressionContext::compressed_data, yaze::app::Rom::data(), DecompressV2(), yaze::app::Rom::LoadFromBytes(), RETURN_IF_ERROR, yaze::app::Rom::size(), yaze::app::gfx::lc_lz2::CompressionContext::src_pos, and yaze::app::gfx::lc_lz2::CompressionContext::start.
Referenced by CompressV3().
absl::StatusOr< CompressionPiece > yaze::app::gfx::lc_lz2::SplitCompressionPieceV3 | ( | CompressionPiece & | piece, |
int | mode ) |
Definition at line 1195 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionPiece::argument, yaze::app::gfx::lc_lz2::CompressionPiece::argument_length, yaze::app::gfx::lc_lz2::CompressionPiece::command, kCommandByteFill, kCommandDirectCopy, kCommandIncreasingFill, kCommandRepeatingBytes, kCommandWordFill, kMaxLengthCompression, kNintendoMode1, kNintendoMode2, kSnesByteMax, and yaze::app::gfx::lc_lz2::CompressionPiece::length.
Referenced by FinalizeCompression().
void yaze::app::gfx::lc_lz2::FinalizeCompression | ( | CompressionContext & | context | ) |
Definition at line 1244 of file compression.cc.
References yaze::app::gfx::lc_lz2::CompressionPiece::argument, yaze::app::gfx::lc_lz2::CompressionPiece::argument_length, BUILD_HEADER, yaze::app::gfx::lc_lz2::CompressionPiece::command, yaze::app::gfx::lc_lz2::CompressionContext::comp_accumulator, yaze::app::gfx::lc_lz2::CompressionContext::compressed_data, yaze::app::gfx::lc_lz2::CompressionContext::compression_pieces, yaze::app::gfx::lc_lz2::CompressionContext::compression_string, yaze::app::gfx::lc_lz2::CompressionContext::data, DEBUG_LOG, kCompressionStringMod, kMaxLengthCompression, kMaxLengthNormalHeader, kNintendoMode1, kSnesByteMax, yaze::app::gfx::lc_lz2::CompressionPiece::length, yaze::app::gfx::lc_lz2::CompressionContext::mode, SplitCompressionPieceV3(), and yaze::app::gfx::lc_lz2::CompressionContext::src_pos.
Referenced by CompressV3().
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::CompressV3 | ( | const std::vector< uint8_t > & | data, |
const int | start, | ||
const int | length, | ||
int | mode = 1, | ||
bool | check = false ) |
Compresses a buffer of data using the LC_LZ2 algorithm.
Definition at line 1311 of file compression.cc.
References AddCompressionToChain(), CheckAvailableCompressionCommands(), yaze::app::gfx::lc_lz2::CompressionContext::cmd_with_max, yaze::app::gfx::lc_lz2::CompressionContext::compressed_data, DEBUG_LOG, DetermineBestCompression(), FinalizeCompression(), HandleDirectCopy(), InitializeCompression(), yaze::app::gfx::lc_lz2::CompressionContext::last_pos, RETURN_IF_ERROR, yaze::app::gfx::lc_lz2::CompressionContext::src_pos, and ValidateCompressionResultV3().
Referenced by CompressOverworld().
std::string yaze::app::gfx::lc_lz2::SetBuffer | ( | const uchar * | data, |
int | src_pos, | ||
int | comp_accumulator ) |
Definition at line 1345 of file compression.cc.
Referenced by CompressV2().
std::string yaze::app::gfx::lc_lz2::SetBuffer | ( | const std::vector< uint8_t > & | data, |
int | src_pos, | ||
int | comp_accumulator ) |
Definition at line 1353 of file compression.cc.
void yaze::app::gfx::lc_lz2::memfill | ( | const uchar * | data, |
std::vector< uint8_t > & | buffer, | ||
int | buffer_pos, | ||
int | offset, | ||
int | length ) |
Definition at line 1362 of file compression.cc.
Referenced by DecompressV2().
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::DecompressV2 | ( | const uchar * | data, |
int | offset, | ||
int | size = 0x800, | ||
int | mode = 1 ) |
Decompresses a buffer of data using the LC_LZ2 algorithm.
Definition at line 1372 of file compression.cc.
References kCommandByteFill, kCommandDirectCopy, kCommandIncreasingFill, kCommandMod, kCommandRepeatingBytes, kCommandWordFill, kExpandedLengthMod, kExpandedMod, kNintendoMode1, kNormalLengthMod, kSnesByteMax, and memfill().
Referenced by DecompressGraphics(), yaze::app::editor::GraphicsEditor::DecompressImportData(), DecompressOverworld(), DecompressOverworld(), yaze::app::editor::GraphicsEditor::DecompressSuperDonkey(), yaze::app::editor::GraphicsEditor::DrawTilemapImport(), yaze::app::Rom::Load2BppGraphics(), yaze::app::Rom::LoadAllGraphicsData(), ValidateCompressionResult(), and ValidateCompressionResultV3().
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::DecompressGraphics | ( | const uchar * | data, |
int | pos, | ||
int | size ) |
Definition at line 1459 of file compression.cc.
References DecompressV2(), and kNintendoMode2.
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::DecompressOverworld | ( | const uchar * | data, |
int | pos, | ||
int | size ) |
Definition at line 1464 of file compression.cc.
References DecompressV2(), and kNintendoMode1.
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::DecompressOverworld | ( | const std::vector< uint8_t > | data, |
int | pos, | ||
int | size ) |
Definition at line 1469 of file compression.cc.
References DecompressV2(), and kNintendoMode1.
const std::array<int, 5> yaze::app::gfx::lc_lz2::kCommandSizes = {1, 2, 2, 2, 3} |
Definition at line 265 of file compression.cc.
Referenced by ValidateForByteGainV2().
const int yaze::app::gfx::lc_lz2::D_NINTENDO_C_MODE1 = 0 |
Definition at line 23 of file compression.h.
const int yaze::app::gfx::lc_lz2::D_NINTENDO_C_MODE2 = 1 |
Definition at line 24 of file compression.h.
const int yaze::app::gfx::lc_lz2::D_CMD_COPY = 0 |
Definition at line 26 of file compression.h.
const int yaze::app::gfx::lc_lz2::D_CMD_BYTE_REPEAT = 1 |
Definition at line 27 of file compression.h.
const int yaze::app::gfx::lc_lz2::D_CMD_WORD_REPEAT = 2 |
Definition at line 28 of file compression.h.
const int yaze::app::gfx::lc_lz2::D_CMD_BYTE_INC = 3 |
Definition at line 29 of file compression.h.
const int yaze::app::gfx::lc_lz2::D_CMD_COPY_EXISTING = 4 |
Definition at line 30 of file compression.h.
const int yaze::app::gfx::lc_lz2::D_MAX_NORMAL_LENGTH = 32 |
Definition at line 32 of file compression.h.
const int yaze::app::gfx::lc_lz2::D_MAX_LENGTH = 1024 |
Definition at line 33 of file compression.h.
const int yaze::app::gfx::lc_lz2::INITIAL_ALLOC_SIZE = 1024 |
Definition at line 35 of file compression.h.
|
constexpr |
Definition at line 37 of file compression.h.
Referenced by CompressV2(), DecompressV2(), DetermineBestCompression(), SplitCompressionPiece(), and SplitCompressionPieceV3().
|
constexpr |
Definition at line 38 of file compression.h.
Referenced by CheckByteRepeat(), CheckByteRepeatV2(), CheckByteRepeatV3(), DecompressV2(), SplitCompressionPiece(), and SplitCompressionPieceV3().
|
constexpr |
Definition at line 39 of file compression.h.
Referenced by CheckWordRepeat(), CheckWordRepeatV2(), CheckWordRepeatV3(), DecompressV2(), SplitCompressionPiece(), and SplitCompressionPieceV3().
|
constexpr |
Definition at line 40 of file compression.h.
Referenced by CheckIncByte(), CheckIncByteV2(), CheckIncByteV3(), DecompressV2(), SplitCompressionPiece(), and SplitCompressionPieceV3().
|
constexpr |
Definition at line 41 of file compression.h.
Referenced by CheckIntraCopy(), CheckIntraCopyV2(), CheckIntraCopyV3(), DecompressV2(), SplitCompressionPiece(), and SplitCompressionPieceV3().
|
constexpr |
Definition at line 42 of file compression.h.
|
constexpr |
Definition at line 43 of file compression.h.
Referenced by CreateCompressionString(), and FinalizeCompression().
|
constexpr |
Definition at line 44 of file compression.h.
Referenced by CreateCompressionString(), FinalizeCompression(), MergeCopy(), SplitCompressionPiece(), and SplitCompressionPieceV3().
|
constexpr |
Definition at line 45 of file compression.h.
Referenced by CompressOverworld(), CompressOverworld(), CreateCompressionString(), DecompressOverworld(), DecompressOverworld(), DecompressV2(), yaze::app::editor::GraphicsEditor::DrawTilemapImport(), FinalizeCompression(), SplitCompressionPiece(), and SplitCompressionPieceV3().
|
constexpr |
Definition at line 46 of file compression.h.
Referenced by CompressGraphics(), DecompressGraphics(), SplitCompressionPiece(), and SplitCompressionPieceV3().
|
constexpr |
Definition at line 47 of file compression.h.
Referenced by CheckIntraCopy(), CheckIntraCopyV2(), CheckIntraCopyV3(), CreateCompressionString(), DecompressV2(), FinalizeCompression(), SplitCompressionPiece(), and SplitCompressionPieceV3().
|
constexpr |
Definition at line 48 of file compression.h.
Referenced by DecompressV2().
|
constexpr |
Definition at line 49 of file compression.h.
Referenced by DecompressV2().
|
constexpr |
Definition at line 50 of file compression.h.
Referenced by DecompressV2().
|
constexpr |
Definition at line 51 of file compression.h.
Referenced by DecompressV2().
|
constexpr |
Definition at line 52 of file compression.h.
Referenced by CreateCompressionString(), and FinalizeCompression().