Patent Document

CROSS-REFERENCE TO RELATED APPLICATIONS  
       [0001]     This application claims priority from Japanese Patent Application No. JP 2006-086927 filed in the Japan Patent Office on Mar. 28, 2006, the entire content of which is incorporated herein by reference.  
       BACKGROUND OF THE INVENTION  
       [0002]     1. Field of the Invention  
         [0003]     The present invention is for example applicable to cases where audio signals are encoded by Layer  1  and Layer  2  of MPEG (Moving Picture Experts Group)  1  and MPEG 2 . The present invention reduces the load of processing as compared with a example in the past when an audio signal is encoded on the basis of psychoacoustic analysis, by sorting evaluation criteria for bit allocation in advance, detecting a subband signal to which to allocate bits, and when sorting a recalculated evaluation criterion, partly changing the sequence of a latest sort result, thereby sorting the evaluation criterion.  
         [0004]     2. Description of the Related Art  
         [0005]     In the past, perceptual coding is known as an audio signal encoding process. Perceptual coding is referred to also as psychoacoustic coding. Perceptual coding encodes an audio signal while not allocating bits to a component difficult to perceive on the basis of a minimum audible limit and a masking effect, and thus efficiently encodes the audio signal using characteristics of a human auditory sense. Layer  1  and Layer  2  of MPEG 1  and MPEG 2  are widely known as an encoding method using the technology of perceptual coding.  
         [0006]      FIG. 16  is a block diagram showing an encoder for encoding an audio signal S 1 . This encoder  1  is formed by a digital signal processor, for example. The encoder  1  encodes the audio signal S 1  by Layer  1  or Layer  2  of MPEG 1  or Layer  1  or Layer  2  of MPEG 2 , and then outputs a bit stream S 2 . The audio signal S 1  is an audio signal of a plurality of channels, and is for example linearly quantized 16-bit PCM (Pulse Code Modulation) data or linearly quantized 24-bit PCM data.  
         [0007]     A subband analyzing filter bank  2  in the encoder  1  is formed by a polyphase filter bank, for example. The subband analyzing filter bank  2  divides the overall frequency band of the audio signal S 1  into 32 frequency bands (subbands), subsamples signals in the respective bands, and then outputs subband signals. Incidentally, in Layer  1 , 384 samples of the audio signal S 1  are set and processed in one frame, whereas in Layer  2 , 1152 samples of the audio signal S 1  are set and processed in one frame.  
         [0008]     A linear quantizer  3  quantizes the subband signals output from the subband analyzing filter bank  2  under control of a dynamic bit allocation unit  4 , and then outputs the quantized subband signals. A bit compressing unit  11  bit-compresses the output data of the linear quantizer  3 , and then outputs the bit-compressed data. A bit stream forming unit  5  adds output data of a side information coding unit  10 , CRC (Cyclic Redundancy Check) code, and the like to the output data of the bit compressing unit  11 , and then outputs a bit stream S 2 .  
         [0009]     A scale factor extracting unit  6  detects a scale factor for each subband signal output from the subband analyzing filter bank  2 . The scale factor is a coefficient indicating a maximum value of amplitude of each subband signal. In Layer  1 , the scale factor extracting unit  6  sets 12 samples of each subband signal as one block, and detects a maximum value from absolute values of respective sample values of the subband signal for each block. In addition, the scale factor extracting unit  6  selects scale factors indicating amplitude values higher than the detected maximum value, and selects a scale factor indicating a minimum amplitude value from the selected scale factors.  
         [0010]     In Layer  2 , on the other hand, as in Layer  1 , 12 samples are set as one block, and a scale factor is detected for each block. In addition, differences between the detected scale factors of successive blocks are detected, a successive pattern of the differences is represented by a transmission pattern of one to three bits, and the transmission pattern is output together with scale factor selection information  7 . In Layer  2 , the scale factor selection information  7  and the transmission pattern of one to three bits are transmitted as the scale factor of each block.  
         [0011]     A fast Fourier transform (FFT) unit  8  subjects the audio signal S 1  in units of 512 samples in Layer  1  and in units of 1024 samples in Layer  2  to a fast Fourier transform process.  
         [0012]     A psychoacoustic model unit  9  calculates an SMR (Signal to Mask Ratio) for each subband from a result of the process of the fast Fourier transform unit  8  and the scale factor detected by the scale factor extracting unit  6 , using a predetermined psychoacoustic model. The SMR is an evaluation value of each subband signal obtained from each subband signal to derive an evaluation criterion used for bit allocation to each subband signal. The SMR is a ratio (signal to mask ratio) between the maximum amplitude level of a subband signal and a maximum amplitude level masked by auditory or perceptual characteristics of a human (masking threshold value).  
         [0013]     The dynamic bit allocation unit  4  calculates an amount of bits allocatable for transmission of the audio signal S 1  itself, and calculates an amount of bits to be allocated to each subband from the calculated amount of bits on the basis of the SMR. In addition, the dynamic bit allocation unit  4  calculates the quantization scale of each subband signal. The dynamic bit allocation unit  4  controls the linear quantizer  3  to encode each subband signal with the calculated amount of bits to be allocated and the calculated quantization scale. Incidentally, the amount of bits allocatable for the transmission of the audio signal S 1  itself is obtained by subtracting a header, CRC code, ancillary data, and bit allocation data from a total number of useable bits.  
         [0014]     The side information coding unit  10  receives the amount of bits allocated to each subband signal, quantization scale data, scale factor data and the like as input data necessary for decoding, encodes the input data, and then outputs the result to the bit stream forming unit  5 .  
         [0015]      FIG. 17  is a flowchart representing in brief the process of the dynamic bit allocation unit  4 . The dynamic bit allocation unit  4  performs this processing procedure for each block of the audio signal S 1 .  
         [0016]     Specifically, starting this processing procedure, the dynamic bit allocation unit  4  calculates an MNR (Mask to Noise Ratio) of each subband signal from the SMR calculated in the psychoacoustic model unit  9 . The MNR is an evaluation criterion for allocating bits to each subband signal. The MNR is obtained by subtracting the SMR [dB] from an SNR (Signal to Noise Ratio) [dB]. Incidentally, the SNR is the SNR of each subband signal when quantization is performed with n bits, for example. Since no bits are allocated to each subband signal immediately after the process of  FIG. 17  is started, an initial value is applied to n.  
         [0017]     Next, the dynamic bit allocation unit  4  proceeds from step SP 1  to step SP 2 , where the dynamic bit allocation unit  4  searches the MNR of each subband signal to detect an MNR having a lowest value. In next step SP 3 , the dynamic bit allocation unit  4  calculates an amount of bits to be allocated to a subband signal having the detected MNR, and allocates the calculated amount of bits to the subband signal. In next step SP 4 , the dynamic bit allocation unit  4  determines whether allocation of all allocatable bits is completed. When a negative result is obtained in step SP 4 , the dynamic bit allocation unit  4  recalculates the MNR of the subband signal to which the bits are allocated in step SP 3 . The dynamic bit allocation unit  4  then returns to step SP 2 . When a positive result is obtained in step SP 4 , on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 4  to step SP 5  to end the processing procedure.  
         [0018]      FIG. 18  and  FIG. 19  are flowcharts representing in detail the processing procedure of  FIG. 17 . Incidentally, although the process of step SP 4  is performed after step SP 3  in  FIG. 17 ,  FIG. 17  describes the processing procedure for convenience in order to facilitate understanding. In practice, as shown in  FIG. 18  and  FIG. 19 , the processes corresponding to step SP 3  and step SP 4  are provided in order opposite to that of the example of  FIG. 17 .  
         [0019]     Specifically, starting this processing procedure, the dynamic bit allocation unit  4  calculates an MNR for each subband signal. The dynamic bit allocation unit  4  proceeds from step SP 11  to step SP 12 , where the dynamic bit allocation unit  4  initializes a total number of bits allocation of which has been completed (alloc bit total) to a value 0.  
         [0020]     Next, the dynamic bit allocation unit  4  proceeds to step SP 13 , where the dynamic bit allocation unit  4  initializes various variables. Incidentally, ch is a variable for identifying a channel of the audio signal S 1 . min ch and min sb are variables for identifying a channel and a subband signal, respectively, of an MNR having a minimum value. min mnr is the minimum value of the MNR. The dynamic bit allocation unit  4  initializes ch to a value 0, min ch and min sb to a value −1, and min mnr to a maximum value MAX of possible values.  
         [0021]     Next, the dynamic bit allocation unit  4  in step SP 14  initializes a variable sb for identifying a subband signal to a value 0. In next step SP 15 , the dynamic bit allocation unit  4  determines whether bit allocation to a subband signal (used[ch] [sb]) identified by the variable sb for the channel identified by the variable ch is not completed yet and whether the value of the MNR of the subband signal is lower than the value of the variable min mnr.  
         [0022]     Incidentally, a case where it is determined that bit allocation to the subband signal (used[ch][sb]) identified by the variable sb for the channel identified by the variable ch is not completed yet is a case where the total number of bits allocation of which has been completed (alloc bit total) exceeds a total number of allocatable bits (total bit), or a case where the number of bits allocated to the subband signal exceeds the number of bits allocatable to one subband signal. Incidentally, in a case of joint stereo, when bit allocation to the subband signal of the corresponding channel is completed, it is determined that bit allocation to the corresponding subband signal is completed.  
         [0023]     When a positive result is obtained in step SP 15 , the dynamic bit allocation unit  4  proceeds from step SP 15  to step SP 16 . In step SP 16 , the dynamic bit allocation unit  4  updates the minimum MNR value min mnr to the MNR of the channel and the subband signal identified by the variables ch and sb. In addition, the dynamic bit allocation unit  4  updates the variable min ch for identifying the channel having the minimum MNR value by the variable ch. Further, the dynamic bit allocation unit  4  updates the variable min sb for identifying the subband signal having the minimum MNR value by the variable sb. The dynamic bit allocation unit  4  then proceeds to step SP 17 .  
         [0024]     When a negative result is obtained in step SP 15 , on the other hand, the dynamic bit allocation unit  4  directly proceeds from step SP 15  to step SP 17 . In step SP 17 , the dynamic bit allocation unit  4  determines whether the value of the variable sb is lower than the value of a total number of subbands (last sb). When a positive result is obtained in step SP 17 , the dynamic bit allocation unit  4  proceeds to step SP 18 , where the dynamic bit allocation unit  4  increments the variable sb by a value of one to change the subband signal as processing object to a following subband signal. The dynamic bit allocation unit  4  then returns to step SP 15 . When a negative result is obtained in step SP 17 , on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 17  to step SP 19 . In step SP 19 , the dynamic bit allocation unit  4  determines whether the value of the variable ch is lower than the value of a total number of channels (last ch). When a positive result is obtained in step SP 19 , the dynamic bit allocation unit  4  proceeds to step SP 20 , where the dynamic bit allocation unit  4  increments the variable ch by a value of one to change the channel as processing object to a following channel. The dynamic bit allocation unit  4  then returns to step SP 14 .  
         [0025]     By the process of steps SP 13  to SP 20 , the dynamic bit allocation unit  4  sequentially changes the channel and the subband signal, and detects a minimum MNR value, thus performing the process of step SP 2  described above with reference to  FIG. 17 . When the process of steps SP 13  to SP 20  is performed for all of the channels and the subband signals, a positive result is obtained in step SP 19 . The dynamic bit allocation unit  4  proceeds from step SP 19  to step SP 21  ( FIG. 19 ).  
         [0026]     In step SP 21 , the dynamic bit allocation unit  4  determines whether the variable min sb for identifying the subband signal having the minimum MNR value is maintained at the initial value (−1). When the variable min sb is maintained at the initial value (−1), a negative result is obtained in step SP 15  for all the subband signals of all the channels. In this case, the dynamic bit allocation unit  4  proceeds from step SP 21  to step SP 22 , where the dynamic bit allocation unit  4  ends the processing procedure. Incidentally, step SP 21  and step SP 22  correspond to step SP 3  and step SP 4  described above with reference to  FIG. 17 .  
         [0027]     When a negative result is obtained in step SP 21 , on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 21  to step SP 23 . In this step SP 23 , the dynamic bit allocation unit  4  calculates the number of bits (alloc bit) to be allocated to the subband signal identified by the variable min sb for the channel identified by the variable min ch.  
         [0028]     In next step SP 24 , the dynamic bit allocation unit  4  adds the number of bits (alloc bit) calculated in step SP 23  to the total number of bits allocation of which has been completed so far (alloc bit total), and determines whether an addition value (alloc bit total+alloc bit) is lower than the total number of allocatable bits (total bit).  
         [0029]     When a positive result is obtained in step SP 24 , the dynamic bit allocation unit  4  proceeds to step SP 25 , where the dynamic bit allocation unit  4  sets the addition value (alloc bit total+alloc bit) as the total number of bits allocation of which is completed (alloc bit total). In addition, the dynamic bit allocation unit  4  increases the number of bits assigned to the subband signal identified by the variable min sb for the channel identified by the variable min ch by the number of bits calculated in step SP 23 , and reduces quantization steps for the subband signal identified by the variable min sb for the channel identified by the variable min ch by one step. Further, the dynamic bit allocation unit  4  recalculates the MNR of this subband signal, and reduces the number of bits assigned to the subband signal by a value of one.  
         [0030]     Next, the dynamic bit allocation unit  4  proceeds to step SP 26 , where the dynamic bit allocation unit  4  determines whether the number of bits already allocated to the subband signal exceeds the number of bits allocatable to one subband signal. When a negative result is obtained in step SP 26 , the dynamic bit allocation unit  4  returns from step SP 26  to step SP 13 . When a positive result is obtained in step SP 26 , on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 26  to step SP 27 , where the dynamic bit allocation unit  4  sets the subband signal in a state of bit allocation being completed. The dynamic bit allocation unit  4  then returns to step SP 13 . Also when a negative result is obtained in step SP 24 , the dynamic bit allocation unit  4  proceeds from step SP 24  to step SP 27 , where the dynamic bit allocation unit  4  sets the subband signal in a state of bit allocation being completed. The dynamic bit allocation unit  4  then returns to step SP 13 .  
         [0031]     By the process of steps SP 23  to SP 27 , the dynamic bit allocation unit  4  allocates bits to the subband signal having the minimum MNR value detected by the process of steps SP 13  to SP 20 . Thus, steps SP 23  to SP 27  correspond to step SP 4  in  FIG. 17 .  
         [0032]     For such an encoding process, various devices are proposed in Japanese Patent Laid-Open No. Hei 8-123488 and the like.  
         [0033]     When bits are allocated to each subband signal while the evaluation criterion is sequentially calculated, the MNRs of all the subband signals are searched to detect a minimum value again each time bits have been allocated to one subband signal. Therefore the encoding process in the past has a problem of a heavy processing load.  
       SUMMARY OF THE INVENTION  
       [0034]     The present invention has been made in view of the above, and it is desirable to provide an audio signal encoding method, a program of the audio signal encoding method, a recording medium having the program of the audio signal encoding method recorded thereon, and an audio signal encoding device that can reduce the load of processing as compared with an existing example when an audio signal is encoded on the basis of psychoacoustic analysis.  
         [0035]     According to an embodiment of the present invention, there is provided an audio signal encoding method for dividing an audio signal into a plurality of subband signals, allocating bits to the subband signals on a basis of psychoacoustic analysis, and encoding the audio signal, the audio signal encoding method may include the steps of: calculating evaluation criteria for allocating bits for each subband signal on the basis of the psychoacoustic analysis, sorting the evaluation criteria, and allocating the bits to the plurality of subband signals by repeating a bit allocating step, an evaluation criterion recalculating step, and a re-sorting step. In the audio signal encoding method, the bit allocating step may be a step of selecting one subband signal from the plurality of subband signals and allocating bits to the subband signal on a basis of one of a sort result of the sorting step and a sort result of the re-sorting step, the evaluation criterion recalculating step may be a step of recalculating the evaluation criterion of the subband signal to which the bits are allocated in the bit allocating step, the re-sorting step may be a step of applying the evaluation criterion calculated in the evaluation criterion recalculating step to the corresponding subband signal and sorting the evaluation criterion, and the re-sorting step may sort the evaluation criterion by partly changing a sequence of the sort result used for bit allocation in the bit allocating step that immediately precedes.  
         [0036]     According to an embodiment of the present invention, there is provided a program of an audio signal encoding method, the audio signal encoding method dividing an audio signal into a plurality of subband signals, allocating bits to the subband signals on a basis of psychoacoustic analysis, and encoding the audio signal, the program being executed by arithmetic processing means, the program may include the steps of: calculating evaluation criteria for allocating bits for each subband signal on the basis of the psychoacoustic analysis, sorting the evaluation criteria, and allocating the bits to the plurality of subband signals by repeating a bit allocating step, an evaluation criterion recalculating step, and a re-sorting step. In the program, the bit allocating step may be a step of selecting one subband signal from the plurality of subband signals and allocating bits to the subband signal on a basis of one of a sort result of the sorting step and a sort result of the re-sorting step, the evaluation criterion recalculating step may be a step of recalculating the evaluation criterion of the subband signal to which the bits are allocated in the bit allocating step, the re-sorting step may be a step of applying the evaluation criterion calculated in the evaluation criterion recalculating step to the corresponding subband signal and sorting the evaluation criterion, and the re-sorting step may sort the evaluation criterion by partly changing a sequence of the sort result used for bit allocation in the bit allocating step that immediately precedes.  
         [0037]     According to an embodiment of the present invention, there is provided a recording medium on which a program of an audio signal encoding method is recorded, the audio signal encoding method dividing an audio signal into a plurality of subband signals, allocating bits to the subband signals on a basis of psychoacoustic analysis, and encoding the audio signal, the program being executed by arithmetic processing means, the program may include the steps of: calculating evaluation criteria for allocating bits for each subband signal on the basis of the psychoacoustic analysis, sorting the evaluation criteria, and allocating the bits to the plurality of subband signals by repeating a bit allocating step, an evaluation criterion recalculating step, and a re-sorting step. In the recording medium, the bit allocating step may be a step of selecting one subband signal from the plurality of subband signals and allocating bits to the subband signal on a basis of one of a sort result of the sorting step and a sort result of the re-sorting step, the evaluation criterion recalculating step may be a step of recalculating the evaluation criterion of the subband signal to which the bits are allocated in the bit allocating step, the re-sorting step may be a step of applying the evaluation criterion calculated in the evaluation criterion recalculating step to the corresponding subband signal and sorting the evaluation criterion, and the re-sorting step may sort the evaluation criterion by partly changing a sequence of the sort result used for bit allocation in the bit allocating step that immediately precedes.  
         [0038]     According to an embodiment of the present invention, there is provided an audio signal encoding device for dividing an audio signal into a plurality of subband signals, allocating bits to the subband signals on a basis of psychoacoustic analysis, and encoding the audio signal. In the audio signal encoding device, evaluation criteria for allocating bits may be calculated for each subband signal on the basis of the psychoacoustic analysis, the evaluation criteria may be subject to a sort, the bits may be allocated to the plurality of subband signals by repeating bit allocation, evaluation criterion recalculation, and a re-sort, in the bit allocation, one subband signal may be selected from the plurality of subband signals and bits may be allocated to the subband signal on a basis of one of a sort result of the sort and a sort result of the re-sort, in the evaluation criterion recalculation, the evaluation criterion of the subband signal to which the bits may be allocated in the bit allocation may be recalculated, in the re-sort, the evaluation criterion calculated in the evaluation criterion recalculation may be applied to the corresponding subband signal and the evaluation criterion may be sorted, and in the re-sort, the evaluation criterion may be sorted by partly changing a sequence of the sort result used for bit allocation in the bit allocation that immediately precedes.  
         [0039]     According to the configurations of the above-described embodiments, evaluation criteria for bit allocation may be sorted in advance and a subband signal to which to allocate bits may be detected. When a recalculated evaluation criterion is to be sorted, the evaluation criterion may be sorted by partly changing the sequence of a latest sort result. It is therefore possible to detect a subband signal to which to allocate bits by a simpler process as compared with the existing example. Hence, when an audio signal is encoded on the basis of psychoacoustic analysis, the load of processing may be reduced as compared with the existing example.  
         [0040]     According to the present invention, when an audio signal is encoded on the basis of psychoacoustic analysis, the load of processing may be reduced as compared with the existing example. 
     
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0041]      FIG. 1  is a flowchart of a processing procedure of a dynamic bit allocation unit  4  in an encoder according to a first embodiment of the present invention;  
         [0042]      FIGS. 2A, 2B , and  2 C are schematic diagrams of assistance in explaining the processing procedure of  FIG. 1 ;  
         [0043]      FIGS. 3A, 3B , and  3 C are schematic diagrams showing a state continued from  FIGS. 2A, 2B , and  2 C;  
         [0044]      FIGS. 4A, 4B , and  4 C are schematic diagrams showing a state continued from  FIGS. 3A, 3B , and  3 C;  
         [0045]      FIG. 5  is a flowchart representing details of step SP 42  in the processing procedure of  FIG. 1  together with related processes;  
         [0046]      FIG. 6  is a flowchart representing in detail the processing procedure of steps SP 43 , SP 44 , and SP 46  in  FIG. 1 ;  
         [0047]      FIGS. 7A, 7B , and  7 C are schematic diagrams of assistance in explaining the processing procedure of  FIG. 6 ;  
         [0048]      FIG. 8  is a flowchart representing in detail the process of step SP 45  in  FIG. 1 ;  
         [0049]      FIG. 9  is a flowchart of a processing procedure of a dynamic bit allocation unit  4  in an encoder according to a second embodiment of the present invention;  
         [0050]      FIGS. 10A, 10B , and  10 C are schematic diagrams of assistance in explaining the processing procedure of  FIG. 9 ;  
         [0051]      FIGS. 11A, 11B , and  11 C are schematic diagrams showing a state continued from  FIGS. 10A, 10B , and  10 C;  
         [0052]      FIG. 12  is a flowchart representing in detail the process of step SP 100  in the processing procedure of  FIG. 9 ;  
         [0053]      FIG. 13  is a characteristic curve diagram of assistance in explaining occurrence of noise;  
         [0054]      FIG. 14  is a characteristic curve diagram of assistance in explaining prevention of noise;  
         [0055]      FIG. 15  is a flowchart of a processing procedure of a dynamic bit allocation unit  4  in an encoder according to a third embodiment of the present invention;  
         [0056]      FIG. 16  is a block diagram showing an encoder;  
         [0057]      FIG. 17  is a flowchart of a processing procedure of a dynamic bit allocation unit  4  in an encoder in the past;  
         [0058]      FIG. 18  is a flowchart representing in detail the processing procedure of  FIG. 17 ; and  
         [0059]      FIG. 19  is a flowchart continued from  FIG. 18 . 
     
    
     DETAILED DESCRIPTION  
       [0060]     Preferred embodiments of the present invention will hereinafter be described in detail, referring to the drawings as appropriate.  
       First Embodiment  
       [0000]     (1) Configuration of Embodiment  
         [0061]      FIG. 1  is a flowchart of a processing procedure of a dynamic bit allocation unit  4  in an encoder according to a first embodiment of the present invention, for comparison with  FIG. 17 . The encoder according to the first embodiment is formed in the same manner as the encoder described above with reference to  FIG. 16  except for the different processing procedure of the dynamic bit allocation unit  4  in the encoder according to the first embodiment. Therefore the following description will be made using the configuration of  FIG. 16  as appropriate.  
         [0062]     The dynamic bit allocation unit  4  performs the processing procedure for each block set in an audio signal S 1 , and thereby assigns bits to each subband signal. Starting this processing procedure, as described above with reference to  FIG. 17 , the dynamic bit allocation unit  4  calculates the MNR of each subband signal. The dynamic bit allocation unit  4  then proceeds from step SP 41  to step SP 42 , where the dynamic bit allocation unit  4  sorts the calculated MNRs in increasing order.  
         [0063]     As shown in  FIGS. 2A, 2B , and  2 C, the dynamic bit allocation unit  4  secures a certain area in a not shown memory, sorts combinations each including an MNR (p mnr ( FIG. 2B )), an index index ( FIG. 2A ) for identifying a channel and a subband signal for which the MNR is detected, and a status used ( FIG. 2C ) indicating a status of processing for the index index for all subband signals of all channels by MNR, and then stores the result in the memory. The value 0 of the status (used) indicates a state in which no bits are allocated, the value 1 of the status (used) indicates a state in which bits are being allocated, and the value 2 of the status (used) indicates a state in which bit allocation is completed. The certain area is set to have a sufficient free space to store the combinations each including an index index, a status used, and an MNR for all the subband signals of all the channels and repeat the process of step SP 44  to be described later.  
         [0064]     Thus, in the example of  FIGS. 2A, 2B , and  2 C, a combination of index=4, p mnr=20, and used=0 is stored in a head area identified by a variable no=0 in a memory space. A combination of an MNR recorded in the memory, an index index for identifying a channel and a subband signal for which the MNR is detected, and a status used indicating a status of processing for the index index will hereinafter be referred to as an MNR combination as appropriate. The variable no identifies the MNR combination.  
         [0065]     Next, the dynamic bit allocation unit  4  proceeds to step SP 43 , where the dynamic bit allocation unit  4  detects an MNR having a lowest value recorded at the head of a sort result. In addition, on the basis of an index index for the detected MNR, the dynamic bit allocation unit  4  allocates bits to the subband signal of a corresponding channel, and then recalculates the MNR of the subband signal to which the bits are allocated.  
         [0066]     Then the dynamic bit allocation unit  4  proceeds to step SP 44 , where the dynamic bit allocation unit  4  determines whether the allocation of all allocatable bits is completed. When a negative result is obtained in step SP 44 , the dynamic bit allocation unit  4  proceeds to step SP 45 . In this step SP 45 , the dynamic bit allocation unit  4  applies the MNR recalculated in step SP 44  to re-sort the MNRs recorded in the memory.  
         [0067]     As shown in  FIGS. 3A, 3B , and  3 C, in the sorting process in step SP 44 , the dynamic bit allocation unit  4  sorts the MNRs by partially changing a sequence of a sort result so far. Specifically, the dynamic bit allocation unit  4  sequentially moves combinations of the sort result so far to an end side as indicated by arrows in the memory where the sort result is recorded until an MNR having a value lower than the recalculated MNR is detected. When an MNR having a value lower than the recalculated MNR is detected, the dynamic bit allocation unit  4  records a combination including the recalculated MNR in a free space obtained by moving the combinations. Thus, the example of  FIGS. 3A, 3B , and  3 C is a case where bits are allocated to the subband signal of index=4 stored in the head area of the memory space, a value  44  is obtained by recalculating the MNR, records of combinations of no=7 to 9 are moved to the end side one by one, and the recalculation result is recorded in a free space of no=7 obtained by moving the combinations. As indicated by hatching, after recalculating and sorting the MNR, the dynamic bit allocation unit  4  excludes the record including the MNR before the recalculation from objects for subsequent processing.  
         [0068]     After completing the process of step SP 45 , the dynamic bit allocation unit  4  returns to step SP 43 , where the dynamic bit allocation unit  4  detects an MNR having a lowest value recorded at the head of the processing objects from the sort result obtained by the sorting in step SP 45 . Thus, in the example of  FIGS. 3A, 3B , and  3 C, an MNR of index=9 identified by no=1 is detected as MNR having a lowest value. Therefore, in this case, the dynamic bit allocation unit  4  allocates bits to the subband signal of index=9 and recalculates the MNR in step SP 43 , and then further sorts the MNRs in step SP 45  as shown in  FIGS. 4A, 4B , and  4 C. Incidentally,  FIGS. 4A, 4B , and  4 C illustrate a case where an MNR having a value  32  is obtained by recalculation for the subband signal of index=9. Incidentally, as will be described later, when bit allocation to the subband signal to which the bits are allocated is completed as a result of allocating the bits in step SP 43 , the dynamic bit allocation unit  4  omits the process of step SP 45  and repeats the process of step SP 43 .  
         [0069]      FIG. 5  is a flowchart representing details of step SP 42  in the processing procedure of  FIG. 1  together with related processes. Starting this processing procedure, the dynamic bit allocation unit  4  calculates an MNR for each subband signal when quantization is performed with one bit, for example. The dynamic bit allocation unit  4  then proceeds from step SP 51  to step SP 52 .  
         [0070]     In step SP 52 , the dynamic bit allocation unit  4  initializes a total number of bits (alloc bit total) indicating the number of bits allocation of which has been completed to a value 0. Incidentally, for representations consistent with the existing example, the index index will hereinafter be ch=index/last sb and sb=index % last sb. Hence, p mnr[index] indicates the same value as mnr[ch][sb]. Incidentally, % denotes modulo calculation for obtaining a remainder, and ch and sb are variables for identifying a channel and a subband signal.  
         [0071]     Next, the dynamic bit allocation unit  4  proceeds to step SP 53 , where the dynamic bit allocation unit  4  initializes each of a variable no and a variable sort num to a value 0. Incidentally, the variable sort num indicates a number of objects to be sorted. The variable no in the process represented in  FIG. 5  identifies a sort object.  
         [0072]     Next, the dynamic bit allocation unit  4  proceeds to step SP 54 , where the dynamic bit allocation unit  4  determines whether the value of the variable no is lower than a multiplication value last ch×last sb obtained by multiplying together a total number last ch of channels and a total number last sb of subbands, and thereby determines whether the processing of all sort objects is not completed.  
         [0073]     When a positive result is obtained in step SP 54 , the dynamic bit allocation unit  4  proceeds to step SP 55 . In step SP 55 , the dynamic bit allocation unit  4  converts the variable no into the variable ch and the variable sb for identifying a channel and a subband signal.  
         [0074]     In next step SP 56 , the dynamic bit allocation unit  4  determines a status used [ch][sb] of a subband signal identified by the variable sb for a channel identified by the variable ch, and thereby determines whether allocation of bits to the subband signal is completed.  
         [0075]     When a negative result is obtained in step SP 56 , the dynamic bit allocation unit  4  proceeds to step SP 57 . In step SP 57 , the dynamic bit allocation unit  4  stores an MNR combination identified by the variable no in an area sort num following an end of MNR combinations stored in the memory so far. Incidentally, order[x]=y denotes that the combination identified by no=y is stored in an xth area from the head side of the memory space and conversely the combination identified by no=y is loaded into the xth area from the head side of the memory space. In the present embodiment, the MNR combination stored in the memory in step SP 57  is a sort object. In addition, the dynamic bit allocation unit  4  sets a variable m for identifying a comparison object for comparison with the sort object by recording order in the memory space to sort num −1, thereby setting an MNR combination stored at a position immediately preceding the sort object as the comparison object. The dynamic bit allocation unit  4  also increments the variable sort num indicating the sort number by a value of one. By performing the process of step SP 57 , the dynamic bit allocation unit  4  prepares for a sort.  
         [0076]     Next, the dynamic bit allocation unit  4  proceeds to step SP 58 , where the dynamic bit allocation unit  4  determines whether the variable m is larger than a value 0. When the sort object is an MNR combination recorded at the head of the memory space, no MNR combination preceding this combination is recorded, and thus there is no comparison object. In addition, there is no comparison object after the comparison object is sequentially changed from the end side to the head side and the first MNR combination becomes the comparison object. Hence, in these cases, the dynamic bit allocation unit  4  obtains a negative result in step SP 58 , and proceeds from step SP 58  to step SP 59 .  
         [0077]     In step SP 59 , the dynamic bit allocation unit  4  records the combination of the sort object at the head of the memory space (order[0]=no).  
         [0078]     Next, the dynamic bit allocation unit  4  proceeds to step SP 60 , where the dynamic bit allocation unit  4  increments the variable no by a value of one, and then returns to step SP 54 .  
         [0079]     When a positive result is obtained in step SP 58 , on the other hand, the dynamic bit allocation unit  4  proceeds to step SP 61 . In step SP 61 , the dynamic bit allocation unit  4  determines whether the MNR (p mnr[no]) of the combination identified by the variable no is lower than the MNR (p mnr[order[m]]) of the combination identified by the variable m, that is, whether the MNR of the sort object is lower than the MNR of the comparison object.  
         [0080]     When a positive result is obtained in step SP 61 , the dynamic bit allocation unit  4  proceeds to step SP 62 , where the dynamic bit allocation unit  4  moves the record of the comparison object in the memory space to the end side by one (order[m+1]=order[m]). In addition, the dynamic bit allocation unit  4  decrements the variable m by a value of one to change the comparison object to a combination recorded at an immediately preceding position. The dynamic bit allocation unit  4  then returns to step SP 58 .  
         [0081]     When a negative result is obtained in step SP 61 , on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 61  to step SP 63 , where the dynamic bit allocation unit  4  records the combination of the sort object at a recording position before the comparison object is moved (order[m+1]=no). The dynamic bit allocation unit  4  then proceeds to step SP 60 .  
         [0082]     The dynamic bit allocation unit  4  sequentially stores MNR combinations in the memory space by performing the process of steps SP 53  to SP 63 . At this time, each time one combination is to be stored in the memory, as described above with reference to  FIGS. 3A, 3B , and  3 C, already stored combinations are sequentially moved to the end side in the memory space until an MNR having a lower value than the MNR to be stored is detected, and the MNR combination is stored in a free space created as a result, whereby the sort process is performed.  
         [0083]     When completing the sort process, the dynamic bit allocation unit  4  obtains a negative result in step SP 54 , and then proceeds to step SP 43 .  
         [0084]      FIG. 6  is a flowchart representing in detail the processing procedure of steps SP 43 , SP 44 , and SP 46  in  FIG. 1 . Incidentally, although the process of step SP 44  is performed after step SP 43  in  FIG. 1 ,  FIG. 1  describes the processing procedure for convenience in order to facilitate understanding. In practice, the processing procedure is performed in order shown in  FIG. 6 . Specifically, starting the processing procedure, the dynamic bit allocation unit  4  proceeds to step SP 71 , where the dynamic bit allocation unit  4  initializes the variable no to a value 0.  
         [0085]     Next, the dynamic bit allocation unit  4  proceeds to step SP 72 , where the dynamic bit allocation unit  4  determines whether the value of the variable no is lower than the sort number sort num, and thereby determines whether the process is to be ended. When the variable no is equal to or larger than the sort number sort num, the dynamic bit allocation unit  4  proceeds from step SP 72  to step SP 73 , where the dynamic bit allocation unit  4  ends the processing procedure. Hence, step SP 72  and step SP 73  correspond to step SP 44  and step SP 46  described above with reference to  FIG. 1 .  
         [0086]     When the value of the variable no is lower than the sort number sort num, on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 72  to step SP 74 . In step SP 74 , the dynamic bit allocation unit  4  detects the index index of a combination identified by the variable no in the memory space (index=order[no]), and converts the index index into variables min ch and min sb identifying a channel and a subband signal (min ch=index/last sb and min sb=index % last sb). Hence, in this case, the channel and subband signal of an MNR having a lowest value sorted and recorded at the head area of the memory space is detected among processing objects.  
         [0087]     Next, the dynamic bit allocation unit  4  proceeds to step SP 75 , where the dynamic bit allocation unit  4  determines a status used[min ch][min sb] set for the combination of the index index detected in step SP 74 , and thereby determines whether bit allocation to the subband signal of the index index is completed.  
         [0088]     When a positive result is obtained in step SP 75 , the dynamic bit allocation unit  4  proceeds from step SP 75  to step SP 76 , where the dynamic bit allocation unit  4  increments the variable no by a value of one. The dynamic bit allocation unit  4  then returns to step SP 72 . When a negative result is obtained in step SP 75 , on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 75  to step SP 77 .  
         [0089]     Thus, the dynamic bit allocation unit  4  performs the process of steps SP 71 , SP 72 , SP 74 , and SP 75  in this order, and when a positive result is obtained in step SP 75 , the dynamic bit allocation unit  4  further performs the process of steps SP 76 , SP 72 , SP 74 , and SP 75  in this order. The dynamic bit allocation unit  4  thereby detects a combination to which bit allocation is not completed and which has a lowest MNR recorded at a foremost position among the combinations recorded as processing objects in the memory.  
         [0090]     When detecting the combination having the lowest MNR, the dynamic bit allocation unit  4  proceeds from step SP 75  to step SP 77 , where the dynamic bit allocation unit  4  calculates an amount of bits (alloc bit) to be allocated to the subband signal of the combination having the lowest MNR which subband signal is detected in step SP 74 . In next step SP 78 , the dynamic bit allocation unit  4  adds the calculated amount of bits (alloc bit) to the total number of bits (alloc bit total), and determines whether an addition value (alloc bit total+alloc bit) is lower than a total number of allocatable bits (total bit).  
         [0091]     When a positive result is obtained in step SP 78 , the dynamic bit allocation unit  4  proceeds to step SP 79 , where the dynamic bit allocation unit  4  sets the addition value (alloc bit total+alloc bit) as the total number of bits (alloc bit total) allocation of which is completed. In addition, the dynamic bit allocation unit  4  sets the status used of the combination identified by the variable no to a value 1 indicating a state of bits being allocated. Further, the dynamic bit allocation unit  4  adds the number of bits calculated in step SP 77  to the number of bits assigned to the subband signal of the combination identified by the variable no, and recalculates the MNR. Further, the dynamic bit allocation unit  4  reduces quantization steps for the subband signal identified by the variable min sb for the channel identified by the variable min ch by one step. Further, the dynamic bit allocation unit  4  reduces the number of bits assigned to the subband signal by a value of one.  
         [0092]     Next, the dynamic bit allocation unit  4  in step SP 80  determines whether the number of bits already allocated to the subband signal of the combination identified by the variable no exceeds the number of bits allocatable to one subband signal, and thereby determines whether allocation of bits to the subband signal is completed.  
         [0093]     When a positive result is obtained in step SP 80 , the dynamic bit allocation unit  4  proceeds to step SP 81 , where the dynamic bit allocation unit  4  changes the status used of the combination whose status used has been set to the value 1 in step SP 79  to a value 2 indicating that bit allocation is completed. The dynamic bit allocation unit  4  then returns to step SP 76 .  
         [0094]     Thus, when bit allocation to the subband signal to which bits are allocated in step SP 79  is completed, the dynamic bit allocation unit  4  proceeds from step SP 81  to step SP 76 . As shown in  FIGS. 7A, 7B , and  7 C for comparison with  FIGS. 4A, 4B , and  4 C, in this case, bits are allocated to a subband signal having a next lowest MNR without the sort process being performed, whereby the number of sorts is reduced. Incidentally,  FIGS. 7A, 7B , and  7 C illustrate a case where the subband signal of the index index=5 is detected as subband signal having a lowest MNR and bit allocation to the subband signal is completed. In this case, sorting of the subband signal of the index index=5 is not performed, and bits are allocated to a next subband signal of the index index=8.  
         [0095]      FIG. 8  is a flowchart representing in detail the process of step SP 45  in  FIG. 1 . Starting this processing procedure, the dynamic bit allocation unit  4  proceeds to step SP 84 , where the dynamic bit allocation unit  4  stores the combination of the subband signal to which bits are allocated in previous step SP 79  in an area sort num following an end of the MNR combinations stored in the memory (order[sort num]=index). In addition, the dynamic bit allocation unit  4  sets the combination stored at the position following the end as a sort object. Further, the dynamic bit allocation unit  4  sets the variable m for identifying a comparison object to sort num−1, and thereby sets an MNR combination recorded at a position immediately preceding the sort object as the comparison object. Further, the dynamic bit allocation unit  4  increments the variable sort num by a value of one.  
         [0096]     Next, the dynamic bit allocation unit  4  proceeds to step SP 85 , where the dynamic bit allocation unit  4  determines whether the variable m is higher than a value no+1. No comparison object exists after the comparison object is sequentially changed from the end side to the head side and the MNR combination at the head of the processing objects becomes the comparison object. Hence, in these cases, the dynamic bit allocation unit  4  obtains a negative result in step SP 85 , and proceeds from step SP 85  to step SP 86 .  
         [0097]     In step SP 86 , the dynamic bit allocation unit  4  records the combination of the sort object at an (no+1)th position of the memory space (order[no+1]=index). Incidentally, the MNR of this combination is the MNR recalculated in step SP 79 . Incidentally, in step SP 86 , when the recording position (order[ ]) of the combination of the sort object is set and the variable sort num is set such that the subband signal for which a positive result is obtained in previous step SP 80  and to which bit allocation is thus completed is not included as a comparison object in the subsequent sort process, a processing load can be further reduced.  
         [0098]     Next, the dynamic bit allocation unit  4  proceeds to step SP 87 , where the dynamic bit allocation unit  4  increments the variable no by a value of one. The dynamic bit allocation unit  4  returns to step SP 72  ( FIG. 6 ).  
         [0099]     When a positive result is obtained in step SP 85 , on the other hand, the dynamic bit allocation unit  4  proceeds to step SP 88 . In step SP 88 , the dynamic bit allocation unit  4  determines whether the MNR (p mnr[index]) of the sort object identified by the index index is lower than the MNR (p mnr[order[m]]) of the combination identified by the variable m.  
         [0100]     When a positive result is obtained in step SP 88 , the dynamic bit allocation unit  4  proceeds to step SP 89 , where the dynamic bit allocation unit  4  moves the record of the comparison object in the memory space to the end side by one (order[m+1]=order[m]). In addition, the dynamic bit allocation unit  4  decrements the variable m by a value of one to change the comparison object to a combination recorded at an immediately preceding position. The dynamic bit allocation unit  4  then returns to step SP 85 .  
         [0101]     When a negative result is obtained in step SP 88 , on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 88  to step SP 90 , where the dynamic bit allocation unit  4  records the combination of the sort object at a recording position immediately succeeding the comparison object (order[m+1]=index). The dynamic bit allocation unit  4  then proceeds to step SP 87 .  
         [0000]     (2) Operation of Embodiment  
         [0102]     With the above configuration, in the encoder according to the present embodiment (see  FIG. 16 ), a subband analyzing filter bank  2  divides a sequentially input audio signal S 1  into a plurality of subband signals, and a linear quantizer  3  quantizes each subband signal. A bit compressing unit  11  bit-compresses a result of the quantization process, and then a bit stream forming unit  5  converts the bit-compressed result into a bit stream S 2  and outputs the bit stream S 2 . A fast Fourier transform unit  8  subjects the audio signal S 1  to a fast Fourier transform process. A psychoacoustic model unit  9  analyzes a result of the fast Fourier transform process, and detects the SMR (signal-to-mask ratio) of each subband signal. The dynamic bit allocation unit  4  determines the MNR (Mask to Noise Ratio) of each subband signal of the audio signal S 1  from the signal-to-mask ratio SMR, and determines bit allocation and a quantization scale on the basis of the MNR. The linear quantizer  3  performs the quantization process with the bit allocation and the quantization scale.  
         [0103]     The bit allocation process in the dynamic bit allocation unit  4  is performed by repeating a process of detecting a subband signal with an MNR having a lowest value among the plurality of subband signals to which to allocate bits and a process of allocating bits to the detected subband signal and recalculating the MNR, and allocating all allocatable bits to each subband signal of each channel. In addition, the quantization scale of each subband signal is set so as to correspond to this bit allocation.  
         [0104]     In the present embodiment, the dynamic bit allocation unit  4  ( FIG. 1 ) first sorts the MNRs of respective subbands in increasing order of MNR, and allocates bits to the subband signal having the MNR recorded at the head of a result of the sort ( FIGS. 2A, 2B , and  2 C). The MNR of the subband signal to which the bits are allocated is recalculated and re-sorted ( FIGS. 3A, 3B , and  3 C). Bits are allocated to the subband signal having the MNR recorded at the head of the re-sorted MNRs. The dynamic bit allocation unit  4  repeats a process of recalculating and re-sorting the MNR and a process of allocating bits to the subband signal having the MNR recorded at the head of the re-sorted MNRs, whereby all bits are allocated to each subband signal of each channel.  
         [0105]     Thus, the dynamic bit allocation unit  4  performs a sort in advance, and then detects a subband signal to which to allocate bits. Therefore, as compared with the existing example, the subband signal to which to allocate bits can be detected more quickly.  
         [0106]     Specifically, the MNRs of the audio signal S 1  are first calculated on the basis of an initial setting, and combinations of the calculated MNRs, indexes index, and statuses used are stored in the memory one by one and sorted ( FIG. 5 ).  
         [0107]     At this time, an MNR combination is stored at an end of a row of MNR combinations already stored in the memory (step SP 57  ( FIG. 5 )), and the order of arrangement is changed between the MNR combination and a combination stored at an immediately preceding position until an MNR having a lower value is detected (steps SP 58 , SP 61 , SP 62 , SP 58 , . . . , SP 58 , SP 61 , and SP 63  in this order, or steps SP 58 , SP 61 , SP 62 , SP 58 , . . . , SP 58 , and SP 59  in this order ( FIG. 5 )), whereby a sort is performed.  
         [0108]     As a result of the sort, an MNR combination stored at the head includes an MNR having a lowest value, and bits are allocated to the channel and the subband signal of the combination at the head (steps SP 71  and SP 74 , SP 75 , and SP 77  in this order ( FIG. 6 )).  
         [0109]     In addition, for a recalculated MNR, a corresponding MNR already stored in the memory is excluded from processing objects, and the recalculated MNR is stored at an end of a row of MNR combinations already stored in the memory (step SP 84  ( FIG. 8 )). Until an MNR having a lower value is detected, the order of arrangement is changed between the MNR combination and a combination stored at an immediately preceding position, and thereby a sort is performed (steps SP 85 , SP 88 , SP 89 , SP 88 , . . . , SP 85 , SP 88 , and SP 87  in this order, or steps SP 85 , SP 88 , SP 89 , SP 88 , . . . , SP 85 , and SP 90  in this order ( FIG. 8 )).  
         [0110]     As a result of sorting the recalculated MNR, an MNR combination stored at the head includes an MNR having a lowest value, and bits are allocated to the channel and the subband signal of the combination at the head (steps SP 71  and SP 74 , SP 75 , and SP 77  in this order ( FIG. 6 )).  
         [0111]     Thus, when bit allocation to the subband signal of the combination at the head of the sort result is completed, it suffices to allocate bits to the subband signal of a next combination in the sort result (steps SP 56 , SP 60 , SP 54 , SP 55 , SP 56 , and SP 57  in this order ( FIG. 5 )). It is therefore possible to reduce the number of sorts as the processing progresses, and simplify the process of detecting a minimum MNR for subband signals to which bits can be allocated.  
         [0112]     Although MNRs are sorted in advance and a minimum MNR is detected quickly, the MNRs are sorted in the present embodiment, and it thus appears that a load of the processing viewed as a whole is not different from that of the existing example. In the present embodiment, however, when a recalculated MNR is to be sorted, the combination of the recalculated MNR is stored at an end of a sort result already stored in the memory, and thereafter the order of arrangement is changed between the combination of the recalculated MNR and a combination stored at an immediately preceding position until an MNR having a lower value is detected, whereby a sort is performed. Thus, the sort result so far is utilized effectively, and the MNRs are sorted by partly changing the sequence of the sort result so far. Hence, the load of the processing viewed as a whole can be reduced as compared with the existing example. In actuality, when the sort process and bit allocation are performed as in the present embodiment, an amount of processing of the encoder as a whole can be reduced by  52  [%] as compared with the processing performed by the existing example.  
         [0000]     (3) Effect of Embodiment  
         [0113]     According to the above configuration, MNRs are sorted in advance and a subband signal to which to allocate bits is detected. When a recalculated MNR is to be sorted, the combination of the recalculated MNR is stored at an end of a row of MNR combinations already stored in the memory, and thereafter the order of arrangement is changed between the combination of the recalculated MNR and a combination stored at an immediately preceding position until an MNR having a lower value is detected, whereby a sort is performed. It is thus possible to utilize the sort result so far effectively, and sort the MNRs by partly changing the sequence of the sort result so far. Hence, the load of processing can be reduced as compared with the existing example.  
       Second Embodiment  
       [0114]      FIG. 9  is a flowchart representing a processing procedure of a dynamic bit allocation unit  4  in an encoder according to a second embodiment of the present invention, for comparison with  FIG. 1 . The encoder according to the second embodiment is formed in the same manner as the encoder described above with reference to  FIG. 16  except for the different processing procedure of the dynamic bit allocation unit  4  in the encoder according to the second embodiment. Therefore the following description will be made using the configuration of  FIG. 16  as appropriate. In addition, the dynamic bit allocation unit  4  is formed in the same manner as in the encoder described above with reference to  FIG. 1  except for a different re-sort process in step SP 100 . Thus, in the following description, the same processes as those of the dynamic bit allocation unit  4  described in the first embodiment are identified by the same reference numerals, and repeated description thereof will be omitted.  
         [0115]     As with the dynamic bit allocation unit  4  of the first embodiment, starting this processing procedure, the dynamic bit allocation unit  4  proceeds from step SP 99  to step SP 42 , where the dynamic bit allocation unit  4  sorts the MNR of each subband signal together with an index index and the like, and stores the MNR of each subband signal in a memory together with the index index and the like. In next step SP 43 , the dynamic bit allocation unit  4  allocates bits to a subband signal with an MNR having a lowest value, and then recalculates the MNR of the subband signal to which the bits are allocated. In next step SP 44 , the dynamic bit allocation unit  4  determines whether all allocatable bits are allocated. When a negative result is obtained in step SP 44 , the dynamic bit allocation unit  4  proceeds from step SP 44  to step SP 100 .  
         [0116]     In this step SP 100 , the dynamic bit allocation unit  4  applies the MNR recalculated in step SP 44  to re-sort the MNRs recorded in the memory.  
         [0117]     In the sort process in step SP 100 , the dynamic bit allocation unit  4  sorts the MNRs by partly changing the sequence of a sort result so far. At this time, as shown in  FIGS. 10A, 10B , and  10 C for comparison with  FIGS. 3A, 3B , and  3 C, the dynamic bit allocation unit  4  sequentially moves combinations of the sort result so far to a head side as indicated by arrows in the memory where the sort result is recorded until an MNR having a value higher than the recalculated MNR is detected. When an MNR having a value higher than the recalculated MNR is detected, the dynamic bit allocation unit  4  records a combination including the recalculated MNR in a free space obtained by moving the combinations. Thus, the example of  FIGS. 10A, 10B , and  10 C is a case where bits are allocated to the subband signal of index=4 stored in the head area of the memory space, a value  44  is obtained by recalculating the MNR, records of combinations of no=1 to 6 are moved to the head side, and the recalculation result is recorded in a free space of no=6 obtained by moving the combinations.  
         [0118]     After completing the process of step SP 100 , the dynamic bit allocation unit  4  returns to step SP 43 , where the dynamic bit allocation unit  4  detects an MNR having a lowest value recorded at the head of processing objects from the sort result obtained by the sorting in step SP 100 . Thus, in the example of  FIGS. 10A, 10B , and  10 C, an MNR of index=9 identified by no=1 is detected as MNR having a lowest value. Therefore, in this case, the dynamic bit allocation unit  4  allocates bits to the subband signal of index=9 and recalculates the MNR in step SP 43 , and then further sorts the MNRs in next step SP 100  as shown in  FIGS. 11A, 11B , and  11 C. Incidentally,  FIGS. 11A, 11B , and  11 C illustrate a case where an MNR having a value  32  is obtained by recalculation for the subband signal of index=9.  
         [0119]      FIG. 12  is a flowchart representing in detail the process of step SP 100  in  FIG. 9 . Starting this processing procedure, the dynamic bit allocation unit  4  proceeds to step SP 101 , where the dynamic bit allocation unit  4  sets the combination of a subband signal to which bits are allocated in previous step SP 43  as a sort object (order[no]=index). In addition, the dynamic bit allocation unit  4  sets a variable m for identifying a comparison object to no+1, and thereby sets an MNR combination recorded at a position immediately succeeding the sort object as the comparison object.  
         [0120]     Next, the dynamic bit allocation unit  4  proceeds to step SP 102 , where the dynamic bit allocation unit  4  determines whether the variable m is lower than a variable sort num. No comparison object exists after the comparison object is sequentially changed from a head side to an end side and a last MNR combination becomes the comparison object. Hence, in this case, the dynamic bit allocation unit  4  obtains a negative result in step SP 102 , and then proceeds from step SP 102  to step SP 103 .  
         [0121]     In step SP 103 , the dynamic bit allocation unit  4  records the combination of the sort object at an end in a memory space (order[sort num−1]=index). The dynamic bit allocation unit  4  returns to step SP 43 .  
         [0122]     When a positive result is obtained in step SP 102 , on the other hand, the dynamic bit allocation unit  4  proceeds to step SP 104 . In step SP 104 , the dynamic bit allocation unit  4  determines whether the MNR (p mnr[index]) of the sort object identified by the index index is lower than the MNR (p mnr[order[m]]) of the combination identified by the variable m.  
         [0123]     When a positive result is obtained in step SP 104 , the dynamic bit allocation unit  4  proceeds to step SP 105 , where the dynamic bit allocation unit  4  moves the record of the comparison object in the memory space to the head side by one (order[m−1]=order[m]). In addition, the dynamic bit allocation unit  4  increments the variable m by a value of one to change the comparison object to a combination recorded at an immediately succeeding position. The dynamic bit allocation unit  4  then returns to step SP 102 .  
         [0124]     When a negative result is obtained in step SP 104 , on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 104  to step SF 106 , where the dynamic bit allocation unit  4  records the combination of the sort object at a recording position immediately preceding the comparison object (order[m]=index). The dynamic bit allocation unit  4  then proceeds to step SP 43 .  
         [0125]     The present embodiment can provide similar effects to those of the first embodiment even when the re-sorting process is performed from a side of lower MNR values.  
       Third Embodiment  
       [0126]     When bit allocation based on psychoacoustic analysis and encoding are performed, depending on frequency characteristics of the audio signal, there occurs a case where as shown in  FIG. 13 , no bits are allocated to particular subband signals B 1  and B 2  on a high-frequency side, and bits are allocated to subband signals B 3  and B 4  having higher frequencies than the subband signals B 1  and B 2 . A situation as shown in  FIG. 13  tends to occur especially when the encoding process is performed at a low bit rate. Results of various studies have shown that the sound quality of the decoded audio signal is degraded when, as described above, no bits are allocated to particular subband signals B 1  and B 2  on a high-frequency side, and bits are allocated to subband signals B 3  and B 4  having higher frequencies than the subband signals B 1  and B 2 .  
         [0127]     Thus, as shown in  FIG. 14  for comparison with  FIG. 13 , the present embodiment detects the subband signals B 3  and B 4  that cause the degradation in sound quality, and reallocates the bits allocated to the subband signals B 3  and B 4  to other subband signals, as indicated by arrows.  
         [0128]      FIG. 15  is a flowchart of a processing procedure of a dynamic bit allocation unit  4  in an encoder according to a third embodiment of the present invention. The encoder according to the third embodiment is formed in the same manner as the encoder described above with reference to  FIG. 16  except for the different processing procedure of the dynamic bit allocation unit  4  in the encoder according to the third embodiment. Therefore the following description will be made using the configuration of  FIG. 16  as appropriate.  
         [0129]     The dynamic bit allocation unit  4  performs the processing procedure for each block of an audio signal S 1 . Starting this processing procedure, the dynamic bit allocation unit  4  proceeds from step SP 121  to step SP 122 , where the dynamic bit allocation unit  4  calculates a bit allocation to each subband signal by performing the processing procedure of  FIG. 1  or  FIG. 9 .  
         [0130]     Next, the dynamic bit allocation unit  4  proceeds to step SP 123 , where the dynamic bit allocation unit  4  determines whether there is a bit allocation to a subband signal causing degradation in sound quality. In step SP 123 , the dynamic bit allocation unit  4  determines that there is a bit allocation to a subband signal causing degradation in sound quality when there is no bit allocation to a subband signal in a band on a lower frequency side of a band of frequencies equal to and higher than a certain frequency, there is a bit allocation to a subband signal in a band on a higher frequency side, and further the number of bits allocated to the subband signal in the band on the higher frequency side is equal to or smaller than a certain number.  
         [0131]     When a negative result is obtained in step SP 123 , the dynamic bit allocation unit  4  proceeds from step SP 123  to step SP 124 , where the dynamic bit allocation unit  4  ends the processing procedure. When a positive result is obtained in step SP 123 , on the other hand, the dynamic bit allocation unit  4  proceeds from step SP 123  to step SP 125 . In step SP 125 , the dynamic bit allocation unit  4  calculates the number of bits allocated to the subband signal causing the degradation in sound quality. Thus, in the example of  FIG. 13 , the dynamic bit allocation unit  4  calculates the number of bits allocated to the subband signals B 3  and B 4 .  
         [0132]     Next, the dynamic bit allocation unit  4  proceeds to step SP 126 , where the dynamic bit allocation unit  4  allocates the amount of bits which amount is calculated in step SP 125  to another subband signal. The dynamic bit allocation unit  4  performs the process of step SP 126  by performing the processing procedure of  FIG. 1  or  FIG. 9  again. Specifically, the dynamic bit allocation unit  4  first sets the statuses used of the subband signals B 3  and B 4  causing degradation in sound quality and the subband signals B 1  and B 2  that are adjacent on the lower frequency side to the subband signals B 3  and B 4  and to which no bits are allocated to indicating completion of bit allocation, so that no bits are to be allocated to the subband signals B 1  to B 4 . In addition, the dynamic bit allocation unit  4  sets the amount of bits that have previously been allocated to the subband signals B 3  and B 4  as an amount of remaining allocatable bits, repeats the processes of re-sorting (step SP 45  or step SP 100 ) and bit allocation (step SP 43 ) described above with reference to  FIG. 1  or  FIG. 9 , and thereby allocates the bits that have previously been allocated to the subband signals B 3  and B 4  to other subband signals. Incidentally, the process of step SP 126  may be performed by restarting the process of  FIG. 1  or  FIG. 9  from the beginning. In addition, a setting may be simply made so that no bits are allocated to only the subband signals B 3  and B 4  that cause degradation in sound quality and to which bits have previously been allocated.  
         [0133]     The present embodiment detects a bit allocation to a subband signal causing degradation in sound quality, and reallocates bits allocated to the subband signal to another subband signal. It is thereby possible to prevent degradation in sound quality by a simple process.  
       Fourth Embodiment  
       [0134]     It is to be noted that while in the foregoing embodiments, MNRs are sorted in order of increasing MNR value, the present invention is not limited to this, and MNRs may conversely be sorted in order of decreasing MNR value. Incidentally, in this case, of course, the process of detecting an MNR having a lowest value is performed in a manner opposite to that of the foregoing embodiment, that is, from an end of a sort result, and the processes of MNR re-sorting and the like are performed in an opposite direction to that of the foregoing embodiment.  
         [0135]     In addition, while in the foregoing embodiments, the encoder is formed by a digital signal processor, the present invention is not limited to this, and is applicable to cases where an audio signal is subjected to an editing process by a computer, for example, and is thus widely applicable to cases where an audio signal is subjected to an encoding process by executing a program of arithmetic processing means, for example. Incidentally, the program of an audio signal encoding method which program is executed by such arithmetic processing means may be provided in a state of being recorded on various recording media such as optical disks, magnetic disks and memory cards, or may be provided via a network such as the Internet.  
         [0136]     Further, in the foregoing embodiments, description has been made of a case where the present invention is applied to a process of encoding an audio signal by MPEG 1  or MPEG 2 , and MNR is used as an evaluation criterion for allocating bits. However, the present invention is not limited to this, and is widely applicable to cases where the encoding process is performed in various formats using various evaluation criteria.  
         [0137]     The present invention is applicable to cases where audio signals are encoded by Layer  1  and Layer  2  of MPEG 1  and MPEG 2 , for example.  
         [0138]     It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and alterations may occur depending on design requirements and other factors insofar as they are within the scope of the appended claims or the equivalents thereof.

Technology Category: g