[FFmpeg-devel] [PATCH] install aes.h, des.h and rc4.h
Michael Niedermayer
michaelni
Sun Feb 8 01:20:05 CET 2009
On Sat, Feb 07, 2009 at 02:07:36PM +0100, Reimar D?ffinger wrote:
> On Sat, Feb 07, 2009 at 01:37:13PM +0100, Michael Niedermayer wrote:
> > On Sat, Feb 07, 2009 at 12:11:15PM +0100, Reimar D?ffinger wrote:
> > > > type name = ff_alloca_##name##_buffer + ((-(long)ff_alloca_##name##_buffer)&15);
> > > > and +15 should be enough
> > >
> > > I was too tired to think about it so I just copy-and-pasted the malloc
> > > stuff.
> > > So like this (note the ugly casting is to make sure it works with C++ as
> > > well, and I haven't tested it yet):
> > > Index: libavutil/mem.h
> > > ===================================================================
> > > --- libavutil/mem.h (revision 16989)
> > > +++ libavutil/mem.h (working copy)
> > > @@ -41,6 +41,17 @@
> > > #endif
> > >
> > > /**
> > > + * Allocate data on the stack with sufficient alignment for all operations
> > > + * and assign it to the given variable.
> > > + * @param type type of the created variable, must be a pointer type
> > > + * @param name name of the created variable
> > > + * @param size Size in bytes for the memory block to be allocated.
> > > + */
> > > +#define AV_STACK_VAR(type, name, size) \
> > > + uint8_t ff_alloca_##name##_buffer[size + 15]; \
> > > + type name = (type)(void *)(ff_alloca_##name##_buffer + ((-(long)ff_alloca_##name##_buffer)&15));
> > > +
> > > +/**
> > > * Allocates a block of \p size bytes with alignment suitable for all
> > > * memory accesses (including vectors if available on the CPU).
> > > * @param size Size in bytes for the memory block to be allocated.
> >
> > iam not against this, though it isnt particularely pretty ...
>
> Well, I'd happily take a pretty solution if you can offer one.
> But making the AES API public while the only way to use it is a way you
> wouldn't accept in libavformat seems pointless to me.
> I don't care, I wasn't the one who requested to move everything to a
> public API.
i really dont see the problem, malloc() can be used to allocate a struct,
alloca() can as well so can a uint64_t array.
I honestly dont see how your custom macro would be better, it requires the
reader to search for the code of the macro to understand it ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090208/1a37d2bf/attachment.pgp>
More information about the ffmpeg-devel
mailing list