JP2018067758A - Image encoding device and control method thereof - Google Patents

Image encoding device and control method thereof Download PDF

Info

Publication number
JP2018067758A
JP2018067758A JP2016203813A JP2016203813A JP2018067758A JP 2018067758 A JP2018067758 A JP 2018067758A JP 2016203813 A JP2016203813 A JP 2016203813A JP 2016203813 A JP2016203813 A JP 2016203813A JP 2018067758 A JP2018067758 A JP 2018067758A
Authority
JP
Japan
Prior art keywords
image
ldr image
ldr
hdr
auxiliary data
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.)
Granted
Application number
JP2016203813A
Other languages
Japanese (ja)
Other versions
JP2018067758A5 (en
JP6867774B2 (en
Inventor
智恵 菊地
Chie Kikuchi
智恵 菊地
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2016203813A priority Critical patent/JP6867774B2/en
Publication of JP2018067758A publication Critical patent/JP2018067758A/en
Publication of JP2018067758A5 publication Critical patent/JP2018067758A5/ja
Application granted granted Critical
Publication of JP6867774B2 publication Critical patent/JP6867774B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To adaptively switch whether or not to use a thing obtained by local decoding as a LDR image to be used in creating auxiliary data for returning accuracy of the LDR image to the accuracy of a HDR image when the HDR image is encoded.SOLUTION: An image encoding device that encodes a HDR image and that creates auxiliary data for returning accuracy of a LDR image to the accuracy of the HDR image comprises: a LDR image creation unit that creates the LDR image from the encoding target HDR image; an encoding unit that irreversibly encodes the created LDR image; a decoding unit that decodes the encoded LDR image; an auxiliary data creation unit that creates the auxiliary data for returning the accuracy of the LDR image to the accuracy of the HDR image on the basis of the HDR image and the LDR image; and a determination unit that determines which of the LDR image created by the LDR image creation unit or the LDR image obtained using the decoding by the decoding unit is used as the LDR image used by the auxiliary data creation unit.SELECTED DRAWING: Figure 2

Description

本発明は画像符号化技術、特に、高ダイナミックレンジ(High Dynamic Range;HDR)を持つデジタル画像(以下、HDR画像)の符号化技術に関するものである。   The present invention relates to an image encoding technique, and more particularly to an encoding technique for a digital image (hereinafter, HDR image) having a high dynamic range (HDR).

静止画像の流通のためのデータ形式の代表的なものにJPEGがある。JPEGは、デジタルカメラの出力ファイルのデータ形式として利用されていることもあって、それを利用したソフトウェアは、ウェブブラウザを始め、多数存在する。JPEG圧縮の対象となる静止画像は、1コンポーネント当り8ビット(256階調)の画像データである。   A representative data format for the distribution of still images is JPEG. JPEG is sometimes used as a data format of an output file of a digital camera, and there are many softwares that use it, including web browsers. A still image to be subjected to JPEG compression is 8-bit (256 gradation) image data per component.

一方、人間の視覚は1:10000までのコントラスト比を認識できるため、従来のJPEG画像の階調表現では実際の見た目と大きな差ができる。そこで、1コンポーネント当り8ビットを超えるビット数(例えば32ビット)で表されるHDR画像が注目されている。最近のデジタルカメラやスマートフォンでもHDRモードを搭載したものが一般的になっている。また、簡単にコンポーネント当り32ビットのデータを持つHDR画像を作成できるソフトウェアアプリケーションも増えてきている。   On the other hand, since human vision can recognize a contrast ratio of up to 1: 10000, the gradation expression of the conventional JPEG image can make a great difference from the actual appearance. Accordingly, attention has been paid to an HDR image represented by a bit number exceeding 8 bits per component (for example, 32 bits). Even recent digital cameras and smartphones are generally equipped with an HDR mode. Software applications that can easily create HDR images having 32-bit data per component are also increasing.

1コンポーネント当り32ビットのデータを持つHDR画像を、従来のJPEGビューアで見ることができる技術が、ISO/IEC 18477−2(JPEG XT Part 2)で規定されている。また、特許文献1にも同様の技術が開示されている。HDR画像を8[ビット/コンポーネント]の、より小さいダイナミックレンジ画像(Low Dynamic Range:LDR画像)にトーンマッピングし、JPEG圧縮する。そして、原画であるHDR画像とLDR画像の比率を別途HDR補助データとして作成し、HDR補助データとLDR画像のJPEG符号データを、1つのファイルに保存するという方法である。HDR補助データを保存する場所は、JPEGのアプリケーションマーカ(APP11)内である。一般的なJPEGビューアは、サポートしないAPPマーカを無視してデコードする。そのため、たとえば、APP11を、HDR補助データを保存しているマーカとして認識できないJPEGビューアがHDR補助データをもつJPEGファイルを受け取ると、LDR画像のみをデコードし表示する。一方、APP11にHDR補助データが保存されていることを認識できるHDR画像ビューアは、LDR画像とAPP11マーカ内のHDR補助データを組み合わせて、元のHDR画像をデコードし表示できる、という仕組みである。   ISO / IEC 18477-2 (JPEG XT Part 2) stipulates a technique capable of viewing an HDR image having 32-bit data per component with a conventional JPEG viewer. Patent Document 1 also discloses a similar technique. The HDR image is tone-mapped to a smaller dynamic range image (Low Dynamic Range: LDR image) of 8 [bit / component], and JPEG compression is performed. Then, the ratio of the original HDR image and LDR image is separately created as HDR auxiliary data, and the HDR auxiliary data and the JPEG code data of the LDR image are saved in one file. The place where the HDR auxiliary data is stored is in the JPEG application marker (APP11). A general JPEG viewer ignores unsupported APP markers and decodes them. Therefore, for example, when a JPEG viewer that cannot recognize APP11 as a marker storing HDR auxiliary data receives a JPEG file having HDR auxiliary data, only the LDR image is decoded and displayed. On the other hand, the HDR image viewer capable of recognizing that the HDR auxiliary data is stored in the APP 11 can decode and display the original HDR image by combining the LDR image and the HDR auxiliary data in the APP 11 marker.

特許第05086067号公報Japanese Patent No. 05086067

ここで、HDR補助データの作成方法について考察する。まず、ISO/IEC 18477−2に準拠したHDR画像の符号化処理について、図1Aを参照して説明する。なお、それぞれの処理については、ISO/IEC 18477−2に記載されているため、詳細な説明は割愛し、ここでは簡単な説明にとどめる。   Here, a method of creating HDR auxiliary data will be considered. First, an HDR image encoding process compliant with ISO / IEC 18477-2 will be described with reference to FIG. 1A. Since each process is described in ISO / IEC 18477-2, detailed description is omitted and only a brief description is given here.

まず、LDR画像のJPEG符号データの作成までを説明する。入力としてHDR画像101が与えられると、HDR画像101はトーンマッピング部102により、1コンポーネントあたり0−255の256階調の線形色空間のLDR画像に変換される。色変換部112は、線形色空間の線形LDR画像を、sRGB色空間に変換する。そして、sRGB空間の画像データは、RGB/YCC変換部113およびサブサンプリング部114による処理を経て、JPEG圧縮部115に供給され、JPEG符号化される。   First, the process up to creation of JPEG code data of an LDR image will be described. When the HDR image 101 is given as an input, the HDR image 101 is converted by the tone mapping unit 102 into an LDR image in a linear color space of 256 gradations of 0 to 255 per component. The color conversion unit 112 converts the linear LDR image in the linear color space into the sRGB color space. The image data in the sRGB space is processed by the RGB / YCC conversion unit 113 and the sub-sampling unit 114, supplied to the JPEG compression unit 115, and JPEG-encoded.

次に、HDR補助データの作成の手順を説明する。Y算出部103は、HDR画像101から輝度成分(Y成分)を算出する。一方、Y算出部105も、トーンマッピング102で作成された線形LDR画像からも輝度成分(Y成分)が算出する。ノイズ付加部106は、Y算出部105で算出された各輝度成分にノイズを加算する。そして、Yratio算出部107は、HDRのY成分をノイズが付加されたLDRのY成分で割る(除算)ことで、輝度成分の比率(Yratio)を算出する。Yratioマッピング部108は、算出されたYratioを、0−255の範囲にマッピングし、HDR補助データのY成分として、JPEG圧縮部109に供給する。さらに、Yratio算出部107は、算出したYratioをRGBスケール変換部104に供給する。RGBスケール変換部104は、HDR画像のRGBの各色成分を、Yratioを用いてスケール変換する。差分取得部110は、スケール変換されたHDR画像のRGB値と、トーンマッピング102から出力される線形LDR画像のRGB値との差分値を取得する。色差算出111は、この差分値によってHDR補助データの色差成分を算出し、JPEG圧縮部109に供給する。JPEG圧縮部109は、Yratioマッピング部108から入力された輝度成分と、色差算出111から入力される色差成分とを使って、HDR補助データのJPEG符号データを作成する。   Next, a procedure for creating HDR auxiliary data will be described. The Y calculation unit 103 calculates a luminance component (Y component) from the HDR image 101. On the other hand, the Y calculation unit 105 also calculates a luminance component (Y component) from the linear LDR image created by the tone mapping 102. The noise adding unit 106 adds noise to each luminance component calculated by the Y calculating unit 105. Then, the Yratio calculating unit 107 calculates the luminance component ratio (Yratio) by dividing (dividing) the HDR Y component by the LDR Y component to which noise is added. The Yratio mapping unit 108 maps the calculated Yratio to the range 0 to 255 and supplies it to the JPEG compression unit 109 as the Y component of the HDR auxiliary data. Further, the Yratio calculation unit 107 supplies the calculated Yratio to the RGB scale conversion unit 104. The RGB scale conversion unit 104 converts the RGB color components of the HDR image using Yratio. The difference acquisition unit 110 acquires a difference value between the RGB value of the scale-converted HDR image and the RGB value of the linear LDR image output from the tone mapping 102. The color difference calculation 111 calculates the color difference component of the HDR auxiliary data based on the difference value, and supplies it to the JPEG compression unit 109. The JPEG compression unit 109 creates JPEG code data of the HDR auxiliary data using the luminance component input from the Yratio mapping unit 108 and the color difference component input from the color difference calculation 111.

以上より、LDRのJPEG符号データと、HDR補助データのJPEG符号データが生成される。出力部116は、両符号データとLDR画像からHDR画像へ伸長するための必要な情報と共に、1つのJPEGファイルを作成し、JPEG XTデータ117として出力する。   As described above, JPEG code data for LDR and JPEG code data for HDR auxiliary data are generated. The output unit 116 creates one JPEG file together with both code data and information necessary for decompression from the LDR image to the HDR image, and outputs it as JPEG XT data 117.

以上がISO/IEC 18477−2の方法によるHDR画像を符号化処理である。HDR補助データ作成時に使用されるLDR画像は、トーンマッピング部102から得られたデータである。しかし、最終的に、JPEG XTデータ117として出力されるLDR画像は、非可逆圧縮であるJPEG圧縮部115から出力されるものであって、劣化後のデータである。従って、JPEG XTデータ117を受信して、復号して得られるHDR画像に対しては、高い精度が期待できない。   The above is encoding processing of an HDR image by the method of ISO / IEC 18477-2. The LDR image used when creating the HDR auxiliary data is data obtained from the tone mapping unit 102. However, the LDR image that is finally output as the JPEG XT data 117 is output from the JPEG compression unit 115 that is irreversible compression, and is data after deterioration. Therefore, high accuracy cannot be expected for an HDR image obtained by receiving and decoding JPEG XT data 117.

このような問題に対して、特許文献1は、JPEG圧縮部115で符号化されたLDR画像を一度復号して得られるLDR画像を、HDR補助データ作成のために使用する方法を開示している。図1Bが、特許文献1に開示された構成である。図1Aと同様の構成については同符号を付し、その説明は省略する。図1Aとの違いは、LDR画像のJPEG圧縮部115の結果を、JPEG復号部119によって復号する。そして、復号されたLDR画像が色変換部118により線形色空間のLDR画像に変換され、その結果がY算出部105と差分取得部110へ供給されている。   For such a problem, Patent Document 1 discloses a method of using an LDR image obtained by once decoding an LDR image encoded by the JPEG compression unit 115 for creating HDR auxiliary data. . FIG. 1B shows the configuration disclosed in Patent Document 1. The same components as those in FIG. 1A are denoted by the same reference numerals, and the description thereof is omitted. The difference from FIG. 1A is that the result of the JPEG compression unit 115 of the LDR image is decoded by the JPEG decoding unit 119. The decoded LDR image is converted into an LDR image in a linear color space by the color conversion unit 118, and the result is supplied to the Y calculation unit 105 and the difference acquisition unit 110.

このように、HDR画像の符号化側で、JPEG圧縮されたLDR画像をJPEG復号部119によってローカルデコードすることで、HDR補助データ作成時のLDR画像と、HDR復号時に使用するLDR画像の差異が解消される。したがって、JPEG XTデータの受信側(符号化HDR画像の復号装置)では、より正確なHDR画像を復号することができる。   In this way, on the HDR image encoding side, a JPEG-compressed LDR image is locally decoded by the JPEG decoding unit 119, so that the difference between the LDR image at the time of HDR auxiliary data creation and the LDR image used at the time of HDR decoding can be reduced. It will be resolved. Therefore, a more accurate HDR image can be decoded on the JPEG XT data reception side (decoded device for encoded HDR image).

しかし、このように毎回ローカルデコードすることは、HDR画像ファイル作成時の処理負荷を増大させるという問題が生じる。特に、デジタルカメラやスマートフォンなどのモバイル機器においてHDR画像を合成・圧縮するようなユースケースを考えた場合、処理負荷の軽減と高画質なHDR画像ファイルの生成の両立が大きな問題となる。   However, local decoding in this way causes a problem of increasing the processing load when creating an HDR image file. In particular, when considering a use case of synthesizing and compressing an HDR image in a mobile device such as a digital camera or a smartphone, it is a big problem to reduce the processing load and generate a high-quality HDR image file.

本発明は上記に鑑みてなされたものであり、符号化処理の負荷と、復号されるHDR画像の画質とのバランスを考慮し、より効率的にHDR画像を符号化する技術を提供しようとするものである。   The present invention has been made in view of the above, and intends to provide a technique for more efficiently encoding an HDR image in consideration of the balance between the load of encoding processing and the image quality of the decoded HDR image. Is.

この課題を解決するため、例えば本発明の画像符号化装置は以下の構成を備える。すなわち、
HDR画像を符号化し、LDR画像をHDR画像の精度に戻すための補助データを生成する画像符号化装置であって、
符号化対象のHDR画像からLDR画像を生成するLDR画像生成手段と、
生成したLDR画像を非可逆符号化する符号化手段と、
符号化したLDR画像を復号する復号手段と、
HDR画像とLDR画像に基づき、LDR画像をHDR画像の精度に戻すための補助データを生成する補助データ生成手段と、
前記補助データ生成手段が利用するLDR画像として、前記LDR画像生成手段が生成したLDR画像、前記復号手段による復号で得たLDR画像のいずれを用いるかを判定する判定手段とを有する。
In order to solve this problem, for example, an image encoding device of the present invention has the following configuration. That is,
An image encoding device for generating auxiliary data for encoding an HDR image and returning an LDR image to the accuracy of the HDR image,
LDR image generation means for generating an LDR image from an HDR image to be encoded;
Encoding means for irreversibly encoding the generated LDR image;
Decoding means for decoding the encoded LDR image;
Auxiliary data generating means for generating auxiliary data for returning the LDR image to the accuracy of the HDR image based on the HDR image and the LDR image;
The LDR image used by the auxiliary data generation unit includes a determination unit that determines which one of the LDR image generated by the LDR image generation unit and the LDR image obtained by decoding by the decoding unit is used.

本発明によれば、HDR画像を符号化する際の、LDR画像をHDR画像の精度に戻すための補助データを作成する際に利用するLDR画像として、ローカルデコードで得たものを利用するか否かを適応的に切り換える。この結果、符号化にかかる処理負荷と画質のいずれにも対応させることが可能となる。   According to the present invention, whether or not to use an LDR image obtained by local decoding as an LDR image used when creating auxiliary data for returning the LDR image to the HDR image accuracy when encoding the HDR image is used. Switch adaptively. As a result, it is possible to cope with both the processing load and the image quality related to encoding.

HDR画像符号化処理のブロック図。The block diagram of a HDR image encoding process. HDR画像符号化処理のブロック図。The block diagram of a HDR image encoding process. 第1の実施形態におけるHDR画像符号化装置のブロック図。The block diagram of the HDR image coding apparatus in 1st Embodiment. 第1の実施形態におけるHDR画像の圧縮フローを示す図。The figure which shows the compression flow of the HDR image in 1st Embodiment. 第1の実施形態における線形LDR画像の作成フローを示す図。The figure which shows the creation flow of the linear LDR image in 1st Embodiment. 第1の実施形態におけるHDR補助データの作成フローを示す図。The figure which shows the creation flow of HDR auxiliary data in 1st Embodiment. 第1の実施形態におけるトーンカーブを示す図。The figure which shows the tone curve in 1st Embodiment. 第1の実施形態の変形例におけるHDR画像の圧縮フローを示す図。The figure which shows the compression flow of the HDR image in the modification of 1st Embodiment. 第1の実施形態の変形例におけるマクロブロック単位のLDR画像圧縮フローを示す図。The figure which shows the LDR image compression flow of the macroblock unit in the modification of 1st Embodiment. 第1の実施形態の変形例におけるマクロブロック単位の線形LDR画像の作成フローを示す図。The figure which shows the creation flow of the linear LDR image of the macroblock unit in the modification of 1st Embodiment. 第2の実施形態におけるHDR画像の圧縮フローを示す図。The figure which shows the compression flow of the HDR image in 2nd Embodiment. 第3の実施形態におけるHDR画像の圧縮フローを示す図。The figure which shows the compression flow of the HDR image in 3rd Embodiment. 第3の実施形態の変形例におけるHDR画像の圧縮フローを示す図。The figure which shows the compression flow of the HDR image in the modification of 3rd Embodiment. 第3の実施形態の変形例におけるマクロブロック単位のLDR画像圧縮フローを示す図。The figure which shows the LDR image compression flow of the macroblock unit in the modification of 3rd Embodiment. 第4の実施形態におけるHDR画像の圧縮フローを示す図。The figure which shows the compression flow of the HDR image in 4th Embodiment. 第4の実施形態の変形例におけるHDR画像の圧縮フローを示す図。The figure which shows the compression flow of the HDR image in the modification of 4th Embodiment. 第5の実施形態におけるマクロブロック単位のLDR画像圧縮フローを示す図。The figure which shows the LDR image compression flow of the macroblock unit in 5th Embodiment. 第5の実施形態の変形例におけるDCT係数の比較範囲を示す図。The figure which shows the comparison range of the DCT coefficient in the modification of 5th Embodiment. 第5の実施形態の変形例におけるマクロブロック単位のLDR画像圧縮フローを示す図。The figure which shows the LDR image compression flow of the macroblock unit in the modification of 5th Embodiment.

以下、添付図面に従って本発明に係る実施形態を詳細に説明する。なお、実施形態では、説明を容易にするため、符号化対象のHDR画像データは1920×1080画素のRGBカラーデータとし、各コンポーネント(色)は16ビットの整数値で表されるものとして説明する。但し、RGB以外のコンポーネントの構成(例えばグレー単色やYMC等)でも構わず、色空間の種類,コンポーネントの個数は問わない。また、1成分のビット数も16ビットに限らず、12ビットや32ビットなど、8ビットを超えるビット数であれば、ビット数に特に制限はない。また、整数値だけに限定されず、32ビットの実数値などでもよい。つまり、HDRのコントラスト比を表現できれば、入力画像の形式はどのようなものでもよい。上記の数値は、あくまで、理解を容易にする具体例を示すものと理解されたい。   Hereinafter, embodiments according to the present invention will be described in detail with reference to the accompanying drawings. In the embodiment, for ease of explanation, it is assumed that the HDR image data to be encoded is 1920 × 1080 pixel RGB color data, and each component (color) is represented by a 16-bit integer value. . However, the configuration of components other than RGB (for example, gray single color or YMC) may be used, and the type of color space and the number of components are not limited. The number of bits of one component is not limited to 16 bits, and the number of bits is not particularly limited as long as the number of bits exceeds 8 bits, such as 12 bits or 32 bits. Further, the value is not limited to an integer value, and may be a 32-bit real value. In other words, any format of the input image may be used as long as the HDR contrast ratio can be expressed. It should be understood that the above numerical values are only specific examples that facilitate understanding.

[第1の実施形態]
図2は、本実施形態におけるHDR画像の画像符号化装置のブロック図である。同図で、201はCPUであり、各構成の処理の全てに関わる。202は入力部であり、ユーザからの指示や、符号化対象のHDR画像データなどを入力する部分である。これは、キーボードやマウスなどのポインティングシステムを含む。符号化対象のHDR画像データの発生源は撮像装置とするが、入力部202にその撮像装置が接続されても良いし、符号化対象のHDR画像データを格納した記憶媒体が入力部202に接続されても構わない。場合によっては、HDR画像データを保持するサーバがネットワーク上に存在し、入力部202はそのサーバからダウンロードしても構わない。203はHDR補助データ生成部、204はLDR画像生成部である。205はJPEGコーデック部(非可逆符号化部)であり、1コンポーネント当り8bitの非圧縮画像データをJPEG符号データに変換したり、JPEG符号データを復号し非圧縮画像データに変換する。206はメモリであり、ROMやRAMを含み、処理に必要なプログラム、データ、作業領域などをCPU201に提供する。207は表示部であり、通常は液晶ディスプレイなどが用いられる。208は蓄積部であり、画像データ、プログラムなどを蓄積する部分で、通常はハードディスクなどが用いられる。また、以降のフローチャートの処理に必要な制御プログラムは、蓄積部208に格納されているか、メモリ206のROMに格納されているものとする。蓄積部208に格納されている場合は、一旦メモリ206内のRAMに読み込まれてから実行される。なお、システム構成については、上記以外にも様々な構成要素が存在するが、本実施形態の主眼ではないので、その説明は省略する。
[First Embodiment]
FIG. 2 is a block diagram of an HDR image coding apparatus according to the present embodiment. In the figure, reference numeral 201 denotes a CPU, which is involved in all processing of each configuration. Reference numeral 202 denotes an input unit that inputs an instruction from a user, HDR image data to be encoded, and the like. This includes pointing systems such as keyboards and mice. The generation source of the HDR image data to be encoded is an imaging device, but the imaging device may be connected to the input unit 202, or a storage medium storing the HDR image data to be encoded is connected to the input unit 202. It does not matter. In some cases, a server that holds HDR image data exists on the network, and the input unit 202 may download from the server. Reference numeral 203 denotes an HDR auxiliary data generation unit, and 204 denotes an LDR image generation unit. Reference numeral 205 denotes a JPEG codec unit (lossy encoding unit) that converts 8-bit non-compressed image data per component into JPEG code data, or decodes JPEG code data and converts it into uncompressed image data. A memory 206 includes a ROM and a RAM and provides the CPU 201 with programs, data, work areas, and the like necessary for processing. Reference numeral 207 denotes a display unit, which typically uses a liquid crystal display or the like. An accumulation unit 208 accumulates image data, programs, and the like. Usually, a hard disk or the like is used. Further, it is assumed that a control program necessary for the processing of the subsequent flowcharts is stored in the storage unit 208 or stored in the ROM of the memory 206. If the data is stored in the storage unit 208, the data is once read into the RAM in the memory 206 and then executed. In addition to the above, there are various components of the system configuration, but since it is not the main point of the present embodiment, the description thereof is omitted.

本実施形態におけるHDR補助データの生成方法は、ISO/IEC 18477−2で規定されている方法を基本とする。すなわち、HDR画像データとLDR画像データの輝度成分比(Yレシオ;Yratio)を利用する方法である。Yレシオを使って、LDR画像データをHDRのレンジに戻して、オリジナルのHDR画像データとの色差成分の差分を生成する。そして、Yレシオと色差成分を8ビット化してJPEG符号化する方法である。   The method for generating HDR auxiliary data in the present embodiment is based on the method defined in ISO / IEC 18477-2. In other words, this is a method that uses the luminance component ratio (Y ratio) between HDR image data and LDR image data. Using the Y ratio, the LDR image data is returned to the HDR range, and a difference of the color difference component from the original HDR image data is generated. Then, the Y ratio and the color difference component are converted into 8 bits and JPEG encoded.

符号化装置に入力されたHDR画像データをLDR画像とHDR補助データに分けて、圧縮する方法について図3を用いて説明する。なお、ISO/IEC 18477−2で規定されている処理と同様の部分については、ここでの詳しい説明は割愛する。   A method of compressing the HDR image data input to the encoding apparatus by dividing it into an LDR image and HDR auxiliary data will be described with reference to FIG. In addition, detailed description here is abbreviate | omitted about the part similar to the process prescribed | regulated by ISO / IEC 18477-2.

ステップS301にて、CPU201は、入力部202を介して符号化対象のHDR画像データを入力し、メモリ206に格納する。ステップS302にて、CPU201は、LDR画像生成部204を制御し、入力したHDR画像データに対してトーンマッピング処理を行わせる。LDR画像生成部204は生成した線形LDR画像データを、メモリ206に保存する。また、LDR画像生成部204は、線形LDR画像を作成する際に、低輝度の画素数をカウントし、保持するものとする。この低輝度画素数のカウント処理の詳細は後述する。   In step S <b> 301, the CPU 201 inputs the HDR image data to be encoded via the input unit 202 and stores it in the memory 206. In step S302, the CPU 201 controls the LDR image generation unit 204 to perform tone mapping processing on the input HDR image data. The LDR image generation unit 204 stores the generated linear LDR image data in the memory 206. The LDR image generation unit 204 counts and holds the number of low-luminance pixels when creating a linear LDR image. Details of the low luminance pixel count process will be described later.

ステップS303にて、CPU201は、上記で得た低輝度画素数から、低輝度画素数の割合RLPを算出する。すなわち、画像全体の低輝度画素数をC、入力されたHDR画像の幅がw画素、高さがh画素とすると、RLP=C/(w×h)として算出できる(実施形態では、w=1920、h=1080)。   In step S303, the CPU 201 calculates the ratio RLP of the number of low luminance pixels from the number of low luminance pixels obtained above. That is, if the number of low-luminance pixels of the entire image is C, the width of the input HDR image is w pixels, and the height is h pixels, RLP = C / (w × h) can be calculated (in the embodiment, w = 1920, h = 1080).

ステップS304にて、CPU201は、算出して得られたRLPと、予め決められた閾値Th_RLPを比較する。RLPが閾値Th_RLPより大きければステップS305へ処理を進め、そうでなければステップS313へ処理を進める。実施形態では、閾値Th_RLPは“0.5”とする。すなわち、低輝度画素が画像全体の半分以上を占める場合には、符号化対象のHDR画像は低輝度画素の割合が大きい画像として判断し、ステップS305へ進む。ステップS305およびステップS313では、HDR補助データ作成時にローカルデコードしたLDR画像を使用するかどうかを示す情報を、メモリ206に予め確保したフラグFlagに設定する。具体的には、ステップS305にて、CPU201は、HDR補助データ作成時にローカルデコードしたLDR画像を使用することを示す値“1”をフラグFlagに設定する。ステップS313にて、CPU201は、ステップS302で作成した線形LDR画像を用いてHDR補助データを作成することを示す値“0”をフラグFlagに設定する。従って、S313に進んだ場合、LDR画像のローカルデコードは行わないことになる。   In step S304, the CPU 201 compares the calculated RLP with a predetermined threshold Th_RLP. If RLP is larger than threshold Th_RLP, the process proceeds to step S305; otherwise, the process proceeds to step S313. In the embodiment, the threshold Th_RLP is set to “0.5”. That is, when the low luminance pixels occupy more than half of the entire image, the HDR image to be encoded is determined as an image having a large proportion of low luminance pixels, and the process proceeds to step S305. In steps S305 and S313, information indicating whether or not to use the locally decoded LDR image when creating the HDR auxiliary data is set in a flag Flag reserved in the memory 206 in advance. Specifically, in step S305, the CPU 201 sets, to the flag Flag, a value “1” indicating that the locally decoded LDR image is used when creating the HDR auxiliary data. In step S313, the CPU 201 sets, to the flag Flag, a value “0” indicating that HDR auxiliary data is to be created using the linear LDR image created in step S302. Therefore, when the process proceeds to S313, local decoding of the LDR image is not performed.

次に、LDR画像をローカルデコードする場合のステップS305以降の処理を説明する。ステップS305にて、CPU201はフラグFlagを“1”に設定すると、処理をステップS306に進める。ステップS306にて、CPU201は、LDR画像の符号化条件として、サブサンプリング情報および量子化ステップに関する情報を取得する。次に、ステップS307にて、CPU201は線形LDR画像の色変換を行う。すなわち、CPU201は、線形色空間のLDR画像にガンマ処理を施し、sRGB色空間の画像データに変換し、その後、RGB/YCC変換を行う。また、CPU201は、ステップS306において取得した情報によって、サブサンプリングが必要な場合は、色差成分Cb,Crのサブサンプリングを行う。これらの処理については、一般的な処理であり、ISO/IEC 18477−2にも記載されているので、ここでの詳細な説明は割愛する。ステップS308にて、CPU201は、JPEGコーデック部205を制御し、ステップS307で得られたLDR画像のYCCデータをマクロブロックに分割させ、DCT変換及び量子化処理を行わせる。これらの処理についても一般的な処理であるため、ここでの詳細な説明を割愛する。ステップS309にて、CPU201は、JPEGコーデック部205を制御し、量子化されたDCT係数を、JPEG(ISO/IEC10918)に規定された方法でエントロピー符号化する。JPEGコーデック部205は、生成した符号化データを、一旦、メモリ206に格納する。   Next, the processing after step S305 when the LDR image is locally decoded will be described. In step S305, when the CPU 201 sets the flag Flag to “1”, the process proceeds to step S306. In step S306, the CPU 201 acquires sub-sampling information and information related to the quantization step as an LDR image encoding condition. Next, in step S307, the CPU 201 performs color conversion of the linear LDR image. That is, the CPU 201 performs gamma processing on the LDR image in the linear color space, converts it into image data in the sRGB color space, and then performs RGB / YCC conversion. Further, the CPU 201 performs sub-sampling of the color difference components Cb and Cr when sub-sampling is necessary according to the information acquired in step S306. Since these processes are general processes and are described in ISO / IEC 18477-2, detailed description thereof is omitted here. In step S308, the CPU 201 controls the JPEG codec unit 205, divides the YCC data of the LDR image obtained in step S307 into macroblocks, and performs DCT conversion and quantization processing. Since these processes are also general processes, a detailed description thereof is omitted here. In step S309, the CPU 201 controls the JPEG codec unit 205 to entropy-encode the quantized DCT coefficient using a method defined in JPEG (ISO / IEC 10918). The JPEG codec unit 205 temporarily stores the generated encoded data in the memory 206.

次に、ステップS310にて、CPU201は、フラグFlagの値が“1”であるかどうかを判定する。すなわち、ステップS304でローカルデコードしたLDR画像を使用すると判定された場合、Flagの値が1であるので、CPU201は処理をステップS311に進める。また、Flagの値が0である場合には、CPU201はステップS317に処理を進める。ここでの説明では、ステップS305を経ているので、ステップS311に処理が進むものとして説明する。   Next, in step S310, the CPU 201 determines whether or not the value of the flag Flag is “1”. That is, if it is determined in step S304 that the LDR image that has been locally decoded is used, the value of Flag is 1, so the CPU 201 advances the process to step S311. If the Flag value is 0, the CPU 201 advances the process to step S317. In this description, since step S305 has been performed, the processing proceeds to step S311.

ステップS311にて、CPU201は、JPEGコーデック部206を制御し、ステップS308で得られた量子化後のDCT係数を逆量子化、逆DCTすることで、ローカルデコード後のLDR画像のYCCデータを取得する。なお、ローカルデコードでは、符号化データから開始してしても良いが、JPEGでのエントロピー(ハフマン符号化)そのものは可逆であるので、途中の量子化後の係数からローカルデコードを行っている。本処理についても、DCT/量子化と同様に詳細な説明は割愛する。ステップS312にて、CPU201は、ステップS311で取得したYCCデータに逆色変換をし、線形LDR画像を生成し、メモリ206に保存し、処理をステップS314に進める。すなわち、CPU201は、YCC/RGB変換によってローカルデコードしたRGB画像データを取得し、さらに、逆ガンマ処理を行うことで、ローカルデコードした線形RGB画像データを取得する。なお、メモリ206には、既にステップS302で作成した線形LDR画像が保存されているが、そのデータをローカルデコードした結果で上書きすることになる。ステップS314にて、CPU201は、HDR補助データ生成部203を制御し、ステップS312で得られたローカルデコードの線形RGB画像を入力として、LDRからHDRの精度(8ビットから16ビット)に戻すためのHDR補助データを作成させる。この処理の詳細は、図5を用いて後述する。次に、ステップS315にて、CPU201は、ステップS314で作成したHDR補助データを、ISO/IEC 18477−2記載の方法で出力する。そして、ステップS316にて、フラグFlagが“1”(ローカルデコードを行うことを示している)であるかどうかを判定する。フラグFlagの値が“1”であれば、既にLDR画像のJPEG符号データがメモリ206に作成されているものと判断し、CPU201は処理をステップS317に進める。また、フラグFlagの値が“0”であれば、処理をステップS306に進め、LDR画像のJPEG符号データの作成処理に進む。ステップS317にて、CPU201は、LDR画像の符号化データを、ISO/IEC 18477−1記載の方法で出力し、このフローを終了する。   In step S311, the CPU 201 controls the JPEG codec unit 206, and obtains YCC data of the LDR image after local decoding by performing inverse quantization and inverse DCT on the quantized DCT coefficient obtained in step S308. To do. In local decoding, although it may start from encoded data, since entropy (Huffman encoding) itself in JPEG is reversible, local decoding is performed from a coefficient after quantization in the middle. A detailed description of this process is omitted as in the case of DCT / quantization. In step S312, the CPU 201 performs reverse color conversion on the YCC data acquired in step S311 to generate a linear LDR image, stores it in the memory 206, and advances the processing to step S314. That is, the CPU 201 acquires RGB image data that has been locally decoded by YCC / RGB conversion, and further acquires linear RGB image data that has been locally decoded by performing inverse gamma processing. The memory 206 already stores the linear LDR image created in step S302, but the data is overwritten with the result of local decoding. In step S314, the CPU 201 controls the HDR auxiliary data generation unit 203 to input the local decoded linear RGB image obtained in step S312 and return from LDR to HDR accuracy (8 bits to 16 bits). Create HDR auxiliary data. Details of this processing will be described later with reference to FIG. Next, in step S315, the CPU 201 outputs the HDR auxiliary data created in step S314 by the method described in ISO / IEC 18477-2. In step S316, it is determined whether or not the flag Flag is “1” (indicating that local decoding is to be performed). If the value of the flag Flag is “1”, it is determined that JPEG code data of the LDR image has already been created in the memory 206, and the CPU 201 advances the process to step S317. If the value of the flag Flag is “0”, the process proceeds to step S306 to proceed to a process for creating JPEG code data of an LDR image. In step S317, the CPU 201 outputs encoded data of the LDR image by a method described in ISO / IEC 18477-1, and ends this flow.

次に、ステップS304にて、符号化対象のHDR画像が、低輝度画素の割合が小さい画像として判断された場合を説明する。   Next, a case will be described in which it is determined in step S304 that the HDR image to be encoded is an image with a low ratio of low luminance pixels.

ステップS313にて、CPU201は、フラグFlagに“0”を設定、すなわち、ローカルデコードしないとして設定する。そして、ステップS314、315にて、CPU201は、HDR補助データ生成部203を制御し、ステップS302で得られた線形LDR画像を入力として、HDR補助データを作成、出力させる。次にステップS316にて、CPU201は、フラグFlagの値が“1”であるか否かを判定し、“1”であればステップS317、“0”であればステップS306に処理を進める。ここでの説明では、ステップS313からの説明であるので、処理はステップS306へ進み、CPU201は、LDR画像の符号化処理を行う。ステップS306からステップS309までは、上述の説明と同じである。ステップS310では、再びフラグFlagを参照する。今回は、ステップS313の処理を経ているため、フラグFlagは“0”である。したがって、ローカルデコードをする必要がないため、ステップS317へ進み、LDR画像の符号化データを出力し、このフローを終了する。   In step S313, the CPU 201 sets “0” in the flag Flag, that is, sets not to perform local decoding. In steps S314 and 315, the CPU 201 controls the HDR auxiliary data generation unit 203 to generate and output HDR auxiliary data using the linear LDR image obtained in step S302 as an input. Next, in step S316, the CPU 201 determines whether or not the value of the flag Flag is “1”. If “1”, the process proceeds to step S317, and if “0”, the process proceeds to step S306. Since the description here is from step S313, the process proceeds to step S306, and the CPU 201 performs LDR image encoding processing. Steps S306 to S309 are the same as described above. In step S310, the flag Flag is referred again. Since the process of step S313 is performed this time, the flag Flag is “0”. Accordingly, since there is no need to perform local decoding, the process proceeds to step S317, the encoded data of the LDR image is output, and this flow ends.

次に、ステップS302におけるLDR画像生成部204による線形LDR画像の作成処理を、図4を参照して説明する。   Next, the linear LDR image creation processing by the LDR image generation unit 204 in step S302 will be described with reference to FIG.

ステップS401にて、LDR画像生成部204は、符号化対象のHDR画像データからLDR画像データを生成するためのトーンカーブを取得する。トーンカーブとは、HDR画像を所定のダイナミックレンジに圧縮するトーンマッピング処理に利用する計算式やテーブルである。トーンマッピング処理は、人間の視覚特性や表示デバイス特性を考慮した手法など様々な手法が提案されている。本実施形態では、各色に対して、図6(a)のようなトーンカーブを描く数式を取得するものとする。他にもルックアップテーブルや、図6(a)のトーンカーブ上のサンプリングされた数点の値など、トーンカーブを特定できる情報であれば、どのようなものでも構わない。   In step S401, the LDR image generation unit 204 acquires a tone curve for generating LDR image data from the HDR image data to be encoded. The tone curve is a calculation formula or table used for tone mapping processing for compressing an HDR image to a predetermined dynamic range. Various methods have been proposed for tone mapping processing, including methods that take into account human visual characteristics and display device characteristics. In the present embodiment, for each color, a mathematical expression that draws a tone curve as shown in FIG. 6A is acquired. Any other information can be used as long as the information can specify the tone curve, such as a look-up table or the values of several points sampled on the tone curve shown in FIG.

ステップS402にて、LDR画像生成部204は、画像の幅wと高さhを取得する。本実施形態の場合、幅w=1920[画素]、高さh=1080[画素]である。ステップS403にて、LDR画像生成部204は、低輝度の画素値を数えるためのカウンタCに、ゼロを代入して初期化する。そして、ステップS404にて、LDR画像生成部204は、画像の高さ方向をカウントするための変数yに、ゼロを代入して初期化する。また、ステップS405にて、LDR画像生成部204は、画像の幅方向をカウントするための変数xにゼロを代入して初期化する。なお、本実施形態では、画像の左上隅(0,0)からラスタ順に以下の処理を行う。   In step S402, the LDR image generation unit 204 acquires the width w and height h of the image. In this embodiment, the width w = 1920 [pixel] and the height h = 1080 [pixel]. In step S403, the LDR image generation unit 204 initializes the counter C for counting low luminance pixel values by substituting zero. In step S <b> 404, the LDR image generation unit 204 initializes the variable y for counting the height direction of the image by substituting zero. In step S405, the LDR image generation unit 204 initializes the variable x for counting the width direction of the image by substituting zero. In the present embodiment, the following processing is performed in raster order from the upper left corner (0, 0) of the image.

ステップS406では、LDR画像生成部204は、HDR画像内の(x,y)で表わされる画素位置の画素値PHを取得する。本実施形態では、画素値PHはそれぞれ16ビットのR,G,Bの値で構成される。ステップS407では、ステップS401で取得したトーンカーブを使って、画素値PHをLDR画像の画素値PL(8ビット)にマッピングする。そして、LDR画像生成部204は、メモリ206に確保した、線形LDR画像用の領域内の画素位置(x,y)に、画素値PLを保存する。次に、ステップS408にて、LDR画像生成部204は、画素値PHの値から、画素位置(x,y)の輝度値Y_hdrを算出する。本実施形態では、輝度Y_hdrは8ビットのJPEG圧縮と同様に、ISO/IEC 18477−1で規定された変換式で算出される。ステップS409にて、LDR画像生成部204は、ステップS407で算出したY_hdrと予め決められた輝度の閾値Th_Yとを比較する。輝度値Y_hdrがしきい値Th_Yより小さければステップS410へ、そうでなければステップS411へ進む。本実施形態では、図6に示すように、マッピングしたLDRの画素値が“96”となる値“4550”を閾値Th_Yとする。したがって、輝度値Y_hdrが“4550”よりも小さい値であれば、処理はステップS410に進み、LDR画像生成部204は低輝度画素を数えるカウンタCに“1”を加算する。また、輝度値Y_hdrが4550以上であれば、処理はステップS410の処理は行わず、ステップS411に処理が進む。このステップS411にて、LDR画像生成部204は、画素位置(x,y)に対してトーンマップ処理および低輝度画素の判定が終了したので、画像の水平方向のカウンタxに“1”を加算する。そして、ステップS412にて、画像の横方向のカウンタxが画像幅wと同じ値であるか判定する。同じ値であれば、この画像の右端まで処理したものと判定し、ステップS413へ進む。そうでなければ、まだ右端に到達していないものと判定し、ステップS406へ処理を戻す。ステップS413にて、LDR画像生成部204は、画像の高さ方向の変数yに“1”を加算する。そして、ステップS414にて、LDR画像生成部204は、変数yと画像の高さhを比較し、同じであれば、この画像のすべての画素の処理を終えたものとして、このフローを終了する。異なる場合には、ステップS405に処理を戻して、残りの画素の処理を続ける。   In step S406, the LDR image generation unit 204 acquires the pixel value PH at the pixel position represented by (x, y) in the HDR image. In the present embodiment, each pixel value PH is composed of 16-bit R, G, and B values. In step S407, the pixel value PH is mapped to the pixel value PL (8 bits) of the LDR image using the tone curve acquired in step S401. Then, the LDR image generation unit 204 stores the pixel value PL at the pixel position (x, y) in the area for the linear LDR image secured in the memory 206. Next, in step S408, the LDR image generation unit 204 calculates the luminance value Y_hdr at the pixel position (x, y) from the value of the pixel value PH. In the present embodiment, the luminance Y_hdr is calculated by a conversion formula defined by ISO / IEC 18477-1 as in the case of 8-bit JPEG compression. In step S409, the LDR image generation unit 204 compares Y_hdr calculated in step S407 with a predetermined brightness threshold Th_Y. If the luminance value Y_hdr is smaller than the threshold value Th_Y, the process proceeds to step S410; otherwise, the process proceeds to step S411. In the present embodiment, as shown in FIG. 6, a value “4550” at which the mapped LDR pixel value is “96” is set as the threshold Th_Y. Therefore, if the luminance value Y_hdr is smaller than “4550”, the process proceeds to step S410, and the LDR image generation unit 204 adds “1” to the counter C that counts the low luminance pixels. If the luminance value Y_hdr is 4550 or more, the process proceeds to step S411 without performing the process in step S410. In step S411, the LDR image generation unit 204 completes tone map processing and low-luminance pixel determination for the pixel position (x, y), and thus adds “1” to the horizontal counter x of the image. To do. In step S412, it is determined whether the horizontal counter x of the image has the same value as the image width w. If it is the same value, it is determined that processing has been performed up to the right end of the image, and the process proceeds to step S413. Otherwise, it is determined that the right end has not been reached yet, and the process returns to step S406. In step S413, the LDR image generation unit 204 adds “1” to the variable y in the height direction of the image. In step S414, the LDR image generation unit 204 compares the variable y with the height h of the image. If they are the same, the process is terminated assuming that all the pixels of the image have been processed. . If they are different, the process returns to step S405 to continue the remaining pixels.

以上の処理により、HDR画像と同じ大きさの線形色空間のLDR画像(線形LDR画像)と、HDR画像の輝度成分Y_hdr、および低輝度画素数Cを得ることができる。なお、線形LDR画像は1コンポーネント当り8ビットの整数値(0〜255)の画像データである。   Through the above processing, the LDR image (linear LDR image) in the linear color space having the same size as the HDR image, the luminance component Y_hdr of the HDR image, and the low luminance pixel number C can be obtained. The linear LDR image is 8-bit integer value (0 to 255) image data per component.

次に、図5を参照して、ステップS314における、HDR補助データ生成部203によるHDR補助データ作成処理を説明する。HDR補助データの作成方法については、ISO/IEC 18477−2で記載されている方法をそのまま使用すれば良いので、詳細な説明は割愛する。   Next, with reference to FIG. 5, the HDR auxiliary data creation processing by the HDR auxiliary data generation unit 203 in step S314 will be described. As a method for creating HDR auxiliary data, the method described in ISO / IEC 18477-2 may be used as it is, and a detailed description thereof will be omitted.

まず、ステップS501にて、HDR補助データ生成部203は、ステップS301で取得したHDR画像の輝度値Y_hdrを取得する。輝度値Y_hdrは、ステップS302の線形LDR画像作成時に既に計算されているので、その値を保存していれば、ここで計算する必要はない。ステップS502にて、HDR補助データ生成部203は、メモリ206の線形LDR画像用の領域から線形LDR画像データを取得する。フラグFlagに“0”が設定されている場合は、メモリ203にはステップS302で作成された線形LDR画像が保存されている。一方、フラグFlagが“1”に設定されている場合は、メモリ203には、ステップS302で作成された線形LDR画像が、ステップS312の処理によってローカルデコード結果の線形LDR画像によって上書きされた画像が保存されている。ステップS503にて、HDR補助データ生成部203は、ステップS502で取得した線形LDR画像の各画素について輝度値Y_ldrを算出する。輝度値の計算方法は、ISO/IEC 18477−2で規定された変換式を用いる。ステップS504にて、HDR補助データ生成部203は、ISO/IEC 18477−2で規定されている方法に従って、ステップS501で取得したY_hdrとステップS503で取得したY_ldrを用いて、次式に従い全画素のYレシオ(Y_ratio)を計算する。
Y_ratio(x,y)=Y_hdr(x,y)/(Y_ldr(x,y)+nf)
ここで、nfは、ノイズ付加部106により付加されるノイズである。これにより、ゼロ割を防ぐことができる。
First, in step S501, the HDR auxiliary data generation unit 203 acquires the luminance value Y_hdr of the HDR image acquired in step S301. Since the luminance value Y_hdr has already been calculated at the time of creating the linear LDR image in step S302, if the value is stored, it is not necessary to calculate here. In step S502, the HDR auxiliary data generation unit 203 acquires linear LDR image data from the region for the linear LDR image in the memory 206. When “0” is set in the flag Flag, the linear LDR image created in step S302 is stored in the memory 203. On the other hand, when the flag Flag is set to “1”, an image in which the linear LDR image created in step S302 is overwritten with the linear LDR image obtained as a result of local decoding in the process of step S312 is stored in the memory 203. Saved. In step S503, the HDR auxiliary data generation unit 203 calculates a luminance value Y_ldr for each pixel of the linear LDR image acquired in step S502. As a calculation method of the luminance value, a conversion formula defined by ISO / IEC 18477-2 is used. In step S504, the HDR auxiliary data generation unit 203 uses the Y_hdr acquired in step S501 and the Y_ldr acquired in step S503 in accordance with the method specified in ISO / IEC 18477-2, and all the pixels according to the following formula: Calculate the Y ratio (Y_ratio).
Y_ratio (x, y) = Y_hdr (x, y) / (Y_ldr (x, y) + nf)
Here, nf is noise added by the noise adding unit 106. Thereby, zero percent can be prevented.

ステップS505にて、HDR補助データ生成部203は、ISO/IEC 18477−2で規定されている方法にしたがって、HDR画像と線形LDR画像の各画素位置毎にRGB値の差分DifRGBを算出する。ステップS506にて、HDR補助データ生成部203は、ステップS505で算出した画素位置毎のDifRGBを、ステップS504で算出した同一画素位置のY_ratioで割ることでスケール変換する。そして、HDR補助データ生成部203は、ISO/IEC 18477−2で規定されている方法に従って、各画素位置に対応するHDR補助データの色差成分CC_hdrを算出する。ステップS507にて、HDR補助データ生成部203は、CC_hdrをステップS503で算出したY_ldrで正規化し、CC_normを取得する。ステップS508にて、HDR補助データ生成部203は、ステップS504で取得したY_ratioの対数をとり、Y_logを算出する。ステップS509にて、HDR補助データ生成部203は、すべての画素のCC_normの値から、最大値Max_CC(Max_CbとMax_Cr)と最小値Min_CC(Min_CbとMin_Cr)を取得する。そして、HDR補助データ生成部203は、Max_CCとMin_CCの範囲でCC_normを量子化し、CC_normを8ビット化したCC_xtを取得する。ステップS511にて、HDR補助データ生成部203は、ステップS508で取得したY_logについて、全ての画素の最大値Max_logと最小値Min_logを取得する。そして、HDR補助データ生成部203は、Max_logとMin_logの範囲でY_logを量子化し、8ビット化したY_xtを取得する。そして、ステップS513において、Y_xtとCC_xtをJPEG方式で符号化し、このフローを終了する。   In step S505, the HDR auxiliary data generation unit 203 calculates a difference DifRGB of RGB values for each pixel position of the HDR image and the linear LDR image according to a method defined in ISO / IEC 18477-2. In step S506, the HDR auxiliary data generation unit 203 performs scale conversion by dividing DifRGB for each pixel position calculated in step S505 by Y_ratio of the same pixel position calculated in step S504. Then, the HDR auxiliary data generation unit 203 calculates the color difference component CC_hdr of the HDR auxiliary data corresponding to each pixel position in accordance with a method specified by ISO / IEC 18477-2. In step S507, the HDR auxiliary data generation unit 203 normalizes CC_hdr with Y_ldr calculated in step S503, and acquires CC_norm. In step S508, the HDR auxiliary data generation unit 203 takes the logarithm of Y_ratio acquired in step S504 and calculates Y_log. In step S509, the HDR auxiliary data generation unit 203 acquires the maximum value Max_CC (Max_Cb and Max_Cr) and the minimum value Min_CC (Min_Cb and Min_Cr) from the CC_norm values of all the pixels. Then, the HDR auxiliary data generation unit 203 quantizes CC_norm in the range of Max_CC and Min_CC, and obtains CC_xt obtained by converting CC_norm to 8 bits. In step S511, the HDR auxiliary data generation unit 203 acquires the maximum value Max_log and the minimum value Min_log of all the pixels for Y_log acquired in step S508. Then, the HDR auxiliary data generation unit 203 quantizes Y_log within the range of Max_log and Min_log, and acquires Y_xt converted to 8 bits. In step S513, Y_xt and CC_xt are encoded by the JPEG method, and this flow ends.

本実施形態では、LDR画像において輝度値が96以下となる画素数が、画像全体の半数を超える場合に、LDR画像をローカルデコードした結果を使ってHDR補助データを作成する。つまり、低輝度画素数が非常に多い場合のみ処理負荷が高いローカルデコード処理を実施し、復号時のHDR画像の画質向上を図る。これは人間の視覚特性上、低輝度に対する感度が大きいためである。そのため、処理負荷が高くても、復号時のHDR画像の画質を向上する効果が大きい。一方、低輝度画素の割合が多くない画像の場合には、復号時のHDR画像の画質を向上させる効果が少ないため、ローカルデコード処理を行わず、符号化にかかる処理負荷を低減させることができる。したがって、本実施形態によれば、復号時の画質向上の効果が大きい時のみ、符号化時の処理負荷が大きくなるローカルデコード処理を実行することが容易になる。   In this embodiment, when the number of pixels having a luminance value of 96 or less in an LDR image exceeds half of the entire image, HDR auxiliary data is created using the result of local decoding of the LDR image. That is, only when the number of low-luminance pixels is very large, local decoding processing with a high processing load is performed to improve the image quality of the HDR image at the time of decoding. This is because the sensitivity to low luminance is large due to human visual characteristics. Therefore, even if the processing load is high, the effect of improving the image quality of the HDR image at the time of decoding is great. On the other hand, in the case of an image in which the ratio of low-luminance pixels is not large, the effect of improving the image quality of the HDR image at the time of decoding is small, so local decoding processing is not performed and the processing load related to encoding can be reduced . Therefore, according to the present embodiment, it is easy to execute local decoding processing that increases the processing load during encoding only when the effect of improving the image quality during decoding is large.

[第1の実施形態の変形例]
上記の第1の実施形態では、符号化対象のHDR画像全体に対する低輝度画素値が占める割合を用いて、ローカルデコード処理の有無を決定した。図3のステップS302で、画像全面分、すなわち1920×1080画素の線形LDR画像を作成すると共に、低輝度画素値をカウントした。そのため、線形LDR画像作成後に、ローカルデコードの有無を判定できた。しかし、画像全体の情報が必要になるため、並列化処理ができず、メモリ使用量も大きくなってしまう。
[Modification of First Embodiment]
In the first embodiment described above, the presence / absence of the local decoding process is determined using the ratio of the low luminance pixel value to the entire HDR image to be encoded. In step S302 of FIG. 3, a linear LDR image of the entire image, that is, 1920 × 1080 pixels is created, and low luminance pixel values are counted. Therefore, it was possible to determine the presence or absence of local decoding after creating the linear LDR image. However, since information on the entire image is required, parallel processing cannot be performed, and the amount of memory used increases.

たとえば、マクロブロック(8×8画素)の高さと同じ8ラインずつに画像を分割し、HDR画像の圧縮フローを実行し、並列処理で高速化することを考える。LDR画像の作成を終えた8ライン分の符号化を行うと同時に、次の8ラインのLDR画像の作成を並列して実行する。しかし、画像全体における低輝度画素の割合が分からないと、ローカルデコードの有無が決まらない。そのため、HDR補助データの作成は、ステップS302の処理が終わるまで始めることができず、並列処理できない。さらに、ローカルデコードの有無が決定するまで、ステップS308で得られるLDR画像の量子化値をすべて保存しておく必要がある。そのため、LDR画像のすべての量子化値を保持しなければならない。あるいは、LDR画像の符号データだけを保持しておき、ローカルデコードが必要になった時点で復号し、線形LDR画像を作成することもできる。この場合、LDR画像のメモリ使用量は符号データ分と、8ライン分のメモリのみで良いが、エントロピー符号化を復号する時間が必要になり、処理全体が遅くなる。   For example, consider dividing an image into 8 lines each having the same height as a macroblock (8 × 8 pixels), executing an HDR image compression flow, and increasing the speed by parallel processing. Encoding for eight lines after the creation of the LDR image is performed, and at the same time, the next eight lines of LDR images are created in parallel. However, if the ratio of low-luminance pixels in the entire image is not known, the presence or absence of local decoding cannot be determined. For this reason, the creation of HDR auxiliary data cannot be started until the processing in step S302 is completed, and parallel processing cannot be performed. Further, it is necessary to save all the quantized values of the LDR image obtained in step S308 until it is determined whether or not local decoding is performed. Therefore, all quantization values of the LDR image must be retained. Alternatively, only the LDR image code data can be retained and decoded when local decoding is required to create a linear LDR image. In this case, the memory usage of the LDR image may be only for the code data and the memory for 8 lines, but it takes time to decode the entropy coding, and the entire processing becomes slow.

上述の問題を解決する方法として、本変形例では、マクロブロック単位でローカルデコードの有無を切り替えるものである。以下、本変形例の具体的な処理を、図7のフローを使って説明する。なお、本変形例において、第1の実施形態と同じ動作の処理には、同符号を付与し、その詳細な説明は割愛する。また、以下の説明では、HDR補助データ生成部203、LDR画像生成部204、JPEGコーデック部205等の各種処理部が、CPU201によって実行される例を説明する。   As a method for solving the above-described problem, in this modification, the presence / absence of local decoding is switched in units of macroblocks. Hereinafter, specific processing of this modification will be described with reference to the flowchart of FIG. In this modification, the same reference numerals are given to the same operation processes as those in the first embodiment, and the detailed description thereof is omitted. In the following description, an example in which various processing units such as the HDR auxiliary data generation unit 203, the LDR image generation unit 204, and the JPEG codec unit 205 are executed by the CPU 201 will be described.

CPU201は、ステップS306にて、LDR画像の符号化条件を取得する。次に、ステップS701にて、CPU201は、HDR画像のサイズ、すなわち幅wと高さhを取得する。本実施形態の場合、幅w=1920画素、高さh=1080画素である。ステップS702にて、CPU201は、処理すべきマクロブロック数Nを算出する。本実施形態では、画像の幅wが1920画素であるので、N=1920÷8=240と計算できる。続くステップS703にて、CPU201は、HDR画像データを先頭から順に8ライン取得する。8ラインとは、マクロブロックの高さと一致するライン数である。ステップS704にて、CPU201は、処理済みのマクロブロックをカウントするためのカウンタMにゼロを代入し初期化する。ステップS705にて、CPU201は、マクロブロック単位でLDR画像の圧縮処理を行う。この処理については、後に図8を使って説明する。ステップS706にて、CPU201は、HDR補助データ作成に必要なマクロブロックのCC_normとY_logを作成する。この処理は、第1の実施形態で説明した図5のステップS501からステップS508を、マクロブロックに対して適用した処理である。第1の実施形態で説明済みのため、本変形例における処理フローとその説明は割愛する。次にステップS707にて、CPU201は、マクロブロックのカウンタMに“1”を加算する。ステップS708にて、CPU201は、カウンタMとステップS703で算出した処理すべきマクロブロック数Nを比較する。M=Nであれば、現時点で入力された8ライン分のHDR画像の処理が終了したと判断し、CPU201は処理をステップS709へ進める。そうでなければ、CPU201はステップS705へ処理を戻す。ステップS709にて、CPU201は、HDR画像の最後のラインまで処理が終わったかどうかを判定する。本実施形態では、ステップS703で入力されたライン数を加算しておき、ステップS701で取得したHDR画像の高さと同じになった場合、最後のラインまで終了したと判定する。最後のラインまで終了した場合、CPU201は処理をステップS710へ進める。そうでなければ、CPU201は、ステップS703へ処理を戻し、次の8ラインを取得する。   In step S306, the CPU 201 acquires the coding conditions for the LDR image. Next, in step S701, the CPU 201 acquires the size of the HDR image, that is, the width w and the height h. In this embodiment, the width is w = 1920 pixels and the height is h = 1080 pixels. In step S702, the CPU 201 calculates the number N of macroblocks to be processed. In this embodiment, since the width w of the image is 1920 pixels, it can be calculated that N = 1920 ÷ 8 = 240. In subsequent step S703, the CPU 201 acquires eight lines of HDR image data in order from the top. Eight lines is the number of lines that matches the height of the macroblock. In step S704, the CPU 201 initializes the counter M for counting processed macroblocks by substituting zero. In step S705, the CPU 201 performs LDR image compression processing in units of macroblocks. This process will be described later with reference to FIG. In step S706, the CPU 201 creates macro blocks CC_norm and Y_log necessary for creating HDR auxiliary data. This process is a process in which steps S501 to S508 of FIG. 5 described in the first embodiment are applied to a macroblock. Since it has already been described in the first embodiment, the processing flow and its description in this modification are omitted. In step S707, the CPU 201 adds “1” to the counter M of the macroblock. In step S708, the CPU 201 compares the counter M with the number N of macroblocks to be processed calculated in step S703. If M = N, the CPU 201 determines that the processing of the HDR image for eight lines input at the present time has ended, and the CPU 201 advances the processing to step S709. Otherwise, the CPU 201 returns the process to step S705. In step S709, the CPU 201 determines whether the processing has been completed up to the last line of the HDR image. In this embodiment, the number of lines input in step S703 is added, and when the height of the HDR image acquired in step S701 is the same, it is determined that the process has been completed up to the last line. When the process reaches the last line, the CPU 201 advances the process to step S710. Otherwise, the CPU 201 returns the process to step S703 and acquires the next eight lines.

ステップS710にて、CPU201は、ステップS706で得られたCC_normとY_logを使って、HDR補助データの圧縮処理を行う。この処理は、第1の実施形態で説明した図5のフローチャートにおけるステップS509からステップS513までの処理と同じであるので、その説明は割愛する。なお、図5のフローのステップS509以降の処理において、画像全体における最大値および最小値を取得する必要がある。そのため、LDR画像の作成を8ラインずつ実施する本変形例においては、ステップS508までと、それ以降で処理を分割する必要がある。次にステップS315にて、CPU201は、ステップS710で作成されたHDR補助データを出力する。そして、ステップS317において、CPU201は、ステップS705で作成されたLDRの圧縮データをLDR情報として出力する。ステップS315とステップS317の処理は第1の実施形態と同じであるので、ここでの説明は省略する。   In step S710, the CPU 201 uses the CC_norm and Y_log obtained in step S706 to perform HDR auxiliary data compression processing. Since this process is the same as the process from step S509 to step S513 in the flowchart of FIG. 5 described in the first embodiment, the description thereof is omitted. In the processing after step S509 in the flow of FIG. 5, it is necessary to acquire the maximum value and the minimum value in the entire image. For this reason, in this modification in which LDR images are created every eight lines, it is necessary to divide the processing up to step S508 and thereafter. Next, in step S315, the CPU 201 outputs the HDR auxiliary data created in step S710. In step S317, the CPU 201 outputs the LDR compressed data created in step S705 as LDR information. Since the processing in step S315 and step S317 is the same as that in the first embodiment, description thereof is omitted here.

次に、ステップS705のマクロブロック単位のLDR画像圧縮処理を図8のフローチャートに従って説明する。   Next, the macroblock unit LDR image compression processing in step S705 will be described with reference to the flowchart of FIG.

ステップS801にて、CPU201は、マクロブロック単位で線形LDR画像を作成する。この方法については、後に図9を用いて説明する。ステップS802にて、CPU201は、ステップS801で線形LDR画像を作成する際にカウントした低輝度画素の数から、着目マクロブロックの低輝度画素の割合RLP_mを算出する。マクロブロックのサイズは8×8画素である。故に、ステップS801で得られる低輝度画素数をCとすると、RLP_m=C/64となる。ステップS803にて、CPU201は、RLP_mと、あらかじめ決められた閾値Th_RLPを比較する。RLP_mが閾値Th_RLPより大きければ、CPU201は処理をステップS305へ進める。本変形例では、閾値Th_RLPは0.5とする。したがって、本変形例の場合、1つのマクロブロックに低輝度の画素が33以上あれば、処理はステップS305へ進むことになる。ステップS305にて、CPU201は、ローカルデコードを行うことを示すためフラグFlagに“1”を代入する。一方、RLP_mが閾値以下となって、S313に処理が進んだ場合、CPU201は、ローカルデコードを行わないことを示すためフラグFlagに“0”を代入する。ステップS307からステップS310までは第1の実施形態と同様の動作をする。ステップS310にて、CPU201は、フラグFlagが“1”であるか否かを判定する。フラグFlagが“1”の場合、CPU201は処理をステップS311へ進め、そうでなければ、本フローを終了する。ステップS311およびステップS312は第1の実施形態と同様の動作をする。ただし、S311、312における処理対象は、着目マクロブロックとなる。ステップS804では、ステップS312で得られたローカルデコード後の画像データで、ステップS801で作成した着目マクロブロックの線形LDR画像を上書きし、このフローを終了する。   In step S801, the CPU 201 creates a linear LDR image in units of macro blocks. This method will be described later with reference to FIG. In step S802, the CPU 201 calculates the ratio RLP_m of the low luminance pixels of the macro block of interest from the number of low luminance pixels counted when creating the linear LDR image in step S801. The size of the macroblock is 8 × 8 pixels. Therefore, if the number of low luminance pixels obtained in step S801 is C, RLP_m = C / 64. In step S803, the CPU 201 compares RLP_m with a predetermined threshold Th_RLP. If RLP_m is larger than the threshold Th_RLP, the CPU 201 advances the process to step S305. In this modification, the threshold Th_RLP is set to 0.5. Therefore, in the case of this modification, if there are 33 or more low-luminance pixels in one macroblock, the process proceeds to step S305. In step S305, the CPU 201 assigns “1” to the flag Flag to indicate that local decoding is to be performed. On the other hand, when RLP_m becomes equal to or less than the threshold value and the process proceeds to S313, the CPU 201 assigns “0” to the flag Flag to indicate that local decoding is not performed. Steps S307 to S310 perform the same operation as in the first embodiment. In step S310, the CPU 201 determines whether or not the flag Flag is “1”. If the flag Flag is “1”, the CPU 201 advances the process to step S311. Otherwise, the flow ends. Steps S311 and S312 operate in the same manner as in the first embodiment. However, the processing target in S311 and 312 is the target macroblock. In step S804, the image data after local decoding obtained in step S312 is overwritten with the linear LDR image of the macro block of interest created in step S801, and this flow ends.

次に、ステップS801のマクロブロック単位の線形LDR画像の作成処理を図9のフローを参照して説明する。   Next, the creation processing of the linear LDR image for each macroblock in step S801 will be described with reference to the flow of FIG.

基本的には、第1の実施形態の図4で画像全体に対して行った処理を、本変形例に合わせて1つのマクロブロックに対して行うことになる。   Basically, the processing performed on the entire image in FIG. 4 of the first embodiment is performed on one macroblock in accordance with this modification.

ステップS401にて、CPU201は、トーンマッピング処理に用いるトーンカーブを取得し、ステップS403に処理を進める。ステップS403からステップS411までは、第1の実施形態と同様の処理である。ステップS901にて、CPU201は、変数xとマクロブロックの幅=8を比較する。変数x=8であれば、CPU201は、このマクロブロックの右端まで処理を終えたものと判断し、処理をステップS413へ進める。また、変数xがマクロブロック幅に達していない場合、CPU201は着目画素の右隣の画素を処理するためにステップS406へ処理を戻す。ステップS413にて、CPU201は、マクロブロックの高さ方向の変数yに“1”を加算する。ステップS902にて、CPU201は、変数yとマクロブロックの高さ=8と比較する。yが8であればこの処理を終了し、そうでなければ次のラインの先頭から処理を進めるために、ステップS405へ処理を戻す。   In step S401, the CPU 201 acquires a tone curve used for tone mapping processing, and proceeds to step S403. Steps S403 to S411 are the same as those in the first embodiment. In step S901, the CPU 201 compares the variable x with the macroblock width = 8. If the variable x = 8, the CPU 201 determines that the process has been completed up to the right end of the macroblock, and advances the process to step S413. If the variable x has not reached the macroblock width, the CPU 201 returns the process to step S406 in order to process the pixel on the right side of the pixel of interest. In step S413, the CPU 201 adds “1” to the variable y in the height direction of the macroblock. In step S902, the CPU 201 compares the variable y with the height of the macroblock = 8. If y is 8, the process ends. If not, the process returns to step S405 to proceed from the beginning of the next line.

本変形例の処理によれば、マクロブロック単位でローカルデコードの有無を切り替えることができる。そのため、マクロブロック境界にアーチファクトが発生するリスクは高くなる。しかし、LDRの符号化に要するメモリ使用量を削減でき、並列処理による高速化も行いやすいという効果が期待できる。   According to the process of this modification, the presence / absence of local decoding can be switched in units of macroblocks. This increases the risk of artifacts occurring at the macroblock boundaries. However, it can be expected that the amount of memory used for encoding the LDR can be reduced, and the speed can be easily increased by parallel processing.

なお、本実施形態では、マクロブロックと同じ高さである8ラインずつデータを読み込み処理したが、マクロブロックの高さ(=8)の倍数であれば、何ラインであっても構わない。   In the present embodiment, data is read and processed every 8 lines having the same height as the macroblock. However, any number of lines may be used as long as it is a multiple of the macroblock height (= 8).

[第2の実施形態]
第1の実施形態では、図6(a)のようにHDR画像のデータがとり得る範囲すべてをカバーするトーンカーブを使用した。このように画像によらず一意に決まるトーンカーブを適用するトーンマッピング処理は、計算コストが小さく、リアルタイム性が要求される場合には好まれる。しかし、入力されるHDR画像がこの範囲をすべて使用していないことがある。実際、個々のHDR画像のダイナミックレンジは様々であり、取り得るデータ範囲の一部しか使っていない画像がほとんどである。たとえば、第1の実施形態では、入力されたHDR画像の画素値が“4550”より小さい値であれば低輝度画素としてカウントしたが、入力HDR画像の最小画素値が“4550”であると、ローカルデコードが必要と判断されることが全くない。
[Second Embodiment]
In the first embodiment, a tone curve that covers the entire possible range of HDR image data as shown in FIG. 6A is used. As described above, the tone mapping process that applies a tone curve that is uniquely determined regardless of an image is preferred when the calculation cost is low and real-time performance is required. However, the input HDR image may not use all of this range. In fact, the dynamic range of individual HDR images varies, and most images use only a part of the possible data range. For example, in the first embodiment, if the pixel value of the input HDR image is a value smaller than “4550”, it is counted as a low luminance pixel, but if the minimum pixel value of the input HDR image is “4550”, There is no determination that local decoding is necessary.

一方、符号化対処のHDR画像のダイナミックレンジに依存したトーンカーブを用いてトーンマッピングを行うことも考えられる。たとえば、入力HDR画像の画素値の最小値が“4550”で、最大値が“50530”である場合、図6(b)のようなトーンカーブを生成し、LDR画像を作成する。このように個々の符号化対象のHDR画像のダイナミックレンジに合わせたトーンカーブを使用する方が、計算コストはかかるが、より綺麗(高品位)なLDR画像を復号できる符号データを作成することができる。つまり、計算コストよりも画質を重視していると判断できる。   On the other hand, it is also conceivable to perform tone mapping using a tone curve depending on the dynamic range of the HDR image to be encoded. For example, when the minimum value of the pixel value of the input HDR image is “4550” and the maximum value is “50530”, a tone curve as shown in FIG. 6B is generated to create an LDR image. Using a tone curve that matches the dynamic range of each HDR image to be encoded in this way is computationally expensive, but it is possible to create code data that can decode a more beautiful (high quality) LDR image. it can. That is, it can be determined that image quality is more important than calculation cost.

本第2の実施形態では、HDR画像の画素値の取り得る全範囲に対応する固定トーンカーブ(図6(a))を用いて符号化するのか、符号化対象のHDR画像に依存したトーンカーブを生成した上で符号化するのかを、ユーザが入力部202を介して設定する例を説明する。そして、その設定に応じてローカルデコードの有無を切り換える。   In the second embodiment, encoding is performed using a fixed tone curve (FIG. 6A) corresponding to the entire possible range of pixel values of the HDR image, or a tone curve depending on the HDR image to be encoded An example will be described in which the user sets via the input unit 202 whether or not encoding is performed. Then, the presence or absence of local decoding is switched according to the setting.

なお、本第2の実施形態におけるLDR画像生成部204は、固定トーンカーブを用いることが設定された場合には、図6(a)に示すトーンカーブを用いてLDR画像を生成する。一方、符号化対象のHDR画像に依存するトーンカーブを用いることが設定された場合、LDR画像生成部204は、符号化対象のHDR画像の画素の最大値と最小値とを求め、その範囲の出力値を0乃至255とする曲線を設定した上で、LDR画像を生成するものとする。   Note that the LDR image generation unit 204 in the second embodiment generates an LDR image using the tone curve shown in FIG. 6A when it is set to use a fixed tone curve. On the other hand, when it is set to use a tone curve that depends on the HDR image to be encoded, the LDR image generation unit 204 obtains the maximum value and the minimum value of the pixels of the HDR image to be encoded, and It is assumed that an LDR image is generated after a curve having an output value of 0 to 255 is set.

以下、本第2の実施形態の処理を図10のフローチャートに従って説明する。なお、本第2の実施形態において、第1の実施形態と同様の処理には、同じ番号を付与し、その説明は省略する。   Hereinafter, the processing of the second embodiment will be described with reference to the flowchart of FIG. In the second embodiment, the same processes as those in the first embodiment are given the same numbers, and the description thereof is omitted.

ステップS301にて、CPU201はHDR画像のデータを取得し、メモリ206に格納する。次に、ステップS302にて、CPU201はLDR画像生成部204を制御し、線形LDR画像を作成させる。生成された線形LDR画像はメモリ206に格納される。なお、LDR画像の生成手順は先に説明した通りである。次に、ステップS1001にて、CPU201は、ステップS302で使用したトーンカーブが、符号化対象のHDR画像に依存したトーンカーブであったかを判定する。この判定は、ユーザの設定から判定しても良い。   In step S <b> 301, the CPU 201 acquires HDR image data and stores it in the memory 206. Next, in step S302, the CPU 201 controls the LDR image generation unit 204 to create a linear LDR image. The generated linear LDR image is stored in the memory 206. The LDR image generation procedure is as described above. Next, in step S1001, the CPU 201 determines whether the tone curve used in step S302 is a tone curve depending on the HDR image to be encoded. This determination may be made based on user settings.

符号化対象のHDR画像に依存したトーンカーブを用いたと判定された場合、CPU201は画質重視であると判断し、処理をステップS305へ進める。ステップS305にて、CPU201は、ローカルデコードしたLDR画像をHDR補助データ作成時に使用するようにするため、フラグFlagに“1”を設定する。一方、ステップS302で使用したトーンカーブが、符号化対象のHDR画像に依存しない、固定トーンカーブであった場合、CPU201は、ステップS1001からステップS313に処理を進める。ステップS313にて、CPU201は、LDR画像のローカルデコードをしないことを示すため、フラグFlagに“0”を設定する。ステップS306以降は、第1の実施形態と同様の動作であるので、ここでの説明は割愛する。   When it is determined that the tone curve depending on the HDR image to be encoded is used, the CPU 201 determines that the image quality is important and advances the process to step S305. In step S305, the CPU 201 sets “1” to the flag Flag so that the locally decoded LDR image is used when creating the HDR auxiliary data. On the other hand, if the tone curve used in step S302 is a fixed tone curve that does not depend on the HDR image to be encoded, the CPU 201 advances the process from step S1001 to step S313. In step S313, the CPU 201 sets “0” to the flag Flag to indicate that local decoding of the LDR image is not performed. Since step S306 and subsequent operations are the same as those in the first embodiment, description thereof is omitted here.

以上の本第2の実施形態によれば、画質優先か否かに応じて、適用するトーンカーブを決定し、LDR画像のローカルデコードをするか、しないかを切り分けることができる。   According to the second embodiment described above, it is possible to determine a tone curve to be applied according to whether or not priority is given to image quality, and to determine whether or not to locally decode an LDR image.

[第2の実施形態の変形例]
上記第2の実施形態では、符号化対象のHDR画像に依存したトーンカーブを使用するか、固定トーンカーブを使用するかによって、ローカルデコードをする/しないを切り替えた。しかし、符号化対象のHDR画像の輝度値の最小値と最大値から、ローカルデコードをする/しないを切り替えてもよい。つまり、入力HDR画像の最大輝度値が予め設定された閾値より小さい場合には、低輝度の画像であると判定し、ローカルデコードを行う。逆に、入力HDR画像の最小輝度値が予め設定された閾値以上の場合には、ローカルデコードを行わない。本変形例の場合、第1の実施形態のように低輝度画素の割合を計算するわけではない。そのため、ほとんどの画素の輝度が低いにも関わらず、ノイズなどで1画素でも最大輝度値が大きくなると、ローカルデコードされない。しかし、ローカルデコードの有無をより簡易に判定できる。さらに、入力HDR画像のダイナミックレンジに応じたトーンカーブを使用しながらも、HDR補助データ作成にかかる計算コストを小さく抑えることができる。
[Modification of Second Embodiment]
In the second embodiment, whether to perform local decoding is switched depending on whether a tone curve depending on the HDR image to be encoded is used or a fixed tone curve is used. However, local decoding may be switched between the minimum value and the maximum value of the luminance value of the HDR image to be encoded. That is, when the maximum luminance value of the input HDR image is smaller than a preset threshold value, it is determined that the image is a low luminance image and local decoding is performed. Conversely, when the minimum luminance value of the input HDR image is equal to or greater than a preset threshold value, local decoding is not performed. In the case of this modification, the ratio of low-luminance pixels is not calculated as in the first embodiment. For this reason, local decoding is not performed when the maximum luminance value of one pixel increases due to noise or the like even though the luminance of most pixels is low. However, the presence or absence of local decoding can be determined more easily. Furthermore, while using a tone curve corresponding to the dynamic range of the input HDR image, the calculation cost for creating the HDR auxiliary data can be kept small.

[第3の実施形態]
トーンマッピング手法としては、大きく2つの手法がある。1つは、第1、第2の実施形態で示したように、画像全体に一様な輝度変換を行うグローバルトーンマッピングである。もうひとつは、画像の局所領域毎に、異なった輝度変換を行うローカルトーンマッピングである。
[Third Embodiment]
There are two major tone mapping methods. One is global tone mapping that performs uniform luminance conversion on the entire image as shown in the first and second embodiments. The other is local tone mapping that performs different luminance conversion for each local region of the image.

グローバルトーンマッピングは、画像全体で一様な変換関数を用いるため、画像中のテクスチャ情報の視認性が低下する。一方、ローカルトーンマッピングは、グローバルトーンマッピングに比べて計算コストが高い。しかし、局所領域におけるコントラストを維持することが可能になり、テクスチャ情報の視認性低下を防ぐことができる。   Since global tone mapping uses a uniform conversion function for the entire image, the visibility of texture information in the image decreases. On the other hand, the local tone mapping has a higher calculation cost than the global tone mapping. However, it is possible to maintain the contrast in the local region, and it is possible to prevent a decrease in the visibility of the texture information.

この2つのトーンマッピング手法を使い分ける場合に、ローカルデコードをする/しないを切り替える方法について、図11を用いて説明する。なお、トーンマッピングを行う場合のグローバルトーンマッピング、ローカルトーンマッピングのいずれを用いるのかは、入力部202によりユーザが設定するものとする。   A method of switching between local decoding and non-decoding when using the two tone mapping methods will be described with reference to FIG. Note that it is assumed that the user sets by the input unit 202 whether to use global tone mapping or local tone mapping when tone mapping is performed.

図11において、図10と同じ処理には同じ番号を付与し、その部分の説明は省略する。   In FIG. 11, the same processes as those in FIG. 10 are given the same numbers, and description thereof is omitted.

ステップS301にて、CPU201は、符号化対象のHDR画像のデータを取得し、メモリ206に格納する。次に、ステップS302にて、CPU201は、LDR画像生成部204を制御し、メモリ206に格納されたHDR画像から線形LDR画像を作成させ、作成した線形LDR画像をメモリ206に格納させる。次に、ステップS1101にて、ステップS302で使用したトーンマッピングの手法が、ローカルトーンマッピングだったかどうかを判定する。この判定は、ユーザからの設定から行うものとするが、例えば、1つのHDR画像に対して、複数のトーンカーブを使用した場合に、ローカルトーンマッピングであったと判定しても良い。ローカルトーンマッピングである場合は、CPU201は、画質重視であると判断し、処理をステップS305へ進める。また、ローカルトーンマッピングではない場合には、CPU201は計算コスト重視と判断し、処理をステップS313に進める。以下の処理は第2の実施形態と同様である。   In step S <b> 301, the CPU 201 acquires HDR image data to be encoded and stores it in the memory 206. Next, in step S <b> 302, the CPU 201 controls the LDR image generation unit 204 to create a linear LDR image from the HDR image stored in the memory 206 and store the created linear LDR image in the memory 206. In step S1101, it is determined whether the tone mapping method used in step S302 is local tone mapping. This determination is made based on a setting from the user. For example, when a plurality of tone curves are used for one HDR image, it may be determined that the local tone mapping is performed. If it is local tone mapping, the CPU 201 determines that image quality is important, and advances the processing to step S305. If it is not local tone mapping, the CPU 201 determines that calculation cost is important, and the process proceeds to step S313. The following processing is the same as in the second embodiment.

本第3の実施形態よれば、トーンマッピングの手法により画質重視か、計算コスト重視かを容易に判断でき、LDR画像のローカルデコードをするか、しないかを簡単に切り分けることができる。   According to the third embodiment, it is possible to easily determine whether the image quality is important or the calculation cost is important by the tone mapping method, and it is possible to easily determine whether or not to locally decode the LDR image.

[第3の実施形態の変形例]
上記第3の実施形態では、ローカルトーンマッピングが選択された場合に、LDR画像の全領域についてローカルデコードした結果を用いた。
[Modification of Third Embodiment]
In the third embodiment, when local tone mapping is selected, the result of local decoding for the entire region of the LDR image is used.

本変形例では、すべてのマクロブロックに対してローカルトーンマッピングを実施するが、マクロブロック毎にローカルデコードをする/しないを切り替える場合について考える。この場合、人間の視覚特性は、低輝度に対する感度が大きいことを考慮すると、暗い領域として分類されたマクロブロックのみ、ローカルデコードすることで、計算コストを軽減することができる。このような処理について、図12を用いて説明する。なお、第1乃至第3の実施形態と同じ処理には同じ番号を付与し、詳細な説明は割愛する。   In this modification, local tone mapping is performed for all macroblocks, but a case is considered where local decoding is switched for each macroblock. In this case, considering that human visual characteristics are highly sensitive to low luminance, only macroblocks classified as dark regions are locally decoded, thereby reducing the calculation cost. Such processing will be described with reference to FIG. The same processes as those in the first to third embodiments are given the same numbers, and detailed descriptions thereof are omitted.

ステップS301にて、CPU201は、符号化対象のHDR画像データを取得し、メモリ206に格納する。次いで、ステップS1201にて、CPU201は、HDR画像を、暗い領域と明るい領域の2つに分類し、領域分割する。領域分割の方法は、明るい領域と暗い領域に2分できるのであれば、どのような方法を用いても構わない。   In step S <b> 301, the CPU 201 acquires HDR image data to be encoded and stores it in the memory 206. Next, in step S1201, the CPU 201 classifies the HDR image into two areas, a dark area and a bright area, and divides the area. Any method may be used as long as the region can be divided into a bright region and a dark region.

本変形例では、各画素の輝度値を見て、16ビットで取り得る輝度範囲(0〜65535)の真ん中(43678)未満であれば暗い領域の画素として分類する。それ以外であれば明るい領域の画素として分類する。その後、例えば128画素×128画素未満の領域は隣接領域と統合し、領域分割を終了するものとする。   In the present modification, the luminance value of each pixel is viewed, and if it is less than the middle (43678) of the luminance range (0 to 65535) that can be obtained in 16 bits, the pixel is classified as a dark region pixel. Otherwise, it is classified as a bright region pixel. Thereafter, for example, an area of less than 128 pixels × 128 pixels is integrated with an adjacent area, and the area division ends.

ステップS702にて、CPU201は、画像全体に含まれるマクロブロック数Nを算出する。実施形態では、画像サイズが1920×1080画素であるので、N=(1920/8)×(1080/8)=32400と算出できる。ステップS704にて、CPU201は、マクロブロック用のカウンタMにゼロを代入して初期化する。ステップS1202にて、CPU201は、マクロブロック単位のLDR画像圧縮を行う。この処理については、後に図13を用いて説明する。   In step S702, the CPU 201 calculates the number N of macroblocks included in the entire image. In the embodiment, since the image size is 1920 × 1080 pixels, it can be calculated as N = (1920/8) × (1080/8) = 32400. In step S704, the CPU 201 initializes the macroblock counter M by substituting zero. In step S1202, the CPU 201 performs LDR image compression in units of macro blocks. This process will be described later with reference to FIG.

ステップS707にて、CPU201は、マクロブロック用カウンタMに“1”を加算する。ステップS708にて、CPU201は、マクロブロック用カウンタMの値と、マクロブロック数Nとを比較する。同じであれば、CPU201は、すべてのマクロブロックについてLDR画像圧縮を終えたものと判断し、処理をステップS314へ進める。そうでなければ、CPU201は処理をステップS1202へ戻す。ステップS314、ステップS315、ステップS317は第1の実施形態と同様の動作を行い、このフローを終了する。   In step S707, the CPU 201 adds “1” to the macroblock counter M. In step S708, the CPU 201 compares the value of the macroblock counter M with the number N of macroblocks. If they are the same, the CPU 201 determines that the LDR image compression has been completed for all the macroblocks, and advances the processing to step S314. Otherwise, the CPU 201 returns the process to step S1202. Steps S314, S315, and S317 perform the same operation as in the first embodiment, and the flow is terminated.

次に、ステップS1202の処理を、図13を参照して説明する。なお、図13において、図9と同様の動作には同じ番号を付与し、その説明は省略する。   Next, the process of step S1202 will be described with reference to FIG. In FIG. 13, the same operations as those in FIG. 9 are denoted by the same reference numerals, and the description thereof is omitted.

ステップS801にて、CPU201は、マクロブロック単位の線形LDR画像を作成する。ステップS1301にて、CPU201は、現在処理中のマクロブロック内に、ステップS1202の結果、暗い領域として判定された画素が32画素以上(半数以上)含まれているかどうか判定する。32画素以上が暗い領域であれば、CPU201はステップS305へ処理を進め、このマクロブロックはローカルデコードするものとして、フラグFlagに“1”を代入する。一方、ステップS313に処理が進んだ場合、CPU201は、ローカルデコードしないものとするため、フラグFlagに“0”を代入する。ステップS307からステップS804は、第1の実施形態およびその変形例で説明したのと同様の処理を行い、このフローを終了する。   In step S801, the CPU 201 creates a linear LDR image in units of macroblocks. In step S1301, the CPU 201 determines whether or not the macro block currently being processed includes 32 pixels or more (half or more) of pixels determined as a dark region as a result of step S1202. If the area is darker than 32 pixels, the CPU 201 advances the processing to step S305, and substitutes “1” for the flag Flag, assuming that this macroblock is to be locally decoded. On the other hand, when the process proceeds to step S313, the CPU 201 assigns “0” to the flag Flag so that local decoding is not performed. From step S307 to step S804, processing similar to that described in the first embodiment and its modifications is performed, and this flow is terminated.

本変形例によれば、低輝度領域に分類されるマクロブロックのみローカルデコードを実施する。そのため、HDR画像デコード時に処理が切り替わったマクロブロックの境界部分にアーチファクトが出る可能性はある。しかし、ローカルトーンマッピングを行う場合であっても、ローカルデコードするマクロブロックを限定することで、HDR補助データ作成にかかる計算コストを削減することができる。   According to the present modification, local decoding is performed only on macroblocks classified into the low luminance area. For this reason, there is a possibility that an artifact may appear at the boundary portion of the macro block where the processing is switched at the time of decoding the HDR image. However, even when local tone mapping is performed, the calculation cost for creating the HDR auxiliary data can be reduced by limiting the macro blocks to be locally decoded.

なお、本変形例では、すべてのマクロブロックに対してローカルトーンマッピングする方法について説明したが、第3の実施形態のように、グローバルトーンマッピングとローカルトーンマッピングのどちらかを選択する場合に適用してもよい。   In this modification, the method of performing local tone mapping for all macroblocks has been described. However, this modification is applied to the case of selecting either global tone mapping or local tone mapping as in the third embodiment. May be.

[第4の実施形態]
ローカルデコードした方が良い場合は、符号化対象のHDR画像をトーンマッピングして得られるLDR画像と、最終的にJPEG XTファイルに書き込まれた符号化データを復号して得られる復号後LDR画像の差異が大きい場合である。LDR画像の量子化ステップが大きいほど、量子化による誤差が大きくなるので、上記の差異が大きくなると考えてよい。したがって、本第4の実施形態では、LDR画像の量子化ステップを基準にローカルデコードをする/しないを切り替える方法について説明する。
[Fourth Embodiment]
If it is better to perform local decoding, the LDR image obtained by tone mapping the HDR image to be encoded and the decoded LDR image finally obtained by decoding the encoded data written in the JPEG XT file This is the case when the difference is large. It can be considered that the larger the quantization step of the LDR image, the larger the error due to the quantization, and thus the above difference becomes large. Therefore, in the fourth embodiment, a method of switching between local decoding and non-decoding based on the LDR image quantization step will be described.

以下、本第4の実施形態における処理を、図14を参照して説明する。   Hereinafter, processing in the fourth embodiment will be described with reference to FIG.

ステップS301、302では、CPU201は、第1の実施形態と同様に、符号化対象のHDR画像データを取得し、線形LDR画像を作成する。ステップS306にて、CPU201は、LDR画像の符号化条件を取得する。符号化条件には、LDR画像のQパラメータの情報も含まれる。Qパラメータは、1から100までの整数値を取り、100を指定すると量子化ステップがもっとも細かくなり、1を指定すると、量子化ステップが最も粗くなる。ステップS1401にて、CPU201は、ステップS306で取得したLDR画像の符号化条件からQパラメータの値を参照する。そして、CPU201は、Qパラメータと、あらかじめ決められた値Th_qを比較する。そしてQパラメータがTh_q未満であれば、CPU201は処理をステップS305、そうでなければステップS313に進める。本実施形態の場合、Th_qは60とする。したがって、LDR画像のQパラメータが60未満であれば、ステップS305に進み、そうでなければステップS313へ進む。ステップS305以降の処理は、第1の実施形態と同様の処理であるので、ここでの詳細な説明は割愛する。   In steps S301 and S302, the CPU 201 acquires HDR image data to be encoded, and creates a linear LDR image, as in the first embodiment. In step S306, the CPU 201 acquires the coding conditions for the LDR image. The encoding condition includes information on the Q parameter of the LDR image. The Q parameter takes an integer value from 1 to 100. When 100 is specified, the quantization step is the finest, and when 1 is specified, the quantization step is the coarsest. In step S1401, the CPU 201 refers to the value of the Q parameter from the coding condition of the LDR image acquired in step S306. Then, the CPU 201 compares the Q parameter with a predetermined value Th_q. If the Q parameter is less than Th_q, the CPU 201 advances the process to step S305, otherwise proceeds to step S313. In the present embodiment, Th_q is 60. Therefore, if the Q parameter of the LDR image is less than 60, the process proceeds to step S305; otherwise, the process proceeds to step S313. Since the process after step S305 is the same process as the first embodiment, a detailed description thereof is omitted here.

上記の結果、LDR画像を符号化する際のQパラメータから、LDR画像の劣化具合を予測し、劣化の程度が大きいと判断した場合にはローカルデコードを行い、劣化の程度が許容できる場合にはローカルデコードは行わないとする処理が実現できる。   As a result of the above, the degree of deterioration of the LDR image is predicted from the Q parameter at the time of encoding the LDR image, and when it is determined that the degree of deterioration is large, local decoding is performed. Processing that does not perform local decoding can be realized.

[第4の実施形態の変形例]
JPEG XTでは、JPEG圧縮する際に、輝度のサブサンプリングは行わず、色差成分のみサブサンプリングを定義している。Cb、Crのx軸方向およびy軸方向のサンプリング比をそれぞれSbx,Sby,Srx,Sryとすると、JPEG XTでは以下の4つのサブサンプリング比が定義されている。
(1)(Sbx,Sby,Srx,Sry)=(1,1,1,1)
(2)(Sbx,Sby,Srx,Sry)=(1,2,1,2)
(3)(Sbx,Sby,Srx,Sry)=(2,1,2,1)
(4)(Sbx,Sby,Srx,Sry)=(2,2,2,2)
上記の(1)の場合、間引きされる色差成分はないので、画質の劣化は少ないと考えて良い。そこで、本第4の変形例では、成分Cb、Crのサブサンプリングが上記の(2)〜(4)のいずれかの場合、ローカルデコードをする。本変形例のHDR画像の圧縮処理を、図15のフローチャートに従って説明する。
[Modification of Fourth Embodiment]
In JPEG XT, luminance sub-sampling is not performed when JPEG compression is performed, and sub-sampling is defined only for color difference components. If the sampling ratios of Cb and Cr in the x-axis direction and y-axis direction are Sbx, Sby, Srx, and Sry, respectively, the following four sub-sampling ratios are defined in JPEG XT.
(1) (Sbx, Sby, Srx, Sry) = (1, 1, 1, 1)
(2) (Sbx, Sby, Srx, Sry) = (1, 2, 1, 2)
(3) (Sbx, Sby, Srx, Sry) = (2, 1, 2, 1)
(4) (Sbx, Sby, Srx, Sry) = (2, 2, 2, 2)
In the case of (1) above, since there are no color difference components to be thinned out, it can be considered that there is little deterioration in image quality. Therefore, in the fourth modification, local decoding is performed when the subsampling of the components Cb and Cr is any one of the above (2) to (4). The HDR image compression processing according to this modification will be described with reference to the flowchart of FIG.

図15と図14との違いは、図14におけるステップS1401がステップS1501で置き換わった点である。図15のステップS1501にて、CPU201は、ステップS306で取得したLDR画像の符号化条件から、サブサンプリング情報を参照する。そして、CPU201は、サブサンプリングが上記(2)〜(4)のいずれかであったと判断した場合、処理をステップS305に、そうでなければ、処理をステップS313に進める。このようにすることで、サブサンプリングされる場合には、LDR画像をローカルデコードした結果を用いてHDR補助データが作成されることになる。   The difference between FIG. 15 and FIG. 14 is that step S1401 in FIG. 14 is replaced with step S1501. In step S1501 in FIG. 15, the CPU 201 refers to the sub-sampling information from the LDR image encoding condition acquired in step S306. If the CPU 201 determines that the sub-sampling is any one of (2) to (4), the CPU 201 advances the process to step S305. Otherwise, the process advances to step S313. In this way, when sub-sampling is performed, HDR auxiliary data is created using the result of local decoding of the LDR image.

[第5の実施形態]
上記第1乃至第3の実施形態、並びにその変形例では、HDR画像の情報やLDR画像の符号化条件などで、ローカルデコードをする/しないを切り替えた。しかし、LDR画像の劣化を直接評価することでローカルデコードを切り替えても良い。そこで本第5の実施形態では、量子化前後の値を直接比較することで、その劣化の程度を評価し、ローカルデコードする/しないをマクロブロック単位で決定する例を説明する。
[Fifth Embodiment]
In the first to third embodiments and the modifications thereof, switching between local decoding and non-decoding is performed based on HDR image information, LDR image encoding conditions, and the like. However, local decoding may be switched by directly evaluating deterioration of the LDR image. Therefore, in the fifth embodiment, an example will be described in which values before and after quantization are directly compared to evaluate the degree of deterioration and whether to perform local decoding is determined in units of macroblocks.

本第5の実施形態の場合、第1の実施形態の変形例とほぼ同じ動作をするが、図7におけるステップS705のマクロブロック単位のLDR画像圧縮の方法が異なる。そこで、本第5の実施形態におけるマクロブロック単位のLDR画像圧縮の方法について図16を用いて説明する。なお、図16において図8と同じ動作の処理には、同じ番号を付与し、その説明は省略する。   In the case of the fifth embodiment, the operation is almost the same as that of the modification of the first embodiment, but the method of LDR image compression in units of macroblocks in step S705 in FIG. 7 is different. Therefore, a macroblock unit LDR image compression method according to the fifth embodiment will be described with reference to FIG. In FIG. 16, processes having the same operations as those in FIG. 8 are given the same numbers, and descriptions thereof are omitted.

ステップS801にて、CPU201は、マクロブロック単位の線形LDR画像の作成を行う。この処理については、第1の実施形態の変形例と同じである。次にステップS307にて、CPU201は、ステップS801で作成した線形LDR画像に、第1の実施形態と同様に、色変換を行う。ステップS1601にて、CPU201は、ステップS307で得られたLDR画像のマクロブロックにDCTを実行し、その時の輝度のDCT係数を例えばメモリ206に保存する。ステップS1602にて、CPU201は、ステップS1601で得られたY,Cb,CrのDCT係数の量子化処理を行う。ステップS1603にて、CPU201は、輝度Yの成分だけ逆量子化する。ステップS309にて、CPU201は、ステップS1602で得られた量子化後のDCT係数をエントロピー符号化する。ステップS1604にて、CPU201は、ステップS1601で保存した量子化前の輝度のDCT係数と、ステップS1603で得られた逆量子化後の輝度のDCT係数を、マクロブロックの64個の係数についてそれぞれ差分値を算出する。そして、ステップS1605にて、CPU201は、ステップS1604で得られた64個の差分値のうち、その絶対値があらかじめ決められたTh_dc以上の係数の数Kをカウントする。本実施形態では、Th_dc=64とする。ステップS1606にて、CPU201は、ステップS1605で得られたKと、あらかじめ決められた値Th_diffを比較する。本実施形態では、Th_diff=32とする。KがTh_diffより大きければ、CPU201は、このマクロブロックにおける量子化前後のDCT係数の差異が大きいと判断し、処理をステップS1607に進め、ローカルデコードする。そうでなければ、ローカルデコードをせずにこのフローを終了する。すなわち、1マクロブロックの半数以上のDCT係数が量子化により、Th_dc=64以上の差が出る場合には、ローカルデコードすることになる。   In step S801, the CPU 201 creates a linear LDR image in units of macroblocks. This process is the same as the modification of the first embodiment. Next, in step S307, the CPU 201 performs color conversion on the linear LDR image created in step S801 as in the first embodiment. In step S1601, the CPU 201 executes DCT on the macroblock of the LDR image obtained in step S307, and stores the DCT coefficient of the luminance at that time in the memory 206, for example. In step S1602, the CPU 201 performs a quantization process on the DCT coefficients of Y, Cb, and Cr obtained in step S1601. In step S1603, the CPU 201 inversely quantizes only the luminance Y component. In step S309, the CPU 201 entropy encodes the quantized DCT coefficient obtained in step S1602. In step S1604, the CPU 201 calculates a difference between the DCT coefficient before luminance stored in step S1601 and the DCT coefficient after luminance obtained in step S1603 for the 64 coefficients of the macroblock. Calculate the value. In step S1605, the CPU 201 counts the number K of coefficients having an absolute value equal to or greater than Th_dc determined in advance among the 64 difference values obtained in step S1604. In this embodiment, Th_dc = 64. In step S1606, the CPU 201 compares K obtained in step S1605 with a predetermined value Th_diff. In this embodiment, Th_diff = 32. If K is larger than Th_diff, the CPU 201 determines that the difference between the DCT coefficients before and after quantization in this macroblock is large, advances the processing to step S1607, and performs local decoding. Otherwise, this flow is terminated without performing local decoding. That is, when a difference of Th_dc = 64 or more is obtained due to quantization of more than half of the DCT coefficients of one macroblock, local decoding is performed.

ステップS1607にて、CPU201は、ステップS1602で得られた量子化後のDCT係数を逆量子化する。輝度Yに関してはステップS1603で逆量子化されているので、ここでは色差のCb、Crだけ逆量子化すれば良い。ステップS312にて、CPU201は、逆色変換をして、線形LDR画像を得る。ステップS804にて、CPU201は、マクロブロックの線形LDR画像を、ローカルデコードして得られたLDR画像で上書きして、このフローを終了する。   In step S1607, the CPU 201 inversely quantizes the quantized DCT coefficient obtained in step S1602. Since the luminance Y is inversely quantized in step S1603, only the color differences Cb and Cr need to be inversely quantized here. In step S312, the CPU 201 performs reverse color conversion to obtain a linear LDR image. In step S804, the CPU 201 overwrites the linear LDR image of the macroblock with the LDR image obtained by local decoding, and ends this flow.

本第5の実施形態によれば、すべてのDCT係数に対して量子化前後の値を比較することから、計算コストが大きくなる。しかし、LDR画像の符号化による劣化の度合いを見ることができるため、劣化が大きいところは確実にローカルデコードした画像を使ってHDR補助データを作成することができることになる。   According to the fifth embodiment, since the values before and after quantization are compared for all DCT coefficients, the calculation cost increases. However, since the degree of deterioration due to encoding of the LDR image can be seen, the HDR auxiliary data can be created using the locally decoded image without fail when the deterioration is large.

[第5の実施形態の変形例]
上記第5の実施形態では、一律にすべてのDCT係数を比較し、ローカルデコードをする/しないを切り替えたが、LDR画像の符号化条件であるQパラメータによって、比較するDCT係数の数およびTh_diffを切り替えてもよい。たとえば、Th_diffは比較するDCT係数の半数とすればよい。図17にDCT係数を模式的に示す。左上隅がDC成分であり、右下がAC成分であるとする。LDR画像のQパラメータが大きい場合は、図17の符号1701で示す、高周波側のDCT係数6個のみを比較する。逆にLDR画像のQパラメータが小さい場合は、図17の符号1701〜1704を合わせた43個のDCT係数を比較対象とする。
[Modification of Fifth Embodiment]
In the fifth embodiment, all DCT coefficients are uniformly compared and whether local decoding is performed or not is switched. However, the number of DCT coefficients to be compared and Th_diff are set according to the Q parameter that is the encoding condition of the LDR image. You may switch. For example, Th_diff may be half of the DCT coefficients to be compared. FIG. 17 schematically shows DCT coefficients. It is assumed that the upper left corner is a DC component and the lower right corner is an AC component. When the Q parameter of the LDR image is large, only six DCT coefficients on the high frequency side indicated by reference numeral 1701 in FIG. 17 are compared. Conversely, when the Q parameter of the LDR image is small, 43 DCT coefficients that are combined with reference numerals 1701 to 1704 in FIG.

本変形例の処理フローを図18に示す。なお、図16と同じ処理をするステップには、図16と同じ番号を付与し、その説明は省略する。   The processing flow of this modification is shown in FIG. Note that steps that perform the same processing as in FIG. 16 are assigned the same numbers as in FIG. 16, and descriptions thereof are omitted.

ステップS801にて、CPU201は、マクロブロック単位の線形LDR画像を作成する。ステップS307にて、CPU201は、ステップS801で作成した線形LDR画像の色変換を行う。ステップS1601にて、CPU201は、色変換後のLDR画像にDCTをかけ、その輝度の係数をメモリ206に保存する。ステップS1602にて、CPU201は、LDR画像のQパラメータに応じて、DCT係数の量子化を行う。ステップS309にて、CPU201はエントロピー符号化を行う。ステップS1801にて、CPU201は、LDR画像のQパラメータが10以上であるか判定する。10以上であれば、ステップS1802へ進む。10未満であれば、CPU201は、量子化による差異が大きい(量子化ステップが大きい)と判断し、ステップS1607へ処理を進め、ローカルデコード処理を実行する。ステップS1702にて、CPU201は、LDR画像のQパラメータが90未満であるか判定する。90未満であれば、CPU201はステップS1803へ処理を進める。また、90以上であれば、CPU201は、量子化による差異は小さいと判断し、ローカルデコードは行わず、この処理フローを終了する。ステップS1803にて、CPU201は、Qパラメータに応じた比較対象となるDCT係数の数と、しきい値Th_diffを取得する。本実施形態では以下のような値を取得するものとする。
(1) Qが70以上90未満の場合
比較対象のDCT係数は、図17の1701で示す6係数
Th_diff=3
(2) Qが50以上70未満の場合
比較対象のDCT係数は、図17の1701および1702で示す15係数
Th_diff=8
(3) Qが30以上50未満の場合
比較対象のDCT係数は、図17の1701〜1703で示す28係数
Th_diff=14
(4) Qが10以上30未満の場合
比較対象のDCT係数は、図17の1701〜1704で示す43係数
Th_diff=22
次に、CPU201は、処理をステップS1603に進める。このステップS1603以降は第5の実施形態と同様の処理であるので、ここでの説明は省略する。
In step S801, the CPU 201 creates a linear LDR image in units of macroblocks. In step S307, the CPU 201 performs color conversion of the linear LDR image created in step S801. In step S1601, the CPU 201 applies DCT to the color-converted LDR image and stores the luminance coefficient in the memory 206. In step S1602, the CPU 201 quantizes the DCT coefficient according to the Q parameter of the LDR image. In step S309, the CPU 201 performs entropy encoding. In step S1801, the CPU 201 determines whether the Q parameter of the LDR image is 10 or more. If it is 10 or more, the process advances to step S1802. If it is less than 10, the CPU 201 determines that the difference due to quantization is large (the quantization step is large), advances the processing to step S1607, and executes local decoding processing. In step S1702, the CPU 201 determines whether the Q parameter of the LDR image is less than 90. If it is less than 90, the CPU 201 advances the process to step S1803. If it is 90 or more, the CPU 201 determines that the difference due to quantization is small, does not perform local decoding, and ends this processing flow. In step S1803, the CPU 201 acquires the number of DCT coefficients to be compared according to the Q parameter and a threshold value Th_diff. In the present embodiment, the following values are acquired.
(1) When Q is 70 or more and less than 90 The comparison target DCT coefficient is 6 coefficients Th_diff = 3 indicated by 1701 in FIG.
(2) When Q is 50 or more and less than 70 The comparison target DCT coefficients are 15 coefficients Th_diff = 8 indicated by 1701 and 1702 in FIG.
(3) When Q is 30 or more and less than 50 The DCT coefficients to be compared are 28 coefficients Th_diff = 14 shown by 1701 to 1703 in FIG.
(4) When Q is 10 or more and less than 30 The DCT coefficients to be compared are 43 coefficients Th_diff = 22 indicated by 1701 to 1704 in FIG.
Next, the CPU 201 advances the process to step S1603. Since step S1603 and subsequent steps are the same as those in the fifth embodiment, description thereof is omitted here.

(その他の実施例)
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサーがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
(Other examples)
The present invention supplies a program that realizes one or more functions of the above-described embodiments to a system or apparatus via a network or a storage medium, and one or more processors in a computer of the system or apparatus read and execute the program This process can be realized. It can also be realized by a circuit (for example, ASIC) that realizes one or more functions.

201…CPU、202…入力部、203…HDR補助データ生成部、204…LDR画像生成部、205…JPEGコーデック部、206…メモリ、207…表示部、208…蓄積部   201 ... CPU, 202 ... input unit, 203 ... HDR auxiliary data generation unit, 204 ... LDR image generation unit, 205 ... JPEG codec unit, 206 ... memory, 207 ... display unit, 208 ... storage unit

Claims (12)

HDR画像を符号化し、LDR画像をHDR画像の精度に戻すための補助データを生成する画像符号化装置であって、
符号化対象のHDR画像からLDR画像を生成するLDR画像生成手段と、
生成したLDR画像を非可逆符号化する符号化手段と、
符号化したLDR画像を復号する復号手段と、
HDR画像とLDR画像に基づき、LDR画像をHDR画像の精度に戻すための補助データを生成する補助データ生成手段と、
前記補助データ生成手段が利用するLDR画像として、前記LDR画像生成手段が生成したLDR画像、前記復号手段による復号で得たLDR画像のいずれを用いるかを判定する判定手段と
を有することを特徴とする画像符号化装置。
An image encoding device for generating auxiliary data for encoding an HDR image and returning an LDR image to the accuracy of the HDR image,
LDR image generation means for generating an LDR image from an HDR image to be encoded;
Encoding means for irreversibly encoding the generated LDR image;
Decoding means for decoding the encoded LDR image;
Auxiliary data generating means for generating auxiliary data for returning the LDR image to the accuracy of the HDR image based on the HDR image and the LDR image;
Determining means for determining whether to use an LDR image generated by the LDR image generating means or an LDR image obtained by decoding by the decoding means as an LDR image used by the auxiliary data generating means; An image encoding device.
前記符号化手段は、マクロブロックを単位として、色変換、DCT変換、量子化、及び、エントロピー符号化を行うJPEGコーデック手段であって、
前記復号手段は、前記エントロピー符号化を行う前の係数に対して逆量子化、逆DCT、逆色変換を行う手段である
ことを特徴とする請求項1に記載の画像符号化装置。
The encoding means is a JPEG codec means for performing color conversion, DCT conversion, quantization, and entropy encoding in units of macroblocks,
The image decoding apparatus according to claim 1, wherein the decoding unit is a unit that performs inverse quantization, inverse DCT, and inverse color conversion on a coefficient before the entropy encoding.
前記LDR画像生成手段はマクロブロックを単位にLDR画像を生成し、
前記復号手段はマクロブロックを単位に復号し、
前記判定手段はマクロブロックが示す画像を単位に判定する
ことを特徴とする請求項2に記載の画像符号化装置。
The LDR image generation means generates an LDR image in units of macroblocks,
The decoding means decodes macroblocks as units,
The image coding apparatus according to claim 2, wherein the determination unit determines the image indicated by the macroblock in units.
前記判定手段は、
HDR画像における画素のうち、予め設定された輝度値より低い輝度を持つ画素が占める割合を求め、
当該割合が予め設定された閾値を超える場合、前記復号手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定し、
前記割合が予め設定された閾値以下の場合、前記LDR画像生成手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定する
ことを特徴とする請求項1乃至3のいずれか1項に記載の画像符号化装置。
The determination means includes
Find the proportion of pixels in the HDR image that are occupied by pixels with a luminance lower than a preset luminance value,
If the ratio exceeds a preset threshold, the LDR image obtained by the decoding unit is determined to be used by the auxiliary data generation unit,
The LDR image obtained by the LDR image generation unit is determined to be used by the auxiliary data generation unit when the ratio is equal to or less than a preset threshold value. The image encoding device described in 1.
前記LDR画像生成手段が生成する際に利用するトーンカーブとして、予め設定された固定のトーンカーブを用いるか、符号化対象のHDR画像内の最大輝度、最小輝度に依存したトーンカーブを用いるのかを設定する設定手段を更に有し、
前記判定手段は、
前記設定手段により符号化対象のHDR画像内の最大輝度、最小輝度に依存したトーンカーブを用いると設定された場合、前記復号手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定し、
前記設定手段により前記固定のトーンカーブを用いると設定された場合、前記LDR画像生成手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定する
ことを特徴とする請求項1乃至3のいずれか1項に記載の画像符号化装置。
Whether to use a preset fixed tone curve or a tone curve depending on the maximum luminance and the minimum luminance in the HDR image to be encoded as the tone curve used when the LDR image generation means generates It further has setting means for setting,
The determination means includes
When it is set by the setting means that the tone curve depending on the maximum luminance and the minimum luminance in the HDR image to be encoded is used, the LDR image obtained by the decoding means is determined to be used by the auxiliary data generation means And
4. If the setting unit sets the fixed tone curve to be used, the LDR image obtained by the LDR image generation unit is determined to be used by the auxiliary data generation unit. The image encoding device according to any one of the above.
前記LDR画像生成手段が生成する際のトーンマッピングとして、グローバルトーンマッピング、ローカルトーンマッピングのいずれを利用するかを設定する設定手段を更に有し、
前記判定手段は、
前記設定手段によりローカルトーンマッピングを利用すると設定された場合、前記復号手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定し、
前記設定手段によりグローバルトーンマッピングを利用すると設定された場合、前記LDR画像生成手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定する
ことを特徴とする請求項1乃至3のいずれか1項に記載の画像符号化装置。
A setting means for setting whether to use global tone mapping or local tone mapping as tone mapping when the LDR image generating means generates;
The determination means includes
If it is set by the setting means to use local tone mapping, the LDR image obtained by the decoding means is determined to be used by the auxiliary data generation means,
4. The LDR image obtained by the LDR image generation unit is determined to be used by the auxiliary data generation unit when it is set by the setting unit to use global tone mapping. 5. The image encoding device according to claim 1.
前記判定手段は、
前記符号化手段における量子化で用いる量子化ステップが予め設定された値を超える場合、前記復号手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定し、
前記符号化手段における量子化で用いる量子化ステップが前記予め設定された値以下である場合、前記LDR画像生成手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定する
ことを特徴とする請求項2又は3に記載の画像符号化装置。
The determination means includes
If the quantization step used for quantization in the encoding means exceeds a preset value, the LDR image obtained by the decoding means is determined to be used by the auxiliary data generation means,
When the quantization step used for quantization in the encoding means is equal to or less than the preset value, the LDR image obtained by the LDR image generation means is determined to be used by the auxiliary data generation means. The image encoding device according to claim 2 or 3.
前記判定手段は、
前記符号化手段における色変換による色差成分について間引きが存在する場合、前記復号手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定し、
前記符号化手段における色変換による色差成分について間引きが存在しない場合、前記LDR画像生成手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定する
ことを特徴とする請求項2又は3に記載の画像符号化装置。
The determination means includes
If there is a thinning out of the color difference component due to color conversion in the encoding means, the LDR image obtained by the decoding means is determined to be used by the auxiliary data generating means,
The LDR image obtained by the LDR image generation unit is determined to be used by the auxiliary data generation unit when there is no thinning out of the color difference component due to color conversion in the encoding unit. The image encoding device described in 1.
前記判定手段は、
前記DCTを行って得た係数と、前記復号手段による逆量子化後の係数との差分を求め、当該差分の絶対値が予め設定した値を超える個数の占める割合と、予め設定された閾値とを比較し、
前記割合が前記閾値より大きい場合、前記復号手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定し、
前記割合が前記閾値以下の場合、前記LDR画像生成手段で得たLDR画像を前記補助データ生成手段により利用するものとして決定する
ことを特徴とする請求項2又は3に記載の画像符号化装置。
The determination means includes
The difference between the coefficient obtained by performing the DCT and the coefficient after inverse quantization by the decoding means is obtained, the ratio of the number of the absolute value of the difference exceeding a preset value, and a preset threshold value, Compare
If the ratio is greater than the threshold, the LDR image obtained by the decoding means is determined to be used by the auxiliary data generation means,
The image coding apparatus according to claim 2 or 3, wherein when the ratio is equal to or less than the threshold value, the LDR image obtained by the LDR image generation unit is determined to be used by the auxiliary data generation unit.
前記量子化で用いる量子化ステップに基づいて、前記DCTが行うマクロブロックにおける、前記割合を求める範囲を決定する手段を更に有する
ことを特徴とする請求項9に記載の画像符号化装置。
The image coding apparatus according to claim 9, further comprising means for determining a range for obtaining the ratio in a macroblock performed by the DCT based on a quantization step used in the quantization.
HDR画像を符号化し、LDR画像をHDR画像の精度に戻すための補助データを生成する画像符号化装置の制御方法であって、
符号化対象のHDR画像からLDR画像を生成するLDR画像生成工程と、
生成したLDR画像を非可逆符号化する符号化工程と、
符号化したLDR画像を復号する復号工程と、
HDR画像とLDR画像に基づき、LDR画像をHDR画像の精度に戻すための補助データを生成する補助データ生成工程と、
前記補助データ生成工程が利用するLDR画像として、前記LDR画像生成手段が生成したLDR画像、前記復号工程による復号で得たLDR画像のいずれを用いるかを判定する判定工程と
を有することを特徴とする画像符号化装置の制御方法。
A control method of an image encoding device for generating auxiliary data for encoding an HDR image and returning an LDR image to the accuracy of the HDR image,
An LDR image generation step of generating an LDR image from the HDR image to be encoded;
An encoding step of irreversibly encoding the generated LDR image;
A decoding step of decoding the encoded LDR image;
An auxiliary data generation step for generating auxiliary data for returning the LDR image to the accuracy of the HDR image based on the HDR image and the LDR image;
A determination step of determining which one of the LDR image generated by the LDR image generation means and the LDR image obtained by decoding in the decoding step is used as the LDR image used in the auxiliary data generation step. Control method for an image encoding device.
コンピュータが読み込み実行することで、前記コンピュータを、請求項1乃至10のいずれか1項に記載の各手段として機能させるためのプログラム。   The program for functioning the said computer as each means of any one of Claims 1 thru | or 10 when a computer reads and executes.
JP2016203813A 2016-10-17 2016-10-17 Image coding device and its control method Active JP6867774B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016203813A JP6867774B2 (en) 2016-10-17 2016-10-17 Image coding device and its control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016203813A JP6867774B2 (en) 2016-10-17 2016-10-17 Image coding device and its control method

Publications (3)

Publication Number Publication Date
JP2018067758A true JP2018067758A (en) 2018-04-26
JP2018067758A5 JP2018067758A5 (en) 2019-11-14
JP6867774B2 JP6867774B2 (en) 2021-05-12

Family

ID=62087372

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016203813A Active JP6867774B2 (en) 2016-10-17 2016-10-17 Image coding device and its control method

Country Status (1)

Country Link
JP (1) JP6867774B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020096326A (en) * 2018-12-14 2020-06-18 キヤノン株式会社 Imaging device, control method thereof, and program

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011509536A (en) * 2008-01-04 2011-03-24 シャープ株式会社 Method and apparatus for determining inter-layer image prediction parameters
JP2015019287A (en) * 2013-07-11 2015-01-29 キヤノン株式会社 Image decoder and control method of the same
JP2015019286A (en) * 2013-07-11 2015-01-29 キヤノン株式会社 Image encoder and decoder and control method of these, and image processing system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011509536A (en) * 2008-01-04 2011-03-24 シャープ株式会社 Method and apparatus for determining inter-layer image prediction parameters
JP2015019287A (en) * 2013-07-11 2015-01-29 キヤノン株式会社 Image decoder and control method of the same
JP2015019286A (en) * 2013-07-11 2015-01-29 キヤノン株式会社 Image encoder and decoder and control method of these, and image processing system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
鈴木 亮 ほか3名: "量子化誤差の影響を考慮したJPEG XTエンコーダー", 電子情報通信学会技術研究報告, vol. 第115巻、第348号, JPN6020049798, 26 November 2015 (2015-11-26), pages 29 - 34, ISSN: 0004415246 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020096326A (en) * 2018-12-14 2020-06-18 キヤノン株式会社 Imaging device, control method thereof, and program
JP7129326B2 (en) 2018-12-14 2022-09-01 キヤノン株式会社 IMAGING DEVICE, CONTROL METHOD AND PROGRAM THEREOF

Also Published As

Publication number Publication date
JP6867774B2 (en) 2021-05-12

Similar Documents

Publication Publication Date Title
AU2014213524B2 (en) High dynamic range image generation and rendering
RU2740034C1 (en) Linear encoder for image / video processing
US7945115B2 (en) Visual processing device, visual processing method, visual processing program, and semiconductor device
US10873763B2 (en) Video compression techniques for high dynamic range data
CN108370405A (en) A kind of picture signal conversion process method, device and terminal device
US20080267495A1 (en) Image compressing method and image compressing apparatus
US10812832B2 (en) Efficient still image coding with video compression techniques
US20010012397A1 (en) Image processing apparatus and method
KR102475139B1 (en) Method for tone adapting an image to a target peak luminance lt of a target display device
EP3107301A1 (en) Method and device for encoding both a high-dynamic range frame and an imposed low-dynamic range frame
CN114467298B (en) Image signal conversion processing method and device and terminal equipment
JP3743389B2 (en) Image compression apparatus and image compression program
JP6867774B2 (en) Image coding device and its control method
KR20060133962A (en) Method and apparatus for scalable single processing
JP6866224B2 (en) Image coding device, image decoding device, image coding method and program
WO2022151053A1 (en) Data processing method, apparatus and system, and computer storage medium
US10462478B2 (en) Method of video generation
JP2020092327A (en) Image encoding device, image encoding method, and program
US20110103705A1 (en) Image encoding method and apparatus, and image decoding method and apparatus
JP6838951B2 (en) Coding device and coding method
CN116886917A (en) Gain map encoding method, decoding method, device, equipment and medium
JP2015170932A (en) Image compression apparatus and image compression method

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20191004

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20191004

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20201215

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210104

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20210103

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210113

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210302

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: 20210312

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210409

R151 Written notification of patent or utility model registration

Ref document number: 6867774

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151