[FFmpeg-devel] [PATCH] support for hardcoded mpegaudiodec tables
Michael Niedermayer
michaelni
Tue Oct 27 17:55:36 CET 2009
On Tue, Oct 27, 2009 at 05:29:34PM +0100, Reimar D?ffinger wrote:
> On Tue, Oct 27, 2009 at 05:05:51PM +0100, Michael Niedermayer wrote:
> > up to these your implementation did not look that bad but this here
> > would need 2(signedness)(8/16/32/64/float/double)(1d/2d) ->
> > 24 functions
>
> Do you mind the number of functions or the code duplication?
> The functions I think can be easily generated by two macros with about
> 4 parameters, one for 1d and one for 2d, getting rid of duplicated code
> and binary size should really not matter here.
what itches me is that this looks like it can be done much simpler with
a single function in style similar to how we read the tables to build
vlc stuff (GET_DATA())
am i missing some disadvanatge of that approuch?
switch(size) {
case 1: v = *(const uint8_t *)ptr; break;
case 2: v = *(const uint16_t *)ptr; break;
case 4: v = *(const uint32_t *)ptr; break;
case 8+1: v = *(const int8_t *)ptr; break;
case 8+2: v = *(const int16_t *)ptr; break;
case 8+4: v = *(const int32_t *)ptr; break;
}
above simply looks nicer to me than 2 pages of 6 functions.
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- 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/20091027/b1dc3ba2/attachment.pgp>
More information about the ffmpeg-devel
mailing list