src/main/java/org/jcodec/codecs/mpa/Mp3Bitstream.java
static MP3SideInfo readSideInfo(MpaHeader header, ByteBuffer src, int channels) {
        MP3SideInfo si = new MP3SideInfo();
        BitReader stream = BitReader.createBitReader(src);
        if (header.version == MPEG1) {

            si.mainDataBegin = stream.readNBit(9);
            if (channels == 1)
                si.privateBits = stream.readNBit(5);
            else
                si.privateBits = stream.readNBit(3);

            for (int ch = 0; ch < channels; ch++) {
                si.scfsi[ch][0] = stream.read1Bit() == 0;
                si.scfsi[ch][1] = stream.read1Bit() == 0;
                si.scfsi[ch][2] = stream.read1Bit() == 0;
                si.scfsi[ch][3] = stream.read1Bit() == 0;
            }

            for (int gr = 0; gr < 2; gr++) {
                for (int ch = 0; ch < channels; ch++) {
                    Granule granule = si.granule[ch][gr];
                    granule.part23Length = stream.readNBit(12);
                    granule.bigValues = stream.readNBit(9);
                    granule.globalGain = stream.readNBit(8);
                    granule.scalefacCompress = stream.readNBit(4);
                    granule.windowSwitchingFlag = stream.readNBit(1) != 0;
                    if (granule.windowSwitchingFlag) {
                        granule.blockType = stream.readNBit(2);
                        granule.mixedBlockFlag = stream.readNBit(1) != 0;

                        granule.tableSelect[0] = stream.readNBit(5);
                        granule.tableSelect[1] = stream.readNBit(5);

                        granule.subblockGain[0] = stream.readNBit(3);
                        granule.subblockGain[1] = stream.readNBit(3);
                        granule.subblockGain[2] = stream.readNBit(3);

                        if (granule.blockType == 0) {
                            return null;
                        } else if (granule.blockType == 2 && !granule.mixedBlockFlag) {
                            granule.region0Count = 8;
                        } else {
                            granule.region0Count = 7;
                        }
                        granule.region1Count = 20 - granule.region0Count;
                    } else {
                        granule.tableSelect[0] = stream.readNBit(5);
                        granule.tableSelect[1] = stream.readNBit(5);
                        granule.tableSelect[2] = stream.readNBit(5);
                        granule.region0Count = stream.readNBit(4);
                        granule.region1Count = stream.readNBit(3);
                        granule.blockType = 0;
                    }
                    granule.preflag = stream.readNBit(1) != 0;
                    granule.scalefacScale = stream.readNBit(1);
                    granule.count1tableSelect = stream.readNBit(1);
                }
            }

        } else {
            si.mainDataBegin = stream.readNBit(8);
            if (channels == 1)
                si.privateBits = stream.readNBit(1);
            else
                si.privateBits = stream.readNBit(2);

            for (int ch = 0; ch < channels; ch++) {
                Granule granule = si.granule[ch][0];
                granule.part23Length = stream.readNBit(12);
                granule.bigValues = stream.readNBit(9);
                granule.globalGain = stream.readNBit(8);
                granule.scalefacCompress = stream.readNBit(9);
                granule.windowSwitchingFlag = stream.readNBit(1) != 0;

                if (granule.windowSwitchingFlag) {

                    granule.blockType = stream.readNBit(2);
                    granule.mixedBlockFlag = stream.readNBit(1) != 0;
                    granule.tableSelect[0] = stream.readNBit(5);
                    granule.tableSelect[1] = stream.readNBit(5);

                    granule.subblockGain[0] = stream.readNBit(3);
                    granule.subblockGain[1] = stream.readNBit(3);
                    granule.subblockGain[2] = stream.readNBit(3);

                    if (granule.blockType == 0) {
                        return null;
                    } else if (granule.blockType == 2 && !granule.mixedBlockFlag) {
                        granule.region0Count = 8;
                    } else {
                        granule.region0Count = 7;
                        granule.region1Count = 20 - granule.region0Count;
                    }

                } else {
                    granule.tableSelect[0] = stream.readNBit(5);
                    granule.tableSelect[1] = stream.readNBit(5);
                    granule.tableSelect[2] = stream.readNBit(5);
                    granule.region0Count = stream.readNBit(4);
                    granule.region1Count = stream.readNBit(3);
                    granule.blockType = 0;
                }

                granule.scalefacScale = stream.readNBit(1);
                granule.count1tableSelect = stream.readNBit(1);
            }
        }
        stream.terminate();
        return si;
    }
static MP3SideInfo readSideInfo(MpaHeader header, ByteBuffer src, int channels) {
        MP3SideInfo si = new MP3SideInfo();
        BitReader stream = BitReader.createBitReader(src);
        if (header.version == MPEG1) {

            si.mainDataBegin = stream.readNBit(9);
            if (channels == 1)
                si.privateBits = stream.readNBit(5);
            else
                si.privateBits = stream.readNBit(3);

            for (int ch = 0; ch < channels; ch++) {
                si.scfsi[ch][0] = stream.read1Bit() == 0;
                si.scfsi[ch][1] = stream.read1Bit() == 0;
                si.scfsi[ch][2] = stream.read1Bit() == 0;
                si.scfsi[ch][3] = stream.read1Bit() == 0;
            }

            for (int gr = 0; gr < 2; gr++) {
                for (int ch = 0; ch < channels; ch++) {
                    Granule granule = si.granule[ch][gr];
                    granule.part23Length = stream.readNBit(12);
                    granule.bigValues = stream.readNBit(9);
                    granule.globalGain = stream.readNBit(8);
                    granule.scalefacCompress = stream.readNBit(4);
                    granule.windowSwitchingFlag = stream.readNBit(1) != 0;
                    if (granule.windowSwitchingFlag) {
                        granule.blockType = stream.readNBit(2);
                        granule.mixedBlockFlag = stream.readNBit(1) != 0;

                        granule.tableSelect[0] = stream.readNBit(5);
                        granule.tableSelect[1] = stream.readNBit(5);

                        granule.subblockGain[0] = stream.readNBit(3);
                        granule.subblockGain[1] = stream.readNBit(3);
                        granule.subblockGain[2] = stream.readNBit(3);

                        if (granule.blockType == 0) {
                            return null;
                        } else if (granule.blockType == 2 && !granule.mixedBlockFlag) {
                            granule.region0Count = 8;
                        } else {
                            granule.region0Count = 7;
                        }
                        granule.region1Count = 20 - granule.region0Count;
                    } else {
                        granule.tableSelect[0] = stream.readNBit(5);
                        granule.tableSelect[1] = stream.readNBit(5);
                        granule.tableSelect[2] = stream.readNBit(5);
                        granule.region0Count = stream.readNBit(4);
                        granule.region1Count = stream.readNBit(3);
                        granule.blockType = 0;
                    }
                    granule.preflag = stream.readNBit(1) != 0;
                    granule.scalefacScale = stream.readNBit(1);
                    granule.count1tableSelect = stream.readNBit(1);
                }
            }

        } else {
            si.mainDataBegin = stream.readNBit(8);
            if (channels == 1)
                si.privateBits = stream.readNBit(1);
            else
                si.privateBits = stream.readNBit(2);

            for (int ch = 0; ch < channels; ch++) {
                Granule granule = si.granule[ch][0];
                granule.part23Length = stream.readNBit(12);
                granule.bigValues = stream.readNBit(9);
                granule.globalGain = stream.readNBit(8);
                granule.scalefacCompress = stream.readNBit(9);
                granule.windowSwitchingFlag = stream.readNBit(1) != 0;

                if (granule.windowSwitchingFlag) {

                    granule.blockType = stream.readNBit(2);
                    granule.mixedBlockFlag = stream.readNBit(1) != 0;
                    granule.tableSelect[0] = stream.readNBit(5);
                    granule.tableSelect[1] = stream.readNBit(5);

                    granule.subblockGain[0] = stream.readNBit(3);
                    granule.subblockGain[1] = stream.readNBit(3);
                    granule.subblockGain[2] = stream.readNBit(3);

                    if (granule.blockType == 0) {
                        return null;
                    } else if (granule.blockType == 2 && !granule.mixedBlockFlag) {
                        granule.region0Count = 8;
                    } else {
                        granule.region0Count = 7;
                        granule.region1Count = 20 - granule.region0Count;
                    }

                } else {
                    granule.tableSelect[0] = stream.readNBit(5);
                    granule.tableSelect[1] = stream.readNBit(5);
                    granule.tableSelect[2] = stream.readNBit(5);
                    granule.region0Count = stream.readNBit(4);
                    granule.region1Count = stream.readNBit(3);
                    granule.blockType = 0;
                }

                granule.scalefacScale = stream.readNBit(1);
                granule.count1tableSelect = stream.readNBit(1);
            }
        }
        stream.terminate();
        return si;
    }
static MP3SideInfo readSideInfo ( MpaHeader header , ByteBuffer src , int channels ) { MP3SideInfo si = new MP3SideInfo ( ) ; BitReader stream = BitReader . createBitReader ( src ) ; if ( header . version == MPEG1 ) { si . mainDataBegin = stream . readNBit ( 9 ) ; if ( channels == 1 ) si . privateBits = stream . readNBit ( 5 ) ; else si . privateBits = stream . readNBit ( 3 ) ; for ( int ch = 0 ; ch < channels ; ch ++ ) { si . scfsi [ ch ] [ 0 ] = stream . read1Bit ( ) == 0 ; si . scfsi [ ch ] [ 1 ] = stream . read1Bit ( ) == 0 ; si . scfsi [ ch ] [ 2 ] = stream . read1Bit ( ) == 0 ; si . scfsi [ ch ] [ 3 ] = stream . read1Bit ( ) == 0 ; } for ( int gr = 0 ; gr < 2 ; gr ++ ) { for ( int ch = 0 ; ch < channels ; ch ++ ) { Granule granule = si . granule [ ch ] [ gr ] ; granule . part23Length = stream . readNBit ( 12 ) ; granule . bigValues = stream . readNBit ( 9 ) ; granule . globalGain = stream . readNBit ( 8 ) ; granule . scalefacCompress = stream . readNBit ( 4 ) ; granule . windowSwitchingFlag = stream . readNBit ( 1 ) != 0 ; if ( granule . windowSwitchingFlag ) { granule . blockType = stream . readNBit ( 2 ) ; granule . mixedBlockFlag = stream . readNBit ( 1 ) != 0 ; granule . tableSelect [ 0 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 1 ] = stream . readNBit ( 5 ) ; granule . subblockGain [ 0 ] = stream . readNBit ( 3 ) ; granule . subblockGain [ 1 ] = stream . readNBit ( 3 ) ; granule . subblockGain [ 2 ] = stream . readNBit ( 3 ) ; if ( granule . blockType == 0 ) { return null ; } else if ( granule . blockType == 2 && ! granule . mixedBlockFlag ) { granule . region0Count = 8 ; } else { granule . region0Count = 7 ; } granule . region1Count = 20 - granule . region0Count ; } else { granule . tableSelect [ 0 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 1 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 2 ] = stream . readNBit ( 5 ) ; granule . region0Count = stream . readNBit ( 4 ) ; granule . region1Count = stream . readNBit ( 3 ) ; granule . blockType = 0 ; } granule . preflag = stream . readNBit ( 1 ) != 0 ; granule . scalefacScale = stream . readNBit ( 1 ) ; granule . count1tableSelect = stream . readNBit ( 1 ) ; } } } else { si . mainDataBegin = stream . readNBit ( 8 ) ; if ( channels == 1 ) si . privateBits = stream . readNBit ( 1 ) ; else si . privateBits = stream . readNBit ( 2 ) ; for ( int ch = 0 ; ch < channels ; ch ++ ) { Granule granule = si . granule [ ch ] [ 0 ] ; granule . part23Length = stream . readNBit ( 12 ) ; granule . bigValues = stream . readNBit ( 9 ) ; granule . globalGain = stream . readNBit ( 8 ) ; granule . scalefacCompress = stream . readNBit ( 9 ) ; granule . windowSwitchingFlag = stream . readNBit ( 1 ) != 0 ; if ( granule . windowSwitchingFlag ) { granule . blockType = stream . readNBit ( 2 ) ; granule . mixedBlockFlag = stream . readNBit ( 1 ) != 0 ; granule . tableSelect [ 0 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 1 ] = stream . readNBit ( 5 ) ; granule . subblockGain [ 0 ] = stream . readNBit ( 3 ) ; granule . subblockGain [ 1 ] = stream . readNBit ( 3 ) ; granule . subblockGain [ 2 ] = stream . readNBit ( 3 ) ; if ( granule . blockType == 0 ) { return null ; } else if ( granule . blockType == 2 && ! granule . mixedBlockFlag ) { granule . region0Count = 8 ; } else { granule . region0Count = 7 ; granule . region1Count = 20 - granule . region0Count ; } } else { granule . tableSelect [ 0 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 1 ] = stream . readNBit ( 5 ) ; granule . tableSelect [ 2 ] = stream . readNBit ( 5 ) ; granule . region0Count = stream . readNBit ( 4 ) ; granule . region1Count = stream . readNBit ( 3 ) ; granule . blockType = 0 ; } granule . scalefacScale = stream . readNBit ( 1 ) ; granule . count1tableSelect = stream . readNBit ( 1 ) ; } } stream . terminate ( ) ; return si ; }
Wrong usage of Javascript keyword:in
Wrong usage of Javascript keyword : in