[FFmpeg-devel] Problem with implementation of AC3 fixed point decoder

Michael Niedermayer michaelni at gmx.at
Sun Jan 6 17:39:12 CET 2013


On Fri, Jan 04, 2013 at 10:08:55AM +0000, Babic, Nedeljko wrote:
> Hello,
> 
> Few weeks ago I posted patche with implementation of AC3 fixed point decoder for review.
> In the meantime code for AC3 floating point decoder changed and now only planar float is 
> outputted, decoding is done directly into output buffers, etc.
> 
> I am trying to apply changes to AC3 fixed point code so I can prepare new patche for review 
> and I have a problem. 
> 
> It looks like decoding (fixed point) is working ok after my changes, but when it exits from decoder 
> it breaks on malloc in memalign (in avfilter_get_audio_buffer_ref_from_arrays_channels) with 
> “malloc(): memory corruption: 0x00000000014798e0 ***”.

Did you try valgrind ?
if it can handle mips, it should provide some hints of what is missing


> 
> This happens only for fixed point decoder (I didn’t break floating point decoder with my changes) 
> when I use AV_SAMPLE_FMT_S16P instead of AV_SAMPLE_FMT_FLTP.
> 
> I even tried to change only sample_fmt field in structure AVCodecContext from AV_SAMPLE_FMT_FLTP 
> to AV_SAMPLE_FMT_S16P and to run floating point decoder but then it also breaks in the same way.
> 
> I also tried to set field sample_fmt to AV_SAMPLE_FMT_FLTP for fixed point decoder to see what will 
> happen and then it decodes, but there are only zeroes on all channels in output file as if output 
> buffers are wrong.
> 
> I am not quite sure that I understand how work with planar data is done in ffmpeg (and I think that 
> the problem is there somewhere) and I guess that I am missing something outside of decoder.
>  

> Is it enough to change value of field sample_fmt (in struct AVCodecContext) from  AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16P (if decoding is done ok) or something else should be set?

sample_fmt in AVCodecContext must match the sample type float/s16 and
Planer/packed that is output, array sizes and layout as well as what
is allocated also must match
and AVCodec.sample_fmts if set should also match

also you may have to change a float to int16_t somewhere
look at compiler warnings about type mismatches

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130106/c0fbf542/attachment.asc>


More information about the ffmpeg-devel mailing list