Patent Publication Number: US-7725323-B2

Title: Device and process for encoding audio data

Description:
BACKGROUND OF THE INVENTION 
   1. Field of the Invention 
   The present invention relates to a device and process for encoding audio data, and in particular to a process for determining encoding parameters for use in MPEG audio encoding. 
   2. Description of the Related Art 
   The MPEG-1 audio standard, as described in the International Standards Organization (ISO) document ISO/IEC 11172-3: Information technology—Coding of moving pictures and associated audio for digital storage media at up to about 1.5 Mbps (“the MPEG-1 standard”), defines processes for lossy compression of digital audio and video data. The MPEG-1 standard defines three alternative processes or “layers” for audio compression, providing progressively higher degrees of compression at the expense of increasing complexity. The third layer, referred to as MPEG-1-L3 or MP3, provides an audio compression format widely used in consumer audio applications. The format is based on a psychoacoustic or perceptual model that allows significant levels of data compression (e.g., typically 12:1 for standard compact disk (CD) digital audio data using 16-bit samples sampled at 44.1 kHz), whilst maintaining high quality sound reproduction, as perceived by a human listener. Nevertheless, it remains desirable to provide even higher levels of data compression, yet such improvements in compression are usually attended by an undesirable degradation in perceived sound quality. Accordingly, it is desired to address the above or at least to provide a useful alternative. 
   BRIEF SUMMARY OF THE INVENTION 
   In accordance with one aspect an embodiment provides a process for encoding audio data, including: 
   determining a first encoding parameter for encoding a block of audio data if a temporal masking transient is not detected in said block of audio data; and 
   determining a second encoding parameter for encoding said block of audio data if a temporal masking transient is detected in said block of audio data, to enable greater compression of said audio data. 
   In accordance with another aspect, an embodiment provides a scalefactor generator for an audio encoder, said scalefactor generator adapted to generate scalefactors for use in quantizing respective portions of a block of audio data if a temporal masking transient is not detected in said block of audio data; and to select one of said scalefactors for use in quantizing each of said portions if a temporal masking transient is detected in said block of audio data to enable greater compression of said audio data. 
   In accordance with another aspect, an embodiment provides a scalefactor modifier for an audio encoder, said scalefactor modifier adapted to output scalefactors for use in quantizing respective portions of a block of audio data if a temporal masking transient is not detected in said block of audio data; and to select one of said scalefactors for use in quantizing each of said portions if a temporal masking transient is detected in said block of audio data to enable greater compression of said audio data. 
   In accordance with another aspect, an audio encoder comprises: an input preprocessor to receive a block of audio data and to detect a presence of a temporal masking transient in the block of audio data; psychoacoustic modeling circuitry coupled to the input preprocessor to generate masking data related to the block of audio data; and iteration loop circuitry, wherein the audio encoder is configured to: encode the block of data using a first protocol if a temporal masking transient is not detected in the block of audio data; encode the block of data using a second protocol if a temporal masking transient is detected in the block of audio data and a first criteria is satisfied; and selectively encode the block of data using a third protocol if a temporal masking transient is detected in the block of audio data and the first criteria is not satisfied. 
   In accordance with another aspect, a method of encoding a block of audio data comprises: encoding the block of data using a first protocol if a temporal masking transient is not detected in the block of audio data; encoding the block of data using a second protocol if a temporal masking transient is detected in the block of audio data and a first criteria is satisfied; and encoding the block of data using a third protocol if a temporal masking transient is detected in the block of audio data and the first criteria is not satisfied. 

   
     BRIEF DESCRIPTION OF THE DRAWINGS 
     Embodiments are hereinafter described, by way of example only, with reference to the accompanying drawings, wherein: 
       FIG. 1  is a functional block diagram of an embodiment of an audio encoder; 
       FIG. 2  is a flow diagram for an embodiment of a scalefactor generation process suitable for use by an audio encoder; 
       FIG. 3  is a bar chart of the increase in compression of encoded audio data generated by an embodiment of an audio encoder, such as the audio encoder illustrated in  FIG. 1 , over that generated by a prior art audio encoder; and 
       FIG. 4  is a graph comparing the quality of encoded audio data generated by an embodiment of an audio encoder, such as the audio encoder illustrated in  FIG. 1 , and a prior art audio encoder. 
   

   DETAILED DESCRIPTION OF THE INVENTION 
   As shown in  FIG. 1 , an audio encoder  100  includes an input pre-processing module  102 , a fast Fourier transform (FFT) analysis module  104 , a masking threshold generator module  106 , a windowing module  108 , a filter bank and modified discrete cosine transform (MDCT) module  110 , a joint stereo coding module  112 , a scalefactor generator module  114 , a scalefactor modifier module  115 , a quantization module  116 , a noiseless coding module  118 , a rate distortion/control module  120 , and a bit stream multiplexer module  122 . The audio encoder  100  executes an audio encoding process that generates an encoded audio data stream  124  from an input audio data stream  126 . The encoded audio data stream  124  constitutes a compressed representation of the input audio data stream  126 . 
   The FFT analysis module  104  and the masking threshold generator module  106  together comprise a psychoacoustic modeling module  128 . The scalefactor generator module  114 , the scalefactor modifier module  115 , the quantization module  116 , the noiseless coding module  118 , and the rate distortion/control module  120  together comprise an iteration loop module  130 . 
   In the described embodiment, the audio encoder  100  may be a standard digital signal processor (DSP), such as a TMS320 series DSP manufactured by Texas Instruments, and the modules  102 - 122 ,  128 - 130  of the encoder  100  may be software modules stored in the firmware of the DSP-core. However, some or all of the audio encoding modules  102 - 122 ,  128 - 130  could alternatively be implemented as dedicated hardware components such as application-specific integrated circuits (ASICs). Although the components of the audio encoder  100  are referred to as modules and will be separately identifiable as either software modules and/or circuitry in one embodiment, the components need not necessarily be separately identifiable in all embodiments and various functions may be combined and/or circuitry in an embodiment may perform one or more of the functions of the various modules. In some embodiments, a computer readable storage medium having stored thereon program code may be employed. For example, in an embodiment, a computer readable storage medium having stored thereon program code for executing the steps of: determining a first encoding parameter for encoding a block of audio data if a temporal masking transient is not detected in said block of audio data; and determining a second encoding parameter for encoding said block of audio data if a temporal masking transient is detected in said block of audio data to enable greater compression of said audio data, may be employed. 
   The audio encoding process executed by the encoder  100  performs encoding steps based on MPEG-1 layer 3 processes described in the MPEG-1 standard. The input audio data  126  may be a time-domain pulse code modulated (PCM) digital audio data, which may be of DVD quality, using a sample rate of 48,000 samples per second. As described in the MPEG-1 standard, the time-domain input audio data stream  126  is divided into 32 sub-bands and (modified) discrete cosine transformed by the filter bank and MDCT module  110 , and the resulting frequency-domain (spectral) data undergoes stereo redundancy coding, as performed by the joint stereo coding module  112 . The scalefactor generator module  114  then generates scalefactors that determine the quantization resolution, as described below, and the audio data is then quantized by the quantization module  116  using quantization parameters determined by the rate distortion/control module  120 . The bit stream multiplexer module  122  then generates the encoded audio data or bit stream  124  from the quantized data. 
   The quantization module  116  performs bit allocation and quantization based upon masking data generated by the masking threshold generator  106 . The masking data is generated from the input audio data stream  126  on the basis of a psychoacoustic model of human hearing and aural perception. The psychoacoustic modeling takes into account the frequency-dependent thresholds of human hearing, and a psychoacoustic phenomenon referred to as masking, whereby a strong frequency component close to one or more weaker frequency components tends to mask the weaker components, rendering them inaudible to a human listener. This makes it possible to omit the weaker frequency components when encoding audio data, and thereby achieve a higher degree of compression, without adversely affecting the perceived quality of the encoded audio data stream  124 . The masking data comprises a signal-to-mask ratio value for each frequency sub-band. These signal-to-mask ratio values represent the amount of signal masked by the human ear in each frequency sub-band, and are therefore also referred to as masking thresholds. The quantization module  116  uses this information to decide how best to use the available number of data bits to represent the input audio data stream  126 , as described in the MPEG-1 standard. Information describing how the available bits are distributed over the audio spectrum is included as side information in the encoded audio bit stream  124 . 
   The MPEG-1 standard specifies the layer 3 encoding of audio data in long blocks comprising three groups of twelve samples (i.e., 36 samples) over the 32 sub-bands, making a total of 1152 samples. However, the encoding of long blocks gives rise to an undesirable artifact if the long block contains one or more sharp transients, for example, a period of silence followed by a percussive sound, such as from a castanet or a triangle. The encoding of a long block containing a transient can cause relatively large quantization errors which are spread across an entire frame when that frame is decoded. In particular, the encoding of a transient typically gives rise to a pre-echo, where the percussive sound becomes audible prior to the true transient. To alleviate this effect, the MPEG-1 standard specifies the layer 3 encoding of audio data using two block lengths: a long block of 1152 samples, as described above, and a short block of twelve samples for each sub-band, i.e., 12*32=384 samples. The short block is used when a transient is detected to improve the time resolution of the encoding process when processing transients in the audio data, thereby reducing the effects of pre-echo. 
   A psychoacoustic effect referred to as temporal masking can disguise such effects. In particular, the human auditory system is insensitive to low level sounds in a period of approximately 20 milliseconds prior to the appearance of a much louder sound. Similarly, a post-masking effect renders low level sounds inaudible for a period of up to 200 milliseconds after a comparatively loud sound. Accordingly, the use of short coding blocks for encoding transients can mask pre-echoes if the time spread is of the order of a few milliseconds. Furthermore, MPEG-1 layer 3 encoding processes control pre-echo by reducing the threshold of hearing used by the masking threshold generator module  106  when a transient is detected. 
     FIG. 2  illustrates a scalefactor generation process that can be employed by an audio encoder, such as the audio encoder  100  illustrated in  FIG. 1 . With reference to  FIG. 1 , the encoder  100  generates scalefactors for use by the quantization module  116  and the rate distortion/control module  120  to determine suitable quantization parameters for quantizing spectral components of the audio data. When encoding blocks of spectral data which do not contain appreciable transients, the data is encoded in long blocks of 1152 samples, as described above. The process begins at step  202  by determining whether the block of spectral data from the joint stereo coding module  112  is a long block or a short block, indicating whether a transient was detected by the input pre-processing module  102 . If the block is a long block, and hence no transient was detected, standard processing is therefore performed at step  204 . That is, scalefactors are generated by the scalefactor generator  114  in accordance with the MPEG-1 layer 3 standard. These scalefactors are then passed to the quantization module  116 . Alternatively, if a short block has been passed to the scalefactor generator  114 , then a test is performed at step  206  to determine whether standard pre-echo control, as described above, is to be used. If so, then the process performs standard processing at step  204 . This involves limiting the value of the scalefactors to reduce transient pre-echo, as described in the MPEG-1 standard. Alternatively, if standard pre-echo control is not invoked at step  206 , then three scalefactors scf m , m=1, 2, 3 are generated by the scalefactor generator  114  at step  208  for three respective groups of twelve spectral coefficients generated by the filter bank and MDCT module  110 . 
   At step  210 , the scalefactor modifier  115  selects the greatest of these three scalefactors as scf max . Thus instead of normalizing the three groups of spectral coefficients by their respective scalefactors, as per the MPEG-1 layer 3 standard, all three groups of coefficients can be normalized by the maximum scalefactor scf max . The use of the maximum scalefactor reduces the dynamic range of the encoded spectral coefficients. The Huffman coding performed by the noiseless coding module  118  ensures that input samples which occur more often are assigned fewer bits. Consequently, quantization and coding of these smaller values results in fewer bits in the encoded audio data  124 ; i.e., greater compression. 
   However, normalizing by a greater scalefactor would also increase the quantization error. In particular, the signal-to-noise ratio for the m th  spectral coefficient (SNR m ) is given by 
                     SNR   m     =         10   ·   log     ⁢           ⁢       P   s         κ   m   2     ⁢     P   n           =         10   ·   log     ⁢           ⁢       P   s       P   n         -       10   ·   log     ⁢           ⁢     κ   m   2             ,             where               κ   m     =       scf   max       scf   m                   
where P s  is the signal power, and P n  is the quantization noise power, given by;
 
             P   n     =       ∫       -   Δ     /   2       Δ   /   2       ⁢         e   2     ·     p   ⁡     (   e   )         ⁢     ⅆ   e               
where, e represents the error, i.e., the difference between a true spectral coefficient and its quantized value, p(e) is the probability density function of the quantization error, and Δ is the quantizer step size. The value of Km is determined at step  212 . In the case of linear quantizers, the error is uniformly distributed over a range −Δ/2 to +Δ/2, where Δ is the quantizer step size. A varies for power law quantizers, which are used in MPEG 1 Layer 3 encoders.
 
   Accordingly, the degree of degradation Err m  of the SNR m  resulting from using the maximum scalefactor value is given by:
 
 Err   m =20. log κ m  
 
   This degree of degradation Err m  is determined at step  214 . 
   At step  216 , the sound energy E m , m=1, 2, 3 in each group of 12 samples is determined from the MDCT coefficients X m (k), as follows: 
   
     
       
         
           
             
               E 
               m 
             
             = 
             
               
                 ∑ 
                 
                   k 
                   - 
                   1 
                 
                 12 
               
               ⁢ 
               
                 
                   
                     X 
                     m 
                   
                   ⁡ 
                   
                     ( 
                     k 
                     ) 
                   
                 
                 2 
               
             
           
           , 
         
       
     
   
   The energy in each group is used to determine the duration of the temporal pre-masking and post-masking effects of the transient signal under consideration, as described below. 
   In a short block, the scalefactors are generated from the MDCT spectrum, which depends on the 12 samples output from each sub-band filter of the filter bank and MDCT module  110 . In standard MP3 encoders, 3 sets of 12 samples are grouped together. 
   Applying the principles of temporal masking to short blocks, if the signal energy E 2  in the second group is higher than the signal energy E 1  of the previous set of 12 samples, the effect of the first set of samples will be masked by the first set due to pre-masking. This is possible as 12 samples at a sampling rate of 48,000 samples per second corresponds to a period of 8 ms. Similarly, 24 samples correspond to 16 ms, which is smaller than the 20 ms pre-masking period. 
   In the human auditory system, post-masking is more dominant than pre-masking. Consequently, quantization errors are more likely to be perceived when relying on pre-masking. The worst cases occur when the third set of 12 samples is relied on to pre-mask the previous 24 samples. Consequently, a test is performed at step  218  to detect this situation by determining whether the energies of each group of 12 samples are in ascending order, i.e., whether E 1 &lt;E 2 &lt;E 3 . If the energies of the 12 samples are not in ascending order, at step  220  the encoder  100  sets the scale modification factor to the maximum scale modification factor determined at step  210 . If the energies of the 12 samples are in ascending order, then a further test is performed at step  222  by comparing the degradation Err m  of the SNR that would result from using the maximum scalefactor to the SNR associated with quantization noise. If the noise Err m  introduced by increasing the scalefactors is greater than 30% of the SNR, the encoder  100  performs standard processing at step  204 ; i.e., the respective scalefactors scf m  are used, as per the MPEG-1 layer 3 standard. If the noise Err m  introduced by increasing the scalefactors is not greater than 30% of the SNR, the encoder  100  proceeds to step  220  and sets the scale modification factor to the maximum scale modification factor determined at step  210 . The encoder  100  may employ other error criteria. For example, another threshold percentage, such as 25%, can be employed to determine whether the noise Err m  introduced by increasing the scalefactors is too large. 
   The scalefactor modifier  115  is activated only after the scalefactors are generated at step  208 . This ensures that higher numbers of bits are not allocated for the modified scalefactors and allows the effect of temporal masking to be taken into account. 
   The encoded audio stream  124  generated by the audio encoder  100  is compatible with any standard MPEG-1 Layer 3 decoder. In order to quantify the improved compression of the encoder, it was used to encode 17 audio files in the waveform audio ‘.wav’ format and sizes of the resulting encoded files are compared with those for a standard MPEG Layer 3 encoder in  FIG. 3 . To achieve a higher compression, both encoders were tested at variable bit rates and using the lowest quality factor.  FIG. 3  shows that, for the particular audio files tested, the improvement in compression produced by the audio encoder is at least 1%, and is nearly 10% in some cases. The amount of compression will, of course, depend on the number of transients present in the input audio data stream  126 . 
   In order to assess the quality of the audio encoder, a quality-testing software program known as OPERA (Objective PERceptual Analyzer) was used. This program objectively evaluates the quality of wide-band audio signals by simulating the human auditory system. OPERA is based on the most recent perceptual techniques, and is compliant with PEAQ (Perceptual Evaluation of Audio Quality), an ITU-R standard. 
   Using OPERA, the quality of the ISO MPEG-1 Layer 3 encoder was compared to that of the audio encoder  100 .  FIG. 4  is a graph comparing objective difference grade (ODG) values generated for each of the ‘.wav’ files represented in  FIG. 3  and the corresponding input audio data stream  126 . The ODG values for the audio encoder  100  are joined by a solid line  402  and those for a standard MP3 audio encoder are shown as a dashed line  404 . ODG values can range from −4.0 to 0.4, with more positive ODG values indicating better quality. A zero or positive ODG value corresponds to an imperceptible impairment, and −4.0 corresponds to an impairment judged as annoying. The tradeoff in quality due to higher compression of the audio files is apparent by the marginally more negative ODG values  402  for the audio encoder  100  compared to those  404  for the standard MP3 audio encoder. As can be observed, files with higher compression have a marginally lower ODG value, with a typical higher compression ratio of 4-5% leading to a decrease in ODG value by only 0.16. 
   Although the audio encoding process described above has been described in terms of determining scalefactors for use in quantizing audio data to generate MPEG audio data, it will be apparent that alternative embodiments of the invention can be readily envisaged in which encoding errors produced by any lossy audio encoding process are allowed to increase in selected portions of audio data that are masked by temporal transients. Thus the resulting degradation in quality, which would be apparent if the encoding errors were not masked, is instead hidden from a human listener by the psychoacoustic effects of temporal masking. 
   Many modifications will be apparent to those skilled in the art without departing from the scope of the present invention as herein described with reference to the accompanying drawings. 
   All of the above U.S. patents, U.S. patent application publications, U.S. patent applications, foreign patents, foreign patent applications and non-patent publications referred to in this specification and/or listed in the Application Data Sheet, are incorporated herein by reference, in their entirety. 
   From the foregoing it will be appreciated that, although specific embodiments of the invention have been described herein for purposes of illustration, various modifications may be made without deviating from the spirit and scope of the invention. Accordingly, the invention is not limited except as by the appended claims.