2009-08-22 22:13:03 +00:00
|
|
|
/**
|
|
|
|
|
* CUETools.Flake: pure managed FLAC audio encoder
|
2020-01-30 18:13:46 +01:00
|
|
|
* Copyright (c) 2009-2020 Grigory Chudov
|
2009-08-22 22:13:03 +00:00
|
|
|
* Based on Flake encoder, http://flake-enc.sourceforge.net/
|
|
|
|
|
* Copyright (c) 2006-2009 Justin Ruggles
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
*/
|
2009-08-17 03:39:53 +00:00
|
|
|
using System;
|
|
|
|
|
|
2018-03-25 17:24:27 -04:00
|
|
|
namespace CUETools.Codecs.Flake
|
2009-08-17 03:39:53 +00:00
|
|
|
{
|
2018-03-11 17:07:48 -04:00
|
|
|
public class FlakeConstants
|
2009-08-17 03:39:53 +00:00
|
|
|
{
|
|
|
|
|
public const int MAX_BLOCKSIZE = 65535;
|
|
|
|
|
public const int MAX_RICE_PARAM = 14;
|
|
|
|
|
public const int MAX_PARTITION_ORDER = 8;
|
|
|
|
|
public const int MAX_PARTITIONS = 1 << MAX_PARTITION_ORDER;
|
2009-08-17 20:16:56 +00:00
|
|
|
|
2009-08-20 04:09:53 +00:00
|
|
|
public const int FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */
|
|
|
|
|
public const int FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */
|
|
|
|
|
public const int FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */
|
|
|
|
|
|
2009-08-17 20:16:56 +00:00
|
|
|
public static readonly int[] flac_samplerates = new int[16] {
|
2013-03-11 23:02:25 -04:00
|
|
|
0, 88200, 176400, 192000,
|
2009-08-17 20:16:56 +00:00
|
|
|
8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000,
|
|
|
|
|
0, 0, 0, 0
|
|
|
|
|
};
|
2013-06-18 20:45:53 -04:00
|
|
|
//1100 : get 8 bit sample rate (in kHz) from end of header
|
|
|
|
|
//1101 : get 16 bit sample rate (in Hz) from end of header
|
|
|
|
|
//1110 : get 16 bit sample rate (in tens of Hz) from end of header
|
2009-08-17 20:16:56 +00:00
|
|
|
public static readonly int[] flac_blocksizes = new int[15] { 0, 192, 576, 1152, 2304, 4608, 0, 0, 256, 512, 1024, 2048, 4096, 8192, 16384 };
|
2013-06-18 20:45:53 -04:00
|
|
|
//0110 : get 8 bit (blocksize-1) from end of header
|
|
|
|
|
//0111 : get 16 bit (blocksize-1) from end of header
|
2009-08-17 20:16:56 +00:00
|
|
|
public static readonly int[] flac_bitdepths = new int[8] { 0, 8, 12, 0, 16, 20, 24, 0 };
|
|
|
|
|
|
2009-08-17 03:39:53 +00:00
|
|
|
public static PredictionType LookupPredictionType(string name)
|
|
|
|
|
{
|
2009-08-20 04:09:53 +00:00
|
|
|
return (PredictionType)(Enum.Parse(typeof(PredictionType), name, true));
|
2009-08-17 03:39:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static StereoMethod LookupStereoMethod(string name)
|
|
|
|
|
{
|
2009-08-20 04:09:53 +00:00
|
|
|
return (StereoMethod)(Enum.Parse(typeof(StereoMethod), name, true));
|
2009-08-17 03:39:53 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-24 16:11:22 +00:00
|
|
|
public static WindowMethod LookupWindowMethod(string name)
|
|
|
|
|
{
|
|
|
|
|
return (WindowMethod)(Enum.Parse(typeof(WindowMethod), name, true));
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-17 03:39:53 +00:00
|
|
|
public static OrderMethod LookupOrderMethod(string name)
|
|
|
|
|
{
|
2009-08-20 04:09:53 +00:00
|
|
|
return (OrderMethod)(Enum.Parse(typeof(OrderMethod), name, true));
|
2009-08-17 03:39:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static WindowFunction LookupWindowFunction(string name)
|
|
|
|
|
{
|
2009-08-20 04:09:53 +00:00
|
|
|
return (WindowFunction)(Enum.Parse(typeof(WindowFunction), name, true));
|
2009-08-17 03:39:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|