数据压缩原理与应用 MPEG音频编码

本文探讨了MPEG音频编码的原理,包括MPEG-I心理声学模型、多相滤波器组、临界频带概念、比例因子计算和比特分配策略。通过对实验流程、代码分析和结果展示,深入解析了MPEG音频压缩的各个环节。
摘要由CSDN通过智能技术生成

一.实验原理

这里写图片描述
mpeg的音频编码主要采用了心理声学模型

1. MPEG-I 心理声学模型
  • 通过子带分析滤波器组使信号具有高的时间分辨率,确保在短暂冲击信号情况下,编码的声音信号具有足够高的质量。
  • 又可以使信号通过FFT运算具有高的频率分辨率,因为掩蔽阈值是从功率谱密度推出来的。
  • 在低频子带中,为了保护音调和共振峰的结构,就要求用较小的量化阶、较多的量化级数,即分配较多的位数来表示样本值。而话音中的摩擦音和类似噪声的声音,通常出现在高频子带中,对它分配较少的位数
2. MPEG-1音频编码器框架图
  • 多相滤波器组(Polyphase Filter Bank):用来分割子带,将PCM样本变换到32个子带的频域信号
    这里写图片描述
    如果输入的采样频率为48kHz ,那么子带的频率宽度为48/ (2*32 )=0.75Hz
  • 心理声学模型(Psychoacoustic Model):计算信号中不可听觉感知的部分
    计算噪声遮蔽效应
  • 比特分配器(Bit Allocator):根据心理声学模型的计算结果,为每个子带信号分配比特数
  • 装帧(Frame Creation):产生MPEG-I兼容的比特流
3. 临界频带(Critical Band)

临界频带是指当某个纯音被以它为中心频率、且具有一定带宽的连续噪声所掩蔽时,如果该纯音刚好被听到时的功率等于这一频带内的噪声功率,这个带宽为临界频带宽度。

掩蔽效应在一定频率范围内不随带宽增大而改变,直至超过某个频率值。通常认为从20Hz到16kHz有25个临界频带,单位为bark。
1 Bark = 一个临界频带的宽度

4. 比例因子的取值和编码

对各个子带每12个样点进行一次比例因子计算。先定出12个样点中绝对值的最大值。查比例因子表中比这个最大值的最小

mpeg4编码库源代码,C++完整源代码,有需要饿同学尽管拿去。 // This is the header file describing // the entrance function of the encoder core // or the encore ... #ifdef __cplusplus extern "C" { #endif typedef struct _ENC_PARAM_ { int x_dim; // the x dimension of the frames to be encoded int y_dim; // the y dimension of the frames to be encoded float framerate;// the frame rate of the sequence to be encoded long bitrate; // the bitrate of the target encoded stream long rc_period; // the intended rate control averaging period long rc_reaction_period; // the reation period for rate control long rc_reaction_ratio; // the ratio for down/up rate control long max_key_interval; // the maximum interval between key frames int max_quantizer; // the upper limit of the quantizer int min_quantizer; // the lower limit of the quantizer int search_range; // the forward search range for motion estimation } ENC_PARAM; typedef struct _ENC_FRAME_ { void *image; // the image frame to be encoded void *bitstream;// the buffer for encoded bitstream long length; // the length of the encoded bitstream } ENC_FRAME; typedef struct _ENC_RESULT_ { int isKeyFrame; // the current frame is encoded as a key frame } ENC_RESULT; // the prototype of the encore() - main encode engine entrance int encore( unsigned long handle, // handle - the handle of the calling entity, must be unique unsigned long enc_opt, // enc_opt - the option for encoding, see below void *param1, // param1 - the parameter 1 (its actually meaning depends on enc_opt void *param2); // param2 - the parameter 2 (its actually meaning depends on enc_opt // encore options (the enc_opt parameter of encore()) #define ENC_OPT_WRITE 1024 // write the reconstruct image to files (for debuging) #define ENC_OPT_INIT 32768 // initialize the encoder for an handle #define ENC_OPT_RELEASE 65536 // release all the resource associated with the handle // return code of encore() #define ENC_OK 0 #define ENC_MEMORY 1 #define ENC_BA
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值