mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
CUETools.Flake: better use of new window functions
This commit is contained in:
@@ -1162,7 +1162,10 @@ namespace CUETools.Codecs.ALAC
|
|||||||
_windowcount = 0;
|
_windowcount = 0;
|
||||||
calculate_window(window, lpc.window_welch, WindowFunction.Welch);
|
calculate_window(window, lpc.window_welch, WindowFunction.Welch);
|
||||||
calculate_window(window, lpc.window_bartlett, WindowFunction.Bartlett);
|
calculate_window(window, lpc.window_bartlett, WindowFunction.Bartlett);
|
||||||
calculate_window(window, lpc.window_tukey, WindowFunction.Tukey);
|
calculate_window(window, (w, wsz) =>
|
||||||
|
{
|
||||||
|
lpc.window_tukey(w, wsz, 0.5);
|
||||||
|
}, WindowFunction.Tukey);
|
||||||
calculate_window(window, lpc.window_hann, WindowFunction.Hann);
|
calculate_window(window, lpc.window_hann, WindowFunction.Hann);
|
||||||
calculate_window(window, lpc.window_flattop, WindowFunction.Flattop);
|
calculate_window(window, lpc.window_flattop, WindowFunction.Flattop);
|
||||||
int tukey_parts = 2;
|
int tukey_parts = 2;
|
||||||
@@ -1171,7 +1174,7 @@ namespace CUETools.Codecs.ALAC
|
|||||||
for (int m = 0; m < tukey_parts; m++)
|
for (int m = 0; m < tukey_parts; m++)
|
||||||
calculate_window(window, (w, wsz) =>
|
calculate_window(window, (w, wsz) =>
|
||||||
{
|
{
|
||||||
lpc.window_punchout_tukey(w, wsz, 0.1,
|
lpc.window_punchout_tukey(w, wsz, 0.1, 0.1,
|
||||||
m / (tukey_parts + overlap_units),
|
m / (tukey_parts + overlap_units),
|
||||||
(m + 1 + overlap_units) / (tukey_parts + overlap_units));
|
(m + 1 + overlap_units) / (tukey_parts + overlap_units));
|
||||||
}, WindowFunction.PartialTukey);
|
}, WindowFunction.PartialTukey);
|
||||||
@@ -1183,7 +1186,7 @@ namespace CUETools.Codecs.ALAC
|
|||||||
for (int m = 0; m < tukey_parts; m++)
|
for (int m = 0; m < tukey_parts; m++)
|
||||||
calculate_window(window, (w, wsz) =>
|
calculate_window(window, (w, wsz) =>
|
||||||
{
|
{
|
||||||
lpc.window_punchout_tukey(w, wsz, 0.1,
|
lpc.window_punchout_tukey(w, wsz, 0.1, 0.1,
|
||||||
m / (tukey_parts + overlap_units),
|
m / (tukey_parts + overlap_units),
|
||||||
(m + 1 + overlap_units) / (tukey_parts + overlap_units));
|
(m + 1 + overlap_units) / (tukey_parts + overlap_units));
|
||||||
}, WindowFunction.PunchoutTukey);
|
}, WindowFunction.PunchoutTukey);
|
||||||
|
|||||||
@@ -1118,7 +1118,10 @@ namespace CUETools.Codecs.FLACCL
|
|||||||
{
|
{
|
||||||
calculate_window(task, lpc.window_welch, WindowFunction.Welch);
|
calculate_window(task, lpc.window_welch, WindowFunction.Welch);
|
||||||
calculate_window(task, lpc.window_flattop, WindowFunction.Flattop);
|
calculate_window(task, lpc.window_flattop, WindowFunction.Flattop);
|
||||||
calculate_window(task, lpc.window_tukey, WindowFunction.Tukey);
|
calculate_window(task, (w, wsz) =>
|
||||||
|
{
|
||||||
|
lpc.window_tukey(w, wsz, 0.5);
|
||||||
|
}, WindowFunction.Tukey);
|
||||||
calculate_window(task, lpc.window_hann, WindowFunction.Hann);
|
calculate_window(task, lpc.window_hann, WindowFunction.Hann);
|
||||||
calculate_window(task, lpc.window_bartlett, WindowFunction.Bartlett);
|
calculate_window(task, lpc.window_bartlett, WindowFunction.Bartlett);
|
||||||
if (task.nWindowFunctions == 0)
|
if (task.nWindowFunctions == 0)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace CUETools.Codecs.FLAKE
|
|||||||
{
|
{
|
||||||
best = new FlacSubframe();
|
best = new FlacSubframe();
|
||||||
sf = new LpcSubframeInfo();
|
sf = new LpcSubframeInfo();
|
||||||
|
best_fixed = new ulong[5];
|
||||||
lpc_ctx = new LpcContext[lpc.MAX_LPC_WINDOWS];
|
lpc_ctx = new LpcContext[lpc.MAX_LPC_WINDOWS];
|
||||||
for (int i = 0; i < lpc.MAX_LPC_WINDOWS; i++)
|
for (int i = 0; i < lpc.MAX_LPC_WINDOWS; i++)
|
||||||
lpc_ctx[i] = new LpcContext();
|
lpc_ctx[i] = new LpcContext();
|
||||||
@@ -20,6 +21,8 @@ namespace CUETools.Codecs.FLAKE
|
|||||||
samples = s;
|
samples = s;
|
||||||
obits = bps - w;
|
obits = bps - w;
|
||||||
wbits = w;
|
wbits = w;
|
||||||
|
for (int o = 0; o <= 4; o++)
|
||||||
|
best_fixed[o] = 0;
|
||||||
best.residual = r;
|
best.residual = r;
|
||||||
best.type = SubframeType.Verbatim;
|
best.type = SubframeType.Verbatim;
|
||||||
best.size = AudioSamples.UINT32_MAX;
|
best.size = AudioSamples.UINT32_MAX;
|
||||||
@@ -35,6 +38,7 @@ namespace CUETools.Codecs.FLAKE
|
|||||||
public int wbits;
|
public int wbits;
|
||||||
public int* samples;
|
public int* samples;
|
||||||
public uint done_fixed;
|
public uint done_fixed;
|
||||||
|
public ulong[] best_fixed;
|
||||||
public LpcContext[] lpc_ctx;
|
public LpcContext[] lpc_ctx;
|
||||||
public LpcSubframeInfo sf;
|
public LpcSubframeInfo sf;
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,11 +3,13 @@ namespace CUETools.Codecs.FLAKE
|
|||||||
{
|
{
|
||||||
public enum StereoMethod
|
public enum StereoMethod
|
||||||
{
|
{
|
||||||
Independent = 0,
|
Invalid,
|
||||||
Estimate = 1,
|
Independent,
|
||||||
Evaluate = 2,
|
Estimate,
|
||||||
Search = 3,
|
Evaluate,
|
||||||
EstimateX = 4,
|
Search,
|
||||||
EvaluateX = 5,
|
EstimateX,
|
||||||
|
EvaluateX,
|
||||||
|
EstimateFixed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,20 @@
|
|||||||
Hann = 4,
|
Hann = 4,
|
||||||
Flattop = 8,
|
Flattop = 8,
|
||||||
Bartlett = 16,
|
Bartlett = 16,
|
||||||
TukeyFlattop = 10,
|
Tukey2 = 32,
|
||||||
PartialTukey = 32,
|
Tukey3 = 64,
|
||||||
TukeyPartialTukey = 34,
|
Tukey4 = (1 << 7),
|
||||||
TukeyFlattopPartialTukey = 42,
|
Tukey2A = (1 << 9),
|
||||||
PunchoutTukey = 64,
|
Tukey2B = (1 << 10),
|
||||||
TukeyFlattopPartialTukeyPunchoutTukey = 106,
|
Tukey3A = (1 << 11),
|
||||||
|
Tukey3B = (1 << 12),
|
||||||
|
Tukey4A = (1 << 13),
|
||||||
|
Tukey4B = (1 << 14),
|
||||||
|
Tukey1A = (1 << 15),
|
||||||
|
Tukey1B = (1 << 16),
|
||||||
|
Tukey1X = (1 << 17),
|
||||||
|
Tukey2X = (1 << 18),
|
||||||
|
Tukey3X = (1 << 19),
|
||||||
|
Tukey4X = (1 << 20),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
public enum WindowMethod
|
public enum WindowMethod
|
||||||
{
|
{
|
||||||
|
Invalid,
|
||||||
Evaluate,
|
Evaluate,
|
||||||
Search,
|
Search,
|
||||||
Estimate,
|
Estimate,
|
||||||
|
|||||||
@@ -81,11 +81,23 @@ namespace CUETools.Codecs
|
|||||||
if (attribute is DefaultValueForModeAttribute)
|
if (attribute is DefaultValueForModeAttribute)
|
||||||
{
|
{
|
||||||
var defaultValueForMode = attribute as DefaultValueForModeAttribute;
|
var defaultValueForMode = attribute as DefaultValueForModeAttribute;
|
||||||
res &= (int)property.GetValue(this) == defaultValueForMode.m_values[index];
|
res &= property.GetValue(this).Equals(defaultValueForMode.m_values[index]);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GuessEncoderMode()
|
||||||
|
{
|
||||||
|
string defaultMode;
|
||||||
|
string[] modes = this.GetSupportedModes(out defaultMode).Split(' ');
|
||||||
|
if (modes == null || modes.Length < 1)
|
||||||
|
return -1;
|
||||||
|
for (int i = 0; i < modes.Length; i++)
|
||||||
|
if (HasDefaultValuesForMode(i))
|
||||||
|
return i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public AudioPCMConfig PCM
|
public AudioPCMConfig PCM
|
||||||
|
|||||||
@@ -11,21 +11,32 @@ namespace CUETools.Codecs
|
|||||||
return log2i((uint)v);
|
return log2i((uint)v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static readonly byte[] MultiplyDeBruijnBitPosition = new byte[32]
|
||||||
|
{
|
||||||
|
0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30,
|
||||||
|
8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31
|
||||||
|
};
|
||||||
|
|
||||||
public static int log2i(ulong v)
|
public static int log2i(ulong v)
|
||||||
{
|
{
|
||||||
int n = 0;
|
v |= v >> 1; // first round down to one less than a power of 2
|
||||||
if (0 != (v & 0xffffffff00000000)) { v >>= 32; n += 32; }
|
v |= v >> 2;
|
||||||
if (0 != (v & 0xffff0000)) { v >>= 16; n += 16; }
|
v |= v >> 4;
|
||||||
if (0 != (v & 0xff00)) { v >>= 8; n += 8; }
|
v |= v >> 8;
|
||||||
return n + byte_to_log2_table[v];
|
v |= v >> 16;
|
||||||
|
if (v >> 32 == 0)
|
||||||
|
return MultiplyDeBruijnBitPosition[(uint)((uint)v * 0x07C4ACDDU) >> 27];
|
||||||
|
return 32 + MultiplyDeBruijnBitPosition[(uint)((uint)(v >> 32) * 0x07C4ACDDU) >> 27];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int log2i(uint v)
|
public static int log2i(uint v)
|
||||||
{
|
{
|
||||||
int n = 0;
|
v |= v >> 1; // first round down to one less than a power of 2
|
||||||
if (0 != (v & 0xffff0000)) { v >>= 16; n += 16; }
|
v |= v >> 2;
|
||||||
if (0 != (v & 0xff00)) { v >>= 8; n += 8; }
|
v |= v >> 4;
|
||||||
return n + byte_to_log2_table[v];
|
v |= v >> 8;
|
||||||
|
v |= v >> 16;
|
||||||
|
return MultiplyDeBruijnBitPosition[(uint)(v * 0x07C4ACDDU) >> 27];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly byte[] byte_to_unary_table = new byte[]
|
public static readonly byte[] byte_to_unary_table = new byte[]
|
||||||
@@ -48,26 +59,6 @@ namespace CUETools.Codecs
|
|||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly byte[] byte_to_log2_table = new byte[]
|
|
||||||
{
|
|
||||||
0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
|
|
||||||
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
|
|
||||||
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
|
||||||
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
|
||||||
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
|
|
||||||
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
|
|
||||||
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
|
|
||||||
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
|
|
||||||
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
|
|
||||||
};
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private byte* buffer_m;
|
private byte* buffer_m;
|
||||||
|
|||||||
@@ -108,6 +108,12 @@ namespace CUETools.Codecs
|
|||||||
writebits(8, (byte)s[i]);
|
writebits(8, (byte)s[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void write(byte[] s)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < s.Length; i++)
|
||||||
|
writebits(8, s[i]);
|
||||||
|
}
|
||||||
|
|
||||||
public void writebits_signed(int bits, int val)
|
public void writebits_signed(int bits, int val)
|
||||||
{
|
{
|
||||||
writebits(bits, val & ((1 << bits) - 1));
|
writebits(bits, val & ((1 << bits) - 1));
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ namespace CUETools.Codecs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resource manager to use;
|
/// Resource manager to use;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int[] m_values;
|
public object[] m_values;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct the description attribute
|
/// Construct the description attribute
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
public DefaultValueForModeAttribute(params int[] values)
|
public DefaultValueForModeAttribute(params object[] values)
|
||||||
{
|
{
|
||||||
this.m_values = values;
|
this.m_values = values;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ namespace CUETools.Codecs
|
|||||||
public class lpc
|
public class lpc
|
||||||
{
|
{
|
||||||
public const int MAX_LPC_ORDER = 32;
|
public const int MAX_LPC_ORDER = 32;
|
||||||
public const int MAX_LPC_WINDOWS = 8;
|
public const int MAX_LPC_WINDOWS = 16;
|
||||||
public const int MAX_LPC_PRECISIONS = 4;
|
public const int MAX_LPC_PRECISIONS = 4;
|
||||||
public const int MAX_LPC_SECTIONS = 32;
|
public const int MAX_LPC_SECTIONS = 128;
|
||||||
|
|
||||||
public unsafe static void window_welch(float* window, int L)
|
public unsafe static void window_welch(float* window, int L)
|
||||||
{
|
{
|
||||||
@@ -47,9 +47,8 @@ namespace CUETools.Codecs
|
|||||||
window[n] = (float)(1.0 - 1.93 * Math.Cos(2.0 * Math.PI * n / N) + 1.29 * Math.Cos(4.0 * Math.PI * n / N) - 0.388 * Math.Cos(6.0 * Math.PI * n / N) + 0.0322 * Math.Cos(8.0 * Math.PI * n / N));
|
window[n] = (float)(1.0 - 1.93 * Math.Cos(2.0 * Math.PI * n / N) + 1.29 * Math.Cos(4.0 * Math.PI * n / N) - 0.388 * Math.Cos(6.0 * Math.PI * n / N) + 0.0322 * Math.Cos(8.0 * Math.PI * n / N));
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe static void window_tukey(float* window, int L)
|
public unsafe static void window_tukey(float* window, int L, double p)
|
||||||
{
|
{
|
||||||
double p = 0.5;
|
|
||||||
int z = 0;
|
int z = 0;
|
||||||
int Np = (int)(p / 2.0 * L) - z;
|
int Np = (int)(p / 2.0 * L) - z;
|
||||||
if (Np > 0)
|
if (Np > 0)
|
||||||
@@ -63,28 +62,29 @@ namespace CUETools.Codecs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe static void window_punchout_tukey(float* window, int L, double p, double start, double end)
|
public unsafe static void window_punchout_tukey(float* window, int L, double p, double p1, double start, double end)
|
||||||
{
|
{
|
||||||
int start_n = (int)(start * L);
|
int start_n = (int)(start * L);
|
||||||
int end_n = (int)(end * L);
|
int end_n = (int)(end * L);
|
||||||
int Np = (int)(p / 2.0 * L);
|
int Np = (int)(p / 2.0 * L);
|
||||||
|
int Np1 = (int)(p1 / 2.0 * L);
|
||||||
int i, n = 0;
|
int i, n = 0;
|
||||||
|
|
||||||
if (start_n != 0)
|
if (start_n != 0)
|
||||||
{
|
{
|
||||||
for (i = 1; n < Np; n++, i++)
|
for (i = 1; n < Np; n++, i++)
|
||||||
window[n] = (float)(0.5 - 0.5 * Math.Cos(Math.PI * i / Np));
|
window[n] = (float)(0.5 - 0.5 * Math.Cos(Math.PI * i / Np));
|
||||||
for (; n < start_n - Np; n++)
|
for (; n < start_n - Np1; n++)
|
||||||
window[n] = 1.0f;
|
window[n] = 1.0f;
|
||||||
for (i = Np; n < start_n; n++, i--)
|
for (i = Np1; n < start_n; n++, i--)
|
||||||
window[n] = (float)(0.5 - 0.5 * Math.Cos(Math.PI * i / Np));
|
window[n] = (float)(0.5 - 0.5 * Math.Cos(Math.PI * i / Np1));
|
||||||
}
|
}
|
||||||
for (; n < end_n; n++)
|
for (; n < end_n; n++)
|
||||||
window[n] = 0.0f;
|
window[n] = 0.0f;
|
||||||
if (end_n != L)
|
if (end_n != L)
|
||||||
{
|
{
|
||||||
for (i = 1; n < end_n + Np; n++, i++)
|
for (i = 1; n < end_n + Np1; n++, i++)
|
||||||
window[n] = (float)(0.5 - 0.5 * Math.Cos(Math.PI * i / Np));
|
window[n] = (float)(0.5 - 0.5 * Math.Cos(Math.PI * i / Np1));
|
||||||
for (; n < L - Np; n++)
|
for (; n < L - Np; n++)
|
||||||
window[n] = 1.0f;
|
window[n] = 1.0f;
|
||||||
for (i = Np; n < L; n++, i--)
|
for (i = Np; n < L; n++, i--)
|
||||||
@@ -358,11 +358,11 @@ namespace CUETools.Codecs
|
|||||||
}
|
}
|
||||||
|
|
||||||
static public unsafe void
|
static public unsafe void
|
||||||
compute_autocorr_glue(/*const*/ int* data, float* window, int offs, int sz, int min, int lag, double* autoc)
|
compute_autocorr_glue(/*const*/ int* data, float* window, int offs, int offs1, int min, int lag, double* autoc)
|
||||||
{
|
{
|
||||||
double* data1 = stackalloc double[lag + lag];
|
double* data1 = stackalloc double[lag + lag];
|
||||||
for (int i = -lag; i < lag; i++)
|
for (int i = -lag; i < lag; i++)
|
||||||
data1[i + lag] = offs + i >= 0 && offs + i < sz ? data[offs + i] * window[offs + i] : 0;
|
data1[i + lag] = offs + i >= 0 && offs + i < offs1 ? data[offs + i] * window[offs + i] : 0;
|
||||||
for (int i = min; i <= lag; ++i)
|
for (int i = min; i <= lag; ++i)
|
||||||
{
|
{
|
||||||
double temp = 0;
|
double temp = 0;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace CUETools.Codecs
|
|||||||
else if (m_type == SectionType.Data)
|
else if (m_type == SectionType.Data)
|
||||||
lpc.compute_autocorr(data + m_start, window + m_start, m_end - m_start, min_order, order, autoc);
|
lpc.compute_autocorr(data + m_start, window + m_start, m_end - m_start, min_order, order, autoc);
|
||||||
else if (m_type == SectionType.Glue)
|
else if (m_type == SectionType.Glue)
|
||||||
lpc.compute_autocorr_glue(data, window, m_start, blocksize, min_order, order, autoc);
|
lpc.compute_autocorr_glue(data, window, m_start, m_end, min_order, order, autoc);
|
||||||
else if (m_type == SectionType.OneGlue)
|
else if (m_type == SectionType.OneGlue)
|
||||||
lpc.compute_autocorr_glue(data + m_start, min_order, order, autoc);
|
lpc.compute_autocorr_glue(data + m_start, min_order, order, autoc);
|
||||||
}
|
}
|
||||||
@@ -109,6 +109,7 @@ namespace CUETools.Codecs
|
|||||||
&& w == window_segment[i1 * stride + x])
|
&& w == window_segment[i1 * stride + x])
|
||||||
alias[i1, boundaries.Count] = i;
|
alias[i1, boundaries.Count] = i;
|
||||||
}
|
}
|
||||||
|
if (boundaries.Count >= lpc.MAX_LPC_SECTIONS * 2) throw new IndexOutOfRangeException();
|
||||||
types[i, boundaries.Count] =
|
types[i, boundaries.Count] =
|
||||||
boundaries.Count >= lpc.MAX_LPC_SECTIONS * 2 - 2 ?
|
boundaries.Count >= lpc.MAX_LPC_SECTIONS * 2 - 2 ?
|
||||||
LpcWindowSection.SectionType.Data : w == 0.0 ?
|
LpcWindowSection.SectionType.Data : w == 0.0 ?
|
||||||
@@ -143,6 +144,7 @@ namespace CUETools.Codecs
|
|||||||
// leave room for glue
|
// leave room for glue
|
||||||
if (secs[i] >= lpc.MAX_LPC_SECTIONS - 1)
|
if (secs[i] >= lpc.MAX_LPC_SECTIONS - 1)
|
||||||
{
|
{
|
||||||
|
throw new IndexOutOfRangeException();
|
||||||
window_sections[secs[i] - 1].m_type = LpcWindowSection.SectionType.Data;
|
window_sections[secs[i] - 1].m_type = LpcWindowSection.SectionType.Data;
|
||||||
window_sections[secs[i] - 1].m_end = boundaries[j + 1];
|
window_sections[secs[i] - 1].m_end = boundaries[j + 1];
|
||||||
continue;
|
continue;
|
||||||
@@ -165,6 +167,7 @@ namespace CUETools.Codecs
|
|||||||
secs[i]--;
|
secs[i]--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (section_id >= lpc.MAX_LPC_SECTIONS) throw new IndexOutOfRangeException();
|
||||||
if (alias_set[i, j] != 0
|
if (alias_set[i, j] != 0
|
||||||
&& types[i, j] != SectionType.Zero
|
&& types[i, j] != SectionType.Zero
|
||||||
&& section_id < lpc.MAX_LPC_SECTIONS)
|
&& section_id < lpc.MAX_LPC_SECTIONS)
|
||||||
@@ -174,7 +177,7 @@ namespace CUETools.Codecs
|
|||||||
sections[i1 * lpc.MAX_LPC_SECTIONS + secs[i1] - 1].m_id = section_id;
|
sections[i1 * lpc.MAX_LPC_SECTIONS + secs[i1] - 1].m_id = section_id;
|
||||||
section_id++;
|
section_id++;
|
||||||
}
|
}
|
||||||
// TODO: section_id for glue?
|
// TODO: section_id for glue? nontrivial, must be sure next sections are the same size
|
||||||
if (sec > 0
|
if (sec > 0
|
||||||
&& (window_sections[sec].m_type == SectionType.One || window_sections[sec].m_type == SectionType.OneLarge)
|
&& (window_sections[sec].m_type == SectionType.One || window_sections[sec].m_type == SectionType.OneLarge)
|
||||||
&& window_sections[sec].m_end - window_sections[sec].m_start >= lpc.MAX_LPC_ORDER
|
&& window_sections[sec].m_end - window_sections[sec].m_start >= lpc.MAX_LPC_ORDER
|
||||||
@@ -203,6 +206,15 @@ namespace CUETools.Codecs
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < _windowcount; i++)
|
for (int i = 0; i < _windowcount; i++)
|
||||||
{
|
{
|
||||||
|
for (int s = 0; s < secs[i]; s++)
|
||||||
|
{
|
||||||
|
LpcWindowSection* window_sections = sections + i * lpc.MAX_LPC_SECTIONS;
|
||||||
|
if (window_sections[s].m_type == SectionType.Glue
|
||||||
|
|| window_sections[s].m_type == SectionType.OneGlue)
|
||||||
|
{
|
||||||
|
window_sections[s].m_end = window_sections[s + 1].m_end;
|
||||||
|
}
|
||||||
|
}
|
||||||
while (secs[i] < lpc.MAX_LPC_SECTIONS)
|
while (secs[i] < lpc.MAX_LPC_SECTIONS)
|
||||||
{
|
{
|
||||||
LpcWindowSection* window_sections = sections + i * lpc.MAX_LPC_SECTIONS;
|
LpcWindowSection* window_sections = sections + i * lpc.MAX_LPC_SECTIONS;
|
||||||
|
|||||||
@@ -94,21 +94,23 @@ namespace CUETools.FlakeExe
|
|||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine(" -0 .. -11 Compression level, default 7; 9..11 require --lax");
|
Console.WriteLine(" -0 .. -11 Compression level, default 7; 9..11 require --lax");
|
||||||
Console.WriteLine(" -o <file> Output filename, or \"-\" for stdout, or nul.");
|
Console.WriteLine(" -o <file> Output filename, or \"-\" for stdout, or nul.");
|
||||||
Console.WriteLine(" -p # Padding bytes.");
|
Console.WriteLine(" -P, --padding # Padding bytes.");
|
||||||
Console.WriteLine(" -q --quiet Quiet mode.");
|
Console.WriteLine(" -q, --quiet Quiet mode.");
|
||||||
Console.WriteLine(" --lax Allow non-subset modes");
|
Console.WriteLine(" -f, --force Overwrite existing files.");
|
||||||
Console.WriteLine(" --verify Verify during encoding.");
|
Console.WriteLine(" -V, --verify Verify a correct encoding.");
|
||||||
|
Console.WriteLine(" -T, --tag FIELD=VAL Add a FLAC tag; may appear multiple times");
|
||||||
|
Console.WriteLine(" --lax Allow encoder to generate non-Subset files");
|
||||||
Console.WriteLine(" --no-md5 Don't compute MD5 hash.");
|
Console.WriteLine(" --no-md5 Don't compute MD5 hash.");
|
||||||
Console.WriteLine(" --no-seektable Don't generate a seektable.");
|
Console.WriteLine(" --no-seektable Don't generate a seektable.");
|
||||||
Console.WriteLine(" --ignore-chunk-sizes Ignore WAV length (for pipe input)");
|
Console.WriteLine(" --ignore-chunk-sizes Ignore data chunk sizes in WAVE files (for pipe input)");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine("Advanced Options:");
|
Console.WriteLine("Advanced Options:");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine(" -b # Block size.");
|
Console.WriteLine(" -b # Block size.");
|
||||||
Console.WriteLine(" -v # Variable block size mode (0,4).");
|
|
||||||
Console.WriteLine(" -t <type> Prediction type (fixed,levinson,search).");
|
Console.WriteLine(" -t <type> Prediction type (fixed,levinson,search).");
|
||||||
Console.WriteLine(" -s <method> Stereo decorrelation (independent,estimate,evaluate,search).");
|
Console.WriteLine(" -s <method> Stereo decorrelation (independent,estimate,evaluate,search).");
|
||||||
Console.WriteLine(" -r #[,#] Rice partition order {max} or {min},{max} (0..8).");
|
Console.WriteLine(" -r #[,#] Rice partition order {max} or {min},{max} (0..8).");
|
||||||
|
Console.WriteLine(" --vbr # Variable block size mode (0,4).");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine("LPC options:");
|
Console.WriteLine("LPC options:");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
@@ -134,15 +136,9 @@ namespace CUETools.FlakeExe
|
|||||||
DateTime start = DateTime.Now;
|
DateTime start = DateTime.Now;
|
||||||
TimeSpan lastPrint = TimeSpan.FromMilliseconds(0);
|
TimeSpan lastPrint = TimeSpan.FromMilliseconds(0);
|
||||||
bool debug = false, quiet = false;
|
bool debug = false, quiet = false;
|
||||||
string prediction_type = null;
|
|
||||||
string stereo_method = null;
|
|
||||||
string window_method = null;
|
|
||||||
string order_method = null;
|
string order_method = null;
|
||||||
string window_function = null;
|
|
||||||
string input_file = null;
|
string input_file = null;
|
||||||
string output_file = null;
|
string output_file = null;
|
||||||
int min_precision = -1, max_precision = -1,
|
|
||||||
estimation_depth = -1;
|
|
||||||
int skip_a = 0, skip_b = 0;
|
int skip_a = 0, skip_b = 0;
|
||||||
int intarg = -1, vbr_mode = -1, magic = -1;
|
int intarg = -1, vbr_mode = -1, magic = -1;
|
||||||
bool do_seektable = true;
|
bool do_seektable = true;
|
||||||
@@ -151,6 +147,7 @@ namespace CUETools.FlakeExe
|
|||||||
var settings = new FlakeWriterSettings() { AllowNonSubset = true };
|
var settings = new FlakeWriterSettings() { AllowNonSubset = true };
|
||||||
bool allowNonSubset = false;
|
bool allowNonSubset = false;
|
||||||
bool ignore_chunk_sizes = false;
|
bool ignore_chunk_sizes = false;
|
||||||
|
bool force = false;
|
||||||
#if FINETUNE
|
#if FINETUNE
|
||||||
int finetune_depth = -1;
|
int finetune_depth = -1;
|
||||||
#endif
|
#endif
|
||||||
@@ -158,13 +155,17 @@ namespace CUETools.FlakeExe
|
|||||||
for (int arg = 0; arg < args.Length; arg++)
|
for (int arg = 0; arg < args.Length; arg++)
|
||||||
{
|
{
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
if (args[arg].Length == 0)
|
if (args[arg].Length == 0)
|
||||||
ok = false;
|
ok = false;
|
||||||
else if (args[arg] == "--debug")
|
else if (args[arg] == "--debug")
|
||||||
debug = true;
|
debug = true;
|
||||||
|
else if ((args[arg] == "-f" || args[arg] == "--force"))
|
||||||
|
force = true;
|
||||||
else if ((args[arg] == "-q" || args[arg] == "--quiet"))
|
else if ((args[arg] == "-q" || args[arg] == "--quiet"))
|
||||||
quiet = true;
|
quiet = true;
|
||||||
else if (args[arg] == "--verify")
|
else if ((args[arg] == "-V" || args[arg] == "--verify"))
|
||||||
settings.DoVerify = true;
|
settings.DoVerify = true;
|
||||||
else if (args[arg] == "--no-seektable")
|
else if (args[arg] == "--no-seektable")
|
||||||
do_seektable = false;
|
do_seektable = false;
|
||||||
@@ -178,16 +179,22 @@ namespace CUETools.FlakeExe
|
|||||||
buffered = true;
|
buffered = true;
|
||||||
else if ((args[arg] == "-o" || args[arg] == "--output") && ++arg < args.Length)
|
else if ((args[arg] == "-o" || args[arg] == "--output") && ++arg < args.Length)
|
||||||
output_file = args[arg];
|
output_file = args[arg];
|
||||||
|
else if ((args[arg] == "-T" || args[arg] == "--tag") && ++arg < args.Length)
|
||||||
|
{
|
||||||
|
var tags = settings.Tags != null ? new List<string>(settings.Tags) : new List<string>();
|
||||||
|
tags.Add(args[arg]);
|
||||||
|
settings.Tags = tags.ToArray();
|
||||||
|
}
|
||||||
else if ((args[arg] == "-t" || args[arg] == "--prediction-type") && ++arg < args.Length)
|
else if ((args[arg] == "-t" || args[arg] == "--prediction-type") && ++arg < args.Length)
|
||||||
prediction_type = args[arg];
|
settings.PredictionType = Flake.LookupPredictionType(args[arg]);
|
||||||
else if ((args[arg] == "-s" || args[arg] == "--stereo") && ++arg < args.Length)
|
else if ((args[arg] == "-s" || args[arg] == "--stereo") && ++arg < args.Length)
|
||||||
stereo_method = args[arg];
|
settings.StereoMethod = Flake.LookupStereoMethod(args[arg]);
|
||||||
else if ((args[arg] == "-m" || args[arg] == "--order-method") && ++arg < args.Length)
|
else if ((args[arg] == "-m" || args[arg] == "--order-method") && ++arg < args.Length)
|
||||||
order_method = args[arg];
|
order_method = args[arg];
|
||||||
else if ((args[arg] == "-w" || args[arg] == "--window") && ++arg < args.Length)
|
else if ((args[arg] == "-w" || args[arg] == "--window") && ++arg < args.Length)
|
||||||
window_function = args[arg];
|
settings.WindowFunctions = Flake.LookupWindowFunction(args[arg]);
|
||||||
else if (args[arg] == "--window-method" && ++arg < args.Length)
|
else if (args[arg] == "--window-method" && ++arg < args.Length)
|
||||||
window_method = args[arg];
|
settings.WindowMethod = Flake.LookupWindowMethod(args[arg]);
|
||||||
else if ((args[arg] == "-r" || args[arg] == "--partition-order") && ++arg < args.Length)
|
else if ((args[arg] == "-r" || args[arg] == "--partition-order") && ++arg < args.Length)
|
||||||
{
|
{
|
||||||
int min_partition_order, max_partition_order;
|
int min_partition_order, max_partition_order;
|
||||||
@@ -210,7 +217,7 @@ namespace CUETools.FlakeExe
|
|||||||
|| (int.TryParse(args[arg], out max_lpc_order)
|
|| (int.TryParse(args[arg], out max_lpc_order)
|
||||||
&& (settings.MaxLPCOrder = max_lpc_order) != -1);
|
&& (settings.MaxLPCOrder = max_lpc_order) != -1);
|
||||||
}
|
}
|
||||||
else if ((args[arg] == "-f" || args[arg] == "--fixed-order") && ++arg < args.Length)
|
else if ((args[arg] == "--fixed-order") && ++arg < args.Length)
|
||||||
{
|
{
|
||||||
int min_fixed_order, max_fixed_order;
|
int min_fixed_order, max_fixed_order;
|
||||||
ok = (args[arg].Split(',').Length == 2
|
ok = (args[arg].Split(',').Length == 2
|
||||||
@@ -229,19 +236,30 @@ namespace CUETools.FlakeExe
|
|||||||
int.TryParse(args[arg], out skip_a);
|
int.TryParse(args[arg], out skip_a);
|
||||||
}
|
}
|
||||||
else if ((args[arg] == "-e" || args[arg] == "--estimation-depth") && ++arg < args.Length)
|
else if ((args[arg] == "-e" || args[arg] == "--estimation-depth") && ++arg < args.Length)
|
||||||
ok = int.TryParse(args[arg], out estimation_depth);
|
{
|
||||||
|
settings.EstimationDepth = int.Parse(args[arg]);
|
||||||
|
}
|
||||||
|
else if (args[arg] == "--tukey-parts" && ++arg < args.Length)
|
||||||
|
settings.TukeyParts = int.Parse(args[arg]);
|
||||||
|
else if (args[arg] == "--tukey-overlap" && ++arg < args.Length)
|
||||||
|
settings.TukeyOverlap = double.Parse(args[arg]);
|
||||||
|
else if (args[arg] == "--tukey-p" && ++arg < args.Length)
|
||||||
|
settings.TukeyP = double.Parse(args[arg]);
|
||||||
else if ((args[arg] == "-c" || args[arg] == "--max-precision") && ++arg < args.Length)
|
else if ((args[arg] == "-c" || args[arg] == "--max-precision") && ++arg < args.Length)
|
||||||
{
|
{
|
||||||
|
int min_precision = -1, max_precision = -1;
|
||||||
ok = (args[arg].Split(',').Length == 2 &&
|
ok = (args[arg].Split(',').Length == 2 &&
|
||||||
int.TryParse(args[arg].Split(',')[0], out min_precision) &&
|
int.TryParse(args[arg].Split(',')[0], out min_precision) &&
|
||||||
int.TryParse(args[arg].Split(',')[1], out max_precision)) ||
|
int.TryParse(args[arg].Split(',')[1], out max_precision)) ||
|
||||||
int.TryParse(args[arg], out max_precision);
|
int.TryParse(args[arg], out max_precision);
|
||||||
|
settings.MinPrecisionSearch = min_precision;
|
||||||
|
settings.MaxPrecisionSearch = max_precision;
|
||||||
}
|
}
|
||||||
else if ((args[arg] == "-v" || args[arg] == "--vbr"))
|
else if (args[arg] == "--vbr")
|
||||||
ok = (++arg < args.Length) && int.TryParse(args[arg], out vbr_mode);
|
ok = (++arg < args.Length) && int.TryParse(args[arg], out vbr_mode);
|
||||||
else if ((args[arg] == "-b" || args[arg] == "--blocksize") && ++arg < args.Length && int.TryParse(args[arg], out intarg))
|
else if ((args[arg] == "-b" || args[arg] == "--blocksize") && ++arg < args.Length && int.TryParse(args[arg], out intarg))
|
||||||
settings.BlockSize = intarg;
|
settings.BlockSize = intarg;
|
||||||
else if ((args[arg] == "-p" || args[arg] == "--padding") && ++arg < args.Length && int.TryParse(args[arg], out intarg))
|
else if ((args[arg] == "-P" || args[arg] == "--padding") && ++arg < args.Length && int.TryParse(args[arg], out intarg))
|
||||||
settings.Padding = intarg;
|
settings.Padding = intarg;
|
||||||
else if (args[arg] == "--magic" && ++arg < args.Length)
|
else if (args[arg] == "--magic" && ++arg < args.Length)
|
||||||
ok = int.TryParse(args[arg], out magic);
|
ok = int.TryParse(args[arg], out magic);
|
||||||
@@ -266,6 +284,14 @@ namespace CUETools.FlakeExe
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Usage();
|
||||||
|
Console.WriteLine("");
|
||||||
|
Console.WriteLine("{0}: {1}", args[arg - 1], ex.Message);
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (input_file == null || ((input_file == "-" || Path.GetExtension(input_file) == ".flac") && output_file == null))
|
if (input_file == null || ((input_file == "-" || Path.GetExtension(input_file) == ".flac") && output_file == null))
|
||||||
{
|
{
|
||||||
Usage();
|
Usage();
|
||||||
@@ -274,8 +300,8 @@ namespace CUETools.FlakeExe
|
|||||||
|
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
{
|
{
|
||||||
Console.WriteLine("CUETools.Flake, Copyright (C) 2009-2013 Grigory Chudov.");
|
Console.WriteLine("CUETools.Flake, Copyright (C) 2009-2014 Grigory Chudov.");
|
||||||
Console.WriteLine("Based on Flake encoder by Justin Ruggles, <http://flake-enc.sourceforge.net/>.");
|
Console.WriteLine("Initially based on Flake encoder by Justin Ruggles.");
|
||||||
Console.WriteLine("This is free software under the GNU GPLv3+ license; There is NO WARRANTY, to");
|
Console.WriteLine("This is free software under the GNU GPLv3+ license; There is NO WARRANTY, to");
|
||||||
Console.WriteLine("the extent permitted by law. <http://www.gnu.org/licenses/> for details.");
|
Console.WriteLine("the extent permitted by law. <http://www.gnu.org/licenses/> for details.");
|
||||||
}
|
}
|
||||||
@@ -342,6 +368,13 @@ namespace CUETools.FlakeExe
|
|||||||
audioSource = new AudioPipe(audioSource, 0x10000);
|
audioSource = new AudioPipe(audioSource, 0x10000);
|
||||||
if (output_file == null)
|
if (output_file == null)
|
||||||
output_file = Path.ChangeExtension(input_file, "flac");
|
output_file = Path.ChangeExtension(input_file, "flac");
|
||||||
|
if (File.Exists(output_file) && !force)
|
||||||
|
{
|
||||||
|
Usage();
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine("File '{0}' already exists.", output_file);
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
settings.PCM = audioSource.PCM;
|
settings.PCM = audioSource.PCM;
|
||||||
settings.AllowNonSubset = allowNonSubset;
|
settings.AllowNonSubset = allowNonSubset;
|
||||||
FlakeWriter flake;
|
FlakeWriter flake;
|
||||||
@@ -354,22 +387,8 @@ namespace CUETools.FlakeExe
|
|||||||
settings);
|
settings);
|
||||||
flake.FinalSampleCount = audioSource.Length < 0 ? -1 : audioSource.Length - skip_a - skip_b;
|
flake.FinalSampleCount = audioSource.Length < 0 ? -1 : audioSource.Length - skip_a - skip_b;
|
||||||
|
|
||||||
if (prediction_type != null)
|
|
||||||
flake.PredictionType = Flake.LookupPredictionType(prediction_type);
|
|
||||||
if (stereo_method != null)
|
|
||||||
flake.StereoMethod = Flake.LookupStereoMethod(stereo_method);
|
|
||||||
if (window_method != null)
|
|
||||||
flake.WindowMethod = Flake.LookupWindowMethod(window_method);
|
|
||||||
if (order_method != null)
|
if (order_method != null)
|
||||||
flake.OrderMethod = Flake.LookupOrderMethod(order_method);
|
flake.OrderMethod = Flake.LookupOrderMethod(order_method);
|
||||||
if (window_function != null)
|
|
||||||
flake.WindowFunction = Flake.LookupWindowFunction(window_function);
|
|
||||||
if (min_precision >= 0)
|
|
||||||
flake.MinPrecisionSearch = min_precision;
|
|
||||||
if (max_precision >= 0)
|
|
||||||
flake.MaxPrecisionSearch = max_precision;
|
|
||||||
if (estimation_depth >= 0)
|
|
||||||
flake.EstimationDepth = estimation_depth;
|
|
||||||
if (vbr_mode >= 0)
|
if (vbr_mode >= 0)
|
||||||
flake.VBRMode = vbr_mode;
|
flake.VBRMode = vbr_mode;
|
||||||
if (magic >= 0)
|
if (magic >= 0)
|
||||||
@@ -479,20 +498,23 @@ namespace CUETools.FlakeExe
|
|||||||
{
|
{
|
||||||
settings = flake.Settings as FlakeWriterSettings;
|
settings = flake.Settings as FlakeWriterSettings;
|
||||||
Console.SetOut(stdout);
|
Console.SetOut(stdout);
|
||||||
Console.Out.WriteLine("{17}\t{0}\t{1:0.00}\t{2}\t{3}\t{4}\t{5}\t{6}..{7}\t{8}..{9}\t{10}..{11}\t{12}..{13}\t{14}\t{15}\t{16}\t{18}",
|
Console.Out.WriteLine("{17}\t{0}\t{1:0.000}\t{2}\t{3}\t{4}\t{5}\t{6}..{7}\t{8}..{9}\t{10}..{11}\t{12}..{13}\t{14}\t{15}\t{16}\t{18}",
|
||||||
flake.TotalSize,
|
flake.TotalSize,
|
||||||
flake.UserProcessorTime.TotalSeconds > 0 ? flake.UserProcessorTime.TotalSeconds : totalElapsed.TotalSeconds,
|
flake.UserProcessorTime.TotalSeconds > 0 ? flake.UserProcessorTime.TotalSeconds : totalElapsed.TotalSeconds,
|
||||||
flake.PredictionType.ToString().PadRight(15),
|
settings.PredictionType.ToString().PadRight(15),
|
||||||
flake.StereoMethod.ToString().PadRight(15),
|
settings.StereoMethod.ToString().PadRight(15),
|
||||||
(flake.OrderMethod.ToString() + "(" + flake.EstimationDepth.ToString() + ")").PadRight(15),
|
(flake.OrderMethod.ToString() + "(" + settings.EstimationDepth.ToString() + ")").PadRight(15),
|
||||||
(flake.WindowMethod.ToString().PadRight(10) + "(" +
|
(settings.WindowMethod.ToString().PadRight(10) + "(" +
|
||||||
((flake.WindowFunction & WindowFunction.Tukey) != 0 ? "T" : " ") +
|
((settings.WindowFunctions & WindowFunction.Tukey1X) != 0 ? "X" : (settings.WindowFunctions & WindowFunction.Tukey) != 0 ? "T" : (settings.WindowFunctions & WindowFunction.Tukey1A) != 0 ? "A" : (settings.WindowFunctions & WindowFunction.Tukey1B) != 0 ? "B" : " ") +
|
||||||
((flake.WindowFunction & WindowFunction.PartialTukey) != 0 ? "P" : " ") +
|
((settings.WindowFunctions & WindowFunction.Tukey2X) != 0 ? "X" : (settings.WindowFunctions & WindowFunction.Tukey2) != 0 ? "2" : (settings.WindowFunctions & WindowFunction.Tukey2A) != 0 ? "A" : (settings.WindowFunctions & WindowFunction.Tukey2B) != 0 ? "B" : " ") +
|
||||||
(((flake.WindowFunction & WindowFunction.PunchoutTukey) != 0 ? "O" : "") +
|
((settings.WindowFunctions & WindowFunction.Tukey3X) != 0 ? "X" : (settings.WindowFunctions & WindowFunction.Tukey3) != 0 ? "3" : (settings.WindowFunctions & WindowFunction.Tukey3A) != 0 ? "A" : (settings.WindowFunctions & WindowFunction.Tukey3B) != 0 ? "B" : " ") +
|
||||||
((flake.WindowFunction & WindowFunction.Welch) == 0 ? "" : "W") +
|
((settings.WindowFunctions & WindowFunction.Tukey4X) != 0 ? "X" : ((settings.WindowFunctions & WindowFunction.Tukey4) != 0 ? "4" : (settings.WindowFunctions & WindowFunction.Tukey4A) != 0 ? "A" : (settings.WindowFunctions & WindowFunction.Tukey4B) != 0 ? "B" : " ") +
|
||||||
((flake.WindowFunction & WindowFunction.Hann) == 0 ? "" : "H") +
|
((settings.WindowFunctions & WindowFunction.Welch) == 0 ? "" : "W") +
|
||||||
((flake.WindowFunction & WindowFunction.Flattop) == 0 ? "" : "F") +
|
((settings.WindowFunctions & WindowFunction.Hann) == 0 ? "" : "H") +
|
||||||
((flake.WindowFunction & WindowFunction.Bartlett) == 0 ? "" : "B")).PadRight(1))
|
((settings.WindowFunctions & WindowFunction.Flattop) == 0 ? "" : "F") +
|
||||||
|
((settings.WindowFunctions & WindowFunction.Bartlett) == 0 ? "" : "B")).PadRight(1))
|
||||||
|
+ ((settings.WindowFunctions & (WindowFunction.Tukey1X|WindowFunction.Tukey2X|WindowFunction.Tukey2X|WindowFunction.Tukey3X|WindowFunction.Tukey4X)) != 0 ?
|
||||||
|
("," + settings.TukeyOverlap.ToString("F3").PadLeft(6) + "," + settings.TukeyP.ToString("F3")) : "").PadRight(13)
|
||||||
+")",
|
+")",
|
||||||
settings.MinPartitionOrder,
|
settings.MinPartitionOrder,
|
||||||
settings.MaxPartitionOrder,
|
settings.MaxPartitionOrder,
|
||||||
@@ -500,22 +522,13 @@ namespace CUETools.FlakeExe
|
|||||||
settings.MaxLPCOrder,
|
settings.MaxLPCOrder,
|
||||||
settings.MinFixedOrder,
|
settings.MinFixedOrder,
|
||||||
settings.MaxFixedOrder,
|
settings.MaxFixedOrder,
|
||||||
flake.MinPrecisionSearch,
|
settings.MinPrecisionSearch,
|
||||||
flake.MaxPrecisionSearch,
|
settings.MaxPrecisionSearch,
|
||||||
flake.Settings.BlockSize,
|
flake.Settings.BlockSize,
|
||||||
flake.VBRMode,
|
flake.VBRMode,
|
||||||
coeffs ?? "",
|
coeffs ?? "",
|
||||||
audioSource.Position * audioSource.PCM.BlockAlign,
|
audioSource.Position * audioSource.PCM.BlockAlign,
|
||||||
(flake.PredictionType == PredictionType.Search && flake.StereoMethod == StereoMethod.Evaluate && flake.WindowMethod == WindowMethod.EvaluateN && flake.WindowFunction == (WindowFunction.PunchoutTukey | WindowFunction.PartialTukey | WindowFunction.Tukey) && flake.EstimationDepth == 2 && flake.MinPrecisionSearch == 0 && settings.HasDefaultValuesForMode(8)) ? "8" :
|
settings.GuessEncoderMode().ToString().Replace("-1","?")
|
||||||
(flake.PredictionType == PredictionType.Levinson && flake.StereoMethod == StereoMethod.Evaluate && flake.WindowMethod == WindowMethod.EvaluateN && flake.WindowFunction == (WindowFunction.PunchoutTukey | WindowFunction.PartialTukey | WindowFunction.Tukey) && flake.EstimationDepth == 1 && flake.MinPrecisionSearch == 1 && settings.HasDefaultValuesForMode(7)) ? "7" :
|
|
||||||
(flake.PredictionType == PredictionType.Levinson && flake.StereoMethod == StereoMethod.Evaluate && flake.WindowMethod == WindowMethod.EstimateN && flake.WindowFunction == (WindowFunction.PunchoutTukey | WindowFunction.PartialTukey) && flake.EstimationDepth == 1 && flake.MinPrecisionSearch == 1 && settings.HasDefaultValuesForMode(6)) ? "6" :
|
|
||||||
(flake.PredictionType == PredictionType.Levinson && flake.StereoMethod == StereoMethod.Evaluate && flake.WindowMethod == WindowMethod.Estimate && flake.WindowFunction == WindowFunction.PunchoutTukey && flake.EstimationDepth == 1 && flake.MinPrecisionSearch == 1 && settings.HasDefaultValuesForMode(5)) ? "5" :
|
|
||||||
(flake.PredictionType == PredictionType.Levinson && flake.StereoMethod == StereoMethod.Estimate && flake.WindowMethod == WindowMethod.Estimate && flake.WindowFunction == WindowFunction.PunchoutTukey && flake.EstimationDepth == 2 && flake.MinPrecisionSearch == 1 && settings.HasDefaultValuesForMode(4)) ? "4" :
|
|
||||||
(flake.PredictionType == PredictionType.Levinson && flake.StereoMethod == StereoMethod.Estimate && flake.WindowMethod == WindowMethod.Estimate && flake.WindowFunction == WindowFunction.PunchoutTukey && flake.EstimationDepth == 1 && flake.MinPrecisionSearch == 1 && settings.HasDefaultValuesForMode(3)) ? "3" :
|
|
||||||
(flake.PredictionType == PredictionType.Levinson && flake.StereoMethod == StereoMethod.Estimate && flake.WindowMethod == WindowMethod.Estimate && flake.WindowFunction == WindowFunction.PartialTukey && flake.EstimationDepth == 1 && flake.MinPrecisionSearch == 1 && settings.HasDefaultValuesForMode(2)) ? "2" :
|
|
||||||
(flake.PredictionType == PredictionType.Fixed && flake.StereoMethod == StereoMethod.Independent && flake.WindowMethod == WindowMethod.Estimate && flake.MinPrecisionSearch == 1 && flake.WindowFunction == WindowFunction.Tukey && settings.HasDefaultValuesForMode(1)) ? "1" :
|
|
||||||
(flake.PredictionType == PredictionType.Fixed && flake.StereoMethod == StereoMethod.Independent && flake.WindowMethod == WindowMethod.Estimate && flake.MinPrecisionSearch == 1 && flake.WindowFunction == WindowFunction.Tukey && settings.HasDefaultValuesForMode(0)) ? "0" :
|
|
||||||
"?"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user