General cleanup and refactor.

This commit is contained in:
2022-03-07 07:36:44 +00:00
parent bc6e432565
commit 762e3eb6d2
1321 changed files with 44657 additions and 45479 deletions

View File

@@ -26,18 +26,16 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Compression;
using System.IO;
using System.Runtime.InteropServices;
using CUETools.Codecs;
using CUETools.Codecs.Flake;
namespace Aaru.Compression;
public class FLAC
{
/// <summary>
/// Set to <c>true</c> if this algorithm is supported, <c>false</c> otherwise.
/// </summary>
/// <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)]
@@ -48,9 +46,8 @@ public class FLAC
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 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);
@@ -81,19 +78,18 @@ 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, uint qlpCoeffPrecision,
bool doQlpCoeffPrecSearch, bool doExhaustiveModelSearch,
uint minResidualPartitionOrder, uint maxResidualPartitionOrder,
string applicationID)
bool looseMidSideStereo, string apodization, uint max_lpc_order,
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, qlpCoeffPrecision,
doQlpCoeffPrecSearch ? 1 : 0,
doExhaustiveModelSearch ? 1 : 0,
minResidualPartitionOrder, maxResidualPartitionOrder,
applicationID, (uint)applicationID.Length);
looseMidSideStereo ? 1 : 0, apodization, max_lpc_order,
qlpCoeffPrecision, doQlpCoeffPrecSearch ? 1 : 0,
doExhaustiveModelSearch ? 1 : 0, minResidualPartitionOrder,
maxResidualPartitionOrder, applicationID,
(uint)applicationID.Length);
var flakeWriterSettings = new EncoderSettings
{