安卓dts音频解码_DTS音效、解码、编码概念剖析

一、什么是DTS

1.DTS是什么

我们经常看到电子产品上贴着DTS的logo,那到底什么DTS呢?其实DTS非常复杂,是一个庞大的系统,里面包括了很多子系统,主要包括声音编码、解码、音效。我们可以简单理解DTS能够给我们提供一种优质的听觉效果,更简单粗暴的可类比使用某种音乐播放器会有一定与众不同的听觉效果。

2.DTS基本概念

DTS是Digital Theater System的缩写,是数字化影院系统的意思,DTS具有更平滑、更具动态效果,声音还原更接近于原始的效果。那么一般的电子产品支持DTS是指音效、解码、还是编码呢?支持DTS一般来说是指支持DTS解码,支持DTS解码肯定就支持DTS音效,DTS编码一般的产品是不支持的。

二、音效、解码、编码的概念

1.DTS音效

音效是人们的一种听觉感受,如我们能区分高音、低音、噪音,不同歌手唱歌好不好听,这些听觉感受就是音效。DTS音效就是提供了一种更优质的听觉效果,如采用DTS音效的产品噪音更小、低音更丰满。DTS音效先可以简单理解为是一个纯软件算法处理的过程,也就是说任何的声音原始数据都可以实现DTS音效。

2.DTS编码

DTS编码是指在声音采集时,采集的声音数据使用DTS编码方式进行编码,最后封装成如.mp4音频文件。

3.DTS解码

既然存在DTS编码方式编码的文件,那当然只能用DTS解码方法才能解析文件的数据,如使用Microsoft Office Word程序创建的.doc文件无法使用Microsoft Office Excel程序打开而只能使用Microsoft Office Word程序才能打开,即使用什么工具去创建就必须用什么工具去解码。

三、音效、解码、编码的联系

1.DTS音效和解码

支持DTS音效,不一定要支持DTS解码,只是如果不支持DTS解码,那么DTS编码的文件是无法播放的。一个普通文件如PCM编码的文件,可以使用PCM解码声音数据后再使用软件算法实现DTS音效。当然PCM编码的文件的DTS音效肯定没有DTS编码文件的DTS音效好,效果不好的原因不在于实现DTS音效软件算法过程,而是在于DTS编码的文件原始数据更丰富或者说更符合DTS音效处理过程的特性,最终处理的效果会更好。

2.DTS解码和编码

支持DTS解码不一定支持DTS编码,就像很多PDF阅读器只能阅读而无法创建PDF文件,编码是一项更高级的功能,一般需要硬件的支持。

如果一台电视机支持DTS编码是什么意思呢?无论电视输入源是什么编码格式,电视机把声音输出给功放时会把声音数据重新使用DTS编码一次,功放接收到的声音即是DTS声音数据,当然目前一般很少的电视机支持DTS编码。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
av_frame_alloc函数用于为AVFrame结构体分配内存空间,AVFrame结构体用于存储解码后的音视频数据。在音频解码中,可以通过调用该函数为AVFrame结构体分配内存空间,然后将解码后的音频数据存储到该结构体中,最后再进行后续的处理操作。 具体使用方法如下: ```c AVFrame *frame = av_frame_alloc(); if (!frame) { // 内存分配失败处理 } ``` 其中,AVFrame结构体的定义如下: ```c typedef struct AVFrame { /** * pointers to the data planes/channels. * This might be different from the first allocated byte */ uint8_t *data[AV_NUM_DATA_POINTERS]; /** * For video, size in bytes of each picture line. * For audio, size in bytes of each plane. */ int linesize[AV_NUM_DATA_POINTERS]; /** * pointers to the start of each picture line. * This is used for both video and audio. */ uint8_t **extended_data; /** * width and height of the video frame */ int width, height; /** * number of audio samples (per channel) described by this frame */ int nb_samples; /** * format of the frame, -1 if unknown or unset * Values correspond to enum AVPixelFormat for video frames, * enum AVSampleFormat for audio) */ int format; /** * 1 -> keyframe, 0-> not */ int key_frame; /** * Picture type of the frame. */ enum AVPictureType pict_type; /** * Quality (between 1 (good) and FF_LAMBDA_MAX (bad)). */ int quality; /** * for AV_PIX_FMT_*_BE formats, linesize alignment */ int64_t best_effort_timestamp; /** * PTS copied from the AVPacket that was decoded to produce this frame. */ int64_t pkt_pts; /** * DTS copied from the AVPacket that triggered returning this frame. */ int64_t pkt_dts; /** * duration of the corresponding packet, expressed in * AVStream->time_base units, 0 if unknown. */ int64_t pkt_duration; uint64_t metadata; int decode_error_flags; /** * number of audio channels */ int channels; /** * size of the corresponding packet containing the compressed * frame. It is set to a negative value if unknown. */ int pkt_size; /** * data type */ enum AVSampleFormat sample_fmt; /** * presentation timestamp in timebase units * (time when frame should be shown to user) * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed. */ int64_t pts; /** * reordered PTS from the last AVPacket that has been input into the decoder */ int64_t best_effort_timestamp; /** * sample aspect ratio (0 if unknown) * - encoding: Set by user. * - decoding: Set by libavcodec. */ AVRational sample_aspect_ratio; /** * motion vector table, used for MPEG1/2/4 and H.263 decoding */ struct AVPanScan *pan_scan; /** * macroblock decision mode */ int coded_picture_number; int display_picture_number; /** * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) */ int quality; /** * buffer age (1->was last buffer and dint change, 2->..., ...) */ int age; /** * is this picture used as reference */ int reference; /** * QP table */ int8_t *qp_table_buf; /** * QP store stride */ int qp_table_linesize; /** * QP values for each macroblock */ int8_t *qp_table; /** * For hwaccel-format frames, this should be a reference to the * AVHWFramesContext describing the frame. * For normal-format frames, this should be NULL. */ AVBufferRef *hw_frames_ctx; } AVFrame; ``` 需要注意的是,AVFrame结构体中的成员变量很多,具体使用哪些成员变量取决于具体的应用场景和需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值