[FFmpeg-devel] [PATCH] swscale-example: use av_malloc()
Tue Jan 19 16:45:57 CET 2010
On Tue, Jan 19, 2010 at 1:33 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Jan 19, 2010 at 08:25:40AM -0200, Ramiro Polla wrote:
>> On Tue, Jan 19, 2010 at 1:07 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Tue, Jan 19, 2010 at 02:20:02AM +0000, Mans Rullgard wrote:
>> >> Image buffers require 16-byte alignment, so av_malloc() should be used.
>> >> Fixes crash on PPC.
>> >> ---
>> >> ?swscale-example.c | ? 11 ++++++-----
>> >> ?1 files changed, 6 insertions(+), 5 deletions(-)
>> > ok with matching av_free()
>> Quoting you from :
>> "seriously, example code should be simple and useage of av_free* may not be
>> for someone unfamiliar with libav* development"
> good argument but without rereading the thread, id suspect that was for a
> "change to avmalloc() due to consistency or so" here its a crash due to
> insufficient alignment on ppc
> same change but different reason for the change
Yes, it was dropped for a reason back then...
>> So maybe we should have a similar comment like we have on output-example:
>> ? ? ? ? /* image buffers passed into libswscale can be allocated any
>> way you prefer,
>> ? ? ? ? ? ?as long as they're aligned enough for the architecture, and
>> ? ? ? ? ? ?they're freed appropriately (such as using av_free for buffers
>> ? ? ? ? ? ?allocated with av_malloc) */
More information about the ffmpeg-devel