[Libav-user] av_samples_fill_arrays and memory

Bruce Wheaton bruce at spearmorgan.com
Fri Apr 26 22:45:33 CEST 2013


On Apr 26, 2013, at 9:45 AM, Brad O'Hearne wrote:

> So for instance, say samples are derived from an outside source (such as capture), and channels/planes are delivered and properly structured, and code was not to use the av_samples_fill_arrays above, but rather set pointers themselves. This would seem right: 
> 
> audio_data[0] = channel1;
> audio_data[1] = channel2;
> 
> But what if the above was done, yet this was also true:
> 
> audio_data[1] != (audio_data[0] + line_size)
> 
> The audio_data array has proper pointers to each channel -- and each channel may be properly aligned within. But what if multiple channels aren't in contiguous memory? Is that going to be an issue in using the audio_data array at any point, perhaps later in encoding? 

Brad, since you've discussed at length every aspect of this except one meaning of 'aligned', and it's the relevant one, can I just double check you're aware of this definition and you are respecting it? When discussing the data being aligned, it means that the data in the buffers is aligned to four byte (or however many) boundaries in memory. That's required to use various FFmpeg accelerated routines - SSE etc.

It may be that your source of dest buffers, if not from ffmpeg, are not correctly aligned. If you make your own buffers, you would generally expect to confirm or adjust alignment as you do, so that ffmpeg can use them. If not, then the results are probably undefined.

Bruce


More information about the Libav-user mailing list