[go: up one dir, main page]

JP2004328097A - Information processor and method therefor, recording medium, and program - Google Patents

Information processor and method therefor, recording medium, and program Download PDF

Info

Publication number
JP2004328097A
JP2004328097A JP2003116598A JP2003116598A JP2004328097A JP 2004328097 A JP2004328097 A JP 2004328097A JP 2003116598 A JP2003116598 A JP 2003116598A JP 2003116598 A JP2003116598 A JP 2003116598A JP 2004328097 A JP2004328097 A JP 2004328097A
Authority
JP
Japan
Prior art keywords
data
program
execution
bit length
unit
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.)
Withdrawn
Application number
JP2003116598A
Other languages
Japanese (ja)
Inventor
Hiroaki Sakaguchi
浩章 坂口
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.)
Sony Corp
Original Assignee
Sony Corp
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 Sony Corp filed Critical Sony Corp
Priority to JP2003116598A priority Critical patent/JP2004328097A/en
Publication of JP2004328097A publication Critical patent/JP2004328097A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To lessen the local compression ratio reduction near the boundary between a plurality of data (including programs) to improve the total compression ratio for concatenating and compressing the plurality of data. <P>SOLUTION: In execution programs 42-1 to 42-4, different data are located at the top and the end of a program code. A sequence order directly executable by a CPU is called "form 1" and another sequence order reverse to the sequence order form 1 is called "form 2". A compressor rearranges the plurality of execution programs 42-1 to 42-4 to be concatenated in the form 2 every two programs and concatenates them to form a program data group 271. Thus, alternately repeating the sequence orders form 1 and form 2 locates similar data at the boundary between the execution programs. A compression program for compressing with sliding a moving window may be employed to lessen the reduction of the compression ratio at the boundary between the execution programs. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は、情報処理装置および方法、記録媒体、並びにプログラムに関し、特に、データの圧縮率を向上させることができるようにした情報処理装置および方法、記録媒体、並びにプログラムに関する。
【0002】
【従来の技術】
以前はASIC(Application Specific Integrated Circuit)で実現していた処理を、主にCPU(Central Processing Unit)に実行させるソフトウエアソリューション指向のアーキテクチャを採用し、ソフトウエアを入れ替えることで異なるアプリケーションに柔軟に対応できるLSI(Large Scale Integration)が、近年、増えてきている。また、近年、複数のCPUを混載し、各CPUに機能を割り当てて分散処理することで、処理能力を高くしたLSIも増えてきている。
【0003】
このため、そのようなLSIを採用した製品には同じアーキテクチャのインストラクションセットで構成された複数の実行プログラムを用意しておくことが必要である。従って、複数の実行プログラムを保持しておけるように、大容量の不揮発性メモリ(EEPROM(Electrically Erasable Programmable Read−only Memory)やフラッシュメモリなど)が必要とされる場合が増えてきている。大容量の不揮発性メモリを必要とすることは、製品コストを高くする要因となる。
【0004】
そこで、プログラムを圧縮して、不揮発性メモリに保存しておき、プログラムの実行時には、圧縮されたプログラムを伸張して使用することにより、不揮発性メモリに記憶させるべきプログラムのデータ量を削減し、不揮発性メモリの容量を小さくすることが知られている。これにより、コスト削減が期待できる。
【0005】
従来、複数の実行プログラムを圧縮して不揮発性メモリに格納する場合には、プログラム毎に個別に圧縮したデータを連結して格納するか、複数のプログラムをそのまま連結して1つのデータとしてまとめて圧縮し、格納するかのどちらかであった。複数のプログラムを個別に圧縮する場合、辞書や統計的情報を個別に構築し直す必要があり、プログラムの最初の部分の局所的な圧縮率はあまりよくない。
【0006】
同じインストラクションセットに基づくプログラムコード同士は、統計的な性質が比較的類似している。また同じハードウエア資源を使用したプログラムコードである場合、統計的な性質がさらに類似している可能性も高いと予想される。そのため、このような複数の類似したプログラムの1つのプログラムを圧縮する場合、他のプログラムを初期辞書として使用し、辞書式圧縮技法(Lempel Ziv符号など)で圧縮することや、他のプログラムの統計的情報を初期値として、統計的圧縮技法(MDL(Minimum Description Length)符号、PPM(Prediction by Partial Matching)符号、CTW(Context Weighting Method)符号など)で圧縮することにより、圧縮率の向上を期待することができる(例えば、非特許文献1参照)。
【0007】
実際のデータは、単純な確率モデルではないので、データの全域にわたって同じ統計的性質を仮定するより、徐々に統計的性質が変化していくことを仮定した方が、圧縮率を高くすることがある。例えば、移動窓を仮定して、符号化しようとするデータの直前の一部分だけのデータから辞書や統計情報を構築し、これを利用して圧縮を行う方法などである。Lempel Ziv符号のLZ77(Lempel Ziv 77)符号はその例である。移動窓を用いる場合には、圧縮しようとするデータとその直前のデータはなるべく類似しているほうが圧縮率がよい。
【0008】
【非特許文献1】
山本博資 著「ユニバーサルデータ圧縮アルゴリズムの変遷―基礎から最新手法まで―」2001年情報論的学習理論ワークショップ(2001年7月30日―8月1日開催)、日本、p.339−348
【0009】
【発明が解決しようとする課題】
しかし、プログラムコードでは、一般的に先頭の方にCPUのインストラクションコードが配置され、変数の初期値や定数値、文字列などのデータが末尾のほうに配置された構造が良く用いられるため、プログラムの境界では局所的に圧縮率が低下するという課題があった。
【0010】
すなわち、プログラムの先頭の方と末尾の方のコードでは、統計的な性質(確率モデルや確率モデルを仮定したときの頻度分布などであり、辞書に対してもこれらを想定することできる)が、かなり異なっている場合が多い。そのため、上記のように移動窓を仮定して、符号化する場合、プログラムの境界では、圧縮しようとするプログラムのデータと、その直前のプログラムのデータの統計的性質が類似していないため、この部分の圧縮率が低下する。
【0011】
具体的には、データ部は連続する8ビットのすべてが0のような特定のビットパターンの頻度が高く、連続しているものも多いことなどがその例である。インストラクションコードの場合には、例えば32ビットのRISCでは4バイト単位で構成されており、4バイトを1ワードとして考えると、1ワードの特定の位置のビットが命令の機能やレジスタの番号を示しているので、特定のビットフィールドに注目すると頻度の高いビットパターンが存在する。
【0012】
従って、インストラクションコードの部分の統計的な性質は、明らかに、変数の初期値や定数値、文字列などとは異なっていると推測できる。そのため、プログラムコードをそのまま連結し、1つのデータとしてまとめて圧縮すると、プログラムの境界では、局所的に圧縮率が低下する。特に移動窓の大きさに対してプログラムの大きさが十分に大きくない場合には、全体に占める影響も大きくなり圧縮率に大きな影響がある。
【0013】
本発明はこのような状況に鑑みてなされたものであり、データの圧縮率をより向上させることができるようにするものである。
【0014】
【課題を解決するための手段】
本発明の第1の情報処理装置は、連結する複数のデータを、1つおきに所定のビット長単位で逆順に並べ替える並べ替え手段と、並べ替え手段により、1つおきに逆順に並べ替えられた複数のデータを連結して圧縮する圧縮手段とを備えることを特徴とする。
【0015】
前記データのビット数を前記ビット長で割り算した余りを、前記ビット長から差し引いた値に等しい長さの別データを前記データに付加する付加手段をさらに設けるようにしても良い。
【0016】
前記圧縮手段により圧縮された複数の前記データ、前記データ毎のデータサイズ、および前記ビット長を記録媒体に記録する記録手段をさらに設けるようにしても良い。
【0017】
前記記録手段には、奇数番目に連結された前記データと偶数番目に連結された前記データのうち、いずれの前記データが逆順に並べ替えられたのかを示す配列データをさらに前記記録媒体に記録するようにさせることができる。
【0018】
前記並べ替え手段には、複数の異なる前記ビット長単位により、前記データを並べ替えるようにさせ、前記圧縮手段には、複数の異なる前記ビット長単位により逆順に並べ替えられた前記データを、前記ビット長単位毎に連結して圧縮するようにさせ、前記記録手段には、前記圧縮手段により前記ビット長単位毎に連結して圧縮された前記データのうち、最も圧縮率の高い前記データを前記記録媒体に記録するようにさせることができる。
【0019】
本発明の第1の情報処理方法は、連結する複数のデータを、1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップと、並べ替えステップの処理により、1つおきに逆順に並べ替えられた複数のデータを連結して圧縮する圧縮ステップとを含むことを特徴とする。
【0020】
本発明の第1の記録媒体のプログラムは、連結する複数のデータを、1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップと、並べ替えステップの処理により、1つおきに逆順に並べ替えられた複数のデータを連結して圧縮する圧縮ステップとを含むことを特徴とする。
【0021】
本発明の第1のプログラムは、連結する複数のデータを、1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップと、並べ替えステップの処理により、1つおきに逆順に並べ替えられた複数のデータを連結して圧縮する圧縮ステップとをコンピュータに実行させることを特徴とする。
【0022】
本発明の第2の情報処理装置は、連結して圧縮された複数のデータを伸長する伸長手段と、伸長手段により伸長された複数のデータを1つおきに所定のビット長単位で逆順に並べ替える並べ替え手段とを備えることを特徴とする。
【0023】
前記並べ替え手段により1つおきに逆順に並べ替えられた複数の前記データのうち、指定された前記データに基づく処理を実行する実行手段をさらに設けるようにすることができる。
【0024】
本発明の第2の情報処理方法は、連結して圧縮された複数のデータを伸長する伸長ステップと、伸長ステップの処理により伸長された複数のデータを1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップとを含むことを特徴とする。
【0025】
本発明の第2の記録媒体のプログラムは、連結して圧縮された複数のデータを伸長する伸長ステップと、伸長ステップの処理により伸長された複数のデータを1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップとを含むことを特徴とする。
【0026】
本発明の第2のプログラムは、連結して圧縮された複数のデータを伸長する伸長ステップと、伸長ステップの処理により伸長された複数のデータを1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップとをコンピュータに実行させることを特徴とする。
【0027】
本発明の第1の情報処理装置および方法、記録媒体、並びにプログラムにおいては、連結する複数のデータが、1つおきに所定のビット長単位で逆順に並べ替えられ、1つおきに逆順に並べ替えられた複数のデータが連結され、圧縮される。
【0028】
本発明の第2の情報処理装置および方法、記録媒体、並びにプログラムにおいては、連結して圧縮された複数のデータが伸長され、伸長された複数のデータが、1つおきに所定のビット長単位で逆順に並べ替えられる。
【0029】
本発明は、例えば電子機器に適用することができる。
【0030】
【発明の実施の形態】
以下に本発明の実施の形態を説明するが、請求項に記載の構成要件と、発明の実施の形態における具体例との対応関係を例示すると、次のようになる。この記載は、請求項に記載されている発明をサポートする具体例が、発明の実施の形態に記載されていることを確認するためのものである。従って、発明の実施の形態中には記載されているが、構成要件に対応するものとして、ここには記載されていない具体例があったとしても、そのことは、その具体例が、その構成要件に対応するものではないことを意味するものではない。逆に、具体例が構成要件に対応するものとしてここに記載されていたとしても、そのことは、その具体例が、その構成要件以外の構成要件には対応しないものであることを意味するものでもない。
【0031】
さらに、この記載は、発明の実施の形態に記載されている具体例に対応する発明が、請求項に全て記載されていることを意味するものではない。換言すれば、この記載は、発明の実施の形態に記載されている具体例に対応する発明であって、この出願の請求項には記載されていない発明の存在、すなわち、将来、分割出願されたり、補正により追加される発明の存在を否定するものではない。
【0032】
請求項1に記載の情報処理装置(例えば、図1の圧縮装置1)は、連結する複数のデータ(例えば、図1の実行プログラム42−1乃至42−4)を、1つおきに所定のビット長単位で逆順に並べ替える並べ替え手段(例えば、図3のステップS2乃至ステップS8の処理を実行する図1の配列処理プログラム43C)と、前記並べ替え手段により、1つおきに逆順に並べ替えられた複数の前記データを連結して圧縮する圧縮手段(例えば、図3のステップS9の処理を実行する図1の圧縮処理プログラム43A)とを備えることを特徴とする。
【0033】
請求項2に記載の情報処理装置は、前記データのビット数を前記ビット長(例えば、図5のビット長X)で割り算した余りを、前記ビット長から差し引いた値に等しい長さの別データを前記データに付加する付加手段(例えば、図3のステップS1の処理を実行する図1のデータ付加プログラム43B)をさらに備えることを特徴とする。
【0034】
請求項3に記載の情報処理装置は、前記圧縮手段により圧縮された複数の前記データ、前記データ毎のデータサイズ(例えば、図9のサイズデータ272)、および前記ビット長(例えば、図9のビット長データ361)を記録媒体(例えば、図1の不揮発性メモリ21)に記録する記録手段(例えば、図1の不揮発性メモリ書き込み装置14)をさらに備えることを特徴とする。
【0035】
請求項4に記載の情報処理装置において、前記記録手段は、奇数番目に連結された前記データと偶数番目に連結された前記データのうち、いずれの前記データが逆順に並べ替えられたのかを示す配列データ(例えば、図17のステップS212の処理により生成された配列データ)をさらに前記記録媒体に記録する(例えば、ステップS214の処理)ことを特徴とする。
【0036】
請求項5に記載の情報処理装置において、前記並べ替え手段は、複数の異なる前記ビット長単位により、前記データを並べ替え(例えば、図21のステップS304乃至ステップS310の処理)、前記圧縮手段は、複数の異なる前記ビット長単位により逆順に並べ替えられた前記データを、前記ビット長単位毎に連結して圧縮し(例えば、図21のステップS311の処理)、前記記録手段は、前記圧縮手段により前記ビット長単位毎に連結して圧縮された前記データのうち、最も圧縮率の高い前記データを前記記録媒体に記録する(例えば、図21のステップS313およびステップS314の処理)ことを特徴とする。
【0037】
請求項6に記載の情報処理方法は、連結する複数のデータ(例えば、図1の実行プログラム42−1乃至42−4)を、1つおきに所定のビット長(例えば、図5のビット長X)単位で逆順に並べ替える並べ替えステップ(例えば、図3のステップS2乃至ステップS8)と、前記並べ替えステップの処理により、1つおきに逆順に並べ替えられた複数の前記データを連結して圧縮する圧縮ステップ(例えば、図3のステップS9)とを含むことを特徴とする。
【0038】
請求項7に記載の記録媒体のプログラムは、連結する複数のデータ(例えば、図1の実行プログラム42−1乃至42−4)を、1つおきに所定のビット長(例えば、図5のビット長X)単位で逆順に並べ替える並べ替えステップ(例えば、図3のステップS2乃至ステップS8)と、前記並べ替えステップの処理により、1つおきに逆順に並べ替えられた複数の前記データを連結して圧縮する圧縮ステップ(例えば、図3のステップS9)とを含むことを特徴とする。
【0039】
請求項8に記載のプログラムは、連結する複数のデータ(例えば、図1の実行プログラム42−1乃至42−4)を、1つおきに所定のビット長(例えば、図5のビット長X)単位で逆順に並べ替える並べ替えステップ(例えば、図3のステップS2乃至ステップS8)と、前記並べ替えステップの処理により、1つおきに逆順に並べ替えられた複数の前記データを連結して圧縮する圧縮ステップ(例えば、図3のステップS9)とをコンピュータに実行させることを特徴とする。
【0040】
請求項9に記載の情報処理装置(例えば、図2の撮像装置201)は、連結して圧縮された複数のデータ(例えば、図9の圧縮済みプログラムデータ351)を伸長する伸長手段(例えば、図11の伸長プログラム44Aを実行することにより、図10のステップS102の処理を実行する図2のCPU244−1)と、前記伸長手段により伸長された複数の前記データ(例えば、図7のプログラムデータ群271に含まれる実行プログラム42−1乃至42−4)を1つおきに所定のビット長(例えば、図5のビット長X)単位で逆順に並べ替える並べ替え手段(例えば、図11の配列処理プログラム44Cを実行することにより、図10のステップS105乃至ステップS109の処理を実行する図2のCPU244−1)とを備えることを特徴とする。
【0041】
請求項10に記載の情報処理装置は、前記並べ替え手段により1つおきに逆順に並べ替えられた複数の前記データのうち、指定された前記データに基づく処理を実行する実行手段(例えば、図12のステップS153の処理を実行する図2のCPU244−3)をさらに備えることを特徴とする。
【0042】
請求項11に記載の情報処理方法は、連結して圧縮された複数のデータ(例えば、図9の圧縮済みプログラムデータ351)を伸長する伸長ステップ(例えば、図10のステップS102)と、前記伸長ステップの処理により伸長された複数の前記データ(例えば、図7のプログラムデータ群271に含まれる実行プログラム42−1乃至42−4)を1つおきに所定のビット長(例えば、図5のビット長X)単位で逆順に並べ替える並べ替えステップ(例えば、図10のステップS105乃至ステップS109)とを含むことを特徴とする。
【0043】
請求項12に記載の記録媒体のプログラムは、連結して圧縮された複数のデータ(例えば、図9の圧縮済みプログラムデータ351)を伸長する伸長ステップ(例えば、図10のステップS102)と、前記伸長ステップの処理により伸長された複数の前記データ(例えば、図7のプログラムデータ群271に含まれる実行プログラム42−1乃至42−4)を1つおきに所定のビット長(例えば、図5のビット長X)単位で逆順に並べ替える並べ替えステップ(例えば、図10のステップS105乃至ステップS109)とを含むことを特徴とする。
【0044】
請求項13に記載のプログラムは、連結して圧縮された複数のデータ(例えば、図9の圧縮済みプログラムデータ351)を伸長する伸長ステップ(例えば、図10のステップS102)と、前記伸長ステップの処理により伸長された複数の前記データ(例えば、図7のプログラムデータ群271に含まれる実行プログラム42−1乃至42−4)を1つおきに所定のビット長(例えば、図5のビット長X)単位で逆順に並べ替える並べ替えステップ(例えば、図10のステップS105乃至ステップS109)とをコンピュータに実行させることを特徴とする。
【0045】
図1は、本発明を適用した圧縮装置1の構成例を表している。圧縮装置1は、複数個のプログラムを連結して1つのデータとしてまとめて圧縮し、不揮発性メモリ21に格納する装置である。なお、圧縮装置1は、例えば、汎用のパーソナルコンピュータ、ワークステーション、または、その他の情報処理装置とすることができる。
【0046】
図1において、CPU11は、ROM(Read Only Memory)12に記憶されているプログラム、またはストレージデバイス18からRAM13にロードされたプログラムに従って、各種の処理を実行する。RAM13にはまた、CPU11が各種の処理を実行する上において必要なデータなども適宜記憶される。
【0047】
CPU11、ROM12、およびRAM13は、バス17を介して、相互に接続されている。このバス17にはまた、不揮発性メモリ書き込み装置14、入力部15、出力部16、ストレージデバイス18、通信部19、およびドライブ20も接続されている。
【0048】
不揮発性メモリ書き込み装置14は、CPU11の指示に従って、ストレージデバイス18に記憶された圧縮コードデータ41を読み出し、不揮発性メモリ21に書き込む。不揮発性メモリ21は、圧縮コードデータ41が書き込まれた状態で、例えばカメラ一体型ビデオテープレーコーダ(VTR)などの電子機器に内蔵される。
【0049】
入力部15は、例えばキーボード、マウスなどにより構成され、操作の入力を受け付ける。出力部16は、CRT(CathodeRay Tube)、LCD(Liquid Crystal Display)などよりなるディスプレイ、並びにスピーカなどにより構成される。
【0050】
ストレージデバイス18は、例えばハードディスクドライブ等により構成され、種々のデータやプログラムを記憶する。ストレージデバイス18は、例えば、圧縮コードデータ41、実行プログラム42−1乃至42−4、記録プログラム43、並びにブートプログラム44を記憶する。
【0051】
圧縮コードデータ41は、不揮発性メモリ21に格納するために生成されたデータであり、圧縮された実行プログラムを含んでいる。圧縮コードデータ41は、後述するデータ記録処理により生成される。
【0052】
実行プログラム42−1乃至42−4は、不揮発性メモリ21に格納するために用意されたプログラムである。実行プログラム42−1乃至42−4は、例えば、圧縮装置1を操作するオペレータからの指示により、通信部19を介して、外部の装置から取得されたり、ドライブ20に装着された磁気ディスク31、光ディスク32、光磁気ディスク33、または半導体メモリ34から読み出すことにより、取得されたものである。また、実行プログラム42−1乃至42−4は、例えば、入力部15を介して、オペレータにより入力されたものであっても良い。勿論、実行プログラム42−1乃至42−4は、上記以外の方法で、取得しても良い。
【0053】
なお、本実施の形態においては、実行プログラム42−1乃至42−4の4つの実行プログラムが用意されているが、用意する実行プログラムの個数は、4個に限定されるものではない。また、以下の説明において、実行プログラム42−1乃至42−4のそれぞれを個々に区別する必要がない場合、まとめて実行プログラム42と称する。以下、他の構成も同様とする。
【0054】
記録プログラム43は、実行プログラム42−1乃至42−4を圧縮して圧縮コードデータ41を生成し、圧縮コードデータ41を不揮発性メモリ21に記録する処理を実行するプログラムであり、適宜RAM13にロードされ、CPU11により実行される。記録プログラム43は、圧縮処理プログラム43A、データ付加処理プログラム43B、および配列処理プログラム43Cを含んでいる。圧縮処理プログラム43Aは、実行プログラム42−1乃至42−4を圧縮するプログラムであり、本実施の形態においては、LZ77符号により実行プログラム42−1乃至42−4を圧縮する。なお、本実施の形態においては、LZ77符号を利用した場合を例にして説明するが、本発明は、移動窓を設定してデータを符号化するLZ77以外の方式にも適用可能である。
【0055】
データ付加処理プログラム43Bは、圧縮処理プログラム43Aにより実行プログラム42−1乃至42−4が圧縮される前に、実行プログラム42−1乃至42−4に、所定のデータを付加するデータ付加処理を実行する。データ付加処理の詳細な説明は後述する。
【0056】
配列処理プログラム43Cは、実行プログラム42−1乃至42−4を連結する際に、各実行プログラムを所定の配列に並べる処理を実行する。
【0057】
ブートプログラム44は、不揮発性メモリ21に記録するために用意されたプログラムである。
【0058】
通信部19は、例えばモデム、ターミナルアダプタなどより構成され、LAN(Local Area Network)やインターネット等を含むネットワークを介しての通信処理を行う。
【0059】
ドライブ20は、必要に応じて、図示せぬ入出力インタフェースを介して、バス17に接続され、磁気ディスク31(フレキシブルディスクを含む)、光ディスク32(CD−ROM(Compact Disk−Read Only Memory),DVD(Digital Versatile Disk)を含む)、光磁気ディスク33(MD(Mini−Disk)を含む)、または半導体メモリ34が装着され、それらから読み出されたコンピュータプログラムやデータが、必要に応じて、ストレージデバイス18に記憶される。
【0060】
次に、図2は、本発明を適用した撮像装置201の構成例を表している。撮像装置201は、例えば、カメラ一体型ビデオテープレコーダ、またはデジタルスチルカメラとすることができる。撮像装置201は不揮発性メモリ21を内蔵しており、この不揮発性メモリ21には、圧縮装置1により圧縮された複数のプログラムが格納されている。撮像装置201は、不揮発性メモリ21に格納されたプログラムを適宜実行する。
【0061】
なお、本実施の形態においては、本発明を撮像装置201に適用した場合を例として説明するが、このことは、本発明が撮像装置にしか適用できないことを意味するものではない。本発明は、その他、あらゆる電子機器に適用することができる。
【0062】
図2において、LSI211は、バス241に接続された複数のCPU244−1乃至244−3、並びにインタフェース(I/F)242,243,245を含んでいる。
【0063】
バス241には、ホストCPU213が接続されており、CPU244−1乃至244−3は、ホストCPU213からの指示に従って、各種の処理を実行する。
【0064】
ホストCPU213は、操作部212からの操作信号に従って、CPU244−1乃至244−3を含む、撮像装置201の全体の動作を制御する。操作部212は、種々のボタンやダイヤル等により構成され、ユーザからの操作の入力を受け付け、入力された操作に基づく操作信号を発生し、ホストCPU213に通知する。
【0065】
バス241には、インタフェース242を介して、不揮発性メモリ21が接続されている。図1の圧縮装置1により、不揮発性メモリ21には、圧縮コードデータ41およびブートプログラム44が格納されている。撮像装置201が起動された場合、CPU244−1により、不揮発性メモリ21からブートプログラム44および圧縮コードデータ41が読み出される。
【0066】
バス241には、インタフェース243を介して、SDRAM(Synchronous Dynamic Random Access Memory)214が接続されている。SDRAM214は、インタフェース243を介して供給されるデータを、所定のメモリアドレスに記憶する。SDRAM214に記憶されたデータは、インタフェース243を介して、適宜読み出されたり、書き込まれる。SDRAM214は、例えば、伸長された実行プログラム42のコード等を記憶する。
【0067】
CPU244−1は、ホストCPU213からの指示に従って、不揮発性メモリ21からブートプログラム44を読み出し、実行する。ブートプログラム44には、圧縮された実行プログラム42−1乃至42−4を伸長する伸長プログラムが含まれている。そこで、CPU244−1は、ブートプログラム44を実行した場合、圧縮コードデータ41を読み出し、圧縮コードデータ41に含まれている圧縮された実行プログラム42−1乃至42−4を伸長する。CPU244−1は、伸長した実行プログラム42−1乃至42−4や、それに付随する情報データ等をSDRAM214に記憶させる。また、CPU244−1は、ホストCPU213からの指示に従って、SDRAM214に記憶された複数の実行プログラム42−1乃至42−4の中から、所定の実行プログラムを選択し、選択した実行プログラムを実行する。
【0068】
CPU244−2および244−3は、ホストCPU213からの指示に従って、SDRAM214に記憶された複数の実行プログラム42−1乃至42−4の中から、所定の実行プログラムを選択し、選択した実行プログラムを実行する。なお、本実施の形態においては、例としてCPU244−2は、画像のエンコードおよびデコードに関する実行プログラムを実行し、CPU244−3は、音声のエンコードおよびデコードに関する実行プログラムを実行するものとする。
【0069】
バス241には、インタフェース245を介して、音声出力部215、音声入力部216、表示部217、撮像部218、および記録再生部219も接続されている。
【0070】
音声出力部215は、スピーカを含み、インタフェース245を介してCPU244−3から供給された音声信号に基づく音声を出力する。音声入力部216は、マイクロフォンを含み、撮像装置201の周囲の音声を集音し、集音された音声に基づく音声信号をインタフェース245を介して、CPU244−3に供給する。
【0071】
表示部217は、例えばLCDにより構成され、インタフェース245を介してCPU244−2から供給された映像信号に基づく映像を表示する。撮像部218は、例えば、CCD(Charged Coupled Device)、またはCMOS(Complementary Metal Oxide Semiconductor)などの撮像素子を有し、被写体を撮像して生成された映像信号をインタフェース245を介してCPU244−2に供給する。
【0072】
記録再生部219は、インタフェース245を介して供給されたオーディオビジュアル(AV)データを、装着された記録媒体(例えばテープメディア)に記録する。また、記録再生部219は、記録媒体に記録されたAVデータを読み出し、インタフェース245を介して、CPU244−2および244−3に出力する。
【0073】
次に、図3のフローチャートを参照して、圧縮装置1のデータ記録処理、すなわち、圧縮コードデータ41を生成し、不揮発性メモリ21に格納するまでの処理について説明する。なお、以下の説明において、記録プログラム43により実行される処理は、実際には、CPU11が記録プログラム43をRAM13にロードして実行することにより実行される。
【0074】
ステップS1において、データ付加処理プログラム43Bは、データ付加処理を実行し、実行プログラム42−1乃至42−4に、所定のデータを付加する。
【0075】
ここで、データ付加処理について説明する。
【0076】
圧縮装置1は、後述するステップS5およびステップS6の処理により、実行プログラム42を所定のビット長毎に区切り、複数に区切られた実行プログラムを、所定の順番で整列させる。図4は、所定のビット長単位で区切られた実行プログラム42のプログラムコードの例を表し、図5は、図4のプログラムコードを、所定のビット長X単位で区切り整列させた例を表している。
【0077】
図4において、プログラムコードの先頭が左側に位置し、プログラムコードの末尾が右側に位置している。配列処理プログラム43Cは、図4に示されるように、プログラムコードを、先頭から順番に、所定のビット長単位で区切る。図4においては、1乃至NのN個のコードに区切られている。なお、Nは2以上の整数である。また、以下の説明において、プログラムコードを区切る単位である所定のビット長をビット長Xと称し、ビット長X単位で区切られた個々のコードを部分コードと称する。また、以下の説明においては、図4に示されるように、先頭の部分コードを1番目の部分コードとし、以下、順次、1番目の部分コードの次の部分コードを2番目の部分コードと称し、2番目の部分コードの次の部分コードを3番目の部分コードと称してゆき、末尾の部分コードをN番目の部分コードと称する。
【0078】
図5は、図4のように区切られたN個の部分コードを先頭のデータから末尾のデータまで整列させたものである。
【0079】
図5の左側には、ビット長X毎に区切られた部分コードが、上から順番に整列した実行プログラム42が示されている。すなわち、左側に示された実行プログラム42は、1番目の部分コードを先頭のデータとして、1番目の部分コードの次に2番目の部分コードを配置し、2番目の部分コードの次に3番目の部分コードを配置している。以下、順次、4番目以降の部分コードが配置されてゆき、N番目の部分コードが末尾のデータとして配置されている。
【0080】
ここで、実行プログラム42全体のビット数が、ビット長Xで割り切れた場合、N番目の部分コードのビット数は、ビット長Xと同一の値になるが、実行プログラム42全体のビット数が、ビット長Xで割り切れず、余りがある場合、N番目部分コードのビット数が、ビット長Xより小さい値になってしまう。
【0081】
これを簡単な例で説明すると、仮に、実行プログラム42全体のビット数が21ビットで、ビット長Xが3ビットであったとする。この場合、実行プログラム42全体のビット数(=21ビット)を、ビット長X(=3ビット)で割り算すると、
21÷3=7…0
となり、割り切れるので、N(=7)番目の部分コードも、3ビットとなる。これに対して、仮に、実行プログラム42全体のビット数が21ビットで、ビット長Xが4ビットであるとした場合、実行プログラム42全体のビット数(=21ビット)を、ビット長X(=4ビット)で割り算すると、
21÷4=5…1
となり、余り(=1)が出てしまう。よって、N番目の部分コードは、1ビットとなり、ビット長X(=4ビット)未満の値になってしまう。
【0082】
このように、N番目の部分コードが、ビット長X未満の値になってしまった場合、図5のN番目の部分コードのビット数が不足してしまう。
【0083】
そこで、ステップS1において、データ付加処理プログラム43Bは、実行プログラム42全体のビット数がビット長Xで割り切れない場合、不足分のデータ(上記の例の場合、3ビットのデータ)をN番目の部分コードに足して、N番目の部分コードのビット数をビット長Xになるようにする。
【0084】
なお、上記の説明においては、実行プログラム42のビット数を21ビットとし、ビット長Xを3ビットまたは4ビットとして説明したが、この値は、説明を簡単にするために仮定した値であり、実際の実行プログラム42のビット数、およびビット長Xが、上記の値になることを意味するものではない。
【0085】
なお、図5の右側に記された実行プログラム42についての説明は後述する。
【0086】
次に、図6のフローチャートを参照して、ステップS1のデータ付加処理、すなわち不足分のデータをN番目の部分コードに付加する処理について詳細に説明する。
【0087】
ステップS31において、データ付加処理プログラム43Bは、プログラム番号iを1に初期化し、RAM13のバッファを初期化する。
【0088】
ステップS32において、データ付加処理プログラム43Bは、プログラム番号iが、プログラム総数以下であるか否かを判定する。ここで、プログラム総数とは、不揮発性メモリ21に格納すべき実行プログラム42の個数のことを示している。すなわち、図1の例の場合、不揮発性メモリ21に格納すべき実行プログラムは、実行プログラム42−1乃至42−4の4個なので、プログラム総数は4となる。そこで、ステップS32において、データ付加処理プログラム43Bは、プログラム番号iが、このプログラム総数以下であるか否かを判定し、プログラム番号iがプログラム総数以下である場合、処理はステップS33に進む。
【0089】
ステップS33において、データ付加処理プログラム43Bは、i番目の実行プログラム42をストレージデバイス18から読み込み、RAM13のバッファに記憶させる。
【0090】
ステップS34において、データ付加処理プログラム43Bは、ステップS33でRAM13に記憶させた実行プログラム42全体のビット数(以下、プログラム長とも称する)を取得する。
【0091】
ステップS35において、データ付加処理プログラム43Bは、ステップS34で取得された、実行プログラム42のプログラム長を、ビット長Xで割り算する。なお、データ付加処理プログラム43Bは、小数点以下の割り算は行わない。よって、商および余りは整数の値となる。
【0092】
ステップS36において、データ付加処理プログラム43Bは、ステップS35の処理により、プログラム長がビット長Xで割り切れたか否かを判定し、プログラム長がビット長Xで割り切れなかった場合、処理はステップS37に進む。
【0093】
ステップS37において、データ付加処理プログラム43Bは、実行プログラム42に、不足分のデータを付加する。すなわち、ステップS35で、プログラム長をビット長Xで割り算することにより、商と余り(余りをYとする)が算出されるので、データ付加処理プログラム43Bは、ビット長Xから余りYを差し引いた分のビット数(X−Y)のデータを実行プログラム42に付加する。その後、処理はステップS38に進む。
【0094】
ステップS36において、データ付加処理プログラム43Bが、プログラム長がビット長Xで割り切れたと判定した場合、ステップS37の処理はスキップされ、処理はステップS38に進む。
【0095】
ステップS38において、データ付加処理プログラム43Bは、RAM13に記憶された実行プログラム42をストレージデバイス18に記憶させる。なお、ステップS37の処理によりデータが付加された場合、データ付加処理プログラム43Bは、付加されたデータも含めて、実行プログラム42をストレージデバイス18に記憶させる。
【0096】
ステップS39において、データ付加処理プログラム43Bは、プログラム番号iを1増やす。
【0097】
その後、処理はステップS32に戻り、上述したステップS32以降の処理がくり返される。
【0098】
そして、ステップS32において、データ付加処理プログラム43Bが、プログラム番号iはプログラム総数以下ではない(プログラム番号iはプログラム総数より大きい)と判定した場合、データ付加処理は終了する。
【0099】
その後、処理は図3のステップS2に進む。
【0100】
ここで、上記のデータ付加処理を、図1の実行プログラム42−1乃至42−4に当てはめた場合の例について説明する。なお、図1の実行プログラム42−1を1番目の実行プログラムとし、実行プログラム42−2を2番目の実行プログラムとし、実行プログラム42−3を3番目の実行プログラムとし、実行プログラム42−4を4番目の実行プログラムとする。
【0101】
データ付加処理プログラム43Bは、まず、ステップS31で、プログラム番号iを1に初期化し、RAM13のバッファを初期化する。次に、ステップS32において、プログラム番号i=1が、プログラム総数(=4)以下であるか否かを判定し、プログラム番号iは、プログラム総数以下なので、処理はステップS33に進む。
【0102】
ステップS33において、データ付加処理プログラム43Bは、1番目の実行プログラム、すなわち実行プログラム42−1をストレージデバイス18から読み込み、RAM13のバッファに記憶させる。データ付加処理プログラム43Bは、ステップS34において、実行プログラム42−1のプログラム長を取得し、ステップS35において、実行プログラム42−1のプログラム長をビット長Xで割り算し、ステップS36において、実行プログラム42−1のプログラム長がビット長Xで割り切れたか否かを判定する。そして、実行プログラム42−1のプログラム長がビット長Xで割り切れなかった場合、処理はステップS37に進み、データ付加処理プログラム43Bは、実行プログラム42−1に、不足分のデータを付加し、ステップS38において、ステップS37でデータが付加された実行プログラム42−1をストレージデバイス18に保存する。また、ステップS36において、データ付加処理プログラム43Bが、実行プログラム42−1のプログラム長がビット長Xで割り切れたと判定した場合、ステップS37はスキップされ、ステップS38において、実行プログラム42−1が、ストレージデバイス18に保存される。ステップS38の後、処理はステップS39に進み、データ付加処理プログラム43Bは、iを1だけ増やして、i=2とする。
【0103】
その後、処理はステップS32に戻り、データ付加処理プログラム43Bは、プログラム番号i=2が、プログラム総数(=4)以下であるか否かを判定し、プログラム番号i=2は、プログラム総数(=4)以下であるので、処理はステップS33に進む。データ付加処理プログラム43Bは、ステップS33において、2番目の実行プログラムである実行プログラム42−2をストレージデバイス18から読み込み、RAM13のバッファに記憶させる。その後、データ付加処理プログラム43Bは、2番目の実行プログラム42−2に対して、ステップS34乃至ステップS38の処理を実行する。なお、2番目の実行プログラム42−2に対するステップS34乃至ステップS38の処理は、1番目の実行プログラム42−1に対するステップS34乃至ステップS38の処理と同様であるので、説明を省略する。ステップS38の後、ステップS39において、データ付加処理プログラム43Bは、iを1だけ増やして、i=3とする。
【0104】
その後、処理はステップS32に戻り、データ付加処理プログラム43Bは、プログラム番号i=3が、プログラム総数(=4)以下であるか否かを判定し、プログラム番号i=3は、プログラム総数(=4)以下であるので、処理はステップS33に進む。データ付加処理プログラム43Bは、ステップS33において、3番目の実行プログラムである実行プログラム42−3をストレージデバイス18から読み込み、RAM13のバッファに記憶させる。その後、データ付加処理プログラム43Bは、3番目の実行プログラム42−3に対して、ステップS34乃至ステップS38の処理を実行する。なお、3番目の実行プログラム42−3に対するステップS34乃至ステップS38の処理は、1番目の実行プログラム42−1に対するステップS34乃至ステップS38の処理と同様であるので、説明を省略する。ステップS38の後、ステップS39において、データ付加処理プログラム43Bは、iを1だけ増やして、i=4とする。
【0105】
その後、処理はステップS32に戻り、データ付加処理プログラム43Bは、プログラム番号i=4が、プログラム総数(=4)以下であるか否かを判定し、プログラム番号i=4は、プログラム総数(=4)以下であるので、処理はステップS33に進む。データ付加処理プログラム43Bは、ステップS33において、4番目の実行プログラムである実行プログラム42−4をストレージデバイス18から読み込み、RAM13のバッファに記憶させる。その後、データ付加処理プログラム43Bは、4番目の実行プログラム42−4に対して、ステップS34乃至ステップS38の処理を実行する。なお、4番目の実行プログラム42−4に対するステップS34乃至ステップS38の処理は、1番目の実行プログラム42−1に対するステップS34乃至ステップS38の処理と同様であるので、説明を省略する。ステップS38の後、ステップS39において、データ付加処理プログラム43Bは、iを1だけ増やして、i=5とする。
【0106】
その後、処理はステップS32に戻り、データ付加処理プログラム43Bは、プログラム番号i=5が、プログラム総数(=4)以下であるか否かを判定し、プログラム番号i=5は、プログラム総数(=4)以下ではない(プログラム番号i=5は、プログラム総数(=4)より大きい)ので、データ付加処理プログラム43Bは、一連のデータ付加処理を終了する。その後、処理は図3のステップS2に進む。
【0107】
以上のようにして、不揮発性メモリ21に格納すべき全ての実行プログラム42−1乃至42−4に対して、必要に応じて、データが付加される。
【0108】
説明は図3に戻り、ステップS1のデータ付加処理の後、ステップS2において、配列処理プログラム43Cは、プログラム番号iを1に初期化し、RAM13のバッファを初期化する。
【0109】
ステップS3において、配列処理プログラム43Cは、プログラム番号iが、プログラム総数以下であるか否かを判定し、プログラム番号iがプログラム総数以下である場合、処理はステップS4に進む。図1の例の場合、不揮発性メモリ21に格納すべき実行プログラムは、実行プログラム42−1乃至42−4の4個なので、プログラム総数は4となる。
【0110】
ステップS4において、配列処理プログラム43Cは、プログラム番号iが偶数であるか否かを判定し、プログラム番号iが偶数ではなかった場合(奇数だった場合)、処理はステップS5に進む。
【0111】
ステップS5において、配列処理プログラム43Cは、i番目の実行プログラム42をストレージデバイス18から読み込み、読み込まれた実行プログラム42を、図5の左側に示されるように、そのままの並び順でRAM13の一時的なバッファに記憶させる。その後、処理はステップS7に進む。なお、以下の説明において、図5の左側に示された、実行プログラム42の並び方の形式を形式1とする。なお、形式1は、撮像装置201のCPU244が直接実行可能な並び順の形式である。また、ビット長Xの例としては、1バイトや、撮像装置201のCPU244の命令長(32ビットRISC(Reduced Instruction Set Computer)では4バイト)、LZ77の移動窓のサイズやその半分などが考えられる。
【0112】
ステップS4において、配列処理プログラム43Cが、プログラム番号iは偶数であると判定した場合、処理はステップS6に進む。
【0113】
ステップS6において、配列処理プログラム43Cは、i番目の実行プログラム42をストレージデバイス18から読み込み、RAM13上で、ビット長X毎に、逆順に並び替えた後、並び替えられた実行プログラム42をRAM13のバッファに追加する(記憶させる)。図5の右側には、ステップS6において、逆順に並べ替えられた実行プログラム42の例が示されている。
【0114】
図5の右側に示された実行プログラム42は、1番目乃至N番目のN個の部分コードが、N番目の部分コードを先頭にし、1番目の部分コードを末尾にして並べられている。すなわち、図5の右側の実行プログラム42においては、図4に示されたN番目の部分コードが、先頭に並べられ、N−1番目の部分コードが、N番目の部分コードの次に並べられ、N−2番目の部分コードが、N−1番目の部分コードの次に並べられ、N−3番目の部分コードが、N−2番目の部分コードの次に並べられている。以下も同様にして並べられてゆき、末尾には、1番目の部分コードが並べられている。なお、図5の右側に示された実行プログラム42の並び方の形式を形式2とする。なお、形式2は、撮像装置201のCPU244が直接実行することができない並び順の形式である。
【0115】
形式2の実行プログラム42を、図5の左側に示された形式1の実行プログラム42と比較すると、形式1の並び方においては、上方に示された先頭のデータは、1番目の部分コードとされ、1番目の部分コードの次は2番目の部分コードとされ、2番目の部分コードの次は3番目の部分コードとされる。以降、順番に並べられ、末尾のデータは、N番目の部分コードとされる。それに対して、形式2の並び方においては、先頭のデータは、N番目の部分コードとされ、N番目の部分コードの次はN−1番目の部分コードとされ、N−1番目の部分コードの次は、N−2番目の部分コードとされ、N−2番目の部分コードの次は、N−3番目の部分コードとされる。以降、順番に並べられ、末尾のデータは、1番目の部分コードとされる。
【0116】
すなわち、形式1の並び方においては、ビット長X毎に区切られた実行プログラム42の各部分コードは、実行プログラム42の記述順(1番目→N番目)に従って、先頭から末尾タに向けて並べられている。それに対して、形式2の並び方においては、ビット長X毎に区切られた実行プログラム42の各部分コードは、実行プログラム42の記述順とは、逆の順番(N番目→1番目)に従って、先頭から末尾に向けて並べられている。すなわち、形式2の並び順は、形式1の並び順をビット長X単位で倒置した並び順となっている。
【0117】
実行プログラム42は、図4のプログラムコードの先頭の方にCPUのインストラクションコードが配置され、末尾の方に変数の初期値や定数値、文字列などのデータが配置されている。すなわち、図4のプログラムコードの1番目の部分コードの方には、CPUのインストラクションコードが配置され、N番目の部分コードの方には、変数の初期値や定数値、文字列などのデータが配置されている。
【0118】
従って、図5に示された形式1の並び順においては、先頭のデータの方に、CPUのインストラクションコードが配置され、末尾のデータの方に、変数の初期値や定数値、文字列などが配置される。また、図5に示された形式2の並び順においては、先頭のデータの方に、変数の初期値や定数値、文字列などが配置され、末尾のデータの方に、CPUのインストラクションコードが配置される。
【0119】
なお、図5の左側の実行プログラム42内に示されている、上から下に向かう矢印は、この実行プログラム42が形式1であることを示し、図5の右側の実行プログラム42内に示されている、下から上に向かう矢印は、この実行プログラム42が形式2であることを示している。後述する図7、図9、および図16も同様である。
【0120】
上記したように、実行プログラム42は、ステップS5においては、形式1の並び順でRAM13のバッファに記憶され、ステップS6においては、形式2の並び順でRAM13のバッファに記憶される。
【0121】
図3に戻り、ステップS6の処理により、実行プログラム42が、図4の形式2のように並び替えられた後、処理はステップS7に進む。
【0122】
ステップS7において、配列処理プログラム43Cは、i番目の実行プログラム42のプログラム長(ビット数)を示すサイズデータを取得し、これをRAM13の情報データを記憶する領域に記憶させる。なお、RAM13には、実行プログラム42を記憶させる領域と情報データを記憶させる領域が、それぞれ異なる領域として確保されている。
【0123】
ステップS8において、配列処理プログラム43Cは、プログラム番号iを1だけ増やす。その後、処理はステップS3に戻り、上述したステップS3以降の処理をくり返す。
【0124】
そして、ステップS3において、配列処理プログラム43Cが、プログラム番号iは、プログラム総数以下ではない(プログラム番号iは、プログラム総数より大きい)と判定した場合、処理はステップS9に進む。
【0125】
なお、以上のステップS3乃至ステップS8のループ処理は、複数の実行プログラム42を、1つおきに逆順に並べ替えて連結する処理であり、ステップS3乃至ステップS8の処理をくり返すことにより、RAM13のバッファには、形式1の並び順の実行プログラム42と形式2の並び順の実行プログラム42が交互に並べられ、記憶される。このことをより具体的に示すために、実行プログラム42−1乃至42−4をRAM13に記憶させる場合を例にして、ステップS3乃至ステップS8の処理について、以下に説明する。
【0126】
配列処理プログラム43Cは、上述したステップS2において、プログラム番号iを1に初期化し、RAM13のバッファを初期化した後、ステップS3において、プログラム番号i(=1)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=1)は、プログラム総数(=4)以下であるので、処理はステップS4に進む。
【0127】
ステップS4において、配列処理プログラム43Cは、プログラム番号i(=1)は偶数であるか否かを判定し、プログラム番号i(=1)は偶数ではない(奇数である)ので、処理はステップS5に進む。ステップS5において、配列処理プログラム43Cは、1番目の実行プログラム42−1をストレージデバイス18から読み込み、形式1の並び順で、RAM13のバッファに追加する。その後、ステップS7において、配列処理プログラム43Cは、1番目の実行プログラム42−1のプログラム長を示すサイズデータを情報データとしてRAM13に記憶させる。なお、情報データは、RAM13のうち、実行プログラム42とは別の領域に記憶される。ステップS8において、配列処理プログラム43Cは、iを1だけ増やし、i=2とする。
【0128】
その後、処理はステップS3に戻り、配列処理プログラム43Cは、プログラム番号i(=2)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=2)は、プログラム総数(=4)以下であるので、処理はステップS4に進む。ステップS4において、配列処理プログラム43Cは、プログラム番号i(=2)は、偶数であるか否かを判定し、プログラム番号i(=2)は偶数なので、処理はステップS6に進む。ステップS6において、配列処理プログラム43Cは、2番目のプログラム42−2をストレージデバイス18から読み込み、形式2の並び順に並び替えてRAM13のバッファに記憶させる。なお、配列処理プログラム43Cは、2番目の実行プログラム42−2を、1番目の実行プログラム42−1が記憶されたメモリアドレスの直後のメモリアドレスに続けて記憶させる。その後、ステップS7において、配列処理プログラム43Cは、2番目の実行プログラム42−2のプログラム長を示すサイズデータをRAM13に記憶された情報データに追加して記憶させる。ステップS8において、配列処理プログラム43Cは、iを1だけ増やし、i=3とする。
【0129】
その後、処理はステップS3に戻り、配列処理プログラム43Cは、プログラム番号i(=3)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=3)は、プログラム総数(=4)以下であるので、処理はステップS4に進む。ステップS4において、配列処理プログラム43Cは、プログラム番号i(=3)は、偶数であるか否かを判定し、プログラム番号i(=3)は偶数ではない(奇数である)ので、処理はステップS5に進む。ステップS5において、配列処理プログラム43Cは、3番目のプログラム42−3をストレージデバイス18から読み込み、形式1の並び順でRAM13のバッファに記憶させる。なお、配列処理プログラム43Cは、3番目の実行プログラム42−3を、2番目の実行プログラム42−2が記憶されたメモリアドレスの直後のメモリアドレスに続けて記憶させる。その後、ステップS7において、配列処理プログラム43Cは、3番目の実行プログラム42−3のプログラム長を示すサイズデータをRAM13に記憶された情報データに追加して記憶させる。ステップS8において、配列処理プログラム43Cは、iを1だけ増やし、i=4とする。
【0130】
その後、処理はステップS3に戻り、配列処理プログラム43Cは、プログラム番号i(=4)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=4)は、プログラム総数(=4)以下であるので、処理はステップS4に進む。ステップS4において、配列処理プログラム43Cは、プログラム番号i(=4)は、偶数であるか否かを判定し、プログラム番号i(=4)は偶数であるので、処理はステップS6に進む。ステップS6において配列処理プログラム43Cは、4番目のプログラム42−4をストレージデバイス18から読み込み、形式2の並び順に並び替えてRAM13のバッファに記憶させる。なお、配列処理プログラム43Cは、4番目の実行プログラム42−4を、3番目の実行プログラム42−3が記憶されたメモリアドレスの直後のメモリアドレスに続けて記憶させる。その後、ステップS7において、配列処理プログラム43Cは、4番目の実行プログラム42−4のプログラム長を示すサイズデータをRAM13に記憶された情報データに追加して記憶させる。ステップS8において、配列処理プログラム43Cは、iを1だけ増やし、i=5とする。
【0131】
その後、処理はステップS3に戻り、配列処理プログラム43Cは、プログラム番号i(=5)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=5)は、プログラム総数(=4)以下ではないので、処理はステップS9に進む。
【0132】
以上のような処理の結果、RAM13のバッファには、図7に示されるようプログラムデータ群271が記憶される。すなわち、プログラムデータ群271は、連続的に並べられた実行プログラム42−1乃至42−4により構成されている。実行プログラム42−1は、形式1の並び順で記憶されている。実行プログラム42−2は、形式2の並び順で、実行プログラム42−1が記憶されたメモリアドレスの直後に記憶されている。実行プログラム42−3は、形式1の並び順で、実行プログラム42−2が記憶されたメモリアドレスの直後に記憶されている。実行プログラム42−4は、形式2の並び順で、実行プログラム42−3が記憶されたメモリアドレスの直後に記憶されている。このように、形式1と形式2の並び順を交互にくり返して、実行プログラム42−1乃至42−4を並べることにより、実行プログラム同士の境界部に、類似するデータが配置されることになる。
【0133】
すなわち、図5を参照して説明したように、形式1の並び順においては、先頭のデータの方に、CPUのインストラクションコードが配置され、末尾のデータの方に、変数の初期値や定数値、文字列などが配置される。それに対して、形式2の並び順においては、先頭のデータの方に、変数の初期値や定数値、文字列などが配置され、末尾のデータの方に、CPUのインストラクションコードが配置される。
【0134】
そこで、図7のプログラムデータ群271の実行プログラム42−1と実行プログラム42−2の境界に注目すると、実行プログラム42−1の末尾の方、および実行プログラム42−2の先頭の方には、変数の初期値や定数値、文字列などのデータが配置されている。また、実行プログラム42−2と実行プログラム42−3の境界に注目すると、実行プログラム42−2の末尾の方、および実行プログラム42−3の先頭の方には、CPUのインストラクションコードが配置されている。また、実行プログラム42−3と実行プログラム42−4の境界に注目すると、実行プログラム42−3の末尾の方、および実行プログラム42−4の先頭の方には、変数の初期値や定数値、文字列などのデータが配置されている。
【0135】
このように、実行プログラム42同士の境界に、類似するデータを配置することにより、後に、プログラムデータ群271を圧縮する際に、境界部分の圧縮率の低下を防ぐことができる。
【0136】
ところで、図7において、下方に、サイズデータ272が示されている。このサイズデータ272は、情報データに含まれるデータであり、272Aは、実行プログラム42−1のプログラム長(ビット数)を示すサイズデータであり、272Bは、実行プログラム42−2のプログラム長(ビット数)を示すサイズデータであり、272Cは、実行プログラム42−3のプログラム長(ビット数)を示すサイズデータであり、272Dは、実行プログラム42−4のプログラム長(ビット数)を示すサイズデータである。
【0137】
図3に戻り、ステップS9において、圧縮処理プログラム43Aは、RAM13のバッファに記憶されたプログラムデータ群271を圧縮する。図8は、圧縮処理プログラム43Aによる圧縮の概念を表している。すなわち、圧縮処理プログラム43Aは、移動窓304を設定し、この移動窓304を、プログラムデータ群271に沿って、矢印A方向に移動させてゆき、プログラムデータ群271を順次圧縮してゆく。図8において、符号化済みデータ301は、移動窓304が移動し、符号化が済んだデータを示している。また、302は、現在の移動窓304を基にして符号化しようとする1符号化単位のデータを示している。また、303は、まだ符号化されていない未符号化データを示している。
【0138】
ここで、図8の符号化方式である、LZ77符号について説明する。辞書式データ圧縮アルゴリズムの代表的なものとしてLempel−Ziv符号がある。Lempel−Ziv符号は、大きく分けてLZ77符号とLZ78符号の2種類がある。このうち、図8のような移動窓304を仮定して、移動窓304中のデータを辞書として符号化/復号するのがLZ77符号である。
【0139】
LZ77符号によりデータを圧縮(符号化)する圧縮処理プログラム43Aは、まず、辞書中に存在する文字列の中で、符号化しようとする1符号化単位のデータ302と最長一致する文字列を検索する。そして、一致するものがあった場合、圧縮処理プログラム43Aは、一致するものがあること示すフラグ、一致した文字列の辞書中における開始位置、および一致長を符号として、1符号化単位のデータ302中のデータを符号化する。また、一致するものがなかった場合、圧縮処理プログラム43Aは、一致するものがないことを示すフラグ、および一致するものがなかった文字列をそのまま符号として、1符号化単位のデータ302中のデータを符号化する。そして、圧縮処理プログラム43Aは、今符号化された1符号化単位のデータ302を含むように移動窓304をスライドさせて新たな辞書とし、その辞書からまた一致するものを検索して符号化する。圧縮処理プログラム43Aは、以上の処理を繰り返すことでデータ全体を符号化する。
【0140】
Lempel−Ziv符号は、確率構造が未知なデータを漸近的にエントロピーレートまで圧縮するユニバーサルデータ圧縮であり、効率のよい圧縮ができることが知られている。また、非常に高速な伸張が可能であり、ソフトウエア処理にも向いている。
【0141】
図3に戻って、ステップS10において、記録プログラム43は、圧縮済みのプログラムデータ、および情報データを、圧縮コードデータ41としてストレージデバイス18に記憶させる。なお、情報データは、ステップS7で追加されたサイズデータ272、プログラム総数を示すプログラム総数データ、およびビット長Xを示すビット長データにより構成される。図9は、圧縮コードデータ41の例を表している。
【0142】
図9において、圧縮コードデータ41は、ステップS9で、圧縮処理プログラム43Aにより圧縮された圧縮済みプログラムデータ351、および情報データ352により構成される。情報データ352は、ビット長データ361、プログラム総数データ362、およびサイズデータ272により構成される。ビット長データ361は、予め配列処理プログラム43Cに設定されたビット長Xに基づいて生成されたデータであり、プログラム総数データ362は、不揮発性メモリ21に格納される実行プログラム42のプログラム総数(4個)に基づいて生成される。なお、ビット長データ361およびプログラム総数データ362は、記録プログラム43により生成される。
【0143】
ステップS11において、記録プログラム43は、ステップS10の処理によりストレージデバイス18に記憶された圧縮コードデータ41およびブートプログラム44を読み出し、不揮発性メモリ書き込み装置14に供給する。不揮発性メモリ書き込み装置14は、供給された圧縮コードデータ41およびブートプログラム44を不揮発性メモリ21に格納する(記憶させる)。
【0144】
以上のようにして、不揮発性メモリ21に、圧縮された実行プログラム42が格納される。
【0145】
以上のように、連結するプログラムを1つおきに逆順に並べ替えることで、類似するコードをより近づけてから圧縮することにより、プログラム同士の境界付近における局所的な圧縮率低下を軽減でき、全体としての圧縮率を向上させることができる。結果的に、不揮発性メモリ21に保存させるデータのデータ量を削減することができるため、メモリコストを削減することができる。また不揮発性メモリ21に書き込むデータ量が減少するので、不揮発性メモリへのデータの書き込み時間を短縮することが可能となる。
【0146】
さらに、以上の処理は、既存の圧縮アルゴリズムへの変更を加える必要がないため、既存のシステムへの適用を容易に実現することができる。
【0147】
以上のようにして不揮発性メモリ21に格納された実行プログラム42は、撮像装置201のCPU244により伸長され実行される。
【0148】
次に、図10のフローチャートを参照して、撮像装置201の伸長処理、すなわち、撮像装置201が、不揮発性メモリ21に格納された実行プログラムを伸長し、実行可能な並び順に並び替える処理について説明する。
【0149】
操作部212が操作され、撮像装置201の起動が指示された場合、ホストCPU213は、CPU244−1に、ブートプログラム44の実行を指示する。そこで、ステップS101において、CPU244−1は、不揮発性メモリ21に記憶されたブートプログラム44を読み出し、実行する。なお、ブートプログラム44は、圧縮済みプログラムデータ351を伸長する伸長プログラム等を含んでいる。図11に、ブートプログラム44に含まれるプログラムの例が示されている。すなわち、図11において、ブートプログラム44には、伸長プログラム44A、管理プログラム44B、および配列処理プログラム44Cが含まれている。以下のステップS102乃至ステップS109の処理は、CPU244−1がブートプログラム44を実行することにより、実行される。
【0150】
ステップS102において、CPU244−1は、伸長プログラム44Aを実行することにより、図11に示されるように、不揮発性メモリ21から、圧縮コードデータ41を読み出し、圧縮済みプログラムデータ351を伸長する。そして、CPU244−1は、情報データ352および伸長されたプログラムデータ群271をSDRAM214に記憶させる。なお、CPU244−1は、伸長されたプログラムデータ群271をSDRAM214に記憶させる際、SDRAM214の予め設定された先頭アドレスから順番に、対応するメモリアドレスに記憶させる。
【0151】
ステップS103において、CPU244−1は、管理プログラム44Bを実行することにより、SDRAM214に記憶された情報データ(サイズデータ272、ビット長データ361、およびプログラム総数データ362)に基づいて、各実行プログラムの先頭が記憶されたメモリアドレス(先頭アドレス)を算出する。
【0152】
すなわち、プログラムデータ群271は、ステップS102の処理により、予め設定された先頭アドレスから順番に記憶されているので、1番目の実行プログラム42−1のプログラム長に基づいて、2番目の実行プログラム42−2の記録開始位置のメモリアドレスを特定する。そして、2番目の実行プログラム42−2の記録開始位置のメモリアドレスと実行プログラム42−2のプログラム長に基づいて、3番目の実行プログラム42−3の記録開始位置のメモリアドレスを特定する。同様に、3番目の実行プログラム42−3の記録開始位置のメモリアドレスと実行プログラム42−3のプログラム長に基づいて、4番目の実行プログラム42−4の記録開始位置のメモリアドレスを特定する。このようにして、CPU244−1は、各実行プログラムの先頭が記憶されたメモリアドレス(先頭アドレス)を算出する。
【0153】
ステップS104において、CPU244−1(管理プログラム44B)は、ステップS103で算出された各実行プログラムの先頭アドレスとプログラム長を対応付けたプログラム管理テーブルを作成し、SDRAM214に記憶させる。図11に示されるように、SDRAM214には、ステップS104で作成されたプログラム管理テーブル401が記憶されている。
【0154】
以下、ステップS105乃至ステップS109の処理は、CPU244−1が、配列処理プログラム44Cを実行することにより実行される。まず、ステップS105において、CPU244−1は、プログラム番号iを1に初期化する。
【0155】
ステップS106において、CPU244−1は、プログラム番号iがプログラム総数以下であるか否かを判定し、プログラム番号iがプログラム総数以下である場合、処理はステップS107に進む。
【0156】
ステップS107において、CPU244−1は、プログラム番号iが偶数であるか否かを判定し、iが偶数である場合、処理はステップS108に進む。
【0157】
ステップS108において、CPU244−1は、SDRAM214に記憶されたi番目の実行プログラムを、所定のビット長X毎に逆順に並び替え、SDRAM214に記憶させる。これにより、形式2の並び順に倒置されていた実行プログラムは、図11に示されるように、本来の並び順(形式1の並び順)に並び替えられる。その後、処理はステップS109に進む。
【0158】
ステップS107において、CPU244−1が、プログラム番号iは偶数ではない(奇数である)と判定した場合、ステップS108の処理はスキップされ、処理はステップS109に進む。
【0159】
ステップS109において、CPU244−1は、プログラム番号iを1だけ増やす。その後、処理はステップS106に戻り、上述したステップS106以降の処理がくり返される。なお、ステップS106乃至ステップS109のループの処理は、形式2の並び順に変換されていた実行プログラム42を形式1の並び順に変換する処理である。
【0160】
そして、ステップS106において、CPU244−1が、プログラム番号iはプログラム総数以下ではない(プログラム番号iはプログラム総数より大きい)と判定した場合、CPU244−1は、伸長処理を終了する。
【0161】
以上のステップS105乃至ステップS109の処理をより具体的に示すために、図9のプログラムデータ群271のように並べられた実行プログラム42−1乃至42−4に対して、ステップS106乃至ステップS109の処理を実行した場合の例を以下に説明する。
【0162】
ステップS105でプログラム番号iが1に初期化された後、ステップS106において、CPU244−1は、プログラム番号i(=1)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=1)はプログラム総数(=4)以下なので、処理はステップS107に進む。ステップS107において、CPU244−1は、プログラム番号i(=1)は偶数であるか否かを判定し、プログラム番号i(=1)は偶数ではない(奇数である)ので、ステップS108の処理はスキップされ、処理はステップS109に進む。ステップS109において、CPU244−1は、プログラム番号iを1だけ増やし、プログラム番号i=2とする。その後、処理はステップS106に戻る。
【0163】
ステップS106において、CPU244−1は、プログラム番号i(=2)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=2)はプログラム総数(=4)以下なので、処理はステップS107に進む。ステップS107において、CPU244−1は、プログラム番号i(=2)は偶数であるか否かを判定し、プログラム番号i(=2)は偶数なので、処理はステップS108に進む。ステップS108において、CPU244−1は、SDRAM214に記憶された2番目の実行プログラム42−2の記録位置を、プログラム管理テーブル401より取得し、取得された記録位置に基づいて、実行プログラム42−2のプログラムコードを特定する。そして、CPU244−1は、実行プログラム42−2の並び順を、形式2から形式1に変換して、SDRAM214の記憶を更新する。その後、処理はステップS109に進む。ステップS109において、CPU244−1は、プログラム番号iを1だけ増やし、プログラム番号i=3とする。その後、処理はステップS106に戻る。
【0164】
ステップS106において、CPU244−1は、プログラム番号i(=3)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=3)はプログラム総数(=4)以下なので、処理はステップS107に進む。ステップS107において、CPU244−1は、プログラム番号i(=3)は偶数であるか否かを判定し、プログラム番号i(=3)は偶数ではない(奇数である)ので、ステップS108の処理はスキップされ、処理はステップS109に進む。ステップS109において、CPU244−1は、プログラム番号iを1だけ増やし、プログラム番号i=4とする。その後、処理はステップS106に戻る。
【0165】
ステップS106において、CPU244−1は、プログラム番号i(=4)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=4)はプログラム総数(=4)以下なので、処理はステップS107に進む。ステップS107において、CPU244−1は、プログラム番号i(=4)が偶数であるか否かを判定し、プログラム番号i(=4)は偶数なので、処理はステップS108に進む。ステップS108において、CPU244−1は、SDRAM214に記憶された4番目の実行プログラム42−4の記録位置を、プログラム管理テーブル401より取得し、取得された記録位置に基づいて、実行プログラム42−4のプログラムコードを特定する。そして、CPU244−1は、実行プログラム42−4の並び順を、形式2から形式1に変換して、SDRAM214の記憶を更新する。その後、処理はステップS109に進む。ステップS109において、CPU244−1は、プログラム番号iを1だけ増やし、プログラム番号i=5とする。その後、処理はステップS106に戻る。
【0166】
ステップS106において、CPU244−1は、プログラム番号i(=5)がプログラム総数(=4)以下であるか否かを判定し、プログラム番号i(=5)はプログラム総数(=4)以下ではない(プログラム番号i(=5)はプログラム総数(=4)より大きい)ので、CPU244−1は、伸長処理を終了する。
【0167】
以上の処理の結果、並び順が倒置されていた(形式2の)実行プログラム42−2および42−4が、形式1の並び順に変換される。図11の実行プログラム42−1乃至42−4は、図10の伸長処理により、並び順が変換された後の状態を表している。
【0168】
形式2の並び順だった実行プログラム42−2および42−4を形式1の並び順に変換することにより、実行プログラム42−2および42−4は、CPU244が直接実行可能な並び順となる。
【0169】
ユーザは、操作部212を操作して、例えば、映像および音声の記録や再生等、種々の動作を指示することができ、ホストCPU213は、ユーザからの指示に対応した実行プログラム42を、CPU244に実行させる。なお、CPU244−1乃至244−3は、それぞれ実行する実行プログラム42が割り当てられている。図11の例においては、CPU244−1は、実行プログラム42−1を実行するように設定され、CPU244−2は、実行プログラム42−2を実行するように設定され、CPU244−3は、実行プログラム42−3および42−4を実行するように設定されている。
【0170】
次に、図12のフローチャートを参照して、撮像装置201のプログラム実行処理、すなわち、撮像装置201が、実行プログラム42を実行する処理について説明する。
【0171】
ステップS151において、ホストCPU213は、操作部212からの操作信号に基づいて、所定の実行プログラム42の実行が指示されたか否かを判定し、所定の実行プログラム42の実行が指示されるまでステップS151の処理をくり返して待機する。そして、所定の実行プログラム42の実行が指示された場合、処理はステップS152に進む。
【0172】
CPU244−1乃至244−3のそれぞれが実行する実行プログラム42は、予め設定されている。例えば、図11の例においては、CPU244−1は、実行プログラム42−1を実行し、CPU244−2は、実行プログラム42−2を実行し、CPU244−3は、実行プログラム42−3および42−4を実行するように、予め設定されている。そこで、ステップS152において、ホストCPU213は、ステップS151で実行するように指示された実行プログラム42が、CPU244−1乃至244−3のうち、どのCPU244により実行されるべき実行プログラムなのかを特定し、特定したCPU244に対して、ステップS151で指示された実行プログラム43を実行するように指令する。以下の説明においては、実行プログラム42−3の実行を指示された場合を例にして説明する。ステップS151において、実行プログラム42−3を実行するように指示された場合、ホストCPU213は、CPU244−3に対して、実行プログラム42−3を実行するように指令する。
【0173】
CPU244−3は、ホストCPU213からの指令に従って、まず、プログラム管理テーブル401を参照して、実行する実行プログラム42−3が記憶された開始アドレスを算出する。
【0174】
ステップS153において、CPU244−3は、ステップS152で算出された開始アドレスにジャンプし、実行プログラム42−3の実行を開始する。
【0175】
ステップS154において、CPU244−3は、実行プログラム42−3の処理が全て実行されたか否かを判定し、実行プログラム42−3の処理が全て実行されていない場合(まだ完了していない処理がある場合)、処理はステップS155に進む。
【0176】
ユーザは、実行プログラム42−3の実行中に、操作部212を操作して、その実行プログラム42−3の実行を強制終了させる指示を入力することができる。ホストCPU213は、実行中の実行プログラム42−3を強制終了させる指示が入力された場合、その実行プログラム42−3を実行中のCPU244−3に、実行プログラム42−3を強制終了するように通知する。そこで、ステップS155において、CPU244−3は、ホストCPU213から、強制終了の指示が通知されたか否かを判定し、ホストCPU213から、強制終了の指示が通知されていない場合、処理はステップS154に戻り、上述したステップS154以降の処理がくり返される。
【0177】
以上のようにして、実行プログラム42−3が終了せず、強制終了の指示も通知されていない場合、ステップS154およびステップS155の処理をくり返し、その間、実行プログラム42−3の実行が継続されるが、ステップS154において、実行プログラム42−3の処理が全て実行されたと判定された場合、CPU244−3は、実行プログラム42−3の実行を終了し、プログラム実行処理を終了する。また、ステップS155において、ホストCPU213から強制終了の指示が通知された場合、CPU244−3は、実行プログラム42−3の実行を終了し、プログラム実行処理を終了する。
【0178】
以上のようにして、プログラム実行処理が実行される。
【0179】
なお、以上の説明においては、CPU244−3が実行プログラム42−3を実行する場合を例にして説明したが、これは1例であり、上記の説明は、CPU244−1が実行プログラム42−1を実行する場合、CPU244−2が実行プログラム42−2を実行する場合、およびCPU244−3が実行プログラム42−4を実行する場合にも適用可能である。
【0180】
以上説明したように、本発明によれば、圧縮装置1で実行プログラム42を圧縮する際に、実行プログラム42を1つおきに倒置させてから、まとめて圧縮することにより、実行プログラム42同士の境界に、類似するコードを配置することができる。従って、圧縮率をより高くすることが可能となる。結果的に、不揮発性メモリ21の記憶容量をより小さいものとすることができ、コストダウンをはかることが可能となる。
【0181】
実験結果を、図13乃至図15を参照して説明する。
【0182】
実験に利用したのは、プログラムのコードサイズが共に131072バイトのプログラムaおよびプログラムbである。なお、プログラムaとプログラムbは、異なるコードである。実験では、プログラムaとプログラムbを図13のように連結した。図13に示される「a」は形式1の並び順のプログラムaを表し、「a逆」は、形式2の並び順のプログラムaを表し、「b」は、形式1の並び順のプログラムbを表し、「b逆」は、形式2の並び順のプログラムbを表している。すなわち、図13に示されるように、形式1のプログラムa、形式2のプログラムa、形式1のプログラムb、形式2のプログラムb、形式1のプログラムbの順番で、プログラムを連結した。この連結されたプログラム全体で、655360バイトである。
【0183】
図13に示されるようにして連結されたプログラムを、4096バイトの移動窓で、LZSSにより圧縮した結果が、図14および図15である。図15は、図14の表をグラフ化したものである。なお、LZSS(Lempel−Ziv−Storer−Syzmanski)は、LZ77のバリエーションの1つである。
【0184】
図14において、左側の列の「逆順に並べ替える単位(バイト)」は、ビット長Xを表している。なお、単位はバイトである。また、右側の列には、「本発明」と「従来」の圧縮率(%)の結果が示されている。図14に示されるように、ビット長Xを1バイト乃至16384バイトの複数の長さに設定して、実験を行った。
【0185】
図15において、縦軸は圧縮率(%)を示し、横軸はビット長X(「逆順に並べ替える単位(バイト)」)を表している。図15に明らかなように、本実験の結果、ビット長Xがa乃至bの間、およびc以上である場合、本発明を適用したほうが、従来より圧縮率を高くすることができる。それに対して、ビット長Xが1乃至aの間、およびb乃至cの間である場合、本発明を適用すると、従来より圧縮率が低くなってしまう。ビット長Xを適切な値に設定すれば、本発明を適用することにより、従来より圧縮率を高くすることができることが、この実験結果より確かめられた。
【0186】
なお、図13乃至図15に示されたものは、実験の1例であり、本発明が、従来と比較して、図14および図15に示される程度しか、圧縮率の向上を望めないことを意味するものではない。例えば、プログラムデータ群271全体のデータ量は同じでも、プログラムデータ群271を構成する実行プログラムの個数が多ければ、実行プログラム同士の境界も多くなるので、従来の圧縮率と比較して、より高い圧縮率を期待することができる。
【0187】
ところで、以上の説明においては、図7のプログラムデータ群271に示されるように、連結する1番目の実行プログラム42−1を形式1の並び順とし、2番目の実行プログラム42−2を形式2の並び順とし、3番目の実行プログラム42−3を形式1の並び順とし、4番目の実行プログラム42−4を形式2の並び順としている。これに対して、連結する実行プログラム42−1乃至42−4を、図16に示されるようにしても良い。
【0188】
すなわち、図16のプログラムデータ群451においては、連結する1番目の実行プログラム42−1を形式2の並び順とし、2番目の実行プログラム42−2を形式1の並び順とし、3番目の実行プログラム42−3を形式2の並び順とし、4番目の実行プログラム42−4を形式1の並び順としている。図7のプログラムデータ群271と比較すると、図7のプログラムデータ群271においては、奇数番目の実行プログラムが形式1の並び順とされ、偶数番目の実行プログラムが形式2の並び順とされているのに対し、図16のプログラムデータ群451おいては、奇数番目の実行プログラムが形式2の並び順とされ、偶数番目の実行プログラムが形式1の並び順とされている。
【0189】
図16に示されるプログラムデータ群451を作成する場合、図3のデータ記録処理のステップS4の処理を変更する必要がある。すなわち、上述したステップS4においては、プログラム番号iが奇数である場合、処理はステップS5に進み、プログラム番号iが偶数である場合、処理はステップS6に進んでいたが、これを、プログラム番号iが奇数である場合、ステップS6に進み、プログラム番号iが偶数である場合、ステップS5に進むように変更する。これにより、図16に示されるプログラムデータ群451を作成することが可能となる。
【0190】
また、図16に示されるプログラムデータ群451が圧縮された圧縮コードデータ41を伸長する場合、図10のステップS107の処理を変更する必要がある。すなわち、上述したステップS107においては、プログラム番号iが偶数である場合、処理はステップS108に進み、プログラム番号iが奇数である場合、ステップS108の処理はスキップされ、処理はステップS109に進んでいたが、これを、プログラム番号iが偶数である場合、ステップS108の処理をスキップしてステップS109に進み、プログラム番号iが奇数である場合、ステップS108に進むように変更する。これにより、図16に示されるプログラムデータ群451が圧縮された圧縮コードデータ41を伸長して、倒置されていた実行プログラムを本来の並び順に直すことができる。
【0191】
ところで、本発明においては、図7のプログラムデータ群271と図16のプログラムデータ群451を、選択可能なようにすることもできる。この場合の圧縮処理について図17および図18のフローチャートを参照して説明する。
【0192】
ステップS201において、記録プログラム43のデータ付加処理プログラム43Bは、データ付加処理を実行する。なお、ステップS201の処理は、図3のステップS1の処理と同様であるため、詳細な説明は省略する。
【0193】
ステップS202において、記録プログラム43の配列処理プログラム43Cは、実行プログラム42の配列を、図7のプログラムデータ群271のようにするのか、図16のプログラムデータ群451のようにするのか、いずれかに設定する。なお、ステップS202の処理は、例えば、入力部15を介して、オペレータから、いずれかの選択を受け付けることにより、設定することができる。
【0194】
ステップS203において、配列処理プログラム43Cは、プログラム番号iを1に初期化し、RAM13のバッファを初期化する。
【0195】
ステップS204において、配列処理プログラム43Cは、ステップS202で設定された配列は、奇数番目の実行プログラム42を形式2の並び順にする配列であるか否かを判定し、ステップS202で設定された配列が、奇数番目の実行プログラム42を形式2の並び順にする配列ではない(偶数番目の実行プログラム42を形式2の並び順にする配列である)場合、処理はステップS205に進む。
【0196】
ステップS205乃至ステップS210の処理はそれぞれ、図3のステップS3乃至ステップS8の処理と同様であるため、説明を省略する。なお、ステップS205において、配列処理プログラム43Cが、プログラム番号iはプログラム総数以下ではない(プログラム番号iはプログラム総数より大きい)と判定した場合、処理はステップS211に進む。
【0197】
ステップS204において、配列処理プログラム43Cが、ステップS202で設定された配列は、奇数番目の実行プログラム42を形式2の並び順にする配列であると判定した場合、処理は図18のステップS215に進む。
【0198】
ステップS215において、配列処理プログラム43Cは、プログラム番号iが、プログラム総数以下であるか否かを判定し、プログラム番号iがプログラム総数以下である場合、処理はステップS216に進む。
【0199】
ステップS216において、配列処理プログラム43Cは、プログラム番号iが奇数であるか否かを判定し、プログラム番号iが奇数ではなかった場合(偶数だった場合)、処理はステップS217に進む。
【0200】
ステップS217において、配列処理プログラム43Cは、i番目の実行プログラム42をストレージデバイス18から読み込み、図5の左側に示されるように、形式1の並び順で、実行プログラム42をRAM13のバッファに追加する(記憶させる)。その後、処理はステップS219に進む。
【0201】
ステップS216において、配列処理プログラム43Cが、プログラム番号iは奇数であると判定した場合、処理はステップS218に進む。
【0202】
ステップS218において、配列処理プログラム43Cは、i番目の実行プログラム42をストレージデバイス18から読み込み、RAM13上で、形式2の並び順に並び替えた後、並び替えられた形式2の実行プログラム42をRAM13のバッファに追加する(記憶させる)。
【0203】
ステップS219において、配列処理プログラム43Cは、i番目の実行プログラム42のプログラム長(ビット数)を示すサイズデータを取得し、これをRAM13の情報データを記憶する領域に記憶させる。
【0204】
ステップS220において、配列処理プログラム43Cは、プログラム番号iを1だけ増やす。その後、処理はステップS215に戻り、上述したステップS215以降の処理をくり返す。
【0205】
そして、ステップS215において、配列処理プログラム43Cが、プログラム番号iは、プログラム総数以下ではない(プログラム番号iは、プログラム総数より大きい)と判定した場合、処理は図17のステップS211に進む。
【0206】
ステップS211において、圧縮処理プログラム43Aは、RAM13のバッファに記憶されたプログラムデータ群271(または451)を圧縮する。なお、ステップS211の処理は、図3のステップS9の処理と同様である。
【0207】
ステップS212において、配列処理プログラム43Cは、ステップS202での設定に基づいて、ステップS211で圧縮されたプログラムデータ群が、図7のプログラムデータ群271であるのか、図16のプログラムデータ群451であるのかを示す配列データを作成する。
【0208】
ステップS213において、記録プログラム43は、圧縮済みのプログラムデータ、および情報データを、圧縮コードデータ41としてストレージデバイス18に記憶させる。なお、情報データは、サイズデータ272、プログラム総数データ362、およびビット長データ361、並びにステップS212で生成された配列データにより構成される。
【0209】
ステップS214において、記録プログラム43は、ステップS213の処理によりストレージデバイス18に記憶された圧縮コードデータ41を読み出し、不揮発性メモリ書き込み装置14に供給する。不揮発性メモリ書き込み装置14は、供給された圧縮コードデータ41を不揮発性メモリ21に格納する(記憶させる)。なお、この際、記録プログラム43は、圧縮コードデータ41とともに、ブートプログラム44を読み出し、不揮発性メモリ書き込み装置14に供給する。不揮発性メモリ書き込み装置14は、圧縮コードデータ41とともにブートプログラム44を不揮発性メモリ21に格納する。
【0210】
以上のように、配列を、図7のプログラムデータ群271、または図16のプログラムデータ群451のいずれかに選択するようにしても良い。この場合、いずれを選択したのかを示す配列データを、情報データに含めることにより、後に、撮像装置201が伸長処理を行う際に、倒置された実行プログラム42を正確に、CPU244が実行可能な並び順に戻すことが可能となる。
【0211】
次に、図19および図20のフローチャートを参照して、図17および図18のデータ記録処理により不揮発性メモリ21に記憶された圧縮コードデータ41を伸長する伸長処理について説明する。
【0212】
ステップS251乃至ステップS254の処理は、それぞれ図10のステップS101乃至ステップS104の処理と同様であるので、説明を省略する。
【0213】
ステップS254の後、ステップS255において、CPU244−1(配列処理プログラム44C)は、SDRAM214に記憶された情報データの中から、配列データを読み出し、配列データに基づいて、奇数番目の実行プログラム42が形式2の並び順になっているか否かを判定し、奇数番目の実行プログラム42は形式2の並び順になっていない(偶数番目の実行プログラム42が形式2の並び順になっている)場合、処理はステップS256に進む。
【0214】
ステップS256乃至ステップS260の処理は、それぞれ図10のステップS105乃至ステップS109と同様である。すなわち、CPU244−1(配列処理プログラム44C)は、ステップS256において、プログラム番号iを1に初期化し、ステップS257において、プログラム番号iがプログラム総数以下であるか否かを判定し、プログラム番号iがプログラム総数以下である場合、処理はステップS258に進む。
【0215】
CPU244−1(配列処理プログラム44C)は、ステップS258において、プログラム番号iが偶数であるか否かを判定し、iが偶数である場合、処理はステップS259に進む。ステップS259において、CPU244−1(配列処理プログラム44C)は、SDRAM214に記憶されたi番目の実行プログラムを、所定のビット長X毎に逆順に並び替え、SDRAM214に記憶させる。これにより、倒置されていた実行プログラムは、本来の並び順(形式1の並び順)に並び替えられる。その後、処理はステップS260に進む。
【0216】
ステップS258において、CPU244−1(配列処理プログラム44C)が、プログラム番号iは偶数ではない(奇数である)と判定した場合、ステップS259の処理はスキップされ、処理はステップS260に進む。
【0217】
ステップS260において、CPU244−1(配列処理プログラム44C)は、プログラム番号iを1だけ増やす。その後、処理はステップS257に戻り、上述したステップS257以降の処理がくり返される。
【0218】
そして、ステップS257において、CPU244−1(配列処理プログラム44C)が、プログラム番号iはプログラム総数以下ではない(プログラム番号iはプログラム総数より大きい)と判定した場合、CPU244−1は、伸長処理を終了する。
【0219】
ステップS255において、CPU244−1(配列処理プログラム44C)が、奇数番目の実行プログラム42が形式2の並び順になっていると判定した場合、処理は図20のステップS261に進む。
【0220】
CPU244−1(配列処理プログラム44C)は、ステップS261において、プログラム番号iを1に初期化し、ステップS262において、プログラム番号iがプログラム総数以下であるか否かを判定し、プログラム番号iがプログラム総数以下である場合、処理はステップS263に進む。
【0221】
CPU244−1(配列処理プログラム44C)は、ステップS263において、プログラム番号iが奇数であるか否かを判定し、iが奇数である場合、処理はステップS264に進む。ステップS264において、CPU244−1(配列処理プログラム44C)は、SDRAM214に記憶されたi番目の実行プログラムを、所定のビット長X毎に逆順に並び替え、SDRAM241に記憶させる。これにより、倒置されていた実行プログラムは、本来の並び順(形式1の並び順)に並び替えられる。その後、処理はステップS265に進む。
【0222】
ステップS263において、CPU244−1(配列処理プログラム44C)が、プログラム番号iは奇数ではない(偶数である)と判定した場合、ステップS264の処理はスキップされ、処理はステップS265に進む。
【0223】
ステップS265において、CPU244−1(配列処理プログラム44C)は、プログラム番号iを1だけ増やす。その後、処理はステップS262に戻り、上述したステップS262以降の処理がくり返される。
【0224】
そして、ステップS262において、CPU244−1(配列処理プログラム44C)が、プログラム番号iはプログラム総数以下ではない(プログラム番号iはプログラム総数より大きい)と判定した場合、CPU244−1は、伸長処理を終了する。
【0225】
以上のようにしても良い。
【0226】
なお、以上の説明においては、図7のプログラムデータ群271、または図16のプログラムデータ群451のいずれを選択したかを示す配列データを情報データに含むようにしているが、このようにする代わりに、ブートプログラムに、予め設定するようにしても良い。すなわち、偶数番目の実行プログラム42を形式1の並び順に並び替えるブートプログラム、および奇数番目の実行プログラム42を形式1の並び順に並び替えるブートプログラムを圧縮装置1に予め保持しておく。そして、不揮発性メモリ21に圧縮コードデータ41を記憶させる場合、圧縮コードデータ41が、図7のプログラムデータ群271を圧縮した圧縮済みプログラムデータを含んでいたら、偶数番目の実行プログラム42を形式1の並び順に並び替えるブートプログラムを、圧縮コードデータ41とともに不揮発性メモリ21に記憶させ、圧縮コードデータ41が、図16のプログラムデータ群451を圧縮した圧縮済みプログラムデータを含んでいたら、奇数番目の実行プログラム42を形式1の並び順に並び替えるブートプログラムを、圧縮コードデータ41とともに不揮発性メモリ21に記憶させる。
【0227】
以上のようにしてもよい。
【0228】
ところで、先述した図15のグラフを参照すると分かるように、設定するビット長Xの値が違えば、プログラムデータ群の圧縮率も異なるものとなる。そこで、圧縮率が最も高いビット長Xのときの圧縮コードデータ41を不揮発性メモリ21に格納することにより、不揮発性メモリ21に記憶させる圧縮コードデータ41の容量を最小にすることができる。
【0229】
そこで、例えば、圧縮装置1に、複数の異なるビット長Xで、それぞれ圧縮コードデータ41を生成させ、生成された複数の圧縮コードデータ41の中から、データサイズが最小の圧縮コードデータ41を特定し、特定された圧縮コードデータ41を不揮発性メモリ21に格納するようにしても良い。
【0230】
この場合の、データ記録処理について、図21のフローチャートを参照して説明する。
【0231】
圧縮装置1は、予め複数のビット長Xの候補を保持している。圧縮装置1は、例えば、図14に示されるように、ビット長Xの候補として、1バイト、2バイト、4バイト、8バイト、16バイト、32バイト、64バイト、128バイト、256バイト、512バイト、1024バイト、2048バイト、4096バイト、8192バイト、および16384バイトの合計15個の候補を保持している。そして、ステップS301において、記録プログラム43は、全てのビット長Xの候補により圧縮コードデータ41が作成されたか否かを判定し、全てのビット長Xの候補により圧縮コードデータ41が作成されていない(まだ圧縮コードデータ41を作成していないビット長Xの候補が存在する)場合、処理はステップS302に進む。
【0232】
ステップS302において、記録プログラム43は、複数のビット長Xの候補の中から1つの候補を選択し、実行プログラム42を整列させる際のビット長Xとして設定する。
【0233】
ステップS303において、データ付加処理プログラム43Bは、ステップS302で設定されたビット長Xを利用して、データ付加処理を実行する。なお、ステップS303の処理は、図3のステップS1の処理と同様である。
【0234】
ステップS304乃至ステップS312の処理は、それぞれ図3のステップS2乃至ステップS10の処理と同様である。すなわち、配列処理プログラム43Cは、ステップS304において、プログラム番号iを1に初期化し、RAM13のバッファを初期化し、ステップS305において、プログラム番号iが、プログラム総数以下であるか否かを判定し、プログラム番号iがプログラム総数以下である場合、処理はステップS306に進む。
【0235】
ステップS306において、配列処理プログラム43Cは、プログラム番号iが偶数であるか否かを判定し、プログラム番号iが偶数ではなかった場合(奇数だった場合)、処理はステップS307に進む。ステップS307において、配列処理プログラム43Cは、i番目の実行プログラム42をストレージデバイス18から読み込み、形式1の並び順で、実行プログラム42をRAM13のバッファに追加する(記憶させる)。その後、処理はステップS309に進む。
【0236】
ステップS306において、配列処理プログラム43Cが、プログラム番号iは偶数であると判定した場合、処理はステップS308に進む。ステップS308において、配列処理プログラム43Cは、i番目の実行プログラム42をストレージデバイス18から読み込み、ステップS302で設定されたビット長X毎に、形式2の並び順に並び替えた後、並び替えられた実行プログラム42をRAM13のバッファに追加する(記憶させる)。その後、処理はステップS309に進む。
【0237】
ステップS309において、配列処理プログラム43Cは、i番目の実行プログラム42のプログラム長(ビット数)を示すサイズデータを取得し、これをRAM13の情報データを記憶する領域に記憶させる。なお、RAM13には、実行プログラム42を記憶させる領域と情報データを記憶させる領域が、それぞれ異なる領域として確保されている。
【0238】
ステップS310において、配列処理プログラム43Cは、プログラム番号iを1だけ増やす。その後、処理はステップS305に戻り、上述したステップS305以降の処理をくり返す。
【0239】
そして、ステップS305において、配列処理プログラム43Cが、プログラム番号iは、プログラム総数以下ではない(プログラム番号iは、プログラム総数より大きい)と判定した場合、処理はステップS311に進む。
【0240】
なお、以上のステップS305乃至ステップS310の処理の結果、RAM13のバッファには、図7に示されるようプログラムデータ群271およびサイズデータ272が記憶される。なお、プログラムデータ群271は、ステップS302で設定されたビット長Xを単位として並べられている。
【0241】
ステップS311において、圧縮処理プログラム43Aは、RAM13のバッファに記憶されたプログラムデータ群271を圧縮する。ステップS312において、記録プログラム43は、圧縮済みのプログラムデータ、および情報データを、圧縮コードデータ41としてストレージデバイス18に記憶させる。なお、情報データは、ステップS309で追加されたサイズデータ272、プログラム総数を示すプログラム総数データ、およびステップS302で設定されたビット長Xを示すビット長データにより構成される。
【0242】
その後、処理はステップS301に戻り、上述したステップS301以降の処理がくり返される。以上のステップS301乃至ステップS312の処理をくり返すことにより、複数の異なるビット長Xに基づいて生成された複数の圧縮コードデータ41が、ストレージデバイス18に記憶される。なお、ステップS302の処理において、複数のビット長Xの候補から1つを選択する際、記録プログラム43は、すでに選択済みのビット長Xの候補は選択せず、まだ選択されていないビット長Xの候補を選択する。
【0243】
そして、ステップS301において、記録プログラム43が、全てのビット長Xの候補での圧縮コードデータ41の生成が終了したと判定した場合、処理はステップS313に進む。
【0244】
ステップS313において、記録プログラム43は、ストレージデバイス18に記憶された複数の圧縮コードデータ41の中から、最もデータ量の小さい圧縮コードデータ41を選択する。
【0245】
ステップS314において、記録プログラム43は、ステップS313の処理により選択された圧縮コードデータ41を読み出し、不揮発性メモリ書き込み装置14に供給する。不揮発性メモリ書き込み装置14は、供給された圧縮コードデータ41を不揮発性メモリ21に格納する(記憶させる)。なお、この際、記録プログラム43は、圧縮コードデータ41とともにブートプログラム44を読み出し、不揮発性メモリ書き込み装置14に供給する。不揮発性メモリ書き込み装置14は、圧縮コードデータ41とともにブートプログラム44を不揮発性メモリ21に格納する。
【0246】
以上のようにして、不揮発性メモリ21に、最もデータ量が小さい圧縮コードデータ41が格納される。以上のようにすることにより、不揮発性メモリ21の記憶容量をさらに削減することが可能となる。
【0247】
以上に説明したように、本発明によれば、複数の実行プログラムを、より高い圧縮率で圧縮することが可能となる。
【0248】
すなわち、上述したように、実行プログラム42のコードは、インストラクションとデータ(変数の初期値や定数、文字列など)から構成される。実行プログラム42を作成するときのリンク方法によってコードの配置は異なるが、最初にインストラクションを配置し、その直後にデータが配置することが多い。また、そうでない配置の場合も、このような配置となるようにリンク方法を変更しても問題となることはほとんどない。
【0249】
実行プログラム42のコードが、このような配置であるとすると、プログラムコードの先頭と末尾の方では統計的な性質が非常に異なっている場合が多く、LZ77符号で圧縮しようとした場合、先頭の方の符号化時と末尾の方の符号化時では辞書の内容が大きく異なっている。圧縮率を高くするためには、辞書に長い一致長のデータがなるべく多く存在することが望ましい。そのため、なるべく似たデータが近くに配置されているほうが良い。
【0250】
本発明は、実行プログラムのコードを似たデータが近くに配置されるようなデータ形式に簡単に変換し、その形式においてデータを圧縮することで、変換せずに圧縮するよりも圧縮率を向上させたものである。
【0251】
なお、以上の説明においては、圧縮アルゴリズムとしてLZ77符号を用い、統計情報を移動窓に対応した辞書とした場合を例として説明したが、本発明は、過去のデータの統計情報(辞書を含む)を用いて圧縮を行うタイプのものであればLZ77符号以外の圧縮アルゴリズムにも適用可能である。
【0252】
また、以上の説明においては、圧縮装置1と撮像装置201の2つの装置に分けて説明したが、装置を分けず、1つの装置で圧縮装置1と撮像装置201の処理を実現するようにしても良い。すなわち、上述のデータ記録処理、伸長処理、およびプログラム実行処理を、1つの装置で実行するようにしても良い。
【0253】
また、以上の説明においては、実行プログラム42−1乃至42−4を圧縮する場合を例にして説明したが、このことは、本発明が、実行プログラムを圧縮する場合にしか適用できないことを意味するものではない。連結して圧縮するものは、プログラム以外のデータでも良い。すなわち、コードの先頭側と末尾側に異なる種類のコードが配置されている複数のデータを連結して圧縮する場合に、本発明を適用することができる。
【0254】
上述した一連の処理は、ハードウエアにより実行させることもできるし、上述したようにソフトウエアにより実行させることもできる。一連の処理をソフトウエアにより実行させる場合には、そのソフトウエアを構成するプログラムが、専用のハードウエアに組み込まれているコンピュータ、または、各種のプログラムをインストールすることで、各種の機能を実行することが可能な、例えば汎用のパーソナルコンピュータなどに、ネットワークや記録媒体からインストールされる。
【0255】
この記録媒体は、図1および図2に示されるように、装置本体とは別に、ユーザにプログラムを提供するために配布される、プログラムが記録されている磁気ディスク31(フレキシブルディスクを含む)、光ディスク32(CD−ROM(Compact Disk−Read Only Memory),DVD(Digital Versatile Disk)を含む)、光磁気ディスク33(MD(Mini−Disk)を含む)、もしくは半導体メモリ34などよりなるパッケージメディアにより構成されるだけでなく、装置本体に予め組み込まれた状態でユーザに提供される、プログラムが記録されている不揮発性メモリ21、ROM12、およびストレージデバイス18に含まれるハードディスクなどで構成される。
【0256】
なお、本明細書において、記録媒体に記録されるプログラムを記述するステップは、記載された順序に沿って時系列的に行われる処理はもちろん、必ずしも時系列的に処理されなくとも、並列的あるいは個別に実行される処理をも含むものである。
【0257】
また、本明細書において、システムとは、複数の装置により構成される装置全体を表すものである。
【0258】
【発明の効果】
このように、第1の本発明によれば、データを圧縮することが可能である。特に、複数のデータ(プログラムを含む)を連結して圧縮する場合、データ同士の境界付近における局所的な圧縮率低下を軽減でき、全体としての圧縮率を向上させることができる。結果的に、不揮発性メモリに保存されるデータが削減されるため、メモリコストを削減することができる。
【0259】
また、第1の本発明によれば、不揮発性メモリに対するデータ転送量が減少するので、不揮発性メモリへのデータの書き込み時間を短縮することが可能となる。
【0260】
さらに、第1の本発明によれば、既存の圧縮アルゴリズムに変更を加えずに、圧縮率を向上させることが可能であり、既存のシステムに対して容易に適用することができる。
【0261】
第2の本発明によれば、圧縮されたデータを伸長することが可能である。特に、複数のデータを、1つおきに逆順に並べ替えることにより、高い圧縮率で圧縮されている場合でも、圧縮されたデータを伸長し、利用可能な並び順に復元することができる。従って、不揮発性メモリに保存されるデータが削減されるため、メモリコストを削減することができる。
【0262】
また、第2の本発明によれば、不揮発性メモリからのデータ転送量が減少するので、不揮発性メモリからのデータの読み込み時間を短縮するとともに、不揮発性メモリから読み出されたデータの伸張処理を高速化することが可能となる。
【0263】
さらに、第2の本発明によれば、既存の圧縮アルゴリズムに変更を加えずに、圧縮率を向上させることが可能であり、既存のシステムに対して容易に適用することができる。
【図面の簡単な説明】
【図1】本発明を適用した圧縮装置の構成例を示すブロック図である。
【図2】本発明を適用した撮像装置の構成例を示すブロック図である。
【図3】圧縮装置のデータ記録処理を説明するフローチャートである。
【図4】実行プログラムのプログラムコードをビット長単位で区切ることを説明する図である。
【図5】実行プログラムの並び順を説明する図である。
【図6】圧縮装置のデータ付加処理を説明するフローチャートである。
【図7】連結される実行プログラムの配列の例を説明する図である。
【図8】圧縮処理の概念を説明する図である。
【図9】圧縮コードデータに含まれるデータについて説明する図である。
【図10】撮像装置の伸長処理を説明するフローチャートである。
【図11】撮像装置の動作を説明する図である。
【図12】撮像装置のプログラム実行処理を説明するフローチャートである。
【図13】実験に利用したプログラムの連結の順番を説明する図である。
【図14】本発明を適用した場合の圧縮率と従来の圧縮率を比較した実験結果を示す図である。
【図15】本発明を適用した場合の圧縮率と従来の圧縮率を比較した実験結果を示す図である。
【図16】連結される実行プログラムの配列の他の例を説明する図である。
【図17】圧縮装置のデータ記録処理を説明する他のフローチャートである。
【図18】圧縮装置のデータ記録処理を説明する、図17に続くフローチャートである。
【図19】撮像装置の伸長処理を説明する他のフローチャートである。
【図20】撮像装置の伸長処理を説明する、図19に続くフローチャートである。
【図21】圧縮装置のデータ記録処理を説明する、さらに他のフローチャートである。
【符号の説明】
1 圧縮装置, 11 CPU, 12 ROM, 13 RAM, 14 不揮発性メモリ書き込み装置, 15 入力部, 16 出力部, 17 バス, 18ストレージデバイス, 19 通信部, 20 ドライブ, 21 不揮発性メモリ, 31 磁気ディスク, 32 光ディスク, 33 光磁気ディスク, 34 半導体メモリ, 41 圧縮コードデータ, 42−1乃至42−4実行プログラム, 43 記録プログラム, 201 撮像装置, 211 LSI, 212 操作部, 213 ホストCPU, 214 SDRAM, 215 音声出力部, 216 音声入力部, 217 表示部, 218 撮像部, 219 記録再生部, 241 バス, 242,243 インタフェース, 244−1乃至244−3 CPU, 245 インタフェース
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an information processing apparatus and method, a recording medium, and a program, and more particularly to an information processing apparatus and method, a recording medium, and a program capable of improving a data compression ratio.
[0002]
[Prior art]
A software solution-oriented architecture that allows CPUs (Central Processing Units) to execute processing previously realized by ASICs (Application Specific Integrated Circuits), and flexibly supports different applications by replacing software The number of possible LSIs (Large Scale Integration) has been increasing in recent years. In recent years, an increasing number of LSIs in which a plurality of CPUs are mixedly mounted, a function is assigned to each CPU, and distributed processing is performed, thereby increasing the processing capability.
[0003]
For this reason, it is necessary to prepare a plurality of execution programs composed of an instruction set of the same architecture in a product employing such an LSI. Accordingly, in many cases, a large-capacity nonvolatile memory (such as an electrically erasable programmable read-only memory (EEPROM) or a flash memory) is required to hold a plurality of execution programs. The need for a large-capacity nonvolatile memory is a factor that increases the product cost.
[0004]
Therefore, the program is compressed and stored in the non-volatile memory, and when the program is executed, the compressed program is decompressed and used to reduce the data amount of the program to be stored in the non-volatile memory, It is known to reduce the capacity of a nonvolatile memory. Thereby, cost reduction can be expected.
[0005]
Conventionally, when a plurality of execution programs are compressed and stored in a non-volatile memory, data individually compressed for each program is connected and stored, or a plurality of programs are directly connected and collected as one data. Compressed and stored either. When compressing a plurality of programs individually, it is necessary to reconstruct the dictionary and statistical information separately, and the local compression ratio of the first part of the program is not very good.
[0006]
Program codes based on the same instruction set have relatively similar statistical properties. In the case of program codes using the same hardware resources, it is highly probable that the statistical properties are more similar. Therefore, when compressing one of such a plurality of similar programs, another program is used as an initial dictionary, and compression is performed using a dictionary-based compression technique (such as Lempel Ziv code). The compression rate is compressed by a statistical compression technique (MDL (Minimum Description Length) code, PPM (Prediction by Partial Matching) code, CTW (Context Weighting Method) code, etc.) using the statistical information as an initial value. (For example, see Non-Patent Document 1).
[0007]
Since the actual data is not a simple probabilistic model, it is possible to increase the compression ratio by assuming that the statistical properties change gradually rather than assuming the same statistical properties over the entire area of the data. is there. For example, there is a method of assuming a moving window, constructing a dictionary or statistical information from only a part of data immediately before data to be encoded, and performing compression using the dictionary or statistical information. The LZ77 code of Lempel Ziv code (Lempel Ziv 77) is an example thereof. When a moving window is used, the compression ratio is better if the data to be compressed and the data immediately before it are as similar as possible.
[0008]
[Non-patent document 1]
Hirosuke Yamamoto, "Transition of Universal Data Compression Algorithms-From Basic to Latest Techniques", 2001 Workshop on Information-Based Learning Theory (July 30-August 1, 2001), Japan, p. 339-348
[0009]
[Problems to be solved by the invention]
However, the program code generally has a structure in which the CPU instruction code is arranged at the beginning and data such as initial values of variables, constant values, and character strings are arranged at the end. There is a problem that the compression ratio locally decreases at the boundary of.
[0010]
In other words, in the code at the beginning and end of the program, the statistical properties (such as the frequency distribution when a stochastic model or a stochastic model is assumed, and these can be assumed for a dictionary) Often quite different. Therefore, when coding is performed assuming a moving window as described above, at the program boundary, the statistical properties of the data of the program to be compressed and the data of the immediately preceding program are not similar. The compression ratio of the part decreases.
[0011]
Specifically, in the data part, a specific bit pattern in which all consecutive 8 bits are all 0s, for example, has a high frequency, and many of them are continuous. In the case of an instruction code, for example, in a 32-bit RISC, it is configured in units of 4 bytes. When 4 bytes are considered as 1 word, a bit at a specific position of 1 word indicates an instruction function or a register number. Therefore, if a particular bit field is focused on, there is a bit pattern with a high frequency.
[0012]
Therefore, it can be presumed that the statistical properties of the instruction code portion are obviously different from the initial values, constant values, character strings, and the like of the variables. Therefore, if the program codes are directly connected and compressed as one data, the compression ratio locally decreases at the boundary of the program. In particular, when the size of the program is not sufficiently large with respect to the size of the moving window, the influence on the whole becomes large and the compression ratio is greatly affected.
[0013]
The present invention has been made in view of such a situation, and aims to further improve the data compression rate.
[0014]
[Means for Solving the Problems]
A first information processing apparatus according to the present invention includes a rearranging unit that rearranges a plurality of data to be concatenated in every other bit order in a predetermined bit length unit, and a rearranging unit that rearranges every other data in a reverse order. Compression means for concatenating and compressing the plurality of data thus obtained.
[0015]
An addition means for adding another data having a length equal to a value obtained by subtracting a remainder obtained by dividing the number of bits of the data by the bit length from the bit length to the data may be further provided.
[0016]
Recording means for recording the plurality of data compressed by the compression means, the data size of each data, and the bit length on a recording medium may be further provided.
[0017]
The recording means further records, on the recording medium, array data indicating which of the odd-numbered data and the even-numbered data is rearranged in reverse order. You can make it.
[0018]
The reordering means causes the data to be reordered by a plurality of different bit length units, and the compression means rewrites the data rearranged in a reverse order by a plurality of different bit length units. The compression unit is configured to compress the data having the highest compression rate among the data connected and compressed for each bit length unit by the compression unit. It can be recorded on a recording medium.
[0019]
According to a first information processing method of the present invention, a rearrangement step of rearranging a plurality of concatenated data every other bit in a predetermined bit length unit in reverse order, A compression step of concatenating and compressing the rearranged plurality of data.
[0020]
According to the program of the first recording medium of the present invention, a rearrangement step of rearranging a plurality of data to be concatenated every other data in a predetermined bit length unit in reverse order, And a compression step of concatenating and compressing the rearranged data.
[0021]
A first program according to the present invention includes a rearranging step of rearranging a plurality of data to be concatenated in every other bit order in a predetermined bit length unit, and a rearranging step of rearranging every other data by the rearranging step. And a compression step of concatenating and compressing the plurality of data thus obtained.
[0022]
According to a second information processing apparatus of the present invention, there is provided a decompression unit for decompressing a plurality of concatenated and compressed data, and arranging the plurality of data decompressed by the decompression unit every other one in a predetermined bit length unit in reverse order. And a rearranging means for rearranging.
[0023]
An execution unit for executing a process based on the specified data among the plurality of data rearranged in every other order by the rearrangement unit may be further provided.
[0024]
According to a second information processing method of the present invention, a decompression step of decompressing a plurality of concatenated and compressed data and a plurality of data decompressed by the decompression step are performed in a reverse order in a predetermined bit length unit every other data. And a rearranging step of rearranging the data.
[0025]
The program of the second recording medium according to the present invention comprises: a decompression step of decompressing a plurality of concatenated and compressed data; and a plurality of data decompressed by the decompression step in every other bit by a predetermined bit length unit. And a rearranging step for rearranging in reverse order.
[0026]
According to a second program of the present invention, a decompression step of decompressing a plurality of concatenated and compressed data, and arranging the plurality of data decompressed by the decompression step every other bit in a predetermined bit length unit in reverse order. And causing the computer to execute the rearranging step of rearranging.
[0027]
In the first information processing apparatus and method, the recording medium, and the program according to the present invention, a plurality of pieces of data to be connected are rearranged in a reverse order in a predetermined bit length unit every other unit, and are rearranged in a reverse order every other unit. The plurality of changed data are concatenated and compressed.
[0028]
In the second information processing apparatus and method, the recording medium, and the program according to the present invention, a plurality of concatenated and compressed data are decompressed, and the plurality of decompressed data are stored in every other predetermined bit length unit. To sort in reverse order.
[0029]
The present invention can be applied to, for example, electronic devices.
[0030]
BEST MODE FOR CARRYING OUT THE INVENTION
Embodiments of the present invention will be described below. The correspondence between constituent elements described in the claims and specific examples in the embodiments of the present invention is as follows. This description is for confirming that a specific example supporting the invention described in the claims is described in the embodiment of the invention. Therefore, even if there is a specific example which is described in the embodiment of the invention but is not described here as corresponding to the configuration requirement, the fact that the specific example is It does not mean that it does not correspond to the requirement. Conversely, even if a specific example is described here as corresponding to a configuration requirement, this means that the specific example does not correspond to a configuration requirement other than the configuration requirement. not.
[0031]
Furthermore, this description does not mean that the invention corresponding to the specific examples described in the embodiments of the invention is all described in the claims. In other words, this description is an invention corresponding to the specific example described in the embodiment of the invention, and the existence of the invention not described in the claims of this application, that is, It does not deny the existence of the invention added by the amendment.
[0032]
The information processing apparatus according to claim 1 (for example, the compression apparatus 1 in FIG. 1) transmits a plurality of data to be connected (for example, the execution programs 42-1 to 42-4 in FIG. A rearranging unit (for example, the array processing program 43C in FIG. 1 executing the processing of steps S2 to S8 in FIG. 3) rearranging in a bit length unit in reverse order, and the rearranging unit rearranges every other in reverse order. A compression means (for example, a compression processing program 43A in FIG. 1 for executing the processing in step S9 in FIG. 3) for connecting and compressing the plurality of changed data.
[0033]
3. The information processing apparatus according to claim 2, wherein the remainder obtained by dividing the number of bits of the data by the bit length (eg, the bit length X in FIG. 5) is equal to a value obtained by subtracting the remainder from the bit length. Is added to the data (for example, the data addition program 43B of FIG. 1 for executing the processing of step S1 of FIG. 3).
[0034]
The information processing apparatus according to claim 3, wherein the plurality of data compressed by the compression unit, a data size of each data (for example, size data 272 in FIG. 9), and the bit length (for example, in FIG. 9). A recording unit (for example, the nonvolatile memory writing device 14 in FIG. 1) for recording the bit length data 361) in a recording medium (for example, the nonvolatile memory 21 in FIG. 1) is further provided.
[0035]
5. The information processing apparatus according to claim 4, wherein the recording unit indicates which of the odd-numbered data and the even-numbered data is rearranged in reverse order. Sequence data (for example, the sequence data generated by the process of step S212 in FIG. 17) is further recorded on the recording medium (for example, the process of step S214).
[0036]
The information processing apparatus according to claim 5, wherein the rearranging unit rearranges the data in a plurality of different bit length units (for example, the processing of steps S <b> 304 to S <b> 310 in FIG. 21). The data rearranged in a reverse order by a plurality of different bit length units is connected and compressed for each bit length unit (for example, the process of step S311 in FIG. 21), and the recording unit includes the compression unit The data having the highest compression rate among the data concatenated and compressed for each bit length unit is recorded on the recording medium (for example, the processing in steps S313 and S314 in FIG. 21). I do.
[0037]
7. The information processing method according to claim 6, wherein a plurality of data to be linked (for example, the execution programs 42-1 to 42-4 in FIG. 1) have a predetermined bit length every other (for example, the bit length in FIG. 5). X) A rearrangement step of rearranging in units of reverse order (for example, steps S2 to S8 in FIG. 3), and a plurality of the data rearranged in reverse order by the rearrangement step are connected by the processing of the rearrangement step. (For example, step S9 in FIG. 3).
[0038]
The program of the recording medium according to claim 7, wherein a plurality of data to be linked (for example, the execution programs 42-1 to 42-4 in FIG. 1) have a predetermined bit length every other bit (for example, a bit in FIG. 5). A rearranging step of rearranging the data in units of length X) (for example, steps S2 to S8 in FIG. 3), and connecting the plurality of data rearranged in the reverse order every other by the processing of the rearranging step. (For example, step S9 in FIG. 3).
[0039]
The program according to claim 8, wherein a plurality of data to be linked (for example, the execution programs 42-1 to 42-4 in FIG. 1) have a predetermined bit length every other bit (for example, the bit length X in FIG. 5). A rearranging step of rearranging the data in units of reverse order (for example, steps S2 to S8 in FIG. 3), and the processing of the rearranging step connects and compresses a plurality of the data rearranged in every other reverse order. (For example, step S9 in FIG. 3).
[0040]
The information processing device according to claim 9 (for example, the imaging device 201 in FIG. 2) expands a plurality of data (for example, the compressed program data 351 in FIG. 9) that are connected and compressed. By executing the decompression program 44A of FIG. 11, the CPU 244-1 of FIG. 2 that executes the processing of step S102 of FIG. 10) and a plurality of the data (for example, the program data of FIG. 7) decompressed by the decompression means. A rearranging unit (for example, the array shown in FIG. 11) that rearranges every other execution program 42-1 to 42-4 included in the group 271 in a predetermined bit length (for example, the bit length X in FIG. 5). By executing the processing program 44C, the CPU 244-1 of FIG. 2 for executing the processing of steps S105 to S109 of FIG. 10 is provided. The features.
[0041]
11. The information processing apparatus according to claim 10, wherein the execution unit executes a process based on the specified data among the plurality of data rearranged alternately by the rearrangement unit. It further includes a CPU 244-3) of FIG. 2 for executing the process of step S153 in FIG.
[0042]
The information processing method according to claim 11, wherein a decompression step (for example, step S102 in FIG. 10) for decompressing a plurality of concatenated and compressed data (for example, the compressed program data 351 in FIG. 9); A plurality of the data (for example, the execution programs 42-1 to 42-4 included in the program data group 271 in FIG. 7) decompressed by the processing of the step have a predetermined bit length every other bit (for example, the bit in FIG. 5). And a rearrangement step of rearranging in units of (length X) in reverse order (for example, steps S105 to S109 in FIG. 10).
[0043]
13. A decompression step (for example, step S102 in FIG. 10) for decompressing a plurality of concatenated and compressed data (for example, compressed program data 351 in FIG. 9); A plurality of data (for example, the execution programs 42-1 to 42-4 included in the program data group 271 of FIG. 7) expanded by the processing of the expansion step have a predetermined bit length (for example, FIG. 5). And a rearrangement step (for example, steps S105 to S109 in FIG. 10) for rearranging in reverse order in units of (bit length X).
[0044]
The program according to claim 13 includes: a decompression step (for example, step S102 in FIG. 10) for decompressing a plurality of concatenated and compressed data (for example, the compressed program data 351 in FIG. 9); A plurality of the data (for example, the execution programs 42-1 to 42-4 included in the program data group 271 in FIG. 7) decompressed by the processing are replaced by a predetermined bit length (for example, the bit length X in FIG. 5). ), Which causes the computer to execute a rearranging step (for example, steps S105 to S109 in FIG. 10) for rearranging in reverse order.
[0045]
FIG. 1 shows a configuration example of a compression apparatus 1 to which the present invention is applied. The compression device 1 is a device that links a plurality of programs, collectively compresses them as one data, and stores the data in the nonvolatile memory 21. Note that the compression device 1 can be, for example, a general-purpose personal computer, a workstation, or another information processing device.
[0046]
In FIG. 1, a CPU 11 executes various processes according to a program stored in a ROM (Read Only Memory) 12 or a program loaded into a RAM 13 from a storage device 18. The RAM 13 also appropriately stores data necessary for the CPU 11 to execute various processes.
[0047]
The CPU 11, the ROM 12, and the RAM 13 are mutually connected via a bus 17. The bus 17 is also connected to a nonvolatile memory writing device 14, an input unit 15, an output unit 16, a storage device 18, a communication unit 19, and a drive 20.
[0048]
The nonvolatile memory writing device 14 reads the compressed code data 41 stored in the storage device 18 and writes the compressed code data 41 in the nonvolatile memory 21 according to the instruction of the CPU 11. The nonvolatile memory 21 with the compressed code data 41 written therein is incorporated in an electronic device such as a camera-integrated video tape recorder (VTR).
[0049]
The input unit 15 includes, for example, a keyboard, a mouse, and the like, and receives an input of an operation. The output unit 16 includes a display such as a CRT (Cathode Ray Tube) and an LCD (Liquid Crystal Display), a speaker, and the like.
[0050]
The storage device 18 is configured by, for example, a hard disk drive or the like, and stores various data and programs. The storage device 18 stores, for example, compressed code data 41, execution programs 42-1 to 42-4, a recording program 43, and a boot program 44.
[0051]
The compressed code data 41 is data generated for storage in the nonvolatile memory 21 and includes a compressed execution program. The compression code data 41 is generated by a data recording process described later.
[0052]
The execution programs 42-1 to 42-4 are programs prepared to be stored in the nonvolatile memory 21. The execution programs 42-1 to 42-4 are acquired from an external device via the communication unit 19 or received from the magnetic disk 31 mounted on the drive 20 according to an instruction from an operator operating the compression device 1, for example. It is obtained by reading from the optical disk 32, the magneto-optical disk 33, or the semiconductor memory 34. Further, the execution programs 42-1 to 42-4 may be input by an operator via the input unit 15, for example. Of course, the execution programs 42-1 to 42-4 may be obtained by a method other than the above.
[0053]
In this embodiment, four execution programs of execution programs 42-1 to 42-4 are prepared, but the number of prepared execution programs is not limited to four. In the following description, when it is not necessary to distinguish each of the execution programs 42-1 to 42-4, they are collectively referred to as an execution program 42. Hereinafter, the same applies to other configurations.
[0054]
The recording program 43 is a program that compresses the execution programs 42-1 to 42-4 to generate the compressed code data 41, and executes a process of recording the compressed code data 41 in the nonvolatile memory 21. And executed by the CPU 11. The recording program 43 includes a compression processing program 43A, a data addition processing program 43B, and an array processing program 43C. The compression processing program 43A is a program for compressing the execution programs 42-1 to 42-4. In the present embodiment, the compression processing program 43A compresses the execution programs 42-1 to 42-4 using the LZ77 code. In the present embodiment, a case where LZ77 codes are used will be described as an example. However, the present invention is also applicable to methods other than LZ77 in which a moving window is set and data is encoded.
[0055]
The data addition processing program 43B executes data addition processing for adding predetermined data to the execution programs 42-1 to 42-4 before the execution programs 42-1 to 42-4 are compressed by the compression processing program 43A. I do. A detailed description of the data addition processing will be described later.
[0056]
The array processing program 43C executes a process of arranging the execution programs in a predetermined array when connecting the execution programs 42-1 to 42-4.
[0057]
The boot program 44 is a program prepared for recording in the nonvolatile memory 21.
[0058]
The communication unit 19 includes, for example, a modem, a terminal adapter, and the like, and performs communication processing via a network including a LAN (Local Area Network), the Internet, and the like.
[0059]
The drive 20 is connected to the bus 17 via an input / output interface (not shown) as necessary, and is connected to a magnetic disk 31 (including a flexible disk), an optical disk 32 (CD-ROM (Compact Disk-Read Only Memory), A DVD (including a digital versatile disk), a magneto-optical disk 33 (including an MD (mini-disk)), or a semiconductor memory 34 is mounted thereon, and computer programs and data read out of the memory are loaded as necessary. It is stored in the storage device 18.
[0060]
Next, FIG. 2 illustrates a configuration example of an imaging device 201 to which the present invention is applied. The imaging device 201 can be, for example, a camera-integrated video tape recorder or a digital still camera. The imaging device 201 has a built-in nonvolatile memory 21, and the nonvolatile memory 21 stores a plurality of programs compressed by the compression device 1. The imaging device 201 appropriately executes a program stored in the nonvolatile memory 21.
[0061]
Note that, in the present embodiment, a case in which the present invention is applied to the imaging device 201 will be described as an example, but this does not mean that the present invention can be applied only to the imaging device. The present invention can be applied to any other electronic devices.
[0062]
2, the LSI 211 includes a plurality of CPUs 244-1 to 244-3 connected to a bus 241, and interfaces (I / F) 242, 243, and 245.
[0063]
A host CPU 213 is connected to the bus 241, and the CPUs 244-1 to 244-3 execute various processes according to instructions from the host CPU 213.
[0064]
The host CPU 213 controls the entire operation of the imaging device 201 including the CPUs 244-1 to 244-3 according to an operation signal from the operation unit 212. The operation unit 212 includes various buttons, dials, and the like, receives an input of an operation from a user, generates an operation signal based on the input operation, and notifies the host CPU 213 of the operation signal.
[0065]
The nonvolatile memory 21 is connected to the bus 241 via an interface 242. With the compression device 1 in FIG. 1, the nonvolatile memory 21 stores the compression code data 41 and the boot program 44. When the imaging device 201 is started, the boot program 44 and the compressed code data 41 are read from the nonvolatile memory 21 by the CPU 244-1.
[0066]
An SDRAM (Synchronous Dynamic Random Access Memory) 214 is connected to the bus 241 via an interface 243. The SDRAM 214 stores data supplied via the interface 243 at a predetermined memory address. The data stored in the SDRAM 214 is read or written as appropriate via the interface 243. The SDRAM 214 stores, for example, the code of the expanded execution program 42 and the like.
[0067]
The CPU 244-1 reads and executes the boot program 44 from the nonvolatile memory 21 according to an instruction from the host CPU 213. The boot program 44 includes a decompression program for decompressing the compressed execution programs 42-1 to 42-4. Therefore, when executing the boot program 44, the CPU 244-1 reads out the compressed code data 41 and decompresses the compressed execution programs 42-1 to 42-4 included in the compressed code data 41. The CPU 244-1 causes the SDRAM 214 to store the decompressed execution programs 42-1 to 42-4, information data associated therewith, and the like. Further, the CPU 244-1 selects a predetermined execution program from a plurality of execution programs 42-1 to 42-4 stored in the SDRAM 214 according to an instruction from the host CPU 213, and executes the selected execution program.
[0068]
The CPUs 244-2 and 244-3 select a predetermined execution program from a plurality of execution programs 42-1 to 42-4 stored in the SDRAM 214 according to an instruction from the host CPU 213, and execute the selected execution program. I do. In the present embodiment, as an example, CPU 244-2 executes an execution program relating to encoding and decoding of an image, and CPU 244-3 executes an execution program relating to encoding and decoding of an audio.
[0069]
The audio output unit 215, the audio input unit 216, the display unit 217, the imaging unit 218, and the recording / reproducing unit 219 are also connected to the bus 241 via the interface 245.
[0070]
The audio output unit 215 includes a speaker and outputs audio based on an audio signal supplied from the CPU 244-3 via the interface 245. The audio input unit 216 includes a microphone, collects audio around the imaging device 201, and supplies an audio signal based on the collected audio to the CPU 244-3 via the interface 245.
[0071]
The display unit 217 includes, for example, an LCD, and displays an image based on an image signal supplied from the CPU 244-2 via the interface 245. The imaging unit 218 has an imaging element such as a charged coupled device (CCD) or a complementary metal oxide semiconductor (CMOS). The imaging unit 218 transmits a video signal generated by capturing an image of a subject to the CPU 244-2 via the interface 245. Supply.
[0072]
The recording / reproducing unit 219 records the audiovisual (AV) data supplied via the interface 245 on a mounted recording medium (for example, a tape medium). Further, the recording / reproducing unit 219 reads out the AV data recorded on the recording medium and outputs it to the CPUs 244-2 and 244-3 via the interface 245.
[0073]
Next, data recording processing of the compression device 1, that is, processing from generation of the compressed code data 41 to storage in the nonvolatile memory 21, will be described with reference to the flowchart of FIG. In the following description, the processing executed by the recording program 43 is actually executed by the CPU 11 loading the recording program 43 into the RAM 13 and executing it.
[0074]
In step S1, the data addition processing program 43B executes data addition processing and adds predetermined data to the execution programs 42-1 to 42-4.
[0075]
Here, the data addition processing will be described.
[0076]
The compression device 1 divides the execution program 42 into units of a predetermined bit length and arranges the divided execution programs in a predetermined order by the processing of steps S5 and S6 described below. FIG. 4 shows an example of a program code of the execution program 42 divided by a predetermined bit length unit, and FIG. 5 shows an example in which the program code of FIG. I have.
[0077]
In FIG. 4, the beginning of the program code is located on the left, and the end of the program code is located on the right. As shown in FIG. 4, the array processing program 43C divides the program code in order of a predetermined bit length from the head. In FIG. 4, the code is divided into 1 to N codes. N is an integer of 2 or more. In the following description, a predetermined bit length, which is a unit for dividing a program code, is referred to as a bit length X, and each code divided by the bit length X is referred to as a partial code. In the following description, as shown in FIG. 4, the first partial code is referred to as a first partial code, and the next partial code following the first partial code is referred to as a second partial code. The partial code next to the second partial code is referred to as a third partial code, and the last partial code is referred to as an N-th partial code.
[0078]
FIG. 5 is a diagram in which N partial codes separated as in FIG. 4 are arranged from the first data to the last data.
[0079]
The left side of FIG. 5 shows an execution program 42 in which partial codes divided for each bit length X are arranged in order from the top. That is, the execution program 42 shown on the left uses the first partial code as the leading data, arranges the second partial code next to the first partial code, and places the third partial code next to the second partial code. Is arranged. Hereinafter, the fourth and subsequent partial codes are sequentially arranged, and the Nth partial code is arranged as the last data.
[0080]
Here, when the number of bits of the entire execution program 42 is divisible by the bit length X, the number of bits of the N-th partial code becomes the same value as the bit length X, but the number of bits of the entire execution program 42 becomes If there is a remainder that is not divisible by the bit length X, the number of bits of the N-th partial code becomes smaller than the bit length X.
[0081]
To explain this with a simple example, it is assumed that the number of bits of the entire execution program 42 is 21 bits and the bit length X is 3 bits. In this case, when the number of bits (= 21 bits) of the entire execution program 42 is divided by the bit length X (= 3 bits),
21/3 = 7 ... 0
, And the N (= 7) th partial code is also 3 bits. On the other hand, if the total number of bits of the execution program 42 is 21 bits and the bit length X is 4 bits, the number of bits (= 21 bits) of the entire execution program 42 is changed to the bit length X (= Divided by 4 bits)
21/4 = 5 ... 1
And the remainder (= 1) appears. Therefore, the N-th partial code has one bit, which is a value less than the bit length X (= 4 bits).
[0082]
As described above, when the N-th partial code has a value less than the bit length X, the number of bits of the N-th partial code in FIG. 5 is insufficient.
[0083]
Therefore, in step S1, if the total number of bits of the execution program 42 cannot be divided by the bit length X, the data addition processing program 43B replaces the insufficient data (3-bit data in the above example) with the N-th part. In addition to the code, the number of bits of the N-th partial code is set to the bit length X.
[0084]
In the above description, the number of bits of the execution program 42 is set to 21 bits, and the bit length X is set to 3 bits or 4 bits. However, this value is assumed to simplify the description. It does not mean that the actual number of bits and the bit length X of the execution program 42 become the above values.
[0085]
The description of the execution program 42 shown on the right side of FIG. 5 will be described later.
[0086]
Next, the data adding process in step S1, that is, the process of adding insufficient data to the N-th partial code will be described in detail with reference to the flowchart in FIG.
[0087]
In step S31, the data addition processing program 43B initializes the program number i to 1 and initializes the buffer of the RAM 13.
[0088]
In step S32, the data addition processing program 43B determines whether or not the program number i is equal to or less than the total number of programs. Here, the total number of programs indicates the number of execution programs 42 to be stored in the nonvolatile memory 21. That is, in the case of the example of FIG. 1, the number of execution programs to be stored in the nonvolatile memory 21 is four, namely, the execution programs 42-1 to 42-4. Therefore, in step S32, the data addition processing program 43B determines whether or not the program number i is equal to or less than the total number of programs. If the program number i is equal to or less than the total number of programs, the process proceeds to step S33.
[0089]
In step S33, the data addition processing program 43B reads the i-th execution program 42 from the storage device 18 and stores it in the buffer of the RAM 13.
[0090]
In step S34, the data addition processing program 43B acquires the number of bits (hereinafter, also referred to as program length) of the entire execution program 42 stored in the RAM 13 in step S33.
[0091]
In step S35, the data addition processing program 43B divides the program length of the execution program 42 obtained in step S34 by the bit length X. Note that the data addition processing program 43B does not perform division below the decimal point. Therefore, the quotient and the remainder are integer values.
[0092]
In step S36, the data addition processing program 43B determines whether or not the program length is divisible by the bit length X by the processing of step S35. If the program length is not divisible by the bit length X, the process proceeds to step S37. .
[0093]
In step S37, the data addition processing program 43B adds insufficient data to the execution program. That is, in step S35, the quotient and the remainder (the remainder is Y) are calculated by dividing the program length by the bit length X, so that the data addition processing program 43B subtracts the remainder Y from the bit length X. The data of the number of bits per minute (XY) is added to the execution program 42. Thereafter, the process proceeds to step S38.
[0094]
In step S36, when the data addition processing program 43B determines that the program length is divisible by the bit length X, the processing of step S37 is skipped, and the processing proceeds to step S38.
[0095]
In step S38, the data addition processing program 43B causes the storage device 18 to store the execution program 42 stored in the RAM 13. When data is added by the process of step S37, the data addition processing program 43B causes the storage device 18 to store the execution program 42 including the added data.
[0096]
In step S39, the data addition processing program 43B increases the program number i by one.
[0097]
After that, the process returns to step S32, and the processes after step S32 described above are repeated.
[0098]
Then, in step S32, when the data addition processing program 43B determines that the program number i is not smaller than the total number of programs (the program number i is larger than the total number of programs), the data addition processing ends.
[0099]
Thereafter, the process proceeds to step S2 in FIG.
[0100]
Here, an example will be described in which the above-described data addition processing is applied to the execution programs 42-1 to 42-4 in FIG. The execution program 42-1 of FIG. 1 is a first execution program, the execution program 42-2 is a second execution program, the execution program 42-3 is a third execution program, and the execution program 42-4 is Let it be the fourth execution program.
[0101]
The data addition processing program 43B first initializes a program number i to 1 and initializes a buffer of the RAM 13 in step S31. Next, in step S32, it is determined whether or not the program number i = 1 is equal to or less than the total number of programs (= 4). Since the program number i is equal to or less than the total number of programs, the process proceeds to step S33.
[0102]
In step S33, the data addition processing program 43B reads the first execution program, that is, the execution program 42-1 from the storage device 18 and stores it in the buffer of the RAM 13. The data addition processing program 43B acquires the program length of the execution program 42-1 in step S34, divides the program length of the execution program 42-1 by the bit length X in step S35, and executes the execution program 42-1 in step S36. It is determined whether or not the program length of −1 is divisible by the bit length X. If the program length of the execution program 42-1 is not divisible by the bit length X, the process proceeds to step S37, where the data addition processing program 43B adds the missing data to the execution program 42-1. In S38, the execution program 42-1 to which the data is added in Step S37 is stored in the storage device 18. Also, in step S36, when the data addition processing program 43B determines that the program length of the execution program 42-1 is divisible by the bit length X, step S37 is skipped, and in step S38, the execution program Stored on device 18. After step S38, the process proceeds to step S39, where the data addition processing program 43B increases i by 1 and sets i = 2.
[0103]
Thereafter, the process returns to step S32, and the data addition processing program 43B determines whether or not the program number i = 2 is equal to or less than the total number of programs (= 4). 4) Since it is the following, the process proceeds to step S33. In step S33, the data addition processing program 43B reads the execution program 42-2, which is the second execution program, from the storage device 18 and stores it in the buffer of the RAM 13. Thereafter, the data addition processing program 43B executes the processing of steps S34 to S38 on the second execution program 42-2. Note that the processing of steps S34 to S38 for the second execution program 42-2 is the same as the processing of steps S34 to S38 for the first execution program 42-1 and will not be described. After step S38, in step S39, the data addition processing program 43B increases i by 1 to set i = 3.
[0104]
Thereafter, the process returns to step S32, and the data addition processing program 43B determines whether or not the program number i = 3 is equal to or less than the total number of programs (= 4). 4) Since it is the following, the process proceeds to step S33. In step S33, the data addition processing program 43B reads the execution program 42-3, which is the third execution program, from the storage device 18 and stores it in the buffer of the RAM 13. Thereafter, the data addition processing program 43B executes the processing of steps S34 to S38 on the third execution program 42-3. Note that the processing of steps S34 to S38 for the third execution program 42-3 is the same as the processing of steps S34 to S38 for the first execution program 42-1 and will not be described. After step S38, in step S39, the data addition processing program 43B increases i by 1 to set i = 4.
[0105]
Thereafter, the process returns to step S32, and the data addition processing program 43B determines whether or not the program number i = 4 is equal to or less than the total number of programs (= 4). 4) Since it is the following, the process proceeds to step S33. In step S33, the data addition processing program 43B reads the execution program 42-4, which is the fourth execution program, from the storage device 18 and stores it in the buffer of the RAM 13. Thereafter, the data addition processing program 43B executes the processing of steps S34 to S38 on the fourth execution program 42-4. Note that the processing of steps S34 to S38 for the fourth execution program 42-4 is the same as the processing of steps S34 to S38 for the first execution program 42-1 and will not be described. After step S38, in step S39, the data addition processing program 43B increases i by 1 to set i = 5.
[0106]
Thereafter, the process returns to step S32, and the data addition processing program 43B determines whether or not the program number i = 5 is equal to or less than the total number of programs (= 4). 4) Since it is not the following (the program number i = 5 is larger than the total number of programs (= 4)), the data addition processing program 43B ends a series of data addition processing. Thereafter, the process proceeds to step S2 in FIG.
[0107]
As described above, data is added to all the execution programs 42-1 to 42-4 to be stored in the nonvolatile memory 21 as necessary.
[0108]
Referring back to FIG. 3, after the data addition processing in step S1, the array processing program 43C initializes the program number i to 1 and initializes the buffer in the RAM 13 in step S2.
[0109]
In step S3, the array processing program 43C determines whether or not the program number i is equal to or less than the total number of programs. If the program number i is equal to or less than the total number of programs, the process proceeds to step S4. In the case of the example of FIG. 1, the number of execution programs to be stored in the nonvolatile memory 21 is four, namely, the execution programs 42-1 to 42-4.
[0110]
In step S4, the array processing program 43C determines whether or not the program number i is an even number. If the program number i is not an even number (if it is an odd number), the process proceeds to step S5.
[0111]
In step S5, the array processing program 43C reads the i-th execution program 42 from the storage device 18 and temporarily stores the read execution program 42 in the RAM 13 in the same order as shown in the left side of FIG. In a buffer. Thereafter, the process proceeds to step S7. In the following description, the format of the arrangement of the execution programs 42 shown on the left side of FIG. The format 1 is a format in which the CPU 244 of the imaging apparatus 201 can directly execute the arrangement order. Examples of the bit length X include 1 byte, the instruction length of the CPU 244 of the imaging device 201 (4 bytes in a 32-bit RISC (Reduced Instruction Set Computer)), the size of the moving window of the LZ77, and half thereof. .
[0112]
In step S4, when the array processing program 43C determines that the program number i is an even number, the process proceeds to step S6.
[0113]
In step S6, the array processing program 43C reads the i-th execution program 42 from the storage device 18, rearranges it on the RAM 13 for each bit length X in reverse order, and places the rearranged execution program 42 in the RAM 13. Add (remember) to buffer. On the right side of FIG. 5, an example of the execution program 42 rearranged in the reverse order in step S6 is shown.
[0114]
In the execution program 42 shown on the right side of FIG. 5, the first to Nth N partial codes are arranged with the Nth partial code at the beginning and the first partial code at the end. That is, in the execution program 42 on the right side of FIG. 5, the N-th partial code shown in FIG. 4 is arranged at the head, and the (N-1) -th partial code is arranged next to the N-th partial code. , N-2th partial code are arranged next to the (N-1) th partial code, and the N-3rd partial code is arranged next to the (N-2) th partial code. The following is similarly arranged, and the first partial code is arranged at the end. The format of the arrangement of the execution programs 42 shown on the right side of FIG. The format 2 is a format in which the CPU 244 of the imaging device 201 cannot directly execute the format.
[0115]
Comparing the execution program 42 of the format 2 with the execution program 42 of the format 1 shown on the left side of FIG. 5, in the arrangement of the format 1, the top data shown at the top is regarded as the first partial code. The first partial code is followed by a second partial code, and the second partial code is followed by a third partial code. Thereafter, the data is arranged in order, and the data at the end is the N-th partial code. On the other hand, in the format 2 arrangement, the leading data is the N-th partial code, the N-th partial code is followed by the N-1-th partial code, and the N-1-th partial code is The next is the (N−2) th partial code, and the next to the (N−2) th partial code is the (N−3) th partial code. Thereafter, the data is arranged in order, and the data at the end is the first partial code.
[0116]
That is, in the arrangement of the format 1, each partial code of the execution program 42 divided for each bit length X is arranged from the top to the end according to the description order (1st → Nth) of the execution program 42. ing. On the other hand, in the format 2 arrangement, each partial code of the execution program 42 divided for each bit length X has a leading code in the reverse order (Nth → first) with respect to the description order of the execution program 42. From the end to the end. That is, the arrangement order of the format 2 is an arrangement order obtained by inverting the arrangement order of the format 1 in units of the bit length X.
[0117]
In the execution program 42, the instruction code of the CPU is arranged at the beginning of the program code of FIG. 4, and data such as initial values, constant values, and character strings of variables are arranged at the end. That is, the instruction code of the CPU is arranged in the first partial code of the program code in FIG. 4, and data such as initial values, constant values, and character strings of variables are arranged in the N-th partial code. Are located.
[0118]
Therefore, in the arrangement order of the format 1 shown in FIG. 5, the instruction code of the CPU is arranged in the first data, and the initial value, constant value, character string, etc. of the variable are arranged in the last data. Be placed. In the order of the format 2 shown in FIG. 5, the initial data, the constant value, the character string, and the like are arranged in the first data, and the instruction code of the CPU is arranged in the last data. Be placed.
[0119]
Note that an arrow from top to bottom shown in the execution program 42 on the left side of FIG. 5 indicates that the execution program 42 is in the format 1, and is shown in the execution program 42 on the right side of FIG. The arrow pointing upward from the bottom indicates that the execution program 42 is in the format 2. The same applies to FIGS. 7, 9 and 16 described later.
[0120]
As described above, the execution program 42 is stored in the buffer of the RAM 13 in the order of the format 1 in step S5, and is stored in the buffer of the RAM 13 in the order of the format 2 in step S6.
[0121]
Returning to FIG. 3, after the execution program 42 is rearranged in the format 2 of FIG. 4 by the process of step S6, the process proceeds to step S7.
[0122]
In step S7, the array processing program 43C acquires size data indicating the program length (number of bits) of the i-th execution program 42, and stores the size data in the area of the RAM 13 for storing information data. In the RAM 13, an area for storing the execution program 42 and an area for storing information data are secured as different areas.
[0123]
In step S8, the array processing program 43C increases the program number i by one. Thereafter, the process returns to step S3, and repeats the above-described processes after step S3.
[0124]
Then, in step S3, when the array processing program 43C determines that the program number i is not smaller than the total number of programs (the program number i is larger than the total number of programs), the process proceeds to step S9.
[0125]
The above-described loop processing of steps S3 to S8 is processing for rearranging and linking a plurality of execution programs 42 in every other order in reverse order, and by repeating the processing of steps S3 to S8, the RAM 13 , The execution programs 42 in the format 1 and the execution programs 42 in the format 2 are alternately arranged and stored. In order to show this more specifically, the processing of steps S3 to S8 will be described below, taking as an example a case where the execution programs 42-1 to 42-4 are stored in the RAM 13.
[0126]
The array processing program 43C initializes the program number i to 1 in step S2 and initializes the buffer of the RAM 13 in step S2. Then, in step S3, when the program number i (= 1) is equal to or less than the total number of programs (= 4). It is determined whether or not there is a program number. Since the program number i (= 1) is equal to or less than the total number of programs (= 4), the process proceeds to step S4.
[0127]
In step S4, the array processing program 43C determines whether or not the program number i (= 1) is an even number. Since the program number i (= 1) is not an even number (it is an odd number), the process proceeds to step S5. Proceed to. In step S5, the array processing program 43C reads the first execution program 42-1 from the storage device 18, and adds it to the buffer of the RAM 13 in the format 1 order. Thereafter, in step S7, the array processing program 43C causes the RAM 13 to store size data indicating the program length of the first execution program 42-1 as information data. The information data is stored in an area of the RAM 13 that is different from the area where the execution program 42 is located. In step S8, the array processing program 43C increases i by 1 and sets i = 2.
[0128]
Thereafter, the process returns to step S3, and the array processing program 43C determines whether or not the program number i (= 2) is equal to or less than the total number of programs (= 4). (= 4) or less, the process proceeds to step S4. In step S4, the array processing program 43C determines whether or not the program number i (= 2) is an even number. Since the program number i (= 2) is an even number, the process proceeds to step S6. In step S <b> 6, the array processing program 43 </ b> C reads the second program 42-2 from the storage device 18, rearranges the format 2 in the arrangement order, and stores it in the buffer of the RAM 13. Note that the array processing program 43C stores the second execution program 42-2 following the memory address immediately after the memory address where the first execution program 42-1 is stored. After that, in step S7, the array processing program 43C adds the size data indicating the program length of the second execution program 42-2 to the information data stored in the RAM 13 and stores it. In step S8, the array processing program 43C increases i by 1 and sets i = 3.
[0129]
Thereafter, the process returns to step S3, and the array processing program 43C determines whether or not the program number i (= 3) is equal to or less than the total number of programs (= 4). (= 4) or less, the process proceeds to step S4. In step S4, the array processing program 43C determines whether or not the program number i (= 3) is an even number. Since the program number i (= 3) is not an even number (it is an odd number), the process proceeds to step S4. Proceed to S5. In step S5, the array processing program 43C reads the third program 42-3 from the storage device 18 and stores the third program 42-3 in the buffer of the RAM 13 in the order of format 1. Note that the array processing program 43C stores the third execution program 42-3 following the memory address immediately after the memory address at which the second execution program 42-2 is stored. After that, in step S7, the array processing program 43C adds the size data indicating the program length of the third execution program 42-3 to the information data stored in the RAM 13 and stores it. In step S8, the array processing program 43C increases i by 1 and sets i = 4.
[0130]
Thereafter, the process returns to step S3, where the array processing program 43C determines whether or not the program number i (= 4) is equal to or less than the total number of programs (= 4). (= 4) or less, the process proceeds to step S4. In step S4, the array processing program 43C determines whether the program number i (= 4) is an even number. Since the program number i (= 4) is an even number, the process proceeds to step S6. In step S <b> 6, the array processing program 43 </ b> C reads the fourth program 42-4 from the storage device 18, rearranges it in the format 2 arrangement order, and stores it in the buffer of the RAM 13. Note that the array processing program 43C stores the fourth execution program 42-4 following the memory address immediately after the memory address at which the third execution program 42-3 is stored. After that, in step S7, the array processing program 43C adds the size data indicating the program length of the fourth execution program 42-4 to the information data stored in the RAM 13 and stores it. In step S8, the array processing program 43C increases i by 1 and sets i = 5.
[0131]
Thereafter, the process returns to step S3, and the array processing program 43C determines whether or not the program number i (= 5) is equal to or less than the total number of programs (= 4). (= 4) Since this is not the case, the process proceeds to step S9.
[0132]
As a result of the above processing, a program data group 271 is stored in the buffer of the RAM 13 as shown in FIG. That is, the program data group 271 is composed of the execution programs 42-1 to 42-4 which are continuously arranged. The execution programs 42-1 are stored in the format 1 order. The execution program 42-2 is stored immediately after the memory address where the execution program 42-1 is stored in the order of the format 2. The execution program 42-3 is stored immediately after the memory address where the execution program 42-2 is stored in the order of the format 1. The execution program 42-4 is stored immediately after the memory address where the execution program 42-3 is stored in the order of the format 2. As described above, the order of the format 1 and the format 2 is alternately repeated, and the execution programs 42-1 to 42-4 are arranged, whereby similar data is arranged at the boundary between the execution programs. .
[0133]
That is, as described with reference to FIG. 5, in the arrangement order of the format 1, the instruction code of the CPU is arranged toward the first data, and the initial value or the constant value of the variable is arranged toward the last data. , A character string, and the like. On the other hand, in the arrangement order of the format 2, the initial data of variables, constant values, character strings, and the like are arranged in the first data, and the instruction code of the CPU is arranged in the last data.
[0134]
Therefore, focusing on the boundary between the execution program 42-1 and the execution program 42-2 of the program data group 271 in FIG. 7, the end of the execution program 42-1 and the head of the execution program 42-2 are: Data such as variable initial values, constant values, and character strings are arranged. Focusing on the boundary between the execution program 42-2 and the execution program 42-3, the instruction code of the CPU is arranged at the end of the execution program 42-2 and at the beginning of the execution program 42-3. I have. When attention is paid to the boundary between the execution program 42-3 and the execution program 42-4, the initial value and the constant value of the variable are set at the end of the execution program 42-3 and at the beginning of the execution program 42-4. Data such as character strings are arranged.
[0135]
By arranging similar data at the boundary between the execution programs 42 as described above, it is possible to prevent a decrease in the compression ratio at the boundary when the program data group 271 is compressed later.
[0136]
By the way, in FIG. 7, the size data 272 is shown below. The size data 272 is data included in the information data, 272A is size data indicating the program length (number of bits) of the execution program 42-1, and 272B is the program length (bits) of the execution program 42-2. 272C is size data indicating the program length (number of bits) of the execution program 42-3, and 272D is size data indicating the program length (number of bits) of the execution program 42-4. It is.
[0137]
Returning to FIG. 3, in step S9, the compression processing program 43A compresses the program data group 271 stored in the buffer of the RAM 13. FIG. 8 illustrates the concept of compression by the compression processing program 43A. That is, the compression processing program 43A sets the moving window 304, moves the moving window 304 in the direction of the arrow A along the program data group 271, and sequentially compresses the program data group 271. In FIG. 8, encoded data 301 indicates data whose moving window 304 has been moved and has been encoded. Reference numeral 302 denotes data of one coding unit to be coded based on the current moving window 304. Reference numeral 303 denotes uncoded data that has not been coded yet.
[0138]
Here, the LZ77 code, which is the coding method of FIG. 8, will be described. A representative Lexel-Ziv code is a dictionary data compression algorithm. Lempel-Ziv codes are roughly classified into two types: LZ77 codes and LZ78 codes. Of these, assuming a moving window 304 as shown in FIG. 8, the LZ77 code encodes / decodes data in the moving window 304 as a dictionary.
[0139]
The compression processing program 43A that compresses (encodes) data using the LZ77 code first searches a character string existing in the dictionary for a character string that is the longest match with the data 302 of one encoding unit to be encoded. I do. Then, when there is a match, the compression processing program 43A uses the flag indicating that there is a match, the start position of the matched character string in the dictionary, and the match length as codes, and sets the data 302 in one coding unit as a code. Encode the data inside. When there is no match, the compression processing program 43A sets the flag indicating that there is no match and the character string having no match as a code as it is in the data 302 of the data 302 in one coding unit. Is encoded. Then, the compression processing program 43A slides the moving window 304 so as to include the currently encoded data 302 of one encoding unit to make a new dictionary, and retrieves and matches a new one from the dictionary. . The compression processing program 43A encodes the entire data by repeating the above processing.
[0140]
The Lempel-Ziv code is universal data compression for asymptotically compressing data whose probability structure is unknown to an entropy rate, and is known to be capable of efficient compression. Also, it is capable of very high-speed decompression and is suitable for software processing.
[0141]
Returning to FIG. 3, in step S10, the recording program 43 causes the storage device 18 to store the compressed program data and information data as the compressed code data 41. The information data includes the size data 272 added in step S7, total program data indicating the total number of programs, and bit length data indicating the bit length X. FIG. 9 shows an example of the compressed code data 41.
[0142]
9, the compressed code data 41 is composed of compressed program data 351 and information data 352 compressed by the compression processing program 43A in step S9. The information data 352 includes bit length data 361, total program data 362, and size data 272. The bit length data 361 is data generated based on the bit length X set in the array processing program 43C in advance, and the program total number data 362 is the program total number (4) of the execution program 42 stored in the nonvolatile memory 21. ). The bit length data 361 and the total program data 362 are generated by the recording program 43.
[0143]
In step S11, the recording program 43 reads out the compressed code data 41 and the boot program 44 stored in the storage device 18 by the processing in step S10, and supplies them to the nonvolatile memory writing device 14. The nonvolatile memory writing device 14 stores (stores) the supplied compressed code data 41 and the supplied boot program 44 in the nonvolatile memory 21.
[0144]
As described above, the compressed execution program 42 is stored in the nonvolatile memory 21.
[0145]
As described above, by rearranging every other linked program in reverse order, similar codes are brought closer to each other and compressed, so that a local decrease in the compression ratio near the boundary between programs can be reduced. Compression ratio can be improved. As a result, the amount of data to be stored in the nonvolatile memory 21 can be reduced, so that the memory cost can be reduced. Further, since the amount of data to be written to the nonvolatile memory 21 is reduced, the time for writing data to the nonvolatile memory can be reduced.
[0146]
Further, since the above processing does not require any change to the existing compression algorithm, application to an existing system can be easily realized.
[0147]
The execution program 42 stored in the nonvolatile memory 21 as described above is extended and executed by the CPU 244 of the imaging device 201.
[0148]
Next, with reference to the flowchart in FIG. 10, a description will be given of a decompression process of the imaging device 201, that is, a process in which the imaging device 201 decompresses an execution program stored in the nonvolatile memory 21 and rearranges the executable program in the executable order. I do.
[0149]
When the operation unit 212 is operated and the activation of the imaging device 201 is instructed, the host CPU 213 instructs the CPU 244-1 to execute the boot program 44. Therefore, in step S101, the CPU 244-1 reads and executes the boot program 44 stored in the nonvolatile memory 21. The boot program 44 includes a decompression program that decompresses the compressed program data 351. FIG. 11 shows an example of a program included in the boot program 44. That is, in FIG. 11, the boot program 44 includes a decompression program 44A, a management program 44B, and an array processing program 44C. The processing of the following steps S102 to S109 is executed by the CPU 244-1 executing the boot program 44.
[0150]
In step S102, the CPU 244-1 executes the decompression program 44A to read out the compressed code data 41 from the nonvolatile memory 21 and decompress the compressed program data 351 as shown in FIG. Then, the CPU 244-1 causes the SDRAM 214 to store the information data 352 and the decompressed program data group 271. When storing the decompressed program data group 271 in the SDRAM 214, the CPU 244-1 stores the decompressed program data group 271 in a corresponding memory address in order from a preset head address of the SDRAM 214.
[0151]
In step S103, the CPU 244-1 executes the management program 44B, thereby executing the start of each execution program based on the information data (size data 272, bit length data 361, and total program data 362) stored in the SDRAM 214. Is calculated at the memory address (head address) in which is stored.
[0152]
That is, since the program data group 271 is stored in order from the preset start address by the processing of step S102, the second execution program 42-1 is stored based on the program length of the first execution program 42-1. The memory address at the recording start position of -2 is specified. Then, the memory address of the recording start position of the third execution program 42-3 is specified based on the memory address of the recording start position of the second execution program 42-2 and the program length of the execution program 42-2. Similarly, the memory address of the recording start position of the fourth execution program 42-4 is specified based on the memory address of the recording start position of the third execution program 42-3 and the program length of the execution program 42-3. In this way, the CPU 244-1 calculates the memory address (head address) at which the head of each execution program is stored.
[0153]
In step S104, the CPU 244-1 (the management program 44B) creates a program management table in which the start address of each execution program calculated in step S103 is associated with the program length, and stores the program management table in the SDRAM 214. As shown in FIG. 11, the SDRAM 214 stores the program management table 401 created in step S104.
[0154]
Hereinafter, the processing of steps S105 to S109 is executed by the CPU 244-1 executing the array processing program 44C. First, in step S105, the CPU 244-1 initializes a program number i to 1.
[0155]
In step S106, the CPU 244-1 determines whether or not the program number i is equal to or less than the total number of programs. If the program number i is equal to or less than the total number of programs, the process proceeds to step S107.
[0156]
In step S107, the CPU 244-1 determines whether the program number i is an even number. If i is an even number, the process proceeds to step S108.
[0157]
In step S108, the CPU 244-1 rearranges the i-th execution program stored in the SDRAM 214 in the reverse order for each predetermined bit length X, and stores the rearranged program in the SDRAM 214. As a result, the execution programs that have been inverted in the order of the format 2 are rearranged in the original order (the order of the format 1), as shown in FIG. Thereafter, the process proceeds to step S109.
[0158]
In step S107, when the CPU 244-1 determines that the program number i is not an even number (is an odd number), the process of step S108 is skipped, and the process proceeds to step S109.
[0159]
In step S109, the CPU 244-1 increases the program number i by one. After that, the process returns to step S106, and the processes after step S106 described above are repeated. Note that the loop processing from step S106 to step S109 is processing for converting the execution program 42, which has been converted in the format 2 order, into the format 1 order.
[0160]
Then, in step S106, when the CPU 244-1 determines that the program number i is not smaller than the total number of programs (the program number i is larger than the total number of programs), the CPU 244-1 ends the decompression process.
[0161]
In order to more specifically show the processing of steps S105 to S109, the execution programs 42-1 to 42-4 arranged as the program data group 271 in FIG. An example in the case where the processing is executed will be described below.
[0162]
After the program number i is initialized to 1 in step S105, in step S106, the CPU 244-1 determines whether or not the program number i (= 1) is equal to or less than the total number of programs (= 4). Since i (= 1) is equal to or less than the total number of programs (= 4), the process proceeds to step S107. In step S107, the CPU 244-1 determines whether or not the program number i (= 1) is an even number. Since the program number i (= 1) is not even (odd), the processing in step S108 is not performed. The process is skipped, and the process proceeds to step S109. In step S109, the CPU 244-1 increments the program number i by 1, and sets the program number i to 2. Thereafter, the process returns to step S106.
[0163]
In step S106, the CPU 244-1 determines whether or not the program number i (= 2) is equal to or less than the total number of programs (= 4). Since the program number i (= 2) is equal to or less than the total number of programs (= 4), The process proceeds to step S107. In step S107, the CPU 244-1 determines whether or not the program number i (= 2) is an even number. Since the program number i (= 2) is an even number, the process proceeds to step S108. In step S108, the CPU 244-1 obtains the recording position of the second execution program 42-2 stored in the SDRAM 214 from the program management table 401, and based on the obtained recording position, Identify program code. Then, the CPU 244-1 converts the arrangement order of the execution programs 42-2 from the format 2 to the format 1, and updates the storage of the SDRAM 214. Thereafter, the process proceeds to step S109. In step S109, the CPU 244-1 increments the program number i by 1, and sets the program number i = 3. Thereafter, the process returns to step S106.
[0164]
In step S106, the CPU 244-1 determines whether or not the program number i (= 3) is equal to or less than the total number of programs (= 4). Since the program number i (= 3) is equal to or less than the total number of programs (= 4), The process proceeds to step S107. In step S107, the CPU 244-1 determines whether or not the program number i (= 3) is an even number. Since the program number i (= 3) is not an even number (is an odd number), the process of step S108 is not performed. The process is skipped, and the process proceeds to step S109. In step S109, the CPU 244-1 increments the program number i by 1, and sets the program number i = 4. Thereafter, the process returns to step S106.
[0165]
In step S106, the CPU 244-1 determines whether or not the program number i (= 4) is equal to or less than the total number of programs (= 4). Since the program number i (= 4) is equal to or less than the total number of programs (= 4), The process proceeds to step S107. In step S107, the CPU 244-1 determines whether the program number i (= 4) is an even number. Since the program number i (= 4) is an even number, the process proceeds to step S108. In step S108, the CPU 244-1 acquires the recording position of the fourth execution program 42-4 stored in the SDRAM 214 from the program management table 401, and based on the acquired recording position, Identify program code. Then, the CPU 244-1 converts the arrangement order of the execution programs 42-4 from the format 2 to the format 1, and updates the storage of the SDRAM 214. Thereafter, the process proceeds to step S109. In step S109, the CPU 244-1 increments the program number i by 1, and sets the program number i to 5. Thereafter, the process returns to step S106.
[0166]
In step S106, the CPU 244-1 determines whether or not the program number i (= 5) is equal to or smaller than the total number of programs (= 4), and the program number i (= 5) is not equal to or smaller than the total number of programs (= 4). (The program number i (= 5) is larger than the total number of programs (= 4)), so the CPU 244-1 terminates the decompression processing.
[0167]
As a result of the above processing, the execution programs 42-2 and 42-4 (in the format 2) whose arrangement order has been inverted are converted into the arrangement order in the format 1. The execution programs 42-1 to 42-4 in FIG. 11 show the states after the arrangement order has been converted by the decompression processing in FIG.
[0168]
By converting the execution programs 42-2 and 42-4, which were in the format 2 order, into the format 1 order, the execution programs 42-2 and 42-4 are in the order that the CPU 244 can directly execute.
[0169]
The user can operate the operation unit 212 to instruct various operations such as recording and reproduction of video and audio, and the host CPU 213 sends the execution program 42 corresponding to the instruction from the user to the CPU 244. Let it run. The execution programs 42 to be executed are assigned to the CPUs 244-1 to 244-3. In the example of FIG. 11, the CPU 244-1 is set to execute the execution program 42-1, the CPU 244-2 is set to execute the execution program 42-2, and the CPU 244-3 is set to execute the execution program 42-1. 42-3 and 42-4 are set to be executed.
[0170]
Next, a program execution process of the imaging device 201, that is, a process of executing the execution program 42 by the imaging device 201 will be described with reference to a flowchart of FIG.
[0171]
In step S151, the host CPU 213 determines whether or not the execution of the predetermined execution program 42 has been instructed based on the operation signal from the operation unit 212, and proceeds to step S151 until the execution of the predetermined execution program 42 is instructed. Repeat the process and wait. Then, when execution of the predetermined execution program 42 is instructed, the process proceeds to step S152.
[0172]
The execution program 42 executed by each of the CPUs 244-1 to 244-3 is set in advance. For example, in the example of FIG. 11, the CPU 244-1 executes the execution program 42-1, the CPU 244-2 executes the execution program 42-2, and the CPU 244-3 executes the execution programs 42-3 and 42-. 4 is set in advance. Therefore, in step S152, the host CPU 213 specifies which of the CPUs 244-1 to 244-3 the execution program 42 instructed to execute in step S151 is an execution program to be executed by It instructs the specified CPU 244 to execute the execution program 43 instructed in step S151. In the following description, a case where execution of the execution program 42-3 is instructed will be described as an example. In step S151, when instructed to execute the execution program 42-3, the host CPU 213 instructs the CPU 244-3 to execute the execution program 42-3.
[0173]
The CPU 244-3 first calculates the start address where the execution program 42-3 to be executed is stored with reference to the program management table 401 in accordance with the instruction from the host CPU 213.
[0174]
In step S153, the CPU 244-3 jumps to the start address calculated in step S152, and starts executing the execution program 42-3.
[0175]
In step S154, the CPU 244-3 determines whether or not all the processes of the execution program 42-3 have been executed, and when all the processes of the execution program 42-3 have not been executed (there is a process that has not been completed yet). If this is the case, the process proceeds to step S155.
[0176]
The user can operate the operation unit 212 during execution of the execution program 42-3 to input an instruction to forcibly terminate the execution of the execution program 42-3. When an instruction to forcibly terminate the executing program 42-3 is input, the host CPU 213 notifies the CPU 244-3 that is executing the executing program 42-3 to forcibly terminate the executing program 42-3. I do. Therefore, in step S155, the CPU 244-3 determines whether or not the forced termination instruction has been notified from the host CPU 213. If the forced termination instruction has not been notified from the host CPU 213, the process returns to step S154. Then, the above-described processing after step S154 is repeated.
[0177]
As described above, when the execution program 42-3 has not been terminated and the instruction of the forced termination has not been notified, the processing of steps S154 and S155 is repeated, and during that time, the execution of the execution program 42-3 is continued. However, if it is determined in step S154 that all the processing of the execution program 42-3 has been executed, the CPU 244-3 ends the execution of the execution program 42-3, and ends the program execution processing. Further, in step S155, when the instruction of the forced termination is notified from the host CPU 213, the CPU 244-3 terminates the execution of the execution program 42-3, and terminates the program execution processing.
[0178]
The program execution processing is executed as described above.
[0179]
In the above description, the case where the CPU 244-3 executes the execution program 42-3 has been described as an example, but this is only an example, and the above description is based on the case where the CPU 244-1 executes the execution program 42-1. Is executed, the CPU 244-2 executes the execution program 42-2, and the CPU 244-3 executes the execution program 42-4.
[0180]
As described above, according to the present invention, when the execution program 42 is compressed by the compression device 1, the execution programs 42 are inverted every other one and then compressed collectively, so that the execution programs 42 Similar code can be placed at the boundaries. Therefore, it is possible to further increase the compression ratio. As a result, the storage capacity of the non-volatile memory 21 can be made smaller, and the cost can be reduced.
[0181]
The experimental results will be described with reference to FIGS.
[0182]
The programs a and b having a code size of 131072 bytes were used for the experiment. Note that the program a and the program b are different codes. In the experiment, program a and program b were connected as shown in FIG. “A” shown in FIG. 13 represents a program a in the order of the format 1, “a reverse” represents a program a in the order of the format 2, and “b” is a program b in the order of the format 1 And "b reverse" represents the program b in the order of the format 2. That is, as shown in FIG. 13, the programs were linked in the following order: format 1 program a, format 2 program a, format 1 program b, format 2 program b, format 1 program b. The total length of the linked program is 655360 bytes.
[0183]
FIGS. 14 and 15 show the results of compressing the program linked as shown in FIG. 13 by LZSS with a moving window of 4096 bytes. FIG. 15 is a graph of the table of FIG. Note that LZSS (Lempel-Ziv-Storer-Syzmanski) is one of the variations of LZ77.
[0184]
In FIG. 14, “unit (byte) for rearranging in reverse order” in the left column indicates the bit length X. The unit is bytes. In the right column, the results of the compression ratio (%) of “the present invention” and “the conventional” are shown. As shown in FIG. 14, an experiment was performed with the bit length X set to a plurality of lengths from 1 byte to 16384 bytes.
[0185]
In FIG. 15, the vertical axis represents the compression ratio (%), and the horizontal axis represents the bit length X (“unit (byte) for rearranging in reverse order”). As is clear from FIG. 15, as a result of this experiment, when the bit length X is between a and b and is equal to or more than c, the compression ratio can be increased by applying the present invention as compared with the related art. On the other hand, when the bit length X is between 1 and a and between b and c, applying the present invention results in a lower compression ratio than before. This experimental result has confirmed that by setting the bit length X to an appropriate value, it is possible to increase the compression ratio as compared with the related art by applying the present invention.
[0186]
FIGS. 13 to 15 are examples of experiments, and the present invention can be expected to improve the compression ratio only to the extent shown in FIGS. 14 and 15 as compared with the related art. It does not mean. For example, even if the data amount of the entire program data group 271 is the same, if the number of execution programs constituting the program data group 271 is large, the boundary between the execution programs is also large, so that the compression ratio is higher than the conventional compression ratio. You can expect a compression ratio.
[0187]
In the above description, as shown in the program data group 271 in FIG. 7, the first execution program 42-1 to be linked is arranged in the format 1 order, and the second execution program 42-2 is changed to the format 2 , The third execution program 42-3 is arranged in the format 1, and the fourth execution program 42-4 is arranged in the format 2. On the other hand, the linked execution programs 42-1 to 42-4 may be configured as shown in FIG.
[0188]
That is, in the program data group 451 shown in FIG. 16, the first execution program 42-1 to be linked is arranged in the format 2 order, the second execution program 42-2 is arranged in the format 1 order, and the third execution program The program 42-3 is arranged in the format 2 and the fourth execution program 42-4 is arranged in the format 1. Compared with the program data group 271 of FIG. 7, in the program data group 271 of FIG. 7, the odd-numbered execution programs are arranged in the format 1 and the even-numbered execution programs are arranged in the format 2. On the other hand, in the program data group 451 in FIG. 16, the odd-numbered execution programs are arranged in the format 2 and the even-numbered execution programs are arranged in the format 1.
[0189]
When the program data group 451 shown in FIG. 16 is created, it is necessary to change the process of step S4 of the data recording process of FIG. That is, in step S4 described above, if the program number i is an odd number, the process proceeds to step S5, and if the program number i is an even number, the process proceeds to step S6. If is an odd number, the process proceeds to step S6, and if the program number i is an even number, the process proceeds to step S5. As a result, the program data group 451 shown in FIG. 16 can be created.
[0190]
When decompressing the compressed code data 41 obtained by compressing the program data group 451 shown in FIG. 16, it is necessary to change the process of step S107 in FIG. That is, in step S107 described above, if the program number i is an even number, the process proceeds to step S108. If the program number i is an odd number, the process in step S108 is skipped, and the process proceeds to step S109. However, when the program number i is an even number, the process of step S108 is skipped and the process proceeds to step S109. When the program number i is an odd number, the process is changed to step S108. As a result, the compressed code data 41 obtained by compressing the program data group 451 shown in FIG. 16 can be expanded, and the inverted execution programs can be rearranged in the original order.
[0191]
Incidentally, in the present invention, the program data group 271 of FIG. 7 and the program data group 451 of FIG. 16 can be made selectable. The compression processing in this case will be described with reference to the flowcharts of FIGS.
[0192]
In step S201, the data addition processing program 43B of the recording program 43 executes data addition processing. Note that the processing in step S201 is the same as the processing in step S1 in FIG. 3, and a detailed description thereof will be omitted.
[0193]
In step S202, the array processing program 43C of the recording program 43 determines whether the array of the execution program 42 is configured as the program data group 271 of FIG. 7 or the program data group 451 of FIG. Set. The processing in step S202 can be set by, for example, receiving any selection from the operator via the input unit 15.
[0194]
In step S203, the array processing program 43C initializes the program number i to 1, and initializes the buffer of the RAM 13.
[0195]
In step S204, the array processing program 43C determines whether the array set in step S202 is an array in which the odd-numbered execution programs 42 are arranged in the order of the format 2, and the array set in step S202 If the odd-numbered execution programs 42 are not arranged in the order of the format 2 (the even-numbered execution programs 42 are arranged in the order of the format 2), the process proceeds to step S205.
[0196]
The processing in steps S205 to S210 is the same as the processing in steps S3 to S8 in FIG. 3, and a description thereof will be omitted. In step S205, when the array processing program 43C determines that the program number i is not smaller than the total number of programs (the program number i is larger than the total number of programs), the process proceeds to step S211.
[0197]
In step S204, if the array processing program 43C determines that the array set in step S202 is an array in which the odd-numbered execution programs 42 are arranged in the format 2 order, the process proceeds to step S215 in FIG.
[0198]
In step S215, the array processing program 43C determines whether or not the program number i is equal to or less than the total number of programs. If the program number i is equal to or less than the total number of programs, the process proceeds to step S216.
[0199]
In step S216, the array processing program 43C determines whether or not the program number i is an odd number. If the program number i is not an odd number (if it is an even number), the process proceeds to step S217.
[0200]
In step S217, the array processing program 43C reads the i-th execution program 42 from the storage device 18, and adds the execution programs 42 to the buffer of the RAM 13 in the order of the format 1 as shown on the left side of FIG. (Remember). Thereafter, the process proceeds to step S219.
[0201]
In step S216, when the array processing program 43C determines that the program number i is an odd number, the process proceeds to step S218.
[0202]
In step S218, the array processing program 43C reads the i-th execution program 42 from the storage device 18, rearranges the format 2 in the RAM 13 in the arrangement order, and converts the rearranged format 2 execution program 42 into the RAM 13. Add (remember) to buffer.
[0203]
In step S219, the array processing program 43C acquires size data indicating the program length (number of bits) of the i-th execution program 42, and stores the size data in an area of the RAM 13 for storing information data.
[0204]
In step S220, the array processing program 43C increases the program number i by one. Thereafter, the process returns to step S215, and repeats the above-described processes from step S215.
[0205]
Then, in step S215, if the array processing program 43C determines that the program number i is not smaller than the total number of programs (the program number i is larger than the total number of programs), the process proceeds to step S211 in FIG.
[0206]
In step S211, the compression processing program 43A compresses the program data group 271 (or 451) stored in the buffer of the RAM 13. The process in step S211 is the same as the process in step S9 in FIG.
[0207]
In step S212, the array processing program 43C determines whether the program data group compressed in step S211 is the program data group 271 in FIG. 7 or the program data group 451 in FIG. 16 based on the setting in step S202. Create array data that indicates
[0208]
In step S213, the recording program 43 causes the storage device 18 to store the compressed program data and information data as the compressed code data 41. The information data includes the size data 272, the total program data 362, the bit length data 361, and the array data generated in step S212.
[0209]
In step S214, the recording program 43 reads the compressed code data 41 stored in the storage device 18 by the processing in step S213, and supplies the read compressed code data 41 to the nonvolatile memory writing device 14. The nonvolatile memory writing device 14 stores (stores) the supplied compressed code data 41 in the nonvolatile memory 21. At this time, the recording program 43 reads the boot program 44 together with the compressed code data 41 and supplies the read boot program 44 to the nonvolatile memory writer 14. The nonvolatile memory writing device 14 stores the boot program 44 in the nonvolatile memory 21 together with the compressed code data 41.
[0210]
As described above, the array may be selected as either the program data group 271 in FIG. 7 or the program data group 451 in FIG. In this case, by including the array data indicating which one is selected in the information data, when the image pickup apparatus 201 performs the decompression process, the CPU 244 can accurately execute the inverted execution program 42 when the imaging apparatus 201 performs the decompression processing. It is possible to return to the order.
[0211]
Next, with reference to the flowcharts of FIGS. 19 and 20, a description will be given of a decompression process of decompressing the compressed code data 41 stored in the nonvolatile memory 21 by the data recording process of FIGS.
[0212]
The processes in steps S251 to S254 are the same as the processes in steps S101 to S104 in FIG.
[0213]
After step S254, in step S255, the CPU 244-1 (array processing program 44C) reads out the array data from the information data stored in the SDRAM 214, and executes the odd-numbered execution program 42 based on the array data. It is determined whether or not the odd-numbered execution programs 42 are in the order of format 2 (if the even-numbered execution programs 42 are in the order of format 2), the process proceeds to step Proceed to S256.
[0214]
Steps S256 to S260 are the same as steps S105 to S109 in FIG. 10, respectively. That is, the CPU 244-1 (array processing program 44C) initializes the program number i to 1 in step S256, determines whether or not the program number i is equal to or less than the total number of programs in step S257. If not, the process proceeds to step S258.
[0215]
The CPU 244-1 (array processing program 44C) determines in step S258 whether or not the program number i is an even number. If i is an even number, the process proceeds to step S259. In step S259, the CPU 244-1 (the array processing program 44C) rearranges the i-th execution program stored in the SDRAM 214 in the order of a predetermined bit length X in reverse order, and stores the rearranged program in the SDRAM 214. As a result, the inverted execution program is rearranged in the original arrangement order (the arrangement order of the format 1). Thereafter, the process proceeds to step S260.
[0216]
In step S258, if the CPU 244-1 (array processing program 44C) determines that the program number i is not an even number (is an odd number), the process of step S259 is skipped, and the process proceeds to step S260.
[0219]
In step S260, the CPU 244-1 (array processing program 44C) increases the program number i by one. After that, the process returns to step S257, and the processes after step S257 described above are repeated.
[0218]
Then, in step S257, if the CPU 244-1 (array processing program 44C) determines that the program number i is not smaller than the total number of programs (the program number i is larger than the total number of programs), the CPU 244-1 terminates the decompression processing. I do.
[0219]
If the CPU 244-1 (array processing program 44C) determines in step S255 that the odd-numbered execution programs 42 are in the order of the format 2, the process proceeds to step S261 in FIG.
[0220]
The CPU 244-1 (array processing program 44C) initializes the program number i to 1 in step S261, determines whether or not the program number i is equal to or less than the total number of programs in step S262. If it is below, the process proceeds to step S263.
[0221]
The CPU 244-1 (array processing program 44C) determines in step S263 whether or not the program number i is an odd number. If i is an odd number, the process proceeds to step S264. In step S264, the CPU 244-1 (array processing program 44C) rearranges the i-th execution program stored in the SDRAM 214 for each predetermined bit length X in the reverse order, and stores the rearranged program in the SDRAM 241. As a result, the inverted execution program is rearranged in the original arrangement order (the arrangement order of the format 1). Thereafter, the process proceeds to step S265.
[0222]
In step S263, when the CPU 244-1 (array processing program 44C) determines that the program number i is not an odd number (is an even number), the process of step S264 is skipped, and the process proceeds to step S265.
[0223]
In step S265, the CPU 244-1 (array processing program 44C) increases the program number i by one. After that, the process returns to step S262, and the processes after step S262 described above are repeated.
[0224]
Then, in step S262, if the CPU 244-1 (array processing program 44C) determines that the program number i is not smaller than the total number of programs (the program number i is larger than the total number of programs), the CPU 244-1 terminates the decompression processing. I do.
[0225]
The above may be performed.
[0226]
In the above description, the array data indicating which of the program data group 271 of FIG. 7 and the program data group 451 of FIG. 16 is selected is included in the information data. It may be set in the boot program in advance. That is, a boot program that rearranges the even-numbered execution programs 42 in the order of the format 1 and a boot program that rearranges the odd-numbered execution programs 42 in the order of the format 1 are stored in the compression device 1 in advance. When the compressed code data 41 is stored in the nonvolatile memory 21, if the compressed code data 41 includes the compressed program data obtained by compressing the program data group 271 of FIG. Are stored in the non-volatile memory 21 together with the compressed code data 41. If the compressed code data 41 includes the compressed program data obtained by compressing the program data group 451 in FIG. A boot program for rearranging the execution program 42 in the format 1 is stored in the nonvolatile memory 21 together with the compressed code data 41.
[0227]
The above may be performed.
[0228]
By the way, as can be seen from the graph of FIG. 15 described above, if the value of the bit length X to be set is different, the compression ratio of the program data group is also different. Therefore, by storing the compressed code data 41 having the highest compression ratio and the bit length X in the nonvolatile memory 21, the capacity of the compressed code data 41 stored in the nonvolatile memory 21 can be minimized.
[0229]
Therefore, for example, the compression device 1 is caused to generate the compressed code data 41 with a plurality of different bit lengths X, and the compressed code data 41 having the smallest data size is specified from the generated plurality of compressed code data 41. Alternatively, the specified compression code data 41 may be stored in the nonvolatile memory 21.
[0230]
The data recording process in this case will be described with reference to the flowchart in FIG.
[0231]
The compression device 1 holds a plurality of candidates of the bit length X in advance. For example, as shown in FIG. 14, the compression apparatus 1 may select 1 byte, 2 bytes, 4 bytes, 8 bytes, 16 bytes, 32 bytes, 64 bytes, 128 bytes, 256 bytes, and 512 bytes as candidates for the bit length X. 1024 bytes, 2048 bytes, 4096 bytes, 8192 bytes, and 16384 bytes. Then, in step S301, the recording program 43 determines whether or not the compressed code data 41 has been created with all the bit length X candidates, and the compressed code data 41 has not been created with all the bit length X candidates. If (there is a candidate for the bit length X for which the compressed code data 41 has not been created yet), the process proceeds to step S302.
[0232]
In step S302, the recording program 43 selects one candidate from a plurality of bit length X candidates and sets it as the bit length X when aligning the execution program 42.
[0233]
In step S303, the data addition processing program 43B executes the data addition processing using the bit length X set in step S302. The processing in step S303 is the same as the processing in step S1 in FIG.
[0234]
The processing in steps S304 to S312 is the same as the processing in steps S2 to S10 in FIG. 3, respectively. That is, the array processing program 43C initializes the program number i to 1 in step S304 and initializes the buffer of the RAM 13, and in step S305 determines whether the program number i is equal to or less than the total number of programs. If the number i is equal to or less than the total number of programs, the process proceeds to step S306.
[0235]
In step S306, the array processing program 43C determines whether or not the program number i is an even number. If the program number i is not an even number (if it is an odd number), the process proceeds to step S307. In step S307, the array processing program 43C reads the i-th execution program 42 from the storage device 18, and adds (stores) the execution program 42 to the buffer of the RAM 13 in the order of format 1. Thereafter, the process proceeds to step S309.
[0236]
In step S306, when the array processing program 43C determines that the program number i is an even number, the process proceeds to step S308. In step S308, the array processing program 43C reads the i-th execution program 42 from the storage device 18, rearranges it for each bit length X set in step S302 in the format 2 order, and then executes the rearranged execution program. The program 42 is added (stored) to the buffer of the RAM 13. Thereafter, the process proceeds to step S309.
[0237]
In step S309, the array processing program 43C acquires size data indicating the program length (the number of bits) of the i-th execution program 42, and stores the size data in the area of the RAM 13 for storing information data. In the RAM 13, an area for storing the execution program 42 and an area for storing information data are secured as different areas.
[0238]
In step S310, the array processing program 43C increases the program number i by one. After that, the process returns to step S305, and repeats the above-described processes from step S305.
[0239]
Then, in step S305, if the array processing program 43C determines that the program number i is not smaller than the total number of programs (the program number i is larger than the total number of programs), the process proceeds to step S311.
[0240]
As a result of the processing in steps S305 to S310, the buffer of the RAM 13 stores the program data group 271 and the size data 272 as shown in FIG. The program data group 271 is arranged using the bit length X set in step S302 as a unit.
[0241]
In step S311, the compression processing program 43A compresses the program data group 271 stored in the buffer of the RAM 13. In step S312, the recording program 43 causes the storage device 18 to store the compressed program data and information data as the compressed code data 41. The information data includes the size data 272 added in step S309, the total program data indicating the total number of programs, and the bit length data indicating the bit length X set in step S302.
[0242]
After that, the process returns to step S301, and the processes after step S301 described above are repeated. By repeating the processing in steps S301 to S312, a plurality of pieces of compressed code data 41 generated based on a plurality of different bit lengths X are stored in the storage device 18. When selecting one of the plurality of bit length X candidates in the process of step S302, the recording program 43 does not select the already selected bit length X candidate, but selects the bit length X that has not been selected yet. Select a candidate.
[0243]
Then, in step S301, when the recording program 43 determines that the generation of the compressed code data 41 for all the candidates of the bit length X has been completed, the process proceeds to step S313.
[0244]
In step S313, the recording program 43 selects the compressed code data 41 having the smallest data amount from among the plurality of compressed code data 41 stored in the storage device 18.
[0245]
In step S314, the recording program 43 reads the compressed code data 41 selected by the processing in step S313, and supplies the read compressed code data 41 to the nonvolatile memory writing device 14. The nonvolatile memory writing device 14 stores (stores) the supplied compressed code data 41 in the nonvolatile memory 21. At this time, the recording program 43 reads the boot program 44 together with the compressed code data 41 and supplies the boot program 44 to the nonvolatile memory writer 14. The nonvolatile memory writing device 14 stores the boot program 44 in the nonvolatile memory 21 together with the compressed code data 41.
[0246]
As described above, the compressed code data 41 having the smallest data amount is stored in the nonvolatile memory 21. With the above, the storage capacity of the nonvolatile memory 21 can be further reduced.
[0247]
As described above, according to the present invention, it is possible to compress a plurality of execution programs at a higher compression ratio.
[0248]
That is, as described above, the code of the execution program 42 includes instructions and data (initial values and constants of variables, character strings, and the like). Although the code arrangement differs depending on the link method used when creating the execution program 42, the instructions are often arranged first, and then the data is arranged immediately after that. Also, in the case of an arrangement other than the above, even if the link method is changed so as to achieve such an arrangement, there is almost no problem.
[0249]
Assuming that the code of the execution program 42 has such an arrangement, the statistical properties are often very different between the beginning and the end of the program code. The content of the dictionary differs greatly between the encoding of the one and the encoding of the end. In order to increase the compression ratio, it is desirable that the dictionary has as much data with a long matching length as possible. Therefore, it is better to arrange similar data as close as possible.
[0250]
The present invention easily converts the code of an execution program into a data format in which similar data is located nearby, and compresses the data in that format, thereby improving the compression ratio as compared to compression without conversion. It was made.
[0251]
In the above description, the LZ77 code is used as a compression algorithm and the statistical information is a dictionary corresponding to a moving window. However, the present invention provides statistical information (including a dictionary) of past data. Any compression algorithm other than the LZ77 code can be applied as long as the compression algorithm is used.
[0252]
Further, in the above description, the compression device 1 and the imaging device 201 are described separately, but the processing of the compression device 1 and the imaging device 201 is realized by one device without dividing the devices. Is also good. That is, the above-described data recording process, decompression process, and program execution process may be executed by one device.
[0253]
In the above description, the case where the execution programs 42-1 to 42-4 are compressed has been described as an example, but this means that the present invention can be applied only to the case where the execution programs are compressed. It does not do. What is connected and compressed may be data other than the program. That is, the present invention can be applied to a case where a plurality of data in which different types of codes are arranged at the beginning and end of the code are connected and compressed.
[0254]
The series of processes described above can be executed by hardware, or can be executed by software as described above. When a series of processing is executed by software, a program constituting the software executes various functions by installing a computer built in dedicated hardware or installing various programs. For example, it is installed from a network or a recording medium into a general-purpose personal computer or the like.
[0255]
As shown in FIGS. 1 and 2, this recording medium is a magnetic disk 31 (including a flexible disk) on which the program is recorded, which is distributed separately from the apparatus main body to provide the user with the program. An optical disk 32 (including a CD-ROM (Compact Disk-Only Memory), a DVD (Digital Versatile Disk)), a magneto-optical disk 33 (including an MD (Mini-Disk)), or a package medium including a semiconductor memory 34 or the like. In addition to the hard disk drive, the hard disk drive includes a non-volatile memory 21, a ROM 12, and a hard disk included in the storage device 18 in which programs are provided to the user in a state of being incorporated in the apparatus main body in advance.
[0256]
In this specification, a step of describing a program recorded on a recording medium may be performed in chronological order according to the described order, or may be performed in parallel or not necessarily in chronological order. This also includes processes executed individually.
[0257]
Also, in this specification, a system represents the entire device including a plurality of devices.
[0258]
【The invention's effect】
As described above, according to the first aspect of the present invention, data can be compressed. In particular, when a plurality of data (including programs) are connected and compressed, a local decrease in the compression ratio near the boundary between the data can be reduced, and the overall compression ratio can be improved. As a result, data stored in the non-volatile memory is reduced, so that memory cost can be reduced.
[0259]
Further, according to the first aspect of the present invention, the amount of data transferred to the non-volatile memory is reduced, so that the time for writing data to the non-volatile memory can be reduced.
[0260]
Further, according to the first aspect of the present invention, it is possible to improve the compression ratio without changing the existing compression algorithm, and it is possible to easily apply the present invention to an existing system.
[0261]
According to the second aspect of the present invention, it is possible to decompress the compressed data. In particular, by rearranging a plurality of data every other in the reverse order, even if the data is compressed at a high compression rate, the compressed data can be decompressed and restored in a usable arrangement order. Therefore, the amount of data stored in the nonvolatile memory is reduced, so that the memory cost can be reduced.
[0262]
Further, according to the second aspect of the present invention, since the amount of data transferred from the nonvolatile memory is reduced, the time for reading data from the nonvolatile memory is reduced, and the decompression processing of the data read from the nonvolatile memory is performed. Can be speeded up.
[0263]
Further, according to the second aspect of the present invention, it is possible to improve the compression ratio without changing the existing compression algorithm, and it is possible to easily apply the present invention to an existing system.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating a configuration example of a compression device to which the present invention has been applied.
FIG. 2 is a block diagram illustrating a configuration example of an imaging device to which the present invention has been applied.
FIG. 3 is a flowchart illustrating a data recording process of the compression device.
FIG. 4 is a diagram for explaining division of a program code of an execution program into bit length units.
FIG. 5 is a diagram illustrating the order of execution programs.
FIG. 6 is a flowchart illustrating data addition processing of the compression device.
FIG. 7 is a diagram illustrating an example of an array of linked execution programs.
FIG. 8 is a diagram illustrating the concept of a compression process.
FIG. 9 is a diagram illustrating data included in compressed code data.
FIG. 10 is a flowchart illustrating a decompression process of the imaging apparatus.
FIG. 11 is a diagram illustrating an operation of the imaging device.
FIG. 12 is a flowchart illustrating a program execution process of the imaging apparatus.
FIG. 13 is a diagram illustrating the order of connection of programs used in the experiment.
FIG. 14 is a diagram showing experimental results comparing a compression ratio when the present invention is applied and a conventional compression ratio.
FIG. 15 is a diagram showing an experimental result of comparing a compression ratio when the present invention is applied with a conventional compression ratio.
FIG. 16 is a diagram illustrating another example of an array of linked execution programs.
FIG. 17 is another flowchart illustrating a data recording process of the compression device.
FIG. 18 is a flowchart illustrating the data recording process of the compression device, continued from FIG. 17;
FIG. 19 is another flowchart illustrating a decompression process of the imaging apparatus.
FIG. 20 is a flowchart illustrating the decompression process of the imaging device, continued from FIG. 19;
FIG. 21 is still another flowchart illustrating the data recording process of the compression device.
[Explanation of symbols]
Reference Signs List 1 compression device, 11 CPU, 12 ROM, 13 RAM, 14 non-volatile memory writing device, 15 input unit, 16 output unit, 17 bus, 18 storage device, 19 communication unit, 20 drive, 21 non-volatile memory, 31 magnetic disk , 32 optical disk, 33 magneto-optical disk, 34 semiconductor memory, 41 compressed code data, 42-1 to 42-4 execution program, 43 recording program, 201 imaging device, 211 LSI, 212 operation unit, 213 host CPU, 214 SDRAM, 215 audio output unit, 216 audio input unit, 217 display unit, 218 imaging unit, 219 recording / playback unit, 241 bus, 242,243 interface, 244-1 to 244-3 CPU, 245 interface

Claims (13)

連結する複数のデータを、1つおきに所定のビット長単位で逆順に並べ替える並べ替え手段と、
前記並べ替え手段により、1つおきに逆順に並べ替えられた複数の前記データを連結して圧縮する圧縮手段と
を備えることを特徴とする情報処理装置。
Rearranging means for rearranging a plurality of data to be concatenated in reverse order in every other predetermined bit length unit;
An information processing apparatus, comprising: a compression unit that connects and compresses a plurality of pieces of data rearranged in every other order by the rearrangement unit.
前記データのビット数を前記ビット長で割り算した余りを、前記ビット長から差し引いた値に等しい長さの別データを前記データに付加する付加手段をさらに備える
ことを特徴とする請求項1に記載の情報処理装置。
2. The data processing apparatus according to claim 1, further comprising an adding unit that adds another data having a length equal to a value obtained by subtracting a remainder obtained by dividing the number of bits of the data by the bit length from the bit length to the data. Information processing device.
前記圧縮手段により圧縮された複数の前記データ、前記データ毎のデータサイズ、および前記ビット長を記録媒体に記録する記録手段をさらに備える
ことを特徴とする請求項1に記載の情報処理装置。
2. The information processing apparatus according to claim 1, further comprising a recording unit that records the plurality of data compressed by the compression unit, a data size of each data, and the bit length on a recording medium.
前記記録手段は、奇数番目に連結された前記データと偶数番目に連結された前記データのうち、いずれの前記データが逆順に並べ替えられたのかを示す配列データをさらに前記記録媒体に記録する
ことを特徴とする請求項3に記載の情報処理装置。
The recording means may further record, on the recording medium, array data indicating which of the odd-numbered data and the even-numbered data are rearranged in reverse order. The information processing apparatus according to claim 3, wherein:
前記並べ替え手段は、複数の異なる前記ビット長単位により、前記データを並べ替え、
前記圧縮手段は、複数の異なる前記ビット長単位により逆順に並べ替えられた前記データを、前記ビット長単位毎に連結して圧縮し、
前記記録手段は、前記圧縮手段により前記ビット長単位毎に連結して圧縮された前記データのうち、最も圧縮率の高い前記データを前記記録媒体に記録する
ことを特徴とする請求項3に記載の情報処理装置。
The rearranging unit rearranges the data according to a plurality of different bit length units,
The compression means, the data rearranged in a reverse order by a plurality of different bit length units, concatenated and compressed for each bit length unit,
4. The data recording apparatus according to claim 3, wherein the recording unit records the data having the highest compression rate among the data concatenated and compressed for each bit length unit by the compression unit on the recording medium. 5. Information processing device.
連結する複数のデータを、1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップと、
前記並べ替えステップの処理により、1つおきに逆順に並べ替えられた複数の前記データを連結して圧縮する圧縮ステップと
を含むことを特徴とする情報処理方法。
A rearranging step of rearranging a plurality of data to be concatenated in a reverse order in every other predetermined bit length unit;
A compression step of concatenating and compressing a plurality of the data rearranged in every other order in the rearrangement step.
連結する複数のデータを、1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップと、
前記並べ替えステップの処理により、1つおきに逆順に並べ替えられた複数の前記データを連結して圧縮する圧縮ステップと
を含むことを特徴とするコンピュータが読み取り可能なプログラムが記録されている記録媒体。
A rearranging step of rearranging a plurality of data to be concatenated in a reverse order in every other predetermined bit length unit;
A compression step of concatenating and compressing the plurality of pieces of data rearranged in every other order in reverse order by the processing of the rearrangement step. Medium.
連結する複数のデータを、1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップと、
前記並べ替えステップの処理により、1つおきに逆順に並べ替えられた複数の前記データを連結して圧縮する圧縮ステップと
をコンピュータに実行させることを特徴とするプログラム。
A rearranging step of rearranging a plurality of data to be concatenated in a reverse order in every other predetermined bit length unit;
And causing the computer to execute a compression step of concatenating and compressing the plurality of pieces of data rearranged in every other order in the rearrangement step.
連結して圧縮された複数のデータを伸長する伸長手段と、
前記伸長手段により伸長された複数の前記データを1つおきに所定のビット長単位で逆順に並べ替える並べ替え手段と
を備えることを特徴とする情報処理装置。
Decompression means for decompressing a plurality of concatenated and compressed data;
An information processing apparatus, comprising: a rearranging unit that rearranges a plurality of the data expanded by the expansion unit every other bit in a predetermined bit length unit in a reverse order.
前記並べ替え手段により1つおきに逆順に並べ替えられた複数の前記データのうち、指定された前記データに基づく処理を実行する実行手段をさらに備える
ことを特徴とする請求項9に記載の情報処理装置。
10. The information according to claim 9, further comprising: an execution unit configured to execute a process based on the specified data among the plurality of data rearranged by the rearranging unit in the reverse order. Processing equipment.
連結して圧縮された複数のデータを伸長する伸長ステップと、
前記伸長ステップの処理により伸長された複数の前記データを1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップと
を含むことを特徴とする情報処理方法。
A decompression step of decompressing a plurality of concatenated and compressed data;
And a rearranging step of rearranging the plurality of data decompressed by the processing of the decompression step every other bit in a predetermined bit length unit in a reverse order.
連結して圧縮された複数のデータを伸長する伸長ステップと、
前記伸長ステップの処理により伸長された複数の前記データを1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップと
を含むことを特徴とするコンピュータが読み取り可能なプログラムが記録されている記録媒体。
A decompression step of decompressing a plurality of concatenated and compressed data;
And a rearrangement step of rearranging a plurality of data expanded by the processing of the expansion step every other predetermined bit length in reverse order. recoding media.
連結して圧縮された複数のデータを伸長する伸長ステップと、
前記伸長ステップの処理により伸長された複数の前記データを1つおきに所定のビット長単位で逆順に並べ替える並べ替えステップと
をコンピュータに実行させることを特徴とするプログラム。
A decompression step of decompressing a plurality of concatenated and compressed data;
And a rearranging step of rearranging the data decompressed by the processing of the decompression step every other bit in a predetermined bit length unit in a reverse order.
JP2003116598A 2003-04-22 2003-04-22 Information processor and method therefor, recording medium, and program Withdrawn JP2004328097A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003116598A JP2004328097A (en) 2003-04-22 2003-04-22 Information processor and method therefor, recording medium, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003116598A JP2004328097A (en) 2003-04-22 2003-04-22 Information processor and method therefor, recording medium, and program

Publications (1)

Publication Number Publication Date
JP2004328097A true JP2004328097A (en) 2004-11-18

Family

ID=33496753

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003116598A Withdrawn JP2004328097A (en) 2003-04-22 2003-04-22 Information processor and method therefor, recording medium, and program

Country Status (1)

Country Link
JP (1) JP2004328097A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4814999B2 (en) * 2008-01-31 2011-11-16 富士通株式会社 Data compression / decompression method and compression / decompression program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4814999B2 (en) * 2008-01-31 2011-11-16 富士通株式会社 Data compression / decompression method and compression / decompression program

Similar Documents

Publication Publication Date Title
US6026198A (en) Data compression and restoration system for encoding an input character on the basis of a conditional appearance rate obtained in relation to an immediately preceding character string
KR100894002B1 (en) Device and data method for selective compression and decompression and data format for compressed data
JP2007037115A (en) Method for encoding digital data, method for encoding stream of data segment, encoder, parallel encoder for encoding source of data, parallel decoder for decoding source of coded data, method for decoding coded data, magnetic tape drive, and method for encoding stream of data
JPH07283739A (en) Method and device to compress and extend data of short block
US20090019070A1 (en) Data compression for communication between two or more components in a system
JPH09246991A (en) Data compression / decompression method, data compression device, and data decompression device
JP3141002B2 (en) Encoding method and data compressor
US7511639B2 (en) Data compression for communication between two or more components in a system
US20130054543A1 (en) Inverted Order Encoding in Lossless Compresssion
JP2005130099A (en) Arithmetic decoding device, arithmetic coding device, arithmetic coding / decoding device, portable terminal device, moving image photographing device, and moving image recording / reproducing device
JP2004515096A (en) How to perform Huffman decoding
CN101095284A (en) Device and data method for selectively compressing and decompressing and data format for compressed data
CA2770348A1 (en) Compression of bitmaps and values
JP4547503B2 (en) Arithmetic coding apparatus, arithmetic coding method, arithmetic coding program, and computer-readable recording medium storing the program
US6748520B1 (en) System and method for compressing and decompressing a binary code image
US7975194B2 (en) System and method for adaptive nonlinear test vector compression
JP2009118464A (en) Decoding variable-length codes in JPEG applications
JP2004328097A (en) Information processor and method therefor, recording medium, and program
JP2005521324A (en) Method and apparatus for lossless data compression and decompression
US20120002894A1 (en) Method for progressive jpeg image decoding
JP2002135128A (en) Data-compression method, data compression/expansion method, data-compression device, and data compression/ expansion device
JP6105355B2 (en) Image compression apparatus, image expansion apparatus, and operation control method thereof
JP4519701B2 (en) Variable length code decoding device
JP2008124632A (en) Image encoding device, image decoding device, image encoding method, image decoding method, image encoding program, image decoding program, recording medium on which image encoding program is recorded, and recording medium on which image decoding program is recorded
JPH07255055A (en) Variable length code decoding circuit and decoding method

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20060704