Logo Search packages:      
Sourcecode: libjlayer-java version File versions  Download package

boolean javazoom::jl::decoder::LayerIIIDecoder::get_side_info (  )  [inline, private]

Reads the side info from the stream, assuming the entire. frame has been read already. Mono : 136 bits (= 17 bytes) Stereo : 256 bits (= 32 bytes)

Definition at line 355 of file LayerIIIDecoder.java.

References javazoom::jl::decoder::Bitstream::get_bits(), and javazoom::jl::decoder::Header::version().

      {
            int ch, gr;
            if (header.version() == Header.MPEG1)
            {

                  si.main_data_begin = stream.get_bits(9);
                  if (channels == 1)
                        si.private_bits = stream.get_bits(5);
                  else si.private_bits = stream.get_bits(3);

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

                  for (gr=0; gr<2; gr++) {
                        for (ch=0; ch<channels; ch++) {
                              si.ch[ch].gr[gr].part2_3_length = stream.get_bits(12);
                              si.ch[ch].gr[gr].big_values = stream.get_bits(9);
                              si.ch[ch].gr[gr].global_gain = stream.get_bits(8);
                              si.ch[ch].gr[gr].scalefac_compress = stream.get_bits(4);
                              si.ch[ch].gr[gr].window_switching_flag = stream.get_bits(1);
                              if ((si.ch[ch].gr[gr].window_switching_flag) != 0) {
                                    si.ch[ch].gr[gr].block_type       = stream.get_bits(2);
                                    si.ch[ch].gr[gr].mixed_block_flag = stream.get_bits(1);

                                    si.ch[ch].gr[gr].table_select[0]  = stream.get_bits(5);
                                    si.ch[ch].gr[gr].table_select[1]  = stream.get_bits(5);

                                    si.ch[ch].gr[gr].subblock_gain[0] = stream.get_bits(3);
                                    si.ch[ch].gr[gr].subblock_gain[1] = stream.get_bits(3);
                                    si.ch[ch].gr[gr].subblock_gain[2] = stream.get_bits(3);

                                    // Set region_count parameters since they are implicit in this case.

                                    if (si.ch[ch].gr[gr].block_type == 0) {
                                          //     Side info bad: block_type == 0 in split block
                                          return false;
                                    } else if (si.ch[ch].gr[gr].block_type == 2
                                                        && si.ch[ch].gr[gr].mixed_block_flag == 0) {
                                          si.ch[ch].gr[gr].region0_count = 8;
                     } else {
                           si.ch[ch].gr[gr].region0_count = 7;
                     }
                                    si.ch[ch].gr[gr].region1_count = 20 -
                                                si.ch[ch].gr[gr].region0_count;
                              } else {
                                    si.ch[ch].gr[gr].table_select[0] = stream.get_bits(5);
                                    si.ch[ch].gr[gr].table_select[1] = stream.get_bits(5);
                                    si.ch[ch].gr[gr].table_select[2] = stream.get_bits(5);
                                    si.ch[ch].gr[gr].region0_count = stream.get_bits(4);
                                    si.ch[ch].gr[gr].region1_count = stream.get_bits(3);
                                    si.ch[ch].gr[gr].block_type = 0;
                              }
                              si.ch[ch].gr[gr].preflag = stream.get_bits(1);
                              si.ch[ch].gr[gr].scalefac_scale = stream.get_bits(1);
                              si.ch[ch].gr[gr].count1table_select = stream.get_bits(1);
               }
            }

            } else {    // MPEG-2 LSF, SZD: MPEG-2.5 LSF

            si.main_data_begin = stream.get_bits(8);
            if (channels == 1)
                  si.private_bits = stream.get_bits(1);
            else si.private_bits = stream.get_bits(2);

            for (ch=0; ch<channels; ch++) {

                si.ch[ch].gr[0].part2_3_length = stream.get_bits(12);
                si.ch[ch].gr[0].big_values = stream.get_bits(9);
                si.ch[ch].gr[0].global_gain = stream.get_bits(8);
                si.ch[ch].gr[0].scalefac_compress = stream.get_bits(9);
                si.ch[ch].gr[0].window_switching_flag = stream.get_bits(1);

                if ((si.ch[ch].gr[0].window_switching_flag) != 0) {

                   si.ch[ch].gr[0].block_type = stream.get_bits(2);
                   si.ch[ch].gr[0].mixed_block_flag = stream.get_bits(1);
                   si.ch[ch].gr[0].table_select[0] = stream.get_bits(5);
                   si.ch[ch].gr[0].table_select[1] = stream.get_bits(5);

                   si.ch[ch].gr[0].subblock_gain[0] = stream.get_bits(3);
                   si.ch[ch].gr[0].subblock_gain[1] = stream.get_bits(3);
                   si.ch[ch].gr[0].subblock_gain[2] = stream.get_bits(3);

                  // Set region_count parameters since they are implicit in this case.

                   if (si.ch[ch].gr[0].block_type == 0) {
                      // Side info bad: block_type == 0 in split block
                      return false;
                   } else if (si.ch[ch].gr[0].block_type == 2
                            && si.ch[ch].gr[0].mixed_block_flag == 0) {
                         si.ch[ch].gr[0].region0_count = 8;
                               } else {
                         si.ch[ch].gr[0].region0_count = 7;
                      si.ch[ch].gr[0].region1_count = 20 -
                                                                                    si.ch[ch].gr[0].region0_count;
                   }

                } else {
                   si.ch[ch].gr[0].table_select[0] = stream.get_bits(5);
                   si.ch[ch].gr[0].table_select[1] = stream.get_bits(5);
                   si.ch[ch].gr[0].table_select[2] = stream.get_bits(5);
                   si.ch[ch].gr[0].region0_count = stream.get_bits(4);
                   si.ch[ch].gr[0].region1_count = stream.get_bits(3);
                   si.ch[ch].gr[0].block_type = 0;
                }

                si.ch[ch].gr[0].scalefac_scale = stream.get_bits(1);
                si.ch[ch].gr[0].count1table_select = stream.get_bits(1);
            }   // for(ch=0; ch<channels; ch++)
         } // if (header.version() == MPEG1)
        return true;
      }


Generated by  Doxygen 1.6.0   Back to index