FLAC格式总结

编程入门 行业动态 更新时间:2024-10-09 03:24:51

FLAC<a href=https://www.elefans.com/category/jswz/34/1771175.html style=格式总结"/>

FLAC格式总结

最近有做一些FLAC播放的工作,做点简单总结用于个人学习。主要参考官网ttp://flac.sourceforge/

FLAC结构与编码

FLAC流数据组织结构可用如下图表示,详情参考1 STREAM基本结构:  

       -The four byte string "fLaC"

       -The STREAMINFO metadata block

            --metadata header

                ---metadata type

                ---metadata data length

            --real metadata data

       -Zero or more other metadata blocks

       -One or more audio frames

            --frame header

            --subframe

                ---subframe header

                ---subframe data

            --frame footer

 

一些背景以及编码知识如下:

This is a detailed description of the FLAC format. There is also a companion document that describes FLAC-to-Ogg mapping.

For a user-oriented overview, see About the FLAC Format.

Table of Contents

·     Acknowledgments

·     Scope

·     Architecture

·     Definitions

·     Blocking

·     Interchannel Decorrelation

·     Prediction

·     Residual Coding

·     Format

·     FLAC Subset

·     Specification

o    STREAM

§     METADATA_BLOCK

§     METADATA_BLOCK_HEADER

§     METADATA_BLOCK_DATA

§     METADATA_BLOCK_STREAMINFO

§     METADATA_BLOCK_PADDING

§     METADATA_BLOCK_APPLICATION

§     METADATA_BLOCK_SEEKTABLE

§     SEEKPOINT

§     METADATA_BLOCK_VORBIS_COMMENT

§     METADATA_BLOCK_CUESHEET

§     CUESHEET_TRACK

§     CUESHEET_TRACK_INDEX

§     METADATA_BLOCK_PICTURE

§     FRAME

§     FRAME_HEADER

§     FRAME_FOOTER

§     SUBFRAME

§     SUBFRAME_HEADER

§     SUBFRAME_CONSTANT

§     SUBFRAME_FIXED

§     SUBFRAME_LPC

§     SUBFRAME_VERBATIM

§     RESIDUAL

§     RESIDUAL_CODING_METHOD_PARTITIONED_RICE

§     RICE_PARTITION

§     RESIDUAL_CODING_METHOD_PARTITIONED_RICE2

§     RICE2_PARTITION

Acknowledgments

FLAC owes much to the many people who have advanced the audio compression field so freely. For instance:

·     A. J. Robinson for his work on Shorten; his paper is a good starting point on some of the basic methods used by FLAC. FLAC trivially extends and improves the fixed predictors, LPC coefficient quantization, and Rice coding 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.

·     And of course, Claude Shannon

Scope

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.

Architecture

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. 首先将输入的音频流划分成block,尽管FLAC允许变化的block size,但encoder目前还是使用固定的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. 由于encoder与decoder都知道前向预测的方法,我们只需要保留参数即可,每个block也可以使用不同的预测方法,甚至每个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.

Definitions

更多推荐

FLAC格式总结

本文发布于:2024-03-23 15:17:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1739688.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:格式   FLAC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!