diff --git a/doc/Doxyfile b/doc/Doxyfile
new file mode 100644
index 00000000..7f4fcc9a
--- /dev/null
+++ b/doc/Doxyfile
@@ -0,0 +1,946 @@
+# Doxyfile 1.2.16
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = FLAC
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = 1.0.3
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = doxytmp
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Brazilian, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
+# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Korean,
+# Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Slovene,
+# Spanish, Swedish and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these class will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
+# members of a class in the documentation of that class as if those members were
+# ordinary class members. Constructors, destructors and assignment operators of
+# the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH =
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower case letters. If set to YES upper case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like the Qt-style comments (thus requiring an
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# reimplements.
+
+INHERIT_DOCS = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES = "assert=\par Assertions:\n"
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consist of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C.
+# For instance some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
+# only. Doxygen will then generate output that is more tailored for Java.
+# For instance namespaces will be presented as packages, qualified scopes
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = ../include/FLAC ../include/FLAC++
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
+# *.h++ *.idl *.odl
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
+# that are symbolic links (a Unix filesystem feature) are excluded from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+
+EXCLUDE_PATTERNS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command , where
+# is the value of the INPUT_FILTER tag, and is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+
+INPUT_FILTER =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse.
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the Html help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
+# or Internet explorer 4.0+). Note that for large projects the tree generation
+# can take a very long time. In such cases it is better to disable this feature.
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimised for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assigments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = YES
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_XML = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line and do not end with a semicolon. Such function macros are typically
+# used for boiler-plate code, and will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE = FLAC.tag
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
+# super classes. Setting the tag to NO turns the diagrams off. Note that this
+# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
+# recommended to install and use dot, since it yield more powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_WIDTH = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermedate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
+
+# The CGI_NAME tag should be the name of the CGI script that
+# starts the search engine (doxysearch) with the correct parameters.
+# A script with this name will be generated by doxygen.
+
+CGI_NAME = search.cgi
+
+# The CGI_URL tag should be the absolute URL to the directory where the
+# cgi binaries are located. See the documentation of your http daemon for
+# details.
+
+CGI_URL =
+
+# The DOC_URL tag should be the absolute URL to the directory where the
+# documentation is located. If left blank the absolute path to the
+# documentation, with file:// prepended to it, will be used.
+
+DOC_URL =
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the
+# documentation is located. If left blank the directory on the local machine
+# will be used.
+
+DOC_ABSPATH =
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
+# is installed.
+
+BIN_ABSPATH = /usr/local/bin/
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to
+# documentation generated for other projects. This allows doxysearch to search
+# the documentation for these projects as well.
+
+EXT_DOC_PATHS =
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 00000000..315e9e09
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,33 @@
+# flac - Command-line FLAC encoder/decoder
+# Copyright (C) 2002 Josh Coalson
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = . html
+
+FLAC.tag: Doxyfile
+ doxygen Doxyfile
+ rm -rf html/api
+ mv doxytmp/html html/api
+ rm -rf doxytmp
+
+docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)
+
+doc_DATA = \
+ FLAC.tag
+
+EXTRA_DIST = Doxyfile $(doc_DATA)
diff --git a/doc/html/Makefile.am b/doc/html/Makefile.am
new file mode 100644
index 00000000..34b18eba
--- /dev/null
+++ b/doc/html/Makefile.am
@@ -0,0 +1,37 @@
+# FLAC - Free Lossless Audio Codec
+# Copyright (C) 2001,2002 Josh Coalson
+#
+# This program is part of FLAC; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = ru images
+
+docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)/html
+
+doc_DATA = \
+ comparison.html \
+ developers.html \
+ documentation.html \
+ download.html \
+ features.html \
+ format.html \
+ goals.html \
+ id.html \
+ index.html \
+ news.html \
+ api
+
+EXTRA_DIST = $(doc_DATA)
diff --git a/doc/html/comparison.html b/doc/html/comparison.html
new file mode 100644
index 00000000..41c6761a
--- /dev/null
+++ b/doc/html/comparison.html
@@ -0,0 +1,1067 @@
+
+
+
+
+
+
+
+
+
+ FLAC - comparison
+
+
+
+
+
+ The purpose of the comparison page is not only to show how compression ratios and encoding/decoding times using the flac reference encoder compare to other lossless encoders, but also to compare features (for example, some coders archive only and files must be uncompressed completely before playback can start). Keep a few things in mind:
+
+
+
+
+ As far as I know, only three of the lossless encoders out there (Bonk, flac and Kexis) are truly free (source code for Shorten and Monkey's Audio is available but the licenses are more restrictive). Most others give out free binaries, but without access to the source, you are leaving your data to the whim of the maintainer for eternity; you have no way to port the program to another OS or fix it if it breaks. This can be a serious drawback unless the format has world-class clout (like MP3).
+
+
+ The compression ratios and times for flac are representative only of the reference encoder. They are not indicative of the limits of all FLAC encoders or the FLAC format itself since the format is open and extensible, and anyone is free to write a better FLAC encoder. And it is almost certain that the reference encoder itself will improve.
+
+
+ Since FLAC supports streaming, it is at a slight disadvantage to the formats that don't because they don't have the extra overhead of all those frame headers.
+
+
+
+
+ I make an effort to keep this information as accurate as possible, but if any of the data is wrong, let me know and I'll correct it.
+
+ Bonk - An open-source source codec. No player or library support yet.
+
+
+ Kexis - An open-source source codec. Still in the alpha stage. No player or library support yet.
+
+
+ LPAC - A closed source codec. At least it's available for more than just Windows, but there's only a Winamp plugin.
+
+
+ Monkey's Audio - A symmetric adaptive codec with good compression. Source is available under a non-OSI license. There are two versions available now, one by the original author Matt Ashland and one by Frank Klemm. The one tested here is from the original author.
+
+
+ Ogg Squish - An open source source codec that is no longer maintained. The version I tested, 0.98, was the latest I could find. I don't have Windows timing results but it is among the 'fast' coders, based on UNIX tests.
+
+
+ optimFROG - A closed source, Windows/Linux codec, with Winamp and XMMS plugins. Slow but best compression ratios.
+
+
+ Pegasus-SPS - A closed source, Windows-only codec.
+
+ Shorten - A.J. Robinson's well-known codec; source is available here.
+
+
+ WaveZIP - A closed source, Windows-only archiver. Uses the MUSICompress[tm] engine which supposedly has a patent. I used to have a link to the company that makes WaveZIP (GadgetLabs) but apparently they have gone out of business (maybe for trying to sell something that should cost nothing).
+
+
+ WavPack - A closed source, Windows-only archiver.
+
+
+
+
+ Encoders I couldn't get a copy of:
+
+
+
+
+ AudioPak
+
+
+ WavARC
+
+
+
+
+ If you take maximum compression ratio and speed out of the picture (as you will see later, most coders exhibit similar performance), here is a subjective sort based on overall "usefulness". As far as features go, having source code gives you the most freedom since you can add anything you need that is missing; besides, open source projects tend to get better faster than closed source ones. A close second (depending on the user) would be OS support or plugin support.
+
+ The machine I used for encoding the test files is a PII-333 with 256 megs of RAM, running Windows NT 4.0 SP5. Unfortunately, Windows is the lowest-common-denominator platform for all the encoders.
+
+
+ The input corpus currently consists entirely of CD music tracks. In the future it may include more kinds of input (like speech, other sample rates/resolutions, etc). There are 14 tracks whose genres range from rock to pop to death metal to classical to chant.
+
+
+ The first table is a summary of results on all input tracks. The remaining tables show the results of the encoders on each track. The summary table has more modes, whereas the individual tables have just the interesting ones.
+
+
+ In the summary table, entries are sorted by average compression ratio, which is the average of the ratios for each track; this keeps long tracks from having more influence than short ones. In the individual tables, this is the same as the straight compression ratio, which is compressed size / uncompressed size.
+
+
+ Some interesting things to note:
+
+
flac -5 is right in the middle with respect to compression, relatively fast on the encoding range, and one of the fastest decoding. This is about what you would expect; FLAC is designed to put most of the processing on the encoding side, which is only done once, whereas the adaptive codecs take as long to decode as encode. FLAC is more suited in this way for playback on low-power devices and is one of the reasons it is the only lossless codec with any kind of hardware support.
+
LPAC quality settings are not too stable with -r (which allows seeking during playback) turned on.
+
RKAU also has a tendency to get bigger in the 'high' mode.
+
Another ironic fact is that the encoders that are patented or cost money turn out to be the worst by most measures. SPS is so archane and crippled that I gave up trying to put together results for it after one track.
+
+
+
+ This is a summary table with just the most 'economic' modes (the ones that give the most compression for the least amount of encode/decode time) for each codec.
+
+
+
+
+
+
+ Codec
+
+
+ Encode time
+
+
+ Decode time
+
+
+ Compressed size
+
+
+ Overall compression ratio
+
+
+ Average compression ratio
+
+
+
Monkey's Audio 3.96 (extra high)
26:52.07
28:44.55
386.96 MB
0.4958
0.5119
+
optimFROG 4.21 (mode 1 @ 4x)
24:19.58
25:37.44
389.04 MB
0.4984
0.5151
+
Monkey's Audio 3.96 (high)
13:59.07
15:30.69
391.76 MB
0.5019
0.5179
+
optimFROG 4.21 (mode 0 @ 4x)
16:34.96
17:57.28
394.69 MB
0.5056
0.5223
+
Monkey's Audio 3.96 (normal)
11:42.34
13:11.29
395.04 MB
0.5061
0.5223
+
RKAU 1.07 (normal)
53:46.74
23:31.10
395.71 MB
0.5070
0.5229
+
RKAU 1.07 (fast)
26:35.34
20:13.22
399.25 MB
0.5115
0.5262
+
LPAC 1.40 (-r, medium)
18:52.79
10:43.32
403.52 MB
0.5170
0.5319
+
Monkey's Audio 3.96 (fast)
9:05.59
10:51.09
401.63 MB
0.5145
0.5327
+
flac 1.0.3 (-5, default)
13:26.74
7:19.04
413.43 MB
0.5297
0.5458
+
flac 1.0.3 (-3)
10:07.34
7:14.68
419.26 MB
0.5371
0.5543
+
Bonk 0.5
36:56.36
27:09.35
418.65 MB
0.5364
0.5543
+
WavPack 3.91 (high)
7:15.37
?
418.09 MB
0.5356
0.5556
+
Ogg Squish 0.98
?
?
431.08 MB
0.5522
0.5714
+
Shorten 3.2a (-p0 -b256, default)
9:44.48
6:31.74
433.56 MB
0.5555
0.5729
+
Kexis 0.2.2
17:49.06
14:53.90
434.33 MB
0.5564
0.5750
+
WaveZIP
8:41.72
?
452.95 MB
0.5802
0.5986
+
RIFF WAVE
780.56 MB
1.0000
1.0000
+
+
+
+
+ Here are the summary results for all codecs and all modes:
+
+
+
+
+
+
+ Codec
+
+
+ Encode time
+
+
+ Decode time
+
+
+ Compressed size
+
+
+ Overall compression ratio
+
+
+ Average compression ratio
+
+
+
+
optimFROG 4.21 (mode 4 @ 2x)
183:05.29
184:13.42
386.13 MB
0.4947
0.5105
+
optimFROG 4.21 (mode 4 @ 1x)
338:34.96
339:23.24
386.22 MB
0.4948
0.5105
+
optimFROG 4.21 (mode 4 @ 4x)
105:15.85
106:36.23
386.21 MB
0.4948
0.5107
+
optimFROG 4.21 (mode 3 @ 2x)
92:48.79
93:49.75
386.52 MB
0.4952
0.5110
+
optimFROG 4.21 (mode 3 @ 1x)
161:51.00
162:10.62
386.55 MB
0.4952
0.5110
+
optimFROG 4.21 (mode 3 @ 4x)
58:18.40
59:30.51
386.71 MB
0.4954
0.5114
+
Monkey's Audio 3.96 (extra high)
26:52.07
28:44.55
386.96 MB
0.4958
0.5119
+
optimFROG 4.21 (mode 2 @ 1x)
68:22.58
69:29.50
387.71 MB
0.4967
0.5128
+
optimFROG 4.21 (mode 2 @ 2x)
44:17.55
45:31.33
387.72 MB
0.4967
0.5129
+
optimFROG 4.21 (mode 2 @ 4x)
32:16.85
33:30.92
387.93 MB
0.4970
0.5133
+
optimFROG 4.21 (mode 1 @ 1x)
43:00.91
44:13.07
388.71 MB
0.4980
0.5146
+
optimFROG 4.21 (mode 1 @ 2x)
30:35.00
31:50.50
388.81 MB
0.4981
0.5147
+
optimFROG 4.21 (mode 1 @ 4x)
24:19.58
25:37.44
389.04 MB
0.4984
0.5151
+
Monkey's Audio 3.96 (high)
13:59.07
15:30.69
391.76 MB
0.5019
0.5179
+
optimFROG 4.21 (mode 0 @ 1x)
20:51.21
22:08.44
394.35 MB
0.5052
0.5218
+
optimFROG 4.21 (mode 0 @ 2x)
17:59.86
19:20.53
394.48 MB
0.5054
0.5220
+
optimFROG 4.21 (mode 0 @ 4x)
16:34.96
17:57.28
394.69 MB
0.5056
0.5223
+
Monkey's Audio 3.96 (normal)
11:42.34
13:11.29
395.04 MB
0.5061
0.5223
+
RKAU 1.07 (normal)
53:46.74
23:31.10
395.71 MB
0.5070
0.5229
+
RKAU 1.07 (high)
136:56.62
27:55.98
395.89 MB
0.5072
0.5235
+
RKAU 1.07 (fast)
26:35.34
20:13.22
399.25 MB
0.5115
0.5262
+
LPAC 1.40 (-r, medium)
18:52.79
10:43.32
403.52 MB
0.5170
0.5319
+
LPAC 1.40 (-r, extra high)
30:30.93
12:20.26
404.08 MB
0.5177
0.5322
+
LPAC 1.40 (-r, high)
24:56.56
11:51.64
404.03 MB
0.5176
0.5323
+
Monkey's Audio 3.96 (fast)
9:05.59
10:51.09
401.63 MB
0.5145
0.5327
+
flac 1.0.3 (-8)
55:49.51
7:25.36
411.85 MB
0.5276
0.5436
+
flac 1.0.3 (-5, default)
13:26.74
7:19.04
413.43 MB
0.5297
0.5458
+
flac 1.0.3 (-3)
10:07.34
7:14.68
419.26 MB
0.5371
0.5543
+
Bonk 0.5
36:56.36
27:09.35
418.65 MB
0.5364
0.5543
+
WavPack 3.91 (high)
7:15.37
?
418.09 MB
0.5356
0.5556
+
flac 1.0.3 (-1)
8:55.94
7:22.51
432.29 MB
0.5538
0.5704
+
Ogg Squish 0.98
?
?
431.08 MB
0.5522
0.5714
+
Shorten 3.2a (-p0 -b256, default)
9:44.48
6:31.74
433.56 MB
0.5555
0.5729
+
Kexis 0.2.2
17:49.06
14:53.90
434.33 MB
0.5564
0.5750
+
Shorten 3.2a (-p8 -b2048)
12:00.04
7:25.12
438.86 MB
0.5622
0.5810
+
WaveZIP
8:41.72
?
452.95 MB
0.5802
0.5986
+
RIFF WAVE
780.56 MB
1.0000
1.0000
+
+
+
+
+ Here are the results for each individual track.
+
+
+
+
+
+
+ Track
+
+
+ Codec
+
+
+ Encode time
+
+
+ Decode time
+
+
+ Compressed size
+
+
+ Compression ratio
+
+
+
+
+ Dream Theater 6:00 58.47 MB
+
+
+
Monkey's Audio 3.96 (extra high)
2:05.36
2:13.44
43.24 MB
0.7395
+
optimFROG 4.21 (mode 1 @ 4x)
1:53.28
2:00.45
43.26 MB
0.7398
+
optimFROG 4.21 (mode 4 @ 1x)
25:32.41
25:38.15
43.26 MB
0.7398
+
Monkey's Audio 3.96 (high)
1:07.92
1:13.20
43.39 MB
0.7421
+
optimFROG 4.21 (mode 0 @ 4x)
1:17.95
1:25.67
43.42 MB
0.7426
+
Monkey's Audio 3.96 (normal)
0:57.04
1:03.37
43.48 MB
0.7436
+
RKAU 1.07 (normal)
1:57.68
1:33.38
43.81 MB
0.7493
+
Monkey's Audio 3.96 (fast)
0:44.33
0:51.22
43.97 MB
0.7520
+
LPAC 1.40 (-r, normal)
1:27.61
0:56.18
44.12 MB
0.7545
+
flac 1.0.3 (-8)
4:20.41
0:37.86
44.33 MB
0.7581
+
Bonk 0.5
2:56.03
2:11.58
44.35 MB
0.7585
+
flac 1.0.3 (-5, default)
1:03.87
0:37.55
44.40 MB
0.7594
+
Shorten 3.2a (-p8 -b2048)
0:58.81
0:37.63
44.75 MB
0.7654
+
flac 1.0.3 (-3)
0:48.52
0:37.22
44.78 MB
0.7658
+
WavPack 3.91 (high)
0:35.86
?
45.14 MB
0.7720
+
Ogg Squish 0.98
?
?
45.17 MB
0.7725
+
Pegasus-SPS
4:45.00
?
45.40 MB
0.7765
+
Kexis 0.2.2
1:24.83
1:10.93
46.52 MB
0.7956
+
flac 1.0.3 (-1)
0:44.07
0:37.77
46.64 MB
0.7977
+
Shorten 3.2a (-p0 -b256, default)
0:47.75
0:32.56
46.68 MB
0.7984
+
WaveZIP
0:38.99
?
47.22 MB
0.8077
+
+
+
+
+
+ Eddie Warner Titus 27.87 MB
+
+
+
LPAC 1.40 (-r, normal)
0:40.76
0:21.21
14.77 MB
0.5298
+
flac 1.0.3 (-8)
1:58.90
0:17.33
15.01 MB
0.5384
+
optimFROG 4.21 (mode 1 @ 4x)
0:53.39
0:55.52
15.01 MB
0.5385
+
optimFROG 4.21 (mode 4 @ 1x)
12:02.54
12:03.76
15.02 MB
0.5390
+
flac 1.0.3 (-5, default)
0:29.56
0:15.57
15.11 MB
0.5423
+
optimFROG 4.21 (mode 0 @ 4x)
0:36.81
0:39.19
15.13 MB
0.5429
+
RKAU 1.07 (normal)
0:54.82
0:42.71
15.15 MB
0.5435
+
Monkey's Audio 3.96 (extra high)
0:58.52
1:01.81
15.25 MB
0.5471
+
Monkey's Audio 3.96 (high)
0:30.88
0:33.55
15.34 MB
0.5505
+
Monkey's Audio 3.96 (normal)
0:25.45
0:28.37
15.35 MB
0.5509
+
flac 1.0.3 (-3)
0:22.29
0:15.29
15.43 MB
0.5537
+
Monkey's Audio 3.96 (fast)
0:19.85
0:22.90
15.58 MB
0.5592
+
Shorten 3.2a (-p0 -b256, default)
0:21.16
0:13.55
15.78 MB
0.5662
+
Shorten 3.2a (-p8 -b2048)
0:26.82
0:16.75
16.21 MB
0.5818
+
flac 1.0.3 (-1)
0:19.92
0:15.67
16.38 MB
0.5879
+
Bonk 0.5
1:22.01
1:00.12
16.73 MB
0.6003
+
Ogg Squish 0.98
?
?
17.03 MB
0.6112
+
WavPack 3.91 (high)
0:10.55
?
17.13 MB
0.6148
+
Kexis 0.2.2
0:38.72
0:32.25
17.40 MB
0.6242
+
WaveZIP
0:17.55
?
17.89 MB
0.6420
+
+
+
+
+
+ Tool Forty-six & 2 64.25 MB
+
+
+
optimFROG 4.21 (mode 4 @ 1x)
27:58.28
28:01.87
37.96 MB
0.5907
+
optimFROG 4.21 (mode 1 @ 4x)
2:03.43
2:09.27
38.15 MB
0.5937
+
Monkey's Audio 3.96 (extra high)
2:14.70
2:24.30
38.23 MB
0.5950
+
Monkey's Audio 3.96 (high)
1:09.82
1:18.09
38.42 MB
0.5979
+
Monkey's Audio 3.96 (normal)
0:58.69
1:07.02
38.59 MB
0.6005
+
optimFROG 4.21 (mode 0 @ 4x)
1:24.44
1:30.97
38.68 MB
0.6020
+
Monkey's Audio 3.96 (fast)
0:46.50
0:55.41
39.18 MB
0.6098
+
RKAU 1.07 (normal)
2:16.00
1:41.84
39.42 MB
0.6135
+
LPAC 1.40 (-r, normal)
1:38.01
0:57.56
40.25 MB
0.6263
+
flac 1.0.3 (-8)
4:39.65
0:38.25
40.88 MB
0.6363
+
Bonk 0.5
3:07.20
2:21.28
40.98 MB
0.6378
+
flac 1.0.3 (-5, default)
1:08.27
0:38.81
41.04 MB
0.6387
+
WavPack 3.91 (high)
0:37.51
?
41.51 MB
0.6461
+
flac 1.0.3 (-3)
0:51.78
0:38.54
41.74 MB
0.6496
+
Ogg Squish 0.98
?
?
42.27 MB
0.6578
+
flac 1.0.3 (-1)
0:46.19
0:41.18
42.70 MB
0.6646
+
Kexis 0.2.2
1:30.09
1:16.29
42.75 MB
0.6652
+
Shorten 3.2a (-p8 -b2048)
1:02.42
0:37.84
43.06 MB
0.6701
+
Shorten 3.2a (-p0 -b256, default)
0:51.29
0:34.59
43.18 MB
0.6721
+
WaveZIP
0:42.84
?
44.52 MB
0.6930
+
+
+
+
+
+ Cannibal Corpse Mummified In Barbed Wire 33.37 MB
+
+
+
Monkey's Audio 3.96 (extra high)
1:10.94
1:15.92
22.95 MB
0.6876
+
optimFROG 4.21 (mode 4 @ 1x)
14:34.28
14:37.69
22.95 MB
0.6877
+
Monkey's Audio 3.96 (high)
0:37.63
0:41.34
23.19 MB
0.6948
+
Monkey's Audio 3.96 (normal)
0:31.71
0:34.87
23.26 MB
0.6968
+
optimFROG 4.21 (mode 1 @ 4x)
1:03.96
1:08.85
23.31 MB
0.6984
+
RKAU 1.07 (normal)
1:09.71
0:56.66
23.34 MB
0.6993
+
LPAC 1.40 (-r, normal)
1:05.38
0:36.20
23.53 MB
0.7050
+
optimFROG 4.21 (mode 0 @ 4x)
0:44.14
0:48.71
23.95 MB
0.7176
+
flac 1.0.3 (-8)
2:27.82
0:22.15
24.18 MB
0.7244
+
Monkey's Audio 3.96 (fast)
0:25.05
0:28.99
24.20 MB
0.7250
+
flac 1.0.3 (-5, default)
0:36.19
0:21.00
24.30 MB
0.7281
+
Bonk 0.5
1:40.38
1:14.58
24.36 MB
0.7297
+
Shorten 3.2a (-p8 -b2048)
0:33.74
0:22.47
25.12 MB
0.7526
+
flac 1.0.3 (-3)
0:28.29
0:20.82
25.16 MB
0.7539
+
Ogg Squish 0.98
?
?
25.23 MB
0.7558
+
WavPack 3.91 (high)
0:20.50
?
25.33 MB
0.7589
+
Kexis 0.2.2
0:47.13
0:40.67
26.03 MB
0.7799
+
flac 1.0.3 (-1)
0:24.95
0:22.70
26.09 MB
0.7818
+
Shorten 3.2a (-p0 -b256, default)
0:28.20
0:20.46
26.61 MB
0.7972
+
WaveZIP
0:22.25
?
26.89 MB
0.8058
+
+
+
+
+
+ Alanis Morisette Hand In My Pocket 39.09 MB
+
+
+
optimFROG 4.21 (mode 4 @ 1x)
16:51.82
16:54.34
21.24 MB
0.5433
+
optimFROG 4.21 (mode 1 @ 4x)
1:14.29
1:18.06
21.36 MB
0.5464
+
Monkey's Audio 3.96 (extra high)
1:21.38
1:27.28
21.54 MB
0.5509
+
Monkey's Audio 3.96 (high)
0:42.54
0:47.41
21.75 MB
0.5563
+
Monkey's Audio 3.96 (normal)
0:35.45
0:39.65
21.84 MB
0.5586
+
optimFROG 4.21 (mode 0 @ 4x)
0:51.39
0:54.97
21.89 MB
0.5598
+
Monkey's Audio 3.96 (fast)
0:28.23
0:33.21
22.16 MB
0.5668
+
RKAU 1.07 (normal)
1:21.18
1:01.60
22.80 MB
0.5833
+
LPAC 1.40 (-r, normal)
1:01.11
0:33.79
23.25 MB
0.5948
+
Bonk 0.5
1:53.41
1:23.52
23.35 MB
0.5972
+
flac 1.0.3 (-8)
2:48.45
0:23.47
23.45 MB
0.5997
+
flac 1.0.3 (-5, default)
0:41.00
0:23.59
23.55 MB
0.6025
+
Ogg Squish 0.98
?
?
24.11 MB
0.6167
+
WavPack 3.91 (high)
0:22.50
?
24.22 MB
0.6196
+
flac 1.0.3 (-3)
0:31.65
0:22.27
24.32 MB
0.6220
+
Shorten 3.2a (-p8 -b2048)
0:37.49
0:22.93
24.72 MB
0.6323
+
Kexis 0.2.2
0:54.26
0:45.64
24.80 MB
0.6345
+
flac 1.0.3 (-1)
0:27.51
0:22.72
24.81 MB
0.6347
+
Shorten 3.2a (-p0 -b256, default)
0:29.71
0:18.92
25.34 MB
0.6481
+
WaveZIP
0:28.05
?
25.95 MB
0.6638
+
+
+
+
+
+ Gloria Estefan Conga 45.15 MB
+
+
+
optimFROG 4.21 (mode 4 @ 1x)
19:40.53
19:44.47
29.43 MB
0.6517
+
optimFROG 4.21 (mode 1 @ 4x)
1:26.64
1:32.23
29.58 MB
0.6550
+
Monkey's Audio 3.96 (extra high)
1:35.65
1:42.11
29.65 MB
0.6567
+
optimFROG 4.21 (mode 0 @ 4x)
0:59.59
1:05.29
29.78 MB
0.6595
+
Monkey's Audio 3.96 (high)
0:50.17
0:56.40
29.85 MB
0.6610
+
Monkey's Audio 3.96 (normal)
0:42.27
0:47.74
29.97 MB
0.6637
+
Monkey's Audio 3.96 (fast)
0:33.46
0:39.22
30.30 MB
0.6710
+
RKAU 1.07 (normal)
1:37.85
1:12.15
30.34 MB
0.6719
+
Bonk 0.5
2:13.34
1:39.44
30.64 MB
0.6785
+
flac 1.0.3 (-8)
3:18.77
0:28.57
30.75 MB
0.6811
+
LPAC 1.40 (-r, normal)
1:14.08
0:44.64
30.81 MB
0.6823
+
flac 1.0.3 (-5, default)
0:48.11
0:27.84
30.85 MB
0.6833
+
WavPack 3.91 (high)
0:26.73
?
30.91 MB
0.6845
+
Ogg Squish 0.98
?
?
31.06 MB
0.6879
+
flac 1.0.3 (-3)
0:37.46
0:27.80
31.63 MB
0.7005
+
flac 1.0.3 (-1)
0:32.55
0:27.42
31.99 MB
0.7085
+
Shorten 3.2a (-p8 -b2048)
0:44.76
0:27.48
31.76 MB
0.7034
+
Kexis 0.2.2
1:03.91
0:53.54
31.86 MB
0.7056
+
Shorten 3.2a (-p0 -b256, default)
0:35.74
0:23.64
32.47 MB
0.7191
+
WaveZIP
0:29.42
?
33.02 MB
0.7313
+
+
+
+
+
+ Cream White Room 53.01 MB
+
+
+
optimFROG 4.21 (mode 4 @ 1x)
22:59.05
23:02.98
33.93 MB
0.6399
+
optimFROG 4.21 (mode 1 @ 4x)
1:42.28
1:47.55
33.96 MB
0.6405
+
Monkey's Audio 3.96 (extra high)
1:51.77
2:00.37
34.14 MB
0.6441
+
Monkey's Audio 3.96 (high)
0:58.45
1:04.59
34.29 MB
0.6468
+
optimFROG 4.21 (mode 0 @ 4x)
1:10.30
1:15.99
34.29 MB
0.6468
+
Monkey's Audio 3.96 (normal)
0:49.32
0:56.89
34.42 MB
0.6493
+
RKAU 1.07 (normal)
1:50.80
1:24.98
34.60 MB
0.6527
+
LPAC 1.40 (-r, normal)
1:25.16
0:48.67
34.84 MB
0.6572
+
Bonk 0.5
2:35.36
1:56.20
34.96 MB
0.6595
+
Monkey's Audio 3.96 (fast)
0:38.75
0:46.80
34.99 MB
0.6601
+
flac 1.0.3 (-8)
3:53.21
0:32.08
35.00 MB
0.6602
+
flac 1.0.3 (-5, default)
0:57.28
0:32.27
35.17 MB
0.6634
+
flac 1.0.3 (-3)
0:42.71
0:32.56
35.37 MB
0.6672
+
Shorten 3.2a (-p8 -b2048)
0:51.44
0:33.02
35.40 MB
0.6677
+
WavPack 3.91 (high)
0:31.05
?
35.60 MB
0.6715
+
Ogg Squish 0.98
?
?
35.74 MB
0.6742
+
Shorten 3.2a (-p0 -b256, default)
0:41.14
0:28.91
36.42 MB
0.6870
+
flac 1.0.3 (-1)
0:38.47
0:30.66
36.56 MB
0.6896
+
Kexis 0.2.2
1:13.87
1:02.90
36.64 MB
0.6911
+
WaveZIP
0:35.77
?
37.13 MB
0.7004
+
+
+
+
+
+ Maurice Ravel Fanfare from "L'eventail de Jeanne" 20.82 MB
+
+
+
optimFROG 4.21 (mode 4 @ 1x)
8:22.42
8:23.32
6.82 MB
0.3274
+
Monkey's Audio 3.96 (extra high)
0:39.93
0:41.69
6.85 MB
0.3289
+
optimFROG 4.21 (mode 1 @ 4x)
0:36.57
0:38.26
7.09 MB
0.3406
+
Monkey's Audio 3.96 (high)
0:21.22
0:23.04
7.16 MB
0.3437
+
RKAU 1.07 (normal)
0:40.67
0:28.52
7.18 MB
0.3451
+
optimFROG 4.21 (mode 0 @ 4x)
0:24.98
0:26.37
7.21 MB
0.3462
+
LPAC 1.40 (-r, normal)
0:29.01
0:15.11
7.33 MB
0.3520
+
Monkey's Audio 3.96 (normal)
0:18.19
0:19.54
7.44 MB
0.3575
+
Monkey's Audio 3.96 (fast)
0:13.70
0:15.72
7.64 MB
0.3671
+
flac 1.0.3 (-8)
1:21.11
0:09.72
7.68 MB
0.3691
+
flac 1.0.3 (-5, default)
0:19.97
0:09.77
7.71 MB
0.3702
+
flac 1.0.3 (-3)
0:15.09
0:10.09
7.77 MB
0.3733
+
Bonk 0.5
0:55.92
0:40.23
7.83 MB
0.3762
+
WavPack 3.91 (high)
0:11.42
?
7.89 MB
0.3791
+
flac 1.0.3 (-1)
0:13.18
0:09.78
8.12 MB
0.3901
+
Ogg Squish 0.98
?
?
8.15 MB
0.3914
+
Shorten 3.2a (-p0 -b256, default)
0:13.81
0:08.88
8.19 MB
0.3932
+
Shorten 3.2a (-p8 -b2048)
0:17.45
0:10.30
8.29 MB
0.3983
+
Kexis 0.2.2
0:26.78
0:21.90
8.52 MB
0.4091
+
WaveZIP
0:13.11
?
8.72 MB
0.4193
+
+
+
+
+
+ Maurice Ravel String Quartet (4th movement) 56.18 MB
+
+
+
Monkey's Audio 3.96 (extra high)
1:54.09
2:01.72
20.47 MB
0.3642
+
optimFROG 4.21 (mode 4 @ 1x)
24:26.99
24:29.36
20.62 MB
0.3671
+
Monkey's Audio 3.96 (high)
0:58.14
1:06.45
20.80 MB
0.3702
+
optimFROG 4.21 (mode 1 @ 4x)
1:42.57
1:47.48
20.93 MB
0.3725
+
Monkey's Audio 3.96 (normal)
0:48.61
0:54.73
21.14 MB
0.3763
+
optimFROG 4.21 (mode 0 @ 4x)
1:09.17
1:13.14
21.23 MB
0.3779
+
RKAU 1.07 (normal)
1:52.65
1:25.39
21.30 MB
0.3791
+
Monkey's Audio 3.96 (fast)
0:37.30
0:44.79
21.54 MB
0.3835
+
LPAC 1.40 (-r, normal)
1:20.84
0:42.73
21.96 MB
0.3909
+
WavPack 3.91 (high)
0:30.03
?
22.30 MB
0.3969
+
flac 1.0.3 (-8)
3:57.24
0:28.26
22.61 MB
0.4024
+
flac 1.0.3 (-5, default)
0:56.47
0:28.31
22.67 MB
0.4036
+
Bonk 0.5
2:33.53
1:51.94
23.18 MB
0.4125
+
flac 1.0.3 (-3)
0:41.66
0:27.63
23.21 MB
0.4131
+
flac 1.0.3 (-1)
0:36.76
0:29.54
23.36 MB
0.4158
+
Kexis 0.2.2
1:15.05
1:03.86
23.42 MB
0.4168
+
Shorten 3.2a (-p0 -b256, default)
0:39.96
0:27.36
23.71 MB
0.4221
+
Ogg Squish 0.98
?
?
24.12 MB
0.4293
+
Shorten 3.2a (-p8 -b2048)
0:49.06
0:29.94
25.59 MB
0.4554
+
WaveZIP
0:36.60
?
25.84 MB
0.4600
+
+
+
+
+
+ Sergei Prokofiev Piano Concerto No.3 (3rd movement) 100.68 MB
+
+
+
optimFROG 4.21 (mode 4 @ 1x)
43:21.88
43:26.18
33.58 MB
0.3335
+
Monkey's Audio 3.96 (extra high)
3:21.33
3:35.91
33.72 MB
0.3349
+
optimFROG 4.21 (mode 1 @ 4x)
3:00.57
3:08.19
33.83 MB
0.3360
+
optimFROG 4.21 (mode 0 @ 4x)
2:00.85
2:09.52
34.14 MB
0.3390
+
Monkey's Audio 3.96 (high)
1:43.17
1:55.31
34.23 MB
0.3400
+
Monkey's Audio 3.96 (normal)
1:26.19
1:35.90
34.66 MB
0.3442
+
RKAU 1.07 (normal)
3:08.70
2:26.17
35.21 MB
0.3496
+
LPAC 1.40 (-r, normal)
2:06.21
1:11.92
35.27 MB
0.3502
+
Monkey's Audio 3.96 (fast)
1:06.28
1:18.56
35.43 MB
0.3518
+
WavPack 3.91 (high)
0:53.49
?
37.44 MB
0.3718
+
flac 1.0.3 (-8)
6:57.76
0:51.45
38.07 MB
0.3781
+
flac 1.0.3 (-5, default)
1:39.78
0:49.47
38.17 MB
0.3791
+
flac 1.0.3 (-3)
1:13.49
0:49.51
38.50 MB
0.3824
+
flac 1.0.3 (-1)
1:04.89
0:53.25
39.30 MB
0.3903
+
Shorten 3.2a (-p0 -b256, default)
1:10.57
0:50.00
39.49 MB
0.3921
+
Kexis 0.2.2
2:12.39
1:49.00
39.89 MB
0.3962
+
Bonk 0.5
4:33.71
3:19.38
40.31 MB
0.4003
+
Ogg Squish 0.98
?
?
41.86 MB
0.4157
+
WaveZIP
1:05.60
?
43.67 MB
0.4337
+
Shorten 3.2a (-p8 -b2048)
1:26.84
0:53.19
45.34 MB
0.4502
+
+
+
+
+
+ Frederic Chopin Prelude No.24 in d minor 27.46 MB
+
+ FLAC is an open source project and we are happy to enlist the help of anyone who wants to contribute. You can do this to a limited extent through the mailing list but if you have major changes to make to the code it's best to sign up as a developer. In either case, make sure to check out the FLAC goals first; there are some thing the we don't want added to FLAC, like copy protection and lossy compression.
+
+
+ High priority items are:
+
+
+
+
+ More input plugins. Currently there are plugins for XMMS and Winamp; Freeamp is in the works. More is better!
+
+
+ Improving the compression methods.
+
+
+
+
+ Some other "nice-to-haves":
+
+
+
+
+ Fix the MSVC makefiles to make libFLAC.dll (instead of just the .lib).
+
+
+ Configurable ID3V1 support and ID3V2 support in the plugins.
+
+
+ Support more input types than just WAVE and raw in flac.
+
+
+ A better logo! Gimp jedi I'm not...
+
+
+
+
+ Things that are in the works (check the flac-dev mailing list):
+
+ FLAC is open to third-party developers who want to add support for FLAC into their programs. All the necessary functionality is contained the library libFLAC which is licensed under the LGPL. The relevant documentation here is:
+
The ID registration page for registering an ID if you need to write custom metadata.
+
+
+
+ There also are several examples in the FLAC code base of the use of libFLAC and libFLAC++ that may also be helpful. Visit the download page for instructions on how to get the source.
+
+ Keep in mind that the online version of this document will always apply to the latest release. For older releases, check the documentation included with the release package.
+
+ flac has been tuned so that the default options yield a good speed vs. compression tradeoff for many kinds of input. However, if you are looking to maximize the compression rate or speed, or want to use the full power of FLAC's metadata system, this section is for you. If not, just skip to the next section.
+
+ The first four bytes are to identify the FLAC stream. The metadata that follows contains all the information about the stream except for the audio data itself. After the metadata comes the encoded audio data.
+
+
+ METADATA
+
+
+ FLAC defines several types of metadata blocks (see the format page for the complete list. Metadata blocks can be any length and new ones can be defined. A decoder is allowed to skip any metadata types it does not understand. Only one is mandatory: the STREAMINFO block. This block has information like the sample rate, number of channels, etc., and data that can help the decoder manage its buffers, like the minimum and maximum data rate and minimum and maximum block size. Also included in the STREAMINFO block is the MD5 signature of the unencoded audio data. This is useful for checking an entire stream for transmission errors.
+
+
+ Other blocks allow for padding, seek tables, and application-specific data. You can see flac options below for adding PADDING blocks or specifying seek points. FLAC does not require seek points for seeking but they can speed up seeks, or be used for cueing in editing applications.
+
+
+ Also, if you have a need of a custom metadata block, you can define your own and request an ID here. Then you can reserve a PADDING block of the correct size when encoding, and overwrite the padding block with your APPLICATION block after encoding. The resulting stream will be FLAC compatible; decoders that are aware of your metadata can use it and the rest will safely ignore it.
+
+
+ AUDIO DATA
+
+
+ After the metadata comes the encoded audio data. Audio data and metadata are not interleaved. Like most audio codecs, FLAC splits the unencoded audio data into blocks, and encodes each block separately. The encoded block is packed into a frame and appended to the stream. The reference encoder uses a single block size for the whole stream but the FLAC format does not require it.
+
+
+ BLOCKING
+
+
+ The block size is an important parameter to encoding. If it is too small, the frame overhead will lower the compression. If it is too large, the modeling stage of the compressor will not be able to generate an efficient model. Understanding FLAC's modeling will help you to improve compression for some kinds of input by varying the block size. In the most general case, using linear prediction on 44.1kHz audio, the optimal block size will be between 2-6 ksamples. flac defaults to a block size of 4608 in this case. Using the fast fixed predictors, a smaller block size is usually preferable because of the smaller frame header.
+
+
+ INTER-CHANNEL DECORRELATION
+
+
+ In the case of stereo input, once the data is blocked it is optionally passed through an inter-channel decorrelation stage. The left and right channels are converted to center and side channels through the following transformation: mid = (left + right) / 2, side = left - right. This is a lossless process, unlike joint stereo. For normal CD audio this can result in significant extra compression. flac has two options for this: -m always compresses both the left-right and mid-side versions of the block and takes the smallest frame, and -M, which adaptively switches between left-right and mid-side.
+
+
+ MODELING
+
+
+ In the next stage, the encoder tries to approximate the signal with a function in such a way that when the approximation is subracted, the result (called the residual, residue, or error) requires fewer bits-per-sample to encode. The function's parameters also have to be transmitted so they should not be so complex as to eat up the savings. FLAC has two methods of forming approximations: 1) fitting a simple polynomial to the signal; and 2) general linear predictive coding (LPC). I will not go into the details here, only some generalities that involve the encoding options.
+
+
+ First, fixed polynomial prediction (specified with -l 0) is much faster, but less accurate than LPC. The higher the maximum LPC order, the slower, but more accurate, the model will be. However, there are diminishing returns with increasing orders. Also, at some point (usually around order 9) the part of the encoder that guesses what is the best order to use will start to get it wrong and the compression will actually decrease slightly; at that point you will have to you will have to use the exhaustive search option -e to overcome this, which is significantly slower.
+
+
+ Second, the parameters for the fixed predictors can be transmitted in 3 bits whereas the parameters for the LPC model depend on the bits-per-sample and LPC order. This means the frame header length varies depending on the method and order you choose and can affect the optimal block size.
+
+
+ RESIDUAL CODING
+
+
+ Once the model is generated, the encoder subracts the approximation from the original signal to get the residual (error) signal. The error signal is then losslessly coded. To do this, FLAC takes advantage of the fact that the error signal generally has a Laplacian (two-sided geometric) distribution, and that there are a set of special Huffman codes called Rice codes that can be used to efficiently encode these kind of signals quickly and without needing a dictionary.
+
+
+ Rice coding involves finding a single parameter that matches a signal's distribution, then using that parameter to generate the codes. As the distribution changes, the optimal parameter changes, so FLAC supports a method that allows the parameter to change as needed. The residual can be broken into several contexts or partitions, each with it's own Rice parameter. flac allows you to specify how the partitioning is done with the -r option. The residual can be broken into 2^n partitions, by using the option -r n,n. The parameter n is called the partition order. Furthermore, the encoder can be made to search through m to n partition orders, taking the best one, by specifying -r m,n. Generally, the choice of n does not affect encoding speed but m,n does. The larger the difference between m and n, the more time it will take the encoder to search for the best order. The block size will also affect the optimal order.
+
+
+ FRAMING
+
+
+ An audio frame is preceded by a frame header and trailed by a frame footer. The header starts with a sync code, and contains the minimum information necessary for a decoder to play the stream, like sample rate, bits per sample, etc. It also contains the block or sample number and an 8-bit CRC of the frame header. The sync code, frame header CRC, and block/sample number allow resynchronization and seeking even in the absence of seek points. The frame footer contains a 16-bit CRC of the entire encoded frame for error detection. If the reference decoder detects a CRC error it will generate a silent block.
+
+
+ MISCELLANEOUS
+
+
+ In order to support come common types of metadata, the reference decoder knows how to skip ID3V1 and ID3V2 tags so it is safe to tag FLAC files in this way. ID3V2 tags must come at the beginning of the file (before the "fLaC" marker) and ID3V1 tags must come at the end of the file.
+
+
+ flac has a verify option -V that verifies the output while encoding. With this option, a decoder is run in parallel to the encoder and its output is compared against the original input. If a difference is found flac will stop with an error.
+
+ flac is the command-line file encoder/decoder. The input to the encoder and the output to the decoder must either be RIFF WAVE format, or raw interleaved sample data. flac only supports linear PCM samples (in other words, no A-LAW, uLAW, etc.). Another restriction (hopefully short-term) is that the input must be 8, 16, or 24 bits per sample. This is not a limitation of the FLAC format, just the reference encoder/decoder.
+
+
+ flac assumes that files ending in ".wav" or that have the RIFF WAVE header present are WAVE files; this may be overridden with a command-line option; it also assumes that files ending in ".ogg" are Ogg-FLAC files. Other than this, flac makes no assumptions about file extensions, though the convention is that FLAC files have the extension ".flac" (or ".fla" on ancient file systems like FAT-16).
+
+
+ Before going into the full command-line description, a few other things help to sort it out: 1) flac encodes by default, so you must use -d to decode; 2) the options -0 .. -8 (or --fast and --best) that control the compression level actually are just synonyms for different groups of specific encoding options (described later) and you can get the same effect by using the same options; 3) flac behaves similarly to gzip in the way it handles input and output files.
+
+
+ flac will be invoked one of four ways, depending on whether you are encoding, decoding, testing, or analyzing:
+
+ In any case, if no inputfile is specified, stdin is assumed. If only one inputfile is specified, it may be "-" for stdin. When stdin is used as input, flac will write to stdout. Otherwise flac will perform the desired operation on each input file to similarly named output files (meaning for encoding, the extension will be replaced with ".flac", or appended with ".flac" if the input file has no extension, and for decoding, the extension will be ".wav" for WAVE output and ".raw" for raw output). The original file is not deleted unless --delete-input-file is specified.
+
+
+ If you are encoding/decoding from stdin to a file, you should use the -o option like so:
+
+
+ flac [options] -o outputfile
+
+
+ flac -d [options] -o outputfile
+
+
+ which are better than:
+
+
+ flac [options] > outputfile
+
+
+ flac -d [options] > outputfile
+
+
+ since the former allows flac to seek backwards to write the STREAMINFO or RIFF WAVE header contents when necessary.
+
+
+ Also, you can force output data to go to stdout using -c.
+
+
The encoding options affect the compression ratio and encoding speed. The format options are used to tell flac the arrangement of samples if the input file (or output file when decoding) is a raw file. If it is a RIFF WAVE file the format options are not needed since they are read from the WAVE header.
+
+
+ In test mode, flac acts just like in decode mode, except no output file is written. Both decode and test modes detect errors in the stream, but they also detect when the MD5 signature of the decoded audio does not match the stored MD5 signature, even when the bitstream is valid.
+
+ Show the long usage screen. Running flac without arguments shows the short help screen by default.
+
+
+
+
+ -d
+
+
+ Decode (flac encodes by default). flac will exit with an exit code of 1 (and print a message, even in silent mode) if there were any errors during decoding, including when the MD5 checksum does not match the decoded output. Otherwise the exit code will be 0.
+
+
+
+
+ -t
+
+
+ Test (same as -d except no decoded file is written). The exit codes are the same as in decode mode.
+
+
+
+
+ -a
+
+
+ Analyze (same as -d except an analysis file is written). The exit codes are the same as in decode mode. This option is mainly for developers; the output will be a text file that has data about each frame and subframe.
+
+
+
+
+ -c
+
+
+ Write output to stdout
+
+
+
+
+ -s
+
+
+ Silent: do not show encoding/decoding statistics.
+
+
+
+
+ -o filename
+
+
+ Force the output file name (usually flac just changes the extension). May only be used when encoding a single file. May not be used in conjunction with --output-prefix.
+
+
+
+
+ --output-prefix string
+
+
+ Prefix each output file name with the given string. This can be useful for encoding/decoding files to a different directory. Make sure if your string is a path name that it ends with a trailing '/' slash.
+
+
+
+
+ --delete-input-file
+
+
+ Automatically delete the input file after a successful encode or decode. If there was an error (including a verify error) the input file is left intact.
+
+
+
+
+ --skip #
+
+
+ Skip over the first # of samples of the input. This works for both encoding and decoding, but not testing.
+
+ By default flac stops decoding with an error and removes the partially decoded file if it encounters a bitstream error. With -F, errors are still printed but flac will continue decoding to completion. Note that errors may cause the decoded audio to be missing some samples or have silent sections.
+
+ When encoding, generate Ogg-FLAC output instead of native-FLAC. Ogg-FLAC streams are FLAC streams wrapped in an Ogg transport layer. The resulting file should have an '.ogg' extension and will still be decodable by flac.
+ When decoding, force the input to be treated as Ogg-FLAC. This is useful when piping input from stdin or when the filename does not end in '.ogg'.
+
+
+
+
+ --lax
+
+
+ Allow encoder to generate non-Subset files. The resulting FLAC file may not be streamable, so you should only use this option in combination with custom encoding options meant for archival. File decoders will still be able play (and seek in) such files.
+
+
+
+
+ --sector-align
+
+
+ Align encoding of multiple CD format WAVE files on sector boundaries. This option is only allowed when encoding WAVE files, all of which have a 44.1kHz sample rate and 2 channels. With --sector-align, the encoder will align the resulting .flac streams so that their lengths are even multiples of a CD sector (1/75th of a second, or 588 samples). It does this by carrying over any partial sector at the end of each WAVE file to the next stream. The last stream will be padded to alignment with zeroes.
+ This option will have no effect if the files are already aligned (as is the normally the case with WAVE files ripped from a CD). flac can only align a set of files given in one invocation of flac.
+ WARNING: The ordering of files is important! If you give a command like 'flac --sector-align *.wav' the shell may not expand the wildcard to the order you expect. To be safe you should 'echo *.wav' first to confirm the order, or be explicit like 'flac --sector-align 8.wav 9.wav 10.wav'.
+
+
+
+
+ -S { # | X | #x }
+
+
+ Include a point or points in a SEEKTABLE:
+
+
+ # : a specific sample number for a seek point
+
+
+ X : a placeholder point (always goes at the end of the SEEKTABLE)
+
+
+ #x : # evenly spaced seekpoints, the first being at sample 0
+
+
+ You may use many -S options; the resulting SEEKTABLE will be the unique-ified union of all such values.
+ With no -S options, flac defaults to '-S 100x'. Use -S- for no SEEKTABLE.
+ NOTE: -S #x will not work if the encoder can't determine the input size before starting.
+ NOTE: if you use -S # and # is >= samples in the input, there will be either no seek point entered (if the input size is determinable before encoding starts) or a placeholder point (if input size is not determinable).
+
+
+
+
+ -P #
+
+
+ Tell the encoder to write a PADDING metadata block of the given length (in bytes) after the STREAMINFO block. This is useful if you plan to tag the file later with an APPLICATION block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the PADDING block. Note that the total length of the PADDING block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no PADDING block at all to be written with -P-, which is the default.
+
+
+
+
+ -b #
+
+
+ Specify the block size in samples. The default is 1152 for -l 0, otherwise 4608. Subset streams must use one of 192/576/1152/2304/4608/256/512/1024/2048/4096/8192/16384/32768. The reference encoder uses the same block size for the entire stream.
+
+
+
+
+ -m
+
+
+ Enable mid-side coding (only for stereo streams). Tends to increase compression by a few percent on average. For each block both the stereo pair and mid-side versions of the block will be encoded, and smallest resulting frame will be stored. Currently mid-side encoding is only available when bits-per-sample <= 16.
+
+
+
+
+ -M
+
+
+ Enable loose mid-side coding (only for stereo streams). Like -m but the encoder adaptively switches between independent and mid-side coding, which is faster but yields less compression than -m (which does an exhaustive search).
+
+
+
+
+ -0 .. -8
+
+
+ Fastest compression .. highest compression. The default is -5.
+
+
+
+
+ -0
+
+
+ Synonymous with -l 0 -b 1152 -r 2,2
+
+
+
+
+ -1
+
+
+ Synonymous with -l 0 -b 1152 -M -r 2,2
+
+
+
+
+ -2
+
+
+ Synonymous with -l 0 -b 1152 -m -r 3
+
+
+
+
+ -3
+
+
+ Synonymous with -l 6 -b 4608 -r 3,3
+
+
+
+
+ -4
+
+
+ Synonymous with -l 8 -b 4608 -M -r 3,3
+
+
+
+
+ -5
+
+
+ Synonymous with -l 8 -b 4608 -m -r 3,3
+
+
+
+
+ -6
+
+
+ Synonymous with -l 8 -b 4608 -m -r 4
+
+
+
+
+ -7
+
+
+ Synonymous with -l 8 -b 4608 -m -e -r 6
+
+
+
+
+ -8
+
+
+ Synonymous with -l 12 -b 4608 -m -e -r 6
+
+
+
+
+ --fast
+
+
+ Fastest compression. Currently synonymous with -0
+
+
+
+
+ --best
+
+
+ Highest compression. Currently synonymous with -8
+
+
+
+
+ -e
+
+
+ Exhaustive model search (expensive!). Normally the encoder estimates the best model to use and encodes once based on the estimate. With an exhaustive model search, the encoder will generate subframes for every order and use the smallest. If the max LPC order is high this can significantly increase the encode time but can shave off another 0.5%.
+
+
+
+
+ -E
+
+
+ Do escape coding in the entropy coder. This causes the encoder to use an unencoded representation of the residual in a partition if it is smaller. It increases the runtime and usually results in an improvement of less than 1%.
+
+
+
+
+ -l #
+
+
+ Specifies the maximum LPC order. This number must be <= 32. If 0, the encoder will not attempt generic linear prediction, and use only fixed predictors. Using fixed predictors is faster but usually results in files being 5-10% larger.
+
+
+
+
+ -q #
+
+
+ Specifies the precision of the quantized LP coefficients, in bits. The default is -q 0, which means let the encoder decide based on the signal. Unless you really know your input file it's best to leave this up to the encoder.
+
+
+
+
+ -p
+
+
+ Do exhaustive LP coefficient quantization optimization. This option overrides any -q option. It is expensive and typically will only improve the compression a tiny fraction of a percent. -q has no effect when -l 0 is used.
+
+
+
+
+ -r [#,]#
+
+
+ Set the [min,]max residual partition order. The min value defaults to 0 if unspecified.
+ By default the encoder uses a single Rice parameter for the subframe's entire residual. With this option, the residual is iteratively partitioned into 2^min# .. 2^max# pieces, each with its own Rice parameter. Higher values of max# yield diminishing returns. The most bang for the buck is usually with -r 2,2 (more for higher block sizes). This usually shaves off about 1.5%. The technique tends to peak out about when blocksize/(2^n)=128. Use -r 0,16 to force the highest degree of optimization.
+
+
+
+
+ -V
+
+
+ Verify the encoding process. With this option, flac will create a parallel decoder that decodes the output of the encoder and compares the result against the original. It will abort immediately with an error if a mismatch occurs. -V increases the total encoding time but is guaranteed to catch any unforseen bug in the encoding process.
+
+
+
+
+
+
+ -F-, -S-, -P-, -m-, -e-, -E-, -p-, -V-, --delete-input-file-, --lax-, --sector-align- can all be used to turn off a particular option.
+
+ metaflac is the command-line .flac file metadata editor. You can use it to list the contents of blocks, delete or insert blocks, and manage padding.
+
+
+ The documentation for metaflac is currently being rewritten, but the usage screen should explain it pretty well. Do metaflac --help to see the full usage.
+
+ All that is necessary is to copy libxmms-flac.so to the directory where XMMS looks for input plugins (usually /usr/lib/xmms/Input). There is nothing else to configure. Make sure to restart XMMS before trying to play any .flac files.
+
+ There are two Winamp plugins; one for Winamp versions 2.x and one for Winamp versions 3.x. If you are using Winamp 2.x, all that is necessary is to copy in_flac.dll to the Plugins/ directory of your Winamp installation. There is nothing else to configure. Make sure to restart Winamp before trying to play any .flac files.
+
+ There are two Winamp plugins; one for Winamp versions 2.x and one for Winamp versions 3.x. If you are using Winamp 3.x, all that is necessary is to copy cnv_flacpcm.wac to the Wacs/ directory of your Winamp installation. There is nothing else to configure. Make sure to restart Winamp before trying to play any .flac files.
+
+ The FLAC library libFLAC is a C implementation of reference encoders and decoders, and a metadata interface. By linking against libFLAC and writing a little code, it is relatively easy to add FLAC support to another program. The library is licensed under the LGPL. Complete source code of libFLAC as well as the command-line encoder and plugins is available and is a useful source of examples.
+
+
+ There is also a C++ object wrapper around libFLAC called libFLAC++; see the documentation below.
+
+
+ libFLAC usually only requires the standard C library and C math library. In particular, threading is not used so there is no dependency on a thread library. However, libFLAC does not use global variables and should be thread-safe.
+
+
+ The libFLAC interface is described in the public header files in the include/FLAC/ directory. The public headers and the compiled library are all that is needed to compile and link against the library. Note that none of the code in src/libFLAC/, including the private header files in src/libFLAC/include/ is required.
+
+
+ Aside from encoders and decoders, libFLAC provides a powerful metadata interface for manipulating metadata in FLAC files. It allows the user to add, delete, and modify FLAC metadata blocks and it can automatically take advantage of PADDING blocks to avoid rewriting the entire FLAC file when changing the size of the metadata. The documentation for the metadata interface is currently being rewritten but there are extensive usage comments in the header file include/FLAC/metadata.h.
+
+
+ The basic usage of a libFLAC encoder or decoder is as follows:
+
+
The program creates an instance of a decoder or encoder using *_new().
+
The program sets the parameters of the instance and callbacks for reading, writing, error reporting, and metadata reporting using *_set_*() functions.
+
The program initializes the instance to validate the parameters and prepare for decoding/encoding using *_init().
+
The program calls *_process_*() functions to encode or decode data, which subsequently calls the callbacks.
+
The program finishes the instance with *_finish(), which flushes the input and output and resets the encoder/decoder to the unitialized state.
+
The instance may be used again or deleted with *_delete().
+
+
+
+ For decoding, libFLAC provides three layers of access. The lowest layer is non-seekable stream-level decoding, the next is seekable stream-level decoding, and the highest layer is file-level decoding. The interfaces are described in stream_decoder.h, seekable_stream_decoder.h, and file_decoder.h respectively. Typically you will choose the highest layer that your input source will support.
+
+
+ The stream decoder relies on callbacks for all input and output and has no provisions for seeking. The seekable stream decoder wraps the stream decoder and exposes functions for seeking. However, you must provide extra callbacks for seek-related operations on your stream, like seek and tell. The file decoder wraps the seekable stream decoder and supplies most of the callbacks internally, simplifying the processing of standard files.
+
+
+ Currently there is only one level of encoder implementation which is at the stream level (stream_encoder.h). There is currently no file encoder because seeking within a file while encoding seemed like too obscure a feature.
+
+
+ Structures and constants related to the format are defined in format.h.
+
+
+ STREAM DECODER
+
+
+ First we discuss the stream decoder. The instance type is FLAC__StreamDecoder. Typically the program will create a new instance by calling FLAC__stream_decoder_new(), then call FLAC__stream_decoder_set_*() functions to set the callbacks and client data, and call FLAC__stream_decoder_init(). The required callbacks are:
+
+
Read callback - This function will be called when the decoder needs more input data. The address of the buffer to be filled is supplied, along with the number of bytes the buffer can hold. The callback may choose to supply less data and modify the byte count but must be careful not to overflow the buffer. The callback then returns a status code chosen from FLAC__StreamDecoderReadStatus.
+
Write callback - This function will be called when the decoder has decoded a single frame of data. The decoder will pass the frame metadata as well as an array of pointers (one for each channel) pointing to the decoded audio.
+
Metadata callback - This function will be called when the decoder has decoded a metadata block. There will always be one STREAMINFO block per stream, followed by zero or more other metadata blocks. These will be supplied by the decoder in the same order as they appear in the stream and always before the first audio frame (i.e. write callback). The metadata block that is passed in must not be modified, and it doesn't live beyond the callback, so you should make a copy of it with FLAC__metadata_object_clone() if you will need it elsewhere. Since metadata blocks can potentially be large, by default the decoder only calls the metadata callback for the STREAMINFO block; you can instruct the decoder to pass or filter other blocks with FLAC__stream_decoder_set_metadata_*() calls.
+
Error callback - This function will be called whenever an error occurs during decoding.
+
+
+
+ Once the decoder is initialized, your program will call one of several functions to start the decoding process:
+
+
FLAC__stream_decoder_process_whole_stream() - Tells the decoder to start and continue processing the stream until the read callback says FLAC__STREAM_DECODER_READ_END_OF_STREAM or FLAC__STREAM_DECODER_READ_ABORT.
+
FLAC__stream_decoder_process_metadata() - Tells the decoder to start processing the stream and stop upon reaching the first audio frame.
+
FLAC__stream_decoder_process_one_frame() - Tells the decoder to process one audio frame and return. The decoder must have processed all metadata first before calling this function.
+
FLAC__stream_decoder_process_remaining_frames() - Tells the decoder to process all remaining frames. The decoder must have processed all metadata first but may also have processed frames with FLAC__stream_decoder_process_one_frame().
+
+
+
+ When the decoder has finished decoding (normally or through an abort), the instance is finished by calling FLAC__stream_decoder_finish(), which ensures the decoder is in the correct state and frees memory. Then the instance may be deleted with FLAC__stream_decoder_delete() or initialized again to decode another stream.
+
+
+ Note that the stream decoder has no real concept of stream position, it just converts data. To seek within a stream the callbacks have only to flush the decoder using FLAC__stream_decoder_flush() and start feeding data from the new position through the read callback. The seekable stream decoder does just this.
+
+
+ SEEKABLE STREAM DECODER
+
+
+ The seekable stream decoder is a wrapper around the stream decoder which also provides seeking capability. The instance type is FLAC__SeekableStreamDecoder. In addition to the Read/Write/Metadata/Error callbacks of the stream decoder, the user must also provide the following:
+
+
Seek callback - This function will be called when the decoder wants to seek to an absolute position in the stream.
+
Tell callback - This function will be called when the decoder wants to know the current absolute position of the stream.
+
Length callback - This function will be called when the decoder wants to know length of the stream. The seeking algorithm currently requires that the overall stream length be known.
+
EOF callback - This function will be called when the decoder wants to know if it is at the end of the stream. This could be determined from the tell and length callbacks but it may be more expensive that way.
+
+
+
+ Seeking is exposed through the FLAC__seekable_stream_decoder_seek_absolute() method. At any point after the seekable stream decoder has been initialized, the user can call this function to seek to an exact sample within the stream. Subsequently, the first time the write callback is called it will contain a (possibly partial) block starting at that sample.
+
+
+ The seekable stream decoder also provides MD5 signature checking. If this is turned on before initialization, FLAC__seekable_stream_decoder_finish() will report when the decoded MD5 signature does not match the one stored in the STREAMINFO block. MD5 checking is automatically turned off if there is no signature in the STREAMINFO block or when a seek is attempted.
+
+
+ FILE DECODER
+
+
+ The file decoder is a trivial wrapper around the seekable stream decoder meant to simplfy the process of decoding from a standard file. The instance type is FLAC__FileDecoder. The file decoder supplies all but the Write/Metadata/Error callbacks. The user needs only to provide the path to the file and the file decoder handles the rest.
+
+
+ Like the seekable stream decoder, seeking is exposed through the FLAC__file_decoder_seek_absolute() method. At any point after the file decoder has been initialized, the user can call this function to seek to an exact sample within the file. Subsequently, the first time the write callback is called it will contain a (possibly partial) block starting at that sample.
+
+
+ The file decoder also inherits MD5 signature checking from the seekable stream decoder. If this is turned on before initialization, FLAC__file_decoder_finish() will report when the decoded MD5 signature does not match the one stored in the STREAMINFO block. MD5 checking is automatically turned off if there is no signature in the STREAMINFO block or when a seek is attempted.
+
+
+ STREAM ENCODER
+
+
+ The stream encoder functions similarly to the stream decoder, but has fewer callbacks and more options. The instance type is FLAC__StreamEncoder. Typically the user will create a new instance by calling FLAC__stream_encoder_new(), then set the necessary parameters with FLAC__stream_encoder_set_*(), and initialize it by calling FLAC__stream_encoder_init().
+
+
+ Unlike the decoding process, FLAC encoding has many options that can affect the speed and compression ratio. When the user calls FLAC__stream_encoder_init() the encoder will validate the values, so you should make sure to check the returned state to see that it is FLAC__STREAM_ENCODER_OK. When setting these parameters you should have some basic knowledge of the format (see the user-level documentation or the formal description) but the required parameters are summarized here:
+
+
streamable_subset - true to force the encoder to generate a Subset stream, else false.
+
do_mid_side_stereo - true to try mid-side encoding on stereo input, else false. channels must be 2.
+
loose_mid_side_stereo - true to do adaptive mid-side switching, else false. do_mid_side_stereo must be true.
+
channels - must be <= FLAC__MAX_CHANNELS.
+
bits_per_sample - do not give the encoder wider data than what you specify here or bad things will happen.
+
sample_rate - must be <= FLAC__MAX_SAMPLE_RATE.
+
blocksize - must be between FLAC__MIN_BLOCKSIZE and FLAC__MAX_BLOCKSIZE.
+
max_lpc_order - 0 implies encoder will not try general LPC, only fixed predictors; must be <= FLAC__MAX_LPC_ORDER.
+
qlp_coeff_precision - must be >= FLAC__MIN_QLP_COEFF_PRECISION, or 0 to let encoder select based on blocksize. In the current imlementation qlp_coeff_precision+bits_per_sample must be < 32.
+
do_qlp_coeff_prec_search - false to use qlp_coeff_precision; true to search around qlp_coeff_precision and take best.
+
do_escape_coding - true => search for escape codes in the entropy coding stage for slightly better compression.
+
do_exhaustive_model_search - false to use estimated bits per residual for scoring; true to generate all and take shortest.
+
min_residual_partition_order, max_residual_partition_order - 0 to estimate Rice parameter based on residual variance; > 0 to partition the residual and use parameter for each based on mean; min_residual_partition_order and max_residual_partition_order specify the min and max Rice partition order.
+
rice_parameter_search_dist - 0 to try only calculated parameter k; else try all [k-rice_parameter_search_dist..k+rice_parameter_search_dist] parameters and use the best.
+
total_samples_estimate - May be set to 0 if unknown. Otherwise, set this to the number of samples to be encoded. This will allow the STREAMINFO block to be more accurate during the first pass in the event that the encoder can't seek back to the beginning of the output file to write the updated STREAMINFO block.
+
metadata - Optional array of pointers to metadata blocks to be written; NULL implies no metadata. The STREAMINFO block is always written automatically and must not be present in the array of pointers.
+
+
+
+ The user provides addresses for the following callbacks:
+
+
Write callback - This function is called anytime there is raw encoded data to write. It may include metadata mixed with encoded audio frames and the data is not guaranteed to be aligned on frame or metadata block boundaries.
+
Metadata callback - This function is called once at the end of encoding with the populated STREAMINFO structure. This is so file encoders can seek back to the beginning of the file and write the STREAMINFO block with the correct statistics after encoding (like minimum/maximum frame size).
+
+ The call to FLAC__stream_encoder_init() currently will also immediately call the write callback with the "fLaC" signature and all the encoded metadata.
+
+
+ After initializing the instance, the user may feed audio data to the encoder in one of two ways:
+
+
Channel separate, through FLAC__stream_encoder_process() - The user will pass an array of pointers to buffers, one for each channel, to the encoder, each of the same length. The samples need not be block-aligned.
+
Channel interleaved, through FLAC__stream_encoder_process_interleaved() - The user will pass a single pointer to data that is channel-interleaved (i.e. channel0_sample0, channel1_sample0, ... , channelN_sample0, channel0_sample1, ...). Again, the samples need not be block-aligned but they must be sample-aligned, i.e. the first value should be channel0_sampleX and the last value channelN_sampleY.
+
+
+
+ When the user is finished encoding data, it calls FLAC__stream_encoder_finish(), which causes the encoder to encode any data still in its input pipe, and call the metadata callback with the final encoding statistics. Then the instance may be deleted with FLAC__stream_encoder_delete() or initialized again to encode another stream.
+
+
+ MISCELLANEOUS
+
+
+ It should be noted that any time an array of pointers to audio data is passed, the channel order currently only has meaning for stereo streams. Channel 0 corresponds to the left channel and channel 1 corresponds to the right channel.
+
+
+ METADATA
+
+
+ For programs that write their own metadata, but that do not know the actual metadata until after encoding, it is advantageous to instruct the encoder to write a PADDING block of the correct size, so that instead of rewriting the whole stream after encoding, the program can just overwrite the PADDING block. If only the maximum size of the metadata is known, the program can write a slightly larger padding block, then split it after encoding.
+
+
+ Make sure you understand how lengths are calculated. All FLAC metadata blocks have a 4 byte header which contains the type and length. This length does not include the 4 bytes of the header. See the format page for the specification of metadata blocks and their lengths.
+
+ libFLAC++ is a C++ object wrapper around libFLAC. It provides classed for the encoders and decoders as well as the metadata interface.
+
+
+ The documentation for libFLAC++ is currently being rewritten. As a wrapper it is actually quite simple. The method names and semantics generally follow those in the C layer and comments in the header files specify where there are differences.
+
+ Bug tracking is done on the Sourceforge project page here. If you submit a bug, make sure and provide an email contact or use the Monitor feature.
+
+
+ The following are major known bugs in the current (1.0.3) release:
+
+
+
+
+ The Winamp2 plugin has a bug where it shows a dialog "ERROR: invalid/missing FLAC metadata" for any .flac file. This has been fixed; you can download the plugin here. The fixed source code is in CVS.
+
+ Monkey's Audio comes with a nice GUI that many people are familiar with. It supports some external encoders, but not FLAC. However, the FLAC Windows distribution comes with a utility that allows you to replace one the of the supported lossless external codecs with FLAC. Here's how:
+
+
Copy flac.exe and flac_ren.exe to the External/ directory of the Monkey's Audio installation.
+
+ Choose a supported encoder to replace:
+
+
Shorten - copy flac_mac.exe on top of External/shortn32.exe
+
WavPack - copy flac_mac.exe on top of both External/wavpack.exe and External/wvunpack.exe
+
RKAU - copy flac_mac.exe on top of External/rkau.exe
+
+ If you choose WavPack you will also be able to use the WavPack Configuration menu to add flac options.
+
+
Now you can encode FLAC files as if you were using the replaced encoder. The renamed flac_mac.exe utility will call flac.exe and afterwards, flac_ren.exe will rename the resulting file to have the .flac extension.
+
+
+
+ Other front-ends may be wedged in the same way; if you have one in mind, post it to the flac-dev mailing list.
+
+ Currently all releases are made through SourceForge and can be found here. For each version there is a source release and binary releases for Linux, Windows, Solaris, and Darwin (includes OS X).
+
+ FLAC stands for Free Lossless Audio Codec. The FLAC project consists of:
+
+
+
+
the stream format
+
libFLAC, a library of reference encoders and decoders, and a metadata interface
+
libFLAC++, an object wrapper around libFLAC
+
flac, a command-line wrapper around libFLAC to encode and decode .flac files
+
metaflac, a command-line metadata editor for .flac files
+
input plugins for various music players (Winamp, XMMS, and more in the works)
+
+
+
+ "Free" means that the specification of the stream format is in the public domain (the FLAC project reserves the right to set the FLAC specification and certify compliance), and that neither the FLAC format nor any of the implemented encoding/decoding methods are covered by any patent. It also means that the sources for libFLAC and libFLAC++ are available under the LGPL and the sources for flac, metaflac, and the plugins are available under the GPL.
+
+
+ FLAC compiles on many platforms: most Unixes (Linux, *BSD, Solaris, OS X), Windows, BeOS, and OS/2. There are build systems for autoconf/automake, MSVC, Watcom C, and Project Builder.
+
+
+ What FLAC is:
+
+
+
+ FLAC is patent free. The FLAC format or encoding/decoding methods are not covered by any patents.
+
+
+ FLAC is lossless. The encoding of PCM data incurs no loss of information, and the decoded audio is bit-for-bit identical to what went into the encoder. Each frame contains a 16-bit CRC of the frame data for detecting transmission errors. The integrity of the audio data is further insured by storing an MD5 signature of the original unencoded audio data in the file header, which can be compared against later during decoding or testing.
+
+
+ FLAC is designed to compress audio data. Technically, flac can "compress" other kinds of data losslessly (if you pass it in as a mono 8-bit raw file), but the output files tend to be bigger.
+
+
+ The compression capabilities of FLAC are extendable, meaning that new methods can be added to future versions of the format without breaking older streams or decoders.
+
+
+ The currently implemented compression methods in the reference encoder yield streams smaller than shorten. The encoding time is variable, but is generally between that of shorten, and that of, say, LAME. The most aggressive compression however can be quite slow. For more info see the comparison page.
+
+
+ FLAC is asymmetric in favor of decode speed. Decoding requires only integer arithmetic, and is much less compute-intensive than for most perceptual codecs. Real-time decode performance is easily achievable on even modest hardare.
+
+
+ FLAC is suitable for archiving, since there is no information loss. You are not locked into the format since there is no generation loss if you decide to convert your data to another format in the future. In addition to the frame CRCs and MD5 signature, flac has a verify option that decodes the encoded stream in parallel with the encoding process and compares the result to the original, aborting with an error if there is a mismatch.
+
+
+ FLAC is suitable for streaming. Each FLAC frame contains enough data to decode that frame. FLAC does not even rely on previous or following frames. FLAC uses sync codes and CRCs (similar to MPEG and other formats), which, along with framing, allow decoders to pick up in the middle of a stream with a minimum of delay.
+
+
+ FLAC supports fast sample-accurate seeking. Not only is this useful for playback, it makes FLAC files suitable for use in editing applications.
+
+
+ FLAC has an extendable metadata system. New metadata blocks can be defined and implemented in future versions of FLAC without breaking older streams or decoders. Applications can write their own APPLICATION metadata once they register an ID. ID3 and ID3V2 tags may be attached to .flac files without disrupting the decoder.
+
+
+
+ Some things that follow from the features:
+
+
+
+ FLAC streams can be played back consecutively with no audible gaps in between, unlike say, MP3s (this is one of the minor goals). For example, you can encode a live album as individual tracks and still play them back seamlessly.
+
+
+ The sample-accurate seeking allows versatile playback: a sophisticated player could do index points, complex looping, or other structured playback. This could be useful in for say DJs, or practice sessions where you want to play along through specific passages.
+
+
+ Basically, you get the versatility of a WAV file in a compressed streamable format.
+
+
+
+ What FLAC is not:
+
+
+
+ Lossy. FLAC is intended for lossless compression only, as there are many good lossy formats already, such as MP3 (see LAME for an excellent open-source implementation), and Ogg Vorbis.
+
+
+ SDMI compliant, et cetera. There is no intention to support any methods of copy protection, which are, for all practical purposes, a complete waste of bits. (Another way to look at it is that since copy protection is futile, it really carries no information, so you might say FLAC already losslessly compresses all possible copy protection information down to zero bits!) Of course, we can't stop what some misguided person does with proprietary meta-data blocks, but then again, non-proprietary decoders will skip them anyway.
+
+ This is a detailed description of the FLAC format.
+
+
+ First, as the original developer I have to say that I am not a compression expert and I feel obligated to give credit where it is due. FLAC owes a lot to the many people who have advanced the audio compression field so freely. For instance:
+
+
+
+
+ A. J. Robinson for his work on Shorten; his code and paper are a good starting point on some of the basic methods used by FLAC. FLAC expands on the fixed predictors used in shorten.
+
+
+ S. W. Golomb and Robert F. Rice; their universal codes are used by FLAC's entropy coder.
+
+
+ N. Levinson and J. Durbin; the reference encoder uses an algorithm developed and refined by them for determining the LPC coefficients from the autocorrelation coefficients.
+
+ It is a known fact that no algorithm can losslessly compress all possible input, so most compressors restrict themselves to a useful domain and try to work as well as possible within that domain. FLAC's domain is audio data. Though it can losslessly code any input, only certain kinds of input will get smaller. FLAC exploits the fact that audio data typically has a high degree of sample-to-sample correlation.
+
+
+ Within the audio domain, there are many possible subdomains. For example: low bitrate speech, high-bitrate multi-channel music, etc. FLAC itself does not target a specific subdomain but many of the default parameters of the reference encoder are tuned to CD-quality music data (i.e. 44.1kHz, 2 channel, 16 bits per sample). The effect of the encoding parameters on different kinds of audio data will be examined later.
+
+ Similar to many audio coders, a FLAC encoder has the following stages:
+
+
+
+ Blocking. The input is broken up into many contiguous blocks. With FLAC, the blocks may vary in size. The optimal size of the block is usually affected by many factors, including the sample rate, spectral characteristics over time, etc. Though FLAC allows the block size to vary within a stream, the reference encoder uses a fixed block size.
+
+
+ Interchannel Decorrelation. In the case of stereo streams, the encoder will create mid and side signals based on the average and difference (respectively) of the left and right channels. The encoder will then pass the best form of the signal to the next stage.
+
+
+ Prediction. The block is passed through a prediction stage where the encoder tries to find a mathematical description (usually an approximate one) of the signal. This description is typically much smaller than the raw signal itself. Since the methods of prediction are known to both the encoder and decoder, only the parameters of the predictor need be included in the compressed stream. FLAC currently uses four different classes of predictors (described in the prediction section), but the format has reserved space for additional methods. FLAC allows the class of predictor to change from block to block, or even within the channels of a block.
+
+
+ Residual coding. If the predictor does not describe the signal exactly, the difference between the original signal and the predicted signal (called the error or residual signal) must be coded losslessy. If the predictor is effective, the residual signal will require fewer bits per sample than the original signal. FLAC currently uses only one method for encoding the residual (see the Residual coding section), but the format has reserved space for additional methods. FLAC allows the residual coding method to change from block to block, or even within the channels of a block.
+
+
+
+ In addition, FLAC specifies a metadata system, which allows arbitrary information about the stream to be included at the beginning of the stream.
+
+ Many terms like "block" and "frame" are used to mean different things in differenct encoding schemes. For example, a frame in MP3 corresponds to many samples across several channels, whereas an S/PDIF frame represents just one sample for each channel. The definitions we use for FLAC follow. Note that when we talk about blocks and subblocks we are refering to the raw unencoded audio data that is the input to the encoder, and when we talk about frames and subframes, we are refering to the FLAC-encoded data.
+
+
+
+ Block: One or more audio samples that span several channels.
+
+
+ Subblock: One or more audio samples within a channel. So a block contains one subblock for each channel, and all subblocks contain the same number of samples.
+
+
+ Blocksize: The number of samples in any of a block's subblocks. For example, a one second block sampled at 44.1KHz has a blocksize of 44100, regardless of the number of channels.
+
+
+ Frame: A frame header plus one or more subframes.
+
+
+ Subframe: A subframe header plus one or more encoded samples from a given channel. All subframes within a frame will contain the same number of samples.
+
+ The size used for blocking the audio data has a direct effect on the compression ratio. If the block size is too small, the resulting large number of frames mean that excess bits will be wasted on frame headers. If the block size is too large, the characteristics of the signal may vary so much that the encoder will be unable to find a good predictor. In order to simplify encoder/decoder design, FLAC imposes a minimum block size of 16 samples, and a maximum block size of 65535 samples. This range covers the optimal size for all of the audio data FLAC supports.
+
+
+ Currently the reference encoder uses a fixed block size, optimized on the sample rate of the input. Future versions may vary the block size depending on the characteristics of the signal.
+
+
+ Blocked data is passed to the predictor stage one subblock (channel) at a time. Each subblock is independently coded into a subframe, and the subframes are concatenated into a frame. Because each channel is coded separately, it means that one channel of a stereo frame may be encoded as a constant subframe, and the other an LPC subframe.
+
+ In stereo streams, in many cases there is an exploitable amount of correlation between the left and right channels. FLAC allows the frames of stereo streams to have different channel assignments, and an encoder may choose to use the best representation on a frame-by-frame basis.
+
+
+
+ Independent. The left and right channels are coded independently.
+
+
+ Mid-side. The left and right channels are transformed into mid and side channels. The mid channel is the midpoint (average) of the left and right signals, and the side is the difference signal (left minus right).
+
+
+ Left-side. The left channel and side channel are coded.
+
+
+ Right-side. The right channel and side channel are coded
+
+
+
+ Surprisingly, the left-side and right-side forms can be the most efficient in many frames, even though the raw number of bits per sample needed for the original signal is slightly more than that needed for independent or mid-side coding.
+
+ FLAC uses four methods for modeling the input signal:
+
+
+
+ Verbatim. This is essentially a zero-order predictor of the signal. The predicted signal is zero, meaning the residual is the signal itself, and the compression is zero. This is the baseline against which the other predictors are measured. If you feed random data to the encoder, the verbatim predictor will probably be used for every subblock. Since the raw signal is not actually passed through the residual coding stage (it is added to the stream 'verbatim'), the encoding results will not be the same as a zero-order linear predictor.
+
+
+ Constant. This predictor is used whenever the subblock is pure DC ("digital silence"), i.e. a constant value throughout. The signal is run-length encoded and added to the stream.
+
+
+ Fixed linear predictor. FLAC uses a class of computationally-efficient fixed linear predictors (for a good description, see audiopak and shorten). FLAC adds a fourth-order predictor to the zero-to-third-order predictors used by Shorten. Since the predictors are fixed, the predictor order is the only parameter that needs to be stored in the compressed stream. The error signal is then passed to the residual coder.
+
+
+ FIR Linear prediction. For more accurate modeling (at a cost of slower encoding), FLAC supports up to 32nd order FIR linear prediction (again, for info on linear prediction, see audiopak and shorten). The reference encoder uses the Levinson-Durbin method for calculating the LPC coefficients from the autocorrelation coefficients, and the coefficients are quantized before computing the residual. Whereas encoders such as Shorten used a fixed quantization for the entire input, FLAC allows the quantized coefficient precision to vary from subframe to subframe. The FLAC reference encoder estimates the optimal precision to use based on the block size and dynamic range of the original signal.
+
+ FLAC currently defines two similar methods for the coding of the error signal from the prediction stage. The error signal is coded using Rice codes in one of two ways: 1) the encoder estimates a single rice parameter based on the variance of the residual and Rice codes the entire residual using this parameter; 2) the residual is partitioned into several equal-length regions of contiguous samples, and each region is coded with its own Rice parameter based on the region's mean. (Note that the first method is a special case of the second method with one partition, except the Rice parameter is based on the residual variance instead of the mean.)
+
+
+ The FLAC format has reserved space for other coding methods. Some possiblities for volunteers would be to explore better context-modeling of the Rice parameter, or Huffman coding. See LOCO-I and pucrunch for descriptions of several universal codes.
+
+
+ Format
+
+
+ This section specifies the FLAC bitstream format. FLAC has no format version information, but it does contain reserved space in several places. Future versions of the format may use this reserved space safely without breaking the format of older streams. Older decoders may choose to abort decoding or skip data encoded with newer methods. Apart from reserved patterns, in places the format specifies invalid patterns, meaning that the patterns may never appear in any valid bitstream, in any prior, present, or future versions of the format. These invalid patterns are usually used to make the synchronization mechanism more robust.
+
+
+ All numbers used in a FLAC bitstream are integers; there are no floating-point representations. All numbers are big-endian coded. All numbers are unsigned unless otherwise specified.
+
+ Before the formal description of the stream, an overview might be helpful.
+
+
+
+ A FLAC bitstream consists of the "fLaC" marker at the beginning of the stream, followed by a mandatory metadata block (called the STREAMINFO block), any number of other metadata blocks, then the audio frames.
+
+
+ FLAC supports up to 128 kinds of metadata blocks; currently the following are defined:
+
+ The audio data is composed of one or more audio frames. Each frame consists of a frame header, which contains a sync code, info about the frame like the block size, sample rate, number of channels, et cetera, and an 8-bit CRC. The frame header also contains either the sample number of the first sample in the frame (for variable-blocksize streams), or the frame number (for fixed-blocksize streams). This allows for fast, sample-accurate seeking to be performed. Following the frame header are encoded subframes, one for each channel, and finally, the frame is zero-padded to a byte boundary. Each subframe has its own header that specifies how the subframe is encoded.
+
+
+ Since a decoder may start decoding in the middle of a stream, there must be a method to determine the start of a frame. A 14-bit sync code begins each frame. The sync code will not appear anywhere else in the frame header. However, since it may appear in the subframes, the decoder has two other ways of ensuring a correct sync. The first is to check that the rest of the frame header contains no invalid data. Even this is not foolproof since valid header patterns can still occur within the subframes. The decoder's final check is to generate an 8-bit CRC of the frame header and compare this to the CRC stored at the end of the frame header.
+
+
+ Again, since a decoder may start decoding at an arbitrary frame in the stream, each frame header must contain some basic information about the stream because the decoder may not have access to the STREAMINFO metadata block at the start of the stream. This information includes sample rate, bits per sample, number of channels, etc. Since the frame header is pure overhead, it has a direct effect on the compression ratio. To keep the frame header as small as possible, FLAC uses lookup tables for the most commonly used values for frame parameters. For instance, the sample rate part of the frame header is specified using 4 bits. Eight of the bit patterns correspond to the commonly used sample rates of 8/16/22.05/24/32/44.1/48/96 kHz. However, odd sample rates can be specified by using one of the 'hint' bit patterns, directing the decoder to find the exact sample rate at the end of the frame header. The same method is used for specifying the block size and bits per sample. In this way, the frame header size stays small for all of the most common forms of audio data.
+
+
+ Individual subframes (one for each channel) are coded separately within a frame, and appear serially in the stream. In other words, the encoded audio data is NOT channel-interleaved. This reduces decoder complexity at the cost of requiring larger decode buffers. Each subframe has its own header specifying the attributes of the subframe, like prediction method and order, residual coding parameters, etc. The header is followed by the encoded audio data for that channel.
+
+ The blocksize bits in the frame header must be 0001-0101 or 1000-1111, specifying a fixed-blocksize stream (the exception being the last block as described in the table). This also means that the STREAMINFO metadata block must specify equal mininum and maximum blocksizes.
+
+
+ The bits-per-sample bits in the frame header must be 001-110.
+
+
+ The sample rate bits in the frame header must be 0001-1011.
+
+
+
+
+
+
+ The following tables constitute a formal description of the FLAC format. Numbers in angle brackets indicate how many bits are used for a given field.
+
+ The minimum block size (in samples) used in the stream.
+
+
+
+
+ <16>
+
+
+ The maximum block size (in samples) used in the stream. (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.
+
+
+
+
+ <24>
+
+
+ The minimum frame size (in bytes) used in the stream. May be 0 to imply the value is not known.
+
+
+
+
+ <24>
+
+
+ The maximum frame size (in bytes) used in the stream. May be 0 to imply the value is not known.
+
+
+
+
+ <20>
+
+
+ Sample rate in Hz. Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 1048570Hz. Also, a value of 0 is invalid.
+
+
+
+
+ <3>
+
+
+ (number of channels)-1. FLAC supports from 1 to 8 channels
+
+
+
+
+ <5>
+
+
+ (bits per sample)-1. FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample.
+
+
+
+
+ <36>
+
+
+ Total samples in stream. 'Samples' means inter-channel sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels. A value of zero here means the number of total samples is unknown.
+
+
+
+
+ <128>
+
+
+ MD5 signature of the unencoded audio data. This allows the decoder to determine if an error exists in the audio data even when the error does not result in an invalid bitstream.
+
+
+
+
+
+
+ NOTES
+
+
+ FLAC specifies a minimum block size of 16 and a maximum block size of 65535, meaning the bit patterns corresponding to the numbers 0-15 in the minimum blocksize and maximum blocksize fields are invalid.
+
+ The contents of a vorbis comment packet as specified here, including the vendor string. Note that the vorbis comment spec allows for on the order of 2 ^ 64 bytes of data where as the FLAC metadata block is limited to 2 ^ 24 bytes. Given the stated purpose of vorbis comments, i.e. human-readable textual information, this limit is unlikely to be restrictive. Also note that the 32-bit field lengths are little-endian coded according to the vorbis spec, as opposed to the usual big-endian coding of fixed-length integers in the rest of FLAC.
+
+ 0010-0101 : 576 * (2^(n-2)) samples, i.e. 576/1152/2304/4608
+
+
+ 0110 : get 8 bit (blocksize-1) from end of header
+
+
+ 0111 : get 16 bit (blocksize-1) from end of header
+
+
+ 1000-1111 : 256 * (2^(n-8)) samples, i.e. 256/512/1024/2048/4096/8192/16384/32768
+
+
+
+
+
+
+ <4>
+
+
+ Sample rate:
+
+
+ 0000 : get from STREAMINFO metadata block
+
+
+ 0001-0011 : reserved
+
+
+ 0100 : 8kHz
+
+
+ 0101 : 16kHz
+
+
+ 0110 : 22.05kHz
+
+
+ 0111 : 24kHz
+
+
+ 1000 : 32kHz
+
+
+ 1001 : 44.1kHz
+
+
+ 1010 : 48kHz
+
+
+ 1011 : 96kHz
+
+
+ 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
+
+
+ 1111 : invalid, to prevent sync-fooling string of 1s
+
+
+
+
+
+
+ <4>
+
+
+ Channel assignment
+
+
+ 0000-0111 : (number of independent channels)-1. when == 0001, channel 0 is the left channel and channel 1 is the right
+
+
+ 1000 : left/side stereo: channel 0 is the left channel, channel 1 is the side(difference) channel
+
+
+ 1001 : right/side stereo: channel 0 is the side(difference) channel, channel 1 is the right channel
+
+
+ 1010 : mid/side stereo: channel 0 is the mid(average) channel, channel 1 is the side(difference) channel
+
+
+ 1011-1111 : reserved
+
+
+
+
+
+
+ <3>
+
+
+ Sample size in bits:
+
+
+ 000 : get from STREAMINFO metadata block
+
+
+ 001 : 8 bits per sample
+
+
+ 010 : 12 bits per sample
+
+
+ 011 : reserved
+
+
+ 100 : 16 bits per sample
+
+
+ 101 : 20 bits per sample
+
+
+ 110 : 24 bits per sample
+
+
+ 111 : reserved
+
+
+
+
+
+
+ <1>
+
+
+ Zero bit padding, to prevent sync-fooling string of 1s
+
+
+
+
+ <?>
+
+
+ if(variable blocksize)
+ <8-56>:"UTF-8" coded sample number (decoded number is 36 bits)
+ else
+ <8-48>:"UTF-8" coded frame number (decoded number is 31 bits)
+
+
+
+
+ <?>
+
+
+ if(blocksize bits == 011x)
+ 8/16 bit (blocksize-1)
+
+ CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0) of everything before the crc, including the sync code
+
+
+
+
+
+
+ NOTES
+
+
+ The blocksize bits 0000-0101 and 1000-1111 may only be used if the blocksize is fixed throughout the entire stream. Blocksize bits 0110-0111 may be used in any case but the decoder will have to pessimistically guess that it is a variable-blocksize stream. There is only one special case: the encoder may use blocksize bits 0110-0111 on the last frame of a fixed-blocksize stream, as long as the blocksize is not greater than the stream blocksize.
+
+
+ The "UTF-8" coding used for the sample/frame number is the same variable length code used to store compressed UCS-2, extended to handle larger input.
+
+ Since FLAC is an open-source project, it's important to have a set of goals that everyone works to. They may change slightly from time to time but they're a good guideline. Changes should be in line with the goals and should not attempt to embrace any of the anti-goals!
+
+
+ Goals
+
+
+
+
+ FLAC should be and stay an open format. The source code is all either LGPL'd or GPL'd.
+
+
+ FLAC should be lossless. This seems obvious but lossy compression seems to creep into every audio codec. This goal also means that flac should stay archival quality and be truly lossless for all input. Testing of releases should be thorough.
+
+
+ FLAC should yield respectable compression, on par or better than other lossless codecs.
+
+
+ FLAC should allow at least realtime decoding on even modest hardware.
+
+
+ FLAC should support fast sample-accurate seeking.
+
+
+ FLAC should allow gapless playback of consecutive streams. This follows from the lossless goal.
+
+
+ The FLAC project owes a lot to the many people who have advanced the audio compression field so freely, and aims also to contribute through the open-source development of new ideas.
+
+
+
+
+ Anti-goals
+
+
+
+
+ Lossy compression. There are already many suitable lossy format (Ogg Vorbis, MP3, etc.).
+
+
+ Copy protection of any kind. Don't get me started, just see the features page for the short answer.
+
+ FLAC allows third-party applications to register an ID for use with FLAC APPLICATION metadata blocks. Use the following form to request an ID, or to submit a change to an existing ID.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id directory
+
+
+
+
+
+
+ Here is a list of all registered IDs and their applications:
+
+
+
+
diff --git a/doc/html/images/1x1.gif b/doc/html/images/1x1.gif
new file mode 100644
index 00000000..f14ea135
Binary files /dev/null and b/doc/html/images/1x1.gif differ
diff --git a/doc/html/images/Makefile.am b/doc/html/images/Makefile.am
new file mode 100644
index 00000000..b3c744f2
--- /dev/null
+++ b/doc/html/images/Makefile.am
@@ -0,0 +1,27 @@
+# FLAC - Free Lossless Audio Codec
+# Copyright (C) 2001,2002 Josh Coalson
+#
+# This program is part of FLAC; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+AUTOMAKE_OPTIONS = foreign
+
+docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)/html/images
+
+doc_DATA = \
+ 1x1.gif \
+ cafebug.gif \
+ logo.jpg
+
+EXTRA_DIST = $(doc_DATA)
diff --git a/doc/html/images/cafebug.gif b/doc/html/images/cafebug.gif
new file mode 100644
index 00000000..3d0c90fd
Binary files /dev/null and b/doc/html/images/cafebug.gif differ
diff --git a/doc/html/images/logo.jpg b/doc/html/images/logo.jpg
new file mode 100644
index 00000000..9a995bd1
Binary files /dev/null and b/doc/html/images/logo.jpg differ
diff --git a/doc/html/index.html b/doc/html/index.html
new file mode 100644
index 00000000..74ae7717
--- /dev/null
+++ b/doc/html/index.html
@@ -0,0 +1,294 @@
+
+
+
+
+
+
+
+
+
+ FLAC - Free Lossless Audio Codec
+
+
+
+
+
FLAC 1.0.3 is out. This release includes a decoder speedup, 24-bit input support, more robust plugins, a new metadata block for Vorbis-style tags, a vastly improved metadata editor, and for developers, a new C++ object wrapper library around libFLAC, among other things. For a complete list see here.
+
Also note that PhatNoise now officially supports FLAC in both the PhatBox/Kenwood Music Keg firmware and the PhatNoise Music Manager software; see the announcement here for more info.
+ FLAC stands for Free Lossless Audio Codec. Grossly oversimplified, FLAC is similar to MP3, but lossless. The FLAC project consists of:
+
+
+
+
the stream format
+
libFLAC, a library of reference encoders and decoders, and a metadata interface
+
libFLAC++, an object wrapper around libFLAC
+
flac, a command-line wrapper around libFLAC to encode and decode .flac files
+
metaflac, a command-line metadata editor for .flac files
+
input plugins for various music players (Winamp, XMMS, and more in the works)
+
+
+
+ "Free" means that the specification of the stream format is in the public domain (the FLAC project reserves the right to set the FLAC specification and certify compliance), and that neither the FLAC format nor any of the implemented encoding/decoding methods are covered by any patent. It also means that the sources for libFLAC and libFLAC++ are available under the LGPL and the sources for flac, metaflac, and the plugins are available under the GPL.
+
+
+ FLAC compiles on many platforms: most Unixes (Linux, *BSD, Solaris, OS X), Windows, BeOS, and OS/2. There are build systems for autoconf/automake, MSVC, Watcom C, and Project Builder.
+
+ Visit the download page for links to the source code or pre-built binaries, or go directly to the source on SourceForge.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ documentation
+
+
+
+
+
+
+ The documentation is available online as well as in the distributions. The general installation and usage documentation for flac and the plugins is here. For a detailed description of the FLAC format and reference encoder see the FLAC format page.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id registration
+
+
+
+
+
+
+ If you have an application that uses FLAC and would like it to be able to tag .flac files with custom metadata, visit the registration page to register an ID for your application.
+
+ FLAC 1.0.3 released Although by version number only a 0.0.1 increment, this release is significant. Remember, micro-revisions mean the FLAC format remains both forward and backward compatible, however, the libFLAC API has changed for the better.
+
+ New features:
+
+
24-bit input support restored in flac.
+
Decoder speedup in libFLAC, which is directly passed on to the command-line decoder and plugins.
+
New -F option to flac to continue decoding in spite of errors.
+
Correctly set granulepos in Ogg packets so seeking Ogg FLAC streams will be easier.
+
New VORBIS_COMMENT metadata block for tagging with Vorbis-style comments.
+
Vastly improved metaflac, now with many editing and tagging options.
+
Partial id3v1 support in Winamp plugins.
+
Updated Winamp 3 plugin.
+
Note: new semantics for -P option in flac.
+
Note: removed -R option in flac.
+
+
+ New library features:
+
+
Previously mentioned decoder speedup in libFLAC.
+
New metadata interface to libFLAC for manipulating metadata in FLAC files.
+
New libFLAC++ API, an object wrapper around libFLAC.
+
New VORBIS_COMMENT metadata block for tagging with Vorbis-style comments.
+
Customizable metadata filtering by type in decoders.
+
Stream encoder can take an arbitrary list of metadata blocks, instead of just one SEEKTABLE and/or PADDING block.
+
+
+ Bugs fixed:
+
+
Fixed bug with using pipes under Windows.
+
Fixed several bugs in the plugins and made them more robust in general.
+
Fixed bug in flac where decoding to WAVE of a FLAC file with 0 for total_samples in the STREAMINFO block yielded a WAVE chunk of 0 size.
+ FLAC goes hardware!Phatnoise has become the first commercial hardware platform to support FLAC. Firmware is now available for the Phatbox player to play FLAC files. See here for details.
+
+ FLAC 1.0.2 released This release is only to fix a bug that was causing some of the plugins to crash sporadically. It can also affect libFLAC users that reuse one file decoder instance for multiple files; see here for more.
+
+ FLAC 1.0.1 released The core codec is unchanged but there have been some features added and some bugs fixed:
+
+ New features for users:
+
+
Support for Ogg-FLAC, i.e. flac can now read and write FLAC streams using Ogg as the transport layer.
+
New Winamp 3 plugin based on the Wasabi Beta 1 SDK.
+
New utilities for adding FLAC support to the Monkey's Audio GUI (see how).
+
Mac OS X support. The download area now contains an OS X binary release.
+
Mingw32 support.
+
Better handling of MS-specific 'fmt' chunks in WAVE files.
+
+
+ New features for developers:
+
+
Added a SeekableStreamDecoder layer between StreamDecoder and FileDecoder. This makes it easier to use libFLAC in situations where files have been abstracted away. See the latest documentation for more. The interface for the StreamDecoder and FileDecoder remain the same and are still binary-compatible with libFLAC 1.0.
+
Drastically reduced the stack requirements of the encoder.
+
+
+ Bug fixes:
+
+
Fixed a serious bug with flac and raw input where the encoder was trying to rewind when it shouldn't, which would add 12 junk samples to the encoded file. This was not present in WAVE encoding.
+
Fixed a minor bug in libFLAC with setting the file name to stdin on a file decoder.
+
Fixed a minor bug in libFLAC where multiple calls to setting the file name on a file decoder caused leaked memory.
+
Fixed a minor bug in metaflac, now correctly skips an id3v2 tag if present.
+
Fixed a minor bug in metaflac, now correctly skips long metadata blocks.
+ FLAC 1.0 is out! It's finally here. There are a few new features but mostly it is minor bug fixes since 0.10:
+
+
New '--sector-align' option to flac which aligns a group of encoded files on CD audio sector boundaries.
+
New '--output-prefix' option to flac to allow the user to prepend a prefix to all output filenames (useful, for example, for encoding/decoding to a different directory).
+
Better WAVE autodetection (doesn't rely on ungetc() anymore).
+
Cleaner one-line encoding/decoding stats.
+
Changes to the libFLAC interface and type names to make binary compatibility easier to maintain in the future.
+
New '--sse-os' option to 'configure' to enable faster SSE-based routines.
+
Another (hopefully last) fix to the Winamp 2 plugin.
+
Slightly improved Rice parameter estimation.
+
Bug fixes for some very rare corner cases when encoding.
+ FLAC 0.10 released. This is probably the final beta. There have been many improvements in the last two months:
+
+
Both the encoder and decoder have been significantly sped up. Aside from C improvements, the code base now has an assembly infrastructure that allows assembly routines for different architectures to be easily integrated. Many key routines have now have faster IA-32 implementations (thanks to Miroslav).
+
A new metadata block SEEKTABLE has been defined to hold an arbitrary number of seek points, which speeds up seeking within a stream.
+
flac now has a command-line usage similar to 'gzip'; make sure to see the latest documentation for the new usage. It also attempts to preserve the input file's timestamp and permissions.
+
The -# options in flac have been tweaked to yield the best compression-to-encode-time ratios. The new default is -5.
+
flac can now usually autodetect WAVE files when encoding so that -fw is usually not needed when encoding from stdin.
+
The WAVE reader in flac now just ignores (with a warning) unsupported sub-chunks instead of aborting with an error.
+
Added an option '--delete-input-file' to flac which automatically deletes the input after a successful encode/decode.
+
Added an option '-o' to flac to force the output file name (the old usage of "flac - outputfilename" is no longer supported).
+
Changed the XMMS plugin to send smaller chunks of samples (now 512) so that visualization is not slow.
+
Fixed a bug in the stream decoder where the decoded samples counter got corrupted after a seek.
+ FLAC 0.9 released. There were some format changes that broke backwards compatibility but these should be the last (see below). Also, there have been several bug fixes and some new features:
+
+
FLAC's sync code has been lengthened to 14 bits from 9 bits. This should enable a faster and more robust synchronization mechanism.
+
Two reserved bits were added to the frame header.
+
A CRC-16 was added to the FLAC frame footer, and the decoder now does frame integrity checking based on the CRC.
+
The format now includes a new subframe field to indicate when a subblock has one or more 0 LSBs for all samples. This increases compression on some kinds of data.
+
Added two options to the analysis mode, one for including the residual signal in the analysis file, and one for generating gnuplot files of each subframe's residual distribution with some statistics. See the latest documentation.
+
XMMS plugin now supports 8-bit files.
+
Fixed a bug in the Winamp2 plugin where the audio sounded garbled.
+
Fixed a bug in the Winamp2 plugin where Winamp would hang sporadically at the end of a track (c.f. bug #231197).
+
+ FLAC is on track for an official 1.0 release soon.
+
+ FLAC 0.8 released. This release is a result of extensive testing and fixes several bugs encountered when pushing the encoder to the limit. I'm pretty confident in the stability of the encoder/decoder now for all kinds of input. There have also been several features added. Here is a complete list of the changes since 0.7:
+
+
Created a new utility called metaflac. It is a metadata editor for .flac files. Right now it just lists the contents of the metadata blocks but eventually it will allow update/insertion/deletion.
+
Added two new metadata blocks: PADDING which has an obvious function, and APPLICATION, which is meant to be open to third party applications. See the latest format docs for more info, or the new id registration page.
+
Added a -P option to flac to reserve a PADDING block when encoding.
+
Added support for 24-bit files to flac (the FLAC format always supported it).
+
Started the Winamp3 plugin.
+
Greatly expanded the test suite, adding more streams (24-bit streams, noise streams, non-audio streams, more patterns) and more option combinations to the encoder. The test suite runs about 30 streams and over 5000 encodings now.
+
Fixed a bug in libFLAC that happened when using an exhaustive LPC coefficient quantization search with 8 bps input.
+
Fixed a bug in libFLAC where the error estimation in the fixed predictor could overflow.
+
Fixed a bug in libFLAC where LPC was attempted even when the autocorrelation coefficients implied it wouldn't help.
+
Reworked the LPC coefficient quantizer, which also fixed another bug that might occur in rare cases.
+
Really fixed the '-V overflow' bug (c.f. bug #231976).
+
Fixed a bug in flac related to the decode buffer sizing.
+
+ FLAC is very close to being ready for an official release. The only known problems left are with the Winamp plugins, which should be fixed soon, and pipes with MSVC.
+
+ FLAC 0.6 released. The encoder is now much faster. The -m option has been sped up by 4x and -r improved, meaning that in the default compression mode (-6), encoding should be at least 3 times faster. Other changes:
+
+
Some bugs related to flac and pipes were fixed (see here for the discussion).
+
A "loose mid-side" (-M) option to the encoder has been added, which adaptively switches between independent and mid-side coding, instead of the exhaustive search that -m does.
+
An analyze mode (-a) has been added to flac. This is useful mainly for developers; currently it will dump info about each frame and subframe to a file. It's a text file in a format that can be easily processed by scripts; a separate analysis program is in the works.
+
The source now has an autoconf/libtool-based build system. This should allow the source to build "out-of-the-box" on many more platforms.
+ FLAC 0.5 released. This is the first beta version of FLAC. Being beta, there will be no changes to the format that will break older streams, unless a serious bug involving the format is found. What this means is that, barring such a bug, streams created with 0.5 will be decodable by future versions. This version also includes some new features:
+
+
An MD5 signature of the unencoded audio is computed during encoding, and stored in the Encoding metadata block in the stream header. When decoding, flac will now compute the MD5 signature of the decoded data and compare it against the signature in the stream header.
+
A test mode (-t) has been added to flac. It works like decode mode but doesn't write an output file.
FLAC 0.4 released. This version fixes a bug in the constant subframe detection. More importantly, a verify option (-V) has been added to flac that verifies the encoding process. With this option turned on, flac will create a parallel decoder while encoding to make sure that the encoded output decodes to exactly match the original input. In this way, any unknown bug in the encoder will be caught and flac will abort with an error message.
FLAC debuts on SourceForge. The FLAC project is now being hosted on SourceForge. Visit the FLAC project page to join the mailing list or sign up as a developer.
+
+
+
+
+
+
+
+
+
+
+
+
+
Copyright (c) 2000,2001,2002 Josh Coalson
+
+
+
diff --git a/doc/html/ru/Makefile.am b/doc/html/ru/Makefile.am
new file mode 100644
index 00000000..c02cb2c9
--- /dev/null
+++ b/doc/html/ru/Makefile.am
@@ -0,0 +1,36 @@
+# FLAC - Free Lossless Audio Codec
+# Copyright (C) 2001,2002 Josh Coalson
+#
+# This program is part of FLAC; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+AUTOMAKE_OPTIONS = foreign
+
+docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)/html/ru
+
+doc_DATA = \
+ authors.html \
+ comparison.html \
+ developers.html \
+ documentation.html \
+ download.html \
+ features.html \
+ format.html \
+ goals.html \
+ id.html \
+ index.html \
+ links.html \
+ news.html
+
+EXTRA_DIST = $(doc_DATA)
diff --git a/doc/html/ru/authors.html b/doc/html/ru/authors.html
new file mode 100644
index 00000000..38647e71
--- /dev/null
+++ b/doc/html/ru/authors.html
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+FLAC: авторы
+
+
+
+
Целью этой страницы является сравнение FLAC с другими аналогичными кодеками. Исследование затрагивает не только уровень и время сжатия, но и другие важные для пользователя возможности кодеков. Выбирая для себя кодек, помните о следующем:
+
+
+
Насколько я знаю, только три кодека (Bonk, FLAC и Kexis) полностью свободны (лицензия Shorten более ограничена). Большинство предоставляют свободные скомпилированные программы без доступа к исходным кодам, следовательно, выбирая их, Вы попадаете в зависимость от производителя. У вас уже не будет шанса портировать программу на другую операционную систему или исправить ошибку, если она появится, если этого не захочет сделать автор. Это может оказаться серьезным недостатком, если формат не является всемирно признаным.
+
+
Уровень и время сжатия характеризуют только конкретную версию енкодера. Они не выявляют предела для всех енкодеров и формата FLAC, так как формат открытый и расширяемый и каждый может написать улучшенную версию. Можно с большой долей уверенности сказать, что кодек будет улучшаться.
+
+
Поддержка потокового формата у FLAC дает ему дополнительное преимущество над теми кодеками, которые такой возможности не имеют.
+
+
+
Я постараюсь обновлять информацию на этой странице как можно чаще, однако, если вы заметите какую-либо неточность, сообщите мне и я исправлю ее.
Bonk - открытый кодек. Нет отдельной библиотеки и поддержки плейера.
+
+
FROG - закрытый кодек только для Windows с плагином для Winamp.
+
+
Kexis - открытый кодек. Находится на альфа-стадии разработки. Нет поддержки плейера. Последнее обновление 24 августа 2000 года. Похоже, проект заглох.
+
+
Ogg Squish - открытый кодек, но более неподдерживаемый. Тестируемая версия 0.98 была последней, которую можно найти. Версии для Windows не было, но судя по результатам, полученным под Unix, это "быстрый" кодек.
+
+
LPAC - поставляется только скомпилированным. Доступны версии не только для Windows, хотя плагин есть только для Winamp. Последнее обновление 25 февраля 2001 года.
+
+
Monkey's Audio - закрытый кодек только для Windows, есть плагин для Winamp.
RKAU - закрытый кодек только для Windows. Последнее обновление 28 октября 2000 года.
+
+
Shorten - наиболее распространенный кодек с доступными исходными текстами.
+
+
WaveZIP - закрытый архиватор только для Windows. Использует движок MUSICompress[tm], который, предположительно, запатентован. Я хотел сделать ссылку на компанию, написавшую WaveZIP (GadgetLabs), но они завершили свою деятельность (может, потому что пытались продать то, не должно ничего стоить).
Я не смог достать копии кодеков AudioPack и WavARC.
+
+
Если не принимать во внимание уровень и скорость сжатия (как вы увидите позже, большинство кодеков имеют сходную производительность), то субъективная картина, основанная на базовых возможностях будет выглядеть следующим образом. Основное преимущество имеют свободные кодеки, так как это предоставляет Вам возможность добавлять все, что необходимо. Кроме того, проекты с открытыми исходниками обычно развиваются и улучшаются быстрее. Второй важный для пользователя фактор - это поддержка разных операционных систем и/или возможность использования плагинов для плейеров.
+
+
Таблица 1. Сравнение возможностей кодеков.
+
+
+
+Кодек
+
+Доступны тексты?
+
+Поддержка ОС
+
+Доступны плагины?
+
+Поточность?
+
+Поиск?
+
+Цена
+
+
flac v1.0.2
+
да
+
любая
+
да (Winamp, XMMS, Apollo, dBpowerAMP)
+
да
+
да
+
своб.
+
+
Shorten v3.2
+
да
+
любая
+
да (Winamp, XMMS)
+
нет
+
нет (только v3)
+
своб.
+
+
Ogg Squish 0.98
+
да
+
любая
+
нет?
+
да
+
да
+
своб.
+
+
Bonk 0.5
+
да
+
любая
+
нет
+
нет
+
нет
+
своб.
+
+
Kexis 0.2.2
+
да
+
любая
+
нет
+
нет
+
нет
+
беспл.
+
+
LPAC v1.31 (codec 3.0)
+
нет
+
Windows/Linux/Solaris
+
да (Winamp)
+
нет?
+
да
+
беспл.
+
+
Monkey's Audio v3.80
+
нет
+
Windows
+
да (Winamp, MediaJukebox, dBpowerAMP)
+
нет
+
да
+
беспл.
+
+
WavPack v3.91
+
нет
+
Windows
+
да (Winamp)
+
нет
+
да
+
беспл.
+
+
Frog 6.61
+
нет
+
Windows
+
да (Winamp)
+
нет
+
да
+
беспл.
+
+
RKAU v1.06
+
нет
+
Windows
+
да (Winamp)
+
нет
+
да
+
беспл.
+
+
WaveZIP v2
+
нет
+
Windows
+
нет
+
нет
+
нет
+
беспл. (24-бит $)
+
+
Pegasus-SPS
+
нет
+
Windows
+
нет
+
нет
+
нет
+
$39 (trial)
+
+
+
Для тестирования использовался PII-333 с 256Mб и ОС Windows NT SP5. К сожалению, именно Windows явлется единственной операционной системой, под которой могут работать все кодеки и где можно добиться равных условий работы.
+
+
Входными данными являются только файлы, записанные с аудио-CD. В будущем могут появиться тесты для других видов информации (например, речь, другие частоты дискретизации и т.д.). Представлены 14 треков различных стилей.
+
+
Во всех таблицах результаты отсортированы по уровню сжатия (= размер_сжатого_файла / размер_несжатого_файла). В первой таблице приведен итог тестирования по всем трекам. Во второй находятся результаты енкодера на каждом треке.
+
+
Необходимо сделать несколько замечаний: настроки качества LPAC становятся нестабильными при использовании ключа -r (добавляет возможность поиска при воспроизведении). В большинстве случаев режим 'normal' делает файлы меньшего размера и работает быстрее. У RKAU размер файла также может возрастать в режиме 'high' (высокая степень сжатия). В Shorten методы дискретизации и передачи коэффициентов LPC не слишком удачны, в связи с чем режимы с постоянными прогнозирующими параметрами дают больший уровень компресии и работают быстрее.
+
+
Следующий факт обративший на себя внимание состоит в том, что патентованные и платные кодеки оказываются худшими по большинству показателей. SPS выглядит настолько устаревшим и корявым, что я забросил его тестирование после кодирования одного файла.
+
+
Таблица 2. Общие результаты.
+
+
+
Енкодер
+
Время кодирования
+
Сжатый размер
+
Уровень сжатия
+
+
Monkey's Audio 3.80 (extra high)
21:09.65
397.89 MB
0.5097
+
RKAU 1.06 (normal)
54:05.71
397.96 MB
0.5098
+
RKAU 1.06 (high)
137:00.11
398.29 MB
0.5103
+
FROG 6.61 (mode 4)
27:51.08
401.79 MB
0.5147
+
LPAC 1.31 (-r, normal)
19:19.39
403.52 MB
0.5170
+
Monkey's Audio 3.80 (high)
7:59.74
404.08 MB
0.5176
+
FROG 6.61 (mode 1)
19:56.44
405.23 MB
0.5192
+
flac 1.0.2 (-8)
56:14.92
411.85 MB
0.5276
+
flac 1.0.2 (-5, default)
13:29.11
413.43 MB
0.5296
+
FROG 6.61 (mode 0)
18:56.67
413.70 MB
0.5300
+
WavPack 3.91 (high)
7:15.37
418.09 MB
0.5356
+
Bonk 0.5
37:05.54
418.65 MB
0.5363
+
flac 1.0.2 (-3)
10:03.33
419.26 MB
0.5371
+
Ogg Squish 0.98
?
431.08 MB
0.5522
+
flac 1.0.2 (-1)
8:59.63
432.29 MB
0.5538
+
Shorten 3.2 (-p0 -b256, default)
10:05.16
433.56 MB
0.5554
+
Kexis 0.2.2
17:50.23
434.33 MB
0.5564
+
Shorten 3.2 (-p8 -b2048)
12:21.27
438.86 MB
0.5622
+
WaveZIP
8:41.72
452.95 MB
0.5802
+
RIFF WAVE
780.56 MB
1.0000
+
+
+
+
+
Таблица 3. Результаты для отдельных треков.
+
+
+
+
+Трек
+
+Енкодер
+
+Время работы
+
+Сжатый размер
+
+Уровень сжатия
+
+
+
+ Dream Theater 6:00 58.47 MB
+
+
+
+
Monkey's Audio (extra high)
1:39.08
43.70 MB
0.7475
+
Monkey's Audio (high)
0:41.98
43.85 MB
0.7500
+
RKAU 1.06 (high)
8:12.44
43.87 MB
0.7503
+
RKAU 1.06 (normal)
2:59.56
43.88 MB
0.7504
+
LPAC 1.31 (-r, normal)
1:32.62
44.12 MB
0.7545
+
FROG 6.61 (mode 1)
1:33.09
44.15 MB
0.7550
+
FROG 6.61 (mode 4)
2:08.48
44.18 MB
0.7556
+
flac 1.0.2 (-8)
4:22.30
44.33 MB
0.7581
+
Bonk 0.5
2:57.32
44.35 MB
0.7585
+
flac 1.0.2 (-5, default)
1:04.07
44.40 MB
0.7594
+
Shorten 3.2 (-p8 -b2048)
0:58.42
44.75 MB
0.7654
+
FROG 6.61 (mode 0)
1:30.94
44.77 MB
0.7657
+
flac 1.0.2 (-3)
0:48.75
44.78 MB
0.7658
+
WavPack 3.91 (high)
0:35.86
45.14 MB
0.7720
+
Ogg Squish 0.98
?
45.17 MB
0.7725
+
Pegasus-SPS
4:45.00
45.40 MB
0.7765
+
Kexis 0.2.2
1:25.04
46.52 MB
0.7956
+
flac 1.0.2 (-1)
0:44.84
46.64 MB
0.7977
+
Shorten 3.2 (-p0 -b256, default)
0:47.19
46.68 MB
0.7984
+
WaveZIP
0:38.99
47.22 MB
0.8077
+
+
+ Eddie Warner Titus 27.87 MB
+
+
+
+
RKAU 1.06 (high)
3:34.79
14.54 MB
0.5216
+
RKAU 1.06 (normal)
1:12.25
14.60 MB
0.5238
+
LPAC 1.31 (-r, normal)
0:40.65
14.77 MB
0.5298
+
flac 1.0.2 (-8)
2:00.01
15.01 MB
0.5384
+
flac 1.0.2 (-5, default)
0:29.09
15.11 MB
0.5423
+
flac 1.0.2 (-3)
0:21.88
15.43 MB
0.5537
+
Shorten 3.2 (-p0 -b256, default)
0:20.71
15.78 MB
0.5662
+
Monkey's Audio (extra high)
0:45.47
16.04 MB
0.5754
+
Monkey's Audio (high)
0:13.99
16.11 MB
0.5779
+
Shorten 3.2 (-p8 -b2048)
0:26.37
16.21 MB
0.5818
+
flac 1.0.2 (-1)
0:20.31
16.38 MB
0.5879
+
FROG 6.61 (mode 1)
0:37.93
16.56 MB
0.5941
+
Bonk 0.5
1:22.60
16.73 MB
0.6003
+
FROG 6.61 (mode 4)
0:58.79
16.76 MB
0.6014
+
Ogg Squish 0.98
?
17.03 MB
0.6112
+
WavPack 3.91 (high)
0:10.55
17.13 MB
0.6148
+
FROG 6.61 (mode 0)
0:35.42
17.18 MB
0.6166
+
Kexis 0.2.2
0:32.81
17.40 MB
0.6242
+
WaveZIP
0:17.55
17.89 MB
0.6420
+
+
+ Tool Forty-six & 2 64.25 MB
+
+
+
+
Monkey's Audio (extra high)
1:48.94
39.30 MB
0.6116
+
Monkey's Audio (high)
0:33.43
39.51 MB
0.6149
+
RKAU 1.06 (normal)
3:34.75
39.93 MB
0.6214
+
RKAU 1.06 (high)
8:37.42
39.97 MB
0.6220
+
LPAC 1.31 (-r, normal)
1:38.80
40.25 MB
0.6263
+
FROG 6.61 (mode 4)
2:21.06
40.36 MB
0.6281
+
FROG 6.61 (mode 1)
1:42.26
40.38 MB
0.6284
+
flac 1.0.2 (-8)
4:41.40
40.89 MB
0.6363
+
Bonk 0.5
3:07.42
40.98 MB
0.6378
+
FROG 6.61 (mode 0)
1:36.56
41.01 MB
0.6383
+
flac 1.0.2 (-5, default)
1:08.48
41.07 MB
0.6387
+
WavPack 3.91 (high)
0:37.51
41.51 MB
0.6461
+
flac 1.0.2 (-3)
0:51.92
41.71 MB
0.6496
+
Ogg Squish 0.98
?
42.27 MB
0.6578
+
flac 1.0.2 (-1)
0:47.39
42.72 MB
0.6646
+
Kexis 0.2.2
1:30.85
42.75 MB
0.6652
+
Shorten 3.2 (-p8 -b2048)
1:02.49
43.06 MB
0.6701
+
Shorten 3.2 (-p0 -b256, default)
0:52.06
43.18 MB
0.6721
+
WaveZIP
0:42.84
44.52 MB
0.6930
+
+
+ Cannibal Corpse Mummified In Barbed Wire 33.37 MB
+
+
+
+
Monkey's Audio (extra high)
0:49.20
23.47 MB
0.7033
+
LPAC 1.31 (-r, normal)
1:12.54
23.53 MB
0.7050
+
FROG 6.61 (mode 4)
1:12.82
23.58 MB
0.7065
+
Monkey's Audio (high)
0:23.25
23.66 MB
0.7087
+
RKAU 1.06 (normal)
1:32.20
24.04 MB
0.7202
+
RKAU 1.06 (high)
3:21.70
24.04 MB
0.7202
+
flac 1.0.2 (-8)
2:29.60
24.18 MB
0.7244
+
flac 1.0.2 (-5, default)
0:36.32
24.30 MB
0.7281
+
Bonk 0.5
1:39.10
24.36 MB
0.7297
+
FROG 6.61 (mode 1)
0:52.74
24.46 MB
0.7329
+
Shorten 3.2 (-p8 -b2048)
0:33.98
25.12 MB
0.7526
+
flac 1.0.2 (-3)
0:27.93
25.16 MB
0.7539
+
Ogg Squish 0.98
?
25.23 MB
0.7558
+
FROG 6.61 (mode 0)
0:49.87
25.24 MB
0.7562
+
WavPack 3.91 (high)
0:20.50
25.33 MB
0.7589
+
Kexis 0.2.2
0:47.07
26.03 MB
0.7799
+
flac 1.0.2 (-1)
0:25.08
26.09 MB
0.7818
+
Shorten 3.2 (-p0 -b256, default)
0:27.19
26.61 MB
0.7972
+
WaveZIP
0:22.25
26.89 MB
0.8058
+
+
+ Alanis Morisette Hand In My Pocket 39.09 MB
+
+
+
+
Monkey's Audio (extra high)
1:03.98
22.85 MB
0.5845
+
Monkey's Audio (high)
0:25.70
23.04 MB
0.5893
+
RKAU 1.06 (high)
5:54.68
23.16 MB
0.5925
+
RKAU 1.06 (normal)
2:23.63
23.19 MB
0.5933
+
FROG 6.61 (mode 4)
1:25.16
23.21 MB
0.5937
+
LPAC 1.31 (-r, normal)
1:01.14
23.25 MB
0.5948
+
FROG 6.61 (mode 1)
1:01.46
23.33 MB
0.5968
+
Bonk 0.5
1:54.24
23.35 MB
0.5972
+
flac 1.0.2 (-8)
2:49.68
23.45 MB
0.5997
+
flac 1.0.2 (-5, default)
0:40.70
23.55 MB
0.6025
+
FROG 6.61 (mode 0)
0:58.35
23.86 MB
0.6104
+
Ogg Squish 0.98
?
24.11 MB
0.6167
+
WavPack 3.91 (high)
0:22.50
24.22 MB
0.6196
+
flac 1.0.2 (-3)
0:30.81
24.32 MB
0.6220
+
Shorten 3.2 (-p8 -b2048)
0:37.23
24.72 MB
0.6323
+
Kexis 0.2.2
0:55.13
24.80 MB
0.6345
+
flac 1.0.2 (-1)
0:27.16
24.81 MB
0.6347
+
Shorten 3.2 (-p0 -b256, default)
0:29.82
25.34 MB
0.6481
+
WaveZIP
0:28.05
25.95 MB
0.6638
+
+
+ Gloria Estefan Conga 45.15 MB
+
+
+
+
Monkey's Audio (extra high)
1:15.79
30.12 MB
0.6670
+
Monkey's Audio (high)
0:29.68
30.32 MB
0.6716
+
FROG 6.61 (mode 4)
1:38.48
30.57 MB
0.6770
+
FROG 6.61 (mode 1)
1:11.15
30.62 MB
0.6782
+
Bonk 0.5
2:13.65
30.64 MB
0.6785
+
flac 1.0.2 (-8)
3:20.51
30.75 MB
0.6811
+
LPAC 1.31 (-r, normal)
1:14.52
30.81 MB
0.6823
+
RKAU 1.06 (high)
6:52.69
30.83 MB
0.6828
+
flac 1.0.2 (-5, default)
0:48.33
30.85 MB
0.6833
+
RKAU 1.06 (normal)
2:41.42
30.87 MB
0.6837
+
WavPack 3.91 (high)
0:26.73
30.91 MB
0.6845
+
FROG 6.61 (mode 0)
1:08.05
30.96 MB
0.6857
+
Ogg Squish 0.98
?
31.06 MB
0.6879
+
flac 1.0.2 (-3)
0:36.80
31.63 MB
0.7005
+
Shorten 3.2 (-p8 -b2048)
0:44.27
31.76 MB
0.7034
+
Kexis 0.2.2
1:06.75
31.86 MB
0.7056
+
flac 1.0.2 (-1)
0:33.50
31.99 MB
0.7085
+
Shorten 3.2 (-p0 -b256, default)
0:36.39
32.47 MB
0.7191
+
WaveZIP
0:29.42
33.02 MB
0.7313
+
+
+ Cream White Room 53.01 MB
+
+
+
+
RKAU 1.06 (high)
8:15.46
34.30 MB
0.6469
+
RKAU 1.06 (normal)
3:12.99
34.35 MB
0.6479
+
Monkey's Audio (extra high)
1:28.45
34.65 MB
0.6535
+
FROG 6.61 (mode 4)
1:56.51
34.68 MB
0.6542
+
LPAC 1.31 (-r, normal)
1:29.48
34.84 MB
0.6572
+
Monkey's Audio (high)
0:24.17
34.91 MB
0.6586
+
Bonk 0.5
2:37.02
34.96 MB
0.6595
+
FROG 6.61 (mode 1)
1:24.97
34.99 MB
0.6600
+
flac 1.0.2 (-8)
3:54.58
35.00 MB
0.6602
+
flac 1.0.2 (-5, default)
0:56.64
35.17 MB
0.6634
+
FROG 6.61 (mode 0)
1:20.55
35.35 MB
0.6667
+
flac 1.0.2 (-3)
0:42.74
35.37 MB
0.6672
+
Shorten 3.2 (-p8 -b2048)
0:51.33
35.40 MB
0.6677
+
WavPack 3.91 (high)
0:31.05
35.60 MB
0.6715
+
Ogg Squish 0.98
?
35.74 MB
0.6742
+
Shorten 3.2 (-p0 -b256, default)
0:40.76
36.42 MB
0.6870
+
flac 1.0.2 (-1)
0:38.39
36.56 MB
0.6896
+
Kexis 0.2.2
1:13.46
36.64 MB
0.6911
+
WaveZIP
0:35.77
37.13 MB
0.7004
+
+
+ Maurice Ravel Fanfare from "L'eventail de Jeanne" 20.82 MB
+
+
+
+
RKAU 1.06 (normal)
1:46.51
6.86 MB
0.3297
+
RKAU 1.06 (high)
3:53.54
6.90 MB
0.3316
+
Monkey's Audio (extra high)
0:30.30
7.09 MB
0.3407
+
FROG 6.61 (mode 4)
0:43.03
7.25 MB
0.3482
+
LPAC 1.31 (-r, normal)
0:28.80
7.33 MB
0.3520
+
FROG 6.61 (mode 1)
0:30.54
7.39 MB
0.3549
+
Monkey's Audio (high)
0:12.58
7.56 MB
0.3634
+
FROG 6.61 (mode 0)
0:28.81
7.65 MB
0.3673
+
flac 1.0.2 (-8)
1:21.75
7.68 MB
0.3691
+
flac 1.0.2 (-5, default)
0:19.79
7.71 MB
0.3702
+
flac 1.0.2 (-3)
0:14.63
7.77 MB
0.3733
+
Bonk 0.5
0:56.07
7.83 MB
0.3762
+
WavPack 3.91 (high)
0:11.42
7.89 MB
0.3791
+
flac 1.0.2 (-1)
0:13.14
8.12 MB
0.3901
+
Ogg Squish 0.98
?
8.15 MB
0.3914
+
Shorten 3.2 (-p0 -b256, default)
0:13.68
8.19 MB
0.3932
+
Shorten 3.2 (-p8 -b2048)
0:17.56
8.29 MB
0.3983
+
Kexis 0.2.2
0:26.88
8.52 MB
0.4091
+
WaveZIP
0:13.11
8.72 MB
0.4193
+
+
+ Maurice Ravel String Quartet (4th movement) 56.18 MB
+
+
+
+
Monkey's Audio (extra high)
1:29.26
20.87 MB
0.3715
+
FROG 6.61 (mode 4)
1:58.06
21.25 MB
0.3781
+
RKAU 1.06 (normal)
3:51.42
21.46 MB
0.3820
+
FROG 6.61 (mode 1)
1:24.44
21.50 MB
0.3826
+
Monkey's Audio (high)
0:34.29
21.55 MB
0.3836
+
RKAU 1.06 (high)
10:39.05
21.56 MB
0.3838
+
FROG 6.61 (mode 0)
1:19.15
21.92 MB
0.3901
+
LPAC 1.31 (-r, normal)
1:21.40
21.96 MB
0.3909
+
WavPack 3.91 (high)
0:30.03
22.30 MB
0.3969
+
flac 1.0.2 (-8)
3:58.83
22.61 MB
0.4024
+
flac 1.0.2 (-5, default)
0:56.68
22.67 MB
0.4036
+
Bonk 0.5
2:34.87
23.18 MB
0.4125
+
flac 1.0.2 (-3)
0:41.61
23.21 MB
0.4131
+
flac 1.0.2 (-1)
0:37.14
23.36 MB
0.4158
+
Kexis 0.2.2
1:14.81
23.42 MB
0.4168
+
Shorten 3.2 (-p0 -b256, default)
0:40.30
23.71 MB
0.4221
+
Ogg Squish 0.98
?
24.12 MB
0.4293
+
Shorten 3.2 (-p8 -b2048)
0:49.18
25.59 MB
0.4554
+
WaveZIP
0:36.60
25.84 MB
0.4600
+
+
+ Sergei Prokofiev Piano Concerto No.3 (3rd movement) 100.68 MB
+
+
+
+
FROG 6.61 (mode 4)
3:28.59
34.51 MB
0.3427
+
Monkey's Audio (extra high)
2:37.54
34.55 MB
0.3431
+
FROG 6.61 (mode 1)
2:27.82
34.82 MB
0.3458
+
LPAC 1.31 (-r, normal)
2:05.82
35.27 MB
0.3502
+
RKAU 1.06 (normal)
6:34.97
35.31 MB
0.3507
+
Monkey's Audio (high)
1:00.47
35.46 MB
0.3521
+
RKAU 1.06 (high)
18:34.20
35.80 MB
0.3555
+
FROG 6.61 (mode 0)
2:20.34
37.02 MB
0.3677
+
WavPack 3.91 (high)
0:53.49
37.44 MB
0.3718
+
flac 1.0.2 (-8)
7:01.69
38.07 MB
0.3781
+
flac 1.0.2 (-5, default)
1:39.81
38.17 MB
0.3791
+
flac 1.0.2 (-3)
1:13.23
38.50 MB
0.3824
+
flac 1.0.2 (-1)
1:04.93
39.30 MB
0.3903
+
Shorten 3.2 (-p0 -b256, default)
1:12.51
39.49 MB
0.3921
+
Kexis 0.2.2
2:12.79
39.89 MB
0.3962
+
Bonk 0.5
4:35.94
40.31 MB
0.4003
+
Ogg Squish 0.98
?
41.86 MB
0.4157
+
WaveZIP
1:05.60
43.67 MB
0.4337
+
Shorten 3.2 (-p8 -b2048)
1:29.19
45.34 MB
0.4502
+
+
+ Frederic Chopin Prelude No.24 in d minor 27.46 MB
+
FLAC - это открытый проект и нам будет очень приятно, если кто-либо захочет к нам присоединиться. Вы можете принимать участие в разработке через список рассылки, сообщая об ошибках или высказывая свои идеи, или как разработчик. В любом случае, почитайте список целей, стоящих перед проектом, потому что некоторые возможности, такие как защита от копирования и сжатие с потерями, мы добавлять не хотим.
+
+
Список особенно важных задач:
+
+
+
Больше плагинов для плейеров. Сейчас есть плагины только для Winamp и XMMS. Хочется больше!
+
+
Улучшить методы сжатия.
+
+
+
Чего бы еще хотелось:
+
+
+
Поправить мейкфайлы для MSVC, чтобы вместо libFLAC.lib на выходе получался libFLAC.dll.
+
+
Обеспечить настраиваемую поддержку ID3v1 и ID3v2 в плагинах.
+
+
Cделать поддержку для большего количества типов входных файлов (не только WAVE и raw).
FLAC открыт для разработчиков, желающих добавить поддержку FLAC в своих программах. Все необходимые функции находятся в библиотеке libFLAC, распространяемой по лицензии LGPL. Соответствующая документация находится здесь:
FLAC определяет несколько типов блоков метаданных (все они перечислены на странице формат). Блоки метаданных могут быть любого размера, новые блоки могут быть легко добавлены. Декодер имеет возможность пропускать неизветные ему блоки метаданных. Обязателен только блок STREAMINFO. В нем содержится частота дискретизация, количество каналов и т.п., а также данные позволяющие декодеру настроить буфферы. Сюда также записывается подпись MD5 несжатых аудиоданных. Это полезно для проверки всего потока после его передачи.
+
+
Другие блоки предназначены для резервирования места, хранения таблиц точек поиска, а также данных для конкретных приложений. Опции для добавления блоков PADDING или точек поиска приведены ниже. FLAC не нуждается в точках поиска, однако они позволяют значительно увеличить скорость доступа, а также могут быть использования для расстановки меток в аудио редакторах.
+
+
Если Вам нужен собственный блок метаданных, Вы можете определить его и запросить идентификатор здесь. Вы можете зарезервировать блок PADDING необходимого размера и записать на его место свои данные после кодирования. Полученнный поток будет отвечать формату FLAC, декодеры распознающие эти блоки смогут их использовать, остальные будут их пропускать.
+
+
+
Аудиоданные
+
+
За метаданным следуют сжатые аудиоданные. Метаданные и аудиоданные не чередуются. Как и большинство кодеков FLAC делит входной поток на блоки и кодирует их независимо друг от друга. Блок упаковыватся во фрейм и добавляется к потоку. Базовый кодер использует блоки постоянного размера для всего потока, однако формат предусматривает наличие блоков разной длины в потоке.
+
+
+
Разбиение на блоки
+
+
Размер блока - очень важный параметр для кодирования. Если он очень мал, то в потоке будет слишком заголовков фреймов, что уменьшит уровень сжатия. Если размер большой, то кодер не сможет подобрать эффективную модель сжатия. Понимание процесса моделирования поможет Вам увеличить уровень сжатия для некоторых типов входных данных. Обычно при использовании линейного прогнозирования на аудиоданных с частотой дискретизации 44.1 кГц оптимальный размер блока лежит в диапазоне 2-6 тысяч сэмплов. В этом случае значение по умолчанию - 4608. Если использовать быстрые постоянные предикторы, предпочтительнее меньшие размеры блоков, так как в этом случае размеры заголовков фреймов меньше.
+
+
+
Межканальная декорреляция
+
+
Если на вход поступают стерео аудиоданные, они могут пройти через стадию межканальной декорреляции. Правый и левый канал преобразуются к среднему и разностному по формулам: средний = (левый + правый)/2, разностный = левый - правый. В отличие от joint stereo этот процесс не приводит к потерям. Для данных с аудио компакт-дисков это обычно приводит к значительному увеличению уровня сжатия. Для включения использования этого метода кодирования flac имеет две опции: -m всегда делает разностную и независимую версию блока и выбирает наименьший фрейм и -M, которая адаптивно выбирает схему сжатия.
+
+
+
Моделирование
+
+
На следующем этапе кодер пытается аппроксимировать сигнал такой функцией, чтобы полученный после ее вычитания из оригинала результат (называемый разностью, остатком, ошибкой) можно было закодировать минимальным количеством битов. Параметры функций тоже должны записываться, поэтому они не должны занимать много места. FLAC использует два метода формирования аппроксимаций: 1) подгонка простого полинома к сигналу и 2) общее кодирование с линейными предикторами (LPC).
+
+
Во-первых, постоянное полиномиальное предсказание (-l 0) работает значительно быстрее, но менее точно, чем LPC. Чем выше порядок LPC, тем медленнее, но лучше будет модель. Однако с увеличением порядка выигрыш будет все менее значительным. В некоторой точке (обычно около 9) процедура кодера, определяющая наилучший порядок, начинает ошибаться и размер получаемых фреймов возрастает. Чтобы преодолеть это, можно использовать полный перебор (опция -e), что приведет к значительному увеличению времени кодирования.
+
+
Во-вторых, параметры для постоянных предикторов могут быть описаны тремя битами, а параметры для модели LPC зависят от количества бит на сэмпл и порядка LPC. Это значит, что размер заголовка фрейма зависит от выбранного метода и порядка и может повлиять на оптимальный размер блока.
+
+
+
Остаточное кодирование
+
+
Когда модель подобрана, кодер вычитает приближение из оригинала, чтобы получить остаточный (ошибочный) сигнал, который затем кодируется без потерь. Для этого используется то обстоятельство, что разностный сигнал обычно имеет распределение Лапласа и есть набор специальный кодов Хаффмана, называемые кодами Райса, позволяющие эффективно и быстро кодировать эти сигналы без использования словаря.
+
+
Кодирование Райса состоит из нахождения одного параметра, отвечающего распределению сигнала, а затем использования его для составления кодов. При изменении распределения меняется и оптимальный параметр, поэтому имеется метод позволяющий пересчитывать его по необходимости. Остаток может быть разбит на контексты или разделы, у каждого из которых будет свой параметр Райса. flac позволяет указать, как нужно производить разбиение, с помощью опции -r. Остаток может быть разбит на 2^n раздела, если использовать -r n,n. Параметр n называется порядком раздела. Также кодер может искать в пределах от m до n порядка, выбирая лучший вариант, если указать -r m,n. Обычно выбор n не влияет на скорость кодирования. От разницы между m и n сильно зависит время работы, чем она больше, тем больше времени будет затрачиваться на поиск лучшего порядка. Выбор размера блока также влияет на оптимальный порядок раздела.
+
+
+
Составление фреймов
+
+
Аудиофрейму предшествует заголовок, который начинается с кода синхронизации и содержит минимум информации, необходимой декодеру для воспроизведения потока. Сюда также записывается номер блока или сэмпла и восьмибитная контрольная сумма самого заголовка. Код синхронизации, CRC заголовка фрейма и номер блока/сэмпла позволяют осуществлять пересинхронизацию и поиск даже в отсутствие точек поиска. В конце фрейма записывается его шестнадцатибитная контрольная сумма. Если базовый декодер обнаружит ошибку, будет сгенерирован блок тишины.
+
+
+
Разное
+
+
Чтобы поддерживать основные типы метаданных, базовый декодер умеет пропускать теги ID3V1 и ID3V2, поэтому их можно свободно добавлять. Теги ID3V2 должны располагаться перед маркером "fLaC", а теги ID3V1 - в конце файла.
+
+
У flac есть опция (-V) для проверки выходных данных при кодировании. В этом случае декодер работает одновременно с кодером и его выход сравнивается с оригинальным вводом. Если будет найдено отличие, flac закончит работу с сообщением об ошибке.
Анализ: flac -a [-s] [--skip #] [<опции_анализа>] [входной_файл [...]]
+
+
+
В любом случае, если входной файл не указан, подразумевается стандартный ввод. Если указан только один входной файл, то это может быть "-" для стандартного ввода (stdin). Когда используется стандартный ввод, flac пишет в стандартный вывод (stdout). В остальных случаях flac выполнит указанные действия для каждого входного файла и запишет результаты в файлы с аналогичными именами (при кодировании суффикс будет заменен на ".flac" или, если его не было, будет добавлен; при декодировании суффиксы также изменяются в соответствии с типом выходных данных.) Оригинал удаляется, только если указан ключ --delete-input-file.
+
+
Существуют особые формы вызова процедур кодирования/декодирования из стандандартного ввода в файл.
+
+
+
+
flac [опции] - выходной_файл
+
+
flac -d [опции] - выходной_файл
+
+
+
которые лучше чем
+
+
+
flac [опции] > выходной_файл
+
+
flac -d [опции] > выходной_файл
+
+
+
+
так как в первом случае сохраняется возможность произвести при необходимости последующую обработку файла, например для записи заголовков RIFF WAVE или STREAMINFO.
+
+
Данные в стандартный вывод можно перенаправить с помощью ключа -c.
+
+
Опции кодирования влияют на скорость работы и уровень сжатия. Настройки формата определяют расположение сэмплов, если на вход поступает файл без заголовка. Если у файла есть заголовок RIFF WAVE, то настойки формата не нужны, так как они берутся из файла.
+
+
В режиме тестирования flac работает как и при декодировании, только выходной файл не записывается. Режимы декодирования и тестирования проверяют поток на наличие ошибок, а также сравнивают подпись MD5 декодированного потока с сохраненной подписью, даже если формат потока правильный.
Декодирование (по умолчанию flac кодирует). flac завершит работу с кодом выхода 1, если будет встречена ошибка или контрольная сумма MD5 декодированного потока не совпадет с сохраненной. Если ошибок не будет, код возврата будет равен 0.
+
+
-H
+
Вывести справку полностью. При запуске flac без аргументов отображается краткая справка.
+
+
-t
+
Тестирование (то же самое, что и декодирование, только выход не записывается в файл). Коды возврата те же.
+
+
-a
+
Анализ (то же самое, что и декодирование, только выходом является файл статистики). Коды возврата те же. Режим предназначен в основном для разработчиков. В выходной текстовый файл записывается информация о каждом фрейме и подфрейме.
+
+
-c
+
Направить результат в стандартный вывод (stdout).
+
+
-s
+
Не показывать статистику при кодировании/декодировании.
+
+
-o файл
+
Явно указать имя выходного файла, по умолчанию flac просто заменяет суффикс.
+
+
--output-prefix строка
+
Добавляет префикс к каждому имени выходному файлу. Может имспользоваться для кодирования/декодирования файлов в другой каталог. Если указанная строка является частью пути, убедитесь, что она заканчивается слэшем '/'.
+
+
--delete-input-file
+
После успешного окончания кодирования/декодирования входной файл будет удален. Если произойдет ошибка, исходный файл останется.
+
+
--skip #
+
Пропустить первые # сэмплов входного файла. Работает для кодирования и декодирования, но не для тестирования.
По умолчанию flac прекращает декодирование
+в случае ошибки в потоке и удаляет частично декодированный файл.
+Использование ключа -F ведет к тому, что сообщения об ошибках
+выводятся, но flac продолжает работу до конца.
+Обратите внимание, что в результате такого декодирования в выходном файле
+могут быть пропущены сэмплы или появится блоки тишины.
При кодировании генерируется вывод в формате Ogg-FLAC вместо "родного"FLAC. Потоки Ogg-FLAC представляют собой потоки FLAC обернутые в транспортный уровень Ogg. Полученный файл будет иметь суффикс '.ogg' и будет декодироваться утилитой flac.
+
При декодировании формат ввода однозначно определяется как Ogg-FLAC. Это полезно при получении данных со стандартного ввода или если у файла суффикс не '.ogg'.
+
+
--lax
+
Позволяет кодеру создавать файлы, отвечающие подмножеству формата FLAC. В результате работы будет получаться непотоковый файл, поэтому этот ключ следует использовать только для архивирования. Декодер будет поддерживать воспроизведение и поиск в таких файлах.
+
+
--sector-align
+
+
При кодировании нескольких WAVE файлов формата CD-Audio выравнивать их на границу сектора. Эта опция применима только для кодирования нескольких WAVE файлов, каждый из которых должен иметь частоту дискретизации 44.1 кГц и два канала. Если будет указана эта опция кодер выровняет потоки .flac так,
+что их длины будут кратны размеру сектора CD-Audio (равны 1/75 секундам или 588 сэмплам). Это осуществляется переносом части сектора в конце каждого WAVE файла в начало следующего. Последний поток будет дополнен до границы выравнивания нулями.
+
Использование этой опции не приведет ни к чему, если файлы уже выровнены (например, если правильно скопированы с аудио-CD). flac может выровнять только несколько файлов за один вызов.
+
+
ВНИМАНИЕ: Порядок файлов имеет значение! Если вы сделаете следующий вызов 'flac --sector-align *.wav', командный процессор может обработать шаблон не в том порядке, в каком вы рассчитываете. Поэтому лучше всего вызывать программу, явно указав список файлов, например, 'flac --sector-align 8.wav 9.wav 10.wav'.
+
+
+
-S {#|X|#x}
+
Добавляет точки для поиска в таблицу SEEKTABLE.
+
+
+
# : создается точка поиска для сэмпла с определенным номером.
+
+
X : резервируемые точки (всегда помещаются в конце SEEKTABLE).
+
+
#x : # равномерно распределенных точек поиска, первая соответствует 0 сэмплу.
+
+
+
Опцию -S можно использовать несколько раз. В результате получится объединенная таблица, в которой будут присутствовать только уникальные значения.
+По умолчанию flac использует -S 100x. Если таблица поиска не нужна, укажите -S-.
+ПРИМЕЧАНИЕ: -S #x не будет работать, если кодер не сможет определить размер входного файла в начале работы.
+ПРИМЕЧАНИЕ: если # больше или равен количеству сэмплов во входном файле, то точки добавлены не будут, если размер можно определить до кодирования, в противном случае будут записаны резервируемые точки.
+
+
+
-P #
+
Eнкодер запишет блок метаданных PADDING, указанного размера (в байтах), после блока STREAMINFO. Ключи -P 0 или -P- указывают, что блок PADDING не нужен (значение по умолчанию). Этот блок полезен, если вы собираетесь добавить тэг в файл позже. Вместо того, чтобы переписывать файл полностью, можно будет записать информацию вместо блока PADDING. Обратите внимание на то, что общий размер блока PADDING будет на 4 байта больше, так как 4 байта занимает заголовок.
+
+
-b #
+
Устанавливает размер блока в сэмплах. По умолчанию 1152 для -l 0, иначе 4608. Стандартные потоки должны использовать одно из указаных значений: 192/576/1152/2304/4608/256/512/1024/2048/4096/8192/16384/32768. Сейчас кодер использует постоянный размер блока для всего файла.
+
+
-m
+
Включает разностное кодирование (только для стерео потоков). Обычно увеличивает уровень сжатия на несколько процентов. Для каждого блока создается усредненная и стерео версия блока, сохраняется блок меньшего размера. Сейчас разностное кодирование доступно для файлов, где сэмпл имеет размер не больше 16 бит.
+
+
-M
+
Включает свободное разностное кодирование (только для стерео потоков). Работает аналогично -m, однако кодер переключается между независимым и усредняющим кодированием адаптивно. Метод работает быстрее, но уровень сжатия меньше, так как -m производит полный перебор вариантов.
+
+
-0..-8
+
Быстрейшее сжатие ... максимальное сжатие. По умолчанию -5.
+
+
-0
+
Аналогично -l 0 -b 1152 -r 2,2.
+
+
-1
+
Аналогично -l 0 -b 1152 -r 2,2 -M.
+
+
-2
+
Аналогично -l 0 -b 1152 -r 3 -m.
+
+
-3
+
Аналогично -l 6 -b 4608 -r 3,3
+
+
-4
+
Аналогично -l 8 -b 4608 -r 3,3 -M.
+
+
-5
+
Аналогично -l 8 -b 4608 -r 3,3 -m.
+
+
-6
+
Аналогично -l 8 -b 4608 -r 4 -m.
+
+
-7
+
Аналогично -l 8 -b 4608 -r 6 -m -e.
+
+
-8
+
Аналогично -l 12 -b 4608 -r 6 -m -e.
+
+
--fast
+
Быстрейшее сжатие. Аналогично -0.
+
+
--best
+
Максимальное сжатие. Аналогично -8.
+
+
-e
+
Полный поиск модели (работает медленно!). Обычно кодер определяет лучшую модель и кодирует далее опираясь на нее. В данном режиме кодер будет создавать подфреймы всех порядков и использовать наименьший. Если максимальное значение порядка LPC велико, время кодирования существенно возрастет. Выигрыш обычно составляет около 0.5%.
+
+
-E
+
Использовать управляющие коды в кодере энтропии. Эта опция позволяет записывать незакодированное представление остатка в разделе, если его размер меньше. При этом время работы увеличивается, а уровень сжатия обычно улучшается примерно на 1%.
+
+
-l #
+
Определяет максимальный порядок LPC (коэффициентов линейного прогнозирования). Число должно быть меньше или равно 32. Если значение равно 0, кодер будет использовать вместо общего линейного прогнозирования постоянные коэффициенты. Этот метод увеличивает скорость работы, но файлы получаются на 5-10% больше.
+
+
-q #
+
Определяет точность дискретных коэффициентов линейного прогнозирования в битах. По умолчанию -q 0, что позволяет кодеру принимать решение в зависимости от сигнала. Лучше оставлять значение по умолчанию.
+
+
-p
+
Производить оптимизацию LPC. Переопределяет любую опцию -q. Сильно замедляет работу, и уменьшает размер файла на долю процента. -q не работает, когда используется -l 0.
+
+
-r [#,]#
+
Установить [min,]max порядок раздела. Если минимальное значение не указано, то оно устанавливается равным 0. По умолчанию кодер один параметр Райса для всего остатка подфрейма. Если использовать эту опцию, остаток будет разделяться на 2^min# ... 2^max частей, для каждой из которых будет определен собственный параметр Райса. С увеличением параметра max выигрыш будет все меньше. Наиболее оптимальный вариант достигается при использовании -r 2,2 (и больших значений для больших размеров блоков). При этом сжатие обычно увеличивается на 1.5%. Выбор оптимального значения можно произвести по формуле размер_блока/(2^n)=128. Максимальный уровень сжатия достигается при использовании -r 0,16.
+
+
-V
+
Проверять процесс сжатия. В данном случае flac создает параллельный декодер, раскодирующий выход кодера и сравнивает результат с оригиналом. Если будет найдено несоответствие, кодирование прекратится. Время работы с этой опцией увеличивается, однако, при этом гарантируется, что файл будет правильно декодирован.
+
+
+
-F-, -S-, -P-, -m-, -e-, -E-, -p-, -V-, --lax-, --delete-input-file-, --sector-align- используются для отключения соответствующих опций.
+
+
+
+
Настройки формата
+
+
+
-fb | -fl
+
Определяет порядок байтов в файле без заголовка big-endian | little-endian.
+
+
-fc n
+
Определяет количество каналов в файле без заголовка.
+
+
-fp n
+
Определяет количество бит на сэмпл в файле без заголовка.
+
+
-fs n
+
Определяет количество сэмплов в секунду в файле без заголовка.
+
+
-fu
+
Указывает, что сэмплы в файле без заголовка беззнаковые (по умолчанию знаковые).
+
+
-fr
+
Воспринимать входной (или выходной при декодировании) файл как raw поток сэмплов вне зависимости от суффикса.
libFLAC требует стандартную и математическую библиотеки для языка C. Программные потоки не используются, однако, так как libFLAC не использует глобальные переменные, библиотека должна быть thread-safe.
+
+
Интерфейс libFLAC описан в публичных заголовочных файлах в каталоге include/FLAC. Для использования скомпилированной библиотеки нужны только публичные заголовки. Обратите внимание на то, что код из src/libFLAC/, включая защищенные заголовочные файлы из src/libFLAC/include/ не нужен.
+
+
В основном использование libFLAC состоит в следующем:
+
+
+
Программа создает экземпляр кодера или декодера с помощью функций *_new().
+
+
Программа устанавливает параметры экземпляра и предоставляет ему обратные вызовы для чтения, записи, сообщения об ошибках и работы с метаданными с помощью функций *_set_*().
+
+
Программа инициализирует экземпляр, проверяет параметры и готовится к кодированию/декодированию, используя функции *_init().
+
+
Программа вызывает функции *_process_*() для кодирования или декодирования данных, которые в свою очередь делают обратные вызовы.
+
+
Программа завершает работу экземпляра функцией *_finish(), которая сбрасывает буферы ввода и вывода.
+
+
Экземпляр может быть использован снова либо удален функцией *_delete().
+
+
+
+
Для декодирования libFLAC предоставляет три уровня доступа. На нижнем уровне находится декодер потоков, на следующем - декодер потоков с возможностью поиска, а на верхнем - декодер файлов. Интерфейсы описаны в файлах stream_decoder.h, seekable_stream_decoder.h и file_decoder.h соответственно. Использовать лучше всего декодер более верхнего уровня.
+
+
Потоковый декодер рассчитывает на обратные вызовы для получения входных и выходных данных. Декодер с возможностью поиска является оберткой потокового декодера, предоставляющий возможность поиска, однако для его выполнения вам необходимо добавить обратные вызовы. Файловый декодер сам осуществляет обратные вызовы для чтения и предоставляет функции поиска.
+
+
кодер пока что реализован только на потоковом уровне (stream_encoder.h).
+
+
Структуры и константы, относящиеся к формату, определены в файле format.h.
+
+
+
ДЕКОДЕР ПОТОКОВ
+
+
Сначала обсудим декодер потоков. Тип его экземпляра FLAC__StreamDecoder. Обычно в программе экземпляр создается вызовом FLAC__stream_decoder_new(), затем вызывает функции FLAC__stream_decoder_set_*() для установки обратных вызовов и пользовательских данных и инициализируется функцией FLAC__stream_decoder_init(). Необходимые обратные вызовы:
+
+
+
Обратный вызов для чтения. Эта функция вызывается, когда декодеру необходимы данные. В качестве параметров передается адрес буфера, который нужно заполнить, и его размер в байтах. Обратный вызов может вернуть меньше данных и изменить счетчик байтов, но не должен переполнять буфер. Код возврата при выходе выбирается из FLAC__StreamDecoderReadStatus.
+
+
Обратный вызов для записи. Эта функция вызывается после декодирования одного фрейма данных. Декодер передаст метаданные фрейма, а также массив указателей (по одному на каждый канал) на декодированные данные.
+
+
Обратный вызов для работы с метаданными. Функция вызывается после разбора блока метаданных. Для потока всегда должен существовать блок метаданных STREAMINFO, за которым может следовать произвольное количество других блоков. Они будут возвращены декодером в том же порядке, в каком они расположены в потоке и всегда перед первым аудио фреймом. Переданный блок метаданных не должен изменяться и не сохраняется после обратного вызова, поэтому, если он будет нужен в дальнейшем сделайте его копию с помощью функции FLAC__metadata_object_copy().
+
+
Обратный вызов для сообщения об ошибке. Эта функция вызывается, если при декодировании происходит ошибка.
+
+
+
Когда декодер инициализирован, программа может вызвать одну из следующих функций для декодирования:
+
+
+
FLAC__stream_decoder_process_whole_stream() - Декодер начинает работу и продолжает обрабатывать поток пока функция обратного вызова чтения не передаст код FLAC__STREAM_DECODER_READ_END_OF_STREAM или FLAC__STREAM_DECODER_READ_ABORT.
+
+
FLAC__stream_decoder_process_metadata() - Декодер обрабатывает поток до первого аудио фрейма.
+
+
FLAC__stream_decoder_process_one_frame() - Декодеровать только один фрейм. Перед вызовом этой функции все метаданные должны быть обработаны.
+
+
FLAC__stream_decoder_process_remaining_frames() - Декодировать все оставшиеся фреймы. Перед вызовом этой функции все метаданные должны быть обработаны. Перед вызовом этой фунции также может вызываться FLAC__stream_decoder_process_one_frame().
+
+
+
Когда декодер заканчивает работу, экземпляр обрабатывается функцией FLAC__stream_decoder_finish(), которая проверяет состояние декодера и освобождает память. Затем экземпляр может быть удален функцией FLAC__stream_decoder_delete() или инициализирован заново для декодирования другого потока.
+
+
Обратите внимание на то, что потоковый декодер не имеет представления о позиции в потоке, он только преобразовывает данные. Чтобы осуществлять поиск в потоке функции обратного вызова могут только сбрасывать данные декодера функцией FLAC__stream_decoder_flush() и начинать подавать данные с новой позиции с помощью обратного вызова для чтения. Декодер файлов поступает именно так.
+
+
ДЕКОДЕР ПОТОКОВ С ВОЗМОЖНОСТЬЮ ПОИСКА
+
+
Декодер потоков с возможностью поиска является оберткой для стандартного декодера потоков. Тип его экземпляра - FLAC__SeekableStreamDecoder. К обраным вызовам декодера потоков для чтения, записи, работы с метаданными и обработки ошибок необходимо добавить еще следующие:
+
+
+
Обратный вызов для поиска. Эта функция вызывается, когда декодеру нужно найти абсолютную позицию в потоке.
+
Обратный вызов для определения текущей позиции. Эта функция вызывается, когда декодеру нужно узнать текущую позицию в потоке.
+
Обратный вызов для определения размера потока. Функция вызывается, когда декодеру нужно узнать размер потока. Используемому алгоритму поиска требуется знать общий размер потока.
+
Обратный вызов для определения конца потока. Функция вызывается, когда декодеру нужно знать, достиг ли он конца потока. Этого результата можно добиться, используя обратные вызовы для определения текущей позиции и общего размера, но такой способ может потребовать гораздо больше ресурсов.
+
+
Поиск осущесвляется через метод FLAC__seekable_stream_decoder_seek_absolute(). В любой момент после инициализации пользовател может вызвать эту функцию для перехода к опрделенному сэмплу в потоке. Первый обратный вызов записи будет содержать (возможно, неполный) блок, начинающийся с заданного сэмпла.
+
+
Декодер потоков с возможностью поиска предоставляет проверку подписей MD5. Если ее включить перед инициализацией, функция FLAC__seekable_stream_decoder_finish() сообщит совпадает ли подпись MD5 декодированного потока с сохраненной блоке STREAMINFO. Проверка подписи MD5 автоматически отключается при попытке посика или если в блоке STREAMINFO не найдена подпись.
+
+
ДЕКОДЕР ФАЙЛОВ
+
+
Декодер файлов - это оболочка декодера потоков с возможностью поиска, призванная упростить процесс декодирования файлов. Тип его экземпляра - FLAC__FileDecoder. Отличие от потокового декодера состоит в том, что вместо обратного вызова для чтения (который обрабатывает сам декодер) при инициализации указывается путь к файлу. Выполнение остальных функций декодер берет на себя.
+
+
Аналогично декодеру потоков с возможностью поиска он предоставляет поиск через метод FLAC__file_decoder_seek_absolute(). В любой момент после инициализации декодера файлов программа может вызвать эту функцию для поиска сэмпла в файле. Впоследствии, при первом обратном вызове для записи он будет содержать (возжожно неполный) блок, начинающийся с этого сэмпла.
+
+
От декодера потоков с возможностью поиска также наследуется проверка подписи MD5. Если эта возможность будет включена перед инициализацией, FLAC__file_decoder_finish() сообщит, если подпись MD5 распакованных данных не совпадет с сохраненной в блоке STREAMINFO. Проверка MD5 автоматически выключается, если в блоке STREAMINFO нет подписи или при попытке осуществления поиска.
+
+
+
кодер ПОТОКОВ
+
+
кодер потоков работает аналогично декодеру, однако имеет меньше обратных вызовов и больше опций. Тип экземпляра - FLAC__StreamEncoder. Для создания нового экземпляра в программе нужно вызвать функцию FLAC__stream_encoder_new(), а чтобы проинициализировать его - FLAC__stream_encoder_init().
+
+
В отличие от процесса декодирования кодирование в формат FLAC имеет множество опций, влияющих на скорость и уровень сжатия. Когда программа вызывает FLAC__stream_encoder_init(), кодер проверяет значения, поэтому необходимо убедиться, что возвращемое этой функцией значение - FLAC__STREAM_ENCODER_OK. Для установки параметров нужно иметь некоторое представление о формате (см. описание формата для пользователя или его формальное описание). Список необходимых параметров приведен здесь:
+
+
+
streamable_subset - истина, если необходимо, чтобы выход соответствовал потоковому подмножеству формата, иначе ложь.
+
+
do_mid_side_stereo - истина, если нужно использовать усредненное кодирование для стерео потоков. Значение channels должно быть 2.
+
+
loose_mid_side_stereo - истина, чтобы применить адаптивное переключение режима усредненного кодирования, иначе ложь. do_mid_side_stereo должно быть истина.
+
+
channels (количество каналов) - должно быть <= FLAC__MAX_CHANNELS.
+
+
bits_per_sample - количество битов на сэмпл.
+
+
sample_rate (частота дискретизации) - должно быть <= FLAC__MAX_SAMPLE_RATE.
+
+
blocksize (размер блока) - должен быть между FLAC__MIN_BLOCKSIZE и FLAC__MAX_BLOCKSIZE.
+
+
max_lpc_order (максимальный порядок коэффициентов линейного прогнозирования) - 0 указывает, что кодер не должен использовать LPC, а только постоянные предикторы. Должно быть <= FLAC__MAX_LPC_ORDER.
+
+
qlp_coeff_precision - должно быть >= FLAC__MIN_QLP_COEFF_PRECISION, или 0, чтобы кодер мог выбирать коэффициенты в зависимости от размера блока. В текущей реализации сумма qlp_coeff_precision+bits_per_sample должна быть < 32.
+
+
do_qlp_coeff_prec_search - ложь, чтобы использовать заданное значение qlp_coeff_precision; истина для поиска и выбора лучшего значения qlp_coeff_precision.
+
+
do_escape_coding - истина, если нужно искать управляющий код на стадии кодирования энтропии для небольшого увеличения уровня сжатия.
+
+
do_exhaustive_model_search (производить полный поиск наилучшей модели) - ложь, to use estimated bits per residual for scoring; истина для перебора всех возможных вариантов и выбора наилучшего.
+
+
min_residual_partition_order (минимальный порядок раздела остатков), max_residual_partition_order (максимальный порядок раздела остатков)= 0, чтобы оценивать параметр Райса основываясь на дисперсии остатков; > 0 для разделения остатков и определения параметра для каждого раздела, основываясь на среднем. min_residual_partition_order и max_residual_partition_order определяют минимальный и максимальный порядок раздела Райса.
+
+
rice_parameter_search_dist (интервал для поиска параметра Райса) - 0, чтобы использовать только вычисленный параметр k; иначе пытаться кодировать со всеми параметрами из интервала [k-rice_parameter_search_dist..k+rice_parameter_search_dist] и выбирать лучший вариант.
+
+
total_samples_estimate (количество сэмплов) - Может равняться 0, если неизвестно. Иначе указывается количество сэмплов, которое нужно закодировать. Это позволяет создавать более точный блок STREAMINFO при первом же проходе в случае, когда кодер не может вернуться к началу вывода, чтобы обновить блок STREAMINFO.
+
+
seek_table (таблица для поиска) - создать необязательную таблицу для поиска в файле. NULL указывает, что таблица не нужна.
+
+
padding (резервирование места) - размер блока PADDING (следует за таблицей для поиска); -1 означает, что блок PADDING добавлять не нужно. Помните, что указывается размер для данных; общий размер блока PADDING будет на 4 байта больше из-за заголовка.
+
+
+
Программа должна предоставить FLAC__stream_encoder_init() адреса для следующих обратных вызовов:
+
+
+
Обратный вызов для записи. Вызывается, когда появляются закодированные данные для записи. Это могут быть метаданные смешанные с аудио фреймами, причем не гарантируется, что данные будут выровнены на границу блока метаданных или фрейма.
+
+
Обратный вызов для работы с метаданными. Вызывается однажды по завершении кодирования с populated структурой STREAMINFO. Это нужно для того, чтобы кодеры файлов могли вернуться к началу файла и записать в блок STREAMINFO корректные данные о кодировании, например минимальный и максимальный размер фрейма.
+
+
+
Вызов FLAC__stream_encoder_init() непосредственно производит обратный вызов для записи сигнатуры "fLaC" и всех определенных на данный момент метаданных.
+
+
После инициализации экземпляра программа может передавать данные кодеру двумя способами:
+
+
+
Разделенными по каналам через FLAC__stream_encoder_process(). В этом случае нужно определить массив указателей на буфферы одинакового размера, по одному на каждый канал. Выравнивать сэмплы на границу блока не нужно.
+
+
В чередующихся каналах через FLAC__stream_encoder_process_interleaved(). Программа должна передать один указатель на аудио данные с чередующимися каналами (например, канал0_сэмпл0, канал1_сэмпл0, ... , каналN_сэмпл0, канал0_сэмпл1, ...). Данные могут быть не выровнены на границу блока, но должны быть выровнены на границу сэмпла, т.е. первым значением должно быть канал0_сэмплX, а последним - каналN_сэмплY.
+
+
+
Для завершения кодирования данных программа вызывает функцию FLAC__stream_encoder_finish(), которая кодирует оставшиеся данные из входного потока и делает обратный вызов для работы с метаданными с корректной статистикой о процессе кодирования. Экземпляр может быть удален функцией FLAC__stream_encoder_delete() или инициализирован снова для кодирования нового потока.
+
+
+
РАЗНОЕ
+
+
Необходимо отметить, что когда передаются указатели на аудио данные, их порядок имеет значение только для стерео потоков. Канал 0 соответствует левому каналу, а 1 - правому.
+
+
+
МЕТАДАННЫЕ
+
+
Программы, записывающие свои блоки метаданных APPLICATION, могут указать кодеру, чтобы он записал блок метаданных PADDING нужного размера. В этом случае вместо перезаписи всего потока после кодирования программа сможет просто заменить блок PADDING на свой. Если известен только максимальный размер блока APPLICATION, программа может создать резервный блок чуть большего размера, а после кодирования разделить его на блоки APPLICATION и PADDING.
+
+
Если размер блока метаданных APPLICATION известен заранее, размер резервируемой области может быть легко вычеслен. Если размер блока APPLICATION (не включая заголовок блока) равен N байтам, то экземпляру FLAC__StreamEncoder перед инициализацией нужно передать значение N+4. Это нужно, чтобы учесть дополнительное место необходимое для хранения идентификатора приложения.
+
+
Когда известен только максимальный размер, скажем, N байт, нужно зарезервировать N+8 байт. Четыре для ID приложения и четыре для дополнительного блока PADDING, который заполнит оставшееся пространство. По окончании кодирования, когда размер блока данных APPLICATION становится известной и равной, допустим, M байтам, на место первоначального блока PADDING будет записан блок APPLICATION и блок PADDING длиной N-M байтов.
Отслеживание ошибок ведется на этой странице проекта, находящейся на SourceForge. Если Вы будете сообщать об ошибке, пожалуйста, оставьте e-mail для контакта.
Все релизы делаются через SourceForge и лежат на этой странице. Для каждой версии выложены исходные тексты, а также скомпилированные версии для Linux, Windows и Darwin (включая OS X).
+
+
Пакеты для дистрибутива Debian можно взять здесь.
+
+
Вы также можете скачать обновляемый ежедневно архив CVS.
FLAC - это аббревиатура от free lossless audio codec (свободный кодек, обеспечивающий сжатие без потерь). Проект FLAC включает:
+
+
+
потоковый формат,
+
+
библиотеку libFLAC, реализующую базовый кодер и декодер,
+
+
flac, утилиту командной строки, выполняющую сжатие и распаковку .flac файлов,
+
+
плагины для разных плейеров (Winamp, XMMS, ведется работа над другими).
+
+
+
"Свобода" означает, что спецификация потокового формата относится к категории public domain (проект FLAC оставляет за собой право устанавливать спецификации и сертифицировать относящиеся к нему продукты на совместимость), а также то, что ни формат, ни один из реализованных методов кодирования/декодирования не запатентованы. Это также значит, что исходные тексты libFLAC доступны по лицензии LGPL, а утилиты flac и плагинов - по GPL.
+
+
+
FLAC компилируется на множестве платформ: Unixes (Linux, *BSD, Solaris, OS X), Windows, BeOS и OS/2. Имеются системы сборки для autoconf/automake, MSVC, Watcom C и Project Builder.
+
+
Характеристики FLAC:
+
+
+
Формат FLAC и методы кодирования/декодирования не защищены патентами.
+
+
FLAC сжимает файлы без потерь. Кодирование PCM данных не приводит к потере информации, следовательно, декодируемый аудиофайл абсолютно идентичен тому, который был подан на вход кодеру. Чтобы определить возможные ошибки при передаче файла, для каждого фрейма вычисляется 16-битная контрольная сумма. Целостность на дальнейшем этапе подтверждается подписью MD5 распакованных данных, которая находится в заголовке и может быть проверена при воспроизведении, декодировании или с помощью тестирования.
+
+
FLAC разработан для сжатия аудиоданных. Теоретически, flac может компрессировать без потерь любые другие данные (если передавать их как 8-битный моно raw-файл), однако выходные файлы получаются почти такого же размера.
+
+
Возможности сжатия во FLAC расширяемы. Это означает, что в будущих версиях формата могут быть добавлены новые методы без потери обратной совместимости.
+
+
Реализованные на данный момент методы компрессии создают потоки меньшего размера, чем Shorten (кодек с открытыми исходными текстами, являющийся текущим стандартом сжатия без потерь "у них"). Время кодирования зависит от метода, но обычно сравнимо с Shorten и LAME. Самые активные методы могут работать очень медленно. Подробнее об этом можно посмотреть на странице сравнение.
+
+
FLAC рассчитан на быстрое декодирование. Декодирование в реальном времени легко достижимо даже на старых компьютерах, так как для него требуется только целочисленная арифметика.
+
+
FLAC удобно использовать для архивации, так как сжатие с его помощью не приводит к потере информации. Вы не привязаны к формату. Если в будущем Вы решите использовать другой формат, данные будут восстановлены из .flac файла в первоначальном виде. Кроме контрольной суммы фрейма и подписи MD5, утилита flac имеет возможность проверки, использование которой приводит к тому, что кодируемый поток сразу же декодируется и сравнивается с исходным. Если происходит ошибка, кодер прекращает работу.
+
+
FLAC - потоковый формат. Это значит, что каждый фрейм содержит достаточно информации для собственного декодирования. Текущий фрейм FLAC не зависит от предыдущих и последующих. FLAC использует коды синхронизации и контрольные суммы, что позволяет декодеру быстро выбирать позицию в текущем потоке.
+
+
FLAC поддерживает быстрый и точный поиск, что полезно не только при воспроизведении, но и дает возможность использовать FLAC в звуковых редакторах.
+
+
FLAC имеет расширяемую систему метаданных. Новые блоки метаданных могут быть определены и реализованы в будущих версиях без потери обратной совместимости. Приложение может использовать блок метаданных APPLICATION после регистрации для него id. Добавленные тэги ID3 и ID3v2 к .flac файлам не влияют на поцесс декодирования.
+
+
+
Некоторые дополнительные преимущества, вытекающие из приведенных выше характеристик:
+
+
+
Потоки FLAC могут быть воспроизведены слитно, без пауз между треками. Таким образом, Вы можете сжать концертный альбом, разделенный на треки, и добиться его непрерывного воспроизведения.
+
+
Механизм точного поиска позволяет организовывать различные режимы воспроизведения: в плейере можно сделать индексный поиск, различные циклы или другие виды структурированного воспроизведения. Это очень полезно, например, для dj'ев или для репетиций, когда нужно повторять определенные пассажи.
+
+
В итоге вы получаете гибкость wav-файла в сжатом потоковом формате.
+
+
+
Чего нет во FLAC?
+
+
+
FLAC не осуществляет сжатие с потерями. Для этого существует много хороших форматов, таких как mp3 (отличная реализация с открытими исходными текстами LAME) и Ogg Vorbis.
+
+
FLAC не будет SDMI совместимым и т.п. Перед проектом не стоит цели поддерживать методы защиты, которые на практике лишь увеличивают объем файла. Конечно, мы не собираемся препятствовать кому-либо создавать соответствующие блоки метаданных, однако, стандартные декодеры все равно будут их пропускать.
Во-первых, как основной разработчик, я должен отметить, что не являюсь экспертом в области сжатия, поэтому чувствую себя обязанным поблагодарить многих людей, работавших над улучшением алгоритмов компрессии аудиоданных. Отдельную благодарность я выражаю:
+
+
+
Э. Робинсону за работу над Shorten. Его код и статья послужили отправной точкой для нескольких основных методов, заложенных во FLAC. FLAC развил идею постоянных предикторов, используемую в Shorten.
+
+
С. Голомбу и Роберту Райсу. Их универсальные коды используются кодером энтропии.
+
+
Н. Левинсону и Дж. Дарбину. Базовый енкодер использует разработанный и улучшенный ими алгоритм для определения LPC коэффициентов из коэффициентов автокорреляции.
Разбиение на блоки. Ввод разбивается на множество последовательных блоков, которые могут иметь различный размер. Оптимальный размер блока обычно зависит от многих факторов, таких как частота дискетизации, спектральная характеристика во времени и т.д. Несмотря на то, что формат FLAC позволяет использовать в потоке блоки различного размера, базовый енкодер использует постоянный размер.
+
+
Межканальная декорреляция. В случае стереопотоков енкодер создает средний и разностный сигналы, основанные на среднем значении между левым и правым каналами и их разности соответственно. На следующий этап кодирования передается лучший из вариантов сжатого сигнала.
+
+
Прогнозирование. Далее енкодер пытается найти математическое описание сигнала (обычно приблизительное). Зачастую оно значительно меньше самого сигнала. Так как методы предсказания известны и кодеру, и декодеру в потоке нужно указать только параметры предиктора. Сейчас FLAC использует четыре различных класса предикторов (описанных в разделе Прогнозирование), но в формате предусмотрено место для дополнительных методов. FLAC допускает изменение класса предиктора от блока к блоку и даже в пределах канала в блоке.
+
+
Кодирование остатков. Если предиктор не описывает сигнал точно, разница между оригинальным сигналом и спрогнозированным (называемым еще ошибочным или остаточным) должна быть закодирована без потерь. Если предсказание эффективно, остаточный сигнал будет занимать меньше бит на сэмпл, чем оригинальный сигнал. Сейчас FLAC использует только один метод для кодирования остатков (см. раздел Кодирование остатков), однако в формате предусмотрено место для дополнительных методов. FLAC допускает изменение метода кодирования остатков от блока к блоку и даже в пределах канала в блоке.
+
+
+
В дополнение ко всему определена система метаданных, позволяющая добавлять в начало потока произвольную информацию.
Линейное прогнозирование FIR. Для более точного моделирования (за счет медленной работы) FLAC поддерживает линейное прогнозирование FIR до 32 порядка (см. Shorten и AudioPak). Базовый енкодер использует метод Левинсона-Дарбина для расчета LPC коэффициентов из коэффициентов автокорреляции и коэффициенты разбиваются перед вычислением остатков. В то время как такие енкодеры как Shorten используют постоянное разбиение для всего ввода, FLAC позволяет для каждого фрейма менять точность коэффициента разбиения. Базовый енкодер FLAC оценивает оптимальную точность, основываясь на размере блока и диапазоне оригинального сигнала.
Аудиопоток состоит из одного или нескольких фреймов. У каждого фрейма есть заголовок, состоящий из кода синхронизации, информации о фрейме (размер блока, частота дискретизации, количество каналов и т.п.) и восьмибитной контрольной суммы. Также в заголовке содержится либо номер первого сэмпла во фрейме относительно всего потока (для потоков с изменяющимся размером блока) или номер фрейма (для потоков с постоянным размером блока). Это позволяет производить быстрый и точный поиск. Далее следуют закодированные подфреймы (по одному на каждый канал) и, наконец, фрейм, дополненный нулями до границы байта. Каждый подфрейм имеет свой заголовок, определяющий способ его декодирования.
+
+
Так как декодер может начать работу в середине потока, должен быть метод определения начала фрейма. Каждый фрейм начинается с 14-битного синхронизирующего кода. Этот код не может появляться ни в одном другом месте заголовка фрейма. Однако так как это код может появиться в подфреймах, у декодера есть два способа определить, что данная последовательность является началом фрейма. Сначала проверяется корректность данных во всем фрейме. Однако этот шаг не может гарантировать отсутствия ошибок, поэтому дополнительно производится расчет восьмибитной контрольной суммы заголовка фрейма и полученный результат сравнивается со значением, полученным при кодировании и записанным после заголовка фрейма.
+
+
Каждый фрейм должен содержать основную информацию о потоке, так как декодер может не иметь доступа к блоку метаданных STREAMINFO в начале потока. Сюда входит частота дискретизации, количество бит на сэмпл, количество каналов и т.д. Так как заголовоки фреймов вносят дополнительные накладные расходы, то они влияют уровень сжатия. Чтобы сделать заголовки фреймов минимальными, FLAC использует таблицы поиска для наиболее часто используемых значений параметров фремов. Например, часть, отвечающая за частоту дискретизации, занимает 4 бита. Восемь предопределенных значений соответствуют наиболее самым распространенным частотам (8/16/22.05/24/32/44.1/48/96 кГц). Однако дополнительные частоты могут быть использованы с помощью специального набора битов, указывающего декодеру, что необходимое значение находится в конце заголовка. Такой же метод используется для указания размера блока и количества битов на сэмпл. В этом случае заголовок остается достаточно малым для наиболее распространенных типов аудиоданных.
+
+
Подфреймы (по одному для каждого канала) кодируются во фрейме отдельно и хранятся в потоке последовательно. Это ведет к упрощению декодера, однако ценой этому является увеличение размеров буффера. У каждого подфрейма есть свой заголовок, определяющий его аттрибуты (метод и порядок прогнозирования, параметры кодирования остатков и т.д.). За заголовком следуют аудиоданные для этого канала.
Минимальный размер блока в сэмплах в данном потоке.
+
+
+
+
<16>
+
Максимальный размер блока в сэмплах в данном потоке.
+
+
+
+
<24>
+
Минимальный размер фрейма в байтах в данном потоке. Если значение не известно, то 0
+
+
+
+
<24>
+
Максимальный размер фрейма в байтах в данном потоке. Если значение не известно, то 0
+
+
+
+
<20>
+
Частота дискретизации в Гц.
+
+
+
+
<3>
+
(Количество каналов) - 1. FLAC поддерживает от 1 до 8 каналов.
+
+
+
+
<5>
+
(Количество битов на сэмпл) - 1. FLAC поддерживает от 1 до 32 битов на сэмпл. Сейчас базовые декодер и енкодер поддерживают до 24 бит на сэмпл.
+
+
+
+
<36>
+
Количество сэмплов в потоке. Если здесь указан 0, то количество сэмплов не известно.
+
+
+
+
<128>
+
Подпись MD5 несжатых аудиоданных, которая позволяет декодеру обнаружить ошибку, даже если ее наличие не нарушает структуру потока.
+
+
+
+
+
Примечания:
+
+
Во FLAC определен минимальный размер блока в 16 сэмплов и максимальный размер - 65535. Это значит, что значения от 0 до 15 в соответствующих полях являются ошибочными.
Содержимое комметария в формате Vorbis, как оно описано здесь. Обратите внимание на то, что спецификация Vorbis ограничивает размер этого блока 2 ^ 64 байтами, в то время как блок метаданных FLAC может иметь размер не больше 2 ^ 24 байтов. В соответствии со спецификацией Vorbis 32-битные данные little-endian coded, в отличие от big-endian coding целых, используемых в остальных местах FLAC.
01-11 : зарезервировано для последующего использования
+
+
+
+
+
+
<4>
+
Размер блока в сэмплах:
+
+
0000 : получить из блока метаданных STREAMINFO
+
0001 : 192 сэмпла
+
0010-0101 : 576 * (2^(2-n)) сэмплов, т.е. 576/1152/2304/4608
+
0110 : получить 8 битов (размер блока-1) из конца заголовка
+
0111 : получить 16 битов (размер блока-1) из конца заголовка
+
1000-1111 : 256 * (2^(n-8)) сэмплов, т.е. 256/512/1024/2048/4096/8192/16384/32768
+
+
+
+
+
+
<4>
+
Частота дискретизации:
+
+
0000 : получить из блока метаданных STREAMINFO
+
0001-0011 : зарезервированы
+
0100 : 8кГц
+
0101 : 16кГц
+
0110 : 22.05кГц
+
0111 : 24кГц
+
1000 : 32кГц
+
1001 : 44.1кГц
+
1010 : 48кГц
+
1011 : 96кГц
+
1100 : получить 8-битное значение частоты дискретизации (в кГц) из конца заголовка
+
1101 : получить 16-битное значение частоты дискретизации (в Гц) из конца заголовка
+
1110 : получить 16-битное значение частоты дискретизации (в дГц) из конца заголовка
+
1111 : ошибочное значение, чтобы не допустить совпадение с кодом синхронизации
+
+
+
+
+
+
<4>
+
Расположение каналов:
+
+
0000-0111 : (количество независимых каналов)-1. Когда == 0001, канал 0 является левым, 1 - правым
+
1000 : левостороннее стерео: канал 0 является левым, 1 - разностным
+
1001 : правостороннее стерео: канал 0 является разностным, 1 - правым
+
1010 : усредненное стерео: канал 0 является усредненным, 1 - разностным
+
1011-1111 : зарезервированы
+
+
+
+
+
+
<3>
+
Количество битов на сэмпл:
+
+
000 : получить из блока метаданных STREAMINFO
+
001 : 8 бит на сэмпл
+
010 : 12 бит на сэмпл
+
011 : зарезервировано
+
100 : 16 бит на сэмпл
+
101 : 20 бит на сэмпл
+
110 : 24 бит на сэмпл
+
111 : зарезервировано
+
+
+
+
+
+
<1>
+
Дополнение нулем до границы бита, чтобы не допустить ошибку синхронизации
+
+
+
+
<?>
+
Если (переменный размер блока)
+ <8-56> : номер сэмпла в формате UTF-8 (размер декодируемого числа 36 бит)
+ иначе
+ <8-48> : номер фрейма в формате UTF-8 (размер декодируемого числа 31 бит)
8-битная полиномальная контрольная сумма (x^8 + x^2 + x^1 + x^0) данных заголовка, включая код синхронизации (x инициализируется нулем).
+
+
+
+
+
Примечания:
+
+
Биты размера блока 0000-0101 могут быть использованы только при постоянном их значении во всем блоке. Биты 0110-0111 могут использоваться в любом случае, декодер будет считать, что поток имеет переменную длину блока. Существует одно исключение: енкодер может использовать биты 0110-0111 в последнем фрейме потока с постоянным размером блока в том случае, если его длина не больше, чем используемая в всем потоке.
0 : в исходном подблоке нет 'неиспользуемых битов', k=0
+
1 : k 'неиспользуемых битов' в исходном подблоке, число записывается в унарном формате; т.е. для k=3 последовательность битов будет выглядеть так 001, для k=7 - 0000001.
+
+
+
+
+
+
+
Примечания:
+
+
'Неиспользуемые биты' встречаются в блоке данных, если при заявленных n битах значимыми являются только m. Число k = n - m и будет определять количество 'неиспользуемых битов'. Например, если все 16-битные сэмплы в исходном подблоке выглядят как 'xxxxxxxxxxxxx000', то енкодер кодирует только 13 бит, и запоминает, что 3 бита являются 'неиспользуемыми'.
Так как FLAC - это открытый проект, важно определить список целей, к чему нужно стремиться. Время от времени они могут немного изменяться, но всегда должны определять направление развития. изменения должны согласовываться с текущими целями и не пытаться включить в себя антицели.
+
+
Цели
+
+
+
FLAC должен оставаться открытым форматом. Все исходные тексты либо под LGPL, либо под GPL.
+
+
FLAC должен производить только сжатие без потерь. Вроде бы это очевидно, однако, кодирование с потерями пытается проникнуть во все аудио кодеки. Эта цель также означает, что FLAC должен придерживаться только принципов архивирования и сжимать без потерь абсолютно все типы входных данных. Релизы должны тщательно тестироваться.
+
+
FLAC должен достичь приемлимого уровня сжатия файлов.
+
+
FLAC должен иметь низкие аппаратные требования и обеспечить декодирование в реальном времени даже на старых компьютерах.
+
+
FLAC должен поддерживать быстрый и точный поиск.
+
+
FLAC должен поддерживать воспроизведение без пауз для непрерывных потоков.
+
+
Проект FLAC находится в долгу перед многими людьми, кто улучшал методы сжатия звука, и нацелен на поддержку новых идей с помощью открытой разработки.
+
+
+
+
Антицели
+
+
+
Сжатие с потерями. Существует достаточно много хороших форматов, предназначенных именно для этого (Ogg Vorbis, mp3, и т.д.).
FLAC позволяет приложениям третьих лиц зарегистрировать id для использования блоков метаданных APPLICATION. Чтобы получить id или внести изменение в существующий id, используйте форму на этой странице (пишите на английском языке).
Phatnoise стала первой коммерческой аппаратной платформой, поддерживающей FLAC. Для воспроизведения FLAC файлов плейером Phatbox выпущена прошивка. Подробнее об этом на странице Phatbox.
+
+
Если вы используете FLAC и у вас есть предоложения или патчи, пожалуйста, присодиняйтесь к списку рассылки или группе разработчиков. Сообщить об ошибке можно здесь.
+
+
+
Что такое FLAC?
+
+
FLAC - это аббревиатура от free lossless audio codec (свободный кодек, обеспечивающий сжатие без потерь). Проект FLAC включает:
+
+
+
потоковый формат,
+
+
библиотеку libFLAC, реализующую базовые енкодеры и декодеры,
+
+
flac, утилиту командной строки, выполняющую сжатие и распаковку .flac файлов,
+
+
плагины для разных плейеров (Winamp, XMMS, ведется работа над другими).
+
+
+
"Свобода" означает, что спецификация потокового формата относится к категории public domain (проект FLAC оставляет за собой право устанавливать спецификации и сертифицировать относящиеся к нему продукты на совместимость), а также то, что ни формат, ни один из реализованных методов кодирования/декодирования не запатентованы. Это также значит, что исходные тексты libFLAC доступны по лицензии LGPL, а утилиты flac и плагинов - по GPL.
+
+
FLAC компилируется на множестве платформ: Unixes (Linux, *BSD, Solaris, OS X), Windows, BeOS и OS/2. Имеются системы сборки для autoconf/automake, MSVC, Watcom C и Project Builder.
+
+
Чтобы узнать больше о проекте FLAC, смотрите страницы характеристики, документация и формат. Также приведено сравнение кодеров, осуществляющих сжатие без потерь, и список целей, стоящих перед участниками проекта.
+
+
+
Файлы
+
+
На этой странице находятся ссылки на исходные тексты, а также скопилированные версии для различных операционных систем. Сами файлы лежат на SourceForge.
+
+
+
Документация
+
+
Документация доступна в режиме онлайн и в дистрибутивах. Информация по установке и использованию flac и плагинов находится здесь. Более детальная информация о формате FLAC и базовом енкодере приведена на этой странице.
+
+
+
Регистрация id
+
+
Если у вас есть приложение, использующее FLAC, и вы хотите, чтобы оно работало с добавляемыми в файл метаданными, зайдите на страницу регистрации и зарезервируйте для него идентификатор.
13.02.2002
+Первая аппаратная реализация FLAC. Phatnoise стала первой коммерческой аппаратной платформой, поддерживающей FLAC. Для воспроизведения FLAC файлов плейером Phatbox выпущена прошивка. Подробнее об этом на странице Phatbox.
+
+
03.12.2001
+Вышла версия FLAC 1.0.2. Релиз сделан для исправления проблемы, приводящей к "падению" плагинов. Ошибка также могла касаться пользователей libFLAC, которые использовали один экземпляр декодера файлов для нескольких файлов. Подробнее см. здесь.
+
+
14.11.2001
+Вышла версия FLAC 1.0.1. Основной кодек не был изменен, но были добавлены несколько новых возможностей и исправлено несколько ошибок.
+
+
+
+
Новые возможности для пользователей:
+
+
+
Поддержка Ogg-FLAC, т.е. flac теперь может читать и создавать потоки с использованием транспортного уровня Ogg.
+
+
Новый плагин для Winamp 3, основанный на Wasabi Beta 1 SDK.
+
+
Новые утилиты для поддержки FLAC в Monkey Audio GUI; см. описание.
+
+
Поддержка Mac OS X. В разделе файлы теперь есть скомпилированная версия для OS X.
+
+
Поддержка Mingw32.
+
+
Улучшена обработка специфичных для MS 'fmt' заголовков файлов WAVE.
+
+
+
Новые возможности для разработчиков:
+
+
+
+Добавлен уровень SeekableStreamDecoder между StreamDecoder и FileDecoder. С его помощью удобнее использовать библиотеку libFLAC в ситуациях, когда неодостачно информации о декодируемом файле. Болле подробно все описано в разделе документация. Интерфейс для StreamDecoder и FileDecoder остался прежним и, соответственно, сохранилась бинарная совместимость с libFLAC 1.0.
+
+
Уменьшен размер стека необходимый кодеру.
+
+
+
Исправленные ошибки:
+
+
+
Существенная ошибка при кодировании raw ввода, приводящая к добавлению 12 лишних сэмплов к получаемому файлу. Кодирование из WAVE файлов работало правильно.
+
+
Ошибка в libFLAC, связанная с установкой имени файла в stdin в декодере файлов.
+
+
Ошибка в libFLAC, возникающая при множественных вызовах для установки имени файла и приводящая к утечке памяти.
+
+
metaflac правильно пропускает тег id3v2.
+
+
metaflac правильно пропускает большие блоки метаданных.
+
+
+
+
+
+
20.07.2001
+Вышла версия FLAC 1.0! Добавлено несколько новых возможностей, но в основном исправления ошибок.
+
+
+
+
Новая опция '--sector-align' позволяет выравнивать группу кодируемых аудиофайлов на границу сектора в формате Audio-CD.
+
+
Новая опция '--output-prefix' добавляет префикс ко всем выходным именам файлов (полезно, например, для сохранения результатов работы в другой каталог).
+
+
Улучшенное автоопределение WAVE (больше не полагается на ungetc()).
+
+
Более понятная статистика при кодировании/декодировании.
+
+
Изменения в интерефейсе библиотеки libFLAC для более простой поддержки бинарной совместимости в будущем.
+
+
Новая опция '
--sse-os
' в конфигурационном скрипте для использования более быстрых процедур, основанных на SSE.
+
+
Еще одно (надеюсь последнее) исправление в плагине для Winamp 2.
+
+
Немного улучшена оценка параметра Райса.
+
+
Исправление ошибок, возникающих в очень редких ситуациях при кодировании.
+
+
+
+
07.06.2001
+Вышла версия FLAC 0.10. Скорее всего это последняя бета версия. За последние два месяца было сделано много улучшений.
+
+
+
Скорость работы кодера и декодера значительно возросла. Основные процедуры написаны на ассемблере для IA-32.
+
+
Добавлен блок метаданных SEEKTABLE, содержащий информацию, позволяющую ускорить значительно ускорить поиск в потоке.
+
+
Модель поведения flac теперь аналогична gzip.
+
+
Опции -# настроены для получения наилучшего соотношения уровень/время сжатия. По умолчению установлено значение -5.
+
+
Неподдерживаемые блоки в WAVE-файле теперь пропускаются с предупреждением.
+
+
Добавлена опция --delete-input-file, позволяющая удалять входной файл после удачного кодирования/декодирования.
+
+
Изменен плагин для XMMS, чтобы нормально работала визуализация.
+
+
Исправлена ошибка, возникающая в потоковом декодере после поиска.
+
+
+
+
31.03.2001
+Вышла версия 0.9. Исправлены плагины для Winamp и XMMS. Изменен формат (надеюсь, последний раз). Потеряна совместимость со всеми предыдущими версиями.
+
+
+
24.03.2001
+Близится выход версии 0.9, в которой должен быть исправлен плагин для Winamp. Джош обратился через список рассылки, чтобы после выхода этой версии к нему обратились с пожеланиями (особенно радикальными, которые могут коснуться формата).
+
+
+
21.03.2001
+Текущая версия FLAC - 0.8. Начат перевод документации.
+
+
+
10.12.2000
+FLAC выложен на SourceForge. Посетите страницу проекта, чтобы подписаться на список расылки или стать разработчиком.
+
+