Exemple #1
0
        // Analysis side code, but directly related to blocking.  Thus it's
        // here and not in analysis.c (which is for analysis transforms only).
        // The init is here because some of it is shared

        int init(Info vi, bool encp)
        {
            //memset(v,0,sizeof(vorbis_dsp_state));
            this.vi=vi;
            modebits=ilog2(vi.modes);

            transform[0]=new Object[VI_TRANSFORMB];
            transform[1]=new Object[VI_TRANSFORMB];

            // MDCT is tranform 0

            transform[0][0]=new Mdct();
            transform[1][0]=new Mdct();
            ((Mdct)transform[0][0]).init(vi.blocksizes[0]);
            ((Mdct)transform[1][0]).init(vi.blocksizes[1]);

            wnd[0][0][0]=new float[VI_WINDOWB][];
            wnd[0][0][1]=wnd[0][0][0];
            wnd[0][1][0]=wnd[0][0][0];
            wnd[0][1][1]=wnd[0][0][0];
            wnd[1][0][0]=new float[VI_WINDOWB][];
            wnd[1][0][1]=new float[VI_WINDOWB][];
            wnd[1][1][0]=new float[VI_WINDOWB][];
            wnd[1][1][1]=new float[VI_WINDOWB][];

            for(int i=0; i<VI_WINDOWB; i++) {
                wnd[0][0][0][i]=
                    window(i,vi.blocksizes[0],vi.blocksizes[0]/2,vi.blocksizes[0]/2);
                wnd[1][0][0][i]=
                    window(i,vi.blocksizes[1],vi.blocksizes[0]/2,vi.blocksizes[0]/2);
                wnd[1][0][1][i]=
                    window(i,vi.blocksizes[1],vi.blocksizes[0]/2,vi.blocksizes[1]/2);
                wnd[1][1][0][i]=
                    window(i,vi.blocksizes[1],vi.blocksizes[1]/2,vi.blocksizes[0]/2);
                wnd[1][1][1][i]=
                    window(i,vi.blocksizes[1],vi.blocksizes[1]/2,vi.blocksizes[1]/2);
            }

            //    if(encp){ // encode/decode differ here
            //      // finish the codebooks
            //      fullbooks=new CodeBook[vi.books];
            //      for(int i=0;i<vi.books;i++){
            //	fullbooks[i]=new CodeBook();
            //	fullbooks[i].init_encode(vi.book_param[i]);
            //      }
            //      analysisp=1;
            //    }
            //    else{
            // finish the codebooks
            fullbooks=new CodeBook[vi.books];
            for(int i=0; i<vi.books; i++) {
                fullbooks[i]=new CodeBook();
                fullbooks[i].init_decode(vi.book_param[i]);
            }

            //    }

            // initialize the storage vectors to a decent size greater than the
            // minimum

            pcm_storage=8192; // we'll assume later that we have
            // a minimum of twice the blocksize of
            // accumulated samples in analysis
            pcm=new float[vi.channels][];
            //pcmret=new float[vi.channels][];
            {
                for(int i=0; i<vi.channels; i++) {
                    pcm[i]=new float[pcm_storage];
                }
            }

            // all 1 (large block) or 0 (small block)
            // explicitly set for the sake of clarity
            lW=0; // previous window size
            W=0;  // current window size

            // all vector indexes; multiples of samples_per_envelope_step
            centerW=vi.blocksizes[1]/2;

            pcm_current=centerW;

            // initialize all the mapping/backend lookups
            mode=new Object[vi.modes];

            for(int i=0; i<vi.modes; i++) {
                int mapnum=vi.mode_param[i].mapping;
                int maptype=vi.map_type[mapnum];

                mode[i]=FuncMapping.mapping_P[maptype].look(this,vi.mode_param[i],
                        vi.map_param[mapnum]);

            }
            return(0);
        }
Exemple #2
0
        // Analysis side code, but directly related to blocking.  Thus it's
        // here and not in analysis.c (which is for analysis transforms only).
        // The init is here because some of it is shared
        int init(Info vi, bool encp)
        {
            //memset(v,0,sizeof(vorbis_dsp_state));
            this.vi=vi;
            modebits=ilog2(vi.modes);

            transform[0]=new Object[VI_TRANSFORMB];
            transform[1]=new Object[VI_TRANSFORMB];

            // MDCT is tranform 0

            transform[0][0]=new Mdct();
            transform[1][0]=new Mdct();
            ((Mdct)transform[0][0]).init(vi.blocksizes[0]);
            ((Mdct)transform[1][0]).init(vi.blocksizes[1]);

            wnd[0][0][0]=new float[VI_WINDOWB][];
            wnd[0][0][1]=wnd[0][0][0];
            wnd[0][1][0]=wnd[0][0][0];
            wnd[0][1][1]=wnd[0][0][0];
            wnd[1][0][0]=new float[VI_WINDOWB][];
            wnd[1][0][1]=new float[VI_WINDOWB][];
            wnd[1][1][0]=new float[VI_WINDOWB][];
            wnd[1][1][1]=new float[VI_WINDOWB][];

            for(int i=0; i<VI_WINDOWB; i++) {
                wnd[0][0][0][i]=
                    window(i,vi.blocksizes[0],vi.blocksizes[0]/2,vi.blocksizes[0]/2);
                wnd[1][0][0][i]=
                    window(i,vi.blocksizes[1],vi.blocksizes[0]/2,vi.blocksizes[0]/2);
                wnd[1][0][1][i]=
                    window(i,vi.blocksizes[1],vi.blocksizes[0]/2,vi.blocksizes[1]/2);
                wnd[1][1][0][i]=
                    window(i,vi.blocksizes[1],vi.blocksizes[1]/2,vi.blocksizes[0]/2);
                wnd[1][1][1][i]=
                    window(i,vi.blocksizes[1],vi.blocksizes[1]/2,vi.blocksizes[1]/2);
            }

            //    if(encp){ // encode/decode differ here
            //      // finish the codebooks
            //      fullbooks=new CodeBook[vi.books];
            //      for(int i=0;i<vi.books;i++){
            //	fullbooks[i]=new CodeBook();
            //	fullbooks[i].init_encode(vi.book_param[i]);
            //      }
            //      analysisp=1;
            //    }
            //    else{
            // finish the codebooks
            fullbooks=new CodeBook[vi.books];
            for(int i=0; i<vi.books; i++) {
                fullbooks[i]=new CodeBook();
                fullbooks[i].init_decode(vi.book_param[i]);
            }

            //    }

            // initialize the storage vectors to a decent size greater than the
            // minimum

            pcm_storage=8192; // we'll assume later that we have
            // a minimum of twice the blocksize of
            // accumulated samples in analysis
            pcm=new float[vi.channels][];
            //pcmret=new float[vi.channels][];
            {
                for(int i=0; i<vi.channels; i++) {
                    pcm[i]=new float[pcm_storage];
                }
            }

            // all 1 (large block) or 0 (small block)
            // explicitly set for the sake of clarity
            lW=0; // previous window size
            W=0;  // current window size

            // all vector indexes; multiples of samples_per_envelope_step
            centerW=vi.blocksizes[1]/2;

            pcm_current=centerW;

            // initialize all the mapping/backend lookups
            mode=new Object[vi.modes];

            for(int i=0; i<vi.modes; i++) {
                int mapnum=vi.mode_param[i].mapping;
                int maptype=vi.map_type[mapnum];

                mode[i]=FuncMapping.mapping_P[maptype].look(this,vi.mode_param[i],
                        vi.map_param[mapnum]);

            }
            return(0);
        }