[FFmpeg-soc] [soc]: r3046 - in aac: aac.c aac.h

Michael Niedermayer michaelni at gmx.at
Thu Aug 7 12:40:28 CEST 2008


Hi

On Thu, Aug 07, 2008 at 08:50:05AM +0200, Reimar Doeffinger wrote:
> On Wed, Aug 06, 2008 at 09:21:32PM -0400, Justin Ruggles wrote:
> > superdump wrote:
> > > Author: superdump
> > > Date: Wed Aug  6 12:00:44 2008
> > > New Revision: 3046
> > > 
> > > Log:
> > > Use a simple LCG as recommended in libavutil/lfg.* rather than Mersenne Twister
> > > as such noise is good enough (sounds the same to my ears on a 1 second sample)
> > > and calculation is faster
> > 
> > Why not add that to libavutil as well?  I would like to use it for AC-3.
> 
> In that case though I think it would be nice if there was some additional information
> on the particular numbers used, and also mentioning that the last bit is always alternating
> for this kind of generator (so if possible, only the upper bits should be used).
> Believing some random guy on the internet: http://random.mat.sbg.ac.at/~charly/server/node3.html
> 2147001325*a+715136305
> at least has some statistics, I could not find any for the current numbers on a quick search.

heres a quick comparission between the 2 generators:

seed= seed*1664525+1013904223;  seed= seed*2147001325+715136305;
test:0 tp: 0 0-16777208         test:0 tp: 0 0-16777208 
test:0 tp: 1 0-4194304          test:0 tp: 1 0-4194304 
test:0 tp: 2 0-1048576          test:0 tp: 2 0-1048576 
test:0 tp: 3 0-262144           test:0 tp: 3 0-262144 
test:0 tp: 4 0-65536            test:0 tp: 4 0-65536 
test:0 tp: 5 0-32768            test:0 tp: 5 0-49152 
test:0 tp: 6 0-12288            test:0 tp: 6 0-12288 
test:0 tp: 7 0-6144             test:0 tp: 7 0-7168 
test:0 tp: 8 0-3072             test:0 tp: 8 0-3584 
test:0 tp: 9 384-1792           test:0 tp: 9 256-2240 
test:0 tp:10 704-1408           test:0 tp:10 656-1424 
test:0 tp:11 880-1168           test:0 tp:11 916-1140 
test:0 tp:12 930-1122           test:0 tp:12 971-1076 
test:0 tp:13 905-1147           test:0 tp:13 898-1165 
test:0 tp:14 889-1167           test:0 tp:14 889-1166 
test:0 tp:15 891-1159           test:0 tp:15 890-1164 
test:1 tp: 0 0-33554432         test:1 tp: 0 0-33554432 
test:1 tp: 1 0-16777216         test:1 tp: 1 0-16777216 
test:1 tp: 2 0-8388608          test:1 tp: 2 0-8388608 
test:1 tp: 3 0-4194304          test:1 tp: 3 0-4194304 
test:1 tp: 4 0-2097152          test:1 tp: 4 0-2097152 
test:1 tp: 5 0-1048576          test:1 tp: 5 0-1048576 
test:1 tp: 6 0-524288           test:1 tp: 6 0-1048576 
test:1 tp: 7 0-262144           test:1 tp: 7 0-262144 
test:1 tp: 8 0-262144           test:1 tp: 8 0-262144 
test:1 tp: 9 0-131072           test:1 tp: 9 0-131072 
test:1 tp:10 0-65536            test:1 tp:10 0-65536 
test:1 tp:11 0-32768            test:1 tp:11 0-49152 
test:1 tp:12 0-24576            test:1 tp:12 0-32768 
test:1 tp:13 0-16384            test:1 tp:13 0-24576 
test:1 tp:14 0-10240            test:1 tp:14 0-10240 
test:1 tp:15 0-8192             test:1 tp:15 0-7168 
test:1 tp:16 0-5120             test:1 tp:16 0-5120 
test:1 tp:17 0-3584             test:1 tp:17 0-4096 
test:1 tp:18 0-2560             test:1 tp:18 0-3456 
test:1 tp:19 256-2112           test:1 tp:19 192-2304 
test:1 tp:20 416-1792           test:1 tp:20 352-1856 
test:1 tp:21 624-1552           test:1 tp:21 576-1552 
test:1 tp:22 744-1368           test:1 tp:22 688-1376 
test:1 tp:23 796-1276           test:1 tp:23 780-1244 
test:1 tp:24 822-1232           test:1 tp:24 866-1202 
test:1 tp:25 889-1176           test:1 tp:25 911-1137 
test:1 tp:26 864-1173           test:1 tp:26 902-1141 
test:1 tp:27 891-1170           test:1 tp:27 894-1155 
test:1 tp:28 891-1156           test:1 tp:28 897-1155 
test:1 tp:29 898-1181           test:1 tp:29 883-1160 
test:1 tp:30 897-1167           test:1 tp:30 897-1178 
test:1 tp:31 900-1177           test:1 tp:31 896-1164 
test:2 tp: 0 1024-1024          test:2 tp: 0 1024-1024 
test:2 tp: 1 1024-1024          test:2 tp: 1 1024-1024 
test:2 tp: 2 1024-1024          test:2 tp: 2 1024-1024 
test:2 tp: 3 1024-1024          test:2 tp: 3 1024-1024 
test:2 tp: 4 1024-1024          test:2 tp: 4 1024-1024 
test:2 tp: 5 1024-1024          test:2 tp: 5 1024-1024 
test:2 tp: 6 1024-1024          test:2 tp: 6 1024-1024 
test:2 tp: 7 1024-1024          test:2 tp: 7 1024-1024 
test:2 tp: 8 1024-1024          test:2 tp: 8 1024-1024 
test:2 tp: 9 1024-1024          test:2 tp: 9 1024-1024 
test:2 tp:10 1024-1024          test:2 tp:10 1024-1024 
test:2 tp:11 906-1142           test:2 tp:11 928-1120 
test:2 tp:12 894-1135           test:2 tp:12 891-1142 
test:2 tp:13 900-1170           test:2 tp:13 899-1157 
test:2 tp:14 881-1159           test:2 tp:14 900-1165 
test:2 tp:15 897-1153           test:2 tp:15 893-1179 
test:2 tp:16 877-1168           test:2 tp:16 888-1171 
test:3 tp: 0 0-33554425         test:3 tp: 0 0-33554425 
test:3 tp: 1 0-16777213         test:3 tp: 1 0-16777213 
test:3 tp: 2 0-8388607          test:3 tp: 2 0-8388607 
test:3 tp: 3 0-4194304          test:3 tp: 3 0-4194304 
test:3 tp: 4 0-2097152          test:3 tp: 4 0-2097152 
test:3 tp: 5 0-1048576          test:3 tp: 5 0-1048576 
test:3 tp: 6 0-524288           test:3 tp: 6 0-524288 
test:3 tp: 7 0-262144           test:3 tp: 7 0-262144 
test:3 tp: 8 0-131072           test:3 tp: 8 0-131072 
test:3 tp: 9 0-131072           test:3 tp: 9 0-131072 
test:3 tp:10 0-65536            test:3 tp:10 0-65536 
test:3 tp:11 0-32768            test:3 tp:11 0-32768 
test:3 tp:12 0-24576            test:3 tp:12 0-24576 
test:3 tp:13 0-16384            test:3 tp:13 0-20480 
test:3 tp:14 0-12288            test:3 tp:14 0-10240 
test:3 tp:15 0-9216             test:3 tp:15 0-6144 
test:3 tp:16 0-4608             test:3 tp:16 0-4608 
test:3 tp:17 0-3328             test:3 tp:17 0-3840 
test:3 tp:18 0-2560             test:3 tp:18 0-2560 
test:3 tp:19 192-2240           test:3 tp:19 128-2176 
test:3 tp:20 384-1888           test:3 tp:20 352-1792 
test:3 tp:21 560-1584           test:3 tp:21 624-1504 
test:3 tp:22 656-1400           test:3 tp:22 696-1336 
test:3 tp:23 756-1296           test:3 tp:23 828-1252 
test:3 tp:24 806-1272           test:3 tp:24 888-1178 
test:3 tp:25 934-1134           test:3 tp:25 929-1124 
test:3 tp:26 914-1138           test:3 tp:26 914-1133 
test:3 tp:27 897-1152           test:3 tp:27 906-1159 
test:3 tp:28 883-1175           test:3 tp:28 902-1160 
test:3 tp:29 864-1160           test:3 tp:29 897-1160 
test:3 tp:30 898-1200           test:3 tp:30 895-1157 
test:3 tp:31 884-1196           test:3 tp:31 890-1155 

tests done with: (only partial source as the whole IS a mess and iam not
interrested in cleaning it up ATM)
    int gr8[8]=   {0,1,4,9,15,22,32,34};
    int gr16[16]= {0,1,4,11,26,32,56,68,76,115,117,134,150,163,168,177};

    for(test=0; test<4; test++){
      for(tp=0; tp<32; tp++){
        unsigned int max= 0;
        unsigned int min= -1;
        memset(matrix, 0, sizeof(matrix));
        for(i=0; i<LEN; i++){
            unsigned int r=get_r();
            hist[i&0xFFFF]= r;
            if(test==0){
                int h=0;
                if(tp >= BITOUT/2)
                    goto next_test;
                for(j=0; j<8; j++)
                    h+= ((hist[(i-gr8[j])&0xFFFF]>>(tp*2))&3)<<(2*j);
                matrix[h]++;
            }else if(test==1){
                int h=0;
                if(tp >= BITOUT)
                    goto next_test;
                for(j=0; j<16; j++)
                    h+= ((hist[(i-gr16[j])&0xFFFF]>>tp)&1)<<j;
                matrix[h]++;
            }else if(test==2){
                if(tp+16 > BITOUT)
                    goto next_test;
                matrix[(r>>tp)&0xFFFF]++;
            }else if(test==3){
                static int h;
                if(tp >= BITOUT)
                    goto next_test;
                h= 2*h + ((r>>tp)&1);
                matrix[h&0xFFFF]++;
            }
        }
        for(i=0; i<256*256; i++){
            unsigned int v= matrix[i];
            if(v>max) max=v;
            if(v<min) min=v;
        }
        printf("test:%d tp:%2d %d-%d add:%d\n", test, tp, min, max, add);
next_test:;


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- 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-soc/attachments/20080807/4a101cb1/attachment.pgp>


More information about the FFmpeg-soc mailing list