yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
compression.h File Reference
#include <memory>
#include <string>
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "app/core/constants.h"
Include dependency graph for compression.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  yaze::app::gfx::lc_lz2::CompressionCommand
 
struct  yaze::app::gfx::lc_lz2::CompressionPiece
 
struct  yaze::app::gfx::lc_lz2::CompressionContext
 

Namespaces

namespace  yaze
 
namespace  yaze::app
 Main namespace for the ImGui application.
 
namespace  yaze::app::gfx
 Contains classes for handling graphical data.
 
namespace  yaze::app::gfx::lc_lz2
 Contains the LC_LZ2 compression algorithm.
 

Macros

#define BUILD_HEADER(command, length)
 

Typedefs

using yaze::app::gfx::lc_lz2::CommandArgumentArray = std::array<std::array<char, 2>, 5>
 
using yaze::app::gfx::lc_lz2::CommandSizeArray = std::array<uint, 5>
 
using yaze::app::gfx::lc_lz2::DataSizeArray = std::array<uint, 5>
 
using yaze::app::gfx::lc_lz2::CompressionPiece = struct CompressionPiece
 
using yaze::app::gfx::lc_lz2::CompressionPiecePointer = std::shared_ptr<CompressionPiece>
 

Functions

void yaze::app::gfx::lc_lz2::PrintCompressionPiece (const CompressionPiecePointer &piece)
 
void yaze::app::gfx::lc_lz2::PrintCompressionChain (const CompressionPiecePointer &chain_head)
 
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)
 
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)
 
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)
 
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)
 
void yaze::app::gfx::lc_lz2::ValidateForByteGain (const DataSizeArray &data_size_taken, const CommandSizeArray &cmd_size, uint &max_win, uint &cmd_with_max)
 
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)
 
void yaze::app::gfx::lc_lz2::CheckByteRepeatV2 (const uchar *data, uint &src_pos, const uint last_pos, CompressionCommand &cmd)
 
void yaze::app::gfx::lc_lz2::CheckWordRepeatV2 (const uchar *data, uint &src_pos, const uint last_pos, CompressionCommand &cmd)
 
void yaze::app::gfx::lc_lz2::CheckIncByteV2 (const uchar *rom_data, uint &src_data_pos, const uint last_pos, CompressionCommand &cmd)
 
void yaze::app::gfx::lc_lz2::CheckIntraCopyV2 (const uchar *rom_data, uint &src_data_pos, const uint last_pos, uint start, CompressionCommand &cmd)
 
void yaze::app::gfx::lc_lz2::ValidateForByteGainV2 (const CompressionCommand &cmd, uint &max_win, uint &cmd_with_max)
 
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)
 
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.
 
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::CompressGraphics (const uchar *data, const int pos, const int length)
 
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::CompressOverworld (const uchar *data, const int pos, const int length)
 
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::CompressOverworld (const std::vector< uint8_t > data, const int pos, const int length)
 
absl::StatusOr< CompressionPiecePointeryaze::app::gfx::lc_lz2::SplitCompressionPiece (CompressionPiecePointer &piece, int mode)
 
std::vector< uint8_t > yaze::app::gfx::lc_lz2::CreateCompressionString (CompressionPiecePointer &start, int mode)
 
absl::Status yaze::app::gfx::lc_lz2::ValidateCompressionResult (CompressionPiecePointer &chain_head, int mode, int start, int src_data_pos)
 
CompressionPiecePointer yaze::app::gfx::lc_lz2::MergeCopy (CompressionPiecePointer &start)
 
void yaze::app::gfx::lc_lz2::CheckByteRepeatV3 (CompressionContext &context)
 
void yaze::app::gfx::lc_lz2::CheckWordRepeatV3 (CompressionContext &context)
 
void yaze::app::gfx::lc_lz2::CheckIncByteV3 (CompressionContext &context)
 
void yaze::app::gfx::lc_lz2::CheckIntraCopyV3 (CompressionContext &context)
 
void yaze::app::gfx::lc_lz2::InitializeCompression (CompressionContext &context)
 
void yaze::app::gfx::lc_lz2::CheckAvailableCompressionCommands (CompressionContext &context)
 
void yaze::app::gfx::lc_lz2::DetermineBestCompression (CompressionContext &context)
 
void yaze::app::gfx::lc_lz2::HandleDirectCopy (CompressionContext &context)
 
void yaze::app::gfx::lc_lz2::AddCompressionToChain (CompressionContext &context)
 
absl::Status yaze::app::gfx::lc_lz2::ValidateCompressionResultV3 (const CompressionContext &context)
 
absl::StatusOr< CompressionPieceyaze::app::gfx::lc_lz2::SplitCompressionPieceV3 (CompressionPiece &piece, int mode)
 
void yaze::app::gfx::lc_lz2::FinalizeCompression (CompressionContext &context)
 
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.
 
uint8_t * yaze::app::gfx::lc_lz2::Compress (uint8_t const *const src, int const oldsize, int *const size, int const flag)
 
uint8_t * yaze::app::gfx::lc_lz2::Uncompress (uint8_t const *src, int *const size, int const p_big_endian)
 
std::string yaze::app::gfx::lc_lz2::SetBuffer (const std::vector< uint8_t > &data, int src_pos, int comp_accumulator)
 
std::string yaze::app::gfx::lc_lz2::SetBuffer (const uchar *data, int src_pos, int comp_accumulator)
 
void yaze::app::gfx::lc_lz2::memfill (const uchar *data, std::vector< uint8_t > &buffer, int buffer_pos, int offset, int length)
 
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.
 
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::DecompressGraphics (const uchar *data, int pos, int size)
 
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::DecompressOverworld (const uchar *data, int pos, int size)
 
absl::StatusOr< std::vector< uint8_t > > yaze::app::gfx::lc_lz2::DecompressOverworld (const std::vector< uint8_t > data, int pos, int size)
 

Variables

const int yaze::app::gfx::lc_lz2::D_NINTENDO_C_MODE1 = 0
 
const int yaze::app::gfx::lc_lz2::D_NINTENDO_C_MODE2 = 1
 
const int yaze::app::gfx::lc_lz2::D_CMD_COPY = 0
 
const int yaze::app::gfx::lc_lz2::D_CMD_BYTE_REPEAT = 1
 
const int yaze::app::gfx::lc_lz2::D_CMD_WORD_REPEAT = 2
 
const int yaze::app::gfx::lc_lz2::D_CMD_BYTE_INC = 3
 
const int yaze::app::gfx::lc_lz2::D_CMD_COPY_EXISTING = 4
 
const int yaze::app::gfx::lc_lz2::D_MAX_NORMAL_LENGTH = 32
 
const int yaze::app::gfx::lc_lz2::D_MAX_LENGTH = 1024
 
const int yaze::app::gfx::lc_lz2::INITIAL_ALLOC_SIZE = 1024
 
constexpr int yaze::app::gfx::lc_lz2::kCommandDirectCopy = 0
 
constexpr int yaze::app::gfx::lc_lz2::kCommandByteFill = 1
 
constexpr int yaze::app::gfx::lc_lz2::kCommandWordFill = 2
 
constexpr int yaze::app::gfx::lc_lz2::kCommandIncreasingFill = 3
 
constexpr int yaze::app::gfx::lc_lz2::kCommandRepeatingBytes = 4
 
constexpr int yaze::app::gfx::lc_lz2::kCommandLongLength = 7
 
constexpr int yaze::app::gfx::lc_lz2::kMaxLengthNormalHeader = 32
 
constexpr int yaze::app::gfx::lc_lz2::kMaxLengthCompression = 1024
 
constexpr int yaze::app::gfx::lc_lz2::kNintendoMode1 = 0
 
constexpr int yaze::app::gfx::lc_lz2::kNintendoMode2 = 1
 
constexpr int yaze::app::gfx::lc_lz2::kSnesByteMax = 0xFF
 
constexpr int yaze::app::gfx::lc_lz2::kCommandMod = 0x07
 
constexpr int yaze::app::gfx::lc_lz2::kExpandedMod = 0xE0
 
constexpr int yaze::app::gfx::lc_lz2::kExpandedLengthMod = 0x3FF
 
constexpr int yaze::app::gfx::lc_lz2::kNormalLengthMod = 0x1F
 
constexpr int yaze::app::gfx::lc_lz2::kCompressionStringMod = 7 << 5
 

Macro Definition Documentation

◆ BUILD_HEADER