JP4319895B2 - Time series signal encoding device - Google Patents

Time series signal encoding device Download PDF

Info

Publication number
JP4319895B2
JP4319895B2 JP2003386707A JP2003386707A JP4319895B2 JP 4319895 B2 JP4319895 B2 JP 4319895B2 JP 2003386707 A JP2003386707 A JP 2003386707A JP 2003386707 A JP2003386707 A JP 2003386707A JP 4319895 B2 JP4319895 B2 JP 4319895B2
Authority
JP
Japan
Prior art keywords
sample
encoding
length
run
buffer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2003386707A
Other languages
Japanese (ja)
Other versions
JP2005151223A (en
Inventor
敏雄 茂出木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dai Nippon Printing Co Ltd
Original Assignee
Dai Nippon Printing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dai Nippon Printing Co Ltd filed Critical Dai Nippon Printing Co Ltd
Priority to JP2003386707A priority Critical patent/JP4319895B2/en
Publication of JP2005151223A publication Critical patent/JP2005151223A/en
Application granted granted Critical
Publication of JP4319895B2 publication Critical patent/JP4319895B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Description

本発明は、音楽制作、音響データの素材保管、ロケ素材の中継など音楽制作分野、特にCDよりも品質の高い高精細オーディオ制作を行う分野、CD、DVD等のデジタル記録媒体を用いたオーディオ記録再生分野、遠隔医療における生体信号の伝送等、データの改変が嫌われる分野等において好適なデータの圧縮符号化技術に関する。   The present invention relates to a music production field such as music production, storage of acoustic data material, relaying location material, particularly a field of producing high-definition audio with higher quality than a CD, and audio recording using a digital recording medium such as a CD or a DVD. The present invention relates to a data compression coding technique suitable for the field of reproduction, the field of transmission of biological signals in telemedicine, and the like where data modification is hated.

従来より、音響信号の圧縮には様々な手法が用いられている。音響信号を圧縮して符号化する手法として、MP3(MPEG−1/Layer3)、AAC(MPEG−2/Layer3)などが実用化されている。このような圧縮符号化方式により、音響信号を小さいデータとして扱うことが可能となり、データの記録・伝送の効率化に貢献している。   Conventionally, various methods are used for compression of an acoustic signal. As a method for compressing and encoding an acoustic signal, MP3 (MPEG-1 / Layer3), AAC (MPEG-2 / Layer3), and the like have been put into practical use. Such a compression encoding method makes it possible to handle an acoustic signal as small data, and contributes to the efficiency of data recording and transmission.

上述のようなMP3、AAC等はいずれもロッシー符号化方式といわれるものであり、効率的な圧縮が可能であるが、復号化にあたって、少なからず品質の劣化を伴い、原信号を完全に再現することはできない。   MP3, AAC, and the like as described above are all referred to as lossy encoding methods, and can be efficiently compressed. However, in decoding, the original signal is completely reproduced with a considerable quality degradation. It is not possible.

このような問題を解決するため、ロスレス型(可逆型)圧縮を実現する手法(例えば、特許文献1参照)が提案されている。
特表2000−821199号公報
In order to solve such a problem, a technique for realizing lossless (reversible) compression (see, for example, Patent Document 1) has been proposed.
JP 2000-82199 Gazette

しかしながら、上記特許文献1に記載の発明では、70%程度の圧縮率しか得られず、また、処理のために大量のワークメモリを必要とするという問題がある。   However, the invention described in Patent Document 1 has a problem that only a compression rate of about 70% can be obtained and a large amount of work memory is required for processing.

上記のような点に鑑み、本発明は、少ないワークメモリを用いて、大量の音楽データを符号化することができるとともに、符号化処理に負荷をかけずに信号平坦部圧縮を行うことが可能な時系列信号の符号化装置を提供することを課題とする。   In view of the above points, the present invention can encode a large amount of music data using a small amount of work memory, and can perform signal flat portion compression without imposing a load on the encoding process. It is an object of the present invention to provide a simple time-series signal encoding device.

上記課題を解決するため、本発明の符号化装置は、時系列のサンプル列で構成される時系列信号に対して、サンプル列よりサンプルを順次読み込むサンプル入力手段と、サンプルを時系列に所定の個数だけ格納するバッファメモリである直前バッファと、直前バッファに格納されているサンプルを用いて、ランレングス符号化を行うか、線形予測符号化を行うかの符号化モードを判定する符号化モード判定手段と、符号化モード判定手段により符号化モードとしてランレングス符号化が選択された場合、サンプル入力手段で取り込まれたサンプルと直前バッファに格納されている最新のサンプルとを比較することによりランレングスデータを算出するランレングス算出手段と、符号化モード判定手段により符号化モードとして線形予測符号化が選択された場合、直前バッファに格納されている複数のサンプルを用いて線形予測誤差を算出する予測誤差算出手段と、サンプル入力手段で取り込まれたサンプルを直前バッファに書き込み、最も過去に位置するサンプルを直前バッファより削除する直前バッファ更新手段と、前記ランレングスデータにおよび前記線形予測誤差に対して可変長で符号化を行う可変長符号化手段と、符号化されたデータを出力する符号出力手段と、各手段を制御して前記サンプル列のサンプルを符号出力する符号化処理制御手段を有する構成としたことを特徴とする。   In order to solve the above-described problem, an encoding apparatus according to the present invention includes a sample input unit that sequentially reads samples from a sample sequence with respect to a time-series signal including a time-series sample sequence, and a predetermined time-series sample. Encoding mode determination that determines the encoding mode of whether run-length encoding or linear predictive encoding is performed using the immediately preceding buffer, which is a buffer memory for storing the number of samples, and the samples stored in the immediately preceding buffer And run-length coding is selected as the coding mode by the coding mode determination means, the run length is determined by comparing the sample fetched by the sample input means with the latest sample stored in the immediately preceding buffer. Linear predictive coding as a coding mode by a run length calculating means for calculating data and a coding mode determining means When selected, a prediction error calculation means for calculating a linear prediction error using a plurality of samples stored in the immediately preceding buffer, and a sample fetched by the sample input means is written to the immediately preceding buffer, and the sample located at the past Last-minute buffer update means for deleting the previous-length buffer, variable-length coding means for coding the run-length data and the linear prediction error with variable length, and code output means for outputting the coded data And an encoding process control means for controlling each means and outputting the sample of the sample string as a code.

本発明によれば、時系列信号の各サンプルを1サンプルずつ読み込んで順次符号化を行う場合に、基本的には線形予測符号化モードとし、状況に応じて、ランレングスモードとして符号化を行うようにしたので、時系列信号を、ワークメモリの制限にとらわれず、リアルタイムで符号化を行うことが可能となる。   According to the present invention, when each sample of the time-series signal is read one by one and sequentially encoded, the linear predictive encoding mode is basically used, and the run length mode is encoded depending on the situation. Since it did in this way, it becomes possible to encode a time series signal in real time without being restricted by the limitation of a work memory.

以下、本発明の実施形態について図面を参照して詳細に説明する。
(1.時系列信号の構成)
まず、本発明で符号化対象とする時系列信号について説明する。ここでは、時系列信号として2つのチャンネルを有するステレオ音響信号の場合を例にとって説明する。まず、時系列信号であるアナログの音響信号をデジタル化する。これは、従来の一般的なPCMの手法を用い、所定のサンプリング周波数でこのアナログ音響信号をサンプリングし、振幅を所定の量子化ビット数を用いてデジタルデータに変換する処理を行えば良い。本実施形態では、サンプリング周波数44.1KHz、量子化ビット数16ビットで正負の符号を記録した場合を想定して以降説明する。サンプリング周波数44.1KHzでサンプリングすると、1秒あたり44100個のサンプルにより構成されるサンプル列ができることになる。図1に、先頭からの所定数のサンプルを模式的に示す。図1において横軸は時刻t、縦軸は振幅x(t)を示す。図1において、t−4〜t+5の数字は各サンプルのサンプル番号を示しており、上述のように44.1KHzでサンプリングすると、この10サンプルは、1/4410秒に相当する。なお、ここでは、サンプル番号と時刻を同義で用いている。これは、サンプル番号が時刻の変化に伴って昇順に付与されており、時刻にサンプリング周波数を乗じた値がサンプル番号となるためである。また、図1において各サンプル番号から延びる線分は振幅値を示しているが、この振幅値は、上述のように量子化ビット数16ビットで正負の符号を記録した場合、−32768〜32767の値をとることになる。
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
(1. Time-series signal configuration)
First, a time series signal to be encoded in the present invention will be described. Here, a case of a stereo sound signal having two channels as a time series signal will be described as an example. First, an analog acoustic signal that is a time-series signal is digitized. This may be performed by using a conventional general PCM method, sampling the analog acoustic signal at a predetermined sampling frequency, and converting the amplitude into digital data using a predetermined number of quantization bits. In the present embodiment, the following description will be given on the assumption that a positive / negative code is recorded with a sampling frequency of 44.1 KHz and a quantization bit number of 16 bits. When sampling is performed at a sampling frequency of 44.1 KHz, a sample string composed of 44100 samples per second is formed. FIG. 1 schematically shows a predetermined number of samples from the top. In FIG. 1, the horizontal axis represents time t, and the vertical axis represents amplitude x (t). In FIG. 1, the numbers t−4 to t + 5 indicate the sample numbers of the respective samples, and when sampling is performed at 44.1 KHz as described above, these 10 samples correspond to 1/44410 seconds. Here, the sample number and time are used synonymously. This is because the sample numbers are assigned in ascending order according to the change in time, and a value obtained by multiplying the time by the sampling frequency becomes the sample number. Further, the line segment extending from each sample number in FIG. 1 indicates the amplitude value. This amplitude value is −32768 to 32767 when a positive / negative code is recorded with a quantization bit number of 16 bits as described above. Will take the value.

(2.1.符号化装置の構成)
本発明に係る符号化装置は、符号化処理を行う専用のプログラムを、コンピュータに搭載することにより実現される。この専用プログラムを実行することにより、コンピュータに所定の処理を行わせ、コンピュータを符号化装置として機能させるのである。
(2.1. Configuration of encoding apparatus)
The encoding apparatus according to the present invention is realized by mounting a dedicated program for performing encoding processing on a computer. By executing the dedicated program, the computer is caused to perform predetermined processing, and the computer is caused to function as an encoding device.

(2.2.処理概要)
続いて、本発明に係る符号化装置の処理動作について説明していく。図2は、本発明に係る符号化方法の処理概要を示すフローチャートである。まず、音響信号を先頭から各チャンネルにつき1サンプルずつ読み込む(ステップS10)。本実施形態のように、2チャンネルで構成されるステレオ音響信号の場合には、各チャンネル交互に1サンプルずつ読み込まれることになる。読み込まれたサンプルは、直前の数サンプルを一時的に保存しておくためのバッファメモリである直前バッファに格納される。直前バッファには、各チャンネルごとに5サンプルまで記録するようになっているので、サンプル番号0〜4までは、読み込んだサンプルを順番に記録していく。
(2.2. Outline of processing)
Next, the processing operation of the encoding device according to the present invention will be described. FIG. 2 is a flowchart showing an outline of the process of the encoding method according to the present invention. First, one sample is read for each channel from the head (step S10). In the case of a stereo sound signal composed of two channels as in this embodiment, one sample is read alternately for each channel. The read sample is stored in the immediately preceding buffer which is a buffer memory for temporarily storing the immediately preceding several samples. Since up to 5 samples are recorded for each channel in the immediately preceding buffer, the read samples are recorded in order from sample numbers 0 to 4.

直前バッファに5サンプルが保存されたら、他の処理が開始される。まず、本装置の符号化モードがどのような状態であるかどうかを判断する(ステップS20)。具体的には、符号化モードが線形予測符号化モードであるか、ランレングスモードであるかを判断する。本装置には、符号化モードとして線形予測符号化モードとランレングスモードの2つが用意されているが、初期状態では、線形予測符号化モードに設定されている。このため、最初は、ステップS30に進むことになる。線形予測符号化モードの場合は、直前バッファ内に格納された5サンプルのうち最新の2サンプル(すなわち初期状態では先頭から4サンプル目と5サンプル目)の値が同一であるかどうかを判断する。同一である場合には、ランレングスモードに移行する。一方、同一でない場合には、線形予測符号化モードの処理を行う。   When 5 samples are stored in the previous buffer, other processing is started. First, it is determined what state the encoding mode of this apparatus is (step S20). Specifically, it is determined whether the encoding mode is a linear predictive encoding mode or a run-length mode. In this apparatus, two linear prediction encoding modes and a run length mode are prepared as encoding modes. In the initial state, the linear prediction encoding mode is set. For this reason, first, the process proceeds to step S30. In the case of the linear predictive coding mode, it is determined whether the latest two samples (that is, the fourth and fifth samples from the beginning in the initial state) among the five samples stored in the immediately preceding buffer are the same. . If they are the same, the mode shifts to the run length mode. On the other hand, if they are not the same, the process of the linear predictive coding mode is performed.

(2.2.1.線形予測符号化モード)
線形予測符号化モードでは、チャンネル間相関処理(ステップS40)、線形予測誤差算出処理(ステップS50)、極性処理(ステップS60)、可変長符号化処理(ステップS70)が行われる。可変長符号化されて得られた可変長ビット列は、記録のために順次出力される。その後、ステップS10で読み込んだ現サンプルを直前バッファに保存する(ステップS80)。直前バッファに記録されるサンプルは、本実施形態では5サンプルと固定しているので、現サンプルを格納する代わりに、最も過去のサンプルを削除する。例えば、サンプル0〜4が記録されていた場合、現サンプル5を格納してサンプル0を削除する。この結果、直前バッファには、サンプル1〜5が格納された状態となる。現サンプルを直前バッファに保存したら、ステップS10に戻って次のサンプルを読み込む。なお、チャンネル間相関処理、線形予測誤差算出処理、極性処理、可変長符号化処理の詳細については、後述する。符号化モードが線形予測符号化モードである間は、読み込まれたサンプルは、ステップS10〜ステップS80のループにおいて処理されることになる。
(2.2.1. Linear predictive coding mode)
In the linear predictive coding mode, inter-channel correlation processing (step S40), linear prediction error calculation processing (step S50), polarity processing (step S60), and variable length coding processing (step S70) are performed. Variable length bit strings obtained by variable length coding are sequentially output for recording. Thereafter, the current sample read in step S10 is stored in the previous buffer (step S80). Since the sample recorded in the immediately preceding buffer is fixed at 5 samples in this embodiment, the oldest sample is deleted instead of storing the current sample. For example, when samples 0 to 4 are recorded, the current sample 5 is stored and the sample 0 is deleted. As a result, the samples 1 to 5 are stored in the previous buffer. When the current sample is stored in the previous buffer, the process returns to step S10 to read the next sample. Details of inter-channel correlation processing, linear prediction error calculation processing, polarity processing, and variable length coding processing will be described later. While the coding mode is the linear predictive coding mode, the read sample is processed in the loop of Step S10 to Step S80.

(2.2.2.線形予測符号化モードからランレングスモードへの移行)
線形予測符号化モード(ステップS10〜ステップS80のループ)の状態で、ステップS30において、直前バッファ内で最新の2サンプルの値が一致した場合には、符号化モードが線形予測符号化モードから、ランレングスモードに切り換えられる(ステップS90)。これにより、符号化処理が線形予測符号化モードからランレングスモードに移行して行われることになる。
(2.2.2 Transition from linear predictive coding mode to run-length mode)
In the state of the linear predictive coding mode (the loop of step S10 to step S80), when the values of the latest two samples match in the immediately preceding buffer in step S30, the coding mode is changed from the linear predictive coding mode, The mode is switched to the run length mode (step S90). As a result, the encoding process is performed from the linear predictive encoding mode to the run-length mode.

(2.2.3.ランレングスモード)
ランレングスモードでは、まず、ランが継続しているかどうかを判定する(ステップS100)。具体的には、読み込んだ後、まだ直前バッファに格納されていない現サンプルの値と、直前バッファに格納された5サンプルのうち最新のサンプルの値が同一であるかどうかを比較する。同一である場合は、ランが継続していると判断して、ランレングスをカウントアップする(ステップS110)。具体的には、現在のランレングスを「1」だけ増加することになる。続いて、読み込んだ現サンプルを直前バッファに保存する(ステップS80)。そして、ステップS10に戻ってサンプル入力手段が次のサンプルを読み込むことになる。この状態では、符号化モードはランレングスモードとなっているので、ステップS20においては、ランレングスモードであると判定されてステップS100に進むことになる。符号化モードがランレングスモードである間は、読み込まれたサンプルは、ステップS10、S20、S100、S110、S80のループにおいて処理されることになる。
(2.2.3. Run length mode)
In the run length mode, first, it is determined whether or not the run is continued (step S100). Specifically, after reading, the value of the current sample not yet stored in the previous buffer is compared with the value of the latest sample among the five samples stored in the previous buffer. If they are the same, it is determined that the run is continuing, and the run length is counted up (step S110). Specifically, the current run length is increased by “1”. Subsequently, the read current sample is stored in the immediately preceding buffer (step S80). Then, returning to step S10, the sample input means reads the next sample. In this state, since the encoding mode is the run-length mode, in step S20, it is determined that the run-length mode is set, and the process proceeds to step S100. While the encoding mode is the run length mode, the read sample is processed in the loop of steps S10, S20, S100, S110, and S80.

(2.2.4.ランレングスモードから線形予測符号化モードへの移行)
ランレングスモード(ステップS10、S20、S100、S110、S80のループ)の状態で、ステップS100において、直前バッファに格納されていない現サンプルと、直前バッファに格納された5サンプルのうち最新のサンプルの値が同一でない場合には、ランが途切れたものと判断して、ここまでのランレングス情報を可変長符号化する(ステップS120)。ここでの可変長符号化の手法としては、種々のものを採用できるが、公知のメルコード(MELCODE)方式を用いるのが望ましい。続いて、符号化モードをランレングスモードから、線形予測符号化モードに切り換える(ステップS130)。これにより、符号化処理がランレングスモードから線形予測符号化モードに移行して行われることになる。続いて、直前バッファに格納されていない現サンプルと、直前バッファに格納された5サンプルのうち最新のサンプルの値の差分を算出する(ステップS140)。本来はランが連続する信号平坦部以外のサンプルについては、過去の複数サンプルを利用して線形予測誤差を算出するのが望ましいが、この時点では、過去の複数サンプルが信号平坦部であるため、効果のある予測誤差の算出が行えない。そのため、線形予測誤差算出の代わりの簡易的な手法として差分処理を行うのである。この後は、ステップS60から線形予測符号化モードのループに入ることになる。
(2.2.4. Transition from run-length mode to linear predictive coding mode)
In the run length mode (the loop of steps S10, S20, S100, S110, and S80), in step S100, the current sample that is not stored in the previous buffer and the latest sample among the five samples stored in the previous buffer are displayed. If the values are not the same, it is determined that the run is interrupted, and the run-length information so far is variable-length encoded (step S120). Various variable-length coding methods can be used here, but it is desirable to use a known melcode method. Subsequently, the coding mode is switched from the run-length mode to the linear predictive coding mode (step S130). As a result, the encoding process is performed by shifting from the run-length mode to the linear predictive encoding mode. Subsequently, the difference between the current sample not stored in the immediately preceding buffer and the value of the latest sample among the five samples stored in the immediately preceding buffer is calculated (step S140). Originally, for samples other than the signal flat part where the run is continuous, it is desirable to calculate the linear prediction error using a plurality of past samples, but at this point, since the past plurality of samples is a signal flat part, Effective prediction error cannot be calculated. Therefore, difference processing is performed as a simple method instead of linear prediction error calculation. After this, the linear predictive coding mode loop is entered from step S60.

通常の音響信号であれば、連続するサンプルの値が全く同じであることは比較的少ないので、線形予測符号化モードで処理が行われる場合が最も多いが、同じ値のサンプルが連続する信号平坦部については、ランレングスモードで処理が行われることになる。音響信号のサンプルの状態が、信号平坦部以外から信号平坦部になった場合には、線形予測符号化モードからランレングスモードに移行し、音響信号のサンプルの状態が、信号平坦部から信号平坦部以外になった場合には、ランレングスモードから線形予測符号化モードに移行することになる。このように、信号平坦部では、ランレングスモードに移行して符号化が行われるため、特に、信号平坦部を有する時系列信号の符号化を効率的に行うことが可能となる。   If it is a normal acoustic signal, it is relatively rare that the values of consecutive samples are exactly the same, so the processing is most often performed in the linear predictive coding mode. The processing is performed in the run length mode. When the state of the acoustic signal sample changes from the signal flat part to the signal flat part, the mode shifts from the linear predictive coding mode to the run length mode, and the state of the acoustic signal sample changes from the signal flat part to the signal flat part. If it is other than the part, the run length mode is shifted to the linear predictive coding mode. As described above, since the signal flat part is shifted to the run-length mode and encoded, it is possible to particularly efficiently encode the time-series signal having the signal flat part.

(2.2.5.チャンネル間相関処理)
続いて、上記ステップS40からステップS70における各処理の詳細について説明する。ステップS40においては、各チャンネルのサンプルに対して、チャンネル間の差分演算を行う。このチャンネル間差分演算の処理概要を図3のフローチャートに示す。まず、現サンプルを読み込む(ステップS41)。ここでの、読み込みとは、ステップS40の処理を行うチャンネル間演算処理のためのモジュールがサンプルを読み込むことを意味する。読み込んだサンプルがLチャンネルのものであれば、サンプルの値を基準チャンネルメモリに格納すると共に、ステップS50の線形予測誤差算出処理に出力する(ステップS42)。一方、読み込んだサンプルがRチャンネルのものであれば、ステップS43以降の処理を行う。なお、サンプルは、各チャンネルのものが交互に読み込まれるので、そのチャンネルがLチャンネルのものかRチャンネルのものかの判断を行う必要はない。例えば、サンプル番号t=1のLチャンネルのサンプルを読み込んだら、次はサンプル番号t=1のRチャンネルのサンプル、その次は、サンプル番号t=2のLチャンネルのサンプルというように順番が決まっているので、交互にステップS42の処理とステップS43以降の処理とを切替えるようにすれば良い。
(2.2.5. Inter-channel correlation processing)
Next, details of each process from step S40 to step S70 will be described. In step S40, the difference calculation between channels is performed on the samples of each channel. A processing outline of the inter-channel difference calculation is shown in the flowchart of FIG. First, the current sample is read (step S41). Here, the reading means that the module for the inter-channel calculation processing that performs the processing of step S40 reads the sample. If the read sample is for the L channel, the value of the sample is stored in the reference channel memory and output to the linear prediction error calculation process in step S50 (step S42). On the other hand, if the read sample is for the R channel, the processing after step S43 is performed. Note that samples of each channel are alternately read, so there is no need to determine whether the channel is of the L channel or the R channel. For example, when an L channel sample with a sample number t = 1 is read, the next is an R channel sample with a sample number t = 1, and the next is an L channel sample with a sample number t = 2. Therefore, the process of step S42 and the process after step S43 may be switched alternately.

Rチャンネルのサンプルの場合は、変数AoとAdの比較を行う(ステップS43)。ここで、AoはRチャンネルのサンプル値の絶対値の累積であり、AdはRチャンネルとLチャンネルのサンプル値の差分の絶対値の累積である。変数Ao、Ad共に初期値は0である。ステップS43において、Ad≧Aoであれば、Rチャンネルのサンプルをそのままの値で、ステップS50の線形予測誤差算出処理に出力する(ステップS44)。さらに、累積値Aoを以下の〔数式1〕の第1式に示すように更新する。具体的には、Rチャンネルのサンプル値eRの絶対値を累積値Aoに加えることになる。 In the case of the R channel sample, the variables Ao and Ad are compared (step S43). Here, Ao is the accumulation of absolute values of the sample values of the R channel, and Ad is the accumulation of absolute values of the differences between the sample values of the R channel and the L channel. The initial values of both variables Ao and Ad are 0. If Ad ≧ Ao in step S43, the R channel sample is output as it is to the linear prediction error calculation process in step S50 (step S44). Further, the accumulated value Ao is updated as shown in the first equation of [Equation 1] below. Specifically, the absolute value of the R channel sample value e R is added to the accumulated value Ao.

ステップS43において、Ad<Aoであれば、基準チャンネルメモリに格納されているLチャンネルのサンプルとの差分を算出し、差分値をステップS50の線形予測誤差算出処理に出力する(ステップS45)。さらに、累積値Adを以下の〔数式1〕の第2式に示すように更新する。具体的には、RチャンネルとLチャンネルのサンプルの差分値eR-eLの絶対値を累積値Adに加えることになる。 If Ad <Ao in step S43, the difference from the L channel sample stored in the reference channel memory is calculated, and the difference value is output to the linear prediction error calculation process in step S50 (step S45). Further, the accumulated value Ad is updated as shown in the second formula of [Formula 1] below. Specifically, the absolute value of the difference value e R -e L between the R channel and L channel samples is added to the accumulated value Ad.

〔数式1〕
Ao←Ao+|eR
Ad←Ad+|eR-eL
[Formula 1]
Ao ← Ao + | e R |
Ad ← Ad + | e R -e L |

続いて、L、Rの1対のサンプルを処理したことを示すカウンタCを1つ加算する(ステップS46)。なお、上述のように、カウンタ変数Cはチャンネル間演算処理モジュール内で用いられるローカル変数である。   Subsequently, one counter C indicating that a pair of samples L and R has been processed is added (step S46). As described above, the counter variable C is a local variable used in the inter-channel arithmetic processing module.

続いて、カウンタが所定回数を超えたかどうかの判定を行う(ステップS47)。本実施形態では、この所定回数を100回として設定している。すなわち、カウンタCが100を超えたかどうかの判定を行う。   Subsequently, it is determined whether the counter has exceeded a predetermined number of times (step S47). In this embodiment, this predetermined number is set as 100 times. That is, it is determined whether or not the counter C exceeds 100.

この結果、カウンタが100を超えていたら、累積値Ao、Adを半分にする(ステップS48)。具体的には、以下の〔数式2〕に示すように、累積値となる変数Ao、Adを2で除算する。同時に、カウンタCも半分にリセットする。すなわち、ここでのAo、Adは純粋な意味での累積誤差ではなく、累積誤差の移動平均となっている。本実施形態では、直前の最大100サンプルまでは累積されるが、それ以前のものは半分になるように処理する。これにより、時間的に離れたサンプルの影響が小さくなるようにしている。   As a result, if the counter exceeds 100, the accumulated values Ao and Ad are halved (step S48). Specifically, as shown in the following [Equation 2], the variables Ao and Ad that are accumulated values are divided by two. At the same time, the counter C is reset to half. That is, Ao and Ad here are not cumulative errors in a pure sense, but are moving averages of cumulative errors. In the present embodiment, the maximum 100 samples immediately before are accumulated, but the previous ones are processed in half. Thereby, the influence of the sample separated in time is made small.

〔数式2〕
Ao←Ao/2
Ad←Ad/2
C←C/2
[Formula 2]
Ao ← Ao / 2
Ad ← Ad / 2
C ← C / 2

上記ステップS41〜ステップS48の処理を時系列信号中の全時刻全サンプルに渡って実行することにより、Rチャンネルの全サンプルの値が、Lチャンネルとの差分値に置き換えられることになる。ただし、上述の処理から明らかなように、累積値Ao、Adの大小関係によっては、Rチャンネルのサンプル値がそのまま記録されるサンプルも存在する。なお、ステップS40のチャンネル間演算処理では、Lチャンネルのサンプルは、全てそのままの値で出力されることになる。   By executing the processes in steps S41 to S48 over all samples in all times in the time-series signal, the values of all samples in the R channel are replaced with the difference values from the L channel. However, as is apparent from the above-described processing, there is a sample in which the R channel sample value is recorded as it is depending on the magnitude relationship between the accumulated values Ao and Ad. In the inter-channel calculation process in step S40, all L channel samples are output as they are.

(2.2.6.線形予測誤差算出処理)
続いて、図2に示すステップS50において、チャンネル間演算後のサンプルの値を予測誤差値に変換する。本実施形態では、適応型の線形予測符号化方式を用いる。本実施形態においては、あるサンプルの予測誤差値を求めるために同一チャンネルの最大4サンプルを必要とする。ステップS50の予測誤差算出処理の概要を図4のフローチャートに示す。予測誤差算出処理は、各チャンネル独立で行われるので、図4においては1つのチャンネルのサンプルに対して処理を行う場合について説明する。複数のチャンネルについて処理する場合も、各チャンネルについて同様に行われる。まず、あらかじめ準備された複数の予測計算式を用いて、各予測計算式に対応した線形予測誤差を算出する(ステップS51)。具体的には、サンプル番号tの予測誤差を算出する予測計算式として、以下の〔数式3〕〜〔数式6〕を用意している。
(2.2.6. Linear prediction error calculation processing)
Subsequently, in step S50 shown in FIG. 2, the value of the sample after the inter-channel calculation is converted into a prediction error value. In this embodiment, an adaptive linear predictive coding method is used. In the present embodiment, a maximum of 4 samples of the same channel are required to obtain a prediction error value of a certain sample. An outline of the prediction error calculation process in step S50 is shown in the flowchart of FIG. Since the prediction error calculation process is performed independently for each channel, the case where the process is performed on a sample of one channel will be described with reference to FIG. When processing a plurality of channels, the same process is performed for each channel. First, a linear prediction error corresponding to each prediction calculation formula is calculated using a plurality of prediction calculation formulas prepared in advance (step S51). Specifically, the following [Formula 3] to [Formula 6] are prepared as prediction calculation formulas for calculating the prediction error of the sample number t.

〔数式3〕
e1(t)=x(t)−x(t−1)−e1(t−1)/2
[Formula 3]
e1 (t) = x (t) -x (t-1) -e1 (t-1) / 2

〔数式4〕
e2(t)=x(t)−2×x(t−1)+x(t−2)−e2(t−1)/2
[Formula 4]
e2 (t) = x (t) -2 * x (t-1) + x (t-2) -e2 (t-1) / 2

〔数式5〕
e3(t)=x(t)−3×x(t−1)+3×x(t−2)−x(t−3)−e3(t−1)/2
[Formula 5]
e3 (t) = x (t) −3 × x (t−1) + 3 × x (t−2) −x (t−3) −e3 (t−1) / 2

〔数式6〕
e4(t)=x(t)−4×x(t−1)+6×x(t−2)−4×x(t−3)+x(t−4)−e4(t−1)/2
[Formula 6]
e4 (t) = x (t) -4 * x (t-1) + 6 * x (t-2) -4 * x (t-3) + x (t-4) -e4 (t-1) / 2

上記〔数式3〕〜〔数式6〕において、e1(t)〜e4(t)は各予測計算式による時刻tのサンプルにおける予測誤差であり、x(t)〜x(t−4)は時刻t〜t−4における振幅値である。   In the above [Equation 3] to [Equation 6], e1 (t) to e4 (t) are prediction errors in the sample at time t according to each prediction calculation equation, and x (t) to x (t-4) are times. It is an amplitude value from t to t-4.

上記〔数式4〕における「2×x(t−1)−x(t−2)」、上記〔数式5〕における「3×x(t−1)−3×x(t−2)+x(t−3)」、上記〔数式6〕における「4×x(t−1)−6×x(t−2)+4×x(t−3)−x(t−4)」は過去の2〜4個のサンプルに基づく線形予測成分である。この線形予測成分、および、直前のサンプルにおいて算出された予測誤差「e1(t−1)/2」〜「e4(t−1)/2」(誤差フィードバック成分)を用いて時刻tにおける予測誤差e1(t)〜e4(t)を算出する。   “2 × x (t−1) −x (t−2)” in the above [Expression 4], “3 × x (t−1) −3 × x (t−2) + x ( t-3) ”,“ 4 × x (t−1) −6 × x (t−2) + 4 × x (t−3) −x (t−4) ”in [Formula 6] Linear prediction component based on ~ 4 samples. Using this linear prediction component and the prediction errors “e1 (t−1) / 2” to “e4 (t−1) / 2” (error feedback component) calculated in the immediately preceding sample, a prediction error at time t e1 (t) to e4 (t) are calculated.

続いて、上記各予測計算式別の予測誤差値の絶対値の累積である累積誤差が最小となる線形予測誤差をそのサンプルの予測誤差として選出する(ステップS52)。ここでは、累積誤差という考え方を用いている。具体的には、各予測計算式〔数式3〕〜〔数式6〕により算出された予測誤差の過去のサンプルについての累積値をA1〜A4として設定する。そして、この累積誤差A1〜A4のうち、最小となるものに対応する予測誤差を選出する。例えば、A1〜A4のうち、A2が最小であったとする。この場合、〔数式4〕で算出された予測誤差e2(t)を符号化対象とする予測誤差e(t)として選出することになる。選出された予測誤差e(t)はサンプルの元の値x(t)と置き換えられて以降処理が行われることになる。元のサンプルと区別するために予測誤差e(t)を記録したサンプルを誤差サンプルと呼ぶことにする。   Subsequently, the linear prediction error that minimizes the cumulative error, which is the cumulative absolute value of the prediction error value for each prediction calculation formula, is selected as the prediction error of the sample (step S52). Here, the concept of cumulative error is used. Specifically, the accumulated values of the past samples of the prediction error calculated by the respective prediction calculation formulas [Formula 3] to [Formula 6] are set as A1 to A4. Then, a prediction error corresponding to the smallest one of the accumulated errors A1 to A4 is selected. For example, it is assumed that A2 is the smallest among A1 to A4. In this case, the prediction error e2 (t) calculated by [Formula 4] is selected as the prediction error e (t) to be encoded. The selected prediction error e (t) is replaced with the original value x (t) of the sample, and the subsequent processing is performed. In order to distinguish from the original sample, the sample in which the prediction error e (t) is recorded is called an error sample.

続いて、累積誤差A1〜A4に各予測誤差e1(t)〜e4(t)の絶対値を加算する(ステップS53)。具体的には、以下の〔数式7〕に示すように、累積誤差値となる変数A1〜A4を更新していく。同時に、各サンプルの処理を行う度に、カウンタCを1つずつ加算していく処理を行う。なお、カウンタ変数Cは、線形予測誤差算出処理モジュール内で用いられるローカル変数であり、後述する他の処理においても用いられるが、これらは各々、各モジュール内で独立した変数である。   Subsequently, the absolute values of the prediction errors e1 (t) to e4 (t) are added to the accumulated errors A1 to A4 (step S53). Specifically, as shown in the following [Equation 7], the variables A1 to A4 that are accumulated error values are updated. At the same time, each time processing of each sample is performed, a process of incrementing the counter C one by one is performed. Note that the counter variable C is a local variable used in the linear prediction error calculation processing module, and is also used in other processes described later, but these are independent variables in each module.

〔数式7〕
A1←A1+|e1(t)|
A2←A2+|e2(t)|
A3←A3+|e3(t)|
A4←A4+|e4(t)|
C←C+1
[Formula 7]
A1 ← A1 + | e1 (t) |
A2 ← A2 + | e2 (t) |
A3 ← A3 + | e3 (t) |
A4 ← A4 + | e4 (t) |
C ← C + 1

続いて、カウンタが所定回数を超えたかどうかの判定を行う(ステップS54)。本実施形態では、この所定回数を100回として設定している。すなわち、カウンタCが100を超えたかどうかの判定を行う。   Subsequently, it is determined whether the counter has exceeded a predetermined number of times (step S54). In this embodiment, this predetermined number is set as 100 times. That is, it is determined whether or not the counter C exceeds 100.

この結果、カウンタが100を超えていたら、累積誤差を半分にする(ステップS55)。具体的には、以下の〔数式8〕に示すように、累積誤差となる変数A1〜A4を2で除算する。同時に、カウンタを0にリセットする。すなわち、ここでの変数A1〜A4も上記〔数式1〕、〔数式2〕におけるAo、Adと同様、純粋な意味での累積値ではなく、累積値の移動平均となっている。本実施形態では、直前の最大100サンプルまでは累積されるが、それ以前のものは半分になるように処理する。これにより、時間的に離れたサンプルの影響が小さくなるようにしている。   As a result, if the counter exceeds 100, the accumulated error is halved (step S55). Specifically, as shown in the following [Equation 8], variables A1 to A4 that are accumulated errors are divided by two. At the same time, the counter is reset to zero. That is, the variables A1 to A4 here are not accumulated values in a pure sense, but are moving averages of accumulated values, similarly to Ao and Ad in [Expression 1] and [Expression 2]. In the present embodiment, the maximum 100 samples immediately before are accumulated, but the previous ones are processed in half. Thereby, the influence of the sample separated in time is made small.

〔数式8〕
A1←(A1)/2
A2←(A2)/2
A3←(A3)/2
A4←(A4)/2
C←0
[Formula 8]
A1 ← (A1) / 2
A2 ← (A2) / 2
A3 ← (A3) / 2
A4 ← (A4) / 2
C ← 0

上記ステップS51〜ステップS55の処理を時系列信号中の全時刻全サンプルに渡って実行することにより、全サンプルの値が元の振幅値x(t)から対象誤差e(t)に置き換えられることになる。   By executing the processing of step S51 to step S55 over all samples at all times in the time series signal, the values of all samples are replaced with the target error e (t) from the original amplitude value x (t). become.

(2.2.7.極性処理)
続いて、図2のステップS60において、各誤差サンプルの正負極性処理を行う。上記ステップS40およびステップS50の処理により各サンプルの値は、Rチャンネルの値は、Lチャンネルとの差分に置き換えられるとともに、振幅値から予測誤差に置き換えられたが、各サンプルのビット形式は、当初のままである。通常、コンピュータ等の計算機で演算される場合は、各データは32ビット単位で処理され、2の補数表現を用いて表現されている。これを、正負の符号付き絶対値表現に変換し、なおかつ、その絶対値部分を上位に1ビット移動させ、正負の符号ビットをLSB(最下位ビット)に移動させる。ステップS60の極性処理によるビット構成の変換の様子を模式的に示すと図5のようになる。図5(a)は処理前のビット構成であり、図5(b)は処理後のビット構成である。このように正負の符号ビットをLSBに移動させるのは、後のステップS70における可変長符号化処理で、各誤差サンプルのビット長を検出し易くするためである。
(2.2.7. Polarity treatment)
Subsequently, in step S60 of FIG. 2, positive / negative polarity processing of each error sample is performed. As a result of the processing of step S40 and step S50, the value of each sample is replaced with the difference between the R channel value and the difference with the L channel, and the amplitude value is replaced with a prediction error. Remains. Normally, when being calculated by a computer such as a computer, each data is processed in units of 32 bits and expressed using a two's complement expression. This is converted into a positive / negative signed absolute value expression, and the absolute value portion is moved one bit higher, and the positive / negative sign bit is moved to LSB (least significant bit). FIG. 5 schematically shows how the bit structure is converted by the polarity processing in step S60. FIG. 5A shows a bit configuration before processing, and FIG. 5B shows a bit configuration after processing. The reason why the positive and negative code bits are moved to the LSB in this way is to make it easier to detect the bit length of each error sample in the variable-length encoding process in the subsequent step S70.

(2.2.8.サンプルの可変長符号化)
次に、図2のステップS70において、各誤差サンプルを可変長に変換する処理を行っていく。本実施形態における可変長符号化は、一般にゴロムライスと呼ばれる公知の方式を採用している。具体的には、1サンプルを構成するビット成分を上位ビット成分と下位ビット成分に分け、下位ビット成分は変更を加えずそのままとし、上位ビット成分は、上位ビットだけを十進数変換した数値分のビット「0」を並べ、最後にセパレータビット「1」を加えた配列とする。例えば、8ビットのビット成分「00101000」を考えてみる。このとき、下位ビット成分を4ビットとすると、下位ビット成分は「1000」となる。上位ビットは「0010」であるため、これを十進数変換した「2」個分の「0」を配列して最後に「1」を加えた「001」に変換される。この結果、8ビットのビット列「00101000」は、7ビットのビット列「0011000」に変換されることになる。本実施形態では、変換の前後でビット成分を不変とする下位ビット成分のビット長を各サンプルで可変とするようにしている。
(2.2.8. Variable length coding of samples)
Next, in step S70 of FIG. 2, a process for converting each error sample into a variable length is performed. The variable-length coding in this embodiment employs a known method generally called Golomurice. Specifically, the bit component constituting one sample is divided into an upper bit component and a lower bit component, the lower bit component is left unchanged, and the upper bit component is a numerical value obtained by decimal conversion of only the upper bit. It is an array in which bit “0” is arranged and separator bit “1” is added at the end. For example, consider an 8-bit bit component “00101000”. At this time, if the lower bit component is 4 bits, the lower bit component is “1000”. Since the upper bits are “0010”, “2” pieces of “0” obtained by decimal conversion are arranged and converted to “001” by adding “1” at the end. As a result, the 8-bit bit string “00101000” is converted into a 7-bit bit string “0011000”. In this embodiment, the bit length of the lower-order bit component that makes the bit component unchanged before and after conversion is made variable for each sample.

以下、ステップS70における可変長符号化処理を具体的に説明していく。図6は可変長符号化の概要を示すフローチャートである。まず、過去のサンプルのビット長の移動平均である平均ビット長Bfを算出する(ステップS71)。平均ビット長Bfは、過去のビット長の累積値である累積ビット長RBを、過去のサンプル数を基にしたカウンタCで除算することにより求められる。すなわち、Bf=RB/Cで算出される。累積ビット長RBは、初期状態では0であるので、t=1のサンプルを処理する場合には、t=1のサンプルのビット長Bd(t)を初期値として設定しておく。また、初期のカウンタC=1と設定する。   Hereinafter, the variable length encoding process in step S70 will be specifically described. FIG. 6 is a flowchart showing an outline of variable length coding. First, an average bit length Bf that is a moving average of the bit lengths of past samples is calculated (step S71). The average bit length Bf is obtained by dividing the cumulative bit length RB, which is the cumulative value of the past bit length, by the counter C based on the past number of samples. That is, Bf = RB / C. Since the accumulated bit length RB is 0 in the initial state, when processing a sample with t = 1, the bit length Bd (t) of the sample with t = 1 is set as an initial value. The initial counter C = 1 is set.

続いて、時刻tにおけるサンプルのビット長Bd(t)を算出する(ステップS72)。t=2以降のサンプルについては、平均ビット長Bfの算出後、サンプルのビット長Bd(t)を算出する。このビット長Bd(t)は、上記ステップS60における極性処理によりビット構成の変換を行ったことにより算出し易くなっている。図5(b)に示したようなビット構成に変換したことにより、各サンプルのビット構成において先頭にビット「1」が出現したところからがビット長となる。次に、変更部のビット長Bvを算出する(ステップS73)。これは、上記誤差サンプルのビット長Bd(t)から平均ビット長Bfを減じることにより算出される。続いて、データの符号出力を行う(ステップS74)。具体的には、上位Bvビットを十進数変換した数値分だけ「0」を出力した後、セパレータビット「1」を出力し、下位Bfビットを不変部として出力する。符号出力は、ハードディスク、CD−R等の外部記憶装置への記録として行われることになる。次に、累積ビット長RBにビット長Bd(t)を加算する(ステップS75)。同時に、各誤差サンプルの処理を行う度に、カウンタCを1つずつ加算していく処理を行う。続いて、カウンタCが所定の数を超えたかどうかを判定する(ステップS76)。所定の数としては、ここでも100程度を設定している。そのため、カウンタが100を超えたかどうかを判断することになる。この結果、カウンタが100を超えていたら、累積ビット長RBを半分にする(ステップS77)。具体的には、累積ビット長となる変数RBを2で除算する。同時に、カウンタCを1/2にする。   Subsequently, the bit length Bd (t) of the sample at time t is calculated (step S72). For samples after t = 2, after calculating the average bit length Bf, the bit length Bd (t) of the sample is calculated. This bit length Bd (t) is easily calculated by converting the bit configuration by the polarity processing in step S60. By converting to the bit configuration as shown in FIG. 5B, the bit length starts from the point where the bit “1” appears at the head in the bit configuration of each sample. Next, the bit length Bv of the changing unit is calculated (step S73). This is calculated by subtracting the average bit length Bf from the bit length Bd (t) of the error sample. Subsequently, the data code is output (step S74). Specifically, “0” is output for the numerical value obtained by decimal conversion of the upper Bv bits, then the separator bit “1” is output, and the lower Bf bits are output as the unchanged part. The code output is performed as recording to an external storage device such as a hard disk or a CD-R. Next, the bit length Bd (t) is added to the cumulative bit length RB (step S75). At the same time, every time each error sample is processed, the counter C is incremented by one. Subsequently, it is determined whether or not the counter C has exceeded a predetermined number (step S76). Here, about 100 is set as the predetermined number. Therefore, it is determined whether or not the counter exceeds 100. As a result, if the counter exceeds 100, the cumulative bit length RB is halved (step S77). Specifically, the variable RB that is the cumulative bit length is divided by two. At the same time, the counter C is halved.

上記のようにして、各サンプルについて可変ビット長での符号化が行われて行く。符号化により得られた可変長誤差サンプルは、可変長ビット列として記録媒体等に出力・記録される。   As described above, encoding with variable bit length is performed for each sample. The variable length error sample obtained by encoding is output and recorded on a recording medium or the like as a variable length bit string.

(3.1.復号装置の構成)
本発明に係る復号装置は、復号処理を行う専用のプログラムを、コンピュータに搭載することにより実現される。この専用プログラムを実行することにより、コンピュータに所定の処理を行わせ、コンピュータを復号装置として機能させるのである。
(3.1. Configuration of Decoding Device)
The decoding device according to the present invention is realized by mounting a dedicated program for performing decoding processing on a computer. By executing this dedicated program, the computer is caused to perform predetermined processing, and the computer is caused to function as a decoding device.

(3.2.復号処理概要)
続いて、本発明に係る復号装置の処理概要について説明していく。図7は、本発明に係る復号装置の処理概要を示すフローチャートである。まず、符号データを所定のビット列単位で読み込む(ステップS200)。この際、時系列信号が複数のチャンネルで構成される場合には、各チャンネルにつき所定のビット列ずつ読み込む。初期状態では、線形予測符号化モードとなっているため、読み込まれた可変長ビット列に対して、サンプルへの復号処理(ステップS230)、極性復元処理(ステップS240)、線形予測誤差復号処理(ステップS250)、チャンネル間復号処理(ステップS260)の各処理が行われて元のサンプルが復元され、サンプルが出力された(ステップS270)後、直前バッファに格納されていく(ステップS280)。直前バッファには、各チャンネルごとに5サンプルまで記録するようになっているので、サンプル番号0〜4までは、読み込んだサンプルを順番に記録していく。
(3.2. Overview of decoding process)
Subsequently, an outline of processing of the decoding apparatus according to the present invention will be described. FIG. 7 is a flowchart showing an outline of processing of the decoding apparatus according to the present invention. First, code data is read in units of a predetermined bit string (step S200). At this time, when the time-series signal is composed of a plurality of channels, a predetermined bit string is read for each channel. In the initial state, since the linear predictive coding mode is set, the sample decoding process (step S230), the polarity restoration process (step S240), and the linear prediction error decoding process (steps) are performed on the read variable length bit string. S250) Each process of the inter-channel decoding process (step S260) is performed to restore the original sample, and after the sample is output (step S270), it is stored in the immediately preceding buffer (step S280). Since up to 5 samples are recorded for each channel in the immediately preceding buffer, the read samples are recorded in order from sample numbers 0 to 4.

直前バッファに5サンプルが保存されたら、他の処理が開始される。まず、本装置の符号化モードがどのような状態であるかどうかを判断する(ステップS210)。具体的には、復号モードが線形予測符号化モードであるか、ランレングスモードであるかを判断する。復号装置においても、復号モードとして線形予測符号化モードとランレングスモードの2つが用意されているが、上述のように、初期状態では、線形予測符号化モードに設定されている。このため、直前バッファ内に5サンプルが格納された状態となっても、最初はステップS53に進むことになる。線形予測符号化モードの場合は、直前バッファ内に格納された5サンプルのうち最新の2サンプル(すなわち初期状態では先頭から4サンプル目と5サンプル目)の値が同一であるかどうかを判断する。同一でない場合には、ステップS54に進んで引き続き線形予測符号化モードで処理を行うことになる。復号モードが線形予測符号化モードである間は、読み込まれた可変長ビット列は、ステップS200〜ステップS280のループにおいて処理されることになる。   When 5 samples are stored in the previous buffer, other processing is started. First, it is determined what state the encoding mode of this apparatus is (step S210). Specifically, it is determined whether the decoding mode is a linear predictive coding mode or a run-length mode. In the decoding apparatus, two linear prediction encoding modes and a run length mode are prepared as decoding modes. As described above, in the initial state, the linear prediction encoding mode is set. For this reason, even if 5 samples are stored in the previous buffer, the process proceeds to step S53 at first. In the case of the linear predictive coding mode, it is determined whether the latest two samples (that is, the fourth and fifth samples from the beginning in the initial state) among the five samples stored in the immediately preceding buffer are the same. . If they are not the same, the process proceeds to step S54 and the process is continued in the linear predictive coding mode. While the decoding mode is the linear predictive coding mode, the read variable-length bit string is processed in the loop of step S200 to step S280.

(3.2.1.線形予測符号化モードからランレングスモードへの移行)
線形予測符号化モード(ステップS200〜ステップS280のループ)の状態で、ステップS220において、直前バッファ内で最新の2サンプルの値が一致した場合には、可変長ビット列からランレングスへの復号処理が行われる(ステップS290)。具体的には、メルコード方式で復号処理が行われる。続いて、復号モードが線形予測符号化モードから、ランレングスモードに切り換えられる(ステップS300)。これにより、復号処理が線形予測符号化モードからランレングスモードに移行して行われることになる。
(3.2.1. Transition from linear predictive coding mode to run-length mode)
In the state of linear predictive coding mode (loop from step S200 to step S280), in step S220, when the values of the latest two samples match in the immediately preceding buffer, the decoding process from the variable length bit string to the run length is performed. This is performed (step S290). Specifically, the decoding process is performed by the Mel code method. Subsequently, the decoding mode is switched from the linear predictive coding mode to the run length mode (step S300). As a result, the decoding process is performed by shifting from the linear predictive coding mode to the run-length mode.

(3.2.2.ランレングスモード)
ランレングスモードでは、まず、ランレングスが0より大きいかどうかを判定する(ステップS310)。ランレングスが0より大きい場合は、ランレングスをカウントダウンする(ステップS320)。具体的には、現在のランレングスを「1」だけ減少させることになる。同時に、そのランレングスに与えられているサンプル値を有するサンプルを1サンプル出力する。このサンプルはオーディオサンプルとして出力され、原デジタル音響信号のサンプルが復元され、サンプルの出力が行われる(ステップS270)。出力されたサンプルは、アナログ変換された後、増幅してスピーカーから音声として出力される。また、そのサンプルを直前バッファへも保存する(ステップS280)。そして、ステップS200に戻って可変長ビット列を読み込むことになる。この状態では、復号モードはランレングスモードとなっているので、ステップS210においては、ランレングスモードであると判定されてステップS310に進むことになる。復号モードがランレングスモードである間は、ランレングスが、ステップS200、S210、S310、S320、S270、S280のループにおいて処理されることになる。
(3.2.2. Run length mode)
In the run length mode, first, it is determined whether or not the run length is greater than 0 (step S310). If the run length is greater than 0, the run length is counted down (step S320). Specifically, the current run length is decreased by “1”. At the same time, one sample having a sample value given to the run length is output. This sample is output as an audio sample, the sample of the original digital sound signal is restored, and the sample is output (step S270). The output sample is analog-converted and then amplified and output as sound from the speaker. The sample is also saved in the immediately preceding buffer (step S280). Then, returning to step S200, the variable length bit string is read. In this state, since the decoding mode is the run-length mode, it is determined in step S210 that it is the run-length mode, and the process proceeds to step S310. While the decoding mode is the run length mode, the run length is processed in the loop of steps S200, S210, S310, S320, S270, and S280.

(3.2.3.ランレングスモードから線形予測符号化モードへの移行)
ランレングスモード(ステップS200、S210、S310、S320、S270、S280のループ)の状態で、ステップS310において、ランレングスが0以下となって場合は、復号モードをランレングスモードから、線形予測符号化モードに切り換える(ステップS330)。これにより、復号処理がランレングスモードから線形予測符号化モードに移行して行われることになる。続いて、可変長ビット列をサンプルに復号する(ステップS340)。具体的には、ゴロム符号化に対する復号処理が行われる。続いて、極性復元処理が行われる(ステップS350)。さらに、直前サンプルとの加算処理が行われる(ステップS360)。加算処理後のサンプルを復号されたサンプルとして出力する(ステップS270)。また、そのサンプルを直前バッファへも保存する(ステップS280)。
(3.2.3. Transition from run-length mode to linear predictive coding mode)
In the state of the run length mode (loop of steps S200, S210, S310, S320, S270, S280), if the run length is 0 or less in step S310, the decoding mode is changed from the run length mode to linear predictive coding. The mode is switched (step S330). As a result, the decoding process is performed from the run-length mode to the linear predictive coding mode. Subsequently, the variable length bit string is decoded into samples (step S340). Specifically, a decoding process for Golomb coding is performed. Subsequently, polarity restoration processing is performed (step S350). Further, an addition process with the immediately preceding sample is performed (step S360). The sample after the addition process is output as a decoded sample (step S270). The sample is also saved in the immediately preceding buffer (step S280).

(3.2.4.可変長ビット列の復号)
続いて、上記ステップS230からステップS260における各処理の詳細について説明する。ステップS230においては、読み込んだビット列のどの部分が変更部であるか、およびどの部分が不変部であるかを判断して、固定ビット長のサンプルを復元する。
(3.2.4. Decoding of variable length bit string)
Next, details of each process from step S230 to step S260 will be described. In step S230, it is determined which part of the read bit string is a change part and which part is an invariant part, and a fixed bit length sample is restored.

ステップS230における固定ビット長のサンプルへの復号処理の概要を図8のフローチャートに示す。まず、入力された符号データのビット列から変更部に相当するビット列を抽出し、固定長に復号する(ステップS231)。入力されたビット列は、先頭から0が続き、1が出現する。これは、上記符号化のときに、そのような規則で可変長符号化したためである。そのため、「1」が出現したときのビット列を、符号化時と逆の規則で復号する。例えば「0011000…」というビット列が来た場合に、最初に「1」が出現した「001」までを変更部と判断し、「0」が2個続いているので、「2」の二進数表現「0010」(4ビットの場合)に復号する。   The outline of the decoding process to the fixed bit length sample in step S230 is shown in the flowchart of FIG. First, a bit string corresponding to the changing unit is extracted from the bit string of the input code data, and is decoded to a fixed length (step S231). The input bit string is followed by 0 from the beginning and 1 appears. This is because variable length coding was performed according to such a rule at the time of the above coding. Therefore, the bit string when “1” appears is decoded according to a rule reverse to that at the time of encoding. For example, when a bit string “0011000...” Comes, it is determined that the first “1” appears up to “001” as a change part, and two “0” s continue. Decode into “0010” (in case of 4 bits).

次に、過去のサンプルのビット長の移動平均である平均ビット長Bfを算出する(ステップS232)。これは、上記可変長符号化のステップS71の処理と全く同じ処理である。続いて、不変部のビット列を抽出する(ステップS233)。これは、算出された平均ビット長Bf分のビット列を抽出することにより行う。例えば、上記のような「0011000…」というビット列で、「001」までが変更部であったとし、Bf=4であったとすると、続く「1000」が不変部として抽出される。   Next, an average bit length Bf, which is a moving average of the bit lengths of past samples, is calculated (step S232). This is exactly the same process as the process of step S71 of the variable length encoding. Subsequently, the bit string of the invariant part is extracted (step S233). This is performed by extracting a bit string corresponding to the calculated average bit length Bf. For example, in the bit string “0011000...” As described above, assuming that up to “001” is the changed part and Bf = 4, the subsequent “1000” is extracted as the invariant part.

続いて、ステップS231で復号された変更部のビット列とステップS233で抽出された不変部のビット列を連結して固定長のサンプルを出力する(ステップS234)。固定長に復元されたサンプルは、図7に示したステップS240の極性復元処理に出力される。次に、累積ビット長RBにビット長Bd(t)を加算する(ステップS235)。同時に、各サンプルの処理を行う度に、カウンタCを1つづつ加算していく処理を行う。続いて、カウンタCが所定の数を超えたかどうかを判定する(ステップS236)。所定の数としては、ここでも100程度を設定している。そのため、カウンタが100を超えたかどうかを判断することになる。この結果、カウンタが100を超えていたら、累積ビット長RBを半分にする(ステップS237)。具体的には、累積ビット長となる変数RBを2で除算する。同時に、カウンタCを1/2にする。ステップS235〜ステップS237の処理は、上記図6の可変長符号化におけるステップS75〜ステップS77の処理と全く同じである。   Subsequently, the bit string of the changing part decoded in step S231 and the bit string of the invariant part extracted in step S233 are connected to output a fixed-length sample (step S234). The sample restored to the fixed length is output to the polarity restoration process in step S240 shown in FIG. Next, the bit length Bd (t) is added to the cumulative bit length RB (step S235). At the same time, each time the processing of each sample is performed, a process of incrementing the counter C one by one is performed. Subsequently, it is determined whether or not the counter C has exceeded a predetermined number (step S236). Here, about 100 is set as the predetermined number. Therefore, it is determined whether or not the counter exceeds 100. As a result, if the counter exceeds 100, the cumulative bit length RB is halved (step S237). Specifically, the variable RB that is the cumulative bit length is divided by two. At the same time, the counter C is halved. The processing from step S235 to step S237 is exactly the same as the processing from step S75 to step S77 in the variable length coding of FIG.

ステップS230により固定長のサンプルが出力されたら、次に、ステップS240において、各誤差サンプルの正負極性を復元する。これは、上記符号化装置のステップS60において行った処理の逆を行うことになる。具体的には、正負の符号ビットをMSB(最下位ビット)に移動させ、絶対値部分を下位に1ビット移動させた後、正負の符号付き絶対値で表現されているサンプル値を2の補数を用いた表現に変換する。ステップS240によるビット構成の変換の様子を模式的に示すと図5(b)に示したビット構成から図5(a)に示したビット構成に変換することになる。ステップS240の処理によりコンピュータによる算術演算を行い易いビット構成となる。   If the sample of fixed length is output by step S230, next, in step S240, the positive / negative polarity of each error sample will be restored. This is the reverse of the processing performed in step S60 of the encoding device. Specifically, the sign bit of positive / negative is moved to the MSB (least significant bit), the absolute value part is moved down by 1 bit, and then the sample value expressed by the positive / negative signed absolute value is replaced with 2's complement. Convert to an expression using. When the state of the bit configuration conversion in step S240 is schematically shown, the bit configuration shown in FIG. 5B is converted to the bit configuration shown in FIG. By the processing in step S240, the bit configuration is easy to perform the arithmetic operation by the computer.

続いて、ステップS250において、予測誤差値が記録されている誤差サンプルの値を過去のサンプル値に依存しない独立した値に復元する。この独立したサンプルの復元処理の概要を図9のフローチャートに示す。まず、あらかじめ準備された複数の予測計算式のうち、どの予測計算式を適用するかを決定する(ステップS251)。予測計算式は、符号化時に利用された上記〔数式3〕〜〔数式6〕のいずれかを用いることになる。〔数式3〕〜〔数式6〕のいずれを選択するかについては、各予測式に対応した累積誤差値に基づいて行う。累積誤差A1〜A4は、符号化時に用いたものと同じであり、初期状態では全て0となる。   Subsequently, in step S250, the error sample value in which the prediction error value is recorded is restored to an independent value independent of the past sample value. The outline of the independent sample restoration process is shown in the flowchart of FIG. First, it is determined which prediction calculation formula is to be applied among a plurality of prediction calculation formulas prepared in advance (step S251). As the prediction calculation formula, any one of [Formula 3] to [Formula 6] used at the time of encoding is used. Which one of [Equation 3] to [Equation 6] is selected is based on the accumulated error value corresponding to each prediction equation. The accumulated errors A1 to A4 are the same as those used at the time of encoding, and are all 0 in the initial state.

上記〔数式3〕〜〔数式6〕において、e1(t)〜e4(t)は各予測計算式による時刻tのサンプルにおける予測誤差であり、x(t)〜x(t−4)は時刻t〜t−4における振幅値である。   In the above [Equation 3] to [Equation 6], e1 (t) to e4 (t) are prediction errors in the sample at time t according to each prediction calculation equation, and x (t) to x (t-4) are times. It is an amplitude value from t to t-4.

上述のように、上記〔数式4〕における「2×x(t−1)−x(t−2)」、上記〔数式5〕における「3×x(t−1)−3×x(t−2)+x(t−3)」、上記〔数式6〕における「4×x(t−1)−6×x(t−2)+4×x(t−3)−x(t−4)」は過去の2〜4個のサンプルに基づく線形予測成分である。この線形予測成分、および、直前のサンプルにおいて算出された予測誤差「e1(t−1)/2」〜「e4(t−1)/2」(誤差フィードバック成分)を用いて時刻tにおけるサンプルe(t)の値を、上記ステップS251で決定したいずれかの予測式にe1(t)〜e4(t)のいずれかとして代入し、x(t)を算出する(ステップS252)。   As described above, “2 × x (t−1) −x (t−2)” in [Expression 4] and “3 × x (t−1) −3 × x (t) in [Expression 5]. −2) + x (t−3) ”,“ 4 × x (t−1) −6 × x (t−2) + 4 × x (t−3) −x (t−4) ”in [Expression 6] above. "Is a linear prediction component based on the past 2-4 samples. Using this linear prediction component and the prediction errors “e1 (t−1) / 2” to “e4 (t−1) / 2” (error feedback component) calculated in the immediately preceding sample, the sample e at time t The value of (t) is substituted as any one of e1 (t) to e4 (t) into any prediction formula determined in step S251, and x (t) is calculated (step S252).

続いて、累積誤差A1〜A4に各予測誤差e1(t)〜e4(t)の絶対値を加算する(ステップS253)。具体的には、符号化装置においても用いた上記〔数式7〕に示したように、累積誤差値となる変数A1〜A4を更新していく。同時に、各サンプルの処理を行う度に、カウンタを1つづつ加算していく処理を行う。   Subsequently, the absolute values of the prediction errors e1 (t) to e4 (t) are added to the accumulated errors A1 to A4 (step S253). Specifically, as shown in [Formula 7] used in the encoding apparatus, the variables A1 to A4 that are accumulated error values are updated. At the same time, each time the processing of each sample is performed, a process of incrementing the counter by one is performed.

続いて、カウンタが所定回数を超えたかどうかの判定を行う(ステップS254)。本実施形態では、この所定回数を100回として設定している。すなわち、カウンタが100を超えたかどうかの判定を行う。   Subsequently, it is determined whether the counter has exceeded a predetermined number of times (step S254). In this embodiment, this predetermined number is set as 100 times. That is, it is determined whether or not the counter exceeds 100.

この結果、カウンタが100を超えていたら、累積誤差を半分にする(ステップS255)。具体的には、符号化装置においても用いた上記〔数式8〕に示したように、累積誤差となる変数A1〜A4を2で除算する。同時に、カウンタを0にリセットする。すなわち、ここでのA1〜A4は純粋な意味での累積誤差ではなく、累積誤差の移動平均となっている。本実施形態では、直前の最大100サンプルまでは累積されるが、それ以前のものは半分になるように処理する。これにより、時間的に離れたサンプルの影響が小さくなるようにしている。   As a result, if the counter exceeds 100, the accumulated error is halved (step S255). Specifically, as shown in the above [Equation 8] used in the encoding apparatus, the variables A1 to A4 that are accumulated errors are divided by two. At the same time, the counter is reset to zero. That is, A1 to A4 here are not cumulative errors in a pure sense, but are moving averages of cumulative errors. In the present embodiment, the maximum 100 samples immediately before are accumulated, but the previous ones are processed in half. Thereby, the influence of the sample separated in time is made small.

上記ステップS251〜ステップS255の処理を読み込んだ全誤差サンプルに対して実行することにより、全サンプルの値が元の予測誤差e(t)から振幅値x(t)に復元されることになる。   By executing the processes in steps S251 to S255 on all the error samples that have been read, the values of all the samples are restored from the original prediction error e (t) to the amplitude value x (t).

次にステップS260において、Rチャンネルのサンプルの値をLチャンネルのサンプルとの差分値から元に戻す処理を行う。このチャンネル間復号処理の概要を図10のフローチャートに示す。まず、ステップS250による予測誤差から復元後のサンプルを読み込む(ステップS261)。読み込んだサンプルがLチャンネルのものであれば、サンプルの値を基準チャンネルメモリに格納すると共に、次のステップS270に出力する(ステップS262)。一方、読み込んだサンプルがRチャンネルのものであれば、ステップS263以降の処理を行う。なお、サンプルは、上記符号化装置のチャンネル間演算処理の場合と同様、各チャンネルのものが交互に読み込まれるので、判断を行う必要はない。例えば、サンプル番号t=1のLチャンネルのサンプルを読み込んだら、次はサンプル番号t=1のRチャンネルのサンプル、その次は、サンプル番号t=2のLチャンネルのサンプルというように順番が決まっているので、交互にステップS262の処理とステップS263以降の処理とを切替えるようにすれば良い。   Next, in step S260, a process for restoring the value of the R channel sample from the difference value with the L channel sample is performed. An outline of this inter-channel decoding process is shown in the flowchart of FIG. First, the restored sample is read from the prediction error in step S250 (step S261). If the read sample is for the L channel, the value of the sample is stored in the reference channel memory and is output to the next step S270 (step S262). On the other hand, if the read sample is for the R channel, the processing from step S263 is performed. Note that, as in the case of the inter-channel calculation processing of the encoding device, samples for each channel are alternately read, so there is no need to make a determination. For example, when an L channel sample with a sample number t = 1 is read, the next is an R channel sample with a sample number t = 1, and the next is an L channel sample with a sample number t = 2. Therefore, the process of step S262 and the process after step S263 may be switched alternately.

Rチャンネルのサンプルの場合は、変数AoとAdの比較を行う(ステップS263)。ここで、AoはRチャンネルのサンプル値の絶対値の累積であり、AdはRチャンネルとLチャンネルのサンプル値の差分の絶対値の累積である。変数Ao、Ad共に初期値は0である。ステップS263において、Ad≧Aoであれば、Rチャンネルのサンプルをそのままの値で、次のステップS270に出力する(ステップS264)。さらに、以下の〔数式9〕の第1式(Ao←Ao+|eR|)の処理を行う。ステップS263において、Sd<Soであれば、Ad←Ad+|eR|の処理を行った後、基準チャンネルメモリに格納されているLチャンネルのサンプルとの和を算出し、和を次のステップS270に出力する(ステップS265)。なお、変数AoとAdは、上記符号化装置のチャンネル間演算処理において用いられているものと同様の働きをするため、同一名の変数としている。特に、〔数式9〕の第2式においては、〔数式1〕の第2式と異なり、変数Adに、両チャンネルのサンプル値の差分ではなく、Rチャンネルのサンプル値の絶対値を加えている。これは、復号装置は、符号化装置により差分演算処理されたRチャンネルのサンプルを処理するためである。すなわち、符号データのRチャンネルのサンプルの値は、RチャンネルとLチャンネルの差分値が記録されているために〔数式9〕の第2式の処理を行っているが、〔数式1〕の第2式と同様の処理を行っていることになる。 In the case of the R channel sample, the variables Ao and Ad are compared (step S263). Here, Ao is the accumulation of absolute values of the sample values of the R channel, and Ad is the accumulation of absolute values of the differences between the sample values of the R channel and the L channel. The initial values of both variables Ao and Ad are 0. In step S263, if Ad ≧ Ao, the R channel sample is output as it is to the next step S270 (step S264). Further, the processing of the first equation (Ao ← Ao + | e R |) of the following [Equation 9] is performed. In step S263, if Sd <So, the process of Ad ← Ad + | e R | is performed, and then the sum with the sample of the L channel stored in the reference channel memory is calculated, and the sum is calculated in the next step S270. (Step S265). The variables Ao and Ad have the same name because they function in the same manner as those used in the inter-channel calculation process of the encoding device. In particular, in the second formula of [Formula 9], unlike the second formula of [Formula 1], the absolute value of the sample value of the R channel is added to the variable Ad, not the difference between the sample values of both channels. . This is because the decoding apparatus processes the sample of the R channel that has been subjected to the difference calculation process by the encoding apparatus. That is, since the difference value between the R channel and the L channel is recorded, the value of the sample of the R channel of the code data is processed by the second equation of [Equation 9]. The same processing as that of Formula 2 is performed.

続いて、L、Rの1対のサンプルを処理したことを示すカウンタCを1つ加算する(ステップS266)。   Subsequently, one counter C indicating that a pair of samples of L and R has been processed is added (step S266).

〔数式9〕
Ao←Ao+|eR
Ad←Ad+|eR
[Formula 9]
Ao ← Ao + | e R |
Ad ← Ad + | e R |

続いて、カウンタが所定回数を超えたかどうかの判定を行う(ステップS267)。本実施形態では、この所定回数を100回として設定している。すなわち、カウンタが100を超えたかどうかの判定を行う。   Subsequently, it is determined whether the counter has exceeded a predetermined number of times (step S267). In this embodiment, this predetermined number is set as 100 times. That is, it is determined whether or not the counter exceeds 100.

この結果、カウンタが100を超えていたら、累積値Ao、Adを半分にする(ステップS268)。具体的には、上記符号化装置において用いた〔数式2〕に示したように、絶対値の累積となる変数Ao、Adを2で除算する。同時に、カウンタCも半分にリセットする。すなわち、ここでの変数Ao、Adも上記A1〜A4と同様、純粋な意味での累積値ではなく、累積値の移動平均となっている。本実施形態では、直前の最大100サンプルまでは累積されるが、それ以前のものは半分になるように処理する。これにより、時間的に離れたサンプルの影響が小さくなるようにしている。   As a result, if the counter exceeds 100, the accumulated values Ao and Ad are halved (step S268). Specifically, as shown in [Formula 2] used in the encoding apparatus, the variables Ao and Ad that are accumulated absolute values are divided by two. At the same time, the counter C is reset to half. That is, the variables Ao and Ad here are not cumulative values in a pure sense, but are moving averages of cumulative values, as in A1 to A4. In the present embodiment, the maximum 100 samples immediately before are accumulated, but the previous ones are processed in half. Thereby, the influence of the sample separated in time is made small.

上記ステップS261〜ステップS268の処理を時系列信号中の全時刻全サンプルに渡って実行することにより、Rチャンネルの全サンプルの値が、Lチャンネルとの差分値からRチャンネル独自の値に復元されることになる。Lチャンネルのサンプルは、符号化時のチャンネル間演算処理においても変更されないので、復号時のチャンネル復元の際には、そのままの値で出力されることになる。   By executing the processing of step S261 to step S268 over all samples at all times in the time-series signal, the values of all samples of the R channel are restored to the values unique to the R channel from the difference values from the L channel. Will be. Since the L channel samples are not changed in the inter-channel calculation process at the time of encoding, the values are output as they are when the channel is restored at the time of decoding.

上記のようにして、原デジタル音響信号のサンプルが復元され、ステップS270においてサンプルの出力が行われる。出力されたサンプルは、アナログ変換された後、増幅してスピーカーから音声として出力される。   As described above, the sample of the original digital sound signal is restored, and the sample is output in step S270. The output sample is analog-converted and then amplified and output as sound from the speaker.

(4.ニアロスレス型の符号化)
以上、ロスレス型の符号化および復号について説明したが、一部の処理を変更することによりニアロスレス型とすることもできる。以下に、ニアロスレス型について説明する。図11は、本発明に係る符号化方法のニアロスレス型の場合の処理概要を示すフローチャートである。図11のフローチャートは、大部分が図2のフローチャートと同じであり、違いは、ステップS150とステップS160が追加されている点である。また、ステップS30およびステップS100における処理も若干異なっている。そのため、ここでは、ステップS30、S100、S150、S160の処理についてのみ説明する。
(4. Near lossless coding)
The lossless type encoding and decoding have been described above. However, a near lossless type can be obtained by changing some processes. The near lossless type will be described below. FIG. 11 is a flowchart showing an outline of processing in the case of the near lossless type encoding method according to the present invention. The flowchart in FIG. 11 is mostly the same as the flowchart in FIG. 2, and the difference is that step S150 and step S160 are added. Further, the processes in step S30 and step S100 are slightly different. For this reason, only the processes of steps S30, S100, S150, and S160 will be described here.

ステップS30では、図2に示したロスレス型の場合、直前バッファ内に格納された5サンプルのうち最新の2サンプルが完全に同じ値の場合に一致するものとしたが、図11に示すニアロスレス型の場合、直前バッファ内に格納された5サンプルのうち最新の2サンプルの差が許容値内であれば、一致するものと判断する。例えば、差が±1程度の場合は、一致するものと設定しておく。   In step S30, in the case of the lossless type shown in FIG. 2, it is assumed that the latest two samples out of the five samples stored in the previous buffer have the same value, but the near lossless type shown in FIG. In this case, if the difference between the two latest samples among the five samples stored in the immediately preceding buffer is within the allowable value, it is determined that they match. For example, if the difference is about ± 1, it is set to match.

ステップS100でも、図2に示したロスレス型の場合、まだ直前バッファに格納されていない現サンプルの値と、直前バッファに格納された5サンプルのうち最新のサンプルの値が同一である場合に、ランが継続すると判断したが、図11に示すニアロスレス型の場合、まだ直前バッファに格納されていない現サンプルの値と、直前バッファに格納された5サンプルのうち最新のサンプルの値の差が許容値内であれば、ランが継続するものと判断する。ここでも、例えば、差が±1程度の場合は、一致するものと設定しておく。   Even in step S100, in the case of the lossless type shown in FIG. 2, when the value of the current sample not yet stored in the previous buffer and the value of the latest sample among the five samples stored in the previous buffer are the same, In the case of the near lossless type shown in FIG. 11, the difference between the value of the current sample not yet stored in the previous buffer and the value of the latest sample among the five samples stored in the previous buffer is acceptable. If it is within the value, it is determined that the run will continue. Again, for example, if the difference is about ± 1, it is set to match.

ステップS150においては、上記ステップS50において算出された予測誤差値e(t)を利用して、誤差を補正する。具体的には、以下の〔数式10〕を用いて誤差を縮小する補正を行う。   In step S150, the error is corrected using the prediction error value e (t) calculated in step S50. Specifically, correction for reducing the error is performed using the following [Equation 10].

〔数式10〕
e´(t)=[(e(t)+Vn)/K]
なお、K=(2Vn+1)
[Formula 10]
e ′ (t) = [(e (t) + Vn) / K]
K = (2Vn + 1)

なお、〔数式10〕において、Vnは、1以上の整数値を示している。実際には、量子化ビット数でとり得る最大値の2%程度が好ましい。そのため、本実施形態では、量子化ビット数16ビットでとり得る最大値32767の2%程度、すなわち、Vnを650程度するのが好ましい。また、〔数式10〕において、[]は、括弧内の値を超えない最大の整数を意味し、したがってe´(t)は整数値であることを示している。このようにして、予測誤差値e(t)を縮小した縮小誤差値e´(t)が得られる。   In [Formula 10], Vn represents an integer value of 1 or more. Actually, about 2% of the maximum value that can be taken by the number of quantization bits is preferable. Therefore, in the present embodiment, it is preferable that the maximum value 32767 that can be taken with 16 quantization bits is about 2%, that is, Vn is about 650. In [Formula 10], [] means the maximum integer that does not exceed the value in parentheses, and thus e ′ (t) indicates an integer value. In this way, a reduced error value e ′ (t) obtained by reducing the prediction error value e (t) is obtained.

ここで、図11の流れで符号化を行うと、各サンプルごとに、現サンプルが復号化される値は、最大Vnの範囲でオリジナル値と相違が生じる。もし、後続するステップS80において、図2のように、現サンプルのオリジナル値をそのまま直前バッファに格納すると、次のサンプルが復号化される値のオリジナル値との誤差は2Vnの範囲に拡大し、以後各サンプルの復号化処理を繰り返すごとに誤差が拡大することになる。そこで、ステップS80の直前に、ステップS160の現サンプルの補正処理を挿入し、本ステップS160では、現サンプルの値が、後続するステップS80において直前バッファに格納される際に、現サンプルのオリジナル値ではなく、後述する手法で復号化された際に、現サンプルが復号化される値になるように補正を行う。具体的には、線形予測符号化モードの場合、現サンプルのオリジナル値x(t)に対して、〔数式11〕のx´(t)に変換するような補正を行う。   Here, when encoding is performed according to the flow of FIG. 11, the value at which the current sample is decoded differs from the original value in the range of maximum Vn for each sample. If the original value of the current sample is stored in the previous buffer as it is as shown in FIG. 2 in the subsequent step S80, the error from the original value of the value to which the next sample is decoded is expanded to a range of 2Vn. Thereafter, each time the decoding process for each sample is repeated, the error increases. Therefore, the current sample correction process of step S160 is inserted immediately before step S80, and in this step S160, when the value of the current sample is stored in the immediately preceding buffer in the subsequent step S80, the original value of the current sample is stored. Instead, correction is performed so that the current sample becomes a value to be decoded when it is decoded by a method described later. Specifically, in the case of the linear predictive coding mode, correction is performed such that the original value x (t) of the current sample is converted to x ′ (t) in [Formula 11].

〔数式11〕
x´(t)=x(t)+e´(t)・K−e(t)
なお、K=(2Vn+1)
[Formula 11]
x ′ (t) = x (t) + e ′ (t) · K−e (t)
K = (2Vn + 1)

また、ランレングスモードの場合、直前と同一の値に補正して、補正された値で現サンプルを直前バッファに格納する。   In the case of the run length mode, the current sample is corrected to the same value as immediately before, and the current sample is stored in the previous buffer with the corrected value.

(5.ニアロスレス型の復号)
次に、上記ニアロスレス型の符号化により得られた符号データを復号するためのニアロスレス型の復号について説明する。図12は、本発明に係る復号方法のニアロスレス型の場合の処理概要を示すフローチャートである。図12のフローチャートは、大部分が図7のフローチャートと同じであり、違いは、ステップS370が追加されている点である。そのため、ここでは、ステップ370の処理についてのみ説明する。
(5. Near lossless decoding)
Next, near-lossless decoding for decoding code data obtained by the near-lossless encoding will be described. FIG. 12 is a flowchart showing an outline of processing in the case of the near lossless type decoding method according to the present invention. The flowchart of FIG. 12 is mostly the same as the flowchart of FIG. 7, and the difference is that step S370 is added. Therefore, only the process of step 370 will be described here.

ステップS370においては、ステップS240において、復元された縮小誤差値e´(t)に対して、下記〔数式12〕を用いて予測誤差値e(t)を復元する。   In step S370, the prediction error value e (t) is restored using the following [Equation 12] with respect to the restored reduction error value e ′ (t) in step S240.

〔数式12〕
e(t)=e´(t)・K
なお、K=(2Vn+1)
[Formula 12]
e (t) = e ′ (t) · K
K = (2Vn + 1)

(6.符号化装置および復号装置による符号化復号システム)
以上、本発明に係る符号化装置および復号装置について説明したが、上記符号化装置および復号装置間をデータ通信可能に接続し、符号化復号システムを構成することができる。具体的には、符号化装置に、符号データを復号装置に送信する機能を持たせ、復号装置に、符号化装置から送信された符号データを受信する機能を持たせる。これらは、各符号化装置、復号装置を構成する各コンピュータに、データ通信用の機器およびソフトウェアを搭載することにより実現される。
(6. Coding / decoding system using coding device and decoding device)
As described above, the encoding device and the decoding device according to the present invention have been described. However, the encoding device and the decoding device can be connected to each other so as to be able to perform data communication. Specifically, the encoding device is provided with a function of transmitting code data to the decoding device, and the decoding device is provided with a function of receiving code data transmitted from the encoding device. These are realized by installing data communication equipment and software in each computer constituting each encoding device and decoding device.

符号化復号システムにおける符号化装置と復号装置の間を一般の通信回線で結ぶことにより、符号化装置で圧縮符号化した符号データを、復号装置でほぼリアルタイムに復号して再生することができる。これにより、音声データのストリーミング配信を行う場合に、通信回線の容量を考慮せずに、大容量のデータを送信することが可能となる。   By connecting the encoding device and the decoding device in the encoding / decoding system via a general communication line, the code data compression-encoded by the encoding device can be decoded and reproduced almost in real time by the decoding device. As a result, when streaming audio data is distributed, it is possible to transmit a large amount of data without considering the capacity of the communication line.

本発明において処理対象とするデジタル時系列信号のサンプル列を模式的に示した図である。It is the figure which showed typically the sample sequence of the digital time series signal made into the processing target in this invention. 本発明に係る時系列信号の符号化装置の処理概要を示すフローチャートである。It is a flowchart which shows the process outline | summary of the encoding apparatus of the time series signal which concerns on this invention. チャンネル間相関処理(S40)の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of the correlation process between channels (S40). 線形予測誤差算出処理(S50)の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of a linear prediction error calculation process (S50). 極性処理の様子を示す図である。It is a figure which shows the mode of a polarity process. 可変長符号化処理(S70)の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of a variable-length-coding process (S70). 本発明の符号化装置により得られた符号データの復号処理の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of the decoding process of the code data obtained by the encoding apparatus of this invention. 固定長サンプルへの復号処理(S230)の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of the decoding process (S230) to a fixed length sample. 予測誤差からの復号処理(S250)の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of the decoding process (S250) from a prediction error. チャンネル間の復号処理(S260)の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of the decoding process (S260) between channels. 本発明の符号化装置によるニアロスレス符号化の処理概要を示すフローチャートである。It is a flowchart which shows the process outline | summary of the near lossless encoding by the encoding apparatus of this invention. ニアロスレス符号化された符号データの復号処理の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of the decoding process of the code data by which the near lossless encoding was carried out.

Claims (10)

時系列のサンプル列で構成される時系列信号に対して、前記サンプル列を再現できるように情報量を圧縮する符号化装置であって、
前記サンプル列よりサンプルを順次読み込むサンプル入力手段と、
前記サンプルを時系列に所定の個数だけ格納するバッファメモリである直前バッファと、
前記直前バッファに格納されているサンプルを用いて、ランレングス符号化を行うか、線形予測符号化を行うかの符号化モードを判定する符号化モード判定手段と、
前記符号化モード判定手段により符号化モードとしてランレングス符号化が選択された場合、前記サンプル入力手段で取り込まれたサンプルと前記直前バッファに格納されている最新のサンプルとを比較することによりランレングスデータを算出するランレングス算出手段と、
前記符号化モード判定手段により符号化モードとして線形予測符号化が選択された場合、前記直前バッファに格納されている複数のサンプルを用いて線形予測誤差を算出する予測誤差算出手段と、
前記サンプル入力手段で取り込まれたサンプルを前記直前バッファに書き込み、最も過去に位置するサンプルを前記直前バッファより削除する直前バッファ更新手段と、
前記ランレングスデータおよび前記線形予測誤差に対して可変長で符号化を行う可変長符号化手段と、
前記符号化されたデータを出力する符号出力手段と、
前記各手段を制御して前記サンプル列のサンプルを符号出力する符号化処理制御手段と、を有し、
前記時系列のサンプル列が複数のチャンネルで構成されており、前記サンプル入力手段は、各チャンネルについて1つずつサンプルの入力を行うものであり、前記直前バッファ、前記符号化モード判定手段、前記ランレングス算出手段、前記予測誤差算出手段、前記直前バッファ更新手段、前記可変長符号化手段は前記チャンネル数と同数のサンプル単位で処理を行うものであることを特徴とする時系列信号の符号化装置。
An encoding device that compresses the amount of information so that the sample sequence can be reproduced with respect to a time-series signal composed of time-series sample sequences,
Sample input means for sequentially reading samples from the sample sequence;
A previous buffer that is a buffer memory for storing a predetermined number of samples in time series, and
Using a sample stored in the immediately preceding buffer, encoding mode determination means for determining an encoding mode for performing run-length encoding or linear predictive encoding;
When run-length encoding is selected as the encoding mode by the encoding mode determining means, the run length is determined by comparing the sample fetched by the sample input means with the latest sample stored in the immediately preceding buffer. A run length calculating means for calculating data;
When linear prediction encoding is selected as the encoding mode by the encoding mode determination unit, a prediction error calculation unit that calculates a linear prediction error using a plurality of samples stored in the immediately preceding buffer;
A previous buffer update unit for writing a sample taken in by the sample input unit to the previous buffer, and deleting a sample located in the past in the previous buffer;
Variable-length encoding means for encoding the run-length data and the linear prediction error with a variable length;
Code output means for outputting the encoded data;
Have a, a coding control means for code output samples of the sample series by controlling the respective means,
The time-series sample string is composed of a plurality of channels, and the sample input means inputs one sample for each channel, and the immediately preceding buffer, the encoding mode determination means, the run length calculating means, the prediction error calculating means, wherein the immediately preceding buffer updating unit, wherein the variable length coding means coding a time-series signal, wherein der Rukoto performs processing in sample units as many as the number of the channel apparatus.
請求項において、
前記予測誤差算出手段の前段にチャンネル間演算手段を設け、前記チャンネル間のサンプル同士で所定の演算を施したデータを前記予測誤差算出手段に渡すようにしていることを特徴とする時系列信号の符号化装置。
In claim 1 ,
An inter-channel operation means is provided in the preceding stage of the prediction error calculation means, and data obtained by performing a predetermined operation between samples between the channels is passed to the prediction error calculation means. Encoding device.
時系列のサンプル列で構成される時系列信号に対して、前記サンプル列を再現できるように情報量を圧縮する符号化装置であって、
前記サンプル列よりサンプルを順次読み込むサンプル入力手段と、
前記サンプルを時系列に所定の個数だけ格納するバッファメモリである直前バッファと、
前記直前バッファに格納されているサンプルを用いて、ランレングス符号化を行うか、線形予測符号化を行うかの符号化モードを判定し、符号化モードがランレングス符号化に設定されている場合は何もせず、線形予測符号化に設定されている場合に、前記直前バッファに格納されているサンプルのうち最新の2サンプルが同一の値である場合、符号化モードをランレングス符号化に切り換え、前記ランレングスデータを0に初期化する符号化モード判定手段と、
前記符号化モード判定手段により符号化モードとしてランレングス符号化が選択された場合、前記サンプル入力手段で取り込まれたサンプルと前記直前バッファに格納されている最新のサンプルとを比較することによりランレングスデータを算出するランレングス算出手段と、
前記符号化モード判定手段により符号化モードとして線形予測符号化が選択された場合、前記直前バッファに格納されている複数のサンプルを用いて線形予測誤差を算出する予測誤差算出手段と、
前記サンプル入力手段で取り込まれたサンプルを前記直前バッファに書き込み、最も過去に位置するサンプルを前記直前バッファより削除する直前バッファ更新手段と、
前記ランレングスデータおよび前記線形予測誤差に対して可変長で符号化を行う可変長符号化手段と、
前記符号化されたデータを出力する符号出力手段と、
前記各手段を制御して前記サンプル列のサンプルを符号出力する符号化処理制御手段と、
を有することを特徴とする時系列信号の符号化装置。
An encoding device that compresses the amount of information so that the sample sequence can be reproduced with respect to a time-series signal composed of time-series sample sequences,
Sample input means for sequentially reading samples from the sample sequence;
A previous buffer that is a buffer memory for storing a predetermined number of samples in time series, and
When the sample stored in the immediately preceding buffer is used to determine the encoding mode for performing run-length encoding or linear predictive encoding, and the encoding mode is set to run-length encoding If nothing is set and linear prediction encoding is set, and the latest two samples among the samples stored in the previous buffer have the same value, the encoding mode is switched to run-length encoding. Encoding mode determination means for initializing the run length data to 0 ;
When run-length encoding is selected as the encoding mode by the encoding mode determining means, the run length is determined by comparing the sample fetched by the sample input means with the latest sample stored in the immediately preceding buffer. A run length calculating means for calculating data;
When linear prediction encoding is selected as the encoding mode by the encoding mode determination unit, a prediction error calculation unit that calculates a linear prediction error using a plurality of samples stored in the immediately preceding buffer;
A previous buffer update unit for writing a sample taken in by the sample input unit to the previous buffer, and deleting a sample located in the past in the previous buffer;
Variable-length encoding means for encoding the run-length data and the linear prediction error with a variable length;
Code output means for outputting the encoded data;
Encoding processing control means for controlling each of the means to code-output samples of the sample sequence;
A time-series signal encoding apparatus comprising:
時系列のサンプル列で構成される時系列信号に対して、前記サンプル列を再現できるように情報量を圧縮する符号化装置であって、
前記サンプル列よりサンプルを順次読み込むサンプル入力手段と、
前記サンプルを時系列に所定の個数だけ格納するバッファメモリである直前バッファと、
前記直前バッファに格納されているサンプルを用いて、ランレングス符号化を行うか、線形予測符号化を行うかの符号化モードを判定する符号化モード判定手段と、
前記符号化モード判定手段により符号化モードとしてランレングス符号化が選択された場合、前記サンプル入力手段で取り込まれたサンプルと前記直前バッファに格納されている最新のサンプルとを比較することによりランレングスデータを算出するランレングス算出手段と、
前記符号化モード判定手段により符号化モードとして線形予測符号化が選択された場合、前記直前バッファに格納されている複数のサンプルを用いて線形予測誤差を算出する予測誤差算出手段と、
前記サンプル入力手段で取り込まれたサンプルを前記直前バッファに書き込み、最も過去に位置するサンプルを前記直前バッファより削除する直前バッファ更新手段と、
前記ランレングスデータに対して可変長で符号化を行う第1の可変長符号化手段と、
記線形予測誤差に対して可変長で符号化を行う第2の可変長符号化手段と、
前記符号化されたデータを出力する符号出力手段と、
前記各手段を制御して前記サンプル列のサンプルを符号出力する符号化処理制御手段と、を有し、
前記ランレングス算出手段は、前記サンプル入力手段で取り込まれたサンプルと、前記直前バッファに格納されている最新のサンプルが同一の場合に、ランレングスデータに1を増加させるようにし、そうでない場合は、ランレングスデータを前記第1の可変長符号化手段に渡すとともに、前記サンプル入力手段で取り込まれたサンプルと、前記直前バッファに格納されている最新のサンプルとの差分値を予測誤差値として前記第2の可変長符号化手段に渡し、符号化モードを線形予測符号化に切り換えるものであることを特徴とする時系列信号の符号化装置。
An encoding device that compresses the amount of information so that the sample sequence can be reproduced with respect to a time-series signal composed of time-series sample sequences,
Sample input means for sequentially reading samples from the sample sequence;
A previous buffer that is a buffer memory for storing a predetermined number of samples in time series, and
Using a sample stored in the immediately preceding buffer, encoding mode determination means for determining an encoding mode for performing run-length encoding or linear predictive encoding;
When run-length encoding is selected as the encoding mode by the encoding mode determining means, the run length is determined by comparing the sample fetched by the sample input means with the latest sample stored in the immediately preceding buffer. A run length calculating means for calculating data;
When linear prediction encoding is selected as the encoding mode by the encoding mode determination unit, a prediction error calculation unit that calculates a linear prediction error using a plurality of samples stored in the immediately preceding buffer;
A previous buffer update unit for writing a sample taken in by the sample input unit to the previous buffer, and deleting a sample located in the past in the previous buffer;
A first variable length coding means for coding a variable length for the run length data,
A second variable length coding means for coding a variable length for the previous SL line forms prediction error,
Code output means for outputting the encoded data;
Have a, a coding control means for code output samples of the sample series by controlling the respective means,
The run length calculation means increases the run length data by 1 when the sample taken in by the sample input means is the same as the latest sample stored in the immediately preceding buffer, otherwise The run length data is passed to the first variable length encoding means, and the difference value between the sample fetched by the sample input means and the latest sample stored in the immediately preceding buffer is used as the prediction error value. An apparatus for encoding a time-series signal, characterized in that it is passed to a second variable length encoding means and the encoding mode is switched to linear predictive encoding .
時系列のサンプル列で構成される時系列信号に対して、前記サンプル列を再現できるように情報量を圧縮する符号化装置であって、
前記サンプル列よりサンプルを順次読み込むサンプル入力手段と、
前記サンプルを時系列に所定の個数だけ格納するバッファメモリである直前バッファと、
前記直前バッファに格納されているサンプルを用いて、ランレングス符号化を行うか、線形予測符号化を行うかの符号化モードを判定する符号化モード判定手段と、
前記符号化モード判定手段により符号化モードとしてランレングス符号化が選択された場合、前記サンプル入力手段で取り込まれたサンプルと前記直前バッファに格納されている最新のサンプルとを比較することによりランレングスデータを算出するランレングス算出手段と、
前記符号化モード判定手段により符号化モードとして線形予測符号化が選択された場合、前記直前バッファに格納されている複数のサンプルを用いて線形予測誤差を算出する予測誤差算出手段と、
前記予測誤差データに対して1以上の値である係数で除算し、前記予測誤差データの絶対値を小さくする補正を行うともに、前記サンプル入力手段で取り込まれたサンプルに対して、前記補正された予測誤差データに前記係数を乗算した値に、前記予測誤差データとの差分を加算する補正を行い、前記直前バッファに対して、前記補正されたサンプルを格納する予測誤差補正手段と、
前記サンプル入力手段で取り込まれたサンプルを前記直前バッファに書き込み、最も過去に位置するサンプルを前記直前バッファより削除する直前バッファ更新手段と、
前記ランレングスデータおよび前記線形予測誤差に対して可変長で符号化を行う可変長符号化手段と、
前記符号化されたデータを出力する符号出力手段と、
前記各手段を制御して前記サンプル列のサンプルを符号出力する符号化処理制御手段と、
を有することを特徴とする時系列信号の符号化装置。
An encoding device that compresses the amount of information so that the sample sequence can be reproduced with respect to a time-series signal composed of time-series sample sequences,
Sample input means for sequentially reading samples from the sample sequence;
A previous buffer that is a buffer memory for storing a predetermined number of samples in time series, and
Using a sample stored in the immediately preceding buffer, encoding mode determination means for determining an encoding mode for performing run-length encoding or linear predictive encoding;
When run-length encoding is selected as the encoding mode by the encoding mode determining means, the run length is determined by comparing the sample fetched by the sample input means with the latest sample stored in the immediately preceding buffer. A run length calculating means for calculating data;
When linear prediction encoding is selected as the encoding mode by the encoding mode determination unit, a prediction error calculation unit that calculates a linear prediction error using a plurality of samples stored in the immediately preceding buffer;
The prediction error data is corrected by dividing the prediction error data by a coefficient that is 1 or more to reduce the absolute value of the prediction error data, and the correction is performed on the sample taken in by the sample input means. A prediction error correction means for performing correction for adding a difference from the prediction error data to a value obtained by multiplying the prediction error data by the coefficient, and storing the corrected sample in the immediately preceding buffer;
A previous buffer update unit for writing a sample taken in by the sample input unit to the previous buffer, and deleting a sample located in the past in the previous buffer;
Variable-length encoding means for encoding the run-length data and the linear prediction error with a variable length;
Code output means for outputting the encoded data;
Encoding processing control means for controlling each of the means to code-output samples of the sample sequence;
A time-series signal encoding apparatus comprising:
時系列のサンプル列で構成される時系列信号に対して、前記サンプル列を再現できるように情報量を圧縮する符号化装置であって、
前記サンプル列よりサンプルを順次読み込むサンプル入力手段と、
前記サンプルを時系列に所定の個数だけ格納するバッファメモリである直前バッファと、
前記直前バッファに格納されているサンプルを用いて、ランレングス符号化を行うか、線形予測符号化を行うかの符号化モードを判定し、符号化モードがランレングス符号化に設定されている場合は何もせず、線形予測符号化に設定されている場合に、前記直前バッファに格納されているサンプルのうち最新の2サンプルの差が所定値内である場合、符号化モードをランレングス符号化に切り換え、前記ランレングスデータを0に初期化する符号化モード判定手段と、
前記符号化モード判定手段により符号化モードとしてランレングス符号化が選択された場合、前記サンプル入力手段で取り込まれたサンプルと前記直前バッファに格納されている最新のサンプルとを比較することによりランレングスデータを算出するランレングス算出手段と、
前記符号化モード判定手段により符号化モードとして線形予測符号化が選択された場合、前記直前バッファに格納されている複数のサンプルを用いて線形予測誤差を算出する予測誤差算出手段と、
前記サンプル入力手段で取り込まれたサンプルを前記直前バッファに書き込み、最も過去に位置するサンプルを前記直前バッファより削除する直前バッファ更新手段と、
前記ランレングスデータおよび前記線形予測誤差に対して可変長で符号化を行う可変長符号化手段と、
前記符号化されたデータを出力する符号出力手段と、
前記各手段を制御して前記サンプル列のサンプルを符号出力する符号化処理制御手段と、
を有することを特徴とする時系列信号の符号化装置。
An encoding device that compresses the amount of information so that the sample sequence can be reproduced with respect to a time-series signal composed of time-series sample sequences,
Sample input means for sequentially reading samples from the sample sequence;
A previous buffer that is a buffer memory for storing a predetermined number of samples in time series, and
When the sample stored in the immediately preceding buffer is used to determine the encoding mode for performing run-length encoding or linear predictive encoding, and the encoding mode is set to run-length encoding If no difference is set and linear prediction encoding is set, and the difference between the latest two samples among the samples stored in the immediately preceding buffer is within a predetermined value, the encoding mode is run-length encoding. And encoding mode determination means for initializing the run length data to 0 ,
When run-length encoding is selected as the encoding mode by the encoding mode determining means, the run length is determined by comparing the sample fetched by the sample input means with the latest sample stored in the immediately preceding buffer. A run length calculating means for calculating data;
When linear prediction encoding is selected as the encoding mode by the encoding mode determination unit, a prediction error calculation unit that calculates a linear prediction error using a plurality of samples stored in the immediately preceding buffer;
A previous buffer update unit for writing a sample taken in by the sample input unit to the previous buffer, and deleting a sample located in the past in the previous buffer;
Variable-length encoding means for encoding the run-length data and the linear prediction error with a variable length;
Code output means for outputting the encoded data;
Encoding processing control means for controlling each of the means to code-output samples of the sample sequence;
A time-series signal encoding apparatus comprising:
時系列のサンプル列で構成される時系列信号に対して、前記サンプル列を再現できるように情報量を圧縮する符号化装置であって、
前記サンプル列よりサンプルを順次読み込むサンプル入力手段と、
前記サンプルを時系列に所定の個数だけ格納するバッファメモリである直前バッファと、
前記直前バッファに格納されているサンプルを用いて、ランレングス符号化を行うか、線形予測符号化を行うかの符号化モードを判定する符号化モード判定手段と、
前記符号化モード判定手段により符号化モードとしてランレングス符号化が選択された場合、
前記サンプル入力手段で取り込まれたサンプルと前記直前バッファに格納されている最新のサンプルの差が所定値内である場合に、ランレングスデータに1を増加させることによりランレングスデータを算出し、前記サンプル入力手段で取り込まれたサンプルに対して、直前バッファに格納されている最新のサンプルと同一になるように補正して、当該補正されたサンプルを前記直前バッファに格納し、そうでない場合は、ランレングスデータを前記可変長符号化手段に渡すとともに、前記サンプル入力手段で取り込まれたサンプルと、前記直前バッファに格納されている最新のサンプルとの差分値を予測誤差値として前記可変長符号化手段に渡し、符号化モードを線形予測符号化に切り換えるランレングス算出手段と、
前記符号化モード判定手段により符号化モードとして線形予測符号化が選択された場合、前記直前バッファに格納されている複数のサンプルを用いて線形予測誤差を算出する予測誤差算出手段と、
前記サンプル入力手段で取り込まれたサンプルを前記直前バッファに書き込み、最も過去に位置するサンプルを前記直前バッファより削除する直前バッファ更新手段と、
前記ランレングスデータおよび前記線形予測誤差に対して可変長で符号化を行う可変長符号化手段と、
前記符号化されたデータを出力する符号出力手段と、
前記各手段を制御して前記サンプル列のサンプルを符号出力する符号化処理制御手段と、
を有することを特徴とする時系列信号の符号化装置。
An encoding device that compresses the amount of information so that the sample sequence can be reproduced with respect to a time-series signal composed of time-series sample sequences,
Sample input means for sequentially reading samples from the sample sequence;
A previous buffer that is a buffer memory for storing a predetermined number of samples in time series, and
Using a sample stored in the immediately preceding buffer, encoding mode determination means for determining an encoding mode for performing run-length encoding or linear predictive encoding;
When run-length encoding is selected as the encoding mode by the encoding mode determination means,
When the difference between the sample taken in by the sample input means and the latest sample stored in the immediately preceding buffer is within a predetermined value, the run length data is calculated by increasing the run length data by 1, The sample taken in by the sample input means is corrected so that it is the same as the latest sample stored in the immediately preceding buffer, and the corrected sample is stored in the immediately preceding buffer. Run length data is passed to the variable length coding means, and the variable length coding is performed using a difference value between the sample taken in by the sample input means and the latest sample stored in the immediately preceding buffer as a prediction error value. A run length calculation means for switching the coding mode to linear predictive coding ,
When linear prediction encoding is selected as the encoding mode by the encoding mode determination unit, a prediction error calculation unit that calculates a linear prediction error using a plurality of samples stored in the immediately preceding buffer;
A previous buffer update unit for writing a sample taken in by the sample input unit to the previous buffer, and deleting a sample located in the past in the previous buffer;
Variable-length encoding means for encoding the run-length data and the linear prediction error with a variable length;
Code output means for outputting the encoded data;
Encoding processing control means for controlling each of the means to code-output samples of the sample sequence;
A time-series signal encoding apparatus comprising:
請求項において、
前記符号化モード判定手段は、符号化モードがランレングス符号化に設定されている場合は何もせず、線形予測符号化に設定されている場合に、前記直前バッファに格納されているサンプルのうち最新の2サンプルの差が所定値内である場合、符号化モードをランレングス符号化に切り換え、前記ランレングスデータを0に初期化するものであることを特徴とする時系列信号の符号化装置。
In claim 7 ,
The encoding mode determination means does nothing when the encoding mode is set to run length encoding, and when the encoding mode is set to linear predictive encoding, out of the samples stored in the immediately preceding buffer When the difference between the latest two samples is within a predetermined value, the encoding mode is switched to run-length encoding, and the run-length data is initialized to 0. .
時系列のサンプル列で構成される時系列信号に対して、前記サンプル列を再現できるように情報量を圧縮する符号化装置であって、
前記サンプル列よりサンプルを順次読み込むサンプル入力手段と、
前記サンプルを時系列に所定の個数だけ格納するバッファメモリである直前バッファと、
前記直前バッファに格納されているサンプルを用いて、ランレングス符号化を行うか、線形予測符号化を行うかの符号化モードを判定する符号化モード判定手段と、
前記符号化モード判定手段により符号化モードとしてランレングス符号化が選択された場合、前記サンプル入力手段で取り込まれたサンプルと前記直前バッファに格納されている最新のサンプルとを比較することによりランレングスデータを算出するランレングス算出手段と、
前記符号化モード判定手段により符号化モードとして線形予測符号化が選択された場合、前記直前バッファに格納されている複数のサンプルを用いて線形予測誤差を算出する予測誤差算出手段と、
前記サンプル入力手段で取り込まれたサンプルを前記直前バッファに書き込み、最も過去に位置するサンプルを前記直前バッファより削除する直前バッファ更新手段と、
前記ランレングスデータに対してメルコード方式で可変長符号化を行う第1の可変長符号化手段と、
記線形予測誤差に対してゴロムライス方式で可変長符号化を行う第2の可変長符号化手段と、
前記符号化されたデータを出力する符号出力手段と、
前記各手段を制御して前記サンプル列のサンプルを符号出力する符号化処理制御手段と、
を有することを特徴とする時系列信号の符号化装置。
An encoding device that compresses the amount of information so that the sample sequence can be reproduced with respect to a time-series signal composed of time-series sample sequences,
Sample input means for sequentially reading samples from the sample sequence;
A previous buffer that is a buffer memory for storing a predetermined number of samples in time series, and
Using a sample stored in the immediately preceding buffer, encoding mode determination means for determining an encoding mode for performing run-length encoding or linear predictive encoding;
When run-length encoding is selected as the encoding mode by the encoding mode determining means, the run length is determined by comparing the sample fetched by the sample input means with the latest sample stored in the immediately preceding buffer. A run length calculating means for calculating data;
When linear prediction encoding is selected as the encoding mode by the encoding mode determination unit, a prediction error calculation unit that calculates a linear prediction error using a plurality of samples stored in the immediately preceding buffer;
A previous buffer update unit for writing a sample taken in by the sample input unit to the previous buffer, and deleting a sample located in the past in the previous buffer;
A first variable length coding means for performing variable length sign-reduction with Mel code method for the run-length data,
A second variable length encoding means for performing variable length sign-reduction in the Golomb-Rice method for the previous SL line forms prediction error,
Code output means for outputting the encoded data;
Encoding processing control means for controlling each of the means to code-output samples of the sample sequence;
A time-series signal encoding apparatus comprising:
与えられた時系列信号に対して、請求項1から請求項9のいずれかに記載の符号化装置により出力された符号データを記録した記録媒体。
The recording medium which recorded the code data output by the encoding apparatus in any one of Claim 1-9 with respect to the given time series signal.
JP2003386707A 2003-11-17 2003-11-17 Time series signal encoding device Expired - Fee Related JP4319895B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003386707A JP4319895B2 (en) 2003-11-17 2003-11-17 Time series signal encoding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003386707A JP4319895B2 (en) 2003-11-17 2003-11-17 Time series signal encoding device

Publications (2)

Publication Number Publication Date
JP2005151223A JP2005151223A (en) 2005-06-09
JP4319895B2 true JP4319895B2 (en) 2009-08-26

Family

ID=34694323

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003386707A Expired - Fee Related JP4319895B2 (en) 2003-11-17 2003-11-17 Time series signal encoding device

Country Status (1)

Country Link
JP (1) JP4319895B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101318574B1 (en) * 2010-03-03 2013-10-16 미쓰비시덴키 가부시키가이샤 Data compression device, data compression method, and computer readable recording medium

Also Published As

Publication number Publication date
JP2005151223A (en) 2005-06-09

Similar Documents

Publication Publication Date Title
JP4049792B2 (en) Floating-point format digital signal lossless encoding method, decoding method, each apparatus, and each program
JP4049791B2 (en) Floating-point format digital signal lossless encoding method, decoding method, each apparatus, and each program
JP4049793B2 (en) Floating point signal lossless encoding method, decoding method, apparatus thereof, program, and recording medium thereof
US5973629A (en) Differential PCM system with frame word length responsive to magnitude
US20070143118A1 (en) Apparatus and method for lossless audio signal compression/decompression through entropy coding
KR20120096541A (en) Method, system, and apparatus for compression or decompression of digital signals
JPWO2006075605A1 (en) Long-term predictive encoding method, long-term predictive decoding method, these devices, program thereof, and recording medium
JP4319895B2 (en) Time series signal encoding device
JP4139704B2 (en) Time series signal encoding apparatus and decoding apparatus
JP4091506B2 (en) Two-stage audio image encoding method, apparatus and program thereof, and recording medium recording the program
JP4170795B2 (en) Time-series signal encoding apparatus and recording medium
JP4736331B2 (en) Acoustic signal playback device
JP3166218B2 (en) Data compression / expansion apparatus and electronic musical instrument using the same
JP4139697B2 (en) Time series signal encoding method and apparatus
JP2004198559A (en) Encoding method and decoding method for time-series signal
JP4109124B2 (en) Time series signal encoding device
JP3747357B2 (en) Music signal encoding apparatus and decoding apparatus
JP4249540B2 (en) Time-series signal encoding apparatus and recording medium
JP4184817B2 (en) Time series signal encoding method and apparatus
JP2730029B2 (en) Linear predictive coding method
JP2652371B2 (en) Audio coding method
JP2005166216A (en) Reproducing apparatus of sound signal
US20050025251A1 (en) Method of optimizing compression rate in adaptive differential pulse code modulation (ADPCM)
JP2992994B2 (en) How to encode digital audio data
JP2004070120A (en) Encoding device, decoding device and recording medium for time-series signal

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060907

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20081222

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090106

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090309

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20090507

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090529

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120605

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120605

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130605

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140605

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees