JP4666261B2 - Image processing apparatus and program - Google Patents

Image processing apparatus and program Download PDF

Info

Publication number
JP4666261B2
JP4666261B2 JP2006153234A JP2006153234A JP4666261B2 JP 4666261 B2 JP4666261 B2 JP 4666261B2 JP 2006153234 A JP2006153234 A JP 2006153234A JP 2006153234 A JP2006153234 A JP 2006153234A JP 4666261 B2 JP4666261 B2 JP 4666261B2
Authority
JP
Japan
Prior art keywords
block
image
component value
value
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2006153234A
Other languages
Japanese (ja)
Other versions
JP2007324973A (en
Inventor
太郎 横瀬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujifilm Business Innovation Corp
Original Assignee
Fuji Xerox Co Ltd
Fujifilm Business Innovation 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 Fuji Xerox Co Ltd, Fujifilm Business Innovation Corp filed Critical Fuji Xerox Co Ltd
Priority to JP2006153234A priority Critical patent/JP4666261B2/en
Publication of JP2007324973A publication Critical patent/JP2007324973A/en
Application granted granted Critical
Publication of JP4666261B2 publication Critical patent/JP4666261B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Record Information Processing For Printing (AREA)
  • Image Processing (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Description

本発明は、符号化された画像データを回転させる画像処理方法に関する。   The present invention relates to an image processing method for rotating encoded image data.

例えば、特許文献1には、DCTブロックを再配列し、各ブロック内でDCT係数の順序を再配列し、適当な係数の符号ビットを変更することにより量子化DCTドメイン内で90度回転を行う方法が開示されている。
また、特許文献7には、完全な伸長および圧縮の工程を経由することなしに、画像の圧縮ドメイン表現を直接操作して、選択された空間ドメイン操作を行う方法が開示されている。
特開平7−154264号公報 特開平9−247423号公報 特開平9−247424号公報 特開平8−204957号公報 特開平10−112796号公報 特開平10−336427号公報 特開平11−331847号公報 特開2000−134459号公報 特開2001−157029号公報 特開2003−189109号公報
For example, in Patent Document 1, a DCT block is rearranged, the order of DCT coefficients is rearranged in each block, and a sign bit of an appropriate coefficient is changed to rotate 90 degrees in a quantized DCT domain. A method is disclosed.
Patent Document 7 discloses a method for performing a selected spatial domain operation by directly manipulating a compressed domain representation of an image without going through a complete decompression and compression process.
JP-A-7-154264 Japanese Patent Laid-Open No. 9-247423 JP-A-9-247424 JP-A-8-204957 Japanese Patent Laid-Open No. 10-1212796 Japanese Patent Laid-Open No. 10-336427 JP-A-11-331847 Japanese Patent Laid-Open No. 2000-134594 Japanese Patent Laid-Open No. 2001-157029 JP 2003-189109 A

本発明は、上述した背景からなされたものであり、比較的軽い処理負荷で、符号化された画像データを回転させる画像処理装置を提供することを目的とする。   The present invention has been made from the above-described background, and an object thereof is to provide an image processing apparatus that rotates encoded image data with a relatively light processing load.

[画像処理装置]
上記目的を達成するために、本発明にかかる画像処理装置は、JPEG方式により符号化された画像データを回転させる画像処理装置であって、画像の符号データに基づいて、JPEG方式の処理単位となるブロックそれぞれを直接復号化するために必要となる必要情報を生成する生成手段と、前記生成手段により生成された各ブロックの必要情報のうち、一部のブロックの必要情報を保持する情報保持手段と、前記情報保持手段により保持されている必要情報に基づいて、回転された画像の符号データを生成する回転符号生成手段とを有する。
[Image processing device]
In order to achieve the above object, an image processing apparatus according to the present invention is an image processing apparatus that rotates image data encoded by the JPEG method, and based on the encoded data of the image, Generating means for generating necessary information necessary for directly decoding each block, and information holding means for holding necessary information of some blocks among the necessary information of each block generated by the generating means And rotation code generation means for generating code data of the rotated image based on the necessary information held by the information holding means.

好適には、前記情報保持手段は、画像の周縁部に相当するブロックの必要情報のみを保持し、前記改定符号生成手段は、画像周縁部に相当するブロックの必要情報に基づいて、90度回転又は180度回転された画像の符号データを生成する。   Preferably, the information holding unit holds only necessary information of a block corresponding to the peripheral portion of the image, and the revised code generating unit rotates 90 degrees based on the necessary information of the block corresponding to the peripheral portion of the image. Alternatively, code data of an image rotated by 180 degrees is generated.

好適には、前記情報保持手段は、主走査方向の各ブロックラインのうち、先頭ブロックの必要情報のみを保持し、この先頭ブロックに続く後続ブロックの必要情報を消去する。   Preferably, the information holding means holds only the necessary information of the head block among the block lines in the main scanning direction, and erases the necessary information of the subsequent block following the head block.

好適には、前記生成手段は、前記必要情報として、符号データにおける各ブロックの位置を特定するためのブロック位置情報と、各ブロックに含まれる直流成分値とを生成し、前記情報保持手段は、一部のブロックのブロック位置情報及び直流成分値を保持する。   Preferably, the generation unit generates block position information for specifying the position of each block in the code data and a DC component value included in each block as the necessary information, and the information holding unit includes: Holds block position information and DC component values of some blocks.

また、本発明にかかる画像処理装置は、JPEG方式により符号化された画像データを回転させる画像処理装置であって、画像の符号データに基づいて、既定の走査方向のブロック群からなるブロックラインそれぞれに対して直接アクセスするためのアクセス情報を生成するアクセス情報生成手段と、前記アクセス情報生成手段により生成されたアクセス情報に基づいて、回転された画像の符号データを生成する回転符号生成手段とを有する。   An image processing apparatus according to the present invention is an image processing apparatus that rotates image data encoded by the JPEG method, and each block line including a group of blocks in a predetermined scanning direction based on the code data of the image. Access information generating means for generating access information for direct access to the image and rotation code generating means for generating code data of a rotated image based on the access information generated by the access information generating means .

[プログラム]
また、本発明にかかるプログラムは、JPEG方式により符号化された画像データを回転させるコンピュータにおいて、画像の符号データに基づいて、JPEG方式の処理単位となるブロックそれぞれを直接復号化するために必要となる必要情報を生成するステップと、生成された各ブロックの必要情報のうち、一部のブロックの必要情報を保持するステップと、保持されている必要情報に基づいて、回転された画像の符号データを生成するステップとを前記コンピュータに実行させる。
[program]
The program according to the present invention is necessary for directly decoding each block that is a processing unit of the JPEG method based on the code data of the image in a computer that rotates image data encoded by the JPEG method. Generating necessary information, a step of retaining necessary information of a part of the generated necessary information of each block, and code data of a rotated image based on the retained necessary information And causing the computer to execute.

本発明の画像処理装置によれば、符号化された画像データの回転に要するメモリ量を小さくすることができる。   According to the image processing apparatus of the present invention, the amount of memory required for rotating encoded image data can be reduced.

[背景と概略]
まず、本発明の理解を助けるために、その背景及び概略を説明する。
例えば、国際標準JPEGは、8×8ブロックを単位とする符号化処理及び復号化処理を行う。このようなJPEGにより生成された画像の符号データを、完全に復号化することなく90度回転又は180度回転させるには、ブロック単位のランダムスキャンが必要である。
しかし、以下の理由のために、JPEGの符号から特定のブロックを抽出することは難しい。
(課題1)可変長符号化によって、符号がビット単位で変化するため、伸長なしにブロックの位置を見つけることが難しい。
(課題2)DCT係数の直流成分値(以下DC値)は、直前ブロックのDC値との差分値として符号化されるため、あるブロックのDC値を得るためには、直前ブロックのDC値を知る必要がある。
[Background and outline]
First, in order to help understanding of the present invention, its background and outline will be described.
For example, the international standard JPEG performs encoding processing and decoding processing in units of 8 × 8 blocks. In order to rotate the code data of an image generated by such JPEG by 90 degrees or 180 degrees without completely decoding, random scanning in units of blocks is necessary.
However, it is difficult to extract a specific block from a JPEG code for the following reasons.
(Problem 1) Since the code changes in bit units by variable length coding, it is difficult to find the position of the block without decompression.
(Problem 2) Since the DC component value (hereinafter referred to as DC value) of the DCT coefficient is encoded as a difference value from the DC value of the immediately preceding block, in order to obtain the DC value of a certain block, the DC value of the immediately preceding block is I need to know.

上記2つの課題を解決するために、例えば、1パス目でブロック毎のビット位置とDC値とを求めて、このビット位置及びDC値をメモリに格納しておき、2パス目で、メモリに格納されたビット位置及びDC値を用いてブロックのランダムスキャンを行うことが考えられる。
これにより、各ブロックへのランダムスキャンが可能になり、回転処理のために画像全体を伸長する必要がなくなる。
In order to solve the above two problems, for example, a bit position and a DC value for each block are obtained in the first pass, the bit position and the DC value are stored in the memory, and the memory is obtained in the second pass. It is conceivable to perform a random scan of the block using the stored bit position and DC value.
As a result, each block can be randomly scanned, and the entire image need not be expanded for the rotation process.

しかしながら、全ブロックのビット位置及びDC値を保持すると、メモリ領域を圧迫する。仮に、ビット位置に4[Byte]、DC値に2[Byte]必要だとすると、8ビットグレイの画像を回転させる場合に、原画像に比較して9%(すなわち、(4+2)/64)程度のメモリ容量が必要である。一般に、JPEGの圧縮率は、10〜20程度で運用されることが多いので、ビット位置及びDC値を保持するために、原画像の符号(以下、原符号)全体と同程度かそれ以上のメモリが必要ということになり、組込み機器などではメモリコストとして大きい。また、メインメモリが潤沢なCPU処理の場合でも、600dpiA3相当で7[MByte]程必要になるため、現状ではキャッシュメモリに収めるのが難しく、メインメモリへのアクセスが発生して、処理速度が低下する。   However, holding the bit positions and DC values of all blocks compresses the memory area. If 4 [Byte] is necessary for the bit position and 2 [Byte] is necessary for the DC value, when rotating an 8-bit gray image, it is about 9% (that is, (4 + 2) / 64) compared to the original image. Memory capacity is required. In general, since the compression rate of JPEG is often operated at about 10 to 20, in order to retain the bit position and the DC value, it is equal to or higher than the entire original image code (hereinafter referred to as original code). This means that memory is required, and the memory cost is high for embedded devices. Also, even when CPU processing is abundant in main memory, it is about 7 [MByte] equivalent to 600 dpi A3, so it is difficult to store it in the cache memory at present, access to the main memory occurs, and processing speed decreases. To do.

そこで、本実施形態における画像処理装置2は、ブロックライン毎に、先頭ブロックのビット位置及びDC値のみを記憶し、先頭ブロックのビット位置及びDC値のみを用いて、90度回転又は180度回転を実現する。ブロックラインとは、図1(A)に例示するブロックのうち、走査方向(主走査方向又は副走査方向)に配列されたブロック群である。本例では、主走査方向に配列されたブロック群からなるブロックラインの先頭ブロックについてのみ、ビット位置及びDC値が保持され、後続ブロック(先頭ブロックに続くブロック群)のビット位置及びDC値は保持されない。換言すると、本例の画像処理装置2は、ブロックラインへのランダムスキャンを用いて、所望の回転方向及び回転角度(90度又は180度)で回転された画像の符号データを生成する。   Therefore, the image processing apparatus 2 in the present embodiment stores only the bit position and DC value of the head block for each block line, and rotates 90 degrees or 180 degrees using only the bit position and DC value of the head block. To realize. A block line is a block group arranged in the scanning direction (main scanning direction or sub-scanning direction) among the blocks illustrated in FIG. In this example, the bit position and the DC value are held only for the first block of the block line made up of blocks arranged in the main scanning direction, and the bit position and the DC value of the subsequent block (block group following the first block) are held. Not. In other words, the image processing apparatus 2 of this example generates code data of an image rotated at a desired rotation direction and rotation angle (90 degrees or 180 degrees) using random scanning on the block lines.

より具体的には、画像処理装置2は、画像を右に90度回転させる場合には、図1(B)に例示するように、各ブロックラインを(原画像で)下から順に、副走査方向を優先して並列的に処理していけば、回転画像の符号データを生成することができる。なお、各ブロックの回転は、各ブロックに含まれるDCT係数の転置及び正負符号の交換により実現される。したがって、回転画像の符号データを生成する過程において、逆DCT処理を行う必要はない。また、各ブロックラインにおける後続ブロック(非先頭ブロック)の処理も、そのブロックを処理するときには直前ブロックの処理が終わっていることが保証されるため、先頭ブロックと同様に処理できる。
なお、以下の説明では、原画像の走査方向の最上流位置にあるブロック(本来的な先頭ブロック)だけでなく、直前ブロックまで処理された後続ブロックも先頭ブロックとよぶ場合がある。
More specifically, when the image processing apparatus 2 rotates the image 90 degrees to the right, as illustrated in FIG. 1B, each block line is sequentially scanned from the bottom (in the original image). If processing is performed in parallel with priority given to the direction, code data of a rotated image can be generated. Note that rotation of each block is realized by transposing DCT coefficients included in each block and exchanging positive and negative signs. Therefore, it is not necessary to perform the inverse DCT process in the process of generating the code data of the rotated image. Further, the processing of the subsequent block (non-first block) in each block line can be processed in the same manner as the first block because it is guaranteed that the processing of the immediately preceding block is finished when the block is processed.
In the following description, not only the block at the most upstream position in the scanning direction of the original image (original head block) but also the subsequent block processed up to the immediately preceding block may be called the head block.

また、画像処理装置2は、画像を左に90度回転させる場合には、図2(A)に例示するように、各ブロックラインを(原画像で)上から順に、副走査方向を優先して並列的に処理する。ただし、このとき得られるライン単位の符号は、回転後画像では下から上への順に並ぶ。
そこで、画像処理装置2は、図2(B)に例示するように、回転画像後の符号をブロックライン単位にバッファリングしておいて、符号の出力時に、処理順とは反対の順序で出力することにより、符号を並べなおす。このとき、リスタートマーカ(RSTマーカ)の挿入などの手段でブロックライン単位にバイトバウンダリに揃えておくことが望ましい。
なお、このような並び替えは、DMAのチェイニングのような手法でも実行し、システム内の他のモジュールに、並び替えられた符号を蹴り出すようにしてもよい。この場合、本実施形態のモジュール内に、ワークメモリを持たないように構成できる。
In addition, when the image processing apparatus 2 rotates the image 90 degrees to the left, as illustrated in FIG. 2A, each block line is (in the original image) in order from the top, giving priority to the sub-scanning direction. Process in parallel. However, the line-by-line codes obtained at this time are arranged in order from bottom to top in the rotated image.
Therefore, as illustrated in FIG. 2B, the image processing apparatus 2 buffers the code after the rotated image in units of block lines, and outputs the code in the order opposite to the processing order when outputting the code. By doing so, the codes are rearranged. At this time, it is desirable to align the byte boundary in block line units by means such as insertion of a restart marker (RST marker).
Such rearrangement may also be performed by a technique such as DMA chaining, and the rearranged codes may be kicked out to other modules in the system. In this case, the module of this embodiment can be configured not to have a work memory.

また、画像処理装置2は、画像を180度回転させる場合には、図2(C)に例示するように、各ブロックラインを(原画像で)下から順に、主走査方向を優先して処理する。換言すると、画像処理装置2は、原画像で下から、各ブロックライン毎に逐次処理する。ただし、このとき得られるブロック符号は、回転後画像では右から左に並ぶ。
ここで、DC値の差分の取り方は、主走査方向の向きで決まるので、ブロックを並べなおしてからでないとDC値を符号化することができない。
そこで、本画像処理装置2は、DC値及び交流成分値(以下AC値)のDCT係数を非圧縮でブロックライン分バッファリングしてから、ブロックの並べ替えと符号化を行う。
なお、画像処理装置2は、AC値のみを先に符号化し、DC値を非圧縮でバッファリングし、ブロックライン分貯まったところでDC値を符号化して、先に符号化されたAC値の符号とマージするようにしてもよい。前者は、処理が単純であるが非圧縮のブロックラインメモリを必要とする。一方、後者は、ワークメモリを減らせるが、処理が複雑になる。また、画像処理装置2は、AC値に対してゼロランレングス符号化だけかけて、このAC値及びDC値をバッファリングし、ブロックライン分貯まったところで残りの符号化処理を行ってもよい。
In addition, when the image is rotated 180 degrees, the image processing apparatus 2 processes each block line in order from the bottom (in the original image) with priority on the main scanning direction as illustrated in FIG. 2C. To do. In other words, the image processing apparatus 2 sequentially processes each block line from the bottom in the original image. However, the block codes obtained at this time are arranged from right to left in the rotated image.
Here, since the method of taking the difference between the DC values is determined by the direction in the main scanning direction, the DC values cannot be encoded unless the blocks are rearranged.
Therefore, the image processing apparatus 2 performs block rearrangement and encoding after buffering the DCT coefficients of the DC value and the AC component value (hereinafter referred to as AC value) for the block line without compression.
The image processing apparatus 2 encodes only the AC value first, buffers the DC value without compression, encodes the DC value when the block line is accumulated, and encodes the previously encoded AC value. And may be merged. The former is simple to process but requires uncompressed block line memory. On the other hand, the latter can reduce the work memory, but the processing becomes complicated. Further, the image processing apparatus 2 may perform only the zero run length encoding on the AC value, buffer the AC value and the DC value, and perform the remaining encoding processing when the block line is accumulated.

なお、カラー画像を符号化又は復号化する場合には、色差をサブサンプリングするために、MCU(Minimum Coding Unit)というブロック群が事実上の処理単位となるが、本ブロックをMCUに置き換えることにより同じ効果が容易に得られるため、説明の便宜上、ブロックによる構成を説明する。   When a color image is encoded or decoded, a block group called MCU (Minimum Coding Unit) is a de facto processing unit for sub-sampling the color difference, but this block is replaced with MCU. Since the same effect can be easily obtained, a configuration using blocks will be described for convenience of explanation.

[ハードウェア構成]
次に、画像処理装置2のハードウェア構成を説明する。
図3は、本発明にかかる画像処理方法が適応される画像処理装置2のハードウェア構成を、制御装置21を中心に例示する図である。
図3に例示するように、画像処理装置2は、CPU212及びメモリ214などを含む制御装置21、通信装置22、HDD・CD装置などの記録装置24、並びに、LCD表示装置あるいはCRT表示装置およびキーボード・タッチパネルなどを含むユーザインターフェース装置(UI装置)25から構成される。
画像処理装置2は、例えば、プリンタ装置3の内部に設けられ、入力された画像の符号データを、回転された画像の符号データに変換して、プリンタ装置3のプリントエンジンなどに送信する。
[Hardware configuration]
Next, the hardware configuration of the image processing apparatus 2 will be described.
FIG. 3 is a diagram illustrating the hardware configuration of the image processing apparatus 2 to which the image processing method according to the present invention is applied, centering on the control apparatus 21.
As illustrated in FIG. 3, the image processing apparatus 2 includes a control device 21 including a CPU 212 and a memory 214, a communication device 22, a recording device 24 such as an HDD / CD device, an LCD display device or a CRT display device, and a keyboard. A user interface device (UI device) 25 including a touch panel and the like is included.
For example, the image processing apparatus 2 is provided inside the printer apparatus 3, converts the code data of the input image into code data of a rotated image, and transmits the code data to the print engine of the printer apparatus 3.

[画像処理プログラム]
図4は、制御装置21(図3)により実行され、本発明にかかる画像処理方法を実現する画像処理プログラム5の機能構成を例示する図である。
図4に例示するように、画像処理プログラム5は、ブロック切出し部500、DC伸長部510、情報保持部520、先頭情報格納部530、符号シーク部540、変換係数伸長部550、ブロック内回転部560、DC差分算出部570、ハフマン符号化部580、及び再配置部590を有する。
画像処理プログラム5において、ブロック切出し部500は、入力された原符号(原画像の符号データ)から、各ブロックの符号を切り出す。
ここで、ブロック切出し部500は、ブロックを切り出すためにはハフマン伸長によって可変長符号の切れ目を見つける必要があるが、AC値は必要ないので、完全に伸長する必要はない。すなわち、JPEGのAC成分の符号は、ゼロラン(係数値0の連続数)と有効係数のペアでシンボルを構成する、いわゆる2次元ハフマン符号であり、付加ビット表現をとるため、完全に伸長する場合は、ゼロランを展開して無効係数を再構成し、グループ番号と付加ビットから有効係数を再構成する必要があるが、本例のブロック切出し部500は、ブロック位置の検出とDC値の伸長を目的とするため、上記の処理をする必要がない。
つまり、本例のブロック切出し部500は、注目ビット列に適合する符号語を検索し、計数した画素数に応じ、DC成分であれば完全にハフマン復号化してDC伸長部510に出力し、同時に、符号語の先頭位置をビット位置として情報保持部520に出力する。また、ブロック切出し部500は、AC成分であれば符号語のビット数だけ注目ビット列を進め、該当符号語に対応する画素数を計数して、次の符号語を検索する。
なお、実際には、EOB(EndOfBlock)やマーカなどの処理が入るが、説明の便宜上、これらの処理を省いて説明する。
[Image processing program]
FIG. 4 is a diagram illustrating a functional configuration of the image processing program 5 which is executed by the control device 21 (FIG. 3) and implements the image processing method according to the present invention.
As illustrated in FIG. 4, the image processing program 5 includes a block cutout unit 500, a DC decompression unit 510, an information holding unit 520, a head information storage unit 530, a code seek unit 540, a transform coefficient decompression unit 550, and an intra-block rotation unit. 560, a DC difference calculation unit 570, a Huffman coding unit 580, and a rearrangement unit 590.
In the image processing program 5, the block cutout unit 500 cuts out the code of each block from the input original code (code data of the original image).
Here, in order to cut out a block, the block cutout unit 500 needs to find a break in the variable length code by Huffman decompression, but does not need to be completely decompressed because an AC value is not necessary. That is, the code of the AC component of JPEG is a so-called two-dimensional Huffman code in which a symbol is composed of a pair of zero run (number of consecutive coefficient values 0) and effective coefficients, and when it is completely expanded to represent additional bits. Needs to reconstruct the invalid coefficient by expanding the zero run and reconstruct the effective coefficient from the group number and the additional bits, but the block cutout unit 500 in this example detects the block position and expands the DC value. For the purpose, it is not necessary to perform the above processing.
That is, the block cutout unit 500 in this example searches for a codeword that matches the target bit string, and according to the counted number of pixels, if it is a DC component, it is completely Huffman decoded and output to the DC decompression unit 510, The head position of the code word is output to the information holding unit 520 as the bit position. In addition, if it is an AC component, the block cutout unit 500 advances the target bit string by the number of bits of the code word, counts the number of pixels corresponding to the corresponding code word, and searches for the next code word.
In practice, processes such as EOB (EndOfBlock) and markers are included, but for convenience of explanation, these processes are omitted.

DC伸長部510は、入力された原符号のDC値を復号化し、復号化されたDC値を情報保持部520に出力する。
本例のDC伸長部510は、DC成分(差分値)に基づいて、各ブロックのDC値を生成し、生成されたDC値を情報保持部520に出力する。
The DC decompression unit 510 decodes the DC value of the input original code and outputs the decoded DC value to the information holding unit 520.
The DC decompression unit 510 of this example generates a DC value of each block based on the DC component (difference value), and outputs the generated DC value to the information holding unit 520.

情報保持部520は、ブロック切出し部500から入力されたビット位置、及び、DC伸長部510から入力されたDC値のうち、先頭ブロックのビット位置及びDC値のみを先頭情報格納部530に格納し、他のブロック(後続ブロック)のビット位置及びDC値を消去する。
なお、本例の情報保持部520は、先頭ブロックそれぞれを直接復号化するために必要となる必要情報として、先頭ブロックのビット位置及びDC値のみを保持するが、これに限定されるものではなく、画像の周縁部に相当する他のブロックのビット位置及びDC値を保持してもよい。
The information holding unit 520 stores, in the head information storage unit 530, only the bit position and DC value of the head block among the bit position input from the block cutout unit 500 and the DC value input from the DC decompression unit 510. The bit position and the DC value of another block (subsequent block) are erased.
The information holding unit 520 of this example holds only the bit position and DC value of the head block as necessary information necessary for directly decoding each head block, but is not limited to this. The bit positions and DC values of other blocks corresponding to the peripheral edge of the image may be held.

符号シーク部540は、先頭情報格納部530により格納されている先頭ブロックのビット位置に基づいて、入力された原符号をランダムスキャンし、必要な符号をブロックライン単位で切り出す。ブロックの切出し順序は、図1又は図2に例示したように、回転方向及び回転角度に対応したものである。
本例の符号シーク部540は、所望の回転方向及び回転角度に対応する先頭ブロックのビット位置及びDC値を先頭情報格納部530から読み出し、読み出されたビット位置から符号語を復号化して、先頭ブロックのシンボル(DC差分値、ACのゼロラン、及びACの有効係数)を切り出し、切り出された先頭ブロックのシンボルと、読み出されたDC値(このブロックのDC値)とを変換係数伸長部550に出力する。なお、本例の符号シーク部540は、先頭ブロックが切り出されると、次のブロックのビット位置を保持し、保持されたビット位置から、後続ブロックのシンボルを切り出す。
The code seek unit 540 randomly scans the input original code based on the bit position of the head block stored by the head information storage unit 530, and cuts out necessary codes in block line units. The block cutting order corresponds to the rotation direction and the rotation angle, as illustrated in FIG. 1 or FIG.
The code seek unit 540 of this example reads the bit position and DC value of the head block corresponding to the desired rotation direction and rotation angle from the head information storage unit 530, decodes the code word from the read bit position, A symbol (DC difference value, AC zero run, and AC effective coefficient) of the first block is cut out, and the extracted symbol of the first block and the read DC value (DC value of this block) are converted into a coefficient expansion unit. Output to 550. The code seek unit 540 of this example holds the bit position of the next block when the head block is cut out, and cuts out the symbol of the subsequent block from the held bit position.

変換係数伸長部550は、符号シーク部540により切り出された各ブロックの符号を復号化して、このブロックの変換係数(DC値及びAC値)を生成し、生成された変換係数をブロック内回転部560に出力する。
本例の変換係数伸長部550は、符号シーク部540から先頭ブロック(本来的な先頭ブロック)のシンボル(DC差分値、ACのゼロラン、及びACの有効係数)とDC値とが入力された場合には、入力されたDC値をそのまま適用し、ACのゼロランを展開して無効係数(ゼロ係数)を生成し、ACの有効係数とマージする。また、変換係数伸長部550は、後続ブロックのシンボル(DC差分値、ACのゼロラン、及びACの有効係数)が入力された場合には、入力されたDC差分値に直前ブロックのDC値を加算してDC値を生成し、ACのゼロランを展開しACの有効係数とマージする。
The transform coefficient expansion unit 550 decodes the code of each block cut out by the code seek unit 540, generates the transform coefficient (DC value and AC value) of this block, and converts the generated transform coefficient into an intra-block rotation unit To 560.
The transform coefficient expansion unit 550 of this example receives a symbol (DC difference value, AC zero run, AC effective coefficient) and DC value of the first block (original head block) from the code seek unit 540 , The input DC value is applied as it is, an AC zero run is expanded to generate an invalid coefficient (zero coefficient), and merged with the AC effective coefficient. Also, the transform coefficient expansion unit 550 adds the DC value of the immediately preceding block to the input DC difference value when the symbol (DC difference value, AC zero run, and AC effective coefficient) of the subsequent block is input. The DC value is generated, and the AC zero run is expanded and merged with the AC effective coefficient.

ブロック内回転部560は、所望の回転方向及び回転角度に応じて、変換係数伸長部550から入力された変換係数の配置及び正負符号の少なくとも一方を変換し、変換された変換係数をDC差分算出部570に出力する。このように、90度又は180度の回転処理は、逆DCT処理を行わなくても実施可能である。   The intra-block rotation unit 560 converts at least one of the conversion coefficient arrangement and the positive / negative sign input from the conversion coefficient expansion unit 550 according to a desired rotation direction and rotation angle, and calculates the converted conversion coefficient as a DC difference. To the unit 570. As described above, the rotation process of 90 degrees or 180 degrees can be performed without performing the inverse DCT process.

DC差分算出部570は、ブロック内回転部560から入力された変換係数のうち、DC値に基づいて、回転された画像における直前ブロックのDC値と注目ブロックのDC値との差分を算出する。
本例のDC差分算出部570は、画像を180度回転する場合(図2(C)の場合)に、1ブロックライン分の変換係数をバッファリングし、1ブロックライン分が貯まったら、バッファリングされた順序とは逆の順序で、各ブロックの変換係数を配列し、配列されたブロック群(すなわち、回転後の画像のブロック群)における直前ブロックのDC値を、注目ブロックのDC値から減算して、注目ブロックのDC差分値を生成する。なお、本例のDC差分算出部570は、画像を90度回転する場合に、1ブロック分の変換係数をバッファリングして、注目ブロックのDC差分値を算出する。
The DC difference calculation unit 570 calculates a difference between the DC value of the immediately preceding block and the DC value of the target block in the rotated image based on the DC value among the transform coefficients input from the intra-block rotation unit 560.
When the image is rotated 180 degrees (in the case of FIG. 2C), the DC difference calculation unit 570 of this example buffers the conversion coefficient for one block line. The transform coefficients of each block are arranged in the reverse order to the order in which they were performed, and the DC value of the immediately preceding block in the arranged block group (that is, the block group of the image after rotation) is subtracted from the DC value of the target block Then, the DC difference value of the block of interest is generated. Note that the DC difference calculation unit 570 of this example calculates the DC difference value of the block of interest by buffering the transform coefficient for one block when rotating the image by 90 degrees.

ハフマン符号化部580は、DC差分算出部570から入力された変換係数(DC差分値及びAC値)を符号化する。
本例のハフマン符号化部580は、DC差分算出部570から入力された変換係数をブロック単位でハフマン符号化し、生成された符号を再配置部590に出力する。
The Huffman encoding unit 580 encodes the transform coefficient (DC difference value and AC value) input from the DC difference calculation unit 570.
The Huffman coding unit 580 of this example performs Huffman coding on the transform coefficient input from the DC difference calculation unit 570 in units of blocks, and outputs the generated code to the rearrangement unit 590.

再配置部590は、ハフマン符号化部580により符号化された符号を、回転方法及び回転角度に応じて再配置する。
本例の再配置部590は、ハフマン符号化部580により符号化された各ブロックの符号をバッファリングし、画像を左に90度回転する場合には、図2(B)に例示するように、バッファリングされた順序とは逆の順序で、各ブロックラインを出力する。
The rearrangement unit 590 rearranges the codes encoded by the Huffman encoding unit 580 according to the rotation method and the rotation angle.
The rearrangement unit 590 of this example buffers the code of each block encoded by the Huffman encoding unit 580, and rotates the image 90 degrees to the left as illustrated in FIG. Each block line is output in the reverse order of the buffered order.

[全体動作]
次に、画像処理装置2の動作を説明する。
図5は、画像処理プログラム5によるアクセス情報登録処理(S10)を示すフローチャートである。
図5に示すように、ステップ100(S100)において、ブロック切出し部500は、入力された原符号のビット列の中から、走査順に注目ビット位置を設定し、設定された注目ビット位置から符号語を検索し切り出す。
また、ブロック切出し部500は、設定された注目ビット位置を情報保持部520に出力する。
[Overall operation]
Next, the operation of the image processing apparatus 2 will be described.
FIG. 5 is a flowchart showing the access information registration process (S10) by the image processing program 5.
As shown in FIG. 5, in step 100 (S100), the block cutout unit 500 sets a target bit position in the scanning order from the input bit string of the original code, and selects a code word from the set target bit position. Search and cut out.
Further, the block cutout unit 500 outputs the set target bit position to the information holding unit 520.

ステップ110(S110)において、ブロック切出し部500は、切り出された符号語がDC成分であるかAC成分であるかを判断する。具体的には、ブロック切出し部500は、これまでに切り出された符号語に対応するシンボル数(DC値及びAC値の個数)に基づいて、DC成分であるかAC成分であるかを判断する。
画像処理プログラム5は、切り出された符号語がDC成分である場合に、S120の処理に移行し、切り出された符号語がAC成分である場合に、S130の処理に移行する。
In step 110 (S110), the block cutout unit 500 determines whether the cut out codeword is a DC component or an AC component. Specifically, the block cutout unit 500 determines whether the component is a DC component or an AC component based on the number of symbols (the number of DC values and AC values) corresponding to the codewords cut out so far. .
The image processing program 5 proceeds to the process of S120 when the extracted code word is a DC component, and proceeds to the process of S130 when the extracted code word is an AC component.

ステップ120(S120)において、ブロック切出し部500は、切り出された符号語を復号化し、復号化されたDC成分(DC差分値)をDC伸長部510に出力し、この符号語のビット数だけ注目ビット位置を進める。
また、ブロック切出し部500は、シンボル数のカウント値を1つ加算する。
DC伸長部510は、ブロック切出し部500から入力されたDC差分値と、直前ブロックのDC値とを合算して、このブロックのDC値を算出し、算出されたDC値を情報保持部520に出力する。
In step 120 (S120), the block cutout unit 500 decodes the cut out codeword, outputs the decoded DC component (DC difference value) to the DC expansion unit 510, and pays attention to the number of bits of this codeword. Advance the bit position.
The block cutout unit 500 adds one count value for the number of symbols.
The DC decompression unit 510 adds the DC difference value input from the block cutout unit 500 and the DC value of the immediately preceding block, calculates the DC value of this block, and sends the calculated DC value to the information holding unit 520. Output.

ステップ130(S130)において、ブロック切出し部500は、切り出された符号語から、符号語に対応するAC値の個数を判定し、判定されたAC値の個数をシンボル数のカウント値に加算する。
また、ブロック切出し部500は、切り出された符号語のビット数だけ注目ビット位置を進めて、S180の処理に移行する。
In step 130 (S130), the block cutout unit 500 determines the number of AC values corresponding to the codeword from the cutout codeword, and adds the determined number of AC values to the count value of the number of symbols.
Further, the block cutout unit 500 advances the target bit position by the number of bits of the cut out code word, and proceeds to the process of S180.

ステップ140(S140)において、情報保持部520は、ブロック切出し部500から入力された注目ビット位置が先頭ブロックのビット位置であるか否かを判断する。例えば、情報保持部520は、DC伸長部520から入力されたDC値の個数をカウント値、このカウント値に基づいて、先頭ブロックのDC値であるか後続ブロックのDC値であるかを判断する。
画像処理プログラム5は、注目ビット位置が先頭ブロックである場合に、S150の処理に移行し、注目ビット位置が後続ブロックである場合に、S160の処理に移行する。
In step 140 (S140), the information holding unit 520 determines whether or not the bit position of interest input from the block cutout unit 500 is the bit position of the first block. For example, the information holding unit 520 counts the number of DC values input from the DC decompression unit 520, and determines whether the DC value of the first block or the subsequent block is based on the count value. .
The image processing program 5 proceeds to the process of S150 when the target bit position is the first block, and proceeds to the process of S160 when the target bit position is the subsequent block.

ステップ150(S150)において、情報保持部520は、ブロック切出し部500から入力された注目ビット位置を先頭ブロックのビット位置として先頭情報格納部530に格納し、DC伸長部510から入力されたDC値を先頭ブロックのDC値として先頭情報格納部530に格納する。   In step 150 (S150), the information holding unit 520 stores the bit position of interest input from the block cutout unit 500 in the head information storage unit 530 as the bit position of the head block, and the DC value input from the DC decompression unit 510 Is stored in the head information storage unit 530 as the DC value of the head block.

ステップ160(S160)において、情報保持部520は、ブロック切出し部500から入力された注目ビット位置、及び、DC伸長部510から入力されたDC値を先頭情報格納部530に格納することなく削除する。   In step 160 (S160), the information holding unit 520 deletes the bit position of interest input from the block cutout unit 500 and the DC value input from the DC decompression unit 510 without storing them in the head information storage unit 530. .

ステップ170(S170)において、画像処理プログラム5は、入力された原符号のビット列全体が処理されたか否かを判断し、未処理のビット列が存在する場合には、S100の処理に戻って、次の符号語に対する処理に移行し、全ビット列が処理された場合には、アクセス情報登録処理(S10)を終了する。
アクセス情報登録処理(S10)が終了すると、後述する回転処理(90度回転処理(S20)又は180度回転処理(S22))に移行する。
In step 170 (S170), the image processing program 5 determines whether or not the entire bit string of the input original code has been processed, and if there is an unprocessed bit string, the process returns to the process of S100, and the next When the process proceeds to the code word of FIG. 5 and all bit strings have been processed, the access information registration process (S10) is terminated.
When the access information registration process (S10) ends, the process proceeds to a rotation process (90-degree rotation process (S20) or 180-degree rotation process (S22)) described later.

図6は、画像処理プログラム5による90度回転処理(S20)を示すフローチャートである。
図6に示すように、ステップ200(S200)において、画像処理プログラム5は、画像を右に90度回転又は左に90度回転させるよう指示されると、90度回転処理を開始する。
符号シーク部540は、要求された回転角度及び回転方向に対応するスキャン順序を決定する。具体的には、符号シーク部540は、右に90度回転させるよう要求された場合に、図1(B)に例示するように、原画像における先頭ブロックの紙面の下方から上方に走査(すなわち、原画像の副走査方向下流から上流に走査)し、先頭ブロックの上端ブロックまでくると、次の副走査ライン(主走査方向右側のブロックライン)のブロック群を先頭ブロックとして紙面の下方から上方に走査するよう決定する。また、符号シーク部540は、左に90度回転させるよう要求された場合に、図2(A)に例示するように、原画像における先頭ブロックの紙面の上方から下方に走査(すなわち、原画像の副走査方向上流から下流に走査)し、先頭ブロックの下端ブロックまでくると、次の副走査ライン(主走査方向右側のブロックライン)のブロック群を先頭ブロックとして紙面の上方から下方に走査するよう決定する。
そして、符号シーク部540は、先頭情報格納部530に格納されている先頭情報のビット位置(又は直前ブロック処理後のビット位置)を用いて、決定されたスキャン順序に対応するブロック(注目ブロック)に直接アクセスし、この注目ブロックの符号をシンボル(DC差分値、ACのゼロラン及びACの有効係数)に変換し、変換されたシンボルを変換係数伸長部550に出力する。
また、符号シーク部540は、注目ブロックが本来的な先頭ブロックである場合には、先頭情報格納部530からDC値を読み出して変換係数伸長部550に出力する。
FIG. 6 is a flowchart showing the 90-degree rotation process (S20) by the image processing program 5.
As shown in FIG. 6, in step 200 (S200), when instructed to rotate the image 90 degrees to the right or 90 degrees to the left, the image processing program 5 starts the 90-degree rotation process.
The code seek unit 540 determines a scan order corresponding to the requested rotation angle and rotation direction. Specifically, when the code seek unit 540 is requested to rotate 90 degrees to the right, as illustrated in FIG. 1B, the code seek unit 540 scans from the bottom to the top of the sheet of the first block in the original image (that is, The original image is scanned from downstream to upstream in the sub-scanning direction) and reaches the top block of the top block, and the block group of the next sub-scanning line (the block line on the right side in the main scanning direction) is used as the top block from the bottom to the top of the page. Decide to scan. Further, when requested to rotate 90 degrees to the left, the code seek unit 540 scans from the top to the bottom of the first block of the original image as illustrated in FIG. 2A (that is, the original image). (Scans from upstream to downstream in the sub-scanning direction) and reaches the lower end block of the top block, and scans from the top to the bottom of the page using the block group of the next sub-scanning line (block line on the right side in the main scanning direction) as the top block. Decide as follows.
Then, the code seek unit 540 uses the bit position (or the bit position after the previous block processing) of the head information stored in the head information storage unit 530 to block (block of interest) corresponding to the determined scan order. , The code of this block of interest is converted into a symbol (DC difference value, AC zero run, and AC effective coefficient), and the converted symbol is output to the conversion coefficient expansion unit 550.
Also, the code seek unit 540 reads a DC value from the head information storage unit 530 and outputs the DC value to the transform coefficient expansion unit 550 when the target block is the original head block.

ステップ210(S210)において、変換係数伸長部550は、符号シーク部540から入力された注目ブロックのシンボルを、DC値及びAC値に変換し、変換されたDC値及びAC値をブロック内回転部560に出力する。   In step 210 (S210), the transform coefficient expansion unit 550 converts the symbol of the target block input from the code seek unit 540 into a DC value and an AC value, and the converted DC value and AC value are converted into an intra-block rotation unit. To 560.

ステップ220(S220)において、ブロック内回転部560は、要求された回転角度及び回転方向に応じて、変換係数伸長部550から入力された注目ブロックのDC値及びAC値の配置及び正負符号を変換し、変換されたDC値及びAC値をDC差分算出部570に出力する。   In step 220 (S220), the in-block rotation unit 560 converts the arrangement and the sign of the DC value and AC value of the block of interest input from the conversion coefficient expansion unit 550 according to the requested rotation angle and rotation direction. Then, the converted DC value and AC value are output to the DC difference calculation unit 570.

ステップ230(S230)において、DC差分算出部570は、直前ブロックのDC値と、注目ブロックのDC値との差分(DC差分値)を算出し、算出されたDC差分値と、入力されたAC値とをハフマン符号化部580に出力する。
ハフマン符号化部580は、DC差分算出部570から入力されたDC差分値及びAC値を再符号化し、生成された注目ブロックの符号を再配置部590に出力する。
In step 230 (S230), the DC difference calculation unit 570 calculates a difference (DC difference value) between the DC value of the immediately preceding block and the DC value of the block of interest, the calculated DC difference value, and the input AC The value is output to the Huffman encoder 580.
The Huffman encoding unit 580 re-encodes the DC difference value and the AC value input from the DC difference calculation unit 570, and outputs the generated code of the target block to the rearrangement unit 590.

ステップ240(S240)において、再配置部590は、ハフマン符号化部580から入力された注目ブロックの符号をバッファリングする。
ステップ250(S250)において、画像処理プログラム5は、全ブロックが処理された場合に、S260の処理に移行し、未処理のブロックが存在する場合に、S200の処理に戻る。
In step 240 (S240), the rearrangement unit 590 buffers the code of the target block input from the Huffman coding unit 580.
In step 250 (S250), the image processing program 5 proceeds to the process of S260 when all the blocks are processed, and returns to the process of S200 when there is an unprocessed block.

ステップ260(S260)において、画像処理プログラム5は、左に90度回転させるよう要求されている場合に、S270の処理に移行し、右に90度回転させるよう要求されている場合に、再配置部590にバッファリングされている符号をそのまま回転符号(回転された画像の符号データ)として外部に出力する。   In step 260 (S260), when the image processing program 5 is requested to rotate 90 degrees to the left, the process proceeds to S270, and when it is requested to rotate 90 degrees to the right, the image processing program 5 is rearranged. The code buffered in unit 590 is output to the outside as it is as a rotated code (code data of the rotated image).

ステップ270(S270)において、再配置部590は、バッファリングされている符号を、図2(B)に例示するように、主走査方向のブロックライン単位で、処理順とは逆の順序で外部に出力する。これにより、ブロックラインの順序が入れ替えられる。   In step 270 (S270), the rearrangement unit 590 outputs the buffered codes in block order in the main scanning direction in the order opposite to the processing order, as illustrated in FIG. 2B. Output to. As a result, the order of the block lines is changed.

図7は、画像処理プログラム5による180度回転処理(S22)を示すフローチャートである。なお、本図に示された処理のうち、図6に示された処理と実質的に同一のものには同一の符号が付されている。
図7に示すように、S200において、画像処理プログラム5は、画像を180度回転させるよう指示されると、180度回転処理を開始する。
符号シーク部540は、要求された回転角度及び回転方向に対応するスキャン順序を決定する。具体的には、符号シーク部540は、180度回転させるよう要求された場合に、図2(C)に例示するように、原画像における最下ブロックライン(主走査方向のブロックラインのうち、副走査方向最下流のブロックライン)を主走査方向に走査し、主走査方向最下流のブロックまでくると、副走査方向上流のブロックライン(紙面で1つ上のブロックライン)を走査するよう決定する。
そして、符号シーク部540は、先頭情報格納部530に格納されている先頭情報のビット位置(又は直前ブロック処理後のビット位置)を用いて、決定されたスキャン順序に対応するブロック(注目ブロック)に直接アクセスし、この注目ブロックの符号をシンボルに変換し、変換されたシンボルを変換係数伸長部550に出力する。
また、符号シーク部540は、注目ブロックが本来的な先頭ブロックである場合には、先頭情報格納部530からDC値を読み出して変換係数伸長部550に出力する。
FIG. 7 is a flowchart showing the 180-degree rotation process (S22) by the image processing program 5. It should be noted that among the processes shown in the figure, the same reference numerals are given to the substantially same processes as those shown in FIG.
As shown in FIG. 7, when the image processing program 5 is instructed to rotate the image by 180 degrees in S200, the image processing program 5 starts the 180 degree rotation process.
The code seek unit 540 determines a scan order corresponding to the requested rotation angle and rotation direction. Specifically, when the code seek unit 540 is requested to rotate 180 degrees, as illustrated in FIG. 2C, the lowermost block line (of the block lines in the main scanning direction of the original image) Scans the most downstream block line in the sub-scanning direction) in the main scanning direction, and when it reaches the most downstream block in the main scanning direction, determines to scan the block line upstream in the sub-scanning direction. To do.
Then, the code seek unit 540 uses the bit position (or the bit position after the previous block processing) of the head information stored in the head information storage unit 530 to block (block of interest) corresponding to the determined scan order. The code of the block of interest is converted into a symbol, and the converted symbol is output to the transform coefficient expansion unit 550.
Also, the code seek unit 540 reads a DC value from the head information storage unit 530 and outputs the DC value to the transform coefficient expansion unit 550 when the target block is the original head block.

S210において、変換係数伸長部550は、符号シーク部540から入力された注目ブロックのシンボルを、DC値及びAC値に変換し、変換されたDC値及びAC値をブロック内回転部560に出力する。
S220において、ブロック内回転部560は、要求された回転角度及び回転方向に応じて、変換係数伸長部550から入力された注目ブロックのDC値及びAC値の配置及び正負符号を変換し、変換されたDC値及びAC値をDC差分算出部570に出力する。
In step S210, the transform coefficient expansion unit 550 converts the symbol of the target block input from the code seek unit 540 into a DC value and an AC value, and outputs the converted DC value and AC value to the intra-block rotation unit 560. .
In S220, the in-block rotation unit 560 converts the DC value and AC value arrangement and the sign of the target block input from the conversion coefficient expansion unit 550 according to the requested rotation angle and rotation direction, and is converted. The obtained DC value and AC value are output to the DC difference calculation unit 570.

ステップ224(S224)において、DC差分算出部570は、ブロック内回転部560から入力された注目ブロックのDC値及びAC値を先入れ後出し方式でバッファリングする。これにより、主走査方向のブロックラインに含まれるブロック群の順序が入れ替えられる。   In step 224 (S224), the DC difference calculation unit 570 buffers the DC value and AC value of the block of interest input from the intra-block rotation unit 560 in a first-in last-out manner. Thereby, the order of the block groups included in the block line in the main scanning direction is changed.

ステップ228(S228)において、画像処理プログラム5は、主走査方向のブロックライン(図2(C))分のDC値及びAC値がDC差分算出部570にバッファリングされた場合(すなわち、主走査方向のブロックラインが完成した場合)に、S234の処理に移行し、ブロックライン分のDC値及びAC値がバッファリングされていない場合に、S200に戻って、次のブロックを処理する。   In step 228 (S228), the image processing program 5 determines that the DC value and AC value for the block line in the main scanning direction (FIG. 2C) are buffered in the DC difference calculation unit 570 (that is, main scanning). When the direction block line is completed), the process proceeds to S234. When the DC value and the AC value for the block line are not buffered, the process returns to S200 to process the next block.

ステップ234(S234)において、DC差分算出部570は、バッファリングされている1ブロックライン分のDC値及びAC値を先入れ後出し方式で1ブロックずつ取り出し、取り出されたブロックのDC値と、直前ブロックのDC値との差分(DC差分値)を算出し、算出されたDC差分値と、取り出されたブロックのAC値とをハフマン符号化部580に出力する。
ハフマン符号化部580は、DC差分算出部570から入力されたDC差分値及びAC値を再符号化し、生成された注目ブロックの符号を再配置部590に出力する。
In step 234 (S234), the DC difference calculation unit 570 extracts the buffered DC value and AC value for one block line one block at a time in a first-in last-out manner, and the DC value of the extracted block, A difference (DC difference value) from the DC value of the immediately preceding block is calculated, and the calculated DC difference value and the AC value of the extracted block are output to the Huffman encoding unit 580.
The Huffman encoding unit 580 re-encodes the DC difference value and the AC value input from the DC difference calculation unit 570, and outputs the generated code of the target block to the rearrangement unit 590.

S240において、再配置部590は、ハフマン符号化部580から入力された注目ブロックの符号をバッファリングする。
S250において、画像処理プログラム5は、未処理のブロックが存在する場合に、S200の処理に戻り、全ブロックが処理された場合に、再配置部590にバッファリングされている符号をそのまま回転符号として外部に出力する。
In S240, the rearrangement unit 590 buffers the code of the target block input from the Huffman encoding unit 580.
In S250, when there is an unprocessed block, the image processing program 5 returns to the process of S200, and when all the blocks are processed, the code buffered in the rearrangement unit 590 is directly used as a rotation code. Output to the outside.

以上説明したように、本実施形態における画像処理装置2は、全ブロックのビット位置及びDC値を保持するのではなく、先頭ブロックのビット位置及びDC値のみを保持して、90度又は180度に回転された画像の符号データを生成する。
これにより、ビット位置及びDC値の保持に要するメモリ領域が小さくなる。
As described above, the image processing apparatus 2 in this embodiment does not hold the bit positions and DC values of all blocks, but holds only the bit positions and DC values of the first block, and is 90 degrees or 180 degrees. The code data of the image rotated in (1) is generated.
As a result, the memory area required to hold the bit position and the DC value is reduced.

[変形例]
図8は、変形例における画像処理プログラム52の機能構成を例示する図である。なお、本図に示された各構成のうち、図4に示された構成と実質的に同一のものには同一の符号が付されている。
図8に例示するように、画像処理プログラム52は、図4の画像処理プログラム5のDC差分算出部570を削除し、ハフマン符号化部580をAC符号化部582で置換し、このAC符号化部582の後段にDC符号化部582を追加した構成をとる。
[Modification]
FIG. 8 is a diagram illustrating a functional configuration of the image processing program 52 in the modification. It should be noted that among the components shown in this figure, the same reference numerals are given to the components substantially the same as those shown in FIG.
As illustrated in FIG. 8, the image processing program 52 deletes the DC difference calculation unit 570 of the image processing program 5 of FIG. 4, replaces the Huffman encoding unit 580 with an AC encoding unit 582, and performs this AC encoding. A configuration in which a DC encoding unit 582 is added after the unit 582 is adopted.

本変形例のAC符号化部582は、ブロック内回転部560から入力された注目ブロックのDC値及びAC値のうち、AC値のみを符号化し、入力されたDC値と、符号化されたAC値(以下AC符号)とをDC符号化部584に出力する。
本変形例のDC符号化部584は、180度回転が要求されている場合に、AC符号化部582から入力されたDC値及びAC符号をバッファリングし、ブロックライン分のDC値が貯まったところで、このブロックラインに含まれるブロック群の順序を入れ替えて、DC差分値を算出し、算出されたDC差分値を符号化する。
The AC encoding unit 582 of the present modification encodes only the AC value out of the DC value and AC value of the target block input from the intra-block rotation unit 560, and the input DC value and the encoded AC The value (hereinafter referred to as AC code) is output to DC encoding section 584.
When the 180 degree rotation is requested, the DC encoding unit 584 of the present modification buffers the DC value and the AC code input from the AC encoding unit 582, and the DC value for the block line is accumulated. By the way, the order of the block groups included in this block line is changed, the DC difference value is calculated, and the calculated DC difference value is encoded.

このように、本変形例の画像処理プログラム52は、180度回転が要求されている場合に、AC値を符号化した状態でバッファリングするため、バッファリングに要するワークメモリを減らすことができる。
なお、画像処理プログラムは、各ブロックのAC値のうち、無効係数のみをランレングス方式で符号化して、バッファリングして、ブロックラインに含まれるブロック群の入替えを行ってもよい。
As described above, the image processing program 52 according to the present modification performs buffering in a state where the AC value is encoded when rotation by 180 degrees is required, so that the work memory required for buffering can be reduced.
Note that the image processing program may replace only the invalid coefficient of the AC value of each block by the run length method and buffer the block group included in the block line.

原画像を右に90度回転させる場合のスキャン順序を説明する。A scan order when the original image is rotated 90 degrees to the right will be described. (A)は、原画像を左に90度回転させる場合のスキャン順序を説明し、(B)は、ブロックラインの再配置を説明する図であり、(C)は、原画像を180度回転させる場合のスキャン順序を説明する図である。(A) illustrates the scanning order when the original image is rotated 90 degrees to the left, (B) illustrates the rearrangement of block lines, and (C) illustrates the original image rotated 180 degrees. It is a figure explaining the scanning order in making it carry out. 本発明にかかる画像処理方法が適応される画像処理装置2のハードウェア構成を、制御装置21を中心に例示する図である。It is a figure which illustrates the hardware constitutions of the image processing apparatus 2 with which the image processing method concerning this invention is applied centering on the control apparatus 21. FIG. 制御装置21(図3)により実行され、本発明にかかる画像処理方法を実現する画像処理プログラム5の機能構成を例示する図である。It is a figure which illustrates the functional structure of the image processing program 5 which is performed by the control apparatus 21 (FIG. 3) and implement | achieves the image processing method concerning this invention. 画像処理プログラム5によるアクセス情報登録処理(S10)を示すフローチャートである。It is a flowchart which shows the access information registration process (S10) by the image processing program 5. FIG. 画像処理プログラム5による90度回転処理(S20)を示すフローチャートである。It is a flowchart which shows the 90 degree | times rotation process (S20) by the image processing program 5. FIG. 画像処理プログラム5による180度回転処理(S22)を示すフローチャートである。It is a flowchart which shows the 180 degree | times rotation process (S22) by the image processing program 5. FIG. 変形例における画像処理プログラム52の機能構成を例示する図である。It is a figure which illustrates the function structure of the image processing program 52 in a modification.

符号の説明Explanation of symbols

2・・・画像処理装置
5,52・・・画像処理プログラム
500・・・ブロック切出し部
510・・・DC伸長部
520・・・情報保持部
530・・・先頭情報格納部
540・・・符号シーク部
550・・・変換係数伸長部
560・・・ブロック内回転部
570・・・DC差分算出部
580・・・ハフマン符号化部
582・・・AC符号化部
584・・・DC符号化部
590・・・再配置部
DESCRIPTION OF SYMBOLS 2 ... Image processing apparatus 5,52 ... Image processing program 500 ... Block cutout part 510 ... DC decompression part 520 ... Information holding part 530 ... Start information storage part 540 ... Code Seek section 550 ... Conversion coefficient expansion section 560 ... In-block rotation section 570 ... DC difference calculation section 580 ... Huffman coding section 582 ... AC coding section 584 ... DC coding section 590 ... Rearrangement section

Claims (6)

JPEG方式により符号化された画像データを回転させる画像処理装置であって、
回転処理の対象である画像の符号データに基づいて、JPEG方式の処理単位となる各ブロックの位置を特定するためのブロック位置情報と、各ブロックに含まれる直流成分値とを生成する生成手段と、
前記生成手段により生成された各ブロックのブロック位置情報および直流成分値のうち、走査方向の各ブロックラインの先頭ブロックのブロック位置情報および直流成分値のみを保持する情報保持手段と、
前記情報保持手段により保持されている先頭ブロックのブロック位置情報および直流成分値に基づいて、前記回転処理の方向および角度に基づいた順序で、符号化された画像データのブロックにアクセスし、前記アクセスしたブロックの符号を直流成分値及び交流成分値に変換し、前記変換された直流成分値及び交流成分値を前記回転処理の方向及び角度に基づいて変換して再符号化し、前記回転処理の方向及び角度に基づいて再配置を行うことにより、90度回転又は180度回転された画像の符号データを生成する回転符号生成手段と
を有する画像処理装置。
An image processing apparatus for rotating image data encoded by the JPEG method,
Generating means for generating block position information for specifying the position of each block, which is a JPEG processing unit, and a DC component value included in each block, based on code data of an image to be rotated; ,
Of the block position information and DC component value of each block generated by the generating means, information holding means for holding only the block position information and DC component value of the leading block of each block line in the main scanning direction;
Based on the block position information and DC component value of the leading block held by the information holding means, the block of the encoded image data is accessed in the order based on the direction and angle of the rotation process, and the access The converted block code is converted into a DC component value and an AC component value, the converted DC component value and the AC component value are converted and re-encoded based on the direction and angle of the rotation process, and the direction of the rotation process is converted. And a rotation code generation means for generating code data of an image rotated 90 degrees or 180 degrees by performing rearrangement based on the angle .
前記回転符号生成手段は、
要求された回転角度及び回転方向に対応するブロックの切り出し順序を決定し、
前記ブロック位置情報に基づき、決定された切り出し順序で符号化された画像データをブロックライン単位で切り出し、
各ブロックの符号を復号化することにより得られる直流成分差分値、交流成分のゼロラン及び交流成分の有効係数と、当該ブロックラインの先頭ブロックの直流成分値とに基づいて、各ブロックの直流成分値および交流成分値を変換係数として生成し、
要求された回転角度及び回転方向に応じて、前記変換係数の配置及び正負符号の少なくとも一方を変換することにより、回転処理後の変換係数を算出し、
算出された回転処理後の変換係数のうちの直流成分値を用いて、直前ブロックにおける直流成分値と注目ブロックの直流成分値とに基づき、ブロックラインにおける各注目ブロックの直流成分差分値を生成し、生成された直流成分差分値と回転処理後の変換係数における前記交流成分値をブロック単位で符号化し、符号化された符号を、要求された回転角度及び回転方向に基づいて再配置することによりことにより90度回転又は180度回転された画像の符号データを生成する請求項1記載の画像処理装置。
The rotation code generation means includes
Determine the cutout order of blocks corresponding to the requested rotation angle and direction,
Based on the block position information, the image data encoded in the determined cut-out order is cut out in block line units,
DC component differential value obtained by decoding the code of each block, and the effective coefficient of zero runs and the AC component of the AC component, based on the DC component value of the first block of the block lines, the DC component value of each block And AC component values as conversion coefficients ,
According to the requested rotation angle and rotation direction, the conversion coefficient after the rotation process is calculated by converting at least one of the arrangement of the conversion coefficient and the positive / negative sign,
Using the DC component value of the calculated conversion coefficient after rotation processing, the DC component difference value of each target block in the block line is generated based on the DC component value in the immediately preceding block and the DC component value of the target block. By encoding the generated DC component difference value and the AC component value in the conversion coefficient after the rotation process in units of blocks, and rearranging the encoded code based on the requested rotation angle and rotation direction. The image processing apparatus according to claim 1, wherein code data of an image rotated by 90 degrees or 180 degrees is generated.
前記回転符号生成手段は、画像を右に90度回転させるよう要求されている場合には、回転処理の対象である画像における先頭ブロックの副走査方向下方から上方に走査するような走査順序をブロックの切り出し順序として決定し、全てのブロックの符号をバッファリングし、バッファリングされている符号をそのまま出力することにより符号化された符号の再配置を行う請求項2記載の画像処理装置。   When the rotation code generation means is requested to rotate the image 90 degrees to the right, the rotation code generation unit blocks the scanning order so as to scan from the lower side to the upper side in the sub-scanning direction of the first block in the image to be rotated. The image processing apparatus according to claim 2, wherein the encoded code is rearranged by buffering the codes of all blocks and outputting the buffered codes as they are. 前記回転符号生成手段は、画像を左に90度回転させるよう要求されている場合には、回転処理の対象である画像における先頭ブロックの副走査方向上方から下方に走査するような走査順序をブロックの切り出し順序として決定し、全てのブロックの符号をバッファリングし、バッファリングされている符号を、主走査方向のブロックライン単位で、処理順とは逆の順序で出力することにより符号化された符号の再配置を行う請求項2記載の画像処理装置。   When the rotation code generating means is requested to rotate the image 90 degrees to the left, the rotation code generation means blocks the scanning order such that the head block in the image to be rotated is scanned from the upper side to the lower side in the sub-scanning direction. The coding order is determined by buffering all block codes and outputting the buffered codes in block line units in the main scanning direction in the reverse order of the processing order. The image processing apparatus according to claim 2, wherein code rearrangement is performed. 前記回転符号生成手段は、画像を180度回転させるよう要求されている場合には、回転処理の対象である画像における主走査方向のブロックラインのうち、副走査方向最下のブロックラインを主走査方向に走査するような走査順序をブロックの切り出し順序として決定し、1ブロックライン分の符号が揃うまで符号化された符号を先入れ後出し方式でバッファリングし、1ブロックライン分の符号が揃うとバッファリングされている符号をそのまま出力することにより符号化された符号の再配置を行う請求項2記載の画像処理装置。   When the rotation code generation unit is requested to rotate the image by 180 degrees, the main scanning is performed on the block line in the sub-scanning direction among the block lines in the main scanning direction in the image to be rotated. The scanning order for scanning in the direction is determined as the block cut-out order, and the encoded codes are buffered in a first-in last-out manner until the codes for one block line are aligned, and the codes for one block line are aligned. The image processing apparatus according to claim 2, wherein the encoded codes are rearranged by outputting the buffered codes as they are. JPEG方式により符号化された画像データを回転させるコンピュータにおいて、
回転処理の対象である画像の符号データに基づいて、JPEG方式の処理単位となる各ブロックの位置を特定するためのブロック位置情報と、各ブロックに含まれる直流成分値とを生成するステップと、
生成された各ブロックのブロック位置情報および直流成分値のうち、走査方向の各ブロックラインの先頭ブロックのブロック位置情報および直流成分値のみを保持するステップと、
生成された各ブロックのブロック位置情報および直流成分値のうち、先頭ブロック以外の他のブロックのブロック位置情報および直流成分値を消去し、
保持されている先頭ブロックのブロック位置情報および直流成分値に基づいて、前記回転処理の方向および角度に基づいた順序で、符号化された画像データのブロックにアクセスし、前記アクセスしたブロックの符号を直流成分値及び交流成分値に変換し、前記変換された直流成分値及び交流成分値を前記回転処理の方向及び角度に基づいて変換して再符号化し、前記回転処理の方向及び角度に基づいて再配置を行うことにより、90度回転又は180度回転された画像の符号データを生成するステップと
を前記コンピュータに実行させるプログラム。
In a computer that rotates image data encoded by the JPEG method,
Generating block position information for specifying the position of each block, which is a processing unit of the JPEG method, and a DC component value included in each block, based on code data of an image to be rotated;
Of the generated block position information and DC component value of each block, the step of holding only the block position information and DC component value of the head block of each block line in the main scanning direction;
Of the generated block position information and DC component value, erase the block position information and DC component value of blocks other than the first block,
Based on the block position information and the DC component value of the held head block, the block of the encoded image data is accessed in the order based on the direction and angle of the rotation process, and the code of the accessed block is Convert to DC component value and AC component value, convert the converted DC component value and AC component value based on the direction and angle of the rotation process, re-encode, and based on the direction and angle of the rotation process Generating the code data of the image rotated by 90 degrees or 180 degrees by performing the rearrangement .
JP2006153234A 2006-06-01 2006-06-01 Image processing apparatus and program Expired - Fee Related JP4666261B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006153234A JP4666261B2 (en) 2006-06-01 2006-06-01 Image processing apparatus and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006153234A JP4666261B2 (en) 2006-06-01 2006-06-01 Image processing apparatus and program

Publications (2)

Publication Number Publication Date
JP2007324973A JP2007324973A (en) 2007-12-13
JP4666261B2 true JP4666261B2 (en) 2011-04-06

Family

ID=38857367

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006153234A Expired - Fee Related JP4666261B2 (en) 2006-06-01 2006-06-01 Image processing apparatus and program

Country Status (1)

Country Link
JP (1) JP4666261B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8977064B2 (en) 2008-02-13 2015-03-10 Qualcomm Incorporated Rotational transcoding for JPEG or other coding standards
US20100254617A1 (en) * 2009-04-01 2010-10-07 Qualcomm Incorporated Apparatus and method to rotate an image
JP5247793B2 (en) * 2010-12-21 2013-07-24 キヤノン株式会社 Image processing apparatus, image processing method, and program
JP6354532B2 (en) * 2014-11-12 2018-07-11 ブラザー工業株式会社 Compression device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08204957A (en) * 1995-01-26 1996-08-09 Dainippon Screen Mfg Co Ltd Image processing method
JP2006101016A (en) * 2004-09-28 2006-04-13 Seiko Epson Corp Image processing apparatus, printer equipped therewith and method of controlling the same

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08204957A (en) * 1995-01-26 1996-08-09 Dainippon Screen Mfg Co Ltd Image processing method
JP2006101016A (en) * 2004-09-28 2006-04-13 Seiko Epson Corp Image processing apparatus, printer equipped therewith and method of controlling the same

Also Published As

Publication number Publication date
JP2007324973A (en) 2007-12-13

Similar Documents

Publication Publication Date Title
JP3778087B2 (en) Data encoding apparatus and data decoding apparatus
JP2008113374A (en) Entropy coding apparatus
JP2011071767A (en) Image processing apparatus and processing method therefor
US11838035B2 (en) Using predicates in conditional transcoder for column store
JP4785706B2 (en) Decoding device and decoding method
JP4666261B2 (en) Image processing apparatus and program
US20040071351A1 (en) Method and system for graphics compression and display
US7373000B2 (en) Image processing apparatus
JP2003189109A (en) Image processor and image processing method, and computer program
JP5083170B2 (en) An encoding device, a decoding device, an image forming device, and a program.
JP2002229759A (en) Code converting method for supporting image conversion
JP4831349B2 (en) Image processing apparatus, image forming apparatus, image forming system, and program
JP3266419B2 (en) Data compression / decompression method
JPH0779415B2 (en) Decompression method of compressed data
JP3520166B2 (en) Image processing device
US20040090441A1 (en) Method and device for translating two-dimensional data of a discrete wavelet transform system
US20020027558A1 (en) Data transfer apparatus and method
JP2008109195A (en) Image processor
JP4526069B2 (en) Image information arithmetic coding apparatus and image information arithmetic decoding apparatus
JP5263717B2 (en) Image processing apparatus, image processing system, and program
JP3321226B2 (en) Encoding / decoding method
JP2005223538A (en) Image processor circuit
JP2008118533A (en) Decoder, method and program
JPH1093967A (en) Picture compression method/device
JPH06152988A (en) Decoder for variable length encoding

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090210

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20100701

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100803

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100930

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20101021

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20101130

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20101217

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20101230

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

Free format text: PAYMENT UNTIL: 20140121

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees