Fix naming style.

This commit is contained in:
2022-03-15 01:37:37 +00:00
parent 265fa4fc17
commit d4b1e63e96
163 changed files with 3422 additions and 3306 deletions

View File

@@ -42,6 +42,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
/// <summary>Implements the Apple version of RLE</summary>
// ReSharper disable once InconsistentNaming
public static class ADC
{
const int PLAIN = 1;
@@ -51,7 +52,7 @@ public static class ADC
public static bool IsSupported => true;
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern int AARU_adc_decode_buffer(byte[] dst_buffer, int dst_size, byte[] src_buffer, int src_size);
static extern int AARU_adc_decode_buffer(byte[] dstBuffer, int dstSize, byte[] srcBuffer, int srcSize);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static int GetChunkType(byte byt) => (byt & 0x80) == 0x80

View File

@@ -43,7 +43,7 @@ public static class AppleRle
public static bool IsSupported => true;
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern int AARU_apple_rle_decode_buffer(byte[] dst_buffer, int dst_size, byte[] src_buffer, int src_size);
static extern int AARU_apple_rle_decode_buffer(byte[] dstBuffer, int dstSize, byte[] srcBuffer, int srcSize);
/// <summary>Decodes a buffer compressed with Apple RLE</summary>
/// <param name="source">Encoded buffer</param>

View File

@@ -38,11 +38,11 @@ public class BZip2
public static bool IsSupported => true;
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern int AARU_bzip2_decode_buffer(byte[] dst_buffer, ref uint dst_size, byte[] src_buffer, uint src_size);
static extern int AARU_bzip2_decode_buffer(byte[] dstBuffer, ref uint dstSize, byte[] srcBuffer, uint srcSize);
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern int AARU_bzip2_encode_buffer(byte[] dst_buffer, ref uint dst_size, byte[] src_buffer, uint src_size,
int blockSize100k);
static extern int AARU_bzip2_encode_buffer(byte[] dstBuffer, ref uint dstSize, byte[] srcBuffer, uint srcSize,
int blockSize100K);
/// <summary>Decodes a buffer compressed with BZIP2</summary>
/// <param name="source">Encoded buffer</param>
@@ -68,21 +68,21 @@ public class BZip2
/// <summary>Compresses a buffer using BZIP2</summary>
/// <param name="source">Data to compress</param>
/// <param name="destination">Buffer to store the compressed data</param>
/// <param name="blockSize100k">Block size in 100KiB units</param>
/// <param name="blockSize100K">Block size in 100KiB units</param>
/// <returns></returns>
public static int EncodeBuffer(byte[] source, byte[] destination, int blockSize100k)
public static int EncodeBuffer(byte[] source, byte[] destination, int blockSize100K)
{
var destinationSize = (uint)destination.Length;
if(Native.IsSupported)
{
AARU_bzip2_encode_buffer(destination, ref destinationSize, source, (uint)source.Length, blockSize100k);
AARU_bzip2_encode_buffer(destination, ref destinationSize, source, (uint)source.Length, blockSize100K);
return (int)destinationSize;
}
using var cmpMs = new MemoryStream(source);
using var encStream = new BZip2OutputStream(new MemoryStream(destination), blockSize100k);
using var encStream = new BZip2OutputStream(new MemoryStream(destination), blockSize100K);
encStream.Write(source, 0, source.Length);
return source.Length;

View File

@@ -33,24 +33,25 @@ using System.Runtime.InteropServices;
using CUETools.Codecs;
using CUETools.Codecs.Flake;
// ReSharper disable once InconsistentNaming
public class FLAC
{
/// <summary>Set to <c>true</c> if this algorithm is supported, <c>false</c> otherwise.</summary>
public static bool IsSupported => true;
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern nuint AARU_flac_decode_redbook_buffer(byte[] dst_buffer, nuint dst_size, byte[] src_buffer,
nuint src_size);
static extern nuint AARU_flac_decode_redbook_buffer(byte[] dstBuffer, nuint dstSize, byte[] srcBuffer,
nuint srcSize);
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern nuint AARU_flac_encode_redbook_buffer(byte[] dst_buffer, nuint dst_size, byte[] src_buffer,
nuint src_size, uint blocksize, int do_mid_side_stereo,
int loose_mid_side_stereo, string apodization,
uint max_lpc_order, uint qlp_coeff_precision,
int do_qlp_coeff_prec_search, int do_exhaustive_model_search,
uint min_residual_partition_order,
uint max_residual_partition_order, string application_id,
uint application_id_len);
static extern nuint AARU_flac_encode_redbook_buffer(byte[] dstBuffer, nuint dstSize, byte[] srcBuffer,
nuint srcSize, uint blocksize, int doMidSideStereo,
int looseMidSideStereo, string apodization,
uint maxLpcOrder, uint qlpCoeffPrecision,
int doQlpCoeffPrecSearch, int doExhaustiveModelSearch,
uint minResidualPartitionOrder,
uint maxResidualPartitionOrder, string applicationID,
uint applicationIDLen);
/// <summary>Decodes a buffer compressed with FLAC</summary>
/// <param name="source">Encoded buffer</param>
@@ -78,14 +79,14 @@ public class FLAC
/// <param name="destination">Buffer to store the compressed data</param>
/// <returns></returns>
public static int EncodeBuffer(byte[] source, byte[] destination, uint blockSize, bool doMidSideStereo,
bool looseMidSideStereo, string apodization, uint max_lpc_order,
bool looseMidSideStereo, string apodization, uint maxLpcOrder,
uint qlpCoeffPrecision, bool doQlpCoeffPrecSearch, bool doExhaustiveModelSearch,
uint minResidualPartitionOrder, uint maxResidualPartitionOrder, string applicationID)
{
if(Native.IsSupported)
return (int)AARU_flac_encode_redbook_buffer(destination, (nuint)destination.Length, source,
(nuint)source.Length, blockSize, doMidSideStereo ? 1 : 0,
looseMidSideStereo ? 1 : 0, apodization, max_lpc_order,
looseMidSideStereo ? 1 : 0, apodization, maxLpcOrder,
qlpCoeffPrecision, doQlpCoeffPrecSearch ? 1 : 0,
doExhaustiveModelSearch ? 1 : 0, minResidualPartitionOrder,
maxResidualPartitionOrder, applicationID,

View File

@@ -30,18 +30,19 @@ namespace Aaru.Compression;
using System.Runtime.InteropServices;
// ReSharper disable once InconsistentNaming
public class LZFSE
{
/// <summary>Set to <c>true</c> if this algorithm is supported, <c>false</c> otherwise.</summary>
public static bool IsSupported => Native.IsSupported;
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern nuint AARU_lzfse_decode_buffer(byte[] dst_buffer, nuint dst_size, byte[] src_buffer, nuint src_size,
byte[] scratch_buffer);
static extern nuint AARU_lzfse_decode_buffer(byte[] dstBuffer, nuint dstSize, byte[] srcBuffer, nuint srcSize,
byte[] scratchBuffer);
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern nuint AARU_lzfse_encode_buffer(byte[] dst_buffer, nuint dst_size, byte[] src_buffer, nuint src_size,
byte[] scratch_buffer);
static extern nuint AARU_lzfse_encode_buffer(byte[] dstBuffer, nuint dstSize, byte[] srcBuffer, nuint srcSize,
byte[] scratchBuffer);
/// <summary>Decodes a buffer compressed with LZFSE</summary>
/// <param name="source">Encoded buffer</param>

View File

@@ -30,17 +30,18 @@ namespace Aaru.Compression;
using System.Runtime.InteropServices;
// ReSharper disable once InconsistentNaming
public class LZIP
{
/// <summary>Set to <c>true</c> if this algorithm is supported, <c>false</c> otherwise.</summary>
public static bool IsSupported => Native.IsSupported;
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern int AARU_lzip_decode_buffer(byte[] dst_buffer, int dst_size, byte[] src_buffer, int src_size);
static extern int AARU_lzip_decode_buffer(byte[] dstBuffer, int dstSize, byte[] srcBuffer, int srcSize);
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern int AARU_lzip_encode_buffer(byte[] dst_buffer, int dst_size, byte[] src_buffer, int src_size,
int dictionary_size, int match_len_limit);
static extern int AARU_lzip_encode_buffer(byte[] dstBuffer, int dstSize, byte[] srcBuffer, int srcSize,
int dictionarySize, int matchLenLimit);
/// <summary>Decodes a buffer compressed with LZIP</summary>
/// <param name="source">Encoded buffer</param>

View File

@@ -38,11 +38,11 @@ public class LZMA
public static bool IsSupported => true;
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern int AARU_lzma_decode_buffer(byte[] dst_buffer, ref nuint dst_size, byte[] src_buffer,
ref nuint src_size, byte[] props, nuint propsSize);
static extern int AARU_lzma_decode_buffer(byte[] dstBuffer, ref nuint dstSize, byte[] srcBuffer,
ref nuint srcSize, byte[] props, nuint propsSize);
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern int AARU_lzma_encode_buffer(byte[] dst_buffer, ref nuint dst_size, byte[] src_buffer, nuint src_size,
static extern int AARU_lzma_encode_buffer(byte[] dstBuffer, ref nuint dstSize, byte[] srcBuffer, nuint srcSize,
byte[] outProps, ref nuint outPropsSize, int level, uint dictSize, int lc,
int lp, int pb, int fb, int numThreads);
@@ -90,9 +90,9 @@ public class LZMA
return (int)dstSize;
}
var _lzmaEncoderProperties = new LzmaEncoderProperties(true, (int)dictSize, fb);
var lzmaEncoderProperties = new LzmaEncoderProperties(true, (int)dictSize, fb);
using var lzmaStream = new LzmaStream(_lzmaEncoderProperties, false, new MemoryStream(destination));
using var lzmaStream = new LzmaStream(lzmaEncoderProperties, false, new MemoryStream(destination));
lzmaStream.Write(source, 0, source.Length);
properties = new byte[lzmaStream.Properties.Length];

View File

@@ -30,16 +30,17 @@ namespace Aaru.Compression;
using System.Runtime.InteropServices;
// ReSharper disable once InconsistentNaming
public class ZSTD
{
/// <summary>Set to <c>true</c> if this algorithm is supported, <c>false</c> otherwise.</summary>
public static bool IsSupported => Native.IsSupported;
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern nuint AARU_zstd_decode_buffer(byte[] dst_buffer, nuint dst_size, byte[] src_buffer, nuint src_size);
static extern nuint AARU_zstd_decode_buffer(byte[] dstBuffer, nuint dstSize, byte[] srcBuffer, nuint srcSize);
[DllImport("libAaru.Compression.Native", SetLastError = true)]
static extern nuint AARU_zstd_encode_buffer(byte[] dst_buffer, nuint dst_size, byte[] src_buffer, nuint src_size,
static extern nuint AARU_zstd_encode_buffer(byte[] dstBuffer, nuint dstSize, byte[] srcBuffer, nuint srcSize,
int compressionLevel);
/// <summary>Decodes a buffer compressed with ZSTD</summary>