Scalable lossless audio codec and authoring tool

An audio codec losslessly encodes audio data into a sequence of analysis windows in a scalable bitstream. This is suitably done by separating the audio data into MSB and LSB portions and encoding each with a different lossless algorithm. An authoring tool compares the buffered payload to an allowed payload for each window and selectively scales the losslessly encoded audio data, suitably the LSB portion, in the non-conforming windows to reduce the encoded payload, hence buffered payload. This approach satisfies the media bit rate and buffer capacity constraints without having to filter the original audio data, reencode or otherwise disrupt the lossless bitstream.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to lossless audio codecs and more specifically to a scalable lossless audio codec and authoring tool.

2. Description of the Related Art

Numbers of low bit-rate lossy audio coding systems are currently in use in a wide range of consumer and professional audio playback products and services. For example, Dolby AC3 (Dolby digital) audio coding system is a world-wide standard for encoding stereo and 5.1 channel audio sound tracks for Laser Disc, NTSC coded DVD video, and ATV, using bit rates up to 640 kbit/s. MPEG I and MPEG II audio coding standards are widely used for stereo and multi-channel sound track encoding for PAL encoded DVD video, terrestrial digital radio broadcasting in Europe and Satellite broadcasting in the US, at bit rates up to 768 kbit/s. DTS (Digital Theater Systems) Coherent Acoustics audio coding system is frequently used for studio quality 5.1 channel audio sound tracks for Compact Disc, DVD video, Satellite Broadcast in Europe and Laser Disc and bit rates up to 1536 kbit/s.

An improved codec offering 96 kHz bandwidth and 24 bit resolution is disclosed in U.S. Pat. No. 6,226,616 (also assigned to Digital Theater Systems, Inc.). That patent employs a core and extension methodology in which the traditional audio coding algorithm constitutes the ‘core’ audio coder, and remains unaltered. The audio data necessary to represent higher audio frequencies (in the case of higher sampling rates) or higher sample resolution (in the case of larger word lengths), or both, is transmitted as an ‘extension’ stream. This allows audio content providers to include a single audio bit stream that is compatible with different types of decoders resident in the consumer equipment base. The core stream will be decoded by the older decoders which will ignore the extension data, while newer decoders will make use of both core and extension data streams giving higher quality sound reproduction. However, this prior approach does not provide truly lossless encoding or decoding. Although the system of U.S. Pat. No. 6,226,216 provides superior quality audio playback, it does not provide “lossless” performance.

Recently, many consumers have shown interest in these so-called “lossless” codecs. “Lossless” codecs rely on algorithms which compress data without discarding any information. As such, they do not employ psychoacoustic effects such as “masking”. A lossless codec produces a decoded signal which is identical to the (digitized) source signal. This performance comes at a cost: such codecs typically require more bandwidth than lossy codecs, and compress the data to a lesser degree.

The lack of compression can cause a problem when content is being authored to a disk, CD, DVD, etc., particularly in cases of highly un-correlated source material or very large source bandwidth requirements. The optical properties of the media establish a peak bit rate for all content that can not be exceeded. As shown inFIG. 1, a hard threshold10, e.g., 9.6 Mbps for DVD audio, is typically established for audio so that the total bit rate does not exceed the media limit.

The audio and other data is laid out on the disk to satisfy the various media constraints and to ensure that all the data that is required to decode a given frame will be present in the audio decoder buffer. The buffer has the effect of smoothing the frame-to-frame encoded payload (bit rate)12, which can fluctuate wildly from frame-to-frame, to create a buffered payload14, i.e. the buffered average of the frame-to-frame encoded payload. If the buffered payload14of the lossless bitstream for a given channel exceeds the threshold at any point the audio input files are altered to reduce their information content. The audio files may be altered by reducing the bit-depth of one or more channels such as from 24-bit to 22-bit, filtering a channel's frequency bandwidth to low-pass only, or reducing the audio bandwidth such as by filtering information above 40 kHz when sampling at 96 kHz. The altered audio input files are re-encoded so that the payload16never exceeds the threshold10. An example of this process is described in the SurCode MLP—Owner's Manual pp. 20-23.

This is a very computationally and time inefficient process. Furthermore, although the audio encoder is still lossless, the amount of audio content that is delivered to the user has been reduced over the entire bitstream. Moreover, the alteration process is inexact, if too little information is removed the problem may still exist, if too much information is removed audio data is needlessly discarded. In addition, the authoring process will have to be tailored to the specific optical properties of the media and the buffer size of the decoder.

SUMMARY OF THE INVENTION

The present invention provides an audio codec that generates a lossless bitstream and an authoring tool that selectively discards bits to satisfy media, channel, decoder buffer or playback device bit rate constraints without having to filter the audio input files, reencode or to otherwise disrupt the lossless bitstream.

This is accomplished by losslessly encoding the audio data in a sequence of analysis windows into a scalable bitstream, comparing the buffered payload to an allowed payload for each window, and selectively scaling the losslessly encoded audio data in the non-conforming windows to reduce the encoded payload, hence the buffered payload thereby introducing loss.

In an exemplary embodiment, the audio encoder separates the audio data into most significant bit (MSB) and least significant bit (LSB) portions and encodes each with a different lossless algorithm. An authoring tool writes the MSB portions to a bitsteam, writes the LSB portions in the conforming windows to the bitstream, and scales the lossless LSB portions in the conforming windows to the bitstream, and scales the lossless LSB portion of any non=conforming frames to make them conform and writes the now lossy LSB portions to the bitstream. The audio decoder decodes the MSB and LSB portions and reassembles the PCM audio data.

The audio encoder splits each audio sample into the MSB and LSB portions, encodes the MSB portion with a first lossless algorithm, encodes the LSB portion with a second lossless algorithm, and packs the encoded audio data into a scalable, lossless bitstream. The boundary point between the MSB and LSB portions is suitably established by the energy and/or maximum amplitude of samples in an analysis window. The LSB bit widths are packed into the bitstream. The LSB portion is preferably encoded so that some or all of the LSBs may be selectively discarded. Frequency extensions may be similarly encoded with MSB/LSB or entirely encoded as LSBs.

An authoring tool is used to lay out the encoded data on a disk (media). The initial layout corresponds to the buffered payload. The tool compares the buffered payload to the allowed payload for each analysis window to determine whether the layout requires any modification. If not, all of the lossless MSB and LSB portions of the lossless bitstream are written to a bitstream and recorded on the disk. If yes, the authoring tool scales the lossless bitstream to satisfy the constraints. More specifically, the tool writes the lossless MSB and LSB portion for all of the conforming windows and the headers and lossless MSB portions for the non-conforming to a modified bitstream. Based on a prioritization rule, for each non-conforming window the authoring tool then determines how many of the LSBs to discard from each audio sample in the analysis window for one or more audio channels and repacks the LSB portions into the modified bitstream with their modified bit widths. This is repeated for only those analysis windows in which the buffered payload exceeds the allowed payload.

A decoder receives the authored bitstream via the media or transmission channel. The audio data is directed to a buffer, which does not overflow on account of the authoring, and in turn provides sufficient data to a DSP chip to decode the audio data for the current analysis window. The DSP chip extracts the header information and extracts, decodes and assembles the MSB portions of the audio data. If all of the LSBs were discarded during authoring, the DSP chip translates the MSB samples to the original bit width word and outputs the PCM data. Otherwise, the DSP chip decodes the LSB portions, assembles the MSB & LSB samples, translates the assembled samples to the original bit width word and outputs the PCM data.

DETAILED DESCRIPTION OF THE INVENTION

The present invention provides a lossless audio codec and authoring tool for selectively discarding bits to satisfy media, channel, decoder buffer or playback device bit rate constraints without having to filter the audio input files, reencode or to otherwise disrupt the lossless bitstream.

As shown inFIG. 2, an audio encoder20losslessly encodes the audio data in a sequence of analysis windows and packs the encoded data and header information into a scalable, lossless bitstream22, which is suitably stored in an archive24. The analysis windows are typically frames of encoded data but as used herein the windows could span a plurality of frames. Furthermore, the analysis window may be refined into one or more segments of data inside a frame, one or more channel sets inside a segment, one or more channels in each channel set and finally one or more frequency extensions inside a channel. The scaling decisions for the bitstream can be very coarse (multiple frames) or more refined (per frequency extension per channel set per frame).

An authoring tool30is used to lay out the encoded data on a disk (media) in accordance with the decoder's buffer capacity. The initial layout corresponds to the buffered payload. The tool compares the buffered payload to the allowed payload for each analysis window to determine whether the layout requires any modification. The allowed payload is typically a function of the peak bit rate supported by a media (DVD disk) or transmission channel. The allowed payload may be fixed or allowed to vary if part of a global optimization. The authoring tool selectively scales the losslessly encoded audio data in the non-conforming windows to reduce the encoded payload, hence the buffered payload. The scaling process introduces some loss into the encoded data but is confined to only the non-conforming windows and is suitably just enough to bring each window into conformance. The authoring tool packs the lossless and lossy data and any modified header information into a bitstream32. The bitstream32is typically stored on a media34or transmitted over a transmission channel36for subsequent playback via an audio decoder38, which generates a single or multi-channel PCM (pulse code modulated) audio stream40.

In an exemplary embodiment as shown inFIGS. 3 and 4, the audio encoder20splits each audio sample into a MSB portion42and a LSB portion44(step46). The boundary point48that separates the audio data is computed by first assigning a minimum MSB bit width (Min MSB)50that establishes a minimum coding level for each audio sample. For example, if the bit width52of the audio data is20-bit the Min MSB might be16-bit. It follows that the maximum LSB bit width (Max LSB)54is the Bit Width52minus the Min MSB50. The encoder computes a cost function, e.g. the L2or L∞norms, for the audio data in the analysis window. If the cost function exceeds a threshold, the encoder calculates an LSB bit width56of at least one bit and no more than Max LSB. If the cost function does not exceed the threshold, the LSB bit width56is set to zero bits. In general, the MSB/LSB split is done for each analysis window. As described above, this is typically one or more frames. The split can be further refined for each data segment, channel set, channel or frequency extension, for example. More refinement improves coding performance at the cost of additional computations and more overhead in the bitstream.

The encoder losslessly encodes the MSB portions (step58) and LSB portions (step60) with different lossless algorithms. The audio data in the MSB portions is typically highly correlated both temporally within any one channel and between channels. Therefore, the lossless algorithm suitably employs entropy coding, fixed prediction, adaptive prediction and joint channel decorrelation techniques to efficiently code the MSB portions. A suitable lossless encoder is described in copending application “Lossless Multi-Channel Audio Codec” filed on AUG. 4, 2004, which is hereby incorporated by reference. Other suitable lossless encoders include MLP (DVD Audio), Monkey's audio (computer applications), Apple lossless, Windows Media Pro lossless, AudioPak, DVD, LTAC, MUSICcompress, OggSquish, Philips, Shorten, Sonarc and WA. A review of many of these codecs is provided by Mat Hans, Ronald Schafer “Lossless Compression of Digital Audio” Hewlett Packard, 1999.

Conversely, the audio data in the LSB portion is highly uncorrelated, closer to noise. Therefore sophisticated compression techniques are largely ineffective and consume processing resources. Furthermore, to efficiently author the bitstream, a very simple lossless code using simplistic prediction of very low order followed by a simple entropy coder is highly desirable. In fact, the currently preferred algorithm is to encode the LSB portion by simply replicating the LSB bits as is. This will allow individual LSBs to be discarded without having to decode the LSB portion.

The encoder separately packs the encoded MSB and LSB portions into a scalable, lossless bitstream62so that they can be readily unpacked and decoded (step64). In addition to the normal header information, the encoder packs the LSB bit width56into the header (step66). The header also includes space for an LSB bit width reduction68, which is not used during encode. This process is repeated for each analysis window (frames, frame, segment, channel set or frequency extension) for which the split is recalculated.

As shown inFIGS. 5,6and7, the authoring tool30allows a user to make a first pass at laying out the audio and video bitstreams on the media in accordance with the decoder's buffer capacity (step70) to satisfy the media's peak bit rate constraint. The authoring tool starts the analysis window loop (step71), calculates an buffered payload (step72) and compares the buffered payload to the allowed payload for the analysis window73to determine whether the lossless bitstream requires any scaling to satisfy the constraints (step74). The allowed payload is determined by buffer capacity of the audio decoder and the peak bit rate of the media or channel. The encoded payload is determined by the bit width of the audio data and the number of samples in all of the data segments75plus the header76. If the allowed payload is not exceeded, the losslessly encoded MSB and LSB portions are packed into respective MSB and LSB areas77and78of the data segments75in a modified bitstream79(step80). If the allowed payload is never exceeded, the lossless bitstream is transferred directly to the media or channel.

If the buffered payload exceeds the allowed payload, the authoring tool packs the headers and losslessly encoded MSB portions42into the modified bitstream79(step81). Based on a prioritization rule, the authoring tool calculates an LSB bit width reduction68that will reduce the encoded payload, hence buffered payload to at most the allowed payload (step82). Assuming the LSB portions were simply replicated during lossless encoding, the authoring tool scales the LSB portions (step84) by preferably adding dither to each LSB portion so as to dither the next LSB bit past the LSB bit width reduction, and then shifting the LSB portion to the right by the LSB bit width reduction to discard bits. If the LSB portions were encoded, they would have to be decoded, dithered, shifted and reencoded. The tool packs the now lossy encoded LSB portions for the now conforming windows into the bitstream with the modified LSB bit widths56and the LSB bit width reduction68and a dither parameter (step86).

As shown inFIG. 6, the LSB portion44has been scaled from a bit width of 3 to a modified LSB bit width56of 1-bit. The two discarded LSBs88match the LSB bit width reduction68of 2 bits. In the exemplary embodiment, the modified LSB bit width56and LSB bit width reduction68are transmitted in the header to the decoder. Alternately, either of these could be omitted and the original LSB bit width transmitted. Any one of the parameters is uniquely determined by the other two.

The benefits of the scalable, lossless encoder and authoring tool are best illustrated by overlaying the buffered payload90for the authored bitstream onFIG. 1as is done inFIG. 8. Using the known approach of altering the audio files to remove content and then simply reencoding with the lossless coder, the buffered payload14was effectively shifted downward to a buffered payload16that is less than the allowed payload10. To ensure that the peak payload is less than the allowed payload, a considerable amount of content is sacrificed across the entire bitstream. By comparison, the buffered payload90replicates the original losslessly buffered payload14except in those few windows (frames) where the buffered payload exceeds the allowed payload. In these areas, the encoded payload, hence buffered payload is reduced just enough to satisfy the constraint and preferably no more. As a result, the payload capacity is utilized more efficiently and more content is delivered to the end user without having to alter the original audio files or reencode.

As shown inFIGS. 9,10and11, the audio decoder38receives an authored bitstream via a disk100. The bitstream is separated into a sequence of analysis windows, each including header information and encoded audio data. Most of the windows include losslessly encoded MSB and LSB portions, the original LSB bit widths and LSB bit width reductions of zero. To satisfy the payload constraints set by the peak bit rate of the disk100and the capacity of the buffer102, some of the windows include the losslessly encoded MSB portions and lossy LSB portions, the modified bit widths of the lossy LSB portions, and the LSB bit width reductions.

A controller104reads the encoded audio data from the bitstream on the disk100. A parser106separates the audio data from the video and streams the audio data to the audio buffer102, which does not overflow on account of the authoring. The buffer in turn provides sufficient data to a DSP chip108to decode the audio data for the current analysis window. The DSP chip extracts the header information (step110) including the modified LSB bit widths56, LSB bit width reduction68, a number of empty LSBs112from an original word width and extracts, decodes and assembles the MSB portions of the audio data (step114). If all of the LSBs were discarded during authoring or original LSB bit width was 0 (step115), the DSP chip translates the MSB samples to the original bit width word and outputs the PCM data (step116). Otherwise, the DSP chip decodes the lossless and lossy LSB portions (step118), assembles the MSB & LSB samples (step120), and, using the header information, translates the assembled samples to the original bit width word (step122).

Multi-Channel Audio Codec & Authoring Tool

An exemplary embodiment of an audio codec and authoring tool for an encoded audio bitstream presented as a sequence of frames is illustrated inFIGS. 12-15. As shown inFIG. 12, each frame200comprises a header202for storing common information204and sub-headers206for each channel set that store the LSB bit widths and LSB bit width reductions, and one or more data segments208. Each data segment comprises one or more channel sets210with each channel set comprising one or more audio channels212. Each channel comprises one or more frequency extensions214with at least the lowest frequency extension including encoded MSB and LSB portions216,218. The bitstream has a distinct MSB and LSB split for each channel in each channel set in each frame. The higher frequency extensions may be similarly split or entirely encoded as LSB portions.

The scalable lossless bitstream from which this bitstream is authored is encoded as illustrated inFIGS. 13aand13b. The encoder sets the bit width of the original word (24-bit), the Min MSB (16-bit), a threshold (Th) for the squared L2 norm and a scale factor (SF) for that norm (step220). The encoder starts the frame loop (step222) and the channel set loop (step224). Because the actual width of the audio data (20-bit) may be less than the original word width, the encoder calculates the number of empty LSBs (24−20=4)(min number of “0” LSBs in any PCM sample in the current frame) and right shifts every sample by that amount (step226). The bit width of the data is the original bit width (24) minus the number of empty LSBs (4) (step228). The encoder then determines the maximum number of bits (Max LSBs) that will allow to be encoded as part of the LSB portion as Max(Bit Width-Min MSB,0) (step230). In the current example, the Max LSBS=20−16=4 bits.

To determine the boundary point for splitting the audio data into MSB and LSB portions, the encoder starts the channel loop index (step232) and calculates the L∞norm as the maximum absolute amplitude of the audio data in the channel and the squared L2 norm as the sum of the squared amplitudes of the audio data in the analysis window (step234). The encoder sets a parameter Max Amp as the minimum integer greater than or equal to log2(L∞) (step236) and initializes the LSB bit width to zero (step237). If the Max Amp is greater than the Min MSB (step238), the LSB bit width is set equal to the difference of the Max Amp and Min MSB (step240). Otherwise, if the L2 norm exceeds the Threshold (small amplitude but considerable variance) (step242), the LSB bit width is set equal to the Max Amp divided by the Scale Factor, typically >1 (step244). If both tests are false, the LSB bit width remains zero. In other words, to maintain the minimum encode quality, e.g. Min MSB, no LSBs are available. The encoder clips the LSB bit width at the Max LSB value (step246) and packs the value into the sub-header channel set (step248).

Once the boundary point has been determined, i.e. the LSB bit width, the encoder splits the audio data into the MSB and LSB portions (step250). The MSB portion is losslessly encoded using a suitable algorithm (step252) and packed into the lowest frequency extension in the particular channel in the channel set of the current frame (step254). The LSB portion is losslessly encoded using a suitable algorithm, e.g. simple bit replication (step256) and packed (step258).

This process is repeated for each channel (step260) for each channel set (step262) for each frame (step264) in the bitstream. Furthermore, the same procedure may be repeated for higher frequency extensions. However, because these extensions contain much less information, the Min MSB may be set to 0 so that it is all encoded as LSBs.

Once the scalable lossless bitstream is encoded for certain audio content, an authoring tool creates the best bitstream it can that satisfies the peak bit rate constraints of the transport media and the capacity of the buffer in the audio decoder. As shown inFIG. 14, a user attempts to layout the lossless bitstream268on the media to conform to the bit rate and buffer capacity constrains (step270). If successful, the lossless bitstream268is written out as the authored bitstream272and stored on the media. Otherwise the authoring tool starts the frame loop (step274) and compares the buffered payload (buffered average frame-to-frame payload) to the allowed payload (peak bit rate) (step276). If the current frame conforms to the allowed payload, the losslessly encoded MSB and LSB portions are extracted from the lossless bitstream268and written to the authored bitstream272and the frame is incremented.

If the authoring tool encounters a non-conforming frame in which the buffered payload exceeds the allowed payload, the tool computes the maximum reduction that can be achieved by discarding all of the LSB portions in the channel set and subtracts it from the buffered payload (step278). If the minimum payload is still too big the tool displays an error message that includes the amount of excess date and frame number (step280). In this case either the Min MSB shall be reduced or the original audio files shall be altered and re-encoded.

Otherwise, the authoring tool calculates an LSB bit width reduction for each channel in the current frame based on a specified channel prioritization rule (step282) such that:Bit Width Reduction[nCh]<LSB bit width[nCh] for nCh=0, . . . AllChannels−1, andBuffered payload[nfr]−Σ(Bit Width Reduction[nCh}* NumSamplesin Frame)< Allowed Payload [nFr]

The reduction of the LSB bit widths by these values will ensure that the frame conforms to the allowed payload. This is done with a minimum amount of loss being introduced into the non-conforming frames and without otherwise affecting the lossless conforming frames.

The authoring tool adjusts the encoded LSB portions (assuming bit replication encoding) for each channel by adding dither to each LSB portion in the frame to dither the next bit and then right shifting by the LSB bit width reduction (step284). Adding dither is not necessary but is highly desirable in order to decorrelate the quantization errors and also make them decorrelated from the original audio signal. The tool packs the now lossy scaled LSB portions (step286), the modified LSB bit widths and LSB bit width reductions for each channel (step288) and the modified stream navigation points (step290) into the authored bitstream. If dither is added, a dither parameter is packed into the bitstream. This process is then repeated for each frame (step292) before terminating (step294).

As shown inFIGS. 15aand15b, a suitable decoder synchronizes to the bitstream (step300) and starts a frame loop (step302). The decoder extracts the frame header information including the number of segments, number of samples in a segment, number of channel sets, etc (step304) and extracts the channel set header information including the number of channels in the set, number of empty LSBs, LSB bit width, LSB bit width reduction for each channel set (step306) and stores it for each channel set (step307).

Once the header information is available, the decoder starts the segment loop (step308) and channel set loop (step310) for the current frame. The decoder unpacks and decodes the MSB portions (step312) and stores the PCM samples (step314). The decoder then starts the channel loop in the current channel set (step316) and proceeds with the encoded LSB data.

If the modified LSB bit width does not exceed zero (step318), the decoder starts the sample loop in the current segment (step320), translates the PCM samples for the MSB portion to the original word width (step322) and repeats until the sample loop terminates (step324).

Otherwise, the decoder starts the sample loop in the current segment (step326), unpacks and decodes the LSB portions (step328) and assembles PCM samples by appending the LSB portion to the MSB portion (step330). The decoder then translates the PCM sample to the original word width using the empty LSB, modified LSB bit width and LSB bit width reduction information from the header (step332) and repeats the steps until the sample loop terminates (step334). To reconstruct the entire audio sequence, the decoder repeats these steps for each channel (step336) in each channel set (step338) in each frame (step340).

Backward Compatible Scalable Audio Codec

The scalability properties can be incorporated into a backward compatible lossless encoder, bitstream format and decoder. A “lossy” core code stream is packed in concert with the losslessly encoded MSB and LSB portions of the audio data for transmission (or recording). Upon decoding in a decoder with extended lossless features, the lossy and lossless MSB streams are combined and the LSB stream is appended to construct a lossless reconstructed signal. In a prior-generation decoder, the lossless MSB and LSB extension streams are ignored, and the core “lossy” stream is decoded to provide a high-quality, multichannel audio signal with the bandwidth and signal-to-noise ratio characteristic of the core stream.

FIG. 16ashows a system level view of a scalable backward compatible encoder400. A digitized audio signal, suitably M-bit PCM audio samples, is provided at input402. Preferably, the digitized audio signal has a sampling rate and bandwidth which exceeds that of a modified, lossy core encoder404. In one embodiment, the sampling rate of the digitized audio signal is 96 kHz (corresponding to a bandwidth of 48 kHz for the sampled audio). It should also be understood that the input audio may be, and preferably is, a multichannel signal wherein each channel is sampled at 96 kHz. The discussion which follows will concentrate on the processing of a single channel, but the extension to multiple channels is straightforward. The input signal is duplicated at node406and handled in parallel branches. In a first branch of the signal path, a modified lossy, wideband encoder404encodes the signal. The modified core encoder404, which is described in detail below, produces an encoded data stream (corestream408) which is conveyed to a packer or multiplexer410. The corestream408is also communicated to a modified corestream decoder412, which produces as output a modified, reconstructed core signal414, which is right shifted by N bits (>>N415) to discard its N lsbs.

Meanwhile, the input digitized audio signal402in the parallel path undergoes a compensating delay416, substantially equal to the delay introduced into the reconstructed audio stream (by modified encode and modified decoders), to produce a delayed digitized audio stream. The audio stream is split into MSB and LSB portions417as described above. The N-bit LSB portion418is conveyed to the packer410. The M-N bit reconstructed core signal414, which was shifted to align with the MSB portion, is subtracted from the MSB portion of the delayed digitized audio stream419at subtracting node420. (Note that a summing node could be substituted for a subtracting node, by changing the polarity of one of the inputs. Thus, summing and subtracting may be substantially equivalent for this purpose).

Subtracting node420produces a difference signal422which represents the difference between the M-N MSBs of the original signal and the reconstructed core signal. To accomplish purely “lossless” encoding, it is necessary to encode and transmit the difference signal with lossless encoding techniques. Accordingly, the M-N bit difference signal422is encoded with a lossless encoder424, and the encoded M-N bit signal426packed or multiplexed with the core stream408in packer410to produce a multiplexed output bitstream428. Note that the lossless coding produced coded lossless streams418and426which are at a variable bit rate, to accommodate the needs of the lossless coder. The packed stream is then optionally subjected to further layers of coding including channel coding, and then transmitted or recorded. Note that for purposes of this disclosure, recording may be considered as transmission through a channel.

The core encoder404is described as “modified” because in an embodiment capable of handling extended bandwidth the core encoder would require modification. A 64-band analysis filter bank within the encoder discards half of its output data and encodes only the lower 32 frequency bands. This discarded information is of no concern to legacy decoders that would be unable to reconstruct the upper half of the signal spectrum in any case. The remaining information is encoded as per the unmodified encoder to form a backwards-compatible core output stream. However, in another embodiment operating at or below 48 kHz sampling rate, the core encoder could be a substantially unmodified version of a prior core encoder. Similarly, for operation above the sampling rate of legacy decoders, the core decoder412would need to be modified as described below. For operation at conventional sampling rate (e.g., 48 kHz and below) the core decoder could be a substantially unmodified version of a prior core decoder or equivalent. In some embodiments the choice of sampling rate could be made at the time of encoding, and the encode and decode modules reconfigured at that time by software as desired.

As shown inFIG. 16b, the method of decoding is complementary to the method of encoding. A prior generation decoder can decode the lossy core audio signal by simply decoding the corestream408and discarding the lossless MSB and LSB portions. The quality of audio produced in such a prior generation decoder will be extremely good, equivalent to prior generation audio, just not lossless.

Referring now toFIG. 16b, the incoming bitstream (recovered from either a transmission channel or a recording medium) is first unpacked in unpacker430, which separates the corestream408from lossless extension data streams418(LSB) and426(MSB). The core stream is decoded by a modified core decoder432, which reconstructs the core stream by zeroing out the un-transmitted sub-band samples for the upper 32 bands in a 64-band synthesis during reconstruction. (Note, if a standard core encode was performed, the zeroing out is unnecessary). The MSB extension field is decoded by a lossless MSB decoder434. Because the LSB data was losslessly encoded using bit replication no decoding is necessary.

After decoding core and lossless MSB extensions in parallel, with the interpolated core reconstructed data is right shifted by N bits436and combined with the lossless portion of the data by adding in summer438. The summed output is left shifted by N bits440to form the lossless MSB portion442and assembled with the N-bit LSB portion444, to produce a PCM data word446that is a lossless, reconstructed representation of the original audio signal402.

Because the signal was encoded by subtracting a decoded, lossy reconstruction from the exact input signal, the reconstructed signal represents an exact reconstruction of the original audio data. Thus, paradoxically, the combination of a lossy codec and a losslessly coded signal actually performs as a pure lossless codec, but with the additional advantage that the encoded data remains compatible with prior generation, lossless decoders. Furthermore, the bitstream can be scaled by selectively discarding LSBs to make it conform to media bit rate constraints and buffer capacity.