[Libav-user] What' the difference of decoding an Audio frame of planar sample format with avcodec_decode_audio3 and 4

黄轩宇 xuanyu.huang at gmail.com
Fri Feb 8 14:00:31 CET 2013


Hi All,

I'm now upgrading our application to use the latest ffmpeg version.

In old version the AAC decoder supports packed sample but the latest AAC
decoder only supports planar sample format.

Our application uses avcodec_decode_audio3(AVCodecContext *avctx, int16_t
*samples, int *frame_size_ptr, AVPacket *avpkt)
to decode a frame.

While the sample data is stored in a simple array. I want to know how the
data will be laid out in this array.

Let's assume audio has 2 channels: A and B.

1. will the output sample array be laid out like A1B1A2B2A3B3... if we use
avcodec_decode_audio3 with old version AAC decoder
2. will the output sample array be laid out like A1A2A3....B1B2B3... if use
avcodec_decode_audio3  with latest AAC decoder

and I also want to know what's the result if I use avcodec_decode_audio4 to
decode a frame, because unlike the decode_audio3,
the decoded samples are stored in an two-dimensional array uint8_t
*AVFrame::data[AV_NUM_DATA_POINTERS];

3. will the output sample array be laid out like
data[0] : A1B1A2B2A3B3....
data[1] : 0
data[2] : 0
 if we use avcodec_decode_audio4 with old version AAC decoder

4. will the output sample array be laid out like
data[0] : A1A2A3...
data[1] : B1B2B3
data[2] : 0
 if we use avcodec_decode_audio4 with latest version AAC decoder?

I don't have code at hand now so I can't run application myself to check
the result.

Another thing is about libavresample and libswresample. I know this two
libraries provide interfaces to convert data format.
But if what I want is just array re-layout (as AAC decoder upgraded from
packed sample format to planar format). May I just
do that by array manipulation, without using these two libraries?

Great thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130209/4cb286e5/attachment.html>


More information about the Libav-user mailing list