METHOD AND APPARATUS FOR TRANSMITTING CODED AUDIO SIGNALS THROUGH A TRANSMISSION CHANNEL WITH LIMITED BANDWIDTH

Abstract: A digital audio transmitter system (10) capable of transmitting high quality, wideband speech over a transmission channel with a limited bandwidth such as a traditional telephone line (16). The digital audio transmitter system (10) includes a coder (32) for coding an input audio signal to a digital signal having a transmission rate that does not exceed the maximum allowable transmission rate for traditional telephone lines and a decoder (40) for decoding the digital signal to provide an output audio signal with an audio bandwidth of wideband speech. A coder (32) and a decoder (40) may be provided in a single device (12) to allow two-way communication between multiple devices.

Description: METHOD AND APPARATUS FOR TRANSMITTING CODED AUDIO SIGNALS THROUGH A TRANSMISSION CHANNEL WITH LIMITED BANDWIDTH RELATED APPLICATION The present application relates to co-pending PCT application PCT/US96/04974, filed April 10, 1996, entitled "System For Compression and Decompression of Audio Signals For Digital Transmission" by the same inventor and assigned to the Assignee of the present application. The co-pending PCT application noted above is incorporated by reference in its entirety along with any appendices and attachments thereto. FIELD OF THE INVENTION The present invention relates generally to an apparatus and method for transmitting audio signals and pertains, more specifically, to an apparatus and method for transmitting a high quality audio signal, such as wideband speech, through a transmission channel having a limited bandwidth or transmission rate. BACKGROUND OF THE INVENTION Human speech lies in the frequency range of approximately 7 Hz to 10 kHz. Because traditional telephone systems only provide for the transmission of analog audio signals in the range of about 300 Hz to 3400 Hz or a bandwidth of about 3 kHz (narrowband speech) , certain characteristics of a speaker's voice are lost and the voice sounds somewhat muffled. A telephone system capable of transmitting an audio signal SUBSTITUTESHEET(RULE 2$) approaching the quality of face-to-face speech requires a bandwidth of about 6 kHz (wideband speech) . Known digital transmission systems are capable of transmitting wideband speech audio signals. However, in order to produce an output audio signal of acceptable quality with a bandwidth of 6 kHz, these digital systems require a transmission channel with a transmission rate that exceeds the capacity of traditional telephone lines. A digital system transmits audio signals by coding an input audio signal into a digital signal made up of a sequence of binary numbers or bits, transmitting the digital signal through a transmission channel, and decoding the digital signal to produce an output audio signal. During the coding process the digital signal is reduced or compressed to minimize the necessary transmission rate of the signal. One known method for compressing wideband speech is disclosed in Recommendation G.722 (CCITT, 1988) . A system using the compression method described in G.722 still requires a transmission rate of at least 48 kbit/s to produce wideband speech of an acceptable quality. Because the maximum transmission rate over traditional telephone lines is 28.8 kbit/s using the most advanced modem technology, alternative transmission channels such as satellite or fiber optics would have to be used with an audio transmission system employing the data compression method disclosed in G.722. Use of these alternative transmission channels is both expensive and inconvenient due to their limited availability. While fiber optic lines are available, traditional copper telephone lines now account for an overwhelming majority of existing lines and it is unlikely that this balance will change anytime in the near future. A digital phone system capable of transmitting wideband speech over existing transmission rate limited telephone phone lines is therefore highly desirable. OBJECTS OF THE INVENTION The disclosed invention has various embodiments that achieve one or more of the following features or objects: An object of the present invention is to provide for the transmission of high quality wideband speech over existing telephone networks. A further object of the present invention is to provide for the transmission of high quality audio signals in the range of 20 Hz to at least 5,500 Hz over existing telephone networks. A still further object of the present invention is to accomplish data compression on wideband speech signals to produce a transmission rate of 28.8 kbit/s or less without significant loss of audio quality. A still further object of the present invention is to provide a device which allows a user to transmit and receive high quality wideband speech and audio over existing telephone networks. A still further object of the present invention is to provide a portable device which is convenient to use and allows ease of connection to existing telephone networks. A still further object of the present invention is to provide a device which is economical to manufacture. A still further object of the present invention is to provide easy and flexible programmability. SUMMARY OF THE INVENTION In accordance with the present invention, the disadvantages of the prior art have been overcome by providing a digital audio transmitter system capable of transmitting high quality, wideband speech over a transmission channel with a limited bandwidth such as a traditional telephone line. More particularly, the digital audio transmitter system of the present invention includes a coder for coding an input audio signal to a digital signal having a transmission rate that does not exceed the maximum allowable transmission rate for traditional telephone lines and a decoder for decoding the digital signal to provide an output audio signal with an audio bandwidth of wideband speech. A coder and a decoder may be provided in a single device to allow two-way communication between multiple devices. A device containing a coder and a decoder is commonly referred to as a CODEC (COder/DECoder) . These and other objects, advantages and novel features of the present invention, as well as details of an illustrative embodiment thereof, will be more fully understood from the following description and from the drawings. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram of a digital audio transmission system including a first CODEC and second CODEC in accordance with the present invention. Fig. 2 is a block diagram of a CODEC of Fig. l. Fig. 3 is a block diagram of an audio input/output circuit of a CODEC. Fig. 4 is a detailed circuit diagram of the audio input portion of Fig. 3. Fig. 5 is a detailed circuit diagram of the level LED's portion of Fig. 3. Fig. 6 is a detailed circuit diagram of the headphone amp portion of Fig. 3. Fig. 7 is a block diagram of a control processor of a CODEC. Fig. 8 is a detailed circuit diagram of the microprocessor portion of the control processor of Fig. 7. Fig. 9 is a detailed circuit diagram of the memory portion of the control processor of Fig. 7. Fig. 10 is a detailed circuit diagram of the dual UART portion of the control processor of Fig. 7. Fig. 11 is a detailed circuit diagram of the keypad, LCD display and interface portions of the control processor of Fig. 7. Fig. 12 is a block diagram of an encoder of a CODEC. Fig. 13 is a detailed circuit diagram of the encoder digital signal processor and memory portions of the encoder of Fig. 12. Fig. 14 is a detailed circuit diagram of the clock generator portion of the encoder of Fig. 12. Fig. 15 is a detailed circuit diagram of the Reed- Soloman encoder and decoder portions of Figs. 12 and 16. Fig. 16 is a block diagram of a decoder of a CODEC. Fig. 17 is a detailed circuit diagram of the encoder digital signal processor and memory portions of the decoder of Fig. 16. Fig. 18 is a detailed circuit diagram of the clock generator portion of the decoder of Fig. 16. Fig. 19 is a detailed circuit diagram of the analog/digital converter portion of the encoder of Fig. 12. Fig. 20 is a detailed circuit diagram of the digital/analog converter portion of the decoder of Fig. 16. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT A digital audio transmission system 10, as shown in Fig. 1, includes a first CODEC (COder/DECoder) 12 for transmitting and receiving a wideband audio signal such as wideband speech to and from a second CODEC 14 via a traditional copper telephone line 16 and telephone network 17. When transmitting an audio signal, the first CODEC 12 performs a coding process on the input analog audio signal which includes converting the input audio signal to a digital signal and compressing the digital signal to a transmission rate of 28.8 kbit/s or less. The preferred embodiment compresses the digital using a modified version of the ISO/MPEG (International Standards Organization/Motion Picture Expert Groups) compression scheme according to the software routine disclosed in the microfiche software appendix filed herewith. The coded digital signal is sent using standard modem technology via the telephone line 16 and telephone network 17 to the second CODEC 14. The second CODEC 14 performs a decoding process on the coded digital signal by correcting transmission errors, decompressing the digital signal and reconverting it to produce an output analog audio signal. Fig. 2 shows a CODEC 12 which includes an analog mixer 20 for receiving, amplifying, and mixing an input audio signal through a number of input lines. The input lines may include a MIC line 22 for receiving an analog audio signal from a microphone and a generic LINE 24 input for receiving an analog audio signal from an audio playback device such as a tape deck. The voltage level of an input audio signal on either the MIC line 22 or the generic LINE 24 can be adjusted by a user of the CODEC 12 by adjusting the volume controls 26 and 28. When the analog mixer 20 is receiving an input signal through both the MIC line 22 and the generic LINE 24, the two signals will be mixed or combined to produce a single analog signal. Audio level LED's 30 respond to the voltage level of a mixed audio signal to indicate when the voltage exceeds a desired threshold level. A more detailed description of the analog mixer 20 and audio level LED's 30 appears below with respect to Figs. 3 and 4. The combined analog signal from the analog mixer 20 is sent to the encoder 32 where the analog signal is first converted to a digital signal. The sampling rate used for the analog to digital conversion is preferably one-half the transmission rate of the signal which will SUBSTITUTESHEET(RULE26 ultimately be transmitted to the second CODEC 14 (shown in Fig. 1) . After analog to digital conversion, the digital signal is then compressed using a modified version of the ISO/MPEG algorithm. The ISO/MPEG compression algorithm is modified to produce a transmission rate of 28.8 kbit/s. This is accomplished by the software routine that is disclosed in the software appendix. The compressed digital signal from the encoder 32 is then sent to an error protection processor 34 where additional error protection data is added to the digital signal. A Reed-Solomon error protection format is used by the error protection processor 34 to provide both burst and random error protection. The error protection processor 34 is described below in greater detail with respect to Figs. 12 and 15. The compressed and error protected digital signal is then sent to an analog modem 36 where the digital signal is converted back to an analog signal for transmitting. As shown in Fig. 1, this analog signal is sent via a standard copper telephone line 16 through a telephone network 17 to the second CODEC 14. The analog modem 36 is preferably a V.34 synchronous modem. This type of modem is commercially available. The analog modem 36 is also adapted to receive an incoming analog signal from the second CODEC 14 (or another CODEC) and reconvert the analog signal to a digital signal. This digital signal is then sent to an error correction processor 38 where error correction according to a Reed-Soloman format is performed. The corrected digital signal is then sent to a decoder 40 where it is decompressed using the modified version of the ISO/MPEG algorithm as disclosed in the software appendix. After decompression the digital signal is converted to an analog audio signal. A more detailed description of the decoder 40 appears below with respect to Figs. 7, 16, 17 and 18. The analog audio signal may then be perceived by a user of the CODEC 12 by routing the analog audio signal through a headphone amp 42 wherein the signal is amplified. The volume of the audio signal at the headphone output line 44 is controlled by volume control 46. The CODEC 12 includes a control processor 48 for controlling the various functions of the CODEC 12 according to software routines stored in memory 50. A more detailed description of the structure of the control processor appears below with respect to Figs. 7, 8, 9, 10, and 11. One software routine executed by the control processor allows the user of the CODEC 12 to initiate calls and enter data such as phone numbers. When a call is initiated the control processor sends a signal including the phone number to be dialed to the analog modem 36. Data entry is accomplished via a keypad 52 and the entered data may be monitored by observation of an LCD 54. The keypad 52 also includes keys for selecting various modes of operation of the CODEC 12. For example, a user may select a test mode wherein the control processor 48 controls the signal path of the output of the encoder to input of decoder to bypass the telephone network allows testing of compression and decompression algorithms and their related hardware Also stored in memory 50 is the compression algorithm executed by the encoder 32 and the decompression algorithm executed by the decoder 40. Additional LED's 56 are controlled by the control processor 48 and may indicate to the user information such as "bit synchronization" (achieved by the decoder) or "power on". An external battery pack 58 is connected to the CODEC 12 for supplying power. Fig. 3 shows a lower level block diagram of the analog mixer 20, audio level LED's 30 and analog headphone amp 42 as shown in Fig. 2. Figs. 4, 5 and 6 are the detailed circuit diagrams corresponding to Fig. 3. Referring to Fig. 3 and 4, line input 210 is an incoming line level input signal while mic input 220 is the microphone level input. These signals are amplified by a line amp 300 and a mic amp 302 respectively and their levels are adjusted by line level control 304 and mic level control 306 respectively. The microphone and line level inputs are fed to the input mixer 308 where they are mixed and the resulting combined audio input signal 310 is developed. Referring now to Figs. 3 and 5, the audio input signal 310 is sent to the normal and overload signal detectors, 312 and 314 respectively, where their level is compared to a normal threshold 316 which defines a normal volume level and a clip threshold 318 which defines an overload volume level. When the audio input signal 310 is at a normal volume level a NORM LED 320 is lighted. When the audio input signal 310 is at an overload volume level a CLIP LED 322 is lighted. Referring now to Figs. 3 and 6, the audio input signal 310 is fed into the record monitor level control 324, where its level is adjusted before being mixed with the audio output signal 336 from the digital/analog converter 442 (shown in Fig. 16 and 20) . The audio output signal 336 is fed to the local monitor level control 326 before it is fed into the headphone mixer amplifier 334. The resulting output signal from the headphone mixer amplifier 334 goes to a headphone output connector 338 on the exterior of the CODEC 12 where a pair of headphones may be connected. The audio input signal 310 and audio output signal 336 are fed to record mix control 328 which is operable by the user. The output of this control is fed to a mix level control 330 (also operable by a user) and then to the record output amplifier 332. The resulting output signal of the record output amplifier 332 goes to a record output 340 on the exterior of the CODEC 12. Fig. 7 shows a lower level block diagram of the control processor 48 (shown in Fig. 2) . The encoder 406 (referenced as number 32 in Fig. 2) is further described in Fig. 12 while the decoder 416 (referenced as number 40 in Fig. 2) is refined in Fig. 16. Figs. 8, 9, 10, 11, 13, 14, 15, 17, 18, 19 and 20 are detailed circuit diagrams. Referring to Figs. 7 and 8 the microprocessor 400 is responsible for the communication between the user, via keypad 412 and LCD display 414, and the CODEC 12. The keypad 412 is used to input commands to the system while the LCD display 414, is used to display the responses of the keypad 412 commands as well as alert messages generated by the CODEC 12. Referring now to Figs. 7 and 9, the RAM (random access memory) 402 is used to hold a portion of the control processor control software routines. The flash ROM (read only memory) 404 holds the software routine (disclosed in the software appendix) which controls the modified ISO/MPEG compression scheme performed by encoder DSP 406 and the modified ISO/MPEG decompression scheme performed by the decoder DSP 416, as well as the remainder of the control processor control software routines. Referring now to Figs. 7 and 10, the dual UART (universal asynchronous receiver/transmitter) 408 is used to provide asynchronous input/output for the control processor 48. The rear panel remote control port 409 and the rear panel RS232 port 411 are used to allow control by an external computer. This external control can be used in conjunction with or instead of the keypad 412 and/or LCD display 414. Referring now to Figs. 7 and 11, the programmable interval timer circuit 410 is used to interface the control processor with the keypad and LCD display. Referring now to Figs. 7, 8 and 13, the encoder DSP (digital signal processor) 434 receives a digital pulse code modulated signal 430 from the analog/digital converter 450. The encoder DSP 434 performs the modified ISO/MPEG compression scheme according to the software routine (described in the software appendix) stored in RAM memory 436 to produce a digital output 418. The A/D clock generation unit 439 is shown in Figs. 12 and 14. The function of this circuitry is to provide all the necessary timing signals for the analog digital converter 450 and the encoder DSP 434. The Reed-Soloman error correction encoding circuitry 438 is shown in Figs. 12 and 15. The function of this unit is to add parity information to be used by the Reed-Soloman decoder 446 (also shown in Fig. 16) to repair any corrupted bits received by the Reed-Soloman decoder 446. The Reed-Soloman corrector 438 utilizes a shortened Reed-Soloman GF(256) code which might contain, for example, code blocks containing 170 eight-bit data words and 8 eight-bit parity words. Referring now to Figs. 7, 16 and 17, the decoder DSP 440 receives a digital input signal 422 from the modem 36 (shown in Fig. 2) . The decoder DSP 440 performs the modified ISO/MPEG decompression scheme according to the software routine (described in the software appendix) stored in RAM memory 444 to produce a digital output to be sent to the digital/analog converter 442. The D/A clock generation unit 448 is shown in Figs. 16 and 18. The function of this circuitry is to provide all the necessary timing signals for the digital/analog converter 442 and the decoder DSP 440. The analog/digital converter 450, shown in Figs. 12 and 19, is used to convert the analog input signal 310 into a PCM digital signal 430. The digital/analog converter 442, shown in Figs. 16 and 20 is used to convert the PCM digital signal from the decoder DSP 440 into an analog audio output signal 336. The Reed-Soloman error correction decoding circuitry 446, shown in Figs. 15 and 16, decodes a Reed- Soloman coded signal to correct errors produced during transmission of the signal through the modem 36 (shown in Fig. 2) and telephone network. Another function contemplated by this invention is to allow real time, user operated adjustment of a number of psycho-acoustic parameters of the ISO/MPEG compression/decompression scheme used by the CODEC 12. A manner of implementing this function is described in applicant's application entitled "System For Adjusting Psycho-Acoustic Parameters In A Digital Audio Codec" which is being filed concurrently herewith (such application and related Software Appendix are hereby incorporated by reference) . Also, applicants application entitled "System For Compression And Decompression Of Audio Signals For Digital Transmission" and related Software Appendix which are being filed concurrently herewith are hereby incorporated by reference. This invention has been described above with reference to a preferred embodiment. Modifications and variations may become apparent to one skilled in the art upon reading and understanding this specification. It is intended to include all such modifications and alterations within the scope of the appended claims. (c 1955 Copyright Corporate Computer Systems, Inc All rignts reserved. nolist \DGCST\def .asm This file contains the definitions for various structures. The following is the minimum value for sib. The true value is -1 but that causes some computational difficulities so -120 db is used. The minimum value (2**-23) is about -138 db so there is some room left below -120 db define MINDB .6228589' ;-120 dB in slb's define MINDB .73' ;-120 dB in slb's Define the 10 for the watch dog timer for bit set and bit clears define WATCH_DOG ' #7,x: <<SFFE ' ; M_PBD bit 7 watch dog time: The following defines the sampling rates define SAM32K ;sampling rate of 32 kHz define SAM48K :sampling rate of 48 kHz 28.6 3 define SAM16K sampling rate of 14.4 kHz define SAM24K sampling rate of 14.4 kHz define SAM16K sampling rate of 16 kHz define SAM24K sampling rate of 24 kHz !28.8 3 define SAM441K :sampling rate of 44.1 kHz !28.8 define SAMTYPE ;set the sampling rate to 14.4 kHz 126.1 The following defines various parameters define NUMPFFT '1024' ;numoer of points used by tne fft The following define the types of maskers. ENDMSKR is not counted in the nmaskers count . define DE ETEDMSKR '0' the masker type of deleted define NONTONAL '1' the masker type of non-tonal define TONAL '2' the masker type of tonal define ENDMSKR '3' the last masker in the array The following define a tonal structure. This structure occupies both x an y memory (i; define TONALSSIZE '2' length of the structure define TONALSP RDB '0' offset to the tonal power (1/ define TONALSBIN '1' offset to the bin (x) define MAXTONALS '50' the maxi urr number cf tonals The following define the sync info for the receiver The sync pattern may be in general any NSYNC bits. The SYNCMSK must contain NSYNC 's right justified and is used to isolate the sync word. MUSICAM uses 12 l's as the sync word. sync pattern left justifed mask high order from getvalue len sync word (hdr bits 0-11) For framing purposes by the decoder and unpadded frames, 24 bits are used : the 1st 12 bits must be l's the next 4 bits are the 1st 4 bits of frame header of the constant 'C (1100) ; skip over the next 4 bits of the frame header that are reserved for the bit rate the next 2 bits (01) of the frame header that represent sampling rate: '01' = 48 K sampling rate '10' = 32 K sampling rate !! 128.8 '00' = 24 K sampling rate (14 4 K rate) '00' = 16 K sampling rate (14.4 K rate) '11' = 24 K sampling rate '00' = 16 K sampling rate ! ! !28.8 the next 2 constant 0 bits of the frame header. The SYNCMSK must conform to the right justified framing sync pattern is used to isolate the sync word. define FRAMESYNC_48K '$fffc04' ;sync pattern for 48 K sampling define FRAMESYNC_32K r $fffc08' ;sync pattern for 32 K sampling ! ! 128.8 define FRAMESYNC_24K 'SfffcOC ;sync pattern for 24 K sampling define FRAMESYNC_24K '$fffc00' ;sync pattern - 14.4 K sampling define FRAMESYNC_16K '$fffc00' ;sync pattern - 14.4 K sampling define FRAMESYNC_16K 'SfffcOO' ;sync pattern for 16 K sampling ! ' 128.8 define FRAMENSY C '24' ;len sync word (hdr bits 0-23) define FRAMESYNCMSK '$ffff0f .mask reflect framing sync ptn define GETSYNCMSK '$000fff .mask high order from getvalue The following define the number of bits used by the fixed part of the MUSICA frame. define NSYST '20' ; length of the system info header define the use of protection check sum or not define CRC_NO_PROTECT '0' ; protection does not apply define CRC_PROTECT '1' ; protection applies define NCRCBITS '16' ; 16 bit check sum define MASKCRC '$00ffff .mask high order from getvalue define CRC_SUM_BIT_OFFSET '16' ; 16th bit offset start at bit rate ; to calculate checksum define CRC_VALUE ' $800500' ; checksum divisor define CRC_STORED_BIT_OFFSET '16' ; bit offset to store checksum following the 32 bit header define the number of bits to be included in the checksum for the header and the checksum itself for one channel in mono f SAD ORIGINAL define CRC 3ITS_A 32' in i bits from hdr & checksum define C : " BITS B 142' inci bits per used channel BALs - 88, SBits = 54 code for the new ISO frame header (these are coded as left justified) define SYSTHDR_l_NO_PROT 'SOOOOOd' bits 12-15 : 1101 (4 bits 1 define SYSTHDR_l_NO_PROT_LO ' $000005' bits 12-15. 0101 .4 bits; define SYSTHDR_l_PROTECT 'S00000C bits 12-15: 1100 (4 bits* define SYSTHDR 1 PROTECT LOW '$000004' bits 12-15: 0100 (4 bits) define SYSTHDR 2 '$000000' ; hdr bits 22-23: 00 (2 bits) se Copyright bit to indicate to decoder if CCS compression applies: bit 28: 0 means NO CCS compression 1 means audio coded with CCS compression define SYSTHDR_3_NO_CCS_COMPRESS '$000000' ; bits 28-31. OO0C (4 1 define SYSTHDR 3 CCS COMPRESS '$000008' ; bits 28-31.1000 (4 define NSYSTHDR_1 '4' ; 4 bits for header field 1 define NSYSTHDR_2 '2' , 2 bits for header field 2 define NSYSTHDR_3 '4' ; 4 bits for header field 3 define MASKSYSTHDR_1 • $00000f ;mask high order from getvalue define MASKSYSTHDR_2 '$000003' ;mask high order from getvalue define MASKSYSTHDR 3 '$00000f ;mask high order from getvalue codes for the type of framing (2 bits in bits 24-25 of frame header) define FULL_STEREO $000000' 00 stereo-left & right channels define JOINT_STEREO $000001' 01 stereo ιntensιty-2 channels define DUAL $000002' 10 dual-2 channels define MONO $000003' 11 mono-1 channel only define NFRAMETYPE 2' ; 2 bits for type of frame field define MASKFRAMETYPE $000003' ;mask high order from getvalue bit flags for controlling the type of framing during bit allocation - coding define STEREO vs_MONO 0' 0 = 2 channels, 1 = one define LEFT_vs_RIGHT '1' 0 « left channel, 1 = right define JOINT_FRAMING 2' 0 •, not JOINT STEREO, 1 = yes define JOINT_at_FULL '3' FULL Stereo upgrade allocation 1 - YES at full, 0 = joint define JOINT at SB BOUND has stereo intensity sub-band boundary been reached: 0 • NO, 1 ■= YES define FIRST_TIME 5' did loop thru allocation tests make any new bit allocation 0 - yes, 1 - no define MASKING_PA≤S ' 6' allocate to masking threshold- 0-YES, l»no (ALL are below; define HEARING_PASS , η , alloc to threshold of hearing. 0-YES, l=no (ALL are below define FINAL_PASS allocate pass of what's left 0 = NO, 1 = YES define AT_LIMIT_SUBBAND 9' does NOT req at least 1 alloc define AT_USED_SUBBAND ' 10' above used sub-band limit define SUMMARY ALARM 16' did any alarm αet sensed 0 = NO, 1 = YES SUBSTITUTE SHEET (RULE ?8> should checksum (CRC16) protec 0 = NO, 1 = YES output to only one channel 0 = left, 1 - right output mono to both channels 0 = NO only one, 1 = YES left channel music vs tone 0 = NO only one, 1 = YES right channel music vs tone 0 = NO only one, l = YES encode low or high sample rate 0 = low, l = high ;decoding overload flag define SKF ZERO '3' ;sensed a zero scale factor ; 0 = no, 1 = yes /define bit position flags for decoding frames with the CRC-16 checksum define USE_SAVED '6' /checksum failed use saved frame define FRAME_SAVED "? ' ,a good frame was saved for use define SAVE_FRAME '8' ,save this good frame for use define USING_SAVED '9' ;thιs frame is the saved frame define REFRAME '10' ,-cnt bit errors exceeded, reframe define decoder auto selection flags for; bit rate (determined by trying to frame at each of the two bit rate choices) type of audio data (MUSICAM frames or G722) (determined by not being able to frame at either of the two bit rate choices) sampling rate (determined from a MUSICAM frame header) (if NOT auto selected, some other switch sets the value) define AUTO_SELECT_BIT_RATE '11' ;0»NO, 1=YES define AUTO_SELECT_DATA_TYPE '12' ;0-N0, 1=YES define AUTO_SELECT_SAMPLE_RATE '13' ;0»NO, 1-YES define MUSICAM_vs_G722 '14' , 0-MUSICAM, 1=G722 define SAMPLE RATE LOW vs HIGH '15' ;0=low, l=hιgh ; this flag indicates if CCS compression applies to getdata.asm define DECOMPRESS_PACKED '16' ;thιs flag indicates that the framing process has previously determined ; that the input data to the MICRO decoder is a stream of MUSICAM frames define MUSICAM_INPUT_SET '17' ;0-NO, 1-YES ;define flag that the current frame has a sync word violation define NO_SYNC '21' ,-defιne flag that determines which ISO CRC-16 controls to use • 0 = OLD controls, seed with 0's and fixed span of bits covered 1 = NEW controls, seed with F's and dynamic span over the SBits define CRC OLD vs NEW 22' SUBSTITUTESHEET(RULE26, CT/US96/04835 17 :def ne the sub-band allocation AtLimit bit flags that control selection define MASKING_LIMIT '0' ;1 reached sub-band's masking threshold define HEARING_LIMIT '1' ,1 reached sub-band's hearing threshold define ALLOCATE_LIMIT '2' ,-1 reached sub-band;s max bit limit define NO ALLOCATE '3' , • 1 NO allocation at this sub-band ;define the standard limit of sub-bands requiring at least 1 level of ; allocation even if the signal is below the Global Masking Threshold define LIMITSUBBANDS 17' ;sub-bands 0 thru 16 get at least 1 ;define the number of successive frames that a sub-band did not need any bits , allocated before shuttting the sub-band from being allocated define FRAMELIMIT '4' codes for stereo intensity subband bound (2 bits 25-27 of frame header) define INTENSITY_4 '$000000' 00 subbands 4-31 intensity mode define INTENSITY_8 '$000001' Cl subbands B-31 intensity mode define INTENSITY_12 '$000002' 10 subbands 12-31 intensity mode define INTENSITY 16 '$000003' 11 subbands 16-31 intensity mode define NSTINTENSITY '2' ; 2 bits for intensity boundary define MASKSTINTENSITY '$000003' ,-mask high order from getvalue stereo intensity boundary sub-band counts 0-3 full stereo, 4-31 intensity 0-7 full stereo, 8-31 intensity 0-11 full stereo 12-31 intensity 0-15 full stereo 16-31 intensity codes for output bit rates (4 bits in positions 16-19 of frame header) define BITRATE_FREE '$000000' 0000 <_. unknown kbits/s define BITRATE_32 '$000001' 0001 β 32 kbits/s define BITRATE_48 '$000002' 0010 β 48 kbits/s 128.8 3 define BITRATE 56 ' $000003' 0011 β 28.8 kbits/s define BIT ATE^*. '$000003' 0011 9 28.8 kbits/s define BITRATE_56 '$000003' 0011 ® 56 kbits/s define BITRATE_6 ' $000004' 0100 9 64 kbits/s 128.8 3 define BITRATE_80 '$000005' 0101 ® 80 kbits/s define BITRATE_96 '$000006' 0110 9 96 kbits/s define BITRATE_112 '$000007' 0111 ® 112 kbits/s define BITRATE_128 '$000008' 1000 ® 128 kbits/s define BITRATE_160 '$000009' 1001 ® 160 kbits/s define BITRATE_192 '$00000a' 1010 (B 192 kbits/s define BITRATE_224 '$00000b' 1011 β 224 kbits/s define BITRATE_256 '$O00OOC 1100 « 256 kbits/s define BITRATE_320 '$00000d' 1101 ® 320 kbits/s define BITRATE 384 ' $00000e' 1110 ® 384 kbits/s low sample rates 24000, 22050 and 16000 : codes for output tit rates (4 bits in positions 16-19 of frame header) define EITRATE FREE LOW '$000000' 0000 ® unknown kbits/s SUBSTITUTE SHEET (RULE 261 * AD ORIGINA 4835 - 18- αetme BITRATE 8_LOW S000001' 0001 S 8 Kbit S. s def ne BITRATE " l€_LOW S0000C2' CC10 ® 16 kbits, s define BITRATE " ' _LOW $000003' 0011 β 24 kbits/s define BITRATE " 32_LOW $000004' 0100 ® 32 kbits/s define BITRATE " 40 LOW $000005' 0101 ® 40 kbits/ε define BITRATE " 48~LOW $000006' 0110 ® 48 kbits/s define BITRATE " ' 56_LOW $000007' cm ® 56 kbits/s define BITRATE " ' 6 _LOW $000008' 1000 ® 64 kbits/s define BITRATE " ' 80_LOW $000009' 1001 ® 80 kbits/s define BITRATE " ' 6_LOW $00000a' 1010 ® 96 kbits/s define BITRATE " 112_LOW $00000b' 1011 ® 112 kbits/s define BITRATE " 128_LOW soooooc 1100 ® 128 kbits/s define BITRATE " 144_LOW $00000d' 1101 ® 144 kbits/s define BITRATE " 160 LOW SOOOOOe' 1110 ® 160 kbits/s define NBITRATE 4' ; 4 bits for bit rate code in hdr define MASKNBI RATE SOOOOOf ,-mask high order from getvalue codes for input sampling rate (2 bits in positions 20-21 of frame header 1 :28.8 def ne SAMPLE_ID_BIT_HIGH 1' define SAMPLINGRATE_16 ' $000000' define SAMPLINGRATE_24 '$000000' define SAMPLINGRATE_16 '$000000' define SAMPLINGRATE_48 '$000001' define SAMPLINGRATE_32 '$000002' define SAMPLINGRATE 24 '$000003' 128.8 define NSAMPLERATE '2' ,- 2 bits for sampling rate in hdi define MASKNSAMPLERATE '$000003' ,-mask high order from getvalue define NSBITS '2' ,- length of the scale factor select def ne MASKNSBITS '$000003' ,-mask high order from getvalue The following defines the masker structure. This structure occupies both x an y memory (l 1 define MASKERSSIZE '3' length of the structure define MASKERSPWRDB '0' offset to masker power :r watts and x for dB) define MASKERSRDPWRDB '0' offset to reduced power n db .VJ define MASKERSBIN '1' offset to bin number ,x> define MASKERSBFREQ '1' offset to freq in bark ,y) define MASKERSTYPE '2' offset to masker type (x) define MASKERSCRITBND '2' offset to msker crital band f noise y, ,-highest numoer of critical bands for all sampling rates define NUMMAXCRI BNDS '26' if SAMTYPE--SAM16K 126.8; define MAXCRITBNDS • 2 ,-number of critical bands 128.83 endif f SAMTYPE«SAM24K !28.8 ORIGINAL OM de f ine MAXCRITBNDS 21 ' ,- nuroDβ r c f c r 1 _ca_ oa αs de f ine MAXCRITBNDS 23 ' ,- number c f cri t _cal aa.-αs if SAMTYPE««SAM32K define MAXCRITBNDS 24' ,-numrιer of critical bands endif if SAMTYPE--SAM48K define MAXCRITBNDS '24' ,-number of critical bands endif 128.8 ,-number of critical bands at 14.4 K .-number of critical bands at 14 4 K ,-number of critical bands at 16 K ,-number of critical bands at 24 K ;number of critical bands at 32 K ;number of critical bands at 48 K rhe following defines the Aliasing structure rhis structure only occupies x or y memory define ALIA≤SIZE '2' ,- length of the structure define ALIASBIN '0' ;bιn number of aliaser (0-511) define ALIASPWRDB '1' ;power of the aliaser in sib General things define NUMSUBBANDS '32' ,-number of sub-bands define NUMBLOCKS '3' ,-number of blocks per super-frame define NUMPERBLK '364' ,-number of points per block define NUMPERSUBBAND '12' ,-number of points per sub-band define SKF '6' ,-number of bits per scale factor define MASKSKF '$00003f ;mask high order from getvalue define SKFX2 '64' ,-number of scale factors define BINSPERSUBBAND '16' ,-number of FFT bins per subband define NUMCHANNELS '2' ,-two channels: left and right define NUMSNRPOSITIONS '18' ,-18 Signal-to-Noise position codes define NUMINDEXES '16' ,-16 position codes Allowed per sub-band define MAXSUBBANDS_CCS '30' .-maximum sub-bands to ever be used define MINSUBBANDS_CCS '4' ;minimum sub-bands to ever be used define MAXSUBBANDS_LO '14' ,- low bit rate max sub-nands ever used define the used subbands for 64 and 56 KBits (sampling rate / 2) » max Hz / by 32 sub-bands - Hz per sub-oand based on sampling rate: 14400 ® 225 Hz per sub-band (14400/ (2*32 :NUMSUBBANDS 225 1 16000 Φ 250 Hz per sub-band (16000/ 12*32:NUMSUBBANDS 250> 24000 ® 375 Hz per sub-band (24000/ (2*32:NUMSUBBANDS 375) 32000 8 500 Hz per sub-band (32000/ (2*32:NUMSUBBANDS 500] 48000 ® 750 Hz per sub-band (48000/(2*32 : UMSUBBANDS 75C, also based on bandwidth code selection from a pair external .ches ■ 00 * CCS standard 01 = 1 sub-band less than standard 10 = 2 sub-bands less than standard 3 sub-bands less than standard define USEDSUBBANDS_00_16 define USEDSUBBANDS_01_16 define USEDSUBBANDS_10_16 define USEDSUBBANDS_11_16 .28.83 define USEDSUBBANDS_00_16 define USEDSUBBANDS_01_16 define USEDSU3BANDS_10_lβ define USEDSUBBANDS_11_16 define USEDSUBBANDS_00_16 define USEDSUBBANDS_01_16 define USEDSUBBANDS_10_16 define USEDSUBBANDS 11 16 28.8 :28.8 define USEDSUBBANDS_00_24 define USEDSUBBANDS_01_24 define USEDSUBBANDS_10_24 define USEDSUBBANDS_11_24 define USEDSUBBANDS_00_24 define USEDSUBBANDS_01_24 define USEDSUBBANDS_10_24 define USEDSUBBANDS_11_24 128.83 define USEDSUBBANDS_00_24 define USEDSUBBANDS_01_24 define USEDSUBBANDS_10_24 define USEDSUBBANDS 11 24 define USEDSUBBANDS_00_32 '20' 10000 Hz ® 32000 Hz sampling define USEDSUBBANDS_01_32 '19' 9500 Hz ® 32000 Hz sampling define USEDSUBBANDS_10_32 '18' 9000 Hz ® 32000 Hz sampling define USEDSUBBANDS_11_32 '17' 8500 Hz ® 32000 Hz sampling define USEDSUBBANDS_00_48 '11' 8250 Hz ® 48000 Hz sampling define USEDSUBBANDS_01_48 '10' 7500 Hz ® 48000 Hz sampling define USEDSUBBANDS_10_48 '9' 6750 Hz ® 48000 Hz sampling define USEDSUBBANDS 11 48 '8' 6000 Hz ® 48000 Hz sampling define INPCM ' 1152' NUMPERBLK*NUMBLOCKS define PCMSIZE '2560' NUMPERBLK+NUMBLOCKS*2+256 define PCMSIZE '1152' NUMPERBLK*NUMBLOCKS 111dbg1 ' ! define PCMSIZE '2304' NUMPERBLK*NUMBLOCKS*2 111dbg ! if SAMTYPE«SAM16K :28.83 define RATE56 '0' dip switch code for 28.8 Kbits define OUTM56 ' 96' 96 output words (2304 bits! define OUTB56 '2304' .080 * 2B800 define RATE64 '0' dip switch code for 28.8 Kbits define OUTM64 ' 96' 96 output words (2304 bits) define OUTB64 '2304' .080 * 28800 define RATE56 0' dip switch code for 56 Kbits define OUTM56 168' 168k output words (4032 bits! define OUTB56 4032' .072 * 56000 BAD ORIGINA ■ 21 - define RATE64 dip switch code for 64 Kbits define OUTM64 ' 192' 192k output words (4608 bits) define OUTB64 ' 4608' .072 * 64000 11128.8. endif if SAMTYPE«SAM24K 1128.8i define RATE56 ' 0' dip switch code for 28.8 Kbits define OUTM56 ' 96' 96 output words (2304 bits) define OUTB56 '2304' .080 * 28800 define RATE64 '0' dip switch code for 28.8 Kbits define 0UTM64 ' 96' 96 output words (2304 bits) define OUTB64 '2304' .080 * 28800 define RATE56 ' 0' dip switch code for 56 Kbits define OUTM56 '112' 112k output words (2688 bits) define OUTB56 '2688' .048 * 56000 define RATE64 ' 1' dip switch code for 64 Kbits define OUTM64 '128' 128k output words (3072 bits) define OUTB64 '3072' .048 * 640C0 128.8. endif if SAMTYPE==SAM32K dip switch code for 56 Kbits 84k output words (2016 bits) .036 * 56000 dip switch code for 64 Kbits 96k output words (2304 bits) .036 * 64000 dip switch code for 56 Kbits 56k output words (1344 bits! .024 * 64000 define RATE64 1' dip switch code for 64 Kbits define OUTM64 64' 64k output words (1536 bits) define OUTB64 1536' .024 * 64000 endif define RATE_L0 '0' ;dιp switch code for lower Kbit rate define RATE HI '1' ;dιp switch code for higher Kbit rate define framing bit rate values for sampling at 16 K define OUTM32_16 96' 96k output words (2304 bits) define OUTB32_16 2304' .072 * 32000 define OUTM48_16 144' 144k output words (3456 bits) define OUTB48_16 3456' .072 * 48000 128.8 define OUTM56_16 96' 96 output words (2304 bits) define OUTB56_16 2304 .080 * 28800 define OUTM64 16 96' 96 output words (2304 bits' SUBSTITUTE SHEET (RULE 26 ) BAD ORIGINAL define OUT364_16 2304' .080 * 28800 define OUTM56_16 16Θ' 168k output words (4032 Dits) define OUTB56_16 4032' .072 * 5 * 6000 define OUTM64_16 192' 192k output words (4608 bits, define OUTB64 16 4608' .072 * 64000 128.8 define framing bit rate values for sampling at 24 K 64k output words (1536 bits) .048 * 32000 96k output words (2304 bits) .048 * 48000 112B.8 96 output words (2304 bits) .080 * 28800 96 output words (2304 bits) .080 * 28800 112k output words (2688 bits) .048 * 56000 128k output words (3072 bits) .048 * 64000 1128.8 define framing bit rate values for sampling at 32 K define OUTM32_32 '48' 48k output words (1152 bits) define OUTB32_32 '1152' .036 * 32000 define OUTM48_32 '72' 72k output words (1728 bits) define OUTB48_32 '1728' .036 * 48000 define OUTM56_32 '84' 84k output words (2016 bits) define OUTB56_32 '2016' .036 * 56000 define OUTM64_32 ' 96' 96k output words (2304 bits) define OUTB64 32 '2304' .036 * 64000 define framing bit rate values for sampling at 48 K define OUTM32_48 '32' 32k output words (768 bits) define OUTB32_48 '768' .024 * 32000 define OUTM48_48 '48' 48k output words (1152 bits) define OUTB48_48 '1152' .024 * 48000 define OUTM56_48 '56' 56k output words (1344 bits) define OUTB56_48 ' 1344' .024 * 64000 define OUTM64_48 '64' 64k output words (1536 bits) define OUTB64_48 ' 1536' .024 * 64000 ;highest number of freqs used for coding for all sampling rates define MAXNMSKFREQS '132' . number of freqs used for coding based on defined sampling rates 128.8 define NMSKFREQS 132' ;number of freqs used for coding 11128.8i endif if SAMTYPE==SAM24K 128.8 BAD ORIGINAL SUBSTITUTE SHEET .RULE 26) L define NMSKFREQS 132' ,-num__er of freqs used for codmq 128.8 ' endif if SAMTYPE==SAM32K define NMSKFREQS 132' ,-number of freqs used for coding endif if SAMTYPE-=SAM48K define NMSKFREQS 126' ;number of freqs used for coding endif 128.8 define NMSKFREQS_16 132' ,-num freqs used for coding at 14.4 K define NMSKFREQS_24 132' ,-num freqs used for coding at 14.4 K define NMSKFREQS_16 132' ,-num freqs used for coding at 16 K define NMSKFREQS_24 132' ,-num freqs used for coding at 24 K 128.8 define NMSKFREQS_32 132' ,-num freqs used for coding at 32 K define NMSKFREQS 48 126' ,-num freqs used for coding at 48 K the following indicates if CCS compression for positions: 1, 2 and 3 define COMPRESS '0' ,-0 indicates no CCS compression define COMPRESS '1' ;1 indicates use CCS compression define uncompressed getdata () getvalue masks for unpack: upack3 , upackδ and upack9 define MASKUPACK3 'SOOOOlf' 5 bit getvalue retrieved define MASKUPACK5 '$00007f' 7 bit getvalue retrieved define MASKUPACK9 '$0003ff' 10 bit getvalue retrieved define CCS compress: getdata ( ) getvalue masks for unpack: upack3 , upack5, upackθ and upack9 define MASKUPACK3X SOOOOOf' 4 bit getvalue retrieved define MASKUPACK5X S00003f' 6 bit getvalue retrieved define MASKUPACK8X SOOOOff' 8 bit getvalue retrieved define MASKUPACK9X $0003ff' 10 bit getvalue retrieved needed by the decoder rdecode program define NOOF '5' ;number of out of frames define NSBUFS '4' ;number of sync buffers define MAX TRIES '10' ;restart after framinα tries needed by the decoder rsynth program size of the output buffer size of the output buffer size of the output buffer size of the output buffer ;number of samples per processing grp This constant is used by xpsycho only to set to offset used to account for the phase locked loop (PLL ) jitter. SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL ne PLLCFSET '32' ;number of samples of offset define the methods of operation controlled by external switches normal operation vs various dignostic operations define NORMA _OPER ' $000000' 000 normal opearion define LEFT_1000hz ' $000001' CC1 1000 Hz tone lef mute right define RIGHT_1000hz '$000002' 010 1000 Hz tone right, • ute left define BOTH_1000hz ' $000003' Oil 1000 Hz tone to both channels define MEMORY_TEST '$000004' 100 perform memory tests define LEFT_10000hz '$000005' 101 10000 Hz tone left, mute right define RIGHT_10000hz '$000006' 110 10000 Hz tone right, mute left define BOTH lOOOOhz ' $000007' 111 10000 Hz tone to Doth channels ,-defme ancillary data baud rates and byte counts per frame time period imsecs define BAUD300 '0' ,dip switch code for 300 baud define BYTES30C '1' ;1 oyte '.7.2 bits ==> 6 b ts/ define M 3CCR30C '$57d' ,-set clock for 3CC oaud rate define BA D1200 ' 1' dip switch code for 1200 baud define BYTES12CC ' 4' 4 bytes (28.8 bits ==> 32 bits, define M SCCR120C '$15f ' set clock for 1200 baud rate define BAUD2400 2' dip switch code for 2400 baud define BYTES2400 8' 8 bytes (57.6 bits ==> 64 bits- define M SCCR2400 $af' set clock for 2400 baud rate define BAUD360C 3' dip switch code for 3600 baud define BYTES3600 11' 11 bytes (86.4 bits ==_> 88 cits define M SCCR3600 $74' set clock for 360C baud rate define BAUD4800 '4' ;dιp switch code for 4800 baud define BYTES480C '15' ,-15 bytes (115.2 bits ==> 120 c: define M SCCR4800 '$57' ;set clock for 4800 oaud rate define BAUD720C 5' ,-dιp switch code for 7200 baud define BYTES7200 22' ,-22 bytes il72.8 bits ==> 176 εits define M SCCR720C $3a' ,-set CIOC for 72CC Daud rate define BAUD9600 ' 6' ; dip switch code for 960C baud define BYTES9600 '29' ,-29 bytes (230.4 bits ==> 232 b ts define M_SCCR9600 '$2b' ,-set clock for 960C baud rate define BAUD19200 '7' ;dιp switch code for 19201. baud define BYTES19200 '58' ,-58 bytes ,460.8 bits =«> 464 b ts ) define M_SCCR19200 'S15' ,-set clock for 19200 baud rate define BAUD7200 '5' ,-dip switch code for 3840C baud define BYTES7200 '116' ;116 bytes (921.6 cits ==> 926 DI:S. define M_SCCR720C '$a' ,-set clock for 3B C0 baud rate define BAUD_KMART_DCD '8' ,-code forced by box_ctl define BYTE_KMART_42187 '127' ,-127 bytes (1012.5 bits ==> Cl€ n ts define M_KMART_42187 '$9' ,-set clock for 42167.5 baud rate define M_SCR_CD '$05: ,-enable re & rei for encoder define M SCR DCD '$12, ,-enable te - tei for decoder BAD OWGANAL £ defme DATABUFLEN '512' ancillary data input coffer leng: define BITSPERBYTE '8' ancillary data m 8-bit cytes define BITSFORPADDING '3' framed bit count for pad by t e co t SUBSTITUTE SHEET (RULE BAD ORIGINAL ic 1995. Copyright Corporate Computer Systems, Inc. All rights reserved. \DGCST\box_ctl . asm This file contains the definitions for the control variables for running the encoder and decoder for: Digicast MimCodec version of CCS CDQ1000: sampling rate is 14.400 K - 225 Hz per sub-band (coded as 16 K sampling bit rate is 28.8 KBits per sec (coded as the low sampling rate; the frame header is coded as 'fffcOO' Port B for the encoder and decoder is defined as a host port encoder has its own phase lock detected on pel of Port C decoder phase lock is detected on pcO of Port C ancillary data is NOT APPLICABLE ;define the bits required for Reed Solomon error correction define REED_S0L0M0N_3ITS '240' ;8 bits - 30 Reed Soiomcr. bytes ;defιne the choice pairs of input PCM sampling rates to make available ; 11128.8 define SAMPLE 16K_AND_24K '0' choιce of 14400 or 14400 define SAMPLE "" 6K_AND_24K '0' ichoice of 16000 or 24000 1128.83 define SAMPLE_16K_AND_32 '1' choice of 16000 or 32000 define SAMPLE_16K_AND_48K '2' choice of 16000 or 48000 define SAMPLE_24K_AND_32K '3' choice of 24000 or 32000 define SAMPLE_24K_AND_48K '4' cnoice of 240C0 or 480CC define SAMPLE 32K AND 48K '5' choice of 32000 or 48000 :defιne the selected pair of input PCM sampling rates to make available ; 11128.6 define SAMPLE RATE PAIR '0' ;1440C and 14400 sample rates 128.8 128.8 if SAMPLE RATE PAIR--SAMPLE 16K AND 24K 126.8 define LOW_SAMPLE_RATE '$000000' 00 @ 14.4 KHz define HIGH_SAMPLE_RATE '$000000' 00 ® 14.4 KHz define FRAMESYNC_LO 'SfffcOO' fr sync pattern 14 *_r. define FRAMESYNC_HI 'SfffcOC fr sync pattern 14 4K define LOW_SAMPLE_RATE_CCS '$000000' 00 ® 1 .4 (16) KHz define KIGH_SAMPLE_RATE_CCS '$000000' 00 ® 14.4 (161 KHz define FRAMESYNC_LO_CCS 'SfffcOC fr sync old CCS 14.4K'1€ define FRAMES NC_HI_CCS 'SfffcOC fr sync old CCS 14.4K.16 define LOW_SAMPLE_RATE_ISC '$000000' 00 S 14.4 (16 KHz define HIGH_SAMPLE_RATE_ISC '$000000' 00 S 1 . (2 i KHz def ne FRAMESYNC_LO_ISO 'S fcOC fr sync MPEG-ISO 14.4K.16' define FRAMESYNC_HI_ISO 'SfffcOO' fr sync MPEG-ISC 14.4K124 128.8 128.8 endif ;define the framing max tries for MUSICAM define VERIFY TRIES '5' ;verify found rates SUBSTITUTE SHEET (RULE 261 ) define MAX BOOT TRIES '40' ;fcr 96 seconds define MAX_AUT _TRIES ' 8C ; or . S2 seconds ;defιne the power up wait times before going into processing define XCODE_STARTUP ' 100C : 1 second define RDCDSYNT STARTUP '1000' 1 second ;define the memory layouts for any diagnostic memory testing: :decoder memory layout: define START_P_MEMORY_DCD 1024' define END_P_MEMORY_DCD 2048' define START_X_MEMORY_DCD 40' define END_X_MEMORY_DCD 5120' define START_Y_MEMORY_DCD 128' define END_Y_MEMORY_DCD 1536' define WATCH DOG TEST DCD 20' ;20 illisecs for watch dcq ,-define the encoder/decoder overload scale factor code a scale facte∑ , lower than this value is considered an overload condition define OVERLOAD SKF '5' define the controls to reframe if an excessive error condition persists A frequency count of frames out-of-frame or oof's (no sync pattern! and a frequency count of checksum bit errors are maintained. For every bad frame condition the appropriate counter is incremented at a given value and for every good frame the counter is decremented at a lower value than it was incremented. A tolerance limit is tested against the counter when an error is sensed to see if it is time to force reframing. By decrementing at an lower rate would allow a counter to reach the reframe limit when there is a persistant pattern of alternating or nearly alternating σood frames and bad frames. define GOOD_DECREMENT '1' good frame decrement value define BAD INCREMENT '2' error condition frame increment value define BAD~LIMIT '4' out-of-frame (oof's, tolerance define BAD CRC LIMIT '10' CRC-16 checKSurr. cit error tolerance ,-ben 3/8/94 (start) : 0722 modification for H221 , Hand shake definition (PBD) define HSFTT '#14' PB14 input define CC '#9' PB9 input define C2 '#10' PB10 input define ABIT '#12' PB12 input define HSTTF '#13' PB13 output x flag definition define TX FLAG '#0' ,-#0 bit of x:flag define M64 #1' ,- (PBD M64 or M56 switch ,-ben 3/8/94 (end) : G722 modification for H221 :ben 3/21/95. decoder Reed Solomon address parameters SUBSTITUTE SHEET (RULE 26) ,^An ORIGINAL : def me PORT C initializations encoder PORT C Assignments i = input port o = output port 7 6 5 4 - 3 2 1 S S S 1 S O 1 e 8 0101 = 5 pcO eclksel (o) select clock for Reed Solomon pel eld (l) phase lock detect (0=not locked, l=locked) pc2 rstrs (o) reset Reed Solomon pc3 ebclk (si) bit clock 0000 = 0 pc4 elrclk d) ; input pem samples left/right clock pc5 ewclk (si) ;transmit word clock pc6 eclk (si) ,-input samples word clock pc7 esrdata (si) ,-ιnput audio pem sample data 0000 = 0 pc8 = etdata (so) ;output MUSICAM frame data define XCODE_PORT_C_M_PCC ' ovep #>$01e8,x:<<$FFEl' define XCODE_PORT_C_M_PCD 'movep #>$0004,x: <<$FFE5' define XCODE_PORT_C_M_PCDDR 'movep #>$0005,x: <<$FFE3 ' decoder PORT C Assignments s ssi port 1 input port o output port 7 6 5 4 - 3 2 1 0 s s i s s o o i d 8 0110 = 6 pcO did (i) phase lock detect (0=not locked, blocked* pel fclksel (o) select clock for Reed Solomon pc2 darst (o) d-to-a reset l ne '0 = mute, 1 = audio) pc3 dclk (si) receive input frame data stream clock 0000 = 0 pc4 dwclk (si) transmit dac output audio word clock SUBSTITUTESHEET.PULE26) BAD ORIGINM- #' fc5 = dircl / ransmit dac audio output left'rignt .OCX DC dbc κ si ; decoder bit clocκ pc7 - drdata isi. ,- receive input musicarr. frame data 0000 pc8 = dsdata (so) ;transmit audio data output to dac define RDECODE_PORT_C_M_PCC 'movep #>$Cld8 ,x: <$FFE ' define RDECODE_PORT_C_M_PCD 'movep #>$0002, x. <<SFFE5 ' define RDECODE_PORT_C_M_PCDDR 'movep #>$0006 , x: <<$FFE3 ' define PORT B initializations encoder PORT 3 Assignments l i lNcte: for Digicast pert B is a host port That means the following definitions are not applicable. 14 13 11 10 9 S 7 6 5 4 - 3 2 1 C 4 13 11 10 9 8 7 6 5 4 - 3 2 1 C o l i o O O O O O C 1 1 ** MUSICAM ** c l O 1 1 0 O O O O O O l l ** G722 ** 1 o 1 1 O c o o c 1 O 1 1 ** G722 ** 1100 - c ** MUSICAM ** 0100 - 4 ** G722 ** pbO =_ lib !ι) loop back pbl = bitrate d) frame bit rate (0=low, i-high) pb2 = coding (o) type of data input (0-MUSI AM, i=G722, pb3 - samprate (o) PCM sampling rate (0-low, l-high) ** MUSICAM : ,- pb3 = samprate (i ,- HSFTT flag for H221 ** G722 *« 1111 = f pb4 = emus (o) encoder MUSICAM led (0-cff, l=lιt ) pb5 = eovrld (o/ input pe overload led (0-off, l=i t alarm pD6 = e24κ (o) encoder pnase lock loop led '0=off, l«lιt pb7 = wd2 ιθ! watch dog timer 1001 - 9 pb6 cal (o) analog-to-digitai converter reset (0-norma , pb9 - eC !ι) CO flag for H221 ** G722 ** pblO - el !ι; C2 flag for H221 ** G722 ** pb l - eral5 (o) must be set to 1 000 - 0 ** MUSICAM ** 010 = 2 ** G722 ** pb!2 = e3 !ι) ABIT flag for H221 ** G722 ** pb!3 = e2 ii) NOT USED ** MUSICAM ** pb!3 = e2 ιθ) HSTTF flag for H221 ** G722 ** pb!4 = e4 (i) NOT USED ** MUSICAM ** HSFTT flag for H221 ** G722 ** pbl4 = e4 (ii auto status of decoder: go to low sam ling/MUSICAM follow above pins iNote: for Digicast port B is a host port That means the orevios definitions are not applicacie. define port B as a host pert define XCODE PORT B M PBC ' mover #>S00C1 , x : <<SFFE_ SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL S ,-set data so tπat bara!5 (bit 11' is 1 define XCODE_PORT_B_M_PBD : 1Diαicastmover #_»S08CC , x : <<SFFE4 ; set b t direction (output = 1 or input ** MUSICAM ** define XCODE_PORT_B_M_PBDDR ' ; 11 IDigicast ovep #>SC9fr, x:<<SFFE2 ** G722 ** define XADPCM_PORT_B_M_PBDDR ' ,- 11 IDigicastmovep #>$29fc x: <<$FFE: decoder PORT B Assignments iNote: for Digicast port B is a host port That means the following definitions are not applicable. .4 13 ι; 11 10 - 7 6 3 2 1 C O C C o o O 1 O O O 1 ** MUSICAM c c O 1 O O O 1 ** G722 ** 1110 = e pbC = ind (l ??? ?? pbl = bitrate 10) deterrr.ined framing bit rate (0=low, l-high pb2 = rcoding (o! type of data to decode (0-MUSICAM, 1-G722' pb3 = rsamprate (o) determined sampling rate (0=low, l-high 1 HSFTT flag for H221 *« G722 ** 1011 - b NO CONNECT NO CONNECT phase lock loop detect !0=not locked, I=locked, watch dog timer 1111 - f pb8 = idarst digital-to-analog reset (l=normal, C=reset pc9 = eC ic, CO flag for H221 ** G722 ** pblO = el ιc) C2 flag for H221 ** G722 * ♦ (o) boot top (1) or bottom (0) if 512 cnip 111 - f ** MUSICAM ** 101 = d ** G722 ** ABIT flag for H221 ** G722 ** NOT USED ** MUSICAM ** HSTTF flag for H221 ** G722 ** NOT USED ** MUSICAM ** HSFTT flag for H221 ** G722 ** pbl4 = e4 .o) auto status: 0 NOT framed-encode low sam ling/MUSI AM 1 FRAMED rdcdsyπt i i lNote: fcr Digicast port B is a host port That means the previos definitions are not applicable. define pert B as a host port define RDECCDE PORT B M PBC 'movep #>$C0C1 ,x: <_<$FFE0 ' BAbφ m. dfy SUBSTITUTE SHEET (RU E-26^ rset data so that baralS (bit 11. is 1 define RDECODE_PORT_B M PBD IDigicastmovep #>S0800,x:<<SFFE4 ' ** MUSICAM ** define RDECODE_PORT_B_M_PBDDR ' IDigicastmovep #>S fbe,x-<<SFFE2' ** G722 ** define FRADPCM PORT B M PBDDR ' IDigicastmovep #>$dfbe,x.<c$FFE2' [define ssi port initialization for encoder and decoder define XCODE_SSI_M CRA 'movep #>$6000,x:<<SFFEC define XCODE_SSI_M CRB 'movep #>$f010,x:<<SFFED' define RDECODE_SSI_M_CRA 'movep #>$600C,x:<<SFFEC define RDECODE_SSI_M_CRB 'movep #>$f008,x: c<$FFED' /define sci port initialization for encoder and decoder define XCODE_SCI_M_SCR 'movep #>$0002,x:<<$FFF0' define RDECODE_SCI_M_SCR 'movep #>$0002,x:<<SFFFC ' ;define the setting dsp560C2 clock (PLL Control Register) ; 8MHz crystal to run a 40 MHz (5 times 8, so code a 4 below) define XCODE_M_PCTL 'movep #>S050004 ,x:<<SFFFD' define RDECODE_M_PCTL 'movep #>$050004,x:<<$FFFD' ENCODER hardware settings for leds and lines control the encoder devices: tested inputs of : host vector 24 provides hardware and encoding parameters : none yet host vector 2A psycho table parameter id (0 - 31) host vector 2C psycho table parameter value for is frotr host vectcr 28 y:<<$FFFF BRAD encode select data type bit 0 (0-MUSICAM, l=G722ι swl LO/HI encode sampling rate bit 1 (0=hιgh, l-low ) sw2 ; ; CODAD decode select data type ; ;bιt 2 (0-MUSICAM, 1-G722! sw3 ; ; MUS/G722 decode sampling rate ; ;bιt 3 ι0=hιgh, l=low. sw4 SRAD bit rate bit 4 ιO=56Kbιts, l«64Kbιts sw5 ; / 32/48 net used ;;bιt 5 (0=low, l=hιgh) sw6 low bit encoder band width code bit 8 (0=0, 1=1) sw 1 back panel high bit encoder band width code , 1=1) sw 2 back panel baud rate code low order bit , 1=1; sw 3 cack pane. baud rate code middle bit , 1=1 ) sw 4 bacK panel baud rate code high order bit , 1=1 ) sw 5 back panel CRC-16 OLD (0) or NEW (1) ISO bit 13 (0=old, l=new) sw 6 bacK pane] lllNote: for Digicast port B is a host port That means the following definitions are not applicable M_PBD (X:<<SFFE4) pbl = bitrate !ι) bit 1 frame bit rate (0=low, l=hιgh) pb9 = eC d' bit 9 CO flag for H221 ** G722 ** SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL L__ " cit 10 C2 flag for H221 ** G722 ** bit 12 ABIT flag for K221 ** G722 ** bit 13 NOT USED ** MUSICAM ** bit 14 HSFFT flag for H221 ** G722 ** set outputs of : l l lNote: for Digicast port B is a host port That means the following definitions are not applicable (x:<<SFFE4) type of data input (0-MUSICAM, 1=G722 PCM sampling rate (0=low, l=hιgh! MUSICAM encoding led (0«off, l=lιt alarm) input pem overload led (0=off, l=lιt alarm 1 encoding at low sampling led 0=off, ι=lιt watch dog timer ana -to-digit converter reset !l=normal, 0=reset must be set to 1 HSTTF flag for H221 ** G722 ** M_ D (X:<<$FFE5) pc2 = eg722 !θ' bit 2 G722 encoding led (0-off, 1- t alarm 1 leds across panel : l l lNote: for Digicast port B is a host port That means the following definitions are not applicable. MUSICAM encoding led: 2 G722 encoding led: N/A 9 mam phase lock loop led: 10 encoder overload led: encoding low sampling led: 1CAL: control the encoder analog-to-digital converter reset line define SET_ADC_RESET ' ;bclr #C , y: <not_app ' define CLR_ADC_RESET ' ;bclr #0, y: <not_appl ' L : test the MAIN phase lock loop detect define LOCK_COUNT '5' ,- 5 successive locks set the loc led define TST_SET_PHASE_LOCK_CD 'Iset #1, x: <<$FFE5 ' define TST_CLR_PHASE_LOCK_CD ';jclr #1 , x: <<SFFE5 ' define TST_ON_PHASE_LOCK_LED_XADPCM ' 3 set #1, x: <_<$FFEΞ ' define TST_OFF_PHA≤E_LOCK_LED_XADPCM 'jelr #1 , x: <_e$FFE5 ' band-width: low order bit of band-width limit code high order bit of band-width limit code codes: 00 = level 0 CDQ2000 standard band-widths 01 = level 1 CDQ2000 standard band-widtns 10 = level 2 CDQ2000 standard band-widths 11 = level 3 CDQ2000 standard band-widths define TST_SET_LOW_BAND_WIDTH_CD ' 3 clr #C ,y: <not_appl ' define TST_SET_HIGH_BAND_WIDTH_CD '}clr #0 ,y: <not_app ' define TST_CLR_LOW_BAND_WIDTH_CD 'jelr #C , y: <nct_app ' define TST_CLR_HIGH_BAND_WIDTH_CD ']clr #C , y: <not_app ' TOGGLE WATCH DOG CD macro SUBSTITUTE SHEET (RULE 26) w ORIGINAL # ,- encoder host interface watch dog tickle see what the host expects for a dog tickle and act accordingly if bit M_HF0 (host i/f flag 0) of X:M_HSR (host status register) is se t, set bit M_HF2 (host i/f flag 2) of X:M_HCR (host control register) " else clear bit M_HF2 (host i/f flag 2) of X:M_HCR (host control register! 3set #4 ,x:<<SFFE9,_watch_dog_00 bset #4,x:<<$FFE8 imp <_watch_dog_10 _watch_dog_00 bclr #4,x:<<$FFE8 _watch_dog_10 endm INTERRUPT_HOST_CD macro ,-wiggle host interrupt 1HACK bit 14 of port b bset #14,x:<<$FFE4 nop nop movep y:word_out,x:<<$FFEB ;output leds for last frame nop nop bclr #14,X:<:<$FFE4 endm INIT_HOST_VECTORS_CD macro ; initialize the encoder host vectors with start-up valid settings ; since value is zero, use 30 sub-bands (6750 Hz) move #>$0,x0 move xO,y:host24_word move #>-l,x0 move xO,y:host2A_word move #>$0,x0 move x0,y:host2C_word endm GET_SWITCHES_CD macro LOOP copy switches received under host vector interrupt bits 0-4 allow user set audio band width by specifying the upper sub-band to be considered for bit allocation, the range is from 4 (900 Hz) to 30 (6750 Hz) Note: 30 is the default if the value is not within the range move y:host24_word,xO move x0,y:word_in SUBSTITUTE SHEET (RULE 26) ,BAD ORIGINAL L__ - endm ,-BITRATE, low/nigh: get the selected bit rate define TST_SET_LO_BIT_RATE_CD ' clr #0,y.- < not appl' define TST_SET_HI_BIT_RATE_CD ' clr #0,y: < no t ~ appl ' ,-C0DAD,MUS/G722 : get the selected type of decoder input data define TST_SET_MUSICAM_DATA_CD ']clr #0,y < word in ' ,- 11128.8 _ define TST_SET_G722_DATA_CD 'iset #0,y:<_not app 1 ' define SET_MUSICAM_DATA_CD ' ,-bclr #0 , y: <not~app__ ' define SET_G722_DATA_CD ' ,-bclr #0, y: <not~appl ' ; 11128.8 ;SDAD,LOW or HIGH: get the selected sampling rate ; choice pairings (A/B ) are: 16/24 16/32 16/48 24/32 24/48 32/48 define TST_SET_LO_SAMPLE_RATE_CD ' clr #0,y:<not appl' define TST_SET_HI_SAMPLE_RATE_CD ' 3 clr #0, y: <not~appl ' SET_LO_SAMPLE_RATE_CD ' ,-bclr #0 , y : <not~appl ' SET_HI_SAMPLE_RATE_CD ' /bclr #0 , y: <not_appl ' t whether mono or stereo framing selected define TST_SET_MONO_STEREO_CD 'iclr #0,y: <not_appl' define TST_CLR_MONO_STEREO_CD 'iclr #0,y: <not_appl' ,-JOINTCE: test for oint stereo framing (if not mono selected above! define TST_SET_JOINT_STEREO_CD 'iclr #0, y:<not_appl ' define TST_CLR_JOINT_STEREO_CD 'iclr #0, y:<not_appl ' ,-set which type ISO CRC-16 checksum OLD (0) or NEW (1) define TST_SET_NEW_ISO_CRC_CD ']clr #0, y: <not_appi ' define TST_CLR_NEW_ISO_CRC_CD ' clr #0 , y: <not_appl ' ;E4: see if decoder is framed or force MUSICAM at LOW sampling rate define TST_SET_DECODER_FRAMED_CD 'jclr #0 ,y: <not_appl ' define TST_CLR_DECODER_FRAMED_CD ' iclr #0 ,y: <not_appl' ,-BRO, BR1 ,BR2 : get the ancillary data baud rate define TST_SET_LOW_BAUD_RATE_CD 'jclr #0, y: <not_appl' define TST_SET_MID_BAUD_RATE_CD 'iclr #0,y: <not_appl ' define TST_SET_HIGH_BAUD_RATE_CD 'jclr #0,y: <not_appl ' define TST_CLR_LOW_BAUD_RATE_CD 'jclr #0 ,y: <not_appl' define TST_CLR_MID_BAUD_RATE_CD 'jclr #0,y: <not_appl' define TST_CLR_HIGH_BAUD_RATE_CD 'jclr #0, y: <not_appl ' ,- summary alarm relay: alarm relay associated with alarm LED define SET_ALARM_RELAY_CD ' ,-bclr #0, y: <not_appl ' define CLR_ALARM_RELAY_CD ' ,-bclr #0 , y: <not_appl ' define TST_SET_ALARM_RELAY_CD 'jclr #0, y: <nct_appl ' SUBSTITUTE SHEET (RULE 26) \ BAD ORIGINAL def me TST_CLR_ALARM_RELAY_CD ' 3 c #0 , y: <not_appl ,- def me state for al l leds on and of f for start - up define 0FF_LEDS_CD '$000000' ,-off if bits set' define ON LEDS CD '$000000' ,-lιt if bits clear' ,-turn leds off: define 0FF_MUSICAM_LED_CD define OFF_G722_LED_CD define OFF_LOW_SAMPLING_LED_CD define OFF_OVERLOAD_LED_CD define OFF_MONO_LED_CD define OFF_STEREO_LED_CD define OFF_JOINT_LED_CD define OFF_PHASE_LOCK_LED_CD define OFF_PHASE_LOCK_LED_XADPCM define 0FF_ALARM_LED_CD define 0FF_BITALL0C_LED_CD define OFF REED SOL LED CD define ON_MUSICAM_LED_CD define ON_G722_LED_CD define ON_L0W_SAMPLING_LED_CD define ON_OVERLOAD_LED_CD define ON_MONO_LED_CD define ON_STEREO_LED_CD define ON_JOINT_LED_CD define ON_PHASE_LOCK_LED_CD define ON_PHASE_LOCK_LED_XADPCM define ON_ALARM_LED_CD define ON_BITALLOC_LED_CD define ON REED SOL LED CD define SET LEDS CD 'movep y:word_out,y: <<$FFFF' ♦ ♦♦♦♦•♦it***************************** ************** DECODER hardware settings for leds and lines ;control the decoder devices: ; phase lock loop signal line: M PBD bit 6 control the decoder devices: tested inputs of : y:<<$FFFF ; ,- BRAD encode select data type ;bιt (0-MUSICAM, 1-G722) swl ; ; LO/HI encode sampling rate ,-bιt (0=high, l=low) sw2 CODAD decode select data type b t (0-MUSICAM, 1-G722) sw3 MUS/G722 decode sampling rate bit (0=hιgh, l=low) sw4 SRAD decode bit rate bit (0=56Kbιts, l=64Kbιts) sw5 32/48 not used b t (0=low, ι=hιgh) sw6 low bit encoder band width code bit (0=0, 1=1) sw 1 back panel high bit encoder band width code bit (0=0, 1-1) sw 2 back panel baud rate code low order bit bit 10 (0=0, 1=1) sw 3 back panel baud rate code middle bit bit 11 (0=0, 1=1) sw 4 back panel SUBSTITUTESHEET(RULE26) BAD ORIGINAL caud rate code high order bit bit 12 10-C, ' sw 5 Dack panel :, CRC-16 OLD : or NEW ( ) ISC ;bιt 13 ι0=old, =new sw caci. car.e i iNote: for Digicast port B is a host port That means the following definitions are not applicable M_PBD lx:<<SFFE4) M_PBD (X:e<$FFE4. 1 B loop back . bit C ( l=not loop oack, 0=looo DacK LD main phase lock loop signal line: bit 6 ( 1-lock 0=not E2 HSTTF flag for H221 ** G722 ** bit 13 set outputs oϋ !No le ; for Digicast port B is a host port That means the following definitions are not applicable M_PBD (X:<<SFFE4) M_PBD (x:<<$FFE4) pbl = bitrate (o> bit 1 determined framing bit rate (0=low, (.-h gh, pb2 = coding to' bit 2 type of data to decode (0=MUSICAM, =G722 pb3 = samprate (o) bit 3 determined sampling rate (0-low, 1= _ n pb4 = 32k (o bit 4 sampling rate low led-9 (0=off, 1=1 pb5 = 48k to) bit 5 sampling rate high led-10 I0-cff, 1 pb7 = wdl !o! bit 7 watch dog timer (0=clear, l=set, pb8 = idarst (o) bit 8 digital-to-analog reset (1-normal, pb9 = eO (o. bit 9 CO flag for H221 ** G722 ** pblO = el (o) bit 10 C2 flag for H221 ** G722 ** pbll = decral5 (o) bit 11 boot top (1) or bottom (0) must be pb!2 = e3 (o) bit 12 ABIT flag for H221 ** G722 ** pbl3 = e2 (o) bit 13 NOT USED * ♦ MUSICAM ** pbl4 = e4 (o) bit 14 HSFFT flag for H221 ** G722 ** M_PBD (x:<<$FFE5) pc2 = alrmrly (o) bit 2 alarm relay leds across panel encode MUSICAM data led: encode 2 G722 data led: 3 MUSICAM frames led: 4 G722 input data led: 5 framing alarm led: 6 main phase lock loop led: 7 decoder overload led: 8 crc bit error led: encode 9 encoder overload led: encde 10 main phase lock loop led: encde 11 low (1) vs hi (0) sampling: 12 low (1) vs hi (0) sampling: 1CAL: control the decoder digital-to-analog converter reset line define SET_DAC_RESET ' bset #2,x:c<$FFE5' define CLR_DAC_RESET 'bclr #2,X:<c$FFE5' 1LE: test the loop back define TST_SET_LOOP_BACK_DCD clr #0 ,y: <not_app] define TST_CLR_LOOP_BACK_DCD iclr #0 ,y: <not_app_ define TST_SET_LOOP_BACK_FRADPCM iclr #C , y ■ <nct_appl define TST_CLR_LOOP_BACK_FRADPCM iclr #C, y: <nct_ap l L ; test the MAIN phase lock loop detect BAD ORIGINAL SUBSTITUTE SHEET (RULE 26^ defme TST_SET_PHASE_LOCK_DCD 'jset #0,x:<cSFFE5 ' define TST_CLR_PHASE_LOCK_DCD 'jclr #0,x:< < SFFE5 ' TOGGLE_WATCH_DOG_DCD macro ,- encoder host interface watch dog tickle see what the host expects for a dog tickle and act accordingly if bit M_HF0 (host i/f flag 0! of X:M_HSR (host status register) is se t , set bit M_HF2 (host i/f flag 2) of X:M_HCR (host control register) else clear bit M_HF2 (host i/f flag 2) of X:M_HCR (host control register! set #4 ,x:<<$FFE9,_watch_dog_00 bset #4,x:<<$FFE8 imp <_watch_dog_10 _watch_dog_00 bclr #4,x:<<$FFE8 _watch_dog_10 endm INTERRUPT_HOST_DCD macro ,- iggle host interrupt 1HACK bit 14 of port b bset #14,x:<<$FFE4 nop nop movep y: ord_out,x:<<$FFEB ;output leds for last frame nop nop bclr #14,x:<<$FFE4 endm INIT_HOST_VECTORS_DCD macro / initialize the encoder host vectors with start-up valid settings move #>$0,x0 move x0,y:host24_word endm GET_SWITCHES_DCD macro LOOP / copy switches received under host vector interrupt move y:host24_word,x0 move x0,y:word_ιn endm ,-BRAD, low/high: get the selected bit rate SUBSTITUTE SHEET (RULE 26) L " n ΛO Λ BAD ORIGINAL flffl &* SET_AUTO_BI _RATE_DCD " C R_AUTO_BI _RATE_DCD " SET_AUTO_BIT_RATE_FRADPCM " CLR_AUTO_BIT_RATE_FRADPCM " SSET_AUTO_BIT_RATE_FRADPCM " SCLR_AUTO_BIT_RATE_FRADPCM " SET_LO_BIT_RATE_DCD " SET_HI_BIT_RATE_DCD " SET_LO_BIT_RATE_FRADPCM ^SET_HI_BIT_RATE_FRADPCM 128.8 LO_BIT_RATE_DCD " HI BIT RATE DCD 1128.6 rCDAD,MUS/G722 : get the selected type of decoder input dar define TST_ SET_AUTC_CODED_DATA_DCD #0, y: <nct_appl ' αetine Tςιr> CLR_AUTO_CODED_DATA_DCD #0 ,y: <not_appl ' define TST " SET_AUTO_CODED_DATA_FRADPCM #0, y: <no _appl ' define TST " CLR_AUTO_CODED_DATA_FRADPCM #C , y: <nct_appl ' define TST " SSET_AUTO_CODED_DATA_FRADPCM ' Selr #0 , y: <nct_appl define TST " SCLR_AUTO_CODED_DATA_FRADPCM 'isclr #0 , y : <nct_appi define ST " SET MUSICAM_DATA_DCD #0 , y : <nct_appl ' define TST " SET~G722_DATA_DCD #0, y: <not_appl ' define TST " SET~MUSICAM_DATA_FRADPCM #0 ,y: <not_appl ' define TST " SET G722 DATA FRADPCM #0,y: <not_appl ' .28.8 define SET_MUSICAM_DATA_DCD #0, y: <not_appl ' define SET G722 DATA DCD #0, y: <not_app ' .28.8 ;SCAD, low or high: get the selected sampling rate : choice pairings (A/B) are: 16/24 16/32 16/48 24/32 1 -'48 32/48 define TST SET AUTO SAMPLE RATE DCD 'jclr #C , y : <nct_app ' define TST_CLR_AUTO_SAMFLE_RATE_DCD #0 , y : <r.ct_appl ' define TST_SET_LO_SAMPLE_RATE_DCD #0 , y : <not_ap l ' define TST_SET_HI_SAMPLE_RATE_DCD i -r #0,y:<not_appl ' 28.5 define SET_LO_SAMPLE_RATE_DCD ,-bclr #0 ,y: <not_appl ' define SET HI SAMPLE RATE DCD ,-bclr #0 ,y: <nct_appi ' 126.8 ;E4 . inform the encoder: define SET_DECODER_FRAMED_DCD ,-bclr #0 , y: cnct_appl ' ;DSW~- mute the decoder output define TST_SET_MUTE_OUTPUT_DCD iclr #C , y :<not_appl define TST CLR MUTE OUTPUT DCD jclr #C , y: <not_appl ;DSWS,DSW9: test the mono output channel requirements define TST_SET_MONO_ONE_CHANNEL_DCD ' clr #C , y : <not_appl' define TST_CLR MONO_ONE_CHANNEL_DCD ' clr #0 , y: <nct_app ' define TST_SET~MONO_LEFT_OR_RIGHT_DCD ' cir #0 , y: <not_app ' define TST CLR~MONC LEFT_OR RIGHT_DCD ' clr #0 , y : <nct_ap l ' ^0 OR^ NAt be activated sometime in CDQ1000 define TST_SET_FADE_OUTPUT_DCD 'iclr #0,y: <not_app ' define TST_CLR_FADE_OUTPUT_DCD 'iclr #0 , y: <not_appi ' define TST_SET_FADE_UP_DCD 'iclr #0, y : <not_appl' define TST_SET_FADE_DOWN_DCD 'iclr #0 , y: <nct_app ' define FADE_INCREMENT '1' ,2 Db per frame define FADE_SOFTEST '40' ,-max of down 80 Db define FADE_START_UP '20' ,-max of start up 40 Db define FADE FRAMES '2' ,- fade every N frames ;LINSEL0,LINESEL1 : test if line 1 and/or line 2 is selected define TST_SET_LINE_1_SELECT_DCD jclr #0, :<not_appl ' define TST_SET_LINE_2_SELECT_DCD clr #0, y: <not_appl ' define TST_CLR_LINE_1_SELECT_DCD jset #0, y: <not_appl ' define TST CLR LINE 2 SELECT DCD set #0 , y: <not_appl ' ,- IAGNOST (ANCELDTA) : test whether diagnostics programming is to be executed define TST_SET_DIAGNOSTICS_DCD 'iclr #0,y:<not_appl ' define TST_CLR_DIAGNOSTICS_DCD ' clr #0,y: <not_appl ' ,-BR0,BRl,BR2 : get the ancillary data baud rate define TST_SET_LOW_BAUD_RATE_DCD ' clr #0, y: <not_appl' define TST_SET_MID_BAUD_RATE_DCD ' clr #0 , y: <nct_appl ' define TST_SET_HIGH_BAUD_RATE_DCD 'jclr #0,y: <not_appl' define TST_CLR_LOW_BAUD_RATE_DCD 'iclr #0,y: <not_appl ' define TST_CLR_MID_BAUD_RATE_DCD 'jclr #0,y:<not_appl' define TST CLR HIGH BAUD RATE DCD 'jclr #0 , y: <not_appl ' ;BR0 , BR1.BR2 : get diagnostics code when DIAGNOST (currently ANCELDTA) is set ; dip switch interpretations for diagnostic operation define TST_SET_LOW_DI G_CODE_DCD define TST_SET_MID_DIAG_CODE_DCD define TST_SET_HIGH_DIAG_CODE_DCD def1ne TST_CLR_LOW_DIAG_CODE_DCD define TST_CLR_MID_DIAG_CODE_DCD define TST CLR HIGH DIAG CODE DCD :summary alarm relay: alarm relay associated wit define SET_A ARM_RELAY_DCD define CLR_AI_ARM_REI_AY_DCD define TST_SET_AI_ARM_RELAY_DCD define TST CLR ALARM RELAY DCD rdefme state for all leds on and off for start-up define OFF_LEDS_DCD '$00' ;off if bits set' define ON LEDS DCD '$ff ;lιt if bits clear' ; turn leds off define OFF_FRAME_LED_DCD 'bclr #1, : <word_out ' define OFF_CRC_ERROR_LED_DCD 'bclr #2, y: <word_out ' define OFF_OVERLOAD_LED_DCD 'bclr #3 ,y: <word_out ' define OFF PHASE LOCK_LED_DCD 'bset #4 , y: <word_out ' SUBSTITUTE SHEET (RULE 26) GIN - define OFF REED SOL LED DCD 'bclr #5,y <word our define OFF_LO_BIT_RATE_LED_DCD define OFF_HI_BIT_RATE_LED_DCD define OFF_MUSICAM_LED_DCD define OFF_G722_LED_DCD define OFF_PHASE_LOCK_LED_FRADPCM _ OFF_PHA≤E_LOCK_LED_MACRO_FRADPCM macro bclr #5,x:<Eram_Mem :turn off red led move x: <Eram_Mem,xO movep x0,y:<<$FFFF endm OFF OVERLOAD LED MACRO FRADPCM macro bclr #6,x:<Eram_Mem ,-turn off overload led movep x:Eram_Mem,y:<<$FFFF endm define OFF_LO_SAMPLE_RATE_LED_DCD bclr #0,y:<not_appl' define OFF_HI_SAMPLE_RATE_LED_DCD bclr #0,y:<not_appl' define 0FF_MONC_LED_DCD bclr #0,y:<not_apρl' define OFF_STEREO_LED_DCD bclr #0,y:<not_apρl' define OFF_JOINT_LED_DCD bclr #0, y:<not_appl' define OFF ALARM LED DCD bclr #0, y • -_not_appl' (turn leds on: define ON_FRAME_LED_DCD 'bset #l,y:<word_out' define ON_CRC_ERROR_LED_DCD 'bset #2,y:<word_out' define ON_OVERLOAD LED_DCD 'bset #3 ,y:<word_out' define ON_PHASE_LOCK_LED_DCD 'bclr #4 , y:<word_out' define ON_REED_SOL_LED_DCD 'bset #5,y:<word_out' define ON_LO_BIT_RATE_LED_DCD bclr #0,y:<not_appl' define ON_HI_BIT_RATE_LED_DCD bclr #0,y:<not_appl' define ON_MUSICAM_LED_DCD bclr #0,y:<not_appl' define ON_G722_LED_DCD bclr #0,y: <not_appl' define ON PHASE LOCK LED FRADPCM bclr #0,y:<not_appl ' ON_PHASE_LOCK_LED_MACRO_FRADPCM macro bset #•_>,x:<Eram_Mem /turn on red led move x:<Eram_Mem,xO movep x0,y:<<$FFFF endm ON_OVERLOAD_LED_MACRO_FRADPCM macro bset #6,x:<Eram_Mem turn on overload led movep x:Eraτn_Me ,y:<<$FFFF endm define ON_LO_SAMPLE_RATE_LED_DCD define ON_HI_SAMPLE_RATE_LED_DCD define ON_MONO_LED_DCD define ON_STEREO_LED_DCD define ON_JOINT_LED_DCD define ON ALARM LED DCD define SET_LEDS_DCD 'movep y:word_out,y:<<$FFFF' define TST_SET_CRC_ERROR_DCD 'jclr #0,y:<not_appl' define TST CLR CRC ERROR DCD 'jclr #0,y:<not_appl' / define macros for getting the encoder and decoder external switches GET BIT RATE CD macro SUBSTITUTE SHEET (RULE 26) SAD ORIGIN ^ encoder interpret the external switches for the framing bi t ra t e move #>RATE_LO,x0 ,-start with lower KBit rate 28.8: force low bit rate TST_SET_LO_BIT_RATE_CD,_grte_a move #>RATE HI,x0 otherwise, use higher KBit ra t e _grte_a move x0,x:tstrate set selected rate endm GET_FRAME_TYPE_CD macro ,- micro encoder only handles mono frame type move #>MONO,x0 move x0,x:tstfrme ,- determine the NEW or OLD ISO CRC-16 specification bclr #CRC_OLD_vs_NEW,y:<stereo 0-OLD ISO specification 1-NEW ISO specification TST_CLR_NEW_ISO_CRC_CD,_gtyp_a if not use NEW CRC, done MmiCodec board FORCE new ISO ere bset #CRC_OLD_vs_NEW,y:<stereo 1=NEW ISO specification ,- ; ,-_gtyp_a ; default to old CCS CDQIOOO's bset #0,x:tStOCCS ,-l=old CCS CDQ2000'S endm GET_CODE_TYPE_CD macro / encoder interpret the external switches for the type of coded output MUSICAM frames or G722 28.8: force MUSICAM TST_SET_MUSICAM_DATA_CD,_gcde_a bset #0,x:tstcode indicate G722 output 0 F F_MUS I CAM_LED_CD turn off MUSICAM indicator OFF_LOW_SAMPLING_LED_CD turn off low sampling rate indicator 0N_G722_LED_CD turn on G722 indicator SET_G722_DATA_CD set line for encoder G722 p <_gcde_b 11 !_gcde_a 0N_MUSICAM_LED_CD turn on MUSICAM indicator 0FF_G722_LED_CD turn off G722 indicator SET MUSICAM DATA CD set line for encoder MUSICAM !_gcde_b endm SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL β GET_SAMPLE_RATE_CD macro / micro encoder handles low and high sampling rates 28.8: force low sample rate TST_SET_LO_SAMPLE_RATE_CD,_gsmp_a bset #0,x:tstsmpl indicate high K sampling rate OFF_LOW_SAMPLING_LED_CD turn off low sampling rate indicator SET_HI_SAMPLE_RATE_CD set l ne for high sampling rate jmp <_gsmp_b gsmt__a TST_SET_G722_DATA_CD,_gsmp_b do not turn on if G722 ON_LOW_SAMPLING_LED_CD turn on low sampling rate indicator SET LC SAMPLE RATE CD set line for low sampling rate _gsmp_b endm GET BAND WIDTH CD macro encoder interpret the external switches for the band-width code to set oand-width based on frame bit rate and type of framing TST_CLR_LOW_BAND_WIDTH_CD,_gbnd_a ;check switch to interpret as 0 bset #0,x:tstband ,-set the band width code low bit on _gbnd_a TST_CLR_HIGH_BAND_WIDTH_CD,_gbnd_b /check switch to interpret as 0 bset #l,x:tstband ,-set the band width code high bit on _gbnd_b bits 0-4 allow user set audio band width by specifying the upper sub-band to be considered for bit allocation, the range is from 4 (900 Hz) to 30 (6750 Hz) Note: 30 is the default if the value is not within the range move y:word_m,x0 get sub-bands for y:<usedsb move x0,x:tstband put value in the new ι/p move xO,y:bndwdth ~ put value in the current endm GET_BAUD_RATE_CD macro ; encoder interpret the external switches to get ancillary data baud rate TST_CLR_LOW_BAUD_RATE_CD,_gbaud_a ;check switch to interpret as 0 bset #0,x:tstbaud ,-set the baud rate low bit on _gbaud_a TST_CLR_MID_BAUD_RATE_CD,_gbaud_b ;check switch to interpret as 0 bset #l,x:tstbaud ,-set the baud rate middle bit on _gbaud_b TST_CLR_HIGH_BAUD_RATE_CD,_gbaud_c /check switch to interpret as 0 bset #2.x:tstbaud ;set the baud rate high bit on _gbaud_c BAD ORIGINAL ) endrr ,- decoder external switch macros GET_BIT_RATE_DCD macro ,- decoder interpret the external switches for the framing bit rate ,- begin witn raw code for lower framing bit rate, clear auto select flag move #>RATE_LO,xC 28.8: force low bit rate bclr #AUTO_SELECT_BIT_RATE,y:<c 1fIgs move #autorate,r0 ,-addr of curr bit auto select state ,- f net auto select switch is set, go by the selected switch setting TST_CLR_AUTC_BIT_RATE_DCD,_grte_c ,- f not auto select, test other sw ,- f in loop Dact , set the bit rate to h gh Kbits TST_CLR_LOOP_BACK_DC ,_grte_a if not loop, continue move #>RATE_KI ,x0 set higher KBits raw cede imp <_grte_e install chosen bit rate _grte_a ,-see if already in auto select bit rate jset #0,x: (rC) ,_grte_b ,- if already in auto, skip next 2 stmts ,- set save code as m auto select bit rate and indicate switch changes bset #C,x: (rO) ,-blt 0 = 1 = AUTO SELECT oset #4 , y:<not_appi /indicate a switch change ;set cohtrcl flag to perform auto se.ee: rate oset #AUTO_SELECT_BIT_RATE,y:<ctiflgs bset #o,x:autosel move y:frmrate,xO ,-use last rate sta: jmp < _9∑ 'te _ e ,- set the b t rate as selected by the switch _grte_c ,-see if currently in auto select bit rate jclr #C,x: (rC , grte d ; f not in auto, skip next 2 stmts ;clear save code as NOT in auto select bit rate and indicate switch changes Dclr #0,x: irO i ;bιt 0 = 0 = NOT AUTC SELECT bset #4 ,y: <nct_appl ;indicate a switch change σrte d , see low cr high cit rate selected, f keep .owe: TST_SET_LO_BIT_RATE_DCD,_grte_e move #>RATE_HI,xO ,otherwise, use higner KBit rate , ' ' '_grte_e move xO , x tstrate ,-set selected rate endm GET_FRAME_TYPE_DCD macro , decoder interpret the external switches for the frame type (not applicable! , however, set the current mono frame output channel parameter , clear tne mono out both channels flag and set the flag if neeαed bset #MONO_OUT_BOTH,y <ctlflgs ,mono out both cnanneis TST_CLR_MONO_ONE_CHANNEL_DC ,_gfrrr._a bclr #MONO_OUT_BOTH,y<ctlflgs ,mono out one channel _gfrm_a , clear the mono output one channel flag indicating LEFT and set the flag to the RIGHT channel if needed bclr #MONO_OUT_CHANNEL,y.<ctlflgs ,-mono one channel out LEFT TST_CLR_MONO_LEFT_OR_RIGHT_DCD,_gfrm_b bset #MONO_OUT_CHANNEL,y <ctlflgs ,mono one channel out RIGHT _g rτ_b endm GET_CCDE_TYPE_DCD macro decoder interpret the external switches for the type of coαed input MUSICAM frames or G722 starts out as MUSICAM (default) , clear auto select flag '28 8 force MUSICAM oclr #AUTO_SELECT_DATA_TYPE,y <ctlflgs move #autocode,r0 , if not auto select switch is set, go by the selected switch setting TST_CLR_AUTO_CODED_DATA_DCD,_gcde_b ,ιf in loop back, leave the data type as MUSICAM TST_SET_LOOP_BACK_DCD,_gcde_d ,ιf in loop, done selection ,-see if already in auto select code type set #0,x trO ,_gcde_a ,ιf already in auto, skip next 2 st-ts , set save code as in auto select code type and indicate switch changes bset #C , {rC ,bit C = 1 = AUTC SELECT bset #4,y <not_appl .indicate a switch change _gcαe_a , set contrcl flag to perform auto select cf b t rate bset #AUTO_SELECT_DATA_TYPE,y <et flgs bset #0,x autosei , set to auto select, continue with previous type of coαed data move y-iputcde.xO move xC,x tstcode , indicate last incut tvoe jmp <__gcde_d _gcde_b , see f currently in auto select code type jclr #0,x 'rC ,_gcde_c ,ιf not in auto, snip next 2 stmts .clear save code as NOT in auto select coαe type ana indicate switch changes bclr #0,x (rO) ,blt 0 = 0 = NOT AUTC SELECT bset #4,y <not_appl .indicate a switch change _gcde_c TST_SET_MUSICAM_DATA_DC ,_gcde_d bset #0,x tstcode /indicate G722 input _gcae_d , indicate the switch selection to encoαer for data type , TST_SΞT_ENCODE_G722_DATA_DCD,_gcde_e , if G7; set that encoαer SET_ENCODE_MUSICAM_DATA_DCD , tell encoder MUSICAM jmp <_gcde_f ,_αcde_e " SET_ENCODE_G722_DATA_DCD ,tell encoder G722 ,_gcde_f endm GET_SAMPLE_RATE_DCD macro , decoder interpret the external switches for the sampling rate , if select switch is set, see which type of coαed data is being ιnp_,t , Degin w th the code for low sampling KHz rate, clear auto select flag nove #0,x0 28 8 force low sample rate Dcir #AUTC_SELECT_SAMPLE_RATE,y <ctlflgs move #autosmpl,r0 ', if not auto select switch is set, gc oy the selected switch setting SUBSTITUTE SHEET (RULE 26) \ NAL TST_CLR_AUTC_SAMPLE_RATΞ_DCD _gsmp_b .f not auto select t es t o th er sw __f in loop back, leave the low sampling rate seiecteα TST_SET_LOOP_BACK_DCD,_gsmp_d , if in loop, done selec t ion ' ' see if already in auto select sampling rate jset #0,x (rO),_gsmp_a ,ιf already in auto skip nex t 2 s t m t s , set save code as in auto select sampling rate and indicate switch changes ' ' bset #0,x (rO) ,bit 0 = 1 = AUTO SELECT I bset #4,y <not_appl .indicate a switch change _gsmp_a ,set control flag to perform auto select of sampling rate bset #AUTO_SELECT_SAMPLE_RATE,y cctlflgs ' bset #0,x.autosel move y smplrte.xO ,use last sampling rate to start mp <_gsmp_d set the sampling rate as seiecteα by the switch _gsmp_b 1 ,see if currently in auto select sampling rate I I iclr #0,x (rO),_gsmp_c ,ιf not in auto, skip next 2 stmts 1 .clear save code as NOT in auto select sampling rate and indicate switch cha bclr #0,x (rO) ,bit 0 = 0 = NOT AUTO SELECT oset #4,y <not_appl , maicate a switch change , ' ' '_gsmp_c TST_SET_LO_SAMPLE_RATE_DCD,_gsmp_d 1 move #_>l,x0 ,otherwise use hign rate , ' _gsmp_d move x0,x tstsmpl 1 , , indicate the switch selection to encoder for data sampling rate ' ' TST_SET_ENCODE_HI_SAMP RATE_DCD _gsmp_e ,ιf high rate set for encoder , ' SET_ENCODE_LO_SAMPLE_RATE_DCD tell encoder low sampling rate 1 1 jmp <_gsmp_f ' ' ' , ,_gsmp_e " SET_ENCODE_HI_SAMPLE_RATE_DCD , tel__ encoαer high sampling rate , ' ' ' , ,_gsmp_f endm GET_BAUD_RATE_DCD macro , decoder interpret the external switches to get ancillary data baud rate TST_CLF_LOW_BAUD_RATE_DCD,_gbaud_a .check switch to interpret as Z cset #0 x tstoaud .set the Da_.α rate low cit c- '_gbaud_a TST_CLR_MID_BAUD_RATE_DC ,_gbaud_c .check switch to interpret as Z oset #l,x tstbaud , set the eaua rate middle hit on _goaud_b TST_CLR_HIGH_BAUD_RATE_DCD,_gDaud_c check switch to interpret as 0 bset #2,x tstoaud .set tne baud rate high oit or '_gDa d_c endrr GET_MΞTHOD_OPERATION_DCD macro αecoαer get external switches for method of operation NORMAL vs DIAGNOSTIC endπ GET_CIAGNOST:CS_DCD macro , αecoαer get external switches for diagnostic operation NORMAL vs DIAGNOSTIC f switcn set for normal operation, skip rest of this interpretation 1 TST_CLR_DIAGNOSTICS_DCD,_gdιag_c .switch set for normal or diagnostics set the diagnostic code bits TST_CLR_LOW_DIAG_CODE_DCD,_gdιag_a ,check switch to interpret as 0 nset #0,x tstmeth .set diagnostic code low bit on _gαιag_a TST_CLR_MID_DIAG_CODE_DCD,_gdιag_D .check switch to interpret as 0 ' ' bset #I,x tstmeth .set diagnostic code middle bit or _gaιag_D TST_CLR_HIGH_DIAG_CODE_DCD,_gαιag_c , cneck switch to interpret as Z oset #2,x tstmeth .set αiagnostic coαe nigh b.t or _gaιag_c endm VERIFY_AUTC_SAMPLE macro Digicast NOT APPLICABLE enαπ , for CDC2C12 start with flag set tc decode MPEG-ISO frames cit 0 C = MPEG-ISC 1 = old CCS CDQ's bit C C = MPEG-ISO at 240C0 sampling 1 = old CDQ1000 (MICRO- frames at 24000 sampling TOC MANY SYNC ERRORS DCD macro SUBSTITUTE SHEET (PULE 26) I BAD ORIGINAL tf :now to nanα e the set of the REFRAME flag after successive svr.c ca -_:err. faai.ures always do old CCS CDQ's bset #0,y:oldccs .-only handle eld CCS CDC s bset #l,y:oldccs ,-old CCS CDQ frms a 14.4 K samp: j p ■-restart ,-restart, as old CCS CDC' s endm TOC_MANY_BIT_ERRORS_DCD macro .low to handle the set of the REFRAME flag after too enay successive CRC-16 b t errors f the cldccs bit is net set, switch from MPEG-ISO to eld CCS CDC' s f old CCS has already been tried, restore MPEG-ISO and reframe move #oldccs, rC :o test oldecs flag ,'bι: nop C = MPEG- ISC 1 = old CCS _cia_ccs ;try decoding frames from older CCS CDQ's units bset #C,y:oldces ,-set old CCS L ag : '. .' .' dbg nop nop nop nop nop ; 111dbg j p <reframe ;reframe, try old CCS endm This code handles the special ancillary data problem when frames have toe many encoded according to the decoder baud rate and the frames alsc have the old ISO (CCS) CRC-16 checksum algor tn for protection. This condition occurs when trying to determine if tne stream of frames s from an cl 1 • C~C~Sc rC"DQ2000 and are two channel frames at low b t rates or s the stream from a new CCS CDQ with MPEG-ISO frames but are protected using the old ISO (CCS) CRC-16 algorithm. TOC_MANY_DATA_ERRORS_DCD macro ;old CDQ OύO mono frames β 240CC sampling do not apply to this problem jset #1, y: ;rl, ,_tdata_lC ,-ιf old CDQIOOO, skip over to cent: ; f too many errors, reframe using the opposite old CCS vs MPEG-ISC w th lew bit rate two channel frames if doing old CCS, go switch tc ISC switch to try eld CCS decoding reframe ;switch to try MPEC ISO decodinσ ,-restart data 10 endm define ancillary data baud rates and max byte counts per frame 11128.8 14400 sampling rate ® 80 msecs !28.8 16000 sampling rate ® 72 msecs 24000 sampling rate @ 48 msecs 32000 sampling rate @ 36 msecs 48000 sampling rate @ 24 msecs (baud rate * milliseconds = bits received bits received then promoted to next even 8-bits to yeild max bytesi M_SCCRnnn (see pages 11-22 & 11-31) = ( ( 32,000,000 / (64 * nnn ) ) - 1) (result rounded ~ converted to h ex where 32,000,000 is crystal, nnn = baud rate define BAUD300 dip switch code for 300 baud define M_SCCR300 set clock for 300 naud rate 11128.8 define BYTES300_16 3 bytes (24.0 bits ==> 24 bits) define BYTES300_24 3 bytes (24.0 bits ==> 24 bits) define BYTES300_16 3 bytes (21.6 bits ==> 24 bits) define BYTES300_24 2 bytes (14.4 bits ==> 16 bits) 128.8 define BYTES300_32 2 bytes (10.8 bits ==> 16 bits) define BYTES300_48 1 byte (7.2 bits ==_» 8 bits) define BAUD1200 dip switch code for 1200 baud define M_SCCR1200 set clock for 1200 baud rate 128.8 define BYTES1200_16 11 bytes (96.0 bits ==> 96 bits) define BYTES1200_24 12 bytes (96.0 bits == 96 bits, define BYTES1200_16 11 bytes (86.4 bits ==> 88 bits) define BYTES1200_24 8 bytes (57.6 bits = => 64 bits) 128.8 define BYTES1200_32 6 bytes (43.2 bits ==> 48 bits) define BYTES1200_48 4 bytes (28.8 Dies ==> 32 bits define BAUD2400 dip switch code for 2400 baud define M_SCCR2400 set clock for 2400 baud rate 128.8 define BYTES2400_16 24 bytes (192.0 bits > 192 bits define BYTES2400_24 24 bytes (192.0 bits > 192 bits define BYTES2400_16 22 bytes (172.8 bits > 176 bits) define BYTES2400_24 15 bytes (115.2 bits > 120 bits 11128.8 define BYTES2400_32 11 bytes (86.4 bits ==> 88 bits/ define BYTES2400_48 8 bytes (57.6 bits ==> 64 bits. define BAUD3600 dip switch code for 3600 baud define M_SCCR3600 set clock for 3600 oaud rate 11128.83 define BYTES3600_16 36 bytes (288.0 bits ==> 288 bits define BYTES3600_24 36 bytes (288.0 bits ==> 288 Dits define BYTES3600 16 33 bytes (259.2 bits ==> 264 bits SUBSTITUTE SHEET (RULE 26 ΛD OHIϋlNAL define BYTES3600_24 '22' ,22 bytes Cits ==: cits 18 83 define 3YTES3600_32 '17' ,-17 bytes (129.6 bits ==> 136 b ts 1 define BYTES360C_48 '11' ,-11 bytes (86.4 bits ==> 88 bits define BAUD4800 '4' :dιp switch code for 4800 baud define M_SCCR4800 '$68' ,-set clock for 4800 baud rate 128.8 define BYTES4800_16 '48' :48 bytes ( 384.0 bits ==> 384 bits, define BYTES4800_24 '4e' :48 bytes (384.0 bits ==> 384 cits define BYTES4800_16 '44' ;44 bytes (345.6 bits ==> 352 bits define BYTES4800_24 '29' ,-29 bytes (230.4 bits ==> 232 bits 128. B3 define 3YTES4800_32 '22' ;22 bytes (172.8 bits ==> 176 cits' define BYTES480C_48 '15' ;15 bytes (115.2 bits ==> 12C cits define BAUD38400 ' 5' ,-dιp switch code for 384CC baud define M_SCCR38400 '$c' r set clock for 38400 baud rate 128.8 define EYTES38400_16 '384' :384 bytes (3072.0 bits ==> 3072 bits define BYTES38400_24 '384' :384 bytes (3072. C bits ==> 3C72 bιts < define BYTES3B400_16 '346' ,-346 bytes (2764.8 bits ==> 2768 bits ) define BYTES38400_24 '231' r231 bytes (1843.2 bits ==> 1848 bits' 128.83 define BYTES38400_32 '173' ;173 bytes (1382.4 bits ==> 1384 bits) define BYTES38400_48 '116' :116 bytes (921.6 bits ==> 928 bits ' define BAUD9600 '6' rdip switch code for 9600 baud define M_SCCR9600 '$33' rset clock for 9600 baud rate 12B.8 define BYTES9600_16 '96' 96 bytes (768.0 bits => 768 bits' define BYTES9600_24 '96' 96 bytes (768.0 bits ■> 768 Dies' define BYTES960C_16 '87' 87 bytes (691.2 bits => 696 bits. define BYTES9600_24 '58' 58 bytes (460.8 bits => 464 Bits, 128.83 define BYTES9600_32 '44' ,-44 bytes (345.6 bits 352 cits define BYTES9600_48 '29' :29 bytes (230.4 bits 232 c ts define BAUD19200 '7' ;dιp switch code for 192CC baud define M_SCCR19200 '$19' :set clock fcr 1920C baud rate 128.83 define BYTES19200_16 '192' 192 bytes (1536.0 bits ==> 1536 bits' define BYTES19200_24 '192' 192 bytes (1536.0 bits ==> 1536 bits define BYTES19200_16 '173' 173 bytes (1382.4 bits ==> 1384 bits, define BYTES19200_24 '116' 116 bytes (921.6 bits ==> 528 bits 128.8 define BYTES19200_32 '87' ;87 bytes (691.2 bits ==> 696 bits define BYTES19200 48 '58' :58 bytes (460.8 bits ==> 464 bits, ,-defιne sampling rate table of ISO MUSICAM frame header codes SAMFLERATES macro samplng =SAMPLE 16K AND 24K old CCS CDQIOOO sampling at 14.4 K old CCS CDQIOOO header sampling id b old CCS CDQ100C max suD-bands 1 cr.an Old CCS CDQIOOO max sub-band old CCS CDQIOOO sampling at old CCS CDQIOOO header sampl old CCS CDQIOOO max sub-band Old CCS CDQIOOO max sub-band number of critical bands at num freqs used for coding at Old CCS CDQIOOO sampling at old CCS CDQIOOO header sampl Old CCS CDQIOOO max sub-band old CCS CDQIOOO max sub-band Old CCS CDQIOOO sampling at old CCS CDQIOOO header sampl Old CCS CDQIOOO max sub-band old CCS CDQIOOO max sub-band number of critical oands at 1 num freqs used for codmα at ,-define framing bit rate table BITRATES macro ,-framing bit rate of 28.8 Kbits ISO frame header code for 28.8 Kbits ISO frame header code for 26.8 Kbits num 24 bit wds 28.8 Kbit frame <_. 14.4 K sample num bits 28.8 Kbit frame ® 14.4 K sample ISO frame header code for 28.8 Kbits ISO frame header code for 28.6 Kbits num 24 bit wds 28.8 Kbit frame ~ 14.4 K sample num bits 28.8 Kbit frame _. 14.4 K sample /framing bit rate of 28.8 Kbits ISO frame header code for 28.8 Kbits ISO frame header code for 28.8 Kbits num 24 bit wds 28.8 Kbit frame ® 14.4 K sample num bits 28.8 Kbit frame ® 14.4 K sample ISO frame header code for 28.8 Kbits- ISO frame header code for 28.8 Kbits num 24 bit wds 28.8 Kbit frame 3 14.4 K sample num bits 28.8 Kbit frame 3 14.4 K sample endm ,-define bit allocation bandwidth tables BANDWIDTHS macro bndwtbl ,-11128.8 if SAMPLE RATE PAIR==SAMPLE 16K AND 24K SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL g KSit rates ow/nign ~ 144CC sampling rate low code 00: mono band-width subbands requiring 1 allocation mono band-width subbands requiring 1 allocation mono band-width subbands requiring 1 allocation mono band-width subbands requiring i allocation rate high code 01: mono band-width subbands requiring 1 allocation mono band-width subbands requiring 1 allocation mono band-width subbands requiring 1 allocation mono band-width subbands requiring 1 allocation KBit rates low/ igh ® 14400 sampling rate low code 00: mono band-width subbands requiring 1 allocation mono band-width subbands requiring 1 allocation mono nand-width subbands requiring 1 allocation mono band-width subbands requiring 1 allocation rate high code 01: mono band-width subbands requiring 1 allocation mono oand-width subbands requiring 1 allocation mono band-width subbands requiring 1 allocation mono band-widtr. subbands requiring 1 allocation endm ,-define ancillary data baud rate table of clock values and oyte counts BAU CLK macro baudclK ,- i : : 28.6 if SAMPLE RATE PAIR==SAMPLE 16K AND 24K ,- : : :23.8 dc M_SCCR300 set clock for 300 data baud rate ' dc BYTES300_16 tol check of bytecnt ® sample 14.4 K dc BYTES300 16 tcl check of bytecnt <S sample 14.4 K dc M_SCCR1200 set clock for 120C data baud rate dc BYTES1200_16 tol check of bytecnt @ sample 14.4 K dc BYTES1200_16 tol check of bytecnt ® sample 14.4 K dc M_SCCR2400 set clock for 24C0 data baud rate dc BYTES2400 16 tcl check of bytecnt ® sample 14 4 K SUBSTITUTE SHEET (RULE 26) 'BAD ORIGINAL ^ ) αc BYTES24 dc M_SCCR3 6c: dc BYTES36 00 16 dc BYTES36 00~16 dc M_SCCR4 800 dc BYTES48 00_16 dc BYTES48 00_16 dc M_SCCR3 84G.0 dc BYTES38 400_16 dc BYTES38 4CC_16 dc M_SCCR9 600 dc BYTES96 00_16 dc BYTES96 00_16 dc M_SCCR1 9200 dc BYTES19 20C_16 dc BYTΞS19 2CC 16 128.8 128.8 endif define MICRO decoder Auto Select MUSICAM frame sizes t o αetermme if input data is MUSICAM frames vs G722 data what is the framing bit rate and sampling rate -SAMPLE 16K AND 24K endm end of box_ctl.asm _************#*****#********* * list SUBSTITUTE SHEET (RULE 2β) B AD ORIGINAL J> opt fc (c: 1995. Copyright Corporate Computer Systems, Inc. All rights reserved. \DGCST\dcframe .asm: u_psych parameter for fmdrms vs checksub title 'PCM data thru XPSYCHO and XCODE' multiple mono channels This routine receives a buffer of PCM data and builds a stand alone single channel mono frame for multiple mono channel devices on entry rO = address of the input PCM buffer rl = address of the coded frame buffer a = destroyed b = destroyed yO = destroyed yl = destroyed rC = destroyed rl = destroyed r4 = destroyed n4 = destroyed include 'def.asm' section highmisc xdef ntonals :number cf tonals in tonal structure inumcer of maskers in masker structure ;table for searching for tonals rts ; ' ~ ^P <top /il l debug if using stored ames Duffer jmp <_xcode_ jmp <_polya_ i i idbg *** ** ** * ** * * *** * * ******* *** **** * ** *** * ** ****** * S t ar t XPSYCHO ** *** * ****** * * * * * **** * ** * **** * * ** * *** * *** * * * **** * ******** ** ** * ** **** Now get the position to read the fft data from This buffer is offset from the polyphase filter to accour for the delay through the filter. ,-set to a mod buffer ;get input pem buffer address ,-back up to position fft ,-get hanning output buffer address ,-apply a hanning window ,-restore rO to linear buffer )sr :fft ,-fft the data real part of fft imaginary part of fft power array compute power of fft data ,-power array /maximum in each sub-band (sib 1 ,-fιnd max power in a sub-band power array tonal array range table for tonal search find tonals save number of tonals power array tonal array range table for tonal search zero power around tonals power array address of the noise array find the noise address cf the masker structure address of the noise array address of the Tonals structure ft cf tonals in Tonals structure merge the maskers save ft of maskers ,-get address of the Masker structure ,-number cf maskers n masker structure ,-fιnd the db value cf masκ_ers ,-get address cf the Masker structure ,-prune close maskers ,-get address of the Masker structure ,-number of maskers in masker structure ,-prune quiet maskers ,-get address of the Masker structure ,-number of maskers in masker structure ,-prune masked maskers address of the Tonals structure ft of tonals in Tonals structure destination buffer address find alismg components rget address of the Masker structure ,-address of global masking thresncid ,-calculate global masking threshold _po ya_ ,- polypnase filter the input data move y:<polyst,r0 ,-get polyana start address move ftPCMSIZE-l,mO ;set as a mod buffer move ftPlAnal,r5 ,-set start of the sub-band output buffe: j sr <polyanal ,-poly analyze the data move y:-.linear, O ,-restore to linear ctl ; develop the scale factors ,- initialize the table of scale factors to minimum amplitude (63 ==> 0 ampl move #SBndSKF,rO ,-addr of sub-band scale factors move ft63,n4 do #NUMSUBBANDS*NPERGROUP, _inιt_00 move n4,x: (rO) + ,-get value t: store shared memorv init 00 move ftPlAnal.rO addr of poly analyzed data move #SBndSKF,rl addr of sub-band scale factors jsr <findskf find scale factors develop the SBits for scale factors move ftSBndSKF.rO addr cf sub-band scale factors move ftSBιts,rl addr cf sub-band sbits jsr <pιckskf pick the best scale factors xcode Start XCODE ** ** * * * ** * * * * ** **** ** * * ** ** ** * * **** ** * * * ** ** ** ***** * ***** ** * :determine which method to use tc determine the sub-band maximum values get use fmdrms.asm rtr. parameter if less than .5, use cnecksub.asm rt see if parameter less than .5 if less, use checKsuo.asm rtn ,-use RMS for maximum level for the sub-band addr of poly analyzed data addr of sub-band max find max in a subband go to set minimum masking leve2 do_checksub :set correct maximum level for the channel move ftSBndSKF,rO ,addr of sub-band scale factors move ftSBMaxDb, rl ,-addr of sub-band max jsr <checκsuD ,-fιnd max in a subϋand _set_mm_masκ ,-set minimum masking level in each sub-band move #GlbMsk,rO channel global masking threshold move ftMinMskDb,rl minimum masking per subband (sib) 3 sr <fιndmιnm find min masking ,-set minimum masking level m each sub-band: left channel then right channel number of aliaser's aliasing structure max in each sub-oand (sib 1 find the maximum signal ;set numoer cf fixed bits required, and the number of available Dies for audi: jsr <bιtpool ,-save fixed bit count ,-save bit count available for alloc scale factors minimum masking per sub-band (s_ maximum in each suc-band (sib 1 sub-cand position sub-band mdicies allocate the bits ,-code tne channel audio frame jsr <codeframe rts SUBSTITUTE SHEET (RULE 26) RAD ORtGiNAL opt ic 1995. Copyright Corporate Computer Systems, Inc. All rights reserved. \RMICRC\getbal .asm title 'Get bit allocations' This routine s used to get the bit allocations of each of the sub-bands. It is from the ISO standard. sub-band 0 - 10 use 4 bits (11 * 4 = 44 bits) sub-oand 11 - 22 use 3 bits (12 * 3 = 36 bits) sub-nand 23 - 26 use 2 bits ( 4 * 2 = 8 bits) ' total = 88 bits) or. entry rO = address of bit allocation array for both left and ng. cr.anne s r6 = current offset in the input array n6 = base address of the input array y:<maxsubs = MAXSUBBANDS at sampling rate and bit rate vise = shift count of current input word y:frmtype = full stereo, joint stereo or mono y:sιbound = joint stereo sub-band intensity bound x:crcbιts = accumulator of bits covered by CRC-16 routine (bit allocation bits are accumulated) r6 = updated y=sc = updated place holder in mask table mask table for 1 bit getvalue mask tabie for 2 bit getvalue mask table for 3 bit getvalue mask table for 4 bit αetvalue SUBSTITUTE SHEET (RULE 26) V ac SOOCOlf άc SC0003f dc S00007f dc SOOOOff dc soooiff dc $0003ff dc $0007ff dc SOOOfff dc SOOlfff dc $003fff dc S007fff dc SOOffff ,-defme data size table for the getvalue routine to extract data tbl section highmisc xdef skftbl xdef skftbl_l xdef skftbl_2 xdef skftbl_3 org xhe : stgetbal_xhe ,-address of BAL's bit table as per Allowed table selected skftbl ds 1 / These t ables is the number of bits used by the scale factor in each sub-band / High sampling rates with higher bit rate framing skftbl 1 ;sub-band 0 ,-sub-band 1 / sub-band 2 ,-sub-band 3 sub- band 4 sub- band 5 sub- band 6 sub- band 7 sub- band 8 sub- band 9 sub- band 10 sub- band 11 sub- band 12 sub-band 13 sub-band 14 sub-band 15 sub-band 16 sub- band 17 sub-band 18 sub-band 19 sub-band 20 sub-band 21 sub-band 22 sub-band 23 sub-band 24 sub-band 25 sub-band 26 sub-band 27 sub-band 28 sub-band 29 : sub-band 30 : sub-band 31 ,- High sampling rates with lower bit rate framing skftbl 2 ,-sub-band 0 ,-sub-band 1 sub-band 2 sub-band 3 sub-band 4 sub-band 5 sub-band 6 sub-band 7 sub-band 8 sub-band 9 sub-band 10 sub-band 11 sub-band 12 sub-band 13 sub-band 14 sub-band 15 sub-band 16 sub-band 17 sub-band 18 sub-band 19 sub-band 20 SUD- oanα _._. sub- band 22 sub- band 23 sub- band 24 sub- band 25 sub- band 26 sub- band 27 sub- band 28 sub- band 29 sub- band 30 sub- band 31 ,- Low sampling rates skftbl 3 dc 4 sub-band 0 dc 4 sub-band 1 dc 4 sub-band 2 dc 4 sub-band 3 dc 3 sub-band dc 3 sub-band dc 3 sub-band dc 3 sub-band dc 3 sub-band 8 dc 3 sub-band 9 dc 3 sub-band 10 dc 2 sub -band 11 dc 2 sub-band 12 dc 2 sub-band 13 dc 2 sub-band 14 dc 2 sub-band 15 dc 2 sub-band 16 dc 2 sub -band 17 dc 2 sub -band 18 dc 2 sub ■ band 19 dc 2 sub ■ band 20 dc sub ■ band 21 dc sub ■ band 22 dc sub •band 23 dc sub -band 24 dc sub ■ band 25 dc sub ■ band 26 dc sub ■ band 27 dc sub ■ band 28 dc sub ■ band 29 ;end table 3-3. dc :sub-band 30 dc :sub-band 31 endgetoal_xhe endsec phe ; initialize : a. rl with start of subband allocation table of bits in frame per sub-band b. πO offset for right channel sub-band bit allocation values: left channel from 0 to (NUMSUBBANDS - 1) h.- SUBSTITUTE SHEET (RULE 2 BAD O .^ - ■ X rignt channel from NUMSUBBANDS to < (2 * NUMSUBBANDS - i :3 set with joint stereo sub-band Doundary for sterec intensity 4 (4-31) , 8 (8-31" , 12 (12-31) or 16 (16-31) getbal move x:skftbl,rl move ftmasktbl, r2 move ftNUMSUBBANDS, O /offset for right enannel move y:<sιbound, r3 ;decr sterec mtens sub-band ctr move x: crcbits, r5 ,-get CRC-16 bit counter loop nrough the sub-bands extracting the left and right ιif applicable* b t a_ ocation index values 'y:<maxsubs ■ fixed count of sub-bands framed) : fcr current sub-band get the number of bits for allocation index value and mcrement address cf the next sub-band bit count D. ge the bit allocation for the left channel always c . D register isolate the type of frame: full stereo, joint stereo or mono d . yC holds the mono frame type code for testing e . yi holds the joint stereo frame type code for testing see f the frame type is joint stereo and just in case, move the current stereo intensity sub-band Doundary counter value for testing - - net joint stereo, see if this is a mono frame type it is joint stereo: test if the boundary counter has reached zero, and ust m case it has, restore the left channel bit allocation value to the al register if the counter is zero, go to copy left channel into the right channel if not , go to extract the full stereo right channel allocation value do y: <maxsubs,_getb_40 move x: (rl) +,n4 get ft of bits to read move n4,n2 get hi order bit mask index move n4,n5 to accumulate CRC-16 bits jsr <getvalue get a left chan bit allocation move y: (r2+n2) ,xl mask for high order one's move ιr5) +n5 accum bits for CRC-16 rtn and xl,a y:<frmtype,b mask off high order one's & set for frame type compare move al,x: (rO) set left channel move ft>M NO,yO ck for no right channel move ft>JOINT_STEREO, y1 ck for intensity sub-Dand emp yl.b r3 , a check for stereo intensity jne <_getb_10 if not, see if mono tst a x: (rO) ,al reached bound, restore left val jeq «__getb_30 yes, left val to right val move !r3) - no, deer mtens sub-band cntr jmp <_getb_20 and retre ve πσht cnan value :est for a mono type of frame and ust in case it is, set al for insertion into the right channel for consistency _f it is mono, go to move the right channel value otherwise, fall through to full stereo _getb_lC emp yO , b ftO.al /if mono, insert 0 for right jeq <_getb_30 full stereo, extract the right channel bit allocation value σetb 20 jsr <getvalue / get a right char, bit allocation SUBSTITUTE SHEET (RULE 26) mask for high order one's accum bits for CRC-16 rtn mask off high order one's insert the right channel value (nO offset! increment for the next sub-band _getb_30 move al,x: (rO+nO) ,-right channel sub-band alloc move (rO) + ; incr for next sub-band _getb_40 Fill the unused sub-bands with 0 bit allocation This allows getdata to process these sub-bands normally and insert 0 data in them. /current MAXSUBBANDS ,-equals unused sub-bands ,-rιght channel ,-left chan & incr for next :store updated CRC-16 bit counte: SUBSTITUTE SHEET (RULE 26) \ ORDINAL opt fc, cex,mex ( c ) 1995. Copyright Corporate Computer Systems, Inc. Ail righ t s reserved. \DGCST\getdata.asm: moves to high P-Memory title 'Get the Data' This routine sets the data in the output buffer on entry r3 = address of left _. right channel SubBandlndex array (x memory! r2 = address of left £_ right channel SubBandSKFs array (x memory) rl = addr of buffer for a set of left and right channel recovered dat (192 samples: one group of 3 samples, 32 subbands, 2 channels; y:<maxsubs = MAXSUBBANDS at sampling rate and b t rate y:AllwAdd = address of the proper Allowed table at sample/bit rates y:frmtype = whether full stereo, joint stereo or mon frame y:sibound = if joint stereo, sub-band boundary for stereo intensity shared memory for rsynth include 'def.asm' include ' ..\rmicro\getvalue .mac' section highmisc xdef NBits xdef CC xdef DD xdef packmax xdef packrpl org xhe: stge data_xhe NBits dc position = 0, place holder dc position = 1 dc position = 2 dc position - 3 dc position = 4 dc 4 -65 ;posιtier. dc 5 ,-posιtion dc 6 ,-posιtion dc 7 ,-posιtion dc 8 ,-posιtion 9 dc 9 ,-posιtion 10 dc 10 ,-posιtion 11 dc 11 ,-posιtion 12 dc 12 ,-posιtion 13 dc 13 ,-posιtion 14 dc 14 ,-position 15 dc 15 :posιtion 16 dc 16 :poSltion 17 CC dc position 0, place holder dc $555555 4.0/ (3. *2. 0) position 1 */ dc $666666 8.0/(5. *2. C) position 2 */ dc $492492 8.0/(7. *2.0) position 3 */ dc S71C71C 16.0/ (9 0*2 0) position 4 */ dc 5444444 16.0/ (1 .0 2.0) position 5 * ' dc $421084 32.0/(3 .0 2.0) position 6 */ dc $410410 64.0/ (6 .0 2.0) position 7 * dc $408102 128.0/ ( 27 0*2.0) position 8 * dc $404040 256.0/ ( 55 0*2.0) position 9 * ' dc $402010 512.0/ ( 11 0*2.0) position 10 */ dc $401004 1024.0/ 1023.0*2.0) position 11 */ dc $400801 2048.0/ 2047.0*2.0) position 12 */ dc $400400 4096.0/ 4095.0*2.0) position 13 */ dc $400200 8192.0/ 8191.0*2.0) position 14 */ dc $400100 16384.0 (16383.0*2.0) position 15 * / dc $400080 32768.0 (32767.0*2.0) position 16 */ dc $400040 65536.0 (65535.0*2.0) position 17 */ DD dc $000000 position place holder dc ScOOOOO position .5000000-1.0 */ dc ScOOOOO position 2, .5000000-1 */ dc $a00000 position 3, .2500000-1 */ dc ScOOOOO position 4, .5000000-1 */ dc $900000 position 5, .1250000-1 */ dc $880000 position 6, .0625000-1 */ dc $840000 position 7, .0312500-1 */ dc $820000 position 8, .0015625-1 */ dc $810000 position 9, .0007812-1 */ dc $808000 position 10 .0003906-1.0 dc $804000 position 11 .0001953-1.0 dc $802000 position 12 .0000976-1.0 dc $801000 position 13 .0000488-1.0 dc $800800 position 14 .0000244-1.0 dc $800400 position 15 .0000122-1.0 dc $800200 position 16 .0000061-1.0 dc $800100 position 17 .0000030-1.0 check for bit errors in packed positions: 1, 2, 3 and 4 STANDARD ISO CCS COMPRESSED position max replacement max replacement value value value value 1 26 13 14 7 2 124 62 62 31 SUBSTITUTE SHEET (RULE 26 i - BAD ORDINAL 438 219 A value after uppackmg B value after uppack ng C value after uppacking incr sub-band for stereo intensity block no 0:0-3, 1:4-7, 2:8-11 save a register value hold current DValue hold current CValue left & right channel recovered data A start addr shared mem for samples starting addr for SKF's starting addr for SBIndx's save addr of applicable Allowed table current address in Allowed for sb ;bιts = 0, place holder endgetdata_yhe endsec org phe getdata move r2,y:SKFaddr ,-save start address move r3,y: INXaddr ,-save start address move rl,y:ASMDadd ;save start addr lvquant values move #0,r0 ,-start group number loop through the 12 groups of 3 samples per sub-band per channel advancing through 36 samples set-up for the group: 1. set starting address for inverse quantized values 2. reset the starting address of the Allowed sub-band bits 3. determine the SKF factor grouping 4. set up for joint stereo sub-band intensity boundary checking do ftNUMPERSUBBAND,_getd_90 set up for next group of samples move y:ASMDadd, rl reset start recover data addr move rl,y:ivdata init recovered data curr addr move y: INXaddr, r3 reset SBIndx ptr move y:SKFaddr,r2 reset start SKF address move y:AllwAdd, r5 reset address of allowed move r5,y:Allow and save set which block of SKFs (scale factor indices) : 0 for group of 4 samples 0-3 1 for group of 4 samples 4-7 2 for group of 4 samples 8-11 ;curr group to test :block [0] groups 0 - 3 ;block [1] groups 4 - 7 SUBSTITUTE SHEET (RULE 2S) gt <_getd_06 move ft>2,yl ,-block [2] groups _getd_06 move (rO) + ,- increment the grouo numoer move yl , y : <block ,-save which block [0, 1 or 2 :set-up for joint stereo sub-Dand intensity control move y : <sιbound,n0 ,- oint stereo intensity sub-band move nO , y : <bandcnt ,-bound sub-band decremented cr.tr bclr ftJOINT_at_SB_BOUND,y:<ctlfIgs ,- clear reached intensity suo-oand ;process this collection of three samples per sub-band per channel ftNUMSUBBANDS , αetd 8C move y: ivdata, rl left channel bloc. 1st move ftO , n3 left channel SBIndx values bclr # EFT_vs_RIGK nidcate working on left chan move y:<block,n2 which block cf SKFs ,-process left channel and then right channel for current sub-band do ftNUMCHANNELS,_getd_75 spaced by number of subbands SubBandlndex [SubBand] get the address cf Allowed [SE] address of the D table get position for the subDand save the position check position == 0 AND set position for DVaiue fetch not transmitted address of the C table DVaiue CValue save DVaiue save CValue address of NBits array to test for packed pos 1 below nbits SKFIndex [SubBand] [biocκ] SKF table address / now, if doing the left channel, continue with extracting data / otherwise, check for j oint stereo and the intensity bound of sub-band ;if riσht channel j oint stereo sub-band intensity boundary reached, ; inverse quantize the saved raw values extracted for the left channel / otherwise extract the true right cnannel stereo values for inverse quantizing ft EFT vs_RIGKT, v : < ctlflgs,_getd_10 ,-clear if doing on left cr.an ■ set ft OINT at SB_30UND,y: <ctlflgs,_getd_50 ,- eached round, do right _getd_l a. set up for extracting the data values b. test the position for packed types (positions : 1 , 2, 3 or 4 ) get shift table address save nbits get the shift count get current frame word check position == l handle pos 1 with 3 packed values check position == 2 handle pos 2 with 3 packed values check position == 4 handle pos 4 with 3 packed values check position == 3, and f not, handle all other pos as unpacked for position 3 : if compressed mode, handle allocation as a packed value otherwise, handle as ISO standard unpacked set of 3 values set ftDECOMPRESS_?ACKED,y: <ctlflgε,_getd_35 _getd_12 ; not position 1, 2 or 4 so just a regular input of 3 adjacent data values move y: (r4+n4) ,x0 /get shift left multiplier per bit cnt ; extract the 1st value and save it in y:<av mpy xO , yO , a n4 , xl shift extracted bits into al w th newly shifted curwd in aC & save passed numb bits required sub xl , b a0,y:<curwd see if next word need to complete va_.ue Si save newly shifted curwd move b,y:<sc save new shift count ■ let's try a macro ge <_getd_16 getnextword 10,15 _getd_16 move al , y : <av : save 1st for inverse quant extract the 2nd value and save it in y:<bv get current frame word get shift left multiplier per bit cnt shift extracted bits into al with newly shifted curwd in aO S_ save passed numb bits required see if next word need to complete value & save newly shifted curwd save new shift count ; xet ' s trv a macro SUBSTITUTE SHEET ( RULE 26) BAD ORIGINAL 1 * . jge <_getd_18 getnextword 20,25 _getd_18 move al,y:<bv ,-save 2nd for inverse qua: , extract the 3rd value and save it in y:<cv move y:<curwd,yO get current frame word move y: (r4+n4) ,x0 get shift left multiplier per bit cnt mpy xO ,y0, a n4 ,xl shift extracted bits into al with newly shifted curwd in aO - save passed numb bits required sub xl,b aO,y:<curwd see if next word need to complete value S. save newly shifted curwd save new shift count yes, get rest from next l p frame word ;save 3rd for inverse quant ;go to do inverse quantizing Pos 1 Three adjacent data values are packed into 5 bits, Eacn of the data values are only 2 bits w de. packed_value = valueO * 9 ♦ valuel * 3 * value2 or packed value = 3 * (valueO * 3 + valuel) + value2 _getd_20 move ft>26,x0 ISO maximum packed value move ft>13,xl ISO replacement value move #MASKUPACK3 ,n4 unpack getvalue mask .f compressed, switch to compressed mas* CCS compression maximum packed vaj CCS compression replacement value compressed unpack getvalue masK _getd_2: /save in y:<avalue for now ,-unpack initial divisor ;save in y:<bvalue for now ,-unpack initial multiplier ;save in y:<cvalue for now ,-unpac second divisor ;save in y:<crcstrt for now ,-unpack second multiplier ;save in y:<svereg for now ;unpack loop counter ,-save in y:<not_appl for now ,-change to packed values nc ts rompressed, switch to compressed nbits ftDECOMPRESS_PACKED,y: <ctiflgs,_getd_22 j» _ n ;change to compress packed values _getd 22 BAD ORIGINA g mp <_getd_45 Pos 2. Three adjacent data values are packed into 7 bits, Each of the data values are only 3 bits wide. packed_value = valueO * 25 + valuel * 5 * value2 or packed_value = 5 * (valueO * 5 - valuel/ + value2 _getd_30 move ft>124,x0 ISO maximum packed value move ft>62,xl ISO replacement value move ftMASKUPACK5,n4 unpack getvalue mask .f compressed, switch to compressed mask CCS compression maximum packed value CCS compression replacement value compressed unpack getvalue mas _getd_3 save in y:<avalue for now unpack initial divisor save in y:<bvalue for now unpack initial multiplier save in y:<cvalue for now unpack second divisor save in y:<crcstrt for now unpack second multiplier save m y:<svereg for now unpack loop counter save in y:<not_appl for now change to packed values nbits if compressed, switch to compressed nbits clr ftDECOMPRESS_PACKED,y: <ctlflgs,_getd_32 move #6,n4 ,-change to compress packed values ncits _getd_32 mp <_getd_45 Compressed pos 3 : Three adjacent data values are packed into 8 bits. Each cf the data values are only 3 bits wide. packed_value = valueO * 64 + valuel * 8 + value2 or packed_value = 8 * (valueO * 8 + valuel ■ * value2 _getd_35 CCS compression maximum packed value CCS compression replacement value unpack getvalue mask save m y:<avalue for now unpack initial divisor save m y:<bvalue fcr now unpack initial multiplier save in y:<cvalue for now SUBSTITUTESHEET(RULE26) l^lN AL ,-unpacκ second divisor ,-save in y:<crcstrt for now /unpack second multiplier ,-save in y:<svereg for now ,-unpack loop counter ;save in y:<not_appl for now ,-change to packed values nbits Pos 4: Tnree adjacent data values are packed into 10 bits. Each of the data values are only 4 bits wide. packed_value = valueO * 81 + valuel * 9 + value2 or packed_value = 9 * (valueO * 9 + valuel) -. value2 _getd_40 ISO maximum packed value ISO replacement value unpack getvalue mask save in y:<avalue for now unpack initial divisor save in y.<bvalue for now unpack initial multiplier save in y:<cvalue for now unpack second divisor save in y:<crcstrt for now unpack second multiplier save in y:<svereg for now unpack loop counter save in y:<not_appl for now change to packed values nbits :handle the data value extraction from the frame and unpack for either position 2, 3 compressed) or 4 _getd_45 move xO, x:packmax ;save position max packed value move xl, x:packrpl /save position replacement value move y: 'r4+n4) ,xO ,-get shift left multiplier per bit clr #DECOMPRESS_PACKED,y: <ctlflgs,_getd_46 move n4 , y:getdataN4Save ,-save the bit field size _getd_46 mpy ! ,yO, a n ,xl shift extracted bits into al with newly shifted curwd in aO & save passed numb bits required sub xl,b a0,y:<curwd see if next word need to complete value & save newly shifted curwd save new shift count yes, get rest from next l/p frame word unpack getvalue mask mask off high order one's clean up ,-test for a possible bit error that might have caused a value above the .-maximuT caeted value if above maximum, replace with the middle value ,-get poisition max packed dvalue ,-compare retrieved value to max ,-if net above max value, continue ,-since above, replace value ,-restore the bit field size ,-set compressed value for table look up ,-get the decompressed value for unpack ,-get 3 parts ,-restore nbits ,-now let's inverse quantize the 3 samples _getd_50 to left justify in ivquant: save A value get left shift value save left shift n bl get C factor 1st value: left justify bits Sc set DVaiue move rslt to correct registe: Y + D S. set CValue forget sign extension C * (Y + D) & set up C factor rnd scale factor * C * !Y * I ~ reget left shift value mult by 2 again & get B value ,-ivquanti 2nd value: 2nd value: left justify bits δ. store 1st data value move rslt to correct register Y + D forget sign extension C * (Y + D) & reget C factor rnd scale factor * C * (Y + D) 4 reget left shift value mult by 2 again & get C value :ivquanti 3rd value: mpy yO.yl.a a,x: (rl) +nl ;3rd value: left justify b: BAD ORIGINAL -74- 4 store 2nd data value move rslt to correct regιs"e»- Y + D forget sign extension C * (Y + D) St reget C factor rnd scale factor * C * (Y * D St setup for intensity boundar mult by 2 again, St set up to test for intensity bounda store 3rd data value try next channel All the 3 adjacent values in the sub-band are 0 _getd_60 clr y: <bandcnt,b output 0 value, t setup to test for intensity bounda setup for intensity boundary We have ust finished the current channel and if we just did the left, set up for the right channel if just did right channel, check for joint stereo and the intensity bound of sub-band if not a joint stereo frame, go set-up for the next sub-band, if right channel joint stereo sub-band intensity boundary reached, go set-up for the next sub-band, otherwise, decrement the intensity boundary sub-band counter before the go set-up for the next sub-band. _getd_70 clr ftl_EFT_vs_RIGHT,y: <ctlflgs,_getd_72 /if did left, go set-up right clr #JOINT_FRAMING,y:<ctlflgs,_getd_72 .-continue if not joint jset #JOINT_at_SB_BOUND,y:<ctlflgs,_getd_72 ,-ιf reached, continue sub yl.b not reached so decrement ctr move bl,y:bandcnt and save for next sub-band jgt <_getd_72 if not reached, continue bset ftJOINT_at_SB_BOUND,y:<ctlflgs if reached, set indicator ;after the left channel, set-up to do the right channel _getd_72 move ftNUMSUBBANDS*NPERGROUP,nl ad to right channel fields move y:ivdata, rl get current start address move # > NUMSUBBANDS*NPERGROUP,a move to SKFs for right channel move y:<block,x0 get current block offset add x0,a ftNUMSUBBANDS,n3 add right chan offset, set AND set ad to right SBIndx bset ftLEFT_vs_RIGHT,y:<ctlflgs indicate now doint right move (rl) +nl adjust rl to right rec data move al,n2 offset register 2 We have ust finished both channels for a sub-band. 1. ad j ust left and right received sample pointers to next sub-band 2 increment SBIndx array pointer for next sub-band 3. increment tne SKFs array pointer over previous sub-oand's 2nd St 3rd SKFs . increment t h e Allowed array pointer to next sub-band SUBSTITUTE SHEET (RULE 26) _getd_75 incr left and right rcv'd samps address prev sub-band adj next sub-band, incr SBIndx save new addr next sub-band adj Allow ptr to next sub-band get current Allow address adj Allow ptr, adj SKFs by 3 save Allowed for next sub-band next sub-band SKFs addr _getd_8C / We have ust finished a group of 3 samples per sub-band per .hanne. and we must send these value to the polysyntnesis dsp move r0,y:<svereg save the key register bclr #0,y: <not_appl clear tested c t f not app. jsr <syntn synth this group of values move y:<svereg,rC restore the Key register _getd_9C bclr #0,y:<not_appl ,-clear tested bit f not appiic rtε SUBSTITUTESHEET(RULE 2 β) BAD ORIGINAL opt (c) 1995. Copyright Corporate Computer Systems, Inc. All rights reserved. \DGCST\rsdecl6.asm: decoder Reed Solomon decoder title ' program' include ' include ' .. \common\ioequ. asm' include 'rstest.as ' this program will decode data in the input buffer according a decode profile with format as follow: parity byte, message byte, repetition times -- first block parity byte, message byte, repetition times -- 2nd blocκ parity byte, message byte, repetition times, 0 • - last block the output data w ll be placed at output buffer ,-parity byte /message nyte ,-codewora Dyte /delay byte ; insert zero byte ,-mess + pan byte ; mp store r3 ;Rs Loop replacement ,-Rs Loop replacement formula that cal the legency delay (P)parιty, (M) essage, delay, repetition delay = (16*<P+M) + P*P «- 4*P +73) / 8 - 1 org yhe : strdecl6_2_yhe PROF1 ;RS profile dc 16,129, ,-RS decode SUBSTITUTESHEET(RULE26) O 96/32805 77 CodeMinLen RS code mm lengt: per block dc 1,6,6,8,10,14,18,24,30,38,46 t=0, l, 2 , .. , 10 dc 56,66,78, 90,104,118 t=ll, 12, .. , 16 endrdecl6_2_yhe endsec ********************************** RS decode routine ********************************** This code is for RS decoder chip that the input is always enabled but output will be enabled when we have the output coming on entry rl output ptr in X SPACE r3 input profile ptr in Y SPACE r6 input data ptr in X SPACE on exit rl destroyed r2 destroyed r3 destroyed r4 destroyed r5 destroyed r6 destroyed a destroyed b destroyed xO destroyed xl destroyed yO destroyed y destroyed org pli: rsdecie .-initial here move #-l,m6 /reset reg r6 to linear move #0,n6 ;reset n6 to 0 move #-l,ml move #3-1,m2 ,-mod 3 - - 2,1,0 move #-l,m5 move #2,r2 ,-set to first byte move #0,r5 ,-word count move #>24,x0 move x0,y:rssc move x: (r6) + ,x0 /set for rsgetvalues move x0,y:rscurwd _Ber.try Dc.r #l,x:<<M PCD the bit elk SUBSTITUTE SHEET (RULE 26 lNAL movep S 3 08 C 8 , x : < <M_BCR ■ set OW to "cs" ; u Sxe. set y: for 8 wai: state : SOFTWARE RESET cir ,- zero move al ,y:RSReg8 ,- reset case : wait for some clock to pass away for the completeness cf reset do #400 ,_resetch nop _resetch : read message length and parity length from profile (r3, ι-,xl ,-parιty ; set no insert byte ,-message length ;decide whether add zero is needed ;get parity byte ;/2 ,-get m codelen ;get T ,-get message byte len ;get min len allowed ,-store insert byte num ,-get inserted byte ! , Xl byte mDyte wr RS block length move al,y:RSRegl ,-a4=0,a3=l only 40MHZ elk and CS and WR move a1,y:mapbyte ,-save message + parity byte move y: byte, a ,-get meaasge byte move #_l,xl sub xl,a y:mbyte, xl ,-get message byte move al,y:cbyte ,-save message byte length -l move y:pbyte, xO ,- load xO mpy xO , xO, a ;p*p move aO, al lsr a ft>73,xC ,-a == ρ**2 add x0,a y:pbyte, b ;+ 73 Isl b al.xO sl b y :mapDyte, al add xC , b ; * 4xt> Isl a /x 16 Isl a Isl a Isl a bl,xO add xO, #>l,xO • + 16x(m+p) lsr a 78 lsr a lsr a cal the delay sub xl , a y : pbyte , xl ,-get p byte sub xl , a y : mbyte , xl /get insert byte sub xl , a move al , y : dbyte /delay without output reading move y : pbyte , al ;# of bytes to be PARITY BYTES ,- Wr parity length move ai,y:RSReg2 ,-a4=0,a3=l elk CS/WR pulses are active lsr a ;/2 get correction power ; Wr correction power, t number move al,y:RSReg3 ,-a4=0,a3=l only reset pulse and elk move #>32,al ,-set SYMBOL Synthesis of the RS codec ; Wr synthesis clock move al,y:RSReg6 ,-N at address 5 move #>0,al ,-set SYMBOL division 8 bit per symbol / Wr bit per symbol move al,y:RSReg7 ,-address 6 / reset again after all register have been filled move #0,al move al,y:RSReg8 ,- reset again do #400,_resetch2 nop resetch2 ;40 MHZ elk is there bset #l,x:<<M_PCD /turn off the bit elk after reset ; Initialization is completed movep #$0101,x: <<M_BCR ,-set low duration of "cs" (chip sleet / RS decoding start move y: (r3 ) +,xO ,-load the repetition time move x0,y:RsLpCnt move r3,y:RsR3Tmp ,-save r3 for later SUBSTITUTE SHEET (RULE 26) D OHfc»» NAL 0 _RsLoop ■ get first input byte move #8,n4 jsr <rsgetvalues or FRAME START SIGNAL and first byte move #>$100,xl insert frame start signal or xl, a The first DATA byte is "OR ' gated as the R-S codec thinks you are sending the first data byte at the same time with the FRAME start pulse. do #8,_dtasndl00 movep al,y:<<RSIN :SEND 1st data byte and also RAISE tne : FRAME START PULSE _dtasndl00 ; input message-1 byte to decode /initial loop count ,-a4=l,a3=l only elk and data ;test loop cnt /dec count ,-resave loop count _EndRsLoopl ; insert zero message byte to decode if it's not zero ,-chk if insertion is needed ,-initial loop count =l,a3=l only elk and data ,-test loop cnt ,-dec count ,-resave loop count SUBSTITUTESHEET(RULE26^ -~-χr f BAD ORIGINAL _EndRsLoop2 _NoIntιon ; input parity byte to decode initial loop count =l,a3=l only elk and data /test loop cnt ,-dec count resave loop count /initial loop count :a4=l,a3=l only elk and data :test loop cnt :dec count ,-resave loop count /shift right 16 bits ,-shιft right 8 bits ,- initial lp count ,-a4=l,a3=l only elk and data / provide clock and read data /get set for shift , test byte counter and put output byte to right pos of output buffei SUBSTITUTESHEET(PULE2^ ORIGINAL U BAD ,- get byte rount • shift right 8 bits /shift right 16 bits :or it with previous 8 bits ;mask off last 8 bits :increase word count ; save the musicam data for desort 2-1-0 mod test loop cnt dec count :resave loop count :chk if insertion is needed initial ID count _RsLoop6 do #8, dtasnd20 ;a4=l,a3=l only elk and data ,-test loop cnt /dec count SUBSTITUTE SHEET (R' LE 26) BAD ORIGINAL 1 move a, y:RsLpCntl ,-resave loop count cir a jmp <_RsLoop6 _EndRsLoop6 _NoIntιonl0 ; forget parity output at the end of frame ,- initial lp count ,-a4=l,a3=l only elk and data /test loop cnt ,-dec count ■ resave loop count /test loop cnt ,-dec count ,-resave loop count ,- repetition end _RepEnd move y:RsR3Tmp, r3 ■ reload profile ptr nop move y: (r3) ,a test if a '0' at last RS block tst a jne <_Bentry ,- patch zero to make 96 (a full frame) move #>96,a move r5,x0 sub x0,a #0,x0 jle <_PatchZerol do a,_PatchZerol move x0,x: (rl) + ;inc to next frame PatchZerol end of RS decoding for One Profile move #-1,m2 movep #$0001,x:<<M_BCR :set all external 10 wait states rts SUBSTITUTESHEET(RULE26) BAD ORIGINAL opt fc , (c) 1995 Copyright Corporate Computer Systems, Ine All rights reserved ,- .asm: use the o_psych parameter (safety margin) This routine is used to allocate the bits. It allocates at least some bits to all sub-bands with a positive SMR It allocates in three phases: A allocate all sub-bands until they are all below the Global Masking Threshold .regardless as to how many bits it takes) note 1. a limit (sub-band boundary) is set which requires all sub-bands up to the boundary require at least index 1 be allocated even if the signal is already below the Global Masking Threshold. (This provides a noticeable improvement in continuity of sound) After Phase A is completed, a test is made to see if the bit pool was overflowed by the allocation, a if the frame fits, Phase B is skipped and Phase C is done D otherwise, Phase B is required to selectively de-allocate the best sub-band candidates. on entry y:<stereo = flags: (set on entry) bit 0 indicates whether or not left channel active 0 = channel not active 1 = channel active for framing bit 1 indicates whether or not center channel active 0 = channel not active 1 = channel active for framing bit 2 indicates whether or not right channel active C = channel not active 1 = channel active for framing bit 3 is used to indicate left vs right channel applies if bit 4 set to 0 (NOT center channel) 0 = looping through left channel arrays 1 = looping tnrough right channel arrays bit 4 is used to indicate center channel vs left right 0 = process left or right channel arrays 1 = looping through center channel arrays bit 5 is used as the FirstTime switch in an allocation 0 = cleared if any allocations were made 1 = no allocations made to any sub-bands bit 6 is used for critical de-allocate and allocate passes with below masking threshold being a criteria de-allocate: 0 = select from any sub-band channel 1 = select from only those below mask allocate: 0 = there are sub-band channels not below mask 1 = all sub-bands are below mask bit 7 is used for critical de-allocate and allocate passes de-allocate : 0 = select from any sub-band channel 1 = select from those with 2 or more allocatio allocate: 0 = are sub-bands not below hearing thresh 1 = all sub-bands are below hearing thresh bit 8 is used for critical de-allocate and allocate passes SUBSTITUTE SHEET (RULE 26) \ Q ^ G \N BAP °- r de-allocate: 0 = select from any sub-oand channel 1 = select from any sub-band channel allocate: for final pass after bit allocation timer 0 = timer interrupt not yet sensed 1 = timer interrupt was sensed bit 9 is to simply indicate that the sub-band limit for allocating at least ONE position has been reached within a current loop: 0 = NOT at sub-band limit 1 = reached the sub-oand limit bit 10 is to simply indicate that the maximum sub-band for consideration for allocation has been reached within a current loop: 0 = NOT at maximum sub-band limit 1 = reached the maximum sub-band limit y:audbιts = number of bits available for sbits, scale factors and data y:<usedsb = number of sub-bands actually used y:<lιmιtsb = number of sub-bands requiring at least one allocation y <qtalloc = timer interrupt set to signal quit allocation loops rO = addr of the SBits array (x memory) rl = addr of MinMask g Db array (x memory) r2 = addr of SubBandMax array (x memory) r4 = addr of the SubBandPosition array (x memory) r5 = addr of the SubBandlndex array (x memory) AtLimit array by sub-bands (32) : bi t 0 set when allocation is below the masking threshold bit 1 set when allocation is below the threshold of hearing bit 2 set when allocation is at the limit of maximum position or there are not enough bits to allocate the sub-band further count cf entries in de-allocate tables available bits to allocate current bit count allocated sub-band critical allocation sub-band counter org yhe: stbitalloc_yhe save address of SBits array save address of SBPosition array save address of SBIndex array save addr of applicable Allowed table Max Position per selected Allowed table curr sub-band for allocation value of curr sub-band for allocation new index for selected sub-band new allowed position for selected sb section highmisc flags set when a sub-band reaches its limit of allocation: (one per 32 subbands) bit 0: set if below the global masking threshold bit 1: set if not used or fully allocated AtLimi t ds NUMSUBBANDS ,This array nolds the MmMask gDb - SubBandMax for each of the 32 suooands SBMsr ds NUMSUBBANDS ;Mask-Sιgnal ratio by sub-band This array holds the deallocation selection values: ( MmMaskmgDb - SubBandMax) + SNR [position at next lower index] for each of the 0-31 subbands ;Mask-to-Sιgnal ratio ,- plus SNR[PrevPos] , able of ordered values sub-band ,-table of associated sub-band section xtabies org xne : stbιtalloc_xtbl /This is the addr of the selected table, ISO or CCS compression, / for the number of bits for data allocation by position ndatabit ds ,-addr ISO or CCS compress NDataBit tbl ;Thιs is the ISO table for the number of bits for data allocation by position NDataBit dc 0*NUMPERSUBBAND dc 5*NUMPERSUBBAND de 7*NUMPERSUBBAND dc 9*NUMPERSUBBAND dc 10*NUMPERSUBBAND dc 12*NUMPERSUBBAND dc 15*NUMPERSUBBAND dc 18*NUMPERSUBBAND dc 21*NUMPERSUBBAND dc 24*NUMPERSUBBAND dc 27*NUMPERSUBBAND dc 30*NUMPERSUBBAND dc 33*NUMPERSUBBAND dc 36*NUMPERSUBBAND dc 39*NUMPERSUBBAND dc 42*NUMPERSUBBAND dc 45*NUMPERSUBBAND dc 48*NUMPERSUBBAND /This is the CCS compression table for number of bits for data allocation by position dc 0*NUMPERSUBBAND /index = 0, no transm: 0 bits 4*NUMPERSUBBAND ,-index = 1, packed 48 cits 6* UMPERSUBBAND , index = 2, pacted SUBSTITUTE SHEET (RULE 26) de 8*NUMPERSUBBAND ~t -~ cits dc I0*NUMPERSUBBAND packed 120 Dits dc 1 *NUMPERSUBBAND 144 bι_s dc 15*NUMPERSUBBAND 180 Dits dc 18* UMPERSUBBAND 216 bits dc 21*NUMPERSUBBAND 252 bits dc 2 *NUMPERSUBBAND 288 bits dc 27*NUMPERSUBBAND 324 bits dc 30*NUMPERSUBBAND 360 bits dc 33*NUMPERSUBBAND 396 bits dc 36*NUMPERSUBBAND 432 bits dc 39*NUMPERSUBBAND 468 bits dc 42*NUMPERSUBBAND 504 bits dc 45* UMPERSUBBAND 540 bits dc 48* UMPERSUBBAND 576 bits Each suo-band, if it is transmitted, must send scale factors. The Sbit patterns determine how many different scale factors are transmitted. The number of scale factors transmitted may be 0, 1, 2 or 3. Each scale factor requires 6 bits. Sbit patterns 00 Transmit all three scale factors 18 (3 * 6 bits) 01 Transmit the second two scale factors 12 (2 * 6 bits) 10 Transmit only one scale factor 6 (l * 6 bits) 11 Transmit the first two scale factors 12 (2 * 6 bits) The NBits array is used to determine the number of bits to allocate for the scale factors. NSBITS (the 2 bits for SBits code) are added to account for all required scale factor bits (18+2, 12+2, 6+2 , 12+2) . NSKFBits dc 20,14,8,14 /This is the table for Signal to Noise ratio by position include ' .. .asm' endbιtalloc_xtbl endsec org phe : bitalloc ,-Save the array starting addresses move r0,y:BitsAdd / save register of SBits array move r4,y:BPosAdd ;save register of SubBandPosition array move r5,y:BInxAdd ,-save register of SubBandlndex array :select the ISO or CCS comperssion table for NDataBit: move #NDataBιt,r5 /standard ISO table move #18,n5 /offset to CCS compression table j clr #0, y: < cmprsctl,_bιta_20_A ,-ιf not applicable, continue move (r5) + n5 /select the CCS compression table _bιta_20_A move r5,x:ndatabιt ,-set addr of NDataBit taole for alloc ,-set up the MNR array move #SBMsr,r5 ,-addr of Mask-to-Signal by sub-band ,-apply the safety factor move y:o_psych,y0 ,-get the safety factor / loop through all sub-bands ,get a channel SBMax /get its channel MmMsk ,-MιnMask - SBMax = Mask-to-Signal ratio ,apply safety factor to channel value ;store for test if below mask already ,-END of do loop ,-set the working value for bits available for allocation move y:audbits,x0 ,-get standard available bit cnt move xO,y: <AvlBιts /store as working bit cnt bita 40 A (c) TotBits 0; /* start the bit allocation counter */ cir a #>l,xl /total bit used, xl = 1 for start index move a,yl ,-yl = 0 to initialize move a,y: <TotB__ts move a,y:<count ;start the sub-band counter bclr #AT_LIMIT_SUBBAND,y:<stereo ,-NOT yet at sub-band limit ,- which require at least 1 allocation bclr #AT_USED_SUBBAND,y: <stereo / NOT yet at sub-band maximum , limit for coding used sub-bands initial allocation for all sub-Dands 1. that are within the use (less than UsedSubBands) 2 with a MinimumMaskmg to MaximumSignal above the masking threshold move #SBMNRmax,r0 addr of de-alloc Max signal-noise move #SBMsr,rl addr of Mask-to-Signal by sub-band move y:BitsAdd,r2 set register of SBits array move y:AllwAdd,n3 mit the current Allow table move y:BPosAdd, r4 set register of SubBandPosition array move y:BInxAdd, r5 set register of SubBandlndex array move #AtLιmιt,r6 point to SubBandAtLimit array ■ clear the n registers for the channel reference #0,n0 SBMNRmax array SBMsr array SBits array SBPos array SBIndx array AtLimit array U -. -- ;initial avocation, pass :de all required sub-bands dc #NUMSUBBANDS,_blta_990_A initialize the pertinent sub-band values move yi,x: (r6+n6. ,-clear allocated limit flag 'AtLimit move yl,x: (r5+n5) ,-clear allocated index (SBIndx move yl ,x: (r4+n , /clear allocated position iSBPos, ;if we reached the used sub-band limit, ta e this one out of tne picture completely set #AT_UΞED_SUBBAN ,y: <stereo,_bιta_180_A move y: -.count, yO ,-get current sub-band (00-3: :see if we reached the used sub-band limit move y:<usedsb,b ,-get count of used suobands for testing emp yC,b ,-see if sub-band not to be coded ng- c_bιta_50_A ,-ιf not, continue bset #AT_USED_SUBBAND,y: <stereo ,- ust reached sub-band maximum jmp <_bιta_180_A /take completely out of use :if we reached the sub-band limit for those requiring at least one sub-band, see if we nave anything to allocate to get below the Glooal Masking Threshold set #AT_LIMIT_SUBBAND,y:<stereo,_bιta_90_A :see if at least one allocation is required regardless of signal to noise ratio move y: elimitsb, a get sub-band limit for at least 1 alloc emp yO , a if there is initial allocation .9- < bita 95 A continue bset #AT_LIMIT_SUBBAN ,y:<stereo ,-just reached that li i _bιta_9C_A ,-otherwise, see if below Mask-to-Signal move x: (rl+nl) ,a get sub-band's Mask-to-Signal ratio tst a test Mast-to-Sig for positive value gt <_bιta_190_A if below maskmσ thresn, set flaσ _Dita_95_A / find Signal-to-Noise position tnat puts Signal below Massing Threshold move xl , r7 start at 1st Signal-to-Noise pes: _on move ftSNR , n7 addr of Signal-to-Noise taoie move x : ( rl +nl ) .yo get signal to mask ratio do ftNUMSNRPOSITIONS-1, blta_110_A move ,-get tne Signai-Ncise a: pes: add 'C,a ,-add MNR to SNR fcr test . -- bi ta 1 0 ; ; st i -. _. aoove mas , : ry next pos : low be low the Global Mask , quit the loop enddo ; f ound pos it ion , stop ftNUMSNRPOS - 1 loop j mp < bita 110 A ,- go to end of loop _bita_100_A ,- try the next position and continue the loop move (r7) /try next Sig-Noise position _bιta_110_A /END of #NUMSNRP0SITI0NS-1 dc loop move r7,yC save the matched SNR position move y:MaxPos, a to test if exceeded max position emp yO , a yl,r3 is counted position greater than max 5. start at index 0 witn allocation jge <_bιta_115_A if not, go on to match the index move al,y0 set position at the maximum position _bιta_lI5_A .find index cf the position that best matches the selected SNR position do #NUMINDEXES,_bιta_130_A get the sub-band indexed position compare to selected position match not found yet, try next index found the matching index, quit the loop enddo found index, stop ftNUMINDEXES loop jmp < bita 130 A go to end of loop _bιta_120_A :try the next index and continue the loop move (r3)+ /try position at next index :see if end cf the table line reached move x: (r3+n3) ,a get this next index to test tst a test for an index cf zero jne <_bita_125_A if not 0, keep iooκmg :index cf zero indicates no higher indices apply, back up 1 and use that move (r3)- ,-use previous mαex bset ftALLOCATE_LIMIT,x: (r6+n6; ,-set the completely allocated bit bset #HEARING_LIMIT,X: (r6+n6; ,-set the completely allocated bit move x: ;r3+n3) ,a ;assιgn the last index position enddo / found index, stop ftNUMINDEXES loop - HID < bita 130 A ;go to end of loop --. _ Cl _ — . ; - 6 _rιta_130_A ; END cf ftNUMINDEXES dc -ocp ,- set the initial allocation SubBandlndex and SubBandPosit ion move r3 ,x: (r5+n5 > ,-set initial allocation SBIndx move al ,x: (r4+n4 ) ,-set initial allocation SEPos ;determine the number of scale factor bits allocated at this position move x: (r2+n2. ,n7 ,-get the SBits scale factor code 0-3 move ftNSKFBιts,r7 ,-addr SBits scale factor bit count tbl nop move x: (r7+n7 ) ,yc ;save tne scale factor bit count _bιta_14C_A :add tne bits required for the signal data ,-get the position ,-address of data bit count oy position ,-get the bit count at this position ts,xC ,-add scale factor bits ,- and get curr TotBits /update TotBits with bits just allocated ,-save new allocated total bits rcheck tnat Signai-to-Noise position that Signal below Masking Threshold move #SNR,r7 addr of Signal-to-Noise table move x: (rl+nl) ,y0 get signal to mask ratio move x: 'r7+n7j , a get the Signal-Noise at position add yC , a x : !r5+n5) , r3 add MNR to SNR for test set up to set prev index for its pos j e <_bιta_160_A aoove mask, skip next statement bset ftMASKING LIMIT, x: !r6+n6' ,-set AtLimit partially done allocate ;set tne value for testing the best sub-band to deallocate bits from ,-ιf tne frame cannot nandle the full required allocation ,-back up one index to get that position ,-get the position at the previous index get the Signal-Noise at position calc Sig-to-Noise at prev position save SBMNRmax array for later continue witn tne next sub-band _bιta_l80_A ,'SUD-band is not to be coded at all oset #ALLOCATE_LIMIT,x: r6+n6' ,-set AtLimit totally out of aliocati bset ftHEARING LIMIT, x: < r6+n6 ,-set AtLimit at tnreshcld of neanr.g ;a l ,-suc-Dana is set to indicate it is at its massing tnres eld bset ftMASKING_LIMIT,x: ( r6*n6 i ,-set AtLimit partially done alloca t e _bιta_20C_A ,-finished the sub-band set up for the initial allocation of the next s boand next sub- and SBMNRmax next sub-band SBMsr to position to next Allowed so taoie next sub-Dand SBits next sub-band Allowed table array set addr for next suo-band Allowed pos next sub-band SBPos next sub-band SBIndx get current sub-Dana count next sub-band AtLimit increment the suD-oa d counter save new suo-band bita 990 A ;END ftNUMSUBBANDS dc loop done with tne initial allocation phase, phase A set the de-allocation passes initial state of control flags bset #MASKING_PASS,y:<stereo :flag do masking passes bclr #HEARING_PASS,y:<stereo ;allocate index must be bclr ftFINAL PASS,y:<stereo ;see i: frame fits or do we have to de-allocate selectively move y: <TotBιts,x0 get the total bits allocated move y:<AvlBιtε,a get available bits emp xO,a TotBits vs BitsAvailabie -, ae < bita S90 B it fits, allocate any leftover ac ftioo: bita 990 B test the bit allocation timout flag f tne timer flag was trip, switch over to the final Dit allocation of any remaining bits jclr #0,y:<qtalloc,_bιta_10_B -set #FINAL_PASS,y: <sterec,_bιta_10_B /continue, ι_ rina. oset #FINAL_PA≤S,y; <stereo ;set for FINAL :rιterιa enddo ,-stop the ftlOOC loop and exit move y:<TotBιts,xO ,-get tne total bits allocated jmp < bita 990 C ,-out cf time, de-alioe under last oasis _b ta_10_B ,-now let's look for qualifying candidates for next de-aliocatior. move # SBMNRmax , rO ,-addr of de-alioe Max signal-noise move y : BInxAdd , r5 ,-set register of SubBandlndex array move ftAt Lirr.i , r6 ;point to SubBandAtLim.it array move ft : , n ;offset to the cna nel SBMNRmax move ;offset to er.a SEIr.dx SUBSTITUTE SHEET (RULE 26) INAL offset to char. AtLimit use r2 as a sub-band counter start cnt of de-allocate table entries to test for index of l to test for at least one alloc limit get address of MNRval table get address of MNRSDC table :to deallocate the 1 index if the signal starts out below global mask move #SBMsr,rl ,-addr cf Mask-to-Signal by sub-oand move nO,nl ,-offset to chan SBMsr loop thru the sub-bands do y: <usedsb,_bιta_80_B if nc index has been allocated, try the next sub-band check for an allocated index it zero, :ry the next suD-oand ;no allocation try next sub-band if the 3rd mode of selection, no checks are made jset #FINAL_PASS, y: <sterec,_bιta_60_B ,-3rd mode, use this one if 2nd mode of selection sub-band may be below the masking threshold, but checks to make sure that if index allocated is ONE and that the suD-oand is not required fcr cont ity set #HEARING_PASS, y: <sterec,_bιta_50_B ■ 2nd mode num cf index :must be 1st mode of selection which requires that the sub-Dand : be oeiow tne masking tnreshold ftMASKING LIMIT, x: (r6 * n6 bita " O B ,- skip : above mask tr.resr. bita 50 B ■ if we have allocated only 1 index, skip this sub-band if at least one allocation is required emp xl , a :see if index at 1 19' < bita 60 B ;no, this sub-oand qualifies move r2,a get current sub-band emp yl , a see if sub-band below at least 1 ge <_bιta_7 if greater, deallocation candidate move ft>14 ,yl if greater than 14 , check emp yl,a y:< _sb,yl test sb vs 14, restore iimitsb to yl _, *- J - - <_bιta_70_B if less tnan 14, keep the 1 allocation move x : .rl+nl) , b get Max Signal to MmMask tst b if positive, started below global mask Di < bita 70 B if net positive, keep the 1 allocation bita 60 B :andιdate qualifies, insert this candidate in: tne taD.e :r ιnιtιa_. oe-a__ιocatιor. SUBSTITUTESHEET(PULE26. BAD OniGlNA' J w increment the sub-band counter next sub-band SBMNRmax next sub-band SBIndx next sub-band AtLimit ;end of y:<usedsb do loop ;if there are any entries in the de-allocate tables, start reclaiming bits get the de-allocate table entry cnt test for zero, no entries are entries at this criteria, dealloc since there were no candidates to deallocate (MNRsub = 0) , change the selection criteria: if we've done the final criteria and nothing to de-allocate, we can do nothing here, exit (How Come???) if we've not found anything with at least 2 indexes allocated, switch to select from any sub-bands if we've not found anything below the masking threshold, switch to at least 2 indexes alloc redo the selection criteria #FINAL_PASS , y : <stereo , _bιta_095_B ■ > • > • > shouldn ' t be , exit #HEARING_PZ_SS , y : <stereo , _bιta_100_B #MASKING_PASS,y:<stereo,_bιta_105_B #MASKING_PASS,y:<stereo < bita 200 B ,- loop thru with this criteria ,-stop the #1000 loop and exit y:<TotBιts,x0 ,-get the total bits allocated < bita 990 C #HEARING_PASS,y:<stereo #FINAL_PASS,y:<stereo < bita 200 B /loop thru with this criteria #MASKING_PASS,y:<stereo #HEARING_PASS,y:<stereo < bita 200 B ,-loop thru with this criteria ,-there are entries in the de-allocate tables _bιta_110_B ;de-allocate from the table from 1st entry to last ; or until enough bits have been reclaimed c__r move a, y:<count ,-start counter thru the table SUBSTITUTESHEET(RULE26) BAD ORIGINAL ' _oco tnrouσn tne ordered de-allocation table y: <MNRsub,_bιta_19C_B :address of MNRsbc table ;current table entry index ;get selected sub-band ,-store current sub-band (0-31 increment to next table entry , save next table entry .-restore tne channel array addresses move ftSBMNRmax, O addr of de-alloc Max signal-noise move ftSBMsr,rl addr of Mask-to-Signal by sub-oand move y:BitsAdd, r2 set register of SBits array move y:BPosAdd, r4 set register of SubBandPosition array- move y:BInxAdd, rS set register of SubBandlndex array move #AtLιmιt,r6 point to SubBandAtLimit array •set tne proper allowed table of indexed position based on the selected sub-band lnit the current Allow table see if it's sub-band zero (from above) sub-band zero was selected to increment to next sub-band addr increment to sub-band number chosen 16 position entries per sub-band set Allowed addr for sub-band cncsen get selected sub-band in SBMNRmax sub-band m SBMsr sub-band SBits sub-band in SBPos sub-band in SBIndx sub-band in AtLimit address of data bit count oy position get current bits allocated get the current allocated index get the position at the old index back up one index save new SBIndx for sub-band data bits allocated at that position subtract old allocated data bits get new position save new SBPos for sub-band data bits allocated at new position add new allocated data Dits :see if index l just de-allocated :ιf not, save the new TotBits value ;we nave tc tase off t ne scale factor bits move x- r2+n2 > ;get tne SBits scale factor code move #NSKF3ιts, r "7 ,addr SBits scale factor bit ecu: nop SUBSTITUTESHEET(RULE23) ^ .; O RIG.NM- _ O 96/32805 97 move X : ■ r7 * n7) rget tne scale factor bi: eeun: sue yo a :suDtract ro Tot3ιts _bιta_160_B move a, y: <TotBιts ,-save the new total bits ,-cneck if Signal-to-Noise position that Signal above/below Masxing Threshold bclr #MASKING_LIMIT,x: (r6+n6) ,-clear AtLimit below masking tnresneid move x: 'r4+n4 ,n7 get the position move ftSNR, r7 addr of Signal-to-Noise table move x: irl+nl) ,y0 get signal to mask ratic move x: 'r7+n7' ,a get the Signal-Noise at position add yO,a x.- ιr5+n5) ,r3 add MNR to SNR for test & set up to set prev index for its pos jle <_bιta_170_B above mask, skip next statement oset ftMASKING LIMIT,x: (r6+n6' ,-set AtLimit below maskma tnresneid _bιta_170_B ,-check if the bit pool can now handle the frame as allocated get the new total bits get the available bits BitsAvailable vs TotBits need more, continue witn de-allocation :we're done here, step MNRsub loop ;we're done here, stop #1000 loop _bιta_180_3 ,-ιf there is nc index allocated (r3 = C continue with the next table entry move r3,a get newly decremented index allocated tst a (r3)- if it is zero, continue S Dack up one index for tnat position jeq < bita 185 B allocated index equals C, continue ,-set the value for testing the best sub-band to deallocate bits from nf tne frame cannot handle the full required allocation ,-get the position at the previous index ,-get the Signal-Noise at position ,-calc Sig-to-Noise at prev position ;save in SBMNRmax array for later ,-continue y :MNRsub do loop rend of y:MNRsub dc loop ;contmue #1000 do locc cita 590 B ,-end ef ftioc: \ BAD ORIGINAL set tne a___ocatιcr_ passes .ιa state of control flags bset #MASKING_PASS,y:<sterec flag do masking passes bclr #HEARING_PASS,y:<stereo NCT hearing tnresneid passes bclr #FINAL_PASS,y:<stereo NOT final passes get the total bits allocated so far move y: <TotBιts,xO Now that we have the initial bit allocation, .terate on it (c) for ( LoopCount = 0; ; ++LoopCount ( do #100C,_bιta_990_C test the bit allocation ti out flag if the timer flag was trip, switch over to the final bit allocation of any remaining bits jclr ftC.y:<qtalloc,_bιta_10_C jset ftFINAL_PASS,y:<stereo,_bita_10_C bset ftFINAL PASS,y:<stereo this is equivalent to the call to the c subroutine: (c) AllocateBits ( ) inititiai allocation is done, set-up for as needed allocation loop restore the left channel array addresses ,-set register of SBMsr array ,-set register of SBits array ,-set register cf SubBandPosition arra-, ,-set register cf SubBandlndex array ,-point to SubBandAtLi it array IC FirstTime = 1; /•start run thru subbands this time * bset #FIRST_TIME,y:<stereo , • FirstTime = !0 clear the n registers for the channel reference cir a move al,y: _count ;start the sub-band counter move y:AllwAdd,rO move #SNR,r3 move a, l SBMsr array move a,n2 SBits array move a,n4 SBPos array move a,n5 SBIndx array move a,n6 AtLimit array ;go through all used sub-bands looking at only those ; that have not reached the allocation limit de v:<usedsb, bita 13C C BAD ORIGINAL , see if this suo-oand's limit flag was set previously, and sj.ιp f it has set #ALLOCATE_LIMIT,x: (r6+n6 ,_bιta_100_C ,-skιp subbnd reacned limi t set #FINAL_PA≤S,y:<stereo,_bιta_40_C ,-pass skips below mask check jset ftMASKING_LIMIT,x: (r6+nό! ,_bιta_100_ ,-skιp subband reached limi t bιta_40_C move x: (r4+n4i ,a ,-get curr position [SubBand] ,-see if this sub-band has reached its limit already move y:MaxPos,yO ,-set max value emp yO , a al,r.3 ,-see if max position,- move pos to n3 eq <_bιta_80_C ,-reached its allocation limit, set flag lect. this suD-Dand out see if tnere is room to handle the next allocation for this sub-Dand cir b ft>l,yl mit added scale factor bits - to incr to next allowed bits size move x: (r5+n5) , a SubBandlndex[SubBand] ;if this will be the 1st index, we must account for the scale factor bits tst a ftNSKFBιts,r7 see if 0 & set addr of NSKFBits array jne <_bιta_50_C not 1st index, skip add scale bits ,-set the scale factor + sbits needed for this 1st index in this sub-band move x: (r2+n2i ,n7 ,-get SBits index nop move x: (r7+n7 ) ,b ,-num bits for scaling fc Dita _.; add yl,a x:ndatabιt, r "1 ,-mcr, get addr of NDataBIts move al,n0 ,-set offset for Allowed next index see if next allocation is passed the max for this sub-band as per Allowed taole nop move x: (rO+nO) , a get the NextPosition as the new pos tst a al,r_7 see if passed the maximum position - move new pos to n7 jeq c_bιta_80_C reached its allocation limit, set flag test tne allocation at this new position get NDataBits [NextSBPos] add to any scaling info bits & set offset SubBandPos [SubBand] bits to add for next index b==>TestBιts = OldTotBits get NDataBits [SBPos [SubBand] ] y:,b al , x .TestBits -= current cits ; & put new position in proper reg y ,c y: «AvlBιts, a TestBits +__ next ailocat: 5- gets BitsAvaiiaoie (Cl i ( TestBits > BitsAvailable ) < (C) AtLimit = 1 ; (c) continue,- IC ■ } emp b,a b,y:TotBιts ,-see if room 5. save allocation < bita 80 C ,- no room, set as AtLimit and continue if this is the final loop, skip the next test and allocate the bits jset #FINAL_PASS, y: <stereo,_bιta_70_C ,-pass skips below mask check ICI SMR = SubBandMax [SubBand] - MmMaskmgDb [SubBand] (c MNR = SNR [SubBandPosition [SubBand] ] - SMR move x: 'r3+n3) ,yl get SNR [SubBandPos [SubBand] j move x: (rl+nl; , a SBMsr [SubBand] Mask-to-Signal add yl,a y:MNRmm,b add Sig-Noise ratio; & get MNRmin for below 19'- < bita 90 C below Masking, go to take out partially move a,yl ,-save MNR jset #FIRST_TIME,y:<stereo,_bιta_60_C ;if first, save as minimum emp yl,b ,MNRmin MNR jle < bita 100 C bita 6! move nO ,y:MNRinx MNRinx = Newlndex; move xl , y:MNRpos MNRpos = NewPosition,- move y: <TotBιts,xl get the allocation of bits move xl,y: <HldBιts save tne allocation of bits move y: <count,xl get current sub-band move xl,y:MNRsb MNRsb = SubBand; move yl,y:MNRmin MNRmin = MNR; bclr ftFIRST_TIME,y:<stereo clear FirstTime flag jmp < bita 100__C ;we are on the final allocations passes after all sub-bands are driven below the Glooal Masking threshold bita 70 move y: <TotBιts,x0 save new TotBits move nO ,x: (r5+n5) save new sub-band index move xl,x: (r4+n4 ) save new allocation position bclr ftFIRST_TIME,y:<stereo clear FirstTime flag jmp < bita 100 C bita _80_C oset ftALLOCATE_LIMIT,x: (r6+n6> ,-set the completely allocated bit bset ftHEARING_LIMIT,x: (r6+n6) ;set tne completely allocated bit et ftMASKING_LIMIT,x: (r6+n6) ,-set the reached global mas in? c t SUBSTITUTE SHEET (RULE ' ) ,-get current suD-band to increment now update Allowed tc next suc_Dand SBMsr array SBits array SBPos array SBIndx array AtLimit array advance Allowed to next sub-band increment the sub-band counter save new sub-band number y:AvlBιts = ft cf bits available y:MNRsb * ■ MNRsb y:MNRMιr. = MNRmin We test now to see if this trip thru the loop produced any cnanges and if not, we have finished the bit allocation for this frame (C) FirstTime ) (c) return; clr ftFIRST_TIME, y: <stereo,_bιta_140_C /not 1st, alloc tc selected clr #FINAL_PASS, y: <stereo,_bιta_160_C /not final, set 1 more loop : finished, end the loop and go to exit routine enddo jmp < bita 990 C _bita_14C_C ,-test flag all candidates are below masking threshold jset #FINAL_PA≤S,y: <sterec,_bιta_170_C ;if final, allocated already /restore the channel array addresses move y:BPosAdd, r4 ,-set register of SubBandPosition array move y:BInxAdd, r5 ,-set register of SubBandlndex array SubBandlndex[MNRsb] ++ SubBandPosition [MNRsb] = AliowedPositions [MNRsb] [SubBandlndex [MNRsb] ] move y:MNRsb, n5 MNRsb move n5 ,n4 MNRsb move y:MNRinx,xl get the saved new index move xl , x: (r5+n5. update the SBIndx for selected sub-oand move y:MNRpos,xl get the saved new Allowed position move xl , x: (r4+n4 ; update the SBPos for selected suD-band move y: <HldBιts, xO set the new bit allocation total cnt jmp <_bιta_170_C continue major loop ;now lets just allocate what's left now that all are beiow mask _bιta_l60_C bset ftFINAL PASS.y: <stereo , just loop now ' BW3 OWUINAL 102 save bits actually allocated determine number of bits padded bits available minus total allocated save count of unallocated audio bits rts msert_value ( ) : This routine orders the table of values per sub-band that are to be de-allocated as needed. The table is ordered in descending sequence that makes the 1st entry the one that can best afford a deallocation. on entry X: (r0+n0) = the current value to be inserted r2 = the sub-band number to be inserted y:MNRsub = current count of entries in the ordered deallocation tables n3 = address of MNRval table n4 = address of MNRsbc table y:MNRsub = incremented count of entries in ordered deallocation tables a = destroyed b = destroyed xO = destroyed yO = destroyed r3 = destroyed r4 = destroyed org phe : insert value ,-get the current value to be inserted and set upo the start into ,- the ordered table of values and the assoicated table of sub-band move x: (rO+nO) ,a ,-get the current value to insert move y:<MNRsub,b /get current count of table entries .f this is the 1st value to be inserted ino the table, skip the search for its place and enter this as table entry no 1 tst b #0,r3 see if this is 1st entry into table & set to 1st entry in MNRval table eq <_msert_50 if 1st, skip following table searcn ,-search through the table of entries so far established looking for where ;to store this current value dc y : <MNRsub,_msert_20 \ BΛD ORIGIN L ,-get the table value for comparison ,-against the new value tc be inserted ,-if less, value is further down table when the new value is greater than or equal the table entry this is its place in the table, we may have to shift the following tac e entries in order to enter tnis new value enddo ;stop the y:MNRsub do loop jmp insert 20 ;see if the table must be shifted _ιnsert_10 move (r3) /try the next table entry insert 20 ,-end of y:MNRsub do loop .f this entry number .its place in the table 1 equals the count of entries, this entry will be the new LAST entry in the table get its place in the table to compare its place to current table entry count if less, we have to shift the table if eq, entry is appended to the table ?? let's make sure we use last entry _ιnsert_25 ;we need to shift the subseσuent entries n the table down one and then ; insert this new sub-band value establish the curr table ends for both MNRval and MNRsbc set r3 witn addr of MNRval end * l set r4 with addr of MNRsbc end - 1 back cff 1 to get last MNRval entry (r4)- , • number cf table entries tc shift l- Dack off 1 to get last MNRSDC insert 40 ; shif t each down 1 cosition tables get curr value ana incr tc rec addr put value 1 entry down £. back up 1 curr sub-bana/chan __ incr tc rec ad r put value 1 entry down £. back up 1 back up one more entry table MNRval back up one more entry table MNRsbc ; end cf b do loop receive value and sub-band .nsert 5. _nsert the current value at this location in the ordered table a se insert the sub-band number ,-matchιnα positic tne MNRsbc tacl. SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL move a, x: (r3+n3 ) ;enter sorted value move r , x: (r4+n4 ) ,-enter the sub-band number / increment the count of entries in the ordered deallocation tables move y:<MNRsub,r3 ,-we need to increment entry counter nop move (r3) + move r3 ,y:<MNRsub save the new table entry count rts opt fe - 105 - (c) 1995. Copyright Corporate Computer Systems, Inc. All rights reserved. \DGCST\botsallo.asm title 'Initialize bit output' ,- This routine is used to initialize the bit output routines. include 'def.asm' include 'box_ctl .asm' section lowmisc xdef sc, curwd org yli: stbιtsallo_ylι sc as ;shift count curwd ds ,-current word endb tsaiio_ylι endsec org phe : bitpool ( ) This subroutine determines the number of bits available based on the output bit rate and the type cf framing *************♦****+************#****#***»************#*************) The table below is based on a Sampling Rate at 48,000 /sec and shows the breakdown of b t counts based on bit rate o/p and choice of frame type Mono Full c Joint Stereo > Stereo 4-bound 8-bound 12-bound 16-Dound fix avail fix avail fix avail fix ava rix avai fix avai .36 9080 224 8992 152 9064 168 9048 183 9033 195 9021 6008 5920 5992 5976 5961 5949 4472 4384 4456 4440 4425 4413 2936 2848 2920 2904 2889 2877 2552 2464 2536 2520 2505 2493 2168 2080 2152 2136 2121 2109 1400 1312 1384 1368 1353 1341 136 1208 224 1120 152 1192 168 1176 183 1161 1149 ** * * * * * * * *** * * ** * * **** y .- <stereo = f lags : test bit indicating applicablation of CRC- 16 protection 0 = NOT APPLICABLE 1 = CRC-16 protection APPLIES y:frmbιts = the total number of bits in a frame at the specified bit rate on exit : xO destroyed = returned number of required (fixed) bits αestroyeo = re! irned number of bits available for b t allocation SUBSTITUTE SHEET (RULE 26) ^AD ORIGINAL 0 a destroyed 106 rO destroyed rl destroyed r3 destroyed org phe : b tpool Select the proper Allowed table: ISO. 1. for low sampling rates (24 or 16 K) , set ISO Extention Allowed table (Ailowed_3) 2. for high sampling rates (48, 44.1 or 32 K) : a. based on MAXSUBBANDS less than 27, set ISO lower bit rate Allowed table (Allowed_2) b. else, set ISO higher bit rate Allowed table (Allowed_l CCS : set ISO higher bit rate Allowed table (Aliowed_l, low sampling rate: test the frame header ID bit (if 0, it' s a Irow sampling rate frame) move ftsmplidbit, rO addr of frame header ID bit (0 = low) nop (l = high) jset #0,y: (rO) ,_bιtp_000_A if high rate, select Allowed table move #Allowed_3,r0 addr of low sampling allowed table move ftskftbl_3,rl addr of the BAL bits table move ft>15,xl maximum position Aliowed_3 table jmp <_bιtp_010_A go to store Allowed table address _bιtp_000_A high sampling rate: set the proper Allowed table address based on working MAXSUBBANDS 'y:<maxucs if less than 27, used table 2 move y:<maxsubs, xO get current MAXSUBBANDS move ft>27,a to see which of 2 tables applies move ft >17 , xl maximum position Allowed_l table move ftskftbl_l , rl addr of the BAL bits taoie emp xO , a #Al lowed_l , rO see if need the low bit rate table - set up as Aliowed_l table le <_bιtp_010_A Allowed_l table applies ,-select the lower bit rate Allowed table ;addr of the BAL bits table /maximum position Allowed_2 table _bltp_C10_A ,-set the address of tne selected Allowed table ,-set tne address of the selected BAL's bit table , set tne maximum oosition code \ :determine the bits required for ancillary data (taken from audio pit pool : start with bits required to store tne padded data byte count in frame move ft>BITSFORPADDING,b ;bιts in the padded byte count move y:maxbytes,yl ,-get max bytes at baud rate move y: <bytecnt, a ,-get current count of bytes received emp yl,a #>BITSPERBYTE,xl ,-see max versus current count & set multiplier jge <_bιtp_00 if more than max, can only send max move a,yl less tnan max, send all received _bιtp_00 .-multiply the bytecount for bits per byte mpy xl,yl,a to get the required bit asr a yl ,y: <bytesfr shift integer result ~ set byte count for framing move aO, a add a,b ,-add to the count of bytes move b,y:ancbits ,-set ancillary data b t count ;set the number of fixed bits used, and the number of available bits for audio cir a ftO.xl ;0 a as accum, zero CRC checksum bit cnt /set the address and bit offsets to identify the end of the current full frame ; and set the end cf tne formatted frame move y: <frmnext, rl ;address for start the next frame move y: <outsize,ml :circular ctl addr the framing o/p buf ;set the fixed bits for the audio frame move ft>NSYNC,xO number of SYNC bits add xO,a ft>NSYST,xO plus number of bits in frame system hdr add x0,a x:skftbl, rO get base of used bits table jclr ftPRCTECT.y: -.stereo,_bιtp_35 ,-skιp checksum bits if no protect move ft > NCRCBITS,xl ,-add applicable bits for the cheexsum :P_35 add xl, a ,-add cnecksum Drotection, any ;account for the bits required for protection encoding move ft > REED_SOLOMON_BITS,xl ,-bιts required for adir's routine add xl , a ,-add protection bits to fixed bit cnt ,-accummuiate the bit allocation bits for standard number of sub-bands ,- included in the frame for the left and right .if applicable, do y: < maxsubs,_bιtp_50 .at. for tne cnanne_ SUBSTITUTESHEET(RULE26) BAϋ ORIGIN move x: trC +, xl add xl, a _bιtp_50 move a,x0 /return fixed bits move y:frmbιts,b ,-total size cf frame bits ,-subtract any bits required for ancillary data move y:ancbιts,yl sub yl,b bιtp_8( sue a,D ;total bits - fixed bits move b,xl :return number of audio data bits avail ;now determine word and bit offsets for the end cf the audio frame add yl,b restore bits for ancillary data add a,b #>24,yl restore to full audio frame s ze ~ set number bits a word move y:<frmstrt,rl count words to last word in frame bitD 90 ,-see if reached last word ,-if so, set eoframe word & bit offsets _bιtp_100 move rl,y:audendw ;tc identify end cf audio part of frame move b,y:audendb ,-bit offset end of audio part cf frame move y: <!ιnear,ml ,-reset to linear buffer control rts Ditsaiio This subroutine starts the bit allocation cf values into the frame buffer values are inserted by setvaiuet, and by b tfree ) below V: <sc = 0 y: < curwd = initialized (0! 1st word in frame buffer a = destroyed bitsallc move ft0,a move a,y.-<sc ,-initialize the shift count move a,y:<curwd ;initialize curwd (1st bit op frame rts This routine .lushes the last bits to the output buffer r6 = address cf next word the output frame buffer x -.erne a = destroted b = destroyed xO « destroyed xl = destroyed yO = destroyed yl = destroyed section highmisc xdef audendw ,- address of end of audio portion ef frame /bit offset to end of audio portion of frame bitsfree ,-see if all cf the frame has been output totally move y: <fr next,xl get address for start of next frame move r6 , b next o/p address of current frame emp xl,b ft>24,a if addresses = start, done and set up for the next test jeq <_free_90 frame done, exit ,-see if the last word cf the frame is to be output next move y: <fr last,xl last word address of current frame emp xl , b y:<sc,xO test if address = last word and get number cf bits in last were jeq <_free_20 last word, chk block sea number neeae: ,-output last partially formatted data word before zero fill remainder cf frame ,-get number of bits left ,-24 - number of bits left ,-not partially formatted ,y:se == C ,-get current output word ,-output the necessary ft cf bits ,-save in the output ;zero the current bit offset cir ,-output zero for remainder cf frame _free_10 ,-see if the last word cf the frame is to be output next r€.b ;next O /Ό address irrer.t frame SUBSTITUTE SHEET (RULE 26) \ L see if last word next last word, c..κ block seq n moer needed output frame word and mcrment addr continue to flush the buffer free 2 init with zeros to pad last word init with no bits req for seq number bits in the word get current formatted word offset bits remaining bits required for block seq num test if any zero bits to output if none, try the block seq num number of bits to output pad word with zeroes as needed free 9C rts opt fc,mex c > 1995. Copyright Corporate Computer Systems, Inc. Ail rights reserved. \DGCST\xmicrmus.asm: Reed Solomon version for DigiCast title 'Micro MUSICAM Transitter Main' (7/23/92) xmiero.asm micro MONO version of XPSYCHO and XCODE combined include 'def.asm' include ' .. \common\ioequ.asm' include 'box_ctl .asm' section lowmisc ,-applicable hardware output (leds, switches) ,-applicable hardware input (switches, lines) ;satisfy non-applicable hardware settings working MAXSUBBANDS for sample/bit rate encode MPEG-ISO or old CCS CDQIOOO' s 0 = MPEG-ISO SUBSTITUTE SHEET (RULE 26 ' INAL 6/32805 112 1 = old CCS CDQIOOO' s usedsE ds number of used sub-oands sterec s y:<stereo = flags, bit 0 means stereo vs mono framing 0 = stereo framing 1 = mono framing bit 1 indicates left vs right channel 0 = looping thru left channel arrays 1 = looping thru right channel arrays bit 2 indicates joint stereo applies 0 = NOT joint stereo framing type 1 = IS joint stereo framing type bit 3 indicates curr frame upgraded to full stereo by joint bit allocation (if joint stereo applies; 0 = normal joint stereo allocation 1 = FULL STEREO allocation bit 4 indicates the stereo intensity sub-band boundary has been reached (if joint stereo applies) 0 = NO sub-bands still below intensity boundary 1 = sub-bands above intensity boundary bit 5 is FirstTime switch in a loop thru the bit allocation 0 = cleared if any allocations were made 1 = no allocations made to any sub-band bit 6 indicates a beiow masking threshold allocation pass 0 = some sub-bands not beiow mask 1 = all sub-bands are below masK bit 7 indicates a below hearing threshold allocation pass 0 = some sub-bands not below hearing threshold 1 = all sub-bands are below hearing threshold bit 8 indicates final bit allocation passes to use up any available bits 0 = not yet 1 = allocate remainder m bit pool bit 9 indicates limit of sub-bands requiring at least one position has been reached: 0 = not yet, 1 = limit reached bit 10 indicates maximum limit of sub-bands that are to be allocated has been reached: 0 = not yet, 1 = limit reached cmprsctl ds control flag for CCS compression: bit 0 = application. 0 = ISO standard 1 = CCS compression applies oprptr ds read pointer into output frame buffer outmus ds number of words to read in outsize ds circular buffer ctl frame o/p buffer frmstrt ds starting addr of current frame frmnext ds starting addr of next frame fr last ds last word addr of current frame timer ds 0.024/0.036 msec timer interrupt sensor timeout ds 0.024/0.036 msec timer interrupt exception qtalloc ds 0.024/0.036 msec timer interrupt bit alloc signal bit allocator to fmisn up lpwptr ds 1 write pointer into input mpcm buffer polyst ds 1 addr of the polyanalysis start nmskfreqs ds NMSKFREQS based on selected sample rate maxcritbnds ds MAXCRITBNDS based on selected sample rate linear ds 1 reset mX as linear buffer control junk ds ,- ! ! Idebug endyli dbgcnt dc ! ! !debug counter of flag limitsb dc LIMITSUBBANDS ;sub-oands req at least 1 allocation endxmιcro_ylι endsec section ptable xdef ptable xdef a_psych, b_psych xdef c_psych, d_psych xdef e_psych, f_psych,g_psych xdef h_psych, ι_psych, j_psych xdef k_psych, l_psych,m_psych, n_psych, o_psych,p_psych xdef q_psych, r_psych, s_psych, t_psych,u_psych,v_psych,w_psyc_- x_psyeh xdef y_psych, z_psych xdef zl_psych, z2_psych, z3_psych, z4_psych, z5_psych, z6_psych stptable ptable ,-thιs table is known as IRT a_psych dc .0467146 9 dB b_psych dc .0498289 .3 dB/Bark c_psych dc .0259526 5 dB d_psych dc .0498289 .3 dB/Bark e_psych dc .0882387 17 dB/Bark f_psych dc .4000000 .4 1/Bark g_psych dc .0311431 6 dB/Bark h_psych dc .0882387 17 dB/Bark ι_psych dc .0882387 17 dB/Bark j_psych dc .1000000 .1 1/Bark k_psych dc .0000000 0.0000000 l_psych dc .0000000 0.0000000 m_psych dc .0000000 0.0000000 n_psych dc .0000000 N: CCS compression NO .5 >= YES o_psych dc .0000000 curval= 0.0000000 p_psych dc .0000000 curval= 0.0000000 q_psych dc .0000000 curval= 0.0000000 r_psych dc .0000000 curval= 0.0000000 s_psych dc .0000000 curval= 0.0000000 SUBSTITUTE SHEET (RULE 26) 0000000 ooooooc 0000000 0000000 dB/Bark dB/Bark 8 dB/Bark 0.0000000 0.0000000 Z3 : 4 to 30 = used sub-Dands (mono* Z4 curval= 0.0000000 Z5 curval= 0.0000000 Z6 curval= 0.0000000 section highmisc xdef startyhe xdef bitrate xdef frmrate xdef smplcde xdef smplrte xdef smplidbit xdef bndwdth xdef frmtype xdef opfrtyp xdef baudrte xdef oputcde xdef frmbits xdef fixbits xdef audbits xdef ancbits xdef st tns xdef b_ι xdef fmap xdef ThresSLB ,- xdef Threshld xdef cb xdef g_cb xdef dbaddtbl xdef plctmn xdef endyhe xdef samplng xdef bitrates xdef baudclk org yhe: stxmιcro_yhe startyhe bitrate ds bit rate code for MUSICAM frame heade: sampling rate 48 K or 32 K: ISO and old CCS CDQIOOO: BAD ORIGINAL 3 (0011' = 56 KBits 4 (01C0) = 64 KBits sampling rate 24 K or 16 K: ISO. 7 (0111) = 56 KBits 8 (1000) = 64 KBits old CCS CDQIOOO : 3 (0011) = 56 KBits 4 (0100) = 64 KBits frmrate ds overall frame bit rate as to hardware switches (1 bit) indicate bit rate sets numb words in a frame: 0 = low Kbit rate 1 = high Kbit rate smplcde ds sample rate code in MUSICAM header: ISO: 00 « 44.1 K or 22.05 K Cl = 48 K or 24 K 10 = 32 K or 16 K old CCS CDQIOOO: 00 * 16 K Cl = 48 K 10 = 32 K 11 « 24 K smpirte ds PCM data sampling rate: low vs high rate depending on flag in box_ctl.asm tnat indicates the pairing (16/24, 16/32, 16/48, 24/32, 24/48 or 32/48) switches (1 bit) indicate 0 - 16000, 24000 or 32000 1 = 24000, 32000 or 48000 smciidbit ds hdr id bit : ISO: 1 for 44.1, 48, and 32 K sample rates 0 for 22.05, 24, and 16 K sample rates old CCS CDQIOOO : 1 is always used with special sample rate codes in the neader .aoove bndwdth ds code for setting sub-band limits frmtype as dip switches (2 bits) are set to: 11 - (3) mono (1 channel) opfrtyp ds current frame type after bit allocation baudrte ds ancillary data baud rate cputcde ds type of output coding: MUSICAM vs G722 switches !1 bit) indicate 0 = MUSICAM frames 1 = G722 data bits in the audio portion of frame bits required before audio data bits number of bits available for audio data bits required for ancillary data current frame intensity subband boundary code addr b_ι table for low or high sample rate addr fmap table for low or high sample rate addr ThresSLB table for low or high sample rat. addr Threshld table for low or high sample rat* addr cb table for low or high sample rate addr g_cb table for low or high sample rate addr DbAddTbl successive phase lock detect hign center main SUBSTITUTE SHEET (RULE 96> BAD ORIGINAL endyhe ,table of sampling rates SAMPLERATES /table cf bit rates BITRATES ,baud rate table for ancillary data BAUDCLK endxmιcro_yhe endsec org phe start ,- The external wait state is set to 1 This allows the HCT541's to , put tneir data on the bus in plenty of time. movep ft$0001,x:<<M_BCR /set all external 10 wait states ,-set dsp56002 clock to selected MHz (PLL Control Register) XCODE_M_PCTL PORT C Assignments l = input port 0 = output port XCODE_PORT_C_M_PCC ,-set port C control register XCODE_PORT_C_M_PCD ,-set output data to port C XC0DE_PORT_C_M_PCDDR ,-set port C data direction reg initialize the ssi port for the ad converter XCODE_SSI_M_CRA ,-set ssi era register XCODE_SSI_M_CRB ;set ssi crb register initialize the sci port for tty XCODE_SCI_M_SCR ,-set sci status control register PORT B Assignments 14 13 12 - 11 10 9 8 - 7 6 5 4 - 3 2 1 0 0 0 1 O l l O O l l l 1 1 1 1 XCODE_PORT_B_M_PBC ,-set B control register for general 10 XCODE PORT B M PBD ,-set the default outputs SUBSTITUTE SHEET (RULE 2 ) XC0DE_PORT_B_M_PBDDR ; set B register direction ,- initialize the host interrupt vector INIT_HOST_VECTORS_CD restart ; set the interrupt for host interrupts ,- HOST set to IPL 2 ,-set t priorities ana edges ,-turn on the interrupt system ;clear the analog to digital converter to restart calibration CLR_ADC_RESET ;dιsabie the ancillary data received interrupt bclr ft _RIE,x:<<M_SCR move ft>OFF_LEDS_CD,b ,- initialize leds as off move b, y : <word_out ******************************************* * ********* * *** * ** * ********* * * ** **! TEST NOTICE THAT THE FOLLOWING DATA IS ENCODED AND PUT INTO A HIGH MEMORY AND WILL BE CHCKED WOTH THE CODED DATA ALL THE TIME WHILE THE PROGRAM RUNS TO MAKE SURE THAT NONE OF A WORD IS IN ERROR TEST DATA initialize the buffer to be encoded for testing OFF_REED_SCL_LED_CD indicate no problem wit Reed Sciomcr. move ftframebuf.rO code the 1st of tne encoded frames cir a ft>l,x0 zero the test value accumulator & to increment in the test buffer ,-set the frame buffer to sequentially incremented values tne reed solomon encoding on the test frame buffer move ftframebuf,rO ,-ι/p pointer of buffer to De RS-COOEI. move ftSbf,mO ,-frame buffer is circular - 2 frames move ftreedsolbu ,rl ,-o/p pointer for CODED data to be store: jsr <new rs ,-encode via reed solomon test if tne reed solomon codec worked or NOT SUBSTITUTE SHEET (RULE 26) j BAD ORIGINAL , -o/p pointer for CODED data to be s c-e^ ; pcmter for tne verificatio table Get current coded data outpu t Get precoded look up table value compare 2 values If SAME No problem indicate no problem with Reed Solomon ON_ALARM_LED_CD , light alarm led indicator TST_SET_ALARM_RELAY_C , _set_led_0 ,-unless already set, SET_A1_ARM_RELAY_CD ,-set the alarm relay line on set led_0 SET_LEDS_CD INTERRUPT HOST CD ;inform the host Clear all of the y memory /value to set x memory to / ■ just in case, set to linear buffer ,-set starting address low y-memory rl ,-set loop count ,-clear it ,-set starting address high y-memory ,-set loop count ,-clear it rset linear buffer control move mO,y:<lιnear set the CRC-16 protection checksum as applicable and set the CRC-16 checksum mono frame bit count for the old ISO method: a. header bits covered by any type of frame plus bits for the left channel also apply to any type of frame b. save old ISO bit count for this frame bset ftPROTECT.y:<sterec ,-checksum protection applies .l=YES, move ft > CRC_BITS_A+CRC_BITS_B,a ;header plus one channel cits move a,x:crcold ;set the old ISO CRC-16 bit count check the switches to determine bit rate and framing type get the external switches to determine: PCM input data sampling rate type of audio compression to format for output (MUSICAM/G722 if MUSICAM, the frame bit rate if MUSICAM, ancillary data baud rate GET SWITCHES CD gsws 00 SUBSTITUTE SHEET (RULE 26 SAD OHIBWØCL ,-set PCM data sampling rate code ,-set type of frame (mono) to code ,-set bit allocation sub-Dana width code ,-type of encoded output (MUSICAM/ 372 ,' ,-set the frame rate i/p code ,-set ancillary data baud rate code ,-set MPEG-ISO vs old CCS CDQlCCC's :set framing mode led move y:frmtype,xC ,-set current frame type move xC,y:cpfrtyp ,-set current frame type fcr ,- indicate mono framing (only frame type supported! bset ftSTEREO_vs_MONO,y: <stereo :based on sample rate (low or high! set the addresses for various tables: address of b_ι table for low rate address cf fmap table for low rate address cf ThresSLB table for low rate address cf Threshld table for low rate address cf cb table for low rate address of g_cb table for low rate indicate coding at low sampling rate for compression bclr ftLOW_vs_HIGH_SAMPLING,y:<stereo jmp < set tables address of b_ι table for high rate address cf fmap table for hiσn rate address cf ThresSLB table for higπ rate address of Threshld table fcr r.ign rate address of cc table for high rate address of g_cb table for nign rate ; indicate coding at high sampling rate fcr compression bset ftLOW vs HIGH SAMPLING,y:<stereo _set_taDies move r0,y:b_ι ,-set addr of b_ι table selected move rl,y-. f ap ,-set a dr of fmap table selected SUBSTITUTE SHEET (RULE 26) move r2 , y.ThresSLB ,-set addr of ThresSLB table selected move r3 , y.Thresnld ,-set addr of Threshld taole selected move r4 , y:cb , set addr of co table selected move r5,y:g_cb ,-set addr of g_cb table selected move ftDbAddTb1_6db, r3 move r3 ,y:dbaddtbi ,-based on the sampling rate and framing bit rate selected: set the sampling rate code for the ISO frame header set tne framing bit rate code for the ISO frame neader set the frame size in words and bits set tne applicable bit allocation control parameters addr of sampling rate codes offset to sampling code table test for sampling rate of zero it set register to advance table lf code is zero, we're there ,-posιtιon to selected sampling rate cooe get ISO frame header sampling code save ISO code to encode in frame neade: get ISO frame header id bit set ISO frame header id bit get mono channel MAXSUBBANDS set working MAXSUBBANDS step over dual channel MAXSUBBANDS in case of MPEG-ISO CCS compression is not applicable if MPEG-ISO, skip over old CDQIOOO 's old CDQIOOO frame neader sampling code ,-to chectς ISO frame header id bit ;save old code to encode in frame neade: ,-ιf ISO high sampling, no compression ,-do CCS compression encoding ,-get old CDQIOOO frame header id bit ,-set ISO frame neader id bit ,-get mono channel MAXSUBBANDS ,-set working MAXSUBBANDS ,-step over dual cnannel MAXSUBBANDS ;continue _smplcffs_ ,MPE3-ISO encoding move ►nO :skιp over old CCS CDQIOOO values aftscds move y. (rO) +,xO ;get MAXCRITBNDS value ® sample rat move xO,y «_maxcrιtbnds ;set MAXCRITBNDS at selected sam l: move y• <rO • ,xO ,-get NMSKFREQS value S sample rate SUBSTITUTE SHEET (RULE 26) SAD O 96/32805 121 - move xC , y: <nmsκfreas set NMSKFREQS at selected sampling move y: fr rate, c test cit rate to set auaic data size move ftbitrates,rO addr of framing bit rate mfc tst b #8,n0 test for rate of zero ~ set register to advance tr.ru table jeq <__bιt_cffs_ if code is zero, we're tnere rep b move frO > +n0 . • position to selected c: rate coae bit offs ;set the table offset based on sampling rate move y: smpirte.b ;get the sample rate code tst b #4,nQ :test if low sampling rate , & set offset to proper sampling rate jeq _bιt_smpl_ ;if low rate, addr is set rep b move rC) -nO /position to seiectea sample rate _bιt_smpl_ clr ft0,y <oldces,_Dit_cds_ ;if MPEG-ISO, continue move (rO. - :adv to old CCS CDQIOOO' s code bit cds move y: (rC ι ♦ , nl get bit rate code for frame header jset #0, y:<oldccs,_aftbcd_ if old CCS CDQIOOO' s, continue move (rO i * skip over old CCS CDQIOOO code ;selected bit rate frame size m wcrds ,-number of audio bits in an output frame audio bit rate code for frame nar set ft of words in a frame musicam audio portion ef frame ,-set bandwidths based on sampling rate, bit rate and oand widtπ selection move y:smplrte,b ,-set bandwidths based en sampling rate move y: frmrate, a ,-set Dandwidths oased en frame bit rate <bandwιdth move y: z3_psych, a ,-get the seiectea sub-bands, if any move a,y: <usedsb ,-set initial used sub-band value move ft>MINSUBBANDS_CCS, xC ,-set minimum sub-bands to be used emp xC , a ft>MAXSU3BANDS_CCS,x0 ,-see if SUDS is toe small , ~ set default value of maximum . - - < default_used_00 ,-ιf less, default tne used suD-Danas emp xO , a ,-see if less tnan maximum suD-oands -, -. -- < after used 00 ;if less, we're ok _default_used_00 ,-default tne used sub-bands to max sub-bands neve xO,y:<usedsb BAD O IGIN L g SUBSTITUTE SHEET (RULE 26> _af er_used_OC :calculate buffer length controls set the mod buffer fcr 2 frames align integer result shift integer result (frame numb words * 2 - 1 mow save the above buffer control values move al,y:<outsιze ,-set circular buffer cti for c t buffer /set the type cf sterec intensity code as nominal 4 subbands ;net ac D licable move #>INTENSITY_4,xO ;sterec intensity code f; aerau-: ef 4 move xO,y:stintns :save fcr frame header i: Set output write read pointer to something safe since interrupts will be o before it is set properly. move #framebuf,rO ,-address of output encoded frames buff; move r0,y:<oprptr ,-set the output read buffer set up for ancillary data to be decoded from a framed and transmit via rs232 a. zero the input data byte counter and bytes for current frame b. set address of clock table, baudelk, based on baud rate (0 thru 7 c. set table offset by baud rate; these are standard CDQ20C0 set by macro, BAUDCLK, in box_etl.asm ■ 0 = 300 baud 1 = 1200 baud 2 = 2400 baud 3 = 3200 baud 4 = 4800 baud 5 = 36400 baud 6 = 9600 baud 7 = 19200 baud d. set transmit enable (for xon/xoff e. get and set the clock for oaud rate from the table . get and set the max bytes fcr oaud rate from the table g. set the data input and output pointers h. set receive enable l . set receive enable interrupt move ft .xO zerc the received data counter move xO,y:<bytecnt zero tne byte counter move xO,y:<bytesfr zero the current frame byte counter move ftbaudclk,r0 get data baud rate table address move y:bauarte,b set to access clock at baud rate tst b ft3,n0 test fcr rate cf zero & set register to advance thru tab] jeq < Daudrte if code is zero, we're tnere rep move < r0 ) +r.0 ,-DOSition to seiectea caua rate oauarte clock value at ca. 'BAD ORDINAL ft SUBSTITUTE SHEET (RULE 26. ,now get sampling rate offset ,get addr of the data byte Duffer ,-get max byte count at sampling rate ,-store maxbytes for scixmt to check ,-address for next byte received ,-addr for next byte to output to frame ,set the clock for selected oaud rate ,-set receive enable ,-data expected set receive interrupt .-set transmit enable ,-enable the host command interrupt bset #M HCIE,x:<<M HCR Set and clear a flag so we can set the scope trigger. ON_BITALLOC_LED_CD ,-set a different flag for debug OFF BITALLOC LED CD Now form the two pointers to the output buffer. frmstrt is the write pointer and frmnext is the read pointer frmεtrt is used to point to where the current buffer is for outputtmg data into This data is a result of the current musicam coding. frmnext is used to point to the address for outputtmg of data to the external device move #framebuf,rO address of the output frame buffer move y:<outmus,n0 set the output read ptr move y:<outsιze,mO set the output buffer circular ctl move rO,y:<frmstrt 1st frame at start of buffer move (rO) +n0 advance to start of 2nd frame move rO,y-<oprptr set the output read buffer move rO,y:<frmnext set the next frame to write into move (rO) - set up last word addr of curr frame move rO,y:<frmlast for block sequence numbering move y:<lιnear,mO reset to linear Duffer ;set number of fixed bits required, and the number of available bits for audit ,-save fixed bit count ;save bit count available for alloc get the input pem data buffer set start address for input pem data set starting position in x buffer init the poly analysis filter IRQA set to IPL 3, negative edge (lowest priority) SSI set to IPL 3 IRQB set to IPL 3, negative edge (highest priority) HOST set to IPL 2 SCI set to IPL 3 movep #>Sf83f,x:<<M_IPR ,-set int priorities and edges :waιt fcr the dust to settle before pushing onward move ft>XCODE_STARTUP, a SET ADC RESET ,-stop A to D calibration test MUSICAM versus G722 : if MUSICAM, go to the TOP of frame processing if G722, jump to that routine and restart upon return move y:oputcde,a MUSICAM vs G722 tst a if zero, jeq c_go_on_ it's MUSICAM, enter that loop jsr <g722 handle G722 ,-G722 output selected, boot up XMCRG722 from the low portion of chi∑ cir boot cOOO for XMCRG722 boot 0000 boot in XMCRG722 restart with new switches ,-turn on the interrupt system ;maιn loop thru the frames of data set up by the left and right ; xpsycho dsp for bit allocation and framing by the xcode dsp top !dbg ,-tickle the dog ,-tickle the dog _ _ _ ,-get the external switches to determine if any changes that signal a restart GET_SWITCHES_CD gsws_10 jsr <getsws j clr #4 ,y: <not_appl,_lets_go ; . ! !debug - remove for normal test MUSICAM versus G722 : if G722, ump to restart if MUSICAM, continue move x:tstcode,a MUSICAM vs G722 tst a if zero, it's MUSICAM ne <restart it's G722, start over to boot V of ^ , : '2/ 9 '93 TST_SET_G722_DATA_CD, restart ; ! ! 12/8/93 ,-we have to restart with new framing criteria, : protect the decoding of frames by clearing 2 successive frame move y: <frmstrt, r6 :set starting for output buffer move y: <outsιze,m6 :set the output buffer circular ctl cir a do y: <outmus,_clear_l :clear the 1st frame move a, x: (r6) ÷ _clear_l ; ! ! 12/8/93 TST_SET_G722_DATA_CD, restart ; ! ! 12/8/93 check for new frame set starting for output buffer clear the 2nd frame ! ! 12/8/93 TST_SET_G722_DATA_CD, restart ! 1 !2/8/93 jclr ftO , y: <tιmer,_clear_2 ;check for new frame bclr ftC,y:<tιmer move y: -.linear,m6 :restore to linear buffer control jmp -.restart : let' s start anew _ιets_go initialize stereo control settings to reflect current transmission jsr <setctls jclr ftO ,y: <timer, top ,-check for new frame bclr ft0,y: <tιmer bclr #0, y:<qtalloc ,-clr 0.024/0.036 msec timer bit alloc mow set the used sub-bands for this frame move y:z3_psych,a ;get the selected sub-Dands, if any move a,y:<usedsb ,-set initial used sub-band value move #>MINSUBBANDS_CCS,xO ;set minimum sub-bands to be used emp x0,a ft>MAXSUBBANDS_CCS,xO ;see if subs is too small set default value of maximum ]lt <_default_used_10 if less, default the used sub-bands emp xO , a see if less than maximum sub-bands < after used 10 if less, we' re oκ BAD ORIGINAL _default_used_lC ;default the used sub-bands to max sub-bands move xO,y:<usedsb _after_used_10 ,-set the CCS compression as per control parameter (r__psyc_v bclr ftO , y:ccmprsctl default as do not use CCS compression move y:n_psych,a get the parameter from the taole move ft .5,x0 if less than .5, no CCS compress emp xO, a see if use CCS compression cr not ]lt <_nc_compress if less, do not use CCS compression bset ftO,y:<cmprseti otherwise, set flaa tc use CCS eomcress _nc_eompress ,-the new data for the next trame is all set, lets do it sr <doframe INTERRUPT HOST CD ; inform the host ,-pass the MUSICAM encoded frame off for reed solomon encoding move y:<frmstrt,rC set starting fcr output buffer move y:<outsιze,mO set the output buffer circular ctl move ftreedsolbuf,r2 set starting for output buffer jsr <new rs call Reed Solomon encodmα routine : : :dbg j p :top ;dbg: skip Reed Solomon :dbσ copy the reed solomon encode frame into the output frames Duffer set starting fcr output cuffer set tne output buffer circular set starting for output Duffer SUBSTITUTE SHEET (RULE 2R) \ β ft** ' opt fc, mex , <c) 1991. Copyright Corporate Computer Systems, Inc. All rights reserved ; \URDCDSYN\autosmpl .asm: modified to coordinate with BEN'S mux title 'Decoder Auto Determine Sampling Rate' This routine attempts to determine the sampling rate cf MUSICAM frame of input data being fed to a MUSICAM decoder. It tries tc match on the selected Dit rate a corresponding sampling rate that are predefined fcr , tne given units capabilities. on entry: y:frmrate = indicates which bit rate was selected y<ctlglgs = NO_LINES bit is set as to whether split frames possible x:maxtnes = the number cf attempts at framing that should be made before determining that the input data is net MUSICAM include 'def.asm' include ' .. \common\ioequ.asm' include ' include ' include ' ,-4 possible sync S hdr patterns count of sync patterns to check pattern matched (odd=padded) words per frame (if pad diff -1) bit offset to frame start number of frame to sync up on count of frames sync'ed section highmisc ! !BEN xdef srchrate 13EN xdef srehtries !BEN !BEN xdef maxtries xdef tstsmpl xdef fndbit xdef fndsmpl xdef fndidbit xdef padbit xdef sampletable erg xhe : stauto_xhe ,- : : :BEN srehrate dc ,-index tc rates in sample rate table srcntries dc ,-failure counter of auto sample attempts ,- : : !BEN maxtries ac ;current auto determine max tries tstsmd de ,-sample code under test fndbit de ,-bιt rate code from frame header fndsmpl dc ,-verify found sampling rate selection fndidbit dc ,-veπfy found sampling rate id bit padbit dc ,-save padding bit from the header SAMPLETABLE ,-table for sample rate auto determination endauto_xhe endsec org phe: autosample CLR_DAC_RESET ,-clear the DAC reset line to mute outcut ! !BEN turn off the interrupt system Now set priorites of the IRQA and SSI peripherals IRQA priority = 2 IRQB priority * 3 SSI priority - 2 SCI priority = 2 movep # >Sa 03e , x : < <M I PR ,- set t priori t ies ana edges I BEN aut o_AA j set ftA TONEXTFRAME,y:<process,_auto_cor.tmue build up the frame length table based on the selected bit rate addr of sample rate frame lengths set auto sample offset to next rate get next rate index to search for see if 1st sample rate m table if so, skip address adjustment SUBSTITUTE SHEET ( RULE 26) GINAL j oo b , _auto BB , f or index count , ad table addr move ( rO ) +nθ ' / advance to next sample rate auto BB / ! ! !BEN /for the number of sampling rates supported, set table of frame lengths do #NUMSAMPLERATES,_auto_900 ;7/12/94: test sampling rate as not applicable to current project ;save current table address /get rate applicable code (0 = APPLIES! /clear y:oldccs frames CDQIOOO flag ,-see if not applicable (-1 = N/Ai ,-ιf N/A, go to try next sampling rate if zero, not old ccs CDQIOOO frames indicate old CCS indicate old CDQIOOO frames bset #DECOMPRESS_PACKED,y:<ctlflgs /handle CCS compression _auto_A ,-get the MUSICAM frame header ID bit that indicates high vs low sampling rates move x: (rO) +,xO /get the high/low rate hdr id bit move x0,y:smplidbit ,-save for translate rate code move rO,rl ,-address of entries at sample rate translate the raw bit rate code to the internal rate index code based on whether the sampling rate is high (y:smplidbit l=hιgh) or low (0) and validate that the rate is supported by the software and/or hardware ;addr of the translation table ;to offset to translated index ;pos to bit rate translate 1st value ,-pos to bit rate translate 2nd value ,-low (0) or high (1) sample rate select ,-to see if not supported / get the translated rate index code / see if not supported rate ,-not supported, try next sampling rate ,-set the supported framing bit rate table index code move x0,y:frmrate ;bιt rate index code ,-set up the framing patterns table at sampling rate/framing bit rate move ftAUTOBYBITRATE,nl numb parameters per bit rate move y: frmrate,b get the defined bit rate tst b x: (rl) +,x0 test if code zero ~ set table sample rate code jeq auto 00 if zero, skip addr adjustment rep position to selected bit rate SUBSTITUTE SHEET (RULE 26) l-J- ,u U RIGlNAL ft (rl i +nl _auto_00 move xO,x:tstsmpl ;save sample rate code ;buιld up the table of framing patterns at this sample/bit rate move ftsyncptrn,r2 ;table of framing patterns to match ,-set at least the 1st two patterns: unpadded and padded (possibly) get 1st defined framing pattern if 1st pattern is zero, not valid Sc save 1st defined framing pattern bit rate not supported @ sample rate insert the pattern in test table get 2nd defined framing pattern if pattern zero (NO padding possible/ & set pattern count to 1 (at least) if zero, use 1st pattern over again else, use the padded framing pattern set pattern count to 2 :insert 2nd pattern in test table ; now if split mono framing is possible, set up to look for those frames lflgs,_auto_20 ,- NOT appl if one cr both lines get 3rd defined framing pattern if pattern zero (NOT split frames) Sc in case of duplication as 4th if zero, NOT eligible for split frames insert 3rd pattern in test table get 2nd defined framing pattern if pattern zero (NO padding possible) & set pattern count to 3 if zero, use 1st pattern over again else, use the padded framing pattern- set pattern count to 4 insert 4th pattern in test table _auto_20 ,-set coun t of framing patterns inserted in the framinb pattern table move xl,y :< synccnt ,-set the pattern count for framing ,-get the frame length values at this sample/bit rate addr of sample rate values numb parameters per sample rate to see if need to adjust address if code 0, no need to shift address if 0, get the 3 parameters :ad j us t the table address to proper sampling rate parameters rep move (rO) +n0 SUBSTITUTE SHEET (RULE 26) to 6X5 ORIGINAL auto 40 numb parameters per framing bit rate test bit rate to set audio data size if code 0, no need to shift address if 0, get the parameters :adjust the table address to proper framing bit rate parameters at sample rate get the words per frame at rate to calc circular doubled buffer : skip the bit count per frame double framing buffer fcr circular double buffer ctl save framing circ buffer ctl get any padded frames DIFF value to see if word count ad needed & restore frame ienath words ,-decrement word count if padded set the words per unpadded frame get any unpadded frame extra bits set any unpadded frame extra bits to zero the failure counter zero the failure counter start looking for CRC protection start looking for privacy bit off ! ( BEN / turn of f the interrupt system on ft$03 , mr initialize for the interrupt routine to try to frame move x:srchtries, r3 current failuer counter move #0,x0 clear all bits move (r3) + increment attempt ctr move r3 ,x:srchtries save incrment failure counter move xO,y:<ιnpstat flags to control i/p routine bset ft2,y:<inpstat flag to do pad framing move y:frmemod,a0 for framing buffer size move aO,y:<mpsize store for ssirec rtn to store move ft>AUTO_FRAMES,yl ft of frames to match move yl,y:<syncfrms set number cf frames to sync move χθ,y:<synced zero the synced frame counter move #syncbuf,xO address of the input buffer move xO,y:<inpwptr set the input write pointer !BEN before turning on the interrupts, restart the input data stream process that inputs bits to form 24-bit words move ftBιtIT6In,r7 ,-ιnιt the bit input ouffer p t r andi #$fc,mr /turn on the interrupt system ,-hang out here until framed or failed _auto_80 bset WATCH_DOG ,-tickle the dog bclr WATCH_DOG ,-tickle the dog bset ftAUTONEXTFRAME,y:<process ; ! ! !BEN:perform old ssirec auto sampling on current frame auto_contmue we are now attempting to frame: if start of "syncing" (bit 3 not set) , set 1st word of pair to check set starting word offset set flag to set 2nd word continue to react when 2nd word to check comes else, see if waiting for the 2nd word or counting looking for the next sync move y:frmcurr,r4 ,-set start of the frame addr move y:frmemod,m4 ,-set circular buffer 2 frames _auto_CC ;start looking for framing pattern jset ft3 ,y: <ιnpstat,_auto_35 we have set the 1st word, continue cir a r4,y:wrdoff init for the 2 words to check - save initial start word offset move x: (r4) +,al set 1st word to check liner write pt: bset ft3,y:<ιnpstat flag to check the 2nd word move ftO, r2 start count cf words looking for sync jmp _auto_CC , try 2nd word if waiting for 2nd word to check (bit 4 not set) , put new word in aO to look for the 24 bit pattern start the bit offset counter loop through 24 bits over 1st and 2nd word trying to match one of the defined sync patterns else, we found a pattern and are trying sync up on the next frame auto_35 j se t ft 4 ,y: < ιnpstat,_auto_105 /counting to check next frame sync move x: (r4),a ,-set the 2nd word to search move ft0,rl ;init the bit offset counter do ft24,_auto_65 ,-see if current offset contains a valid sync pattern move al,b current bit offset pattern move #syncptrn,nO addr of array of sync patterns move ftO.rO offset to 1st pattern SUBSTITUTE SHEET (RULE 26 ' BAD ORI INA i - /loop through the available sync patterns do y:<synccnt,_auto_55 move y: (rO+nO) ,x0 get the next sync pattern to check emp xO,b see if pattern matches jne _auto_45 if not, try next pattern ;we found a framing pattern, set the indication and break out to proceed bset ft4,y: <inpstat indicate the match enddo end y:<synccnt loop enddo end ft24 loop jmp _auto_65 we matched the pattern _auto_45 ;try the next framing pattern move (rO) + _auto_55 ;try the next bit for a match of a framing pattern asl a (rl)+ shift left into al increment the bit shift counter auto 65 if the pattern was not matched, set the next word as the offset increment the address for the next word exit the interrupt routine and wait for a new 2nd word to check cir a (r2)+ zero the syne'ed frames counter Sc incr count of words looking for sync jset ft4 ,y:<inpstat,_auto_75 if match, set up to check next frame move y:<syncwrds,a get number of words per frame move ft>FRAME_0VERAGE,x0 to add some cushion to frame length add xO,a r2,x0 add cushion to frame length & get words checked so far emp xO,a r4,y:wrdoff test more than frame checked for sync & save possible new start word offset :if more than a full frame has been searched without finding SYNC: we failed at framing at this sampling/bit rate indicate failure at sample/bit rate set new 1st word to check (incr ptr) try new 2nd word frame matches a sync pattern: update the syne'ed frame counter save the sync pattern match index to test for padding or not store the new bit offset to start this frame set the address and offset for the next frame see if padding needed, SUBSTITUTE SHEET (RULE 26> ^AD ORIGINAL 0 update the syne'ed frame counter save matched pattern index save the bit offset address start last frame set circular buffer words to next frame get the bit offset start address for next frame start get unpadded frame extra bits add extra bits to offset Sc set upo for any neede padding match index even, NOT padded ,add the padded bits ,-see if bits exceeds full word and adjust 24 bits per word see if next address needed if offset witnm word, continue (rO) adjust the bit offset by full word Sc increment the start address _auto_95 ;set address and bit offset to match the next frame ,-start next frame word address ;start next frame bit offset ,-advance the write pointer ,-restore as a linear buffer ,-restore as a linear buffer ,-clear reached frame indicator ,-BEN - exit rtn and wait for next frame if ready to check the new frame as it comes in test if expected frame start address has been reached if so, set indicator to check the next word received (2nd in the frame' otherwise, keep accepting frame words into buffer else, check for the pattern in the 1st and 2nd word (latest received' jset #5,y:<ιnpstat,_auto_115 move r4 ,x0 to test if frame start addr hit move y:wrdoff,a address to match emp xO,a (r4)+ see if address hit - increment the write pointer jne auto 155 if not, frame length proDle ;we have the 1st word of the frame ; set indicator to check 2nd word for framing pattern bset ft5 , y : <mpstat ,- indicate check next word for pattern jmp auto CC ,- to check 2nd word auto 115 ,-we now have the 2 words to check this frame for framing cir a #>l,xl clear the register to align pattern & set to increment frame match count move x: (r4) -,a0 retrieve 2nd word (back up to 1st) move x: (r4) +,al retrieve 1st word (forward to 2nd) ,-ιf a bit offset, shift over the expected bits to align the pattern ,-to see if a shift is needed ,-see if zero ,-ιf so, skip the shift ■ shift left to align pattern in al do b, auto 125 asl a _auto_l25 / see if current offset contains a valid sync pattern to test shifted pattern from frame addr of array of sync patterns offset to 1st pattern indicate no match yet loop through the available sync patterns do y:<synccnt,_auto_145 move y: (rO+nO) ,x0 ,-get the next sync pattern to check emp xO,b ,-see if pattern matches jne _auto_135 ;ιf not, try next pattern ;we found a framing pattern, set the indication and break out to proceed bset #6,y:-.mpstat indicate the match enddo end y:<synccnt loop jmp _auto_145 we matched the pattern _auto_135 ,-try the next framing pattern move (rO) + _auto_145 ,-ιf not a matcn, we are not framed, try again via framit or autosmpl rtn j clr #6 ,y: < ιnpstat ,_auto_155 / we did match a framing pattern move y:<synced,a get count of frames syne'ed so far add xl,a y: <syncfrms,xl increment count & set to test if limit reached emp xl,a y.bιtoff,rl see if sync frame count reached Sc set the bit offset reaister SUBSTITUTE SHEET (RULE 2fi jlt auto 75 ;not at limit, go set up for next rrame we are now considered framed indicate OK put bit offset for this new frame in proper register put address offset for this new frame in proper register set the data gathering correctly exit the interrupt routine cir ft>l,x0 a=0 indicates we're framed Sc set to set flag to gather data r3 is expected to have the bit offset address of the last matched frame sta starting address of input buffer calculate the start offset into buffe Sc increment the input write pointer save buffer address start word offset r5 is expected to have address offset set flag for normal data gathering done with auto sample this sample rate /failed to frame, indicate to the framit or autosmpl routine tc try again bset ftθ , y: <inpstat _auto_160 ! !BEN:per orm old ssirec auto sampling on current frame jset ftO,y: <inpstat,_auto_90 /framing found set #8,y:<mpstat,_auto_100 /conclusion has been as not framed jmp _auto_80 ,-continue waiting for result _auto_90 we nave successfully framed the correct number of frames in a row and therefore we found our sampling rate ! ! !BEN enddo ;end ftNUMSAMPLRATES loop bset ftAUTOSAMPLEPROCESS,y:<process ;indicate auto sampling done cir a ,-indicate success to caller move y: linear,m4 /restore as a linear buffer rts ,-return with sample rate found _auto_100 ! !BEN ,-we did not frame at that last sample rate, try the next one ,-turn off the interrupt system ,-number of tries at sample rate ,-number of tries at sample rate -13"- get tolerance ctr see if time to try next sample ra t e not yet make another try ,-see if the pass looking for frames with privacy bit not set move ftprivacybit,r3 ,-addr of privacy bit flag nop jset #0,y: (r3) ,_auto_108 ;if tried privacy, check protection ,-now try looking for a frame header with the privacy bit set move ftsyncptrn,r3 ,-modιfy table of syn patterns bset ftO,y:prιvacybιt ; indicate privacy bit set ;for the number sync patterns set the privacy bit set do y:<synccnt,_auto_102 bset ftO,y: (r3) + _auto_102 ;restart the attempt counter for the new sync patterns ,-zero the failure counter /now make tries with privacy bit set ,-see if the pass looking for frames without CRC protection was done if so, try next sampling rate jset #0,y:<protect,_auto_800 ,-ιf no CRC done, try next sampling rate ,-now try looking for a frame header without the CRC protection move ftsyncptrn, r3 modify table of syn patterns bset ft0,y:<protect indicate NO CRC protection bclr #0,y:prιvacybιt reset try with privacy bit set tc ,-for the number sync patterns set the NO protection bit do y:<synccnt,_auto_110 bset #8,y: (r3) ,-set the protect bit bclr #0,y: (r3)+ ,-clear the privacy bit _auto_110 ;restart the attempt counter for the new sync patterns move #0,r3 move rO,x:srchtries ; zero the failure counter jmp _auto_70 ,-now make tries without CRC bit ,-7/12/94: added label to skip to next sampling rate if not applicable _auto_800 /this sampling rate did not match, try the next table entry SUBSTITUTE SHEET ( RULE 2P) BΛϋ OWGlNAL : !BEN move y: <svereg, rO ,-restore sample table address move ftAUTOBYSAMPLE, nO ,-set auto sample offset to next rate nop move (rθ)-t-nθ ,-advance to next sample rate !BEN: increment the current sample rate table index to try next sample rate bclr #AUTONEXTFRAME,y:<process ,-to start next sample rate entr move x:srehrate,b ,-to increment table entry move ft > l , x0 increment add χ0 , b ft >NUMSAMPLERATES xO ,- increment search index Sc get max table entries count emp x0 , b b , x : srchrate see if table totally searched & m case, save new search index :it auto AA if less than max, try new table entry _auto_900 ,-we failed to determine the sampling rate, indicate failure to caller bset ftAUTOSAMPLEPROCESS, y: <process ; indicate auto sampling done move ft>-l,a ,-ιndιcates failure move y: linear,m4 .-restore as a linear buffer rts ;return to caller 96/32805 -139- opt fc (c 1991. Copyright Corporate Computer Systems, Inc. All rights reserved. \URDCDSYN\getancda.asm: BEN y:<lιnear, y:frmemod(inpsize) ,- This routine decodes the ancillary data bytes for output to rs232 i/f. on entry r6 = current offset in output array y:dataιptr = address in data byte input buffer to start from y:bytecnt = count of bytes in input buffer not yet transmitted a = destroyed b = destroyed yO = destroyed yl = destroyed rO = destroyed rl = destroyed r2 = destroyed r3 = destroyed r4 = destroyed n4 = destroyed include 'def.asm' include ' .. \common\ioequ.asm' include ' section bytebuffer xdef databytes ;buffer for bytes received ,-data baud rate code from switcnes pe of count field after audio data: 0 = 3 bit padded byte count 1 = 8 bit data byte count ta baud rate code from switches r for next byte decoded from frame SUBSTITUTE SHEET (RULE 26. ,-ptr for next byte to transmitted to rs232 ;count of bytes yet to be output tc rs232 /tolerance check of bytecnt for scixmt ,-save reg aO for scixmt ,-save reg al for scixmt ;save reg a2 for scixmt ;hold pad bytes from the frame endgetancda_yhe endsec org phe : getancdata ,-clear the ancillary data problem for old CCS frames bclr ft2,y:oldccs ,-set address of type of count to extract: padded bits byte count OR data byte count move ftanctype,r4 ,-addr of type of count field ,-do not decode ancillary data from a reused saved frame set ftUSE_SAVED,y:<ctlflgs,_ancd_90 ;if not reused, continue ,-see if data byte count, and if so, read byte count and then bytes jset #0, y: (r4) ,_ancd_78 ,-ιf byte count, get data byte count ,-set the end of the MUSICAM portion of the full frame values ,-normal MUSICAM frame last word address ,-normal MUSICAM frame last bit offset ,-set circular buff to addj addr ,-set circular buff to ada addr ,-ιnιt the pad bytes value ,-test if room remaining in the frame to read the CCS ancillary data pad byte count ,-get addr of last word into proper reg ,-to test next addr to decode ,-to see if last word being decoded ,-to test last frame word address tt>BITSFORPADDING,xl ,-see if about to decode last ,- c set numb bits in pad byte cnt ,-ιf net, test room from curr decode word ,-decoding of the last word in the frame is in progress, see if sufficient bits remain to get the padded byte count move ft_»24,b ,-get bits per word move y:<sc,x0 ,-get undecoded bits count in last word sub x0,b n0,x0 ,-calc bits decoded from last word so far ,- Sc get total bits m that last word ,-make bits already decoded negative add xC ,D add total bits in last word emp xl.b see if enough bits remain idbg Di _ancd_85 if not it's not CCS, no ancillary data ge ancd 05 if sc, do ancillary data nop nop nop nop nop jmp ancd 85 .f not it's not CCS, no ancillary data ancd 00 ;test the next to last word address to test remaining bits - offset tc last move .rl) - back up to next tc last word addr move rl,xC tc test next to last vs next addr emp xO, a see if next is next tc last jne ancd 05 if not at next tc last, de ancillarv ;see if remaining bits in current (next to last) word being decoded plus the nurtiDer of bits in the last word have enough bits for pad byte cnt y: esc,b get undecoded bit cnt curr decode word move nO ,x0 get total bits in that last word add x0,b add total bits to remaining bits cnt emp xl,b see if enough bits left in the frame !dbg it _ancd_85 if not, it's not CCS no ancillary data ge ancd 05 if so, do ancillary data nop nop nop nop nop jmp ancd 85 :if not, it's not s no ancillary data _aneed 05 ; get the count cf pad audio bytes from the frame move ftmasktbl , r2 move ftB ITSFORPADDING , n4 numb bits in pad Dyte count move n , n2 get hi order bit mask index jsr getvalue get pad byte count from frame move y: (r2+n2) ,xl mask off high order one's and xl,a n0,x0 mask off high order one's & set end of frame bit offset move al,a clean up for a zero test move a, y:padbytes save the retrieved pad byte count tst a y:dataιptr, r5 test if any pad bytes included Sc set addr of next byte to be stored jeq _ancd_4C no pad bytes in frame, go decode data ;ad j ust end cf frame for padded bytes (8 bits per byte ) set up bits in a data byte get count of pad bytes mult by 8 bits per byte - set bits per word SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL t — align integer result ■ Sc get next decoded word addr :shift integer result ;if a full word of padding remains :if not, go adjust the bit offset ■ to see if at next decode word ■ see if next to decode reached :ιf so, no data to decode if not, keep checking if so, no data to decode sub full 24 bits, back off one word in end address try again ,-now back off the number of bits emp xO,a x0,b offset vs rest of pad bits - offset to b reg for adjustment if less or equal, don't adjust get next decoded word addr see if next to decode reached & offset to b reg for adjustment if so,no data to decode if not, data to decode ;if so, no data to decode ,-adjust offset by bits for full word ,- Sc back off one more word address _ancd_30 :ad ust the bit offset by the remaining pad bits ,-get the remaining pad bits ,-calculate new bit offset ,-save approx end of anc data offset _ancd_40 ;now ge t the by t es and store in the buffer for the trasmit interrupt move #DATABUFLEN-l,m5 circular buffer move ftBITSPERBYTE,n4 number of bits to decode from frame move n4,n2 get hi order bit mask index SUBSTITUTE SHEET (RULE 26. ove ftC , 3 ,-thιs is the decoded byte counter _ancd_50 :as long as there is room for a byte be decoded, do it curr next frame word address set up bits in a data byte next frame word addr - 1 = curr addr get frame end word addr get end bit offset in frame end word to compare curr frame word to end addr is curr frame word equal end frame word S get bit offset into curr frame word if not end frame word, try next to last since we've decoded into the last word in the frame, subtract remaining bit in curr word from 24 to determine how many have Deen decoded subtract the used bits from the last word bits available move ft>24,a bits per word to be sub from sub b,a y0,b subtract y:<sc from 24 to get used cnt tt get last word bits available sub a,b sub used bit cnt from bits abvalable mp ancd 70 see if another byte can be decoded ancd 60 :since we have not reached the last frame word, we must see if we're at ■ the next to last frame, and if not, keep decoding ancillary data bytes end frame word address this pains me back up to next to last addr for comparison is curr frame word = end - 1 frame wo∑ if not, decode the next data byte we have reached the next to last frame word, add bits from the last frame word to those remaining in this byte if there is a byte's worth of bits, decode another ancillary data byte add y0,b ,-add number of bits in last word ancd 70 emp xl,b ,-see if a byte fits in the bits left Dit ancd 80 ;no more bytes, go update byte count _ancd_75 ;there is room for another byte, let's get it retreive the next byte from tne frame mask off high order one's mask off high order one's Sc incr byte counter ise. :he byte into the transmit buffer B AD ORIGIN L move al,y: (r5)+ ;put tne byte out :test to see that did not exceed baud rate byte count ,-count of data bytes just decoded ,-maxbytes tolerance decoded check ,-check for frame alignment error /skip if too many bytes decoded ,-see if there is room for another _ancd_78 ,-get the count of ancillary data bytes in the frame bits in the ancillary data byte count set addr of the masking table get hi order bit mask index get pad byte count from frame get mask off high order one's mask off high order one's Sc zero decoded byte counter clean up for a zero test test if any data bytes included & set addr of next byte to be stored no data bytes in frame, we're dene / make sure the data byte count is valid vs the max bytes at this baud rate ,-get max bytes @ baud rate ,-comp byte count from frame to max ,-ιf number is too big, skip data / now get the bytes and store in the buffer for the trasmit interrupt move ftDATABUFLEN-l,m5 ,-set circular buffer / get the count of ancillary data bytes in the frame ,- bytes are stored m the reverse order received by encoder do a,_ancd_80 ,-get the next ancillary data byte jsr getvalue retreive the next byte from the frame move y: (r2+n2) ,xl mask off high order one's and xl,a (r3)- mask off high order one's Sc mcr byte counter / insert the byte into the transmit buffer move al,y: (r5)+ .put the byte out _ancd_80 / temporarily disable the interrupt for data received bclr ftM TIE,x:<<M_SCR nop noD ^ 0AD ORIGIN nop while waiting for interrupt to take effect: make a tolerance check of the frame's alignment to make sure we haven't decoded more data bytes than is possible if we have decoded too many bytes, skip the junk just decoded by ignoring the results of this frame move r3,y0 count of data bytes ust decoded move y:maxbytes,a axbytes tolerance decoded cneck emp y0,a y:bytecnt,a check for frame alignment error S get latest byte cnt of unsent bytes it _ancd_85 skip if too many bytes decoded ,-interrupt should now be disabled and we can safely update count of unsent bytes add yO,a r5,y:dataiptr add count of bytes just framed & save addr of next byte next frame move a,y:bytecnt save new unsent byte count jmp _ancd_89 reset interrupt ancd 85 a problem decoding ancillary data may indicate a stream of frames from some other manufacturer or, if the frames are from a CCS encoder that is encoding old CCS CDQ200G two-channel frames at a low bit rate that is incorrectly using the wrong allowed table BUT, has an old CCS CRC-16 checksum ; ! ! !dbg nop nop nop nop nop ; ! ! !dbg jset ftCRC_OLD_vs NEW,y:<ctlflgs,_ancd_89 ,-ιf ISC CRC, ccntir ,- : : :dbg nop nop nop nop nop ,- : ! !dbg bset ft2,y:oldecs ;show problem to switch to old CCS _ancd_89 ,-turn the transmit byte interrupt back on bset ftM TIE,x: <<M_SCR ,-enable transmit interrupt ;return after ail bytes decoded and counted move y : linear,mO ,-uncircular buffer move m0,ml juncircular buffer move m0,m5 juncircuiar buffer ancd 90 SUBSTITUTE SHEET (RULE 26) i BAD ORIGINAL , opr ( c) 1991. Copyright Corporate Computer Systems, Inc. All rights reserved. \URDCDSYN\getbal .asm: BEN y:<frmtype y.<sιbound title 'Get bit allocations' This routine is used to get the bit allocations of each of the sub-bands It is from the ISO standard. suD-band 0 - 10 use 4 bits (11 * 4 = 44 bits) sub-band 11 - 22 use 3 bits (12 * 3 = 36 bits) sub-band 23 - 26 use 2 bits ( 4 * 2 = 8 bits) ( total = 88 bits) on entry rO = address of bit allocation array for both left and right channels r6 = current offset in the input array n6 = base address of the input array y---maxsubs = MAXSUBBANDS at sampling rate and bit rate y:sc = shift count of current input word y:frmtype = full stereo, joint stereo or mono y:sιbound = joint stereo sub-band intensity bound x:crcbιts = accumulator of bits covered by CRC-16 routine (bit allocation bits are accumulated) r6 = updated y:sc = updated place holder in mask table masK table for 1 bit getvalue bit getvalue bit getvalue bit getvalue bit getvalue SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL /define data size table for tbl ,-address of BAL's bit table as per Allowed table selected skftbl ds 1 ;These tables is the number of bits used by the scale factor in each sub-band ; High sampling rates with higher bit rate framing skftbl l sub-band 0 sub-band 1 sub-band 2 sub-band 3 sub-band 4 sub-band 5 sub-band 6 sub-band 7 sub-band 8 sub-band 9 sub-band 10 sub-band 11 sub-band 12 sub-band 13 sub-band 14 sub-band 15 sub-band 16 sub-band 17 sub-band 18 sub-band 19 sub-band 20 sub-band 21 sub-band 22 /sub-band 23 ;sub-band 27 ;sub-band 28 ;sub-band 29 ,-sub-band 30 ;sub-band 31 ;sub-band 0 ;sub-band 1 sub-band sub-band sub-band su -band sub-band sub-band sub-band 8 sub-band 9 sub-band 10 sub-band 11 sub-band 12 sub-band 13 sub-band 14 sub-band 15 sub-band 16 sub-band 17 sub-band 18 sub-band 19 sub-band 20 sub-band 21 sub-band 22 sub-band 23 sub-band 24 sub-band 25 sub-band 26 sub-band 27 sub-band 28 sub-band 29 sub-band 30 sub-band 31 sub-band 0 sub-band 1 sub-band 2 sub-band 3 sub-band sub-band sub-band sub-band sub-band 8 sub-band 9 sub-band 10 sub-band 11 sub-band 12 sub-band 13 sub-band 14 sub-band 15 sub-band 16 sub-band 17 sub-band 18 sub-band 19 sub-band 20 sub-band 21 sub-band 22 sub-band 23 sub-band 24 sub-band 25 sub-band 26 sub-band 27 dc :sub-band 28 dc ,-sub-band 29 rend table 3-B.l dc ;sub-band 30 dc :sub-band 31 endgetbal_xhe endsec org phe: initialize : a rl with start of subband allocation table of bits in frame per sub-band D. nO offset for right channel sub-band bit allocation values: left channel from C to (NUMSUBBANDS - 1) right channel from NUMSUBBANDS to ( (2 * NUMSUBBANDS! - 1) c. r3 set with joint stereo sub-band boundary for stereo intensity- 4 (4-31) , 8 '8-31) , 12 (12-31) or 16 (16-31) getbai move x:skftbl,rl move ..masktbl, r2 move #NUMSUBBANDS,nO cffset for right channel move y:sιbound,r3 deer stereo intens sub-band ctr move x:crcbιts,r5 get CRC-16 bit counter loop through the sub-bands extracting the left and right (if applicable) bit allocation index values (y:<maxsubs = fixed count of sub-bands framed) : a. for current sub-band get the number of bits for allocation index value and increment address of the next sub-band bit count b. get the bit allocation for the left channe1 always c. b register isolate the type of frame: full stereo, joint stereo or mono d. yO holds the mono frame type code for testing e. yl holds the joint stereo frame type code for testing f. see if the frame type is joint stereo and just in case, move the current stereo intensity sub-band boundary counter value for testing g. if not joint stereo, see if this is a mono frame type h. if it is joint stereo: 1. test if tne boundary counter has reached zero, and just in case it has, restore the left channel bit allocation value to the al register 2. if the counter is zero, go to copy lef channel into the right channel 3. if not, go to extract the full stereo rlght channel allocation value do y:<maxsubs,_getb_40 move x: (rl) +,n4 get # of bits to read move n4,n2 get hi order bit mask index move n4 ,n5 to accumulate CRC-16 bits jsr getvalue get a left cnan bit aliocatier move y: (r2+n2) ,xl mask for high order one's move (r5)+n5 accum bits for CRC-16 rtn and xl,a y:frmtype,b mask off high order one's Sc set for frame type compare move al,x: (rO) set left channel move #>MONO,y0 ck for no right channel move # > JOINT_STEREO,yl ck for intensity sub-band emp yl,b r3,a check for stereo intensity jne _getb_lC if not, see if mono tst a x: (rO) ,al reached bound, restore left v_ jeq _getb_30 yes, left val to right val move no, deer mtens sub-Dand cntr SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL 0 ;mp αetb 20 ana retreive riant :nar. va.je test fcr a mono type of frame and just in case it is, set al tc zerc for insertion into the right channel for consistency if it is mono, go to move the right channel value otherwise, fall through to full sterec mono, insert 0 ,-get a right chan bit allocation /mask for high order one's ,-accum bits for CRC-16 rtn ,-mask off hiσn order one's insert the right channel value inO Ifset increment for the next sub-oand _getb_3C move al,x: (rO+nO ι ,-right cnannel sub-band alloc move (rO) + ; incr for next sub-Dand _getD_40 Fill the unused sub-bands with 0 bit allocation This allows getdata to process these sub-bands normally and insert data in them. :current MAXSUBBANDS :equais unused sub-Dands ,-right channel ,-left chan - incr for nei ,-store updated CRC-16 bit counter BAD ORIGI AL SUBSTITUTE SHEET (RULE 26) opt fe.mex '.C 1995. Copyright Corporate Computer Systems, Inc. Ail rights reserved . .asm: with Reed Solomon decoding title 'Main' 27 '4/93 rmicrmus.asm version cf cdq20C0 MUSICAM (rdcdsynt .asm) for mierc ,** * ********* **** * * ** ** *** * **** *** * ** , 08/26/9: (dsb lwh) NOTE: Never use m4 to control a circular buffer. The interrupt rou t ine, ssirec.asm has been sped up by using m4 and then restorina i t to a linear buffer. This routine does it all for the decoder. include 'def.asm' include ' .. \common\ioegu.asm' include ,-set A cf 192 inverse quantized lir left 4 right sub-band scale factors 192 samples per 1 group of 3 samples for 32 sub-bands from both ena nels SUBSTITUTE SHEET (RULE 26. BAD ORIGINAL org vhe strmicro yhe eheksum ds hold checksum from coded frame frmsize ds number of words in a frame frmemod ds l ,-numb words in 2 frames - l (mod Duffer frmhalf ds 1 ;l/2 words in framed buf (rd ptr check; framesz ds size of framing input mod buffer ctl sueeessive f aming faults: oof out-of-frame sync pattern failures voof sample rate code faults (auto sample vs frame header poof CRC protection code faults (auto sample vs frame header) doof ancillary data errors coupled with old CCS CRC-16 algorithm oof ds 1 ;ou -of-frame faults: numb of oof's ,0-NOOF) vocf ds 1 ,-number of voof' s (0-NOOFl poof ds 1 ,-CRC protection faults: numb of poof's O-NOOF) doof ds 1 ;ancιl data with old CCS CRC-16: doef's (0-NOOF> IPwrdoff ds 1 ; frame l/p word offset from start of buffer IPbitof ds 1 ,- frame i/p bit offset from msb wrdoff dc C ,-frame decoding word offset from start cf ouffer Ditoff dc 0 ,-frame decoding bit offset from msc dedfrmo s 1 ,-framebuf circ buf mod ctl ,-these are for auto detect as requested by switches ISO sampling id bit from frame header, low/high ISO bit rate from frame header: io/hi .Kbit rate ISO sampling rate from frame header: low/high ISO sampling rate from on select sws : low/high ISO bit rate from select sws : lo/m Kbit rate hold i/p buf addr to restore after save dip switch .1 bit' indicate which of 2 selectable bit rates bit rate sets numb words in a frame 0 = lower Kbit rate 1 = higher Kbit rate smpirte dc 0 i/p PCM data sampling rate lputcde dc c 0 = MUSCIMAM frames, 1 = G722 data i/p smplidbit dc ISO hdr id bit: 1 = 32 or 48 K sampling rate 0 - 16 cr 24 K sampling rate maxsubs 1 ds MAXSUBBANDS if MONO frames SUBSTITUTE SHEET (RULE 26) . ;> 96/32805 -1 5- MAXSUBBANDS if 2 channel frames bit 0 = 1 to decode old CCS CDC1CCC 0 means MPEG-ISC frames count successive bit errors in case of fade volume output ctl in case of fade volume output ctl count framing to reboot if toe many ;table of sample rate variables ;table cf framing bit rate variables :table cf specified ancillary data rates The variables Delow are defined in lowmisc in low y memory and must be locate: Delow address 40 to maKe use of short addressing. org yli strmιcro_yl_ word_out ds 1 ,-applicable hardware outputs (leds, switches word_m ds 1 ,-applicable hardware inputs (switches, lines not_appl ds 1 ,-satιsfy non-applicable hardware settings fr type ds 1 ■ from coded frame indicates: 00 = (0) full stereo Cl = (1) joint stereo 10 = (2) dual channel 11 = (3) mono 'I channel sibound ds ;intensity subband boundary alloc addr et. _gs as :control indicators in certain bits. bit 0 = STEREO_vs_MONO: 0 = stereo 1 ■ mono bit 2 = joint stereo or not 0 - NOT joint 1 = joint sterec frame bits 6, 7 and 8 indicate protection ,-was a saved frame used 0=no, ι=yes bit 6 is overwritten when validating the checksum after getsbits- if 0 « checksum valid, use tne frame in progress SUBSTITUTE SHEET (RULE 26) 0 B\G^ β ana save it wner. finished if 1 = checksum failed, use previous saved frame and bypass saving it when done bit indicates if a saved frame has been stored: 0 = no saved :rame 1 = yes a saved frame bit 8 indicates to getvalue ihis is a good frame to store : 0 = do not store m save area 1 = do store in save area bit 18 indicates whether tne frame is coded with CRC protection or not 0 = no CRC16 checksum 1 = yes CRC16 checksum included bit 19 is for mono output only wner. one channel is used for output and the other is to be muted (see bit 20) : 0 = left channel fcr output 1 = right cnannel for output bit 20 is for mono output only and specifies if the mono is to output to one or both cnannels : 0 = both channels 1 = one channel only as defined by bit 19 working MAXSUBBANDS flag for CRC checksum protection: bit 0: 0 = yes, 1 = no state of data collection used by ssirec to set mod buffer i/p use by ssixmte for temp storage output left write pointer output right write pointer value -1 to reset regs to linear buffs org phe: start ,-turn off the interrupt system on #S03,mr nop nop nop movep #$0001,x :<< M_BCR ,-set all external 10 wait states , -se t dsp56002 clock t o selected MHz ( PLL Control Register* RDECODE M PCTL sr -.mitdeb ,-ιnιt the debug port move »S~209C6 , a SUBSTITUTE SHEET (RULE 26^ ^ βAD ©ftl©MA: ^ ϊ sr couthex jsr <:r /initialize the volume output fade control PORT C Assignments s = ssi port l = input port o = output pert 8 - 7 6 5 4 - 3 2 1 0 S S S S S S 1 Ξ S RDECODE_PORT_C_M_?CC ,-set C ccntrcl register for general I. RDECCDE_PORT_C_M_?CC ,-set the default outputs RDECODE_PORT_C_M_FCDDR ,-set C register direction initialize the ssi port fcr the input from the xmitter RDECODE_SSI_M_CRA ;set ssi era register RDECODE_SSI_M_CRB ,-set ssi crb register initialize the sci port for tty RDECODE_SCI_M_SCR ,-set sei status control register PORT B Assignments i = input port o = output pert 14 13 12 - 11 10 9 8 - 7 6 5 4 - 3 2 1 0 O O C O O O O O i l l i l l ! RDECODE_PORT B_M_PBC set B control register for general IC RDECODE_PORT~B_M_PBD set the default outputs RDECODE PORT~B M PBDDR set B register direction move #>ON_LEDS_DCD,b /flash the LEDS on move b,y:<word_out CLR_DAC_RESET ~ ,-clear the DAC reset line tc mute outp-. ON_LO_SAMPLE_RATE_LED_DCD ON_HI_SAMPLE_RATE LED_DCD SET_LEDS_DCD INTERR ?T_HOST_DCD move #>RDCDSYNT_STARTUP,a sr cwait initialize the linear buffer value for mX move #-l,m0 ,-reset to a linear buffer move mO,y:ciinear ;ir.it tne autc select test table of frame lengths, sample rate and bit rate ;tnιε tacle as each entry wit 2 words: lengtn, sample/bit flags SUBSTITUTE SHEET (RULE 26) ij -158- of flag word indicates sample rate: Z - - . = nigh cf flag word indicates framing bit rat. LOW, I = r.igr. table of selectable frame lengths table to test from get 1st entry frame length store smallest frame indicate high sample/low bit rates ;2nd smallest frame ; indicate high sample/high bit rates :2nd largest frame : indicate low sample/low bit rates ■ largest frame indicate low sample/high bit rates ,-set start-up auto selects bset #0 , x:autorate /with lower bit rate bset #0 , x:autocode ,-as MUSICAM oset #0 , x: autosmpl ,-at low sample rate 24,000 restart CLR_DAC_RESET ; clear the DAC reset line to mute outpu: INTERRUPT_HOST_DCD :urn off the interrupt system set tne interrupt for host interrupts HOST set to IPL 2 movep #>S0800, x:<<M_IPR :set ir.t priorities and edges anai t.$fc,mr :turn o the interrupt system cri tt$03,mr ;disable the ancillary data transmit interrupt bclr #M_TIE,x:c<M_SCR bit C The input state word, y:inpstat, controls data collection from the outside into the decoder. If bit 0 is C , then evervtime an input occurs, event is counted by incrementing the input write pointer ιy:mpwptr, and no data is stereo. If t C is a then data is stored and the input write pointer is incremented. cir #>OFF LEDS_DCD, b ; initialize leds as ci move a,y: <ιnpstat :state of the input buffer move a, y: <ctlfigs :decoding control flags move a,y: <not_appl :lear any stubbed flags initialize the led outσut word and light initial leds SUBSTITUTE SHEET (RULE 26) BAD O IGI AL ove D,y: ewcrd_out ON_ALARM_LED_DCD ; light alarm led indicator TST_SET_AI_ARM_RELAY_DCD,_set_led_0 ;unless already set, SET_ALARM_RELAY_DCD ,-set the alarm relay line on set_led_0 OFF_LO_SAMPLE_RATE_LED_DCD OFF_HI_SAMPLE_RATE_LED_DCD . * * ** * *** . TEST NOTICE THAT THE FOLLOWING DATA IS DECODED AND PUT INTO A HIGH MEMORY AND WILL BE CKCKED WOTH THE CODED DATA ALL THE TIME WHILE THE PROGRAM RUNS TO MAKE SURE THAT NONE OF A WORD IS IN ERROR TEST DATA initialize the buffer to De decoded for testing OFF_REED_SOL_LED_DCD ,-indicate no problem with Reed Solomon make sure it's linear Duffer make sure it's linear buffer make sure it's linear buffer code the 1st of the encoded frames zero the test value accumulator 4 to increment in the test buffer ;set the frame buffer to sequentially incremented values _ιr.ιt: ;dc the reed solomon encoding on the test frame buffer o/p pointer of buffer to be RS-DECODΞ i/p pointer fcr CODED data tc decode Reed Solomon profile: control decode encode via reed solomon :test if the reed solomon codec worked or NOT move #syncbuf,r6 / pointer for DECODED data te be stored move #framebuf, rl ,-poιnter for tne verification table ,-veπfv that tne reed solomon coded values are correct Get current coded data output Get precoded look up table value compare 2 values If SAME No problem indicate no problem with Reed Solem.cn Same noc SUBSTITUTE SHEET (RULE 26) BAD ORIGINAL 0 _RS_Chk SET_LEDS_DCD INTERRUPT_HOST_DCD ,-mute current output buffer move #outbuf,r7 ;setup synth variables jsr <muteout ,-mute the dac output buffer ,-get the external switches to determine frame bit rate and ancillary data baud rate GET_SWITCHES_DCD gsws_00 jsr <getsws ,-MUSICAM selections by switches set up prior to possible auto selec t move x:tstsmpl,yl move yl,y:smpirte ,-set the i/p PCM sampling rate code move x:tstcode,yl move yl,y: lputcde ,-set type of i/p data MUSICAM vs G722 move x:tstrate,yl move yl,y:frmrate ,-set the frame rate i/p code ! ! !dsb 11/22/94 ,-ιf no auto selection required, go with the settings from the input switches move #autosel,r0 nop jclr #0,x: (rO) ,_onward_ ;N0 auto selection required ! !dsb 11/22/94 if the selection of MUSICAM vs G722 is not auto selected, test for MUSICAM input data stream selected versus G722 data input stream and if G722 selected manually, boot rom file from lower half of the chip jset #AUTO_SELECT_DATA_TYPE,y:<ctlfigs,_auto_type move y:lputcde, tst b ;0 = MUSICAM, else G722 jne <g722_boot ;if 1, it's G722, boot lower half _auto_type ,- initialize the auto select MUSICAM max tries move # > MAX_BOOT_TRIES,x0 move xO,x:maxtrιes sr outoselect ;try for MUSICAM input data ;if autoselect successful, use the selected info move #autosel,r0 nop nop nop j clr #0,x : (rO) ,_onward_ ;N0 auto selection required ,-ιf auto select for MUSICAM vs_G722, it must be G722 SUBSTITUTE SHEET (RULE 26) ΌAO ORIGINAL j nop nop nop nop nop set #AUTO_SELECT_DATA_TYPE,y ■ <c iflgs, g722_boct : indicate not MUSICAM framed ON_FRAME_LED_DCD ;set the framing led alarm SET_LEDS_DCD INTERRU?T_HOST_DCD jmp <restart .-try for new switch settings _onward_ [everything fcr MUSICAM selected by switches or auto selection move x:tstsmpi,yl move yl,y:smpirte set the i/p PCM sampling rate code move x:tstcode,yl move yl,y:lputcde set type of i/p data MUSICAM vs G722 move x:tstrate,yl move yl,y:frmrate set the frame rate i/p code move x:tstbaud,yl move yl,y:baudrte set ancillary data baud rate code /test for the diagnostic method of operation TST_CLR_DIAGNOSTICS_DCD,_go_fwd ,-ιf normal operation, continue .•diagnostic method of operation selected, reboot from tne low portion cf chip bclr #11 ,x:<<M_PBD ,clr boot cOOO for rdcddiag boot CC : jmp <bootup _gc_fwd set the values for the data collection routine. This is used for setting the value for the mod buffer ctis y:framesz input for purposes cf framing y-frmemod normal framed input (double bufferea-2 frames but setting the address of a buffer 'y:inpwptr> can't hurt either. move #syncbuf,aO ,-set input word pointer move aO,y:cmpwptr move #framebuf,aO ,-buffer addr of MUSICAM decode buffer move aO,y: inpaddr ;store input buf addr for saving frame set access to the flags resulting from autosel framing pattern match: bit 0 - sampling rate: 0 = low, 1 = high bit 1 - framing bit rate: 0 = low, 1 = high Dit 2 - ISO vs old CCS: 0 = ISO, 1 = old ccs CDQIOOO bit 3 - CRC-16 protection: 0 = yes, 1 = unprotected move #chkflags,rl ;tc test results of autosel match ;basea en tne sampling rate and framing Dit rate selected SUBSTITUTE SHEET (RULE 26) NW - fi 96/32805 -162- set tne sampling rate code for the ISO frame header set tne framing Dit rate code fcr the ISC frame header set the frame size words and bits addr cf sampling rate codes offset to sampling code table test for sampling rate cf zero Sc set register to advance thru table if code is zero, we're tnere ,-posιtιon to seiectea sampling rate code offset MPEG-ISO vs eld CCS values if ISO, rO is all set for ISO values offset to old CCS CDC1CCC values get frame header sampling code save code to match in the frame neaae: get frame header sampling id bit save code to match the frame header get 1 channel frame maximum SUD- oands save max sub-bands for decoding mono get 2 channel frame maximum sub- Dands save max sub-bands for decoding dual test bit rate to set audio data size addr of framing bit rate info test for rate of zero Sc set register to advance thru tacie if code is zero, we're there ,-posιtιon to selected bit rate code bi. ,-set the table offset based on sampling rate move y:smpirte,b ,-get the sample rate code tst b #4,nO ,-test if low sampling rate & set offset to proper sampling rate eq _bιt_smpl_ ,-ιf low rate, addr is set position to seiectea samp±e rate get ISO bit rate code in frame header if ISC, xO is all set with ISO code get old CCS Dit rate code in frame ndr save frame header bit rate code to subtract 1 for mod buffer ctl Delow advance to sampling rate lengths kbit/sec rate frame size in words set # of words in a frame to set decode fra er f med ctl move bl , y : dedf mod set MUSICAM decode fra ebuf med ctl move : f rmsi ze , b get # of words in a frame Isl b double buffer framed i/p buffer sub x0 , b # >NSBUFS , xl subtract 1 for mod buffer control SL set number of frames to check move bl,y: frmemod save mod buffer control - 2 frames add xO , b y:frmsιze,yl re-add 1 to calculate 1/2 frame size and get full frame for below lsr frame size divided by 2 move bl , y: frmhaif save 1/2 frame size (1 full frame :now calculate the framing buffer circular mod control size mpy xl,yl,a #>l,yC ,-times frame size ; and set up 1 to decrement ,-align integer result /shift integer result ,-mιnus 1 for mod buffer cor.ti ,- save framing mod buffer eon: se: _;p to ancillary data to be decoded from a framed and transmit vilas rs232 a set address of clock table, baudelk, based on baud rate (0 thru ~ set table offset by baud rate; '.these are standard CDQ2000 set by macro, BAUDCLK, in box_ctl . asrr.j 0 = 300 baud 1 = 1200 baud 2400 baud 3200 baud 4800 baud 38400 baud 9600 baud 19200 baud set transmit enable get and set the clock for baud rate from the table adjust tc the sampling rate info αet and set the max bvtes for baud rate from the table get data baud rate table address set to access clock at baud rate set transmit enable test for rate of zero Sc set register tc advance thru table if code is zero, we're there ;posιtιon to selected baud rate code Daua cas move y: (rO'i * ,r2 ,-get clock value at baud rate move y:smpirte, nO ,-now get sampling rate offset movep r2,X:<<M_SCCR ,-set the clock for selected baud rate move y: (rO+nO) , nl ,-get max byte count at sampling rate move nl , y:maxbytes ,- store maxbytes fcr scixmt to cheek ;se: ιags fcr sampling rate and type of data received !dbα frmrate, b -164- eq bit lo :dbg SET_HI_BIT_RATE_DCD jmp <_smpl_ bit io SET LO BIT RATE DCD _smpi_ i ! !dbg move y: smpirte,b tst b y: iputcde,b !dbσ jeq < _'YP e _ jeq <_smpl_lo_ ! idbg bset #SAMPLE RATE_LOW_vs_HIGH,v.<ctlflgs SET_K: SAMPLE_RATE_DCD jmp <_type_ ! : dba _smp i_i Loc _ SET_LC_SAMPLE_RATE_DCD _type_ ;test for MUSICAM input data stream selected versus G722 data input stream tst b ,-0 = MUSICAM, else G722 jeq <rate ;if 0, it's MUSICAM, test bit rate g722 boot ,-G722 input selected, signal the encoder XMICRMUS and boot up RMCRG722 from the low portion of chip ,2/7/1994 SET_G722_DATA_DCD bset #MUSICAM_vs_G722,y:<ctlflgs OFF_FRAME_LED_DCD douse the framing led alarm OFF_CRC_ERROR_LED_DCD douse the crc error led alarm OFF_MONO LED_DCD douse the mono led indicator OFF_JOINT_LED_DCD douse the joint stereo led indicate: OFF_STEREO_LED DCD douse the stereo led indicator OFF_LO_BIT_RATE LED_DCD OFF_HI_BIT_RATE~LED_DCD 0N_G722_LED_DCD .ight the G722 front panel led OFF_MUSICAM_LED_DCD OFF_LO_SAMPLE_RATE_LED_DCD OFF_HI_SAMPLE_RATE_LED_DCD SET_LEDS_DCD ,-set the leds as needed INTERRUPT_HOST DCD bclr #ll,x: <M_PBD ;clr boot cOOO for RMCRG722 boot , D__ mp <bootup ;boot in RMCRG722 rate_ ,- i i : dbg SET_MUSICAM_DATA_DCD ; ! ! :dbg ,- setup syntr. variables setup synth variables set to skip left and right set circular outbuf ctl set up to set read and write ptrs set ptrs Now set priorites of the IRQA and SSI peripherals IRQA priority = 0 turned off HOST set to IPL 2 SSI priority = 2 SCI priority = 2 movep #>Sa000, x: <<M_IPR ,-set ir.t priorities and edges movep #>Sa800 ,x: <<M_IPR ,-set t priorities and edges ! : !debug tickle to see it chip booted _loop bset WATCH_DOG bclr WATCH_DOG jmp <_loop ,-waιt for the dust to settle before pushing onward ,-KM move #>RDCDSYNT_STARTUP,a ;KM jsr <waιt andi #$fc,mr ; turn on the interrupt system ,- NOW we are alive with interrupts on! ,- Set the addresses of mbuf and nxtbuf to receive the input data, reframe bclr #M_TIE,x:<<M_SCR ;disable anc data transmit interrupt CLR_DAC_RESET /clear the DAC reset line tc mute cut; ;if G722 data input, go to the RMCRG722 boot-up routine jset #MUSICAM_vs_G722,y:<ctlfIgs, g722_boot ;since it's musicam, keep in this routine and set indicators SET_MUSICAM_DATA_DCD ON_MUSICAM_LED_DCD OFF_G722_LED_DCD ON_FRAME_LED_DCD ,-set the framing led alarm ON_CRC_ERROR_LED_DCD ,-set the crc error led alarm OFF_MONO_LED_DCD ,-set the mono led indicator 0FF_ OINT_LED_DCD ,-set the joint stereo led indicator OFF_STERΞO_LED__DCD ,-set the stereo lea indicator set micro leds and indicators move #f mrate, rO nop -set #0,y: (rO! . _do_hι_ ,-test for frame higher Kbit rate .IT RATE DCD SUBSTITUTE SHEET (RULE 26) BA D OR.G^ L ON_LO_BIT_RATE_LED_DCD OrF_HI_3I _RATE_LED_DCD jmp <_do_coding_ do_hι_ SET_HI_BIT_RATE_DCD ON_HI_BI _RATE_LED_DCD OFF_LO_BIT_RATE_LED_DCD _do_codιng_ jset #SAMPLE_RATE_LOW_vs_HIGH,y:<ctlflgs,_hi_rte ;test hi sample SET_LO_SAMPLE_RATE_DCD ON_LO_SAMPLE_RATE_LED_DCD OFF_HI_SAMPLE_RATE_LED_DCD jmp <_do_plld_ hι_rte_ SET_HI_SAMPLE_RATE_DCD ON_HI_SAMPLE_RATE_LED_DCD OFF_LO_SAMPLE_RATE_LED_DCD _do_plid_ ;check the phase lock loop signal: TST_SET_PHASE_LOCK_DCD,_set_PLL OFF_PHASE_LOCK_LED_DCD ,-turn off phase lock led indicator jmp <_set_alm set_PLL ON_PHASE_LOCK_LED_DCD ,-turn on phase lock led indicator _set_aim ON_ALARM_LED_DCD ,-set alarm led indicator TST_SET_ALARM_RELAY_DCD,_set_led_A /unless already set, SET_ALARM_RELAY_DCD ;set the alarm relay line on _set_led_A SET_LEDS_DCD ,-set the leds as needed INTERRUPT_HOST_DCD ;mute the audio output until we are framed jsr <muteout ,-mute the dac output buffer ;controls to force a reboot if an inordinate number of framing errors move y-.frtrιes,a get frame tries move #>MAX_TRIES,x0 get number of tries tolerance move #>3,x0 get number of tries tolerance emp x0,a #>l,y0 make test t ~ set up to mcr count kill watch dog, if reached tolerance jit c_dsb_dbg_ _f manual auto selection, do not force a reboot move #autosel,r0 nop clr #o , x: (rO) ,_manual_restart ,-manual select, dc not reboot ^BAO O IGIN ' ) nop nop nop nop nop jmp ,-kili watch dog jmp • ■ -restart ;kili watch dog _manual_restart ,-if in manual mode, zero the failure counter ,- m manual mode start over ,- increment count of frames ,- & get address of sync buffer ;update count of framing tries ,-and frame the data itest for successful framing, if not, restart tst a r3 ,y: IPbitoff ;test if framed (a = 0 if framed) ,- 5. save the bit offset ,-NO, we must restart _ok_ :since we have MUSICAM frames, set the flag for auto select switches bset #MUSICAM_INPUT_SET,y:<ctlflgs indicate to encoder that the decoder is framed and to use pins for: MUSICAM vs G722 LOW vs HIGH sampling rate (otherwise, if auto selected and pin 14 is still low, encoder operates at MUSICAM at the LOW sampling rate) SET_DECODER_FRAMED_DCD initialize the polysynthesis arrays for the 1st frame jsr <polysini the a reg is returned as 0 to go on :lear the successive CRC-16 bit error sensed counter if exceeded according to the chkcrc routine, automatically reframe SUBSTITUTE SHEET (RULE 26 move a,y:Diterrs zero the bit error counter move a,y.oof zero out-of-fra e faults counter move a,y:voof zero sample rate code faults counter move a,y:poof zero CRC protection code faults counter move a,y:doof 0 ancil data errors/cid CCS CRC-16 cntr move rS ,y: IPwrdoff save i/p buufer word offset bclr #FIRST_TIME,y:<ctlflgs clear the indicator bclr #FRAME_SAVED,y:<ctiflgs clear the indicator bclr #USE_SAVED,y:<ctlfigs clear the indicator bclr #SAVE_FRAME,y:<ctifigs clear the indicator bclr #USING_SAVED,y:<ctlflgs clear the indicator bclr #REFRAME,y:<ctlflgs clear the indicator OFF_FRAME_LED__DCD ,-douse decoder framed alarm led SET_LEDS_DCD ,-set the leds as needed INTERRUPT HOST DCD :fcr ancillary data decoding purposes, determine the end of the coded frame jsr <framend :initialize the ancillary data controls for decoding and transmission cir a #databytes, rO zero the decoded byte counter ~ get addr of the data byte buffer move a,y:bytecnt bytes decoded counter set tc zero move rO,y:dataιptr address for next byte decoded move rO,y:dataoptr addr for next byte to out RS232 do #DATABUFLEN,_cir_data move a,y: (r0)+ • zero the ancillary data buffer _data bset #M_TIE,x:<<M_SCR iset the data transmit interrupt ,- Let the show begin. :op / get the external switches to determine if any changes that signal a restart GET_SWITCHES_DCD gsws_20 jsr <getsws j set #4,y:enot_appl, restart j clr #4 ,y: < not_appl,_ok_2_ nop nop nop nop jmp •-restart ok 2 check the phase lock loop signal: TST_SET_PHASE_LOCK_DCD,_set_ph if no t set, clear the phase lock loop led and light the alarm led CLR DAC RESET ,-clear the DAC reset line to mute SUBSTITUTE SHEET (RULE 26> £AD ORIQI NAL OFF_PHA≤Ξ_LOCK LED_DCD ; t urn or f phase lock l ea mdi cat o: ON_ALARM_LED_DCD , ng < ■ al arm condi t i on led ai cat TST_SET_ALARM_RELAY_DCD , _set_led_B SET_ALARM_RELAY_DCD j mp <_set_led_B _set_pr else, light the phase lock loop led and if there is no CRC bit error, clear the alarm led ON_PHASE_LOCK_LED_DCD ; light phase lock loop led indicator TST_SET_CRC_ERROR_DCD,_set_alm_A ,-ιf crc error set, turn alarm led on CFF_ALARM_LED_DCD ;turn off alarm led indicator TST_CLR_ALARM_RELAY_DCD,_set_led_B CLR_Ai_ARM_RELAY_DCD j mp <_set_led_B se t_alm_A ON ALARM LED DCD : light alarm condition led mdicato: TST_SET_ALARM_RELAY_DCD,_set_led_B SET ALARM RELAY DCD ;clear decoder overload alarm led ,-set the leds as needed ;tickle the dog Now wait until we have 1 word in the input buffer The varibie waitform contains the address of one word after the sync word. This is the word to wait for in the interrupt routine to signal the start of a new frame. set up mO as a mod buffer of one frame get buffer length word offset for frame start get 1/2 buffer length: frame length times 2 set framing buf length for addr compare increment to next input frame save new offset word to start cf frame increment 1 word set as address to wait for restore rC tc linear addressing get half the framing buffer size Here we check if we have received enough data to proceed This is done by checking by subtracting the ;tickle the dog y: einuwot- ,-σet curr read frames SUBSTITUTE SHEET (RULE 26) A xC , a sub aadr to wait for ge <_rdec_20 check fcr zero addr wrap around add yO , a bump result by framing buffer leng: rdec 2C emp xl , a : see past a half a buffer τlt < rdec 15 not yet at the half-way, loop ! !DGCST ,-ιf required for even frame sizes when auto select sampling rate, ; make sure no rate switch fooled the decoder VERIFY_AUTO_SAMPLE ,-as needed by box_ctl.asm ! :DGCST take the next frame to decode and word align it for reed solomon decodinc move y: IPwrdoff , rC get the word offset for the next fame to decode move #syncbuf,nO base address cf the i/p frame buffer move y: frmemod, C doubled buffer i/p move #reedsolbuf, rl addr for Reed Solomon i/p buffer move #framebuf,r2 addr for MUSICAM decode frame i/p buffer move (rO) +n0 get to start addr of current i/p frame move y:frmsize,nO number of words in a frame move y:IPbιtoff,b bit offset to sync pattern in 1st word :for the length of a full frame, get the words in pairs and shift tc word boundary do r.C ,_reed_shift move x: (rO)+,al ; 1st word of the curr pair to shift :if words already are aligned, simply copy the word to the Reed Solomon buffer tst b x: (rO) ,a0 ,-see if a shift is needed, ; ~ get 2nd word of curr pair to shift jeq <_no_shift ,-if no offset, no shift needed ;for the number of offset bits, shift the pair cf words to abut properly aiigne: rep b asl a _no_shιft ,-copy aligned word in Reed Solomon buffer for decoding ,- ! ! :dbg move al,x: (rl ) * move al,x: (r2 ' + /also copy to MUSICAM frame Duffer _reed_shift ;decode the Reed Solomon frame back to a MUSICAM frame move y: <linear,mO restore rO to linear addressing move #reedsolbuf, r6 Reed Solomon frame buffer: ι/ρ move #framebuf,rl frame buffer decoded: o/p move #PRCFi,r3 Reed Solomon profile: control decode SUBSTITUTE SHEET (RULE 26) BAD 0WG1N . -PI- sr <rsdecl6 ;oo Reed Solomon decode Now setup the buffer reading routines move y:dcdfrmod,m6 decoded Reed Sol frame buf od c t l move #framebuf,n6 decoded Reed Solomon frame Duffer addr move y:wrdoff, r6 bit offset from msb move y:bιtoff,a bit offset from msb bclr #USE_SAVED,y:<ctlfIgs ;clear used saved frame flag bclr #USING_SAVED,y:<ctlflgs ;clear using saved frame flag OFF_CRC_ERROR_LED_DCD ;turn cff the crc error led mdicato: TST_SET_PHASE_LOCK_DCD,_clr_aim_A ;if not phase loop locked, then CLR_DAC_RESET clear the DAC reset line to mute outpu: ON_ALARM_LED_DCD light alarm led mdictor TST_SET_ALARM_RELAY_DCD,_set_led C SET_ALARM_RELAY_DCD turn the alarm relay on jmp <_set_led_C _clr_aim_A :release the digital to analog converter for output SET_DAC_RESET ;set the DAC reset line high now OFF_ALARM_LED_DCD ;turn off alarm led indicator TST_CLR_ALARM_RELAY_DCD,_set_led_C LR_ALARM_RELAY_DCD ;turn the alarm relay off _set_led_C SET_LEDS_DCD ,-set the leds as needed INTERRU?T_HOST_DCD bclr #SAVE_FRAME,y: <ctlflgs ,-clr ind for getvalue to save frame was Now we are ready to decode the current frame using: n6 = buffer address r6 = word offset into the buffer for start of the frame a = bit offset into the word offset into the buffer for start of the frame m6 = mod buffer control through the buffer this will be either normal input for 3 * frame size -1 (leaves space for saved buffer' single frame size -1 for using the saved frame if a checksum error _rdec_3C ,-tickle the dog ,-tickle the dog TOGGLE_WATCH_DOG_DCD jsr <bιtsallo :prepare to suppress ancillary data if any out of frame condition bclr #N0_SYNC,y: <ctiflgs ,-clear the indicator , Now get the sync pattern. If the pattern matches a good syn;, tnen SUBSTITUTE SHEET (RULE 26) II BAD -17:- the ocf counter is decremented. If it doesn't match, tne ocf pa tt ern is incremented. If it is incremented past an upper limit, an cu t cf frame condition is declared and the system goes into frammα. On the other hand, the oof counter is never allowed to go negative ,-get the sync bits ,-move right justified value ,-get current # of ocf'ε ;if using the saved frame, do not recount sync problems jset #USE_SAVED,y:<ctlflgs,_rdec_50 move #>SYNC,a ,-get sync pattern for test emp y0,a #>GOOD_DECREMENT,xl ;do we have a valid sync ; & set good sync decrement value jeq <_rdec_40 : We are here because the sync did not match. Increment the numoer cf bad syncs found. bset #N0_SYNC,y:<ctiflgs ,-set indicator to skip ancillary data move #>BAD_INCREMENT,xl /set the bad match increment value add xi,b #>BAD_LIMIT,x0 /increment the number of oof's / Sc set limit value to restart emp xO,b ,-see if at the limit jit <_rdec_50 ,-we are not, so keep going nop nop nop nop nop ;we've sensed too many sync pattern failures in succession TOO_MANY_SYNC_ERRORS_DCD :rmιcrmus jmp <restart ,-at error limit sc reframe : We are here because a valid sync was found. : Decrement the number of bad syncs found. _rdec_40 sub xl.b ,-decrement the number of oof's tst b #0,xl ,-see if at the limit tit xl,b _rdec_50 move b,y:oof ;save the current oof counter ,-get the sytem header info j sr < getsyst ,-get system header info see if the frame header sample rate code matches determined sampling rate If the sample rate codes match a good sync, tnen the voof counter is decremented. If tne codes don't match, the voof counter is incrementeo SUBSTITUTE SHEET (RULE 26) &$> & AM- -1"3- If tne vocf counter is incremented past an upper limit, we nave t c do tne auto selection again since pernaps tne sampling rate has cr . ar.αe: move y:svesmpl,a get code from frame header move y:smplcde,xO get code determined by framing move y.voof.b get current # of voof's emp xO,a #>GOOD_DECREMENT xl ; is a valid sample rate code Sc set good code decrement value ne «_ck_smpl_05 if we don't that's bad :now check tne frame header ID that matches the sample rate ,-get ID from frame header ,-get ID determiend by framing ,-see if a match ,-ιf we do that's good We are here oecause there was no match of tne sample rate codes Increment tne number of unmatches found. move #>BAD_INCREMENT,xl set the bad match increment value add xl,b #>BAD_LIMIT,xO increment tne number of voof's 4 set limit value tc restart emp xO,b see if at the limit <_ck_smpl_20 we are not, so keep going !dbg nop nop nop nop nop !aDg j p •.restart at error limit so restart We are nere because a valid sample rate was found in tne frame header Decrement tne number of unmatched sample rate codes _ck_smpi_10 sub xl,b decrement tne number of voof's tst b #0,xl see if at the limit tit xl.b if less than zero, set to zero _ck_smpl_20 move b,y:voof :save the current voof counter see if the frame header CRC protection code matcnes determined protectier If tne codes match, then the pocf counter is decremented. If the codes don't match, the pocf counter is incremented. If tne poof counter is incremented past an upper limit, we have tc do the auto selection again since perhaps the CRC protection has change. move y:poof,b ,-get current # of poof's move #>GOOD DECREMENT,xl ,-set good match decrement value verify the CRC PROTECT setting versus auto sampling: if the frame header shows CRC protection, veπfv auto sample also indicates proteeti: SUBSTITUTE SHEET (RULE 26 ΘAD OHIϋlNAL jset #PRCTECT,y: <ctiflgs,_ck_prot_00 ,-ιf protect, check auto frame shows no protection, if auto sampling also found no protection, go to decrement the poof counter otherwise, force protection and assume a bit error and increment the pocf counter jset #0, y: <protect ,_ck_prot_10 ; ιf match, decrement poof bset #PR0TECT,y:<ctlflgs ,-set the CRC applies bit jmp <_ck_prot_05 ,-go to increment poof for the bad match _ck_prot_00 frame shows protection, if auto sampling also found protection, continue otherwise, force nc protection and assume a bit error and increment the pocf counter clr #0 , y: <protect,_ck_prot_10 ,-ιf match, decrement D oof bclr #PRCTECT,y: <ctlflgs ,-clear the CRC applies bit _ck_prct_05 ,- We are here because there was no match of the CRC protection codes. ,- Increment the number of unmatches found. move #>BAD_INCREMENT, xl ,-set the bad match increment value add xl,b #>BAD_LIMIT,xO ,- increment the number of poof's ; 5_ set limit value to restart emp xO , b ;see if at the limit jit <_ck_prot_20 ,-we are not, so keep going ,- ! : !dog nop nop ncp nop nop ,- : : !dbg jmp <restart ;at error limit so restart ; We are here because a valid CRC protection code was found in the frame neader. ,- Decrement the number of unmatched CRC protection codes. _ck_prot_10 sub xl,b ,-decrement the number of poof's tst b #0,xl ,-see if at the limit tit xl,b ;if less than zero, set to zero _ck_prot_20 move b,y:poof ,-save the current pocf counter if there is CRC-16 protection on the frame: set the CRC-16 checksum bit count for the old ISO method: a. header bits covered by any type of frame plus bits for the left channel also apply to any type cf frame b. set bits for possible right channel based on frame type c. if not MONO, add bits for right channel a. save eld ISO bit count for this frame -175- clr #PROTECT,y:«:ctIflgs,_rdec_60 ,-if no checksum, ge: a_.oca:ions move #>CRC_BITS_A+CRC_BITS_B,a move #>CRC~BITS_B,xO ,-bit count for right channels jset #STEREO_vs_MONO,y:<ctlflgs,_rdec_52 add xO, a ,-since its stereo, add for right channel rdec 52 move a,x:crcold ,-set the old ISO CRC-16 bit count bset WATCH_DOG ;tickle the dog bclr WATCH_DOG ;tickle the dog jsr <getcrc ,-get checksum from frame rdec 60 move #SBIndx,rθ ,-address of sub-band mdicies jsr <getbal ,-get bit allocations move #SBιts,rO ,-address of SB bits array move #SBIndx,rl ,-address of sub-band mdicies jsr <getsbιts ,-get the sb bits move #SBndSKF,rO address of the SB scale factors move #SBιts,rl address of SB bits array move #SBIndx,r2 address of sub-band mdicies jsr <getskf get scale factors jclr #PROTECT,y:<ctlflgs,_rdec_70 ,-ιf no checksum, get data pts : ! !dbg jmp < rdec 70 : ! !dbg bset WATCH DOG ,-tickle the dog set #USE_SAVED,y:<ctl igs,_rdec_70 ,-do not recheck saved frame jsr <chkcrc ,-check the validity of frame set #REFRAME,y: <ctlflgs, reframe ; if too many bit errors, reframe jclr #REFRAME,y: <ctlflgs,_dbg_dsb_ ,-ιf too many bit errors, reframe nop nop nop nop nop TOO MANY BIT ERRORS DCD dbg dsb clr #USE SAVED,y:<ctIflgs ,_rdec_65 ,-ιf valid, continue with frame clr #USING_SAVED,y: <ctiflgs,_rdec_65 ;if saved valid, continue ON_CRC_ERROR_LED_DCD ; light crc error alarm led ON_ALARM_LED_DCD ;light alarm led indicator TST_SET ALARM_RELAY_DCD,_set_led_D SET ALARM RELAY DCD ;turn the alarm relay on set_Ied_D SET_LEDS_DCD ,-set the leds as needed INTERRUPT HOST DCD ' C12 #FRAME_SAVED, y: <ctlflgs,_rdec_80 ,-else failed, if r.c saved fra-e SUBSTITUTE SHEET (RULE 26) owe» NΛL -I?6- output zeroes ana try again clear since we used tne saved frame else, set up last saved frame word offset was saved bit offset was saved ;go bacK and dc last frame again rae 65 OFF_CRC_ERROR_LED_DCD ; turn off the crc error alarm led bclr WATCH DOG ,-tickle the dog rdec 7C ,-now, light the proper led for the type cf framing: full stereo, joint stereo, dual channel or mono jset #STEREO_vs_MONO,y: <ctiflgs,_rdec_53 ,-if mono jset #JOINT_FRAMING,y: <ctIflgs,_rdec_51 ;i_ OFF_MONO_LED_DCD turn off the mono led indicator OFF_JOINT_LED_DCD turn off the joint stereo led mdicato: ON_STEREO_LED_DCD light the stereo led indicator mp <_rdec_55 rdec 5: 0FF_MONC_LED DCD turn off the mono led indicator OFF_STEREO_LED_DCD turn off the stereo led indicator ON_JOINT_LED_DCD light the joint stereo led indicator jmp <_rdec_55 rdec 53 OFF_STEREO_LED_DCD turn off the stereo led indicator OFF_JCINT_LED DCD turn off the joint sterec led mdicato: ON MONO LED DCD light the mono led indicator rdec 55 SET_LEDS_DCD ,-set the leds as needed INTERRUPT HOST DCD ;test if the fade controls are applicable TST_CLR_FADE_OUTPUT_DCD, fade 5 if fade not requested, continue move y:fadecnt,b get fade frame counter tst b #>l,x0 test if ready tc fade (fadecnt=0) Sc set to decrement frame count jne <__fade_3 not ready yet, go decrement move y:fade,a get current fade value move #>FADE_SOFTEST,y0 get maximum fade down range TST_SET FADE_DOWN_DCD,_fade_l increment to soften output tst a #>FADE START UP, xl ;test if at loudest fade up & get test for max start fade value if at loudest, continue xO ;test if above max start fade S. get scale factor increment if needed, set start fade up adjust louder for this frame ~ set frame count to next decrement SUBSTITUTE SHEET (RULE 26) \ BAD OWGWAL -r p f ade 2 ,- store new f ade SKF adj ust va lue fade emp y0,a #>FADE INCREMENT,xO j eq <_fade_5 if at softest, continue add xO,a #>FADE FRAMES,b adjust softer for this frame & set frame count to next decrement fade 2 move a,y: fade ;save the new fade SKF adjust value jmp c fade 4 fade 3 ΞUD xO,b :decrement frame counter fade 4 move b,y: fadecr.t :save the new fade frame counter _faae_5 ■ if 1st frame align the ptrs fcr the polysynthes align the read & write ptrs set ptrs indicate ptrs have Deen aligned ,-sb mdicies ,-get the scale factors ,-set A share mem of rec samples ,-get the sub-Dand data <getancdata ,-process ancillary data maintain tne frame counter of successive frames with the old CCS CRC-16 checksum coupled with ancillary data decoding problems If the no error was detected, then the doof counter is aecrementea If there was an error, the doof pattern is incremented. If it is incremented past an upper limit, an out of frame condition is declared and tne system may go into reframing swapping tne old CCS decoding for MPEG-ISO decoding or vice versa. Tne doer counter is never allowed to go negative. move y:doof,b ,-get current # cf doof's A saved frame is not included in maintaining the doof's counter jset #USE_SAVED,y:cctlflgs,_rdec_150 :check if a problem with old CCS CRC-16 algorithm coupled with a problem with ancillary data. move #oldccs,rl addr to test ancillary data proble- move #>GOOD_DECREMENT,x1 to decrement error frame counter clr #2,y: (rl ,_rdee_140 if no ancillary data error, decremer We are here because there was an ancillary data problem/old CCS CRC-16 Increment tne number of bad frames found. SUBSTITUTE SHΞΞT .RULE 26) BAD ORIGINAL 96/32805 -1"8- move #>BAD_INCREMENT,xl to increment the number cf doof add xl,b #>BAD_LIMIT,xC increment the number of doof's Sc set limit value tc restart emp xO,b see if at the limit 1 - - < rdec 150 we are not, so keep going idbg nop nop nop nop nop ,- ' : :dbg : eframe if too many ancillary data problems in succession TOC_MANY_DATA_ERRORS_DCD mp c_rdec_150 ~ : We are nere because the ancillary data decoded ok ,- Decrement tne numoer of ancillary data problem frames found ub xl,b decrement the number of doof's tst b #0,xl see if at the limit tit xl,b if less than zero, set to zero _rdec_150 move b,y:doof :save the current doof counter clr #PROTECT,y:<ctlflgs,_rdec_72 ,-ιf no checksum, no reason to save -elr #USE SAVED,y:<ctiflgs, rdec_72 ,-dιd not use a saved frame :do net reuse a saved frame bclr #FRAME_SAVED,y: <_ctiflgs ;clear we have a saved frame fia: jmp <top _rdec_72 since we had a good new frame, cnecK controls for long solid operation restart the counter of frames with bit error and adjust count of framing retries, tnat control reset needed #>l,y0 zero bit successive bit error counter Sc tc decrement counter every frame get framing try counter decrement counter every frame Si zero bit error counter see if counter reached zero if not, continue zero framing tries ,-save the reduced framing tries ct_ ,-do next frame rdec 8C 0FF_M0NC_LED_DCD :turn eff the none _ea indicator CFF JOINT LED DCD turn eff tne jem: sterec lea i: OFF_STEREO_LΞD_DCD /turn off the stereo led indicator SET_LEDS_DCD ,-set the leds as needed INTERRUPT_HOST_DCD ,-mute the current frame sr <muteout ,-mute the output buffer jmp <top end start BAD O R IG INAL opt fc ( c ) 1991. Copyright Corporate Computer Systems, Inc. All rights reserved. title 'Get SB bits' This routine is used to get the SB bits of each of the sub-bands. on entry rO = address of the bit SB array rl = address of the SubBandlndex array r6 = current offset m the input array n6 = base address of the input array y:<maxsubs = MAXSUBBANDS at sampling rate and bit rate y:sc = shift count of current input word x:crcbιts = accumulator of bits covered by CRC-16 routine (bit coded for SBits are accumulated) org phe : initialize: a. number of frame bits for a sub-band SBits index value b. nO offset for right channel sub-band SBits values: left channel from 0 to (NUMSUBBANDS - 1) right channel from NUMSUBBANDS to ( (2 * NUMSUBBANDS) - 1) c. nl offset for right channel sub-band bit allocation values: left channel from 0 to (NUMSUBBANDS - 1) right channel from NUMSUBBANDS to ( (2 * NUMSUBBANDS) - 1) set number of bits to get SBits offset-right channel bit alloc offset-right channel get CRC-16 bit counter to accumulate CRC-16 bits loop through the sub-bands extracting the left and right (if applicable) SBit values values (y:<maxsubs = fixed count of sub-bands framed) : process the right channel: a. for current sub-band get the left channel allocation index value 96/32805 -181- b. if the left channel index is zero, go to insert a zero SBits value c. otherwise, extract tne SBits value fcr left channel of current sub- D and and go to insert value into the SBits array /get left index for subband ,-test index for not coded (0) /use value of zero if not /get a sb value ,-mask for sbits from getvalue ,-mask off hi order one's ,- Sc accum bits for CRC-16 rtn jmp _gets_20 ; go to store SBits value insert 0 for tne left channel SBits value for this sub-band gets_10 cir ,-no index use zero move the left channel SBits value to the SBits array gets_20 move al,x: (rO) process the right channel . a. for current sub-band get the right channel allocation index value b. if the right channel index is zero, go to insert a zero SBits value c. otherwise, extract the SBits value for right channel of current sub-band and go to insert value into the SBits array get right index for subband test index for not coded (0 use value of zero if not get a sb value mask for sbits from getvalue mask off hi order one's S accum bits for CRC-16 rtn mp _gets_40 ,-go to store SBits value insert 0 for the right channel SBits value for this sub-band gets_30 cir ,-no index use zero move the right channel SBits value to the SBits array increment SBits array and bit allocation index arrays for next sub-band _gets_40 move al,x: (rO+nO) move (r0) + move (rl) + _gets_90 move r5,x:crcbιts / store updated CRC-16 bit counter rts SUBSTITUTE SHEET (RULE 26) -182- opt fc,mex (c 1991. Copyright Corporate Computer Systems, Inc. All rights reserved. \URDCDSYN\getskf .asm: Ben's mux title 'Get Scale Factors' This routine is used to get the scale factors of each of the sub-bands. on entry rO = address of the bit scale factor array (x memory) rl = address of the bit SB array ιx memory) r2 = address of the bit SubBandlndex array (x memory) r6 = current offset in the input array n6 = base address of the input array y<maxsubs = MAXSUBBANDS at sampling rate and bit rate y:sc = shift count of current input word on exit r6 = updated y:sc = updated a = destroyed b = destroyed xO = destroyed xl = destroyed yO = destroyed yl = destroyed rO = destroyed r4 = destroyed n4 = destroyed include 'def.asm' include 'box ctl.asm' org phe : getskf ,- initialize : ,- number of frame bits for a sub-band scale factor index value move #SKF,n4 ,-set number of bits to get move #0,n0 ,-scale facts offset-left cnan test tne scale factors for certain tolerances a. zero scale factor is equivalent to a bit error, indicate NO zero scale factor b. clear the channel overload led indicators bclr #SKF_ZERO,y:<ctlflgs OFF_LEFT_OVER_LED_DCD OFF RIGHT OVER LED DCD loop through the sub-bands extracting the left and right (if applicable) scale factor index values (y:<maxsubs = fixed count of sub-Dands framed ) within tne sub-band loop is a loop for both channels left then right process the rhannel : nO offset for left channel sub-band scale factor index values left channel from 0 to (NUMSUBBANDS*NPERGROUF - 1! right channel from NUMSUBBANDS*NPERGROUP to ( ( 2 * NUMSUBBANDS*NPERGROUP ) - : nl offset for left channel sub-band SBits values: left channel from 0 to (NUMSUBBANDS - l) right channel from NUMSUBBANDS to ( (2 * NUMSUBBANDS) - 1' n2 offset for left channel sub-band bit allocation vaiues: left channel from 0 to (NUMSUBBANDS - 1) right channel from NUMSUBBANDS to i (2 * NUMSUBBANDS. - 1' do y: <maxsubs,_gets_90 move #0,nl SBits offset-left channel move #0,n2 bit alloc offset-left channel bclr #LEFT_vs_RIGHT,y:<ctiflgs left is current channel process a channel for the current sub-band: 1st left then right a. upaate the register pointer with the offset into the scale factor index array for the left or right channel b. get the bit allocation for the proper channel to see if any factors at ai_ do #NUMCHANNELS,_getS_80 move (rO) +n0 /offset for proper channel move x: (r2+n2) , a ,-get the SubBandlndex [SubBand] first check if sub-band contains anything to work on. This value could be zero if there is no energy in the sub-band. tst a x: (rl+nl) ,-see if any alloted bits jne _gets_05 /there were no bits were allocated, so set the scale factors to 63. I could ust set the scale factors to anything for this case, but I set them to the lowest lacutllly, 63 is one lower than the lowest) scale factor. move #>63,al :get lowest scale factor value move al,x: (rO) + move al,x: (rO) + move al , x: (rO) + mp _gets_40 _gets_05 tst a #>l,x0 ,-SB == 0 for this sub-band ,- set xO tc sbit code '01' jne _gets_10 sbit code 00 case where must get ail 3 scale factors ,-mask for scale factor hi ord ,-mask off high order one's ,-save in SubBandSKFs [SubBand] .2. _gets_a jmp _gets_40 σets SUBSTITUTE SHEET (RULE 26) RIGINAL 96/32805 -184- emp xC , a #>3,x0 :SB == 1 fcr this sub-oand jne sbit code '01' case where must get the second two scale factors ,-get SubBandSKFs [SubBand] [1] /mask for scaie factor hi or ,-mask off high order one's ;save in SubBandSKFs [SubBand .03 ;save in SubBandSKFs [SubBand ,-get SubBandSKFs [SubBand] [2] ;mask for scale factor r.i ord :mask off high order one's ;save in SubBandSKFs [SubBand] [2] _gets_2C emp x0,a #>2,x0 ,-SB == 3 for this sub-band ,- set xO to sbit code '10' jne _gets_30 ,- sbit code ' 11' case where must get the first two scale factors sr getvalue ,-get SubBandSKFs [SubBand] [0] move #>MASKSKF,xl ,-mask for scale factor hi ord and xl, a ,-mask off high order one's move al,x: (rO ) + ,-save in SubBandSKFs [SubBand] [C] jsr getvalue ,-get SubBandSKFs [SubBand] [1] move #>MASKSKF,xl ,-mask for scaie factor hi ord and xl.a ,-mask off high order one's move al,x: (rO) + ;save in SubBandSKFs [SubBand] [1] move al,x: (rO) + ,-save in SubBandSKFs [SubBand] [2] jmp _gets_40 _gets_30 ,-SB == 2 for this suD-band sbit code '10' case where must get the first factor sr getvalue get SubBandSKFs [SubBand] [0] move #>MASKSKF,xl mask for scaie factor r.i ord and xl, a mask off high order one's move al ,x: (rO) + save in SubBandSKFs [SubBand] [C move al ,x: (rO ι + save in SubBandSKFs [SubBand] [l move al ,x: (rO ι + save in SubBandSKFs [SubBand] [_. set up for the right channel : backup the SKFs array for the left channel 3 scale factors indices nO offset for right channel sub-band scale factor index values: left channel from 0 to (NUMSUBBANDS*NPERGROUP - 1 ) right channel from NUMSUBBANDS*NPERGROUP to ( (2 * NUMSUBBANDS*NPERGROUP) - 1 . r. offset for right channel sub-band SBits values: left channel from 0 to (NUMSUBBANDS - l. right c h annel from NUMSUBBANDS to ( (2 * NUMSUBBANDS - 1 SUBSTITUTE SHEET (RULE 26) ^ BAD OWGWM. d. r_2 offset for right channel sub-band bit allocation values: left channel from 0 to (NUMSUBBANDS - 1. right channel from NUMSUBBANDS to ( (2 * NUMSUBBANDS' - l) _gets_40 back up for the 3 scale factors and while doing it test for: a. zero scale factor b. overload scale factor move y: fade,yl ,-get current fade value do #NPERGROUP,_gets_40_e move x: - (rO) ,a add yl, a #>63,y0 /apply scale factor fade ; Si set maximum scale factor tst a #>OVERLOAD_SKF,xO jne _gets_40_a bset #SKF_ZER0, y: <ctlflgs ,1/4/94 do not set bit error move y0,a ,-1/4/94 set scale factor to 63 jmp _gets_40_d test for an overload, and if so, set channel led _gets_40_a emp x0,a jge _gets_40_c /NO overload, test for max ;overload sensed, set which channel led jset #LEFT_vs_RIGHT,y:<ctlflgs,_gets_40_b ON LEFT OVER LED DCD ; ! ! :dbg ,-test for max SKF test if greater 63 if less or eq, use current if so, set to 63 ;restore scale factor O 96/32805 -186- gets_ _4C_e oset #LEFT_vs_RIGHT, y: <ctlflgs indicate current cnannei move #NUMSUBBANDS*NPERGROUP, nO scale facts offset-right chan move #NUMSUBBANDS,nl SBits offset-right channel move #NUMSUBBANDS,n2 bit alloc offset-right channe] after processing the right channel, set up for the left channel of the next su -band: a. reincrement rO for scale factor array by 3 for the inserted 3 factors b. to reposition the scale factor index array from right back to left channel we put the negative offset in nO c increment the SBits value array for the next sub-band d. increment the bit allocation index array for the next sub-band _gets_8C move #3,n0 move irl > * move (r2) + move (rO' +n0 move #-NUMSUBBANDS*NPERGROUP,nC ;scale facts offset-right cnan _gets_9C SET LEDS DCD ,-show overload conditions rts 'BAD ORIGINAL opt fcmex (c! 1991. Copyright Corporate Computer Systems, Inc. All rights reserved. \URDCDSYN\getsws.asm title 'Get decoder external switch settings' This routine is used to interpret the external switches on the box x: tstrate = raw bit rate input from the switches x.tstsell = raw application of line 1 select switch x:tstsei2 = raw application of line 2 select switch x:tstfrmt = frame communication formatting x:tstreed = Reed/Solomon encoding switch x:tstbaud = raw ancillary data baud rate input from the switches y<not_appi = bit 4 set if any switches changed destroyed: register a include def .asm' include 'box ctl.asm' section highmisc xdef selectl ,-current setting of line 1 select switch xdef select2 /current setting of line 2 select switch xdef tstrate, tstsell, tstsel2, tstfrmt , tstreed, tstbaud, tstmeth current setting cf line 1 select switch current setting of line 2 select switch raw bit rate out from the switches raw application of line j. seiect switch raw application of line 1 seiect switch raw frame comm ucation formatting Reed/Solomon encoding switch raw ancil data baud rate input from switches raw code for diagnostic vs normal operation erg phe : αetsws bclr #4,y:<not appl ; indicate no changes initially ^00W< NW - move a, x: tstmeth /check the dip switches to determine frame bit rate and ancillary data application and data baud rate ;switches for framing bit rate GET_BI _RATE_DCD / switches for framing type code and mono output GET_FRAME_TYPE_DCD /switches to set if selecting line l and/or line 2 GET_SELECTED_LINES_DCD / switches fcr ancillary data baud rate GET_BAUD_RATE_DCD ,-switches for method of operation, normal audio or diagnostics GET DIAGNOSTICS DCD ,- look for a change in framing rate ,-set up to test line 1 selection ,-set up to test line 2 selection ,-set up to test framing format ,-set up to test Reed/Solomon switch ,-set up to test ancillary data baud get the diag nostic code see if other than normal operation normal operation, continue ,- indicate changes m external switches rts \ BA0 0 IG1 NAL SUBSTITUTE SHEET (RULE 26. opt fc,mex (c) 1991. Copyright Corporate Computer Systems, Inc. All rights reserved. \URDCDSYN\getsync.asm: Ben's mux title 'Get Sync' This routine gets the sync word. al = right justified sync value padded on right with zeros r6 = updated y:sc = updated a2 = destroyed al = destroyed b = destroyed xO = destroyed xl = destroyed yO = destroyed yl = destroyed r4 = destroyed n4 = destroyed ,-number of bits ,-get sync right justified ,-mask for sync word hi order ,-mask off any high order l's rts -190- opt (c) 1991. Copyright Corporate Computer Systems, Inc. All rights reserved. \URDCDSYN\getsystd.asm: set led for MPEG-ISO vs old CDQ2000/CDQ1000 title 'Get Syst' This routine decodes the MUSICAM frame header information. l=hιgh sample rate, 0=low sample rate (PROTECT bit: 0-YES for checksum, 1=N0 1 (STERE0_vs_MON0 bit: 0-stereo, l=mono) (JOINT_FRAMING bit: 0-not, l=jcιnt) (SPLIT_MONO_FRAME bit: 0=no, l=yes> bit rate code sampling rate code actual frame length in bits 0=frame not padded, l=frame padded w 8 added bits privacy bit value in frame header stereo, joint stereo, dual mono or mono joint stereo intensity boundary subband count number of sub-bands encoded in BAL's copyright bit value in frame header original/home bit value m frame header emphasis value in frame header address of the Allowed table to use address of the BAL's bit table to use by getvalue call org phe : getsyst decode the bits 0 thru 3 of the frame heade: bit description : high or low sampling rate: I = high rates 48, 44.1 and 32 K sampling rates 0 = low rates 24, 22.05 and 16 K sampling rates 1-2 MUSICAM Layer: II = Layer I 10 = Layer II 01 = Layer III 3 CRC-16 checksum frame header protection: SUBSTITUTE SHEET (R'/LE 2S> BAD OTOGNW- 0 = cnec sum protection encoded after frame header 1 = NO checksum protection move #NSYSTHDR_1,n4 ,-get field #1 (bits 0-3 in hdr 1 bit 0 indicates protection cnecκsuιτ 0 = yes checksum included 1 = no checksum included jsr getvalue get data right justified move #>MASKSYSTHDR_1,Xl mask for getvalue of header field l and xl,a #NBITRATE,n4 mask off high order bits & set len of bit rate-bits 4-7 m hdr bset #PROTECT,y:<ctlflgs default that CRC protection applies move al,y:<not__appl see if CRC bit set indicating not appl clr #0,y:<not_appI,_gsyst_00 ,-hdr shows zero, CRC is included bclr #PROTECT,y:<ctlflgs ,-set that CRC protection NOT applicable _gsyst_C0 ,- set tne high or low sampling rate ID code bset #0 ,x:fndidbit ;default with high sample rate bit on jset #3,y:<not_appl,_gsyst_01 ;ιf set for high, continue bclr #0 ,x:fndidbit ;reset to low sample rate bit on _gsyst_01 ;decode the bits 4 thru 7 of the frame header: bit rate jsr getvalue get bit rate code right justified move #>MASKNBITRATE,xl mask for getvalue of frame bit rate and xl,a y:spltrte,xl mask off high order bits Sc get the 1/2 bit rate code move al,x:fndbit save header bit rate code :test fcr CDC2000 split mode of transmission and checK for a split mono frame bclr #SPLIT_MONO_FRAME,y:<ctlflgs ;clear indication for split mono jclr #SPLIT_MODE,y:<ctlflgs,_gsyst_05 ;test fcr spilt mode cf trans ,-clean up junk after getvalue ;see if frame rate same as split rate ;if not, we should have a full frame :since we matched bit rates, this must be a 1/2 bit rate in mono bse t #SPLIT_MONO_FRAME,y:<ctlflgs ; indicate for ancillary data _gsyst_05 ;decode the bits 8 and 9 of the frame header: sampling rate move #NSAMPLERATE,n4 eat sampling rate jsr getvalue get sampling rate right justified move # > MASKNSAMPLERATE,xl mask for getvalue cf data sampling rate and xl,a #NSYSTHDR_2,n4 masK off high order bits 4 set len field #2 (bits 10-11 hdr' move al,x:fndsmpl save the header sample rate idecode tne bits 10 and 11 cf the frame header SUBSTITUTE SHEET (RL'LΞ 26) BAD ORIGINAL Dit description 10 padding bit: 0 = frame is not padded 1 = frame is padded with 8 bits 11 privacy bit test the frame padded flag in header (bit 10) and update frame bit count jsr getvalue ;get data right justified move #>MASKSYSTHDR_2, xl and xl,a #>PAD SLOT.xl mask off high order bits & get the padded bits added to frame move al,y:<not_appl see if frame padded bit set move y:frmbιts,a get the unpadded frame bit count bclr #0,x:padbιt default that the frame is not padded clr #l,y.<not_appl,_gsyst_06 ,-ιf hdr bit not set, no padded bits bset #0,x:padbit ; indicate padded bits add xl,a ,-add pad bits to frame bit count _gsyst_06 ,-set the frame length in bits (normal or padded with 8 bits) ,-set the frame privacy bit in header (bit 11) move a,y:bιtsfrm /store actual frame bit count bclr #0,y:prιvacybιt /default the frame header privacy bit CLR_PRIVACY_BIT_DCD /in decoder status jclr #0 , y: <not_appl,_gsyst_08 bset #0,y:prιvacybιt ,-set the frame header privacy bit SET_PRIVACY_BIT_DCD ,- in decoder status _gsyst_08 decode the bits 12 and 13 of the frame header- frame type 00 = FULL STEREO (2 channels) 01 = JOINT STEREO (2 channels) 10 = DUAL MONO (2 channels) 11 = MONO (1 channel) move #NFRAMETYPE,n4 ,-get frame type (bits 12-13 in hdr* jsr getvalue /get frame type right justified move #>MASKFRAMETYPE,xl /mask for getvalue of framing type and xl.a #NSTINTENSITY, n4 ,-mask off high order bits ,- Sc get stereo intesity (bits 14-15 1 move al,y:frmtype ;save type of frame ,-set the default MAXSUBBANDS as for 2 channel frames move #oidccs,r0 ;to test if old CCS CDQ frames move y:maxsubs_2 ,yl /default to 2 channel MAXSUBBANDS ,- if the old CCS flag is set to decode from old CCS CDQ's, use mono MAXSUBBANDS jclr #0,y: (rO) ,_gsyst_09 ;if MPEG-ISO, continue move y:maxsubs_l,yl /default to MONO MAXSUBBANDS _gsyst_09 ,-set the type cf frame flag 6 -193- ™ιove y : rrmtype , a ,-get tne frame type move # >FULL_STEREO , xl emp xl , a #>JOINT_STEREO , xl j ne _gsyst_10 bclr #STEREO_vs_MONO,y:<ctlflgs ,- indicate stereo samples bclr #JOINT_FRAMING,y:<ctlflgs ,-clear joint stereo indicator mp _gsyst_40 _gsyst_10 emp xl,a #>DUAL,xl jne _gsyst_20 bclr #STEREO_vs_MONO,y:<ctlflgs ;indicate stereo samples bset #JOINT_FRAMING,y:<ctlflgs ,- indicate stereo samples j p _gsyst_40 _gsyst_20 emp xl,a j ne _gsyst_30 ;dual channel is same as stereo Dclr #STEREO_vs_MONO,y:<ctl igs ,-indicate stereo samples bclr #JOINT_FRAMING,y:<ctlflgs ,-clear joint stereo indicator j mp _gsyst_40 _gsyst_30 bset #STEREO_vs_MONO,y:<ctlflgs ; indicate mono samples bclr #JOINT_FRAMING,y:<ctlflgs ,-clear joint stereo indicator ,-set the MAXSUBBANDS for MONO channel frames move y:maxsubs_l,yl ;get to MONO MAXSUBBANDS ,-ιf SPLIT_MONO_FRAME, use split frame mono MAXSUBBANDS jclr #SPLIT_MONO_FRAME,y:<ctlflgs,_gsyst_40 move y:spltmaxsubs,yl ;get to split MONO MAXSUBBANDS _gsyst_40 ,-set the number of sub-bands encoded the BAL's move yl,y:<maxsubs ,-set the working MAXSUBBANDS for frame ,- light led to indicate MPEG-ISO compatible frames or old CCS CDQ2000/CDQ1000 non-conforming frames at low bit rates move #oidccs,r0 ;to test if old CCS CDQ frames nop jclr #0,y: (rO) ,_ιso_led if ISO, set led as ISO ON_MPEG_ISO_vs_CCS_LED_DCD indicate old ccs frames set #l,y: (r0) ,_do_leds if CDQIOOO, set led as CCS jset #STEREO_vs_MONO,y:<ctlflgs,_ιso_led ;ιf MONO, ISO led move #>SAM48K,xO test for 48 K sampling move #>SAM32K,xl test for 32 K sampling move #>BITRATE_56,yO low bit rate code 56 K move y:smpirte, a to test sample rate code emp xO,a #>BITRATE_96,yl see if 48 K sampling & set hi bit rate 96 K @ 48 eq _tst_bιt if 48, test bit rate range emp xi,a #>BITRATE_160,yl ,-see if 32 K sampling & set hi bit rate 96 K * 32 jne iso led if not 32, set ISO led tst bit move y:bιtrate,a check bit rate m the range emp yO , a test vs lowest ISO nigh code it _ιso_led if less, ISO led emp yl, a test vs highest ISO high code le _do_leds if less or equal, leave CCS led iso led OFF MPEG ISO vs CCS LED DCD indicate iso compatible frames do leds SET_LEDS_DCD decode the bits 14 and 15 of the frame header: mode extention (joint sterec intensity boundary) 00 = stereo for sub-bands 0 thru 3, joint for sub-bands 4 and up 01 = stereo for sub-bands 0 thru 7, joint for sub-bands 8 and up 10 = stereo for sub-bands 0 thru 11, joint for sub-bands 12 and up 11 = stereo for sub-bands 0 thru 15, joint for sub-bands 16 and up sr getvalue get data right justified move #>MASKSTINTENSITY,xl mask for getvalue of intensity bound and xl,a #BOUND 4 , rO mask off high order bits & set up for joint just in case jclr #JOINT_FRAMING,y:<ctlflgs,_gsyst_90 ,- intensity is meaningless ,-clear off any unk ,get code for channels 4-31 intensity not joint, intensity is meaningless not joint, intensity is meaningless save intensity stereo sub-band bound decode the bits 16 thru 19 of the frame header: bit description 16 copyright bit : 0 = no copyright 1 = protected by copyright 17 original/home bit: 0 = bitstream is a copy 1 = bitstream is an original 18-19 emphasis: 00 = no emphasis 01 = 50/15 microsec . emphasis 10 = reserved SUBSTITUTE SHEET (RULE 25) 11 = CCITT J.17 emphasis move #NSYSTHDR_3,n4 ,-get field #3 (bits 16-19) sr getvalue ,-get data right justified move #>MASKSYSTHDR_3,xl ,-to mask off unwanted bits and xl,a /mask off the unwanted bits move al,y:<not_appl /move to addr to be tested cir a ,-to restore y:<not_appl as all 0' ,-set the copyright bit, original/home bit and emphasis code from header bclr #0,y:copyright /default bit as not set CLR_COPYRIGHT_BIT_DCD /in decoder status jclr #3 ,y:<not_appl,_gsyst_91 ,-ιf bit 16 not set, continue bset #0,y:copyright ,-set the copyright bit SET COPYRIGHT BIT DCD ,- in decoder status gsyst_91 bclr #0,y:original ,-default bit as not set CLR_ORIGINAL_BIT_DCD ,-in decoder status clr #2,y:<not_appl,_gsyst_92 ,-ιf bit 17 not set, continue bset #0,y:original ,-set the original/home bit SET ORIGINAL BIT DCD ; in decoder status _gsyst_92 move a,y:emphasis /zero the emphasis code CLR_EMPHASIS_BIT_0_DCD ,-m decoder status CLR_EMPHASIS_BIT_1_DCD ,-m decoder status clr #l,y:<not_appl,_gsyst_93 ,-ιf bit 18 not set, try bit 19 bset #1,y:emphasis ,-set bit 1 of emphasis code SET EMPHASIS BIT 1 DCD ,-m decoder status _gsyst_93 clr #0,y:<not_appl,_gsyst_94 ;if bit 19 not set, finish up bset #0,y:emphasis ,-set bit 0 of emphasis code SET EMPHASIS BIT 0 DCD ,-m decoder status _gsyst_94 /restore y:<not_appl to all zeros move a,y:<not_appl ,-reset the dummy variable ,-Set the proper Allowed table and BAL's bit table addresses: / test for low sampling rate Allowed table move #smplιdbιt,rO ;addr of frame header ID bit (0 = low) nop jset #0,y: (rO) ,_gsyst_95 ;if high rate, select Allowed table move #Allowed_3,rO addr of low sampling allowed table move #skftbl_3,rl addr of low sampling BAL's bit table mp _gsyst_100 go to store Allowed table address _gsyst_95 ,-Set tne proper Allowed table address based on working MAXSUBBANDS (y:<maxubsι ,- if less than 27, used table 2 move y: <maxsubs,xO get current MAXSUBBANDS move #>27,a to see which of 2 tables applies move #skftbl_l,rl addr of high sampling BAL's bit table emp x0,a #Allowed_l , rO see if need the low bit rate table & set up as regular Allowed table jle _gsyst_100 regular Allowed table applies rselect the lower bit rate Allowed table move #Allowed_2,rO move #skftbl 2,rl ,-addr of high sampling BAL's bit table _gsyst_100 rset the address of the selected Allowed table rset tne address of the selected BAL's bit table move rO,x:AllwAdd move ri,x:skftbl rts opt fc (c) 1991. Copyright Corporate Computer Systems, Inc. All rights reserved. \URDCDSYN\synth.asm title 'Synthesize a group of sample and output audio' synth.as : this is the main of the poly synthesis routine it handles a new group of samples to be decoded and inverse quantized for stereo a group of samples contains 192 samples (96 left & 96 right) if mono a group of samples contains 96 samples only include 'def.asm' include 'box_ctl .asm' section highmisc xdef dualchan control for channel swap ctis instead of ssh bit 0 = 1 means copy left to right bit 1 1 means copy right to left bit 2 1 means swap left & right bit 3 1 means mute both left & right endsynth_yhe endsec org phe synth move #dualchan, rO ,-set addr of two chan ctis move #ASMData,rl ,-position to left channel ,-see if the frame is to be muted jclr #MUTE_LEFT_and_RIGHT,y: (rO) ,_synt_00 ;set the number of words in both channels for the MUTE do loop move #NUMSUBBANDS*NPERGROUP*2,nO 2 channels numb words to mute move #0,nl hold position at left channel jmp _synt_20 go to the mute loop _synt_00 ,-if a stereo frame, checkout for special mute or swaps jclr #STEREO vs MONO,y:<ctlflgs,_synt_40 move #NUMSUBBANDS*NPERGROUP, n1 ,-spacing to right channel move rl.rO /position to left channel move (rl> +nl ;addr of right channel :copy the left tc right O 96/32805 -198- do #NUMSUBBANDS*NPERGROUF,_syr.t_05 move x: (rO) +,x0 ,-get left channel value move xO,x: (rl) + ,-put left value into right _synt_05 :if we do not have to mute a channel (mono to both), skip ahead to restore registers used jset #MONO_OUT_BOTH,y:<ctlflgs,_synt_90 ,-out to both, go restore regs ,-set the number of words in one channel for the mute do loop move #NUMSUBBANDS*NPERGROUP,n0 ,-1 channel numb words to mute rset up to mute the channel not selected for mono output move #ASMData,rl ,-position to left channel move #0,nl ,-start at left channel ;if not the left channel for output, continue else, position to the right channel for muting jset #MONO_OUT_CHANNEL,y:<ctlflgs,_synt_20 ,-if right, zero left move #NUMSUBBANDS*NPERGROUP,nl ,-else, zero the right channel _synt_20 :mute the proper channel (s) move #0,x0 ;to mute the channel move (rl) +nl ,-addr of channel to mute do n0,_synt_30 move xC,x: (rl~+ :zero value chosen channel _synt_30 jmp _synt_90 ;do the polysynthesis _synt_40 see if the two channel frame requires any swapping: swap left and right left into right right into left jclr #SWAP_LEFT_and_RIGHT,y: (rO) ,_synt_50 ,-swap the left and right channels move #NUMSUBBANDS*NPERGROUP,nl spacing to right channel move rl,rO position to left channel move (rl) +nl addr cf right channel ;copy the left into right do #NUMSUBBANDS*NPERGROUP,_synt_45 move x: (rO) ,xO ,-get left channel value move x: 'rl) ,xl ,-get right channel value SUBSTITUTE SHEET (RULE 26 ) I. ORDINA move xO,x: (rl. * /put left value into right move xl,x: (rC) + /put right value into left _synt_45 jmp _synt_80 :go see if any channel mutes _synt_50 :see if a copy the left into the right jclr #COPY_LEFT_to_RIGHT,y: (rO' ,_synt_60 ,-ιf not copy left to righ t icopy the left channel into the right channel move #NUMSUBBANDS*NPERGROUP,nl spacing to right channel move rl , rO position to left channel move (rl) +nl addr of right channel jmp _synt_70 do the copy _synt_60 :see if a copy the right into the left jclr #COPY_RIGHT_to_LEFT,y: (rO) ,_synt_80 ;if not copy right to left ;copy the right channel into the left channel move #NUMSUBBANDS*NPERGROUP,nO ;spacing to right channel move rl,rO ,-positιon to left channel nop move (rO) +n0 ;addr of right channel _synt_7C ;copy the one channel into the other do #NUMSUBBANDS*NPERGROUP,_synt_80 move x: (rO) +,x0 ,-get source channel value move x0,x: (rl) + ;put source value into destm _synt_80 ,-see if either channel is to be muted jmp _syr_t_05 _synt_9C ;pass both channels to the polysynthesis routine move #ASMData,rO ;save ,-set to be a mod (1024) buffer ,-set to be a mod;10241 buffer ,-set scale factor :restore n6 SUBSTITUTE SHEET (RULE 26) \ BAD ORIGINAL g restore to linear addressing restore tc linear adaressmg restore to linear addressing restore to linear addressing rts (c) 1991. Copyright Corporate Computer Systems, Inc. All rights reserved, c: \musicam\dsp\acorn\urdcdsyn\translte .asm include ' .. \ultma\translte.asm'

Claims: CLAIMS What is claimed is: 1. An audio transmission system comprising: a coder for coding an input audio signal into a digital signal to be transmitted through a traditional analog telephone network, the digital signal having a transmission rate of 28.8 kilobits per second or less; and a decoder for decoding the digital signal that is received form the telephone network to provide an output audio signal with a frequency range greater than 4 kilohertz.

Inventors: HINDERKS LARRY W, HINDERKS, LARRY, W.
Applicants: CORPORATE COMPUTER SYSTEMS INC, HINDERKS LARRY W, CORPORATE COMPUTER SYSTEMS, INC., HINDERKS, LARRY, W.
Application year: 1996
Main classification: H04M11
IPC codes: H04Q11, H04R1