summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Sun <sunyi@freedesktop.org>2015-03-18 20:44:51 -0700
committerYi Sun <sunyi@freedesktop.org>2015-03-18 20:44:51 -0700
commit749919fdff9049674a92a360df5cb71481a4cea4 (patch)
tree9fb0b7a5b549a8d621f36d5db578e255239f709d
Init commit.
Signed-off-by: Yi Sun <sunyi@freedesktop.org>
-rw-r--r--doc/ApiReference.ja335
-rw-r--r--doc/HackingGuide.ja132
-rw-r--r--doc/LGPL504
-rw-r--r--doc/README86
-rw-r--r--git-daemon-export-ok0
-rw-r--r--img/01-1.jpgbin0 -> 23484 bytes
-rw-r--r--img/01-2.jpgbin0 -> 19601 bytes
-rw-r--r--img/01-3.jpgbin0 -> 126151 bytes
-rw-r--r--img/01-4.jpgbin0 -> 112411 bytes
-rw-r--r--img/02-1.jpgbin0 -> 15711 bytes
-rw-r--r--img/02-2.jpgbin0 -> 19652 bytes
-rw-r--r--img/02-3.jpgbin0 -> 101669 bytes
-rw-r--r--img/02-4.jpgbin0 -> 87936 bytes
-rw-r--r--img/03-1.jpgbin0 -> 16887 bytes
-rw-r--r--img/03-2.jpgbin0 -> 16601 bytes
-rw-r--r--img/03-3.jpgbin0 -> 99917 bytes
-rw-r--r--img/03-4.jpgbin0 -> 98049 bytes
-rw-r--r--img/04-1.jpgbin0 -> 24455 bytes
-rw-r--r--img/04-2.jpgbin0 -> 23674 bytes
-rw-r--r--img/04-3.jpgbin0 -> 120839 bytes
-rw-r--r--img/04-4.jpgbin0 -> 109542 bytes
-rw-r--r--img/05-1.jpgbin0 -> 20848 bytes
-rw-r--r--img/05-2.jpgbin0 -> 18817 bytes
-rw-r--r--img/05-3.jpgbin0 -> 133870 bytes
-rw-r--r--img/05-4.jpgbin0 -> 128223 bytes
-rw-r--r--img/06-1.jpgbin0 -> 21055 bytes
-rw-r--r--img/06-2.jpgbin0 -> 20833 bytes
-rw-r--r--img/06-3.jpgbin0 -> 120508 bytes
-rw-r--r--img/06-4.jpgbin0 -> 114543 bytes
-rw-r--r--img/125.bmpbin0 -> 230456 bytes
-rw-r--r--img/qr.pngbin0 -> 808 bytes
-rw-r--r--src/Makefile.in45
-rwxr-xr-xsrc/configure5620
-rw-r--r--src/configure.in128
-rwxr-xr-xsrc/install-sh294
-rw-r--r--src/libdecodeqr/Makefile.in65
-rw-r--r--src/libdecodeqr/bitstream.cpp147
-rw-r--r--src/libdecodeqr/bitstream.h48
-rw-r--r--src/libdecodeqr/codedata.cpp506
-rw-r--r--src/libdecodeqr/codedata.h95
-rw-r--r--src/libdecodeqr/container.cpp288
-rw-r--r--src/libdecodeqr/container.h175
-rw-r--r--src/libdecodeqr/decodeqr.h286
-rw-r--r--src/libdecodeqr/ecidecoder.cpp341
-rw-r--r--src/libdecodeqr/ecidecoder.h110
-rw-r--r--src/libdecodeqr/formatinfo.cpp195
-rw-r--r--src/libdecodeqr/formatinfo.h113
-rw-r--r--src/libdecodeqr/galois.cpp593
-rw-r--r--src/libdecodeqr/galois.h134
-rw-r--r--src/libdecodeqr/imagereader.cpp1099
-rw-r--r--src/libdecodeqr/imagereader.h127
-rw-r--r--src/libdecodeqr/libdecodeqr.cpp195
-rw-r--r--src/libdecodeqr/libdecodeqr.dep80
-rw-r--r--src/libdecodeqr/libdecodeqr.dsp160
-rw-r--r--src/libdecodeqr/libdecodeqr.dsw29
-rw-r--r--src/libdecodeqr/libdecodeqr.mak245
-rw-r--r--src/libdecodeqr/qrerror.h40
-rw-r--r--src/libdecodeqr/qrtypes.h42
-rw-r--r--src/libdecodeqr/version.h42
-rw-r--r--src/sample/Makefile.in36
-rw-r--r--src/sample/simple/Makefile.in41
-rw-r--r--src/sample/simple/simple.dep15
-rw-r--r--src/sample/simple/simple.dsp105
-rw-r--r--src/sample/simple/simple.dsw41
-rw-r--r--src/sample/simple/simple.mak186
-rw-r--r--src/sample/simple/simpletest.cpp70
-rw-r--r--src/sample/webcam/Makefile.in41
-rw-r--r--src/sample/webcam/webcam.cpp196
-rw-r--r--src/sample/webcam/webcam.dep15
-rw-r--r--src/sample/webcam/webcam.dsp105
-rw-r--r--src/sample/webcam/webcam.dsw41
-rw-r--r--src/sample/webcam/webcam.mak186
-rw-r--r--src/test/Makefile.in44
-rw-r--r--src/test/test_codedata.cpp72
-rw-r--r--src/test/test_galois.cpp52
75 files changed, 13545 insertions, 0 deletions
diff --git a/doc/ApiReference.ja b/doc/ApiReference.ja
new file mode 100644
index 0000000..3dafc40
--- /dev/null
+++ b/doc/ApiReference.ja
@@ -0,0 +1,335 @@
+= API =
+[[TOC(inline,depth=3)]]
+
+== 型および構造体 ==
+
+=== QrDecoderHandle ===
+{{{
+typedef void * QrDecoderHandle;
+}}}
+
+QRデコーダハンドル
+
+=== QrCodeHeader ===
+{{{
+typedef struct{
+ int model; // モデル番号
+ int version; // 型番
+ int level; // 誤り訂正レベル
+ //int mode; // 本文モード (未実装)
+ //int eci_mode; // 本文ECIモード (未実装)
+ int charactor_size; // 本文文字数
+ int byte_size; // 本文バイト数
+} QrCodeHeader;
+}}}
+
+QRコードヘッダ構造体
+
+== コンストラクタ ==
+
+=== qr_decoder_open ===
+{{{
+QrDecoderHandle qr_decoder_open();
+}}}
+
+ * 引数: なし
+ * 戻り値: QRデコーダハンドル
+
+デコーダを初期化する。
+
+=== qr_decoder_open_with_image_size ===
+{{{
+QrDecoderHandle qr_decoder_open_with_image_size(
+ int width,
+ int height,
+ int depth,
+ int channel
+);
+}}}
+
+ * 引数:
+ * int width : 画像バッファの幅(pixel)
+ * int height : 画像バッファの高さ(pixel)
+ * int depth : 画像バッファのピクセルあたりのbit数
+ * int channel : 画像バッファのチャンネル数
+ * 戻り値: QRデコーダハンドル
+
+画像バッファの幅,高さ,ピクセルあたりのbit数,チャンネル数を指定してデコーダを初期化する。[[BR]]
+ピクセルあたりのbit数はIPL_DEPTH_8UなどOpenCVの定数を指定する。[[BR]]
+一般的な24bitフルカラー画像では depth = IPL_DEPTH_8U, channel = 3 と指定する。
+
+入力画像のサイズが既知の場合,バッファサイズを指定してデコーダを初期化することで,バッファ確保にかかるオーバーヘッドを低減できる。
+
+== デストラクタ ==
+=== qr_decoder_close ===
+{{{
+void qr_decoder_close(QrDecoderHandle decoder);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * 戻り値:なし
+
+デコーダ内の各バッファを破壊し終了処理を行う。
+
+== バッファ初期化 ==
+
+Webカメラからの入力など,フォーマットの一定した画像を連続で扱う際に使用する。
+
+=== qr_decoder_set_image_size ===
+{{{
+qr_decoder_set_image_size(
+ QrDecoderHandle decoder,
+ int width,
+ int height,
+ int depth,
+ int channel
+);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * int width : 画像バッファの幅(pixel)
+ * int height : 画像バッファの高さ(pixel)
+ * int depth : 画像バッファのピクセルあたりのbit数
+ * int channel : 画像バッファのチャンネル数
+ * 戻り値: QRデコーダハンドル
+
+デコーダの入力画像バッファの幅,高さ,ピクセルあたりのbit数,チャンネル数を指定する。[[BR]]
+qr_decoder_open()で初期化したデコーダのバッファのサイズ指定,およびqr_decoder_open_with_image_size()で初期化したデコーダのバッファサイズの再指定を行う。
+
+=== qr_decoder_set_image_buffer ===
+{{{
+QrDecoderHandle qr_decoder_set_image_buffer(
+ QrDecoderHandle decoder,
+ IplImage *src
+);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * !IplImage *src : 画像バッファへのポインタ
+ * 戻り値: QRデコーダハンドル
+
+srcとして指定したIplImage形式の画像バッファをデコーダの画像バッファとする。[[BR]]
+指定するバッファはtop-left origin (src->origin==0)で無ければならない。[[BR]]
+bottom-left origin (src->origin==1)の場合は,highguiのcvConvertImage()などでtop-left originに変換すること。
+
+IplImageの構造は[http://opencvlibrary.sourceforge.net/CxCore#head-b9f1e08636cc1f2bc532f3970cc41deaf5eedd9b OpenCVのマニュアル]を参照のこと。
+
+== バッファ取得 ==
+=== qr_decoder_get_image_buffer ===
+{{{
+IplImage *qr_decoder_get_image_buffer(QrDecoderHandle decoder);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * 戻り値: IplImage型のバッファへのポインタ
+
+qr_decoder_open_with_image_size(), qr_decoder_set_image_size()およびqr_decoder_set_image()で設定された原画像を格納するバッファのアドレスを取得する。
+
+=== qr_decoder_get_transformed_image_buffer ===
+{{{
+IplImage *qr_decoder_get_transformed_image_buffer(QrDecoderHandle decoder);
+}}}
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * 戻り値: IplImage型のバッファへのポインタ
+
+歪み補正済みカラー画像を格納するバッファのアドレスを取得する。(デバッグ用)
+
+=== qr_decoder_get_binarized_image_buffer ===
+{{{
+IplImage *qr_decoder_get_binarized_image_buffer(QrDecoderHandle decoder);
+}}}
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * 戻り値: IplImage型のバッファへのポインタ
+
+二値画像を格納するバッファのアドレスを取得する。(デバッグ用)
+
+=== qr_decoder_get_tmp_image_buffer ===
+{{{
+IplImage *qr_decoder_get_tmp_image_buffer(QrDecoderHandle decoder);
+}}}
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * 戻り値: IplImage型のバッファへのポインタ
+
+ワークバッファのアドレスを取得する。(デバッグ用)
+
+== デコード ==
+=== qr_decoder_decode ===
+{{{
+short qr_decoder_decode(
+ QrDecoderHandle decoder,
+ int adaptive_th_size=DEFAULT_ADAPTIVE_TH_SIZE,
+ int adaptive_th_delta=DEFAULT_ADAPTIVE_TH_DELTA
+);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * int adaptive_th_size : 動的二値化処理ブロックサイズ
+ * int adaptive_th_delta : 動的二値化処理差分閾値
+ * 戻り値: デコード結果ステータス
+
+初期化済みバッファの内容をデコードする。[[BR]]
+adaptive_th_sizeは3以上の奇数または0以下の値を指定すること。[[BR]]
+adaptive_th_sizeに0以下の値を指定したときは,adaptive_th_deltaを閾値とする固定二値化処理が行われる。
+
+デコード結果ステータスは[source:/trunk/src/libdecodeqr/qrerror.h#latest qrerror.h]で定義された値のうち該当するものをOR処理したものとなる。
+
+ex)
+ * デコード成功時: QR_IMAGEREADER_DECODED
+ * デコードには成功したが本文に修復不能なエラーが含まれていたとき: QR_IMAGEREADER_DECODED|QR_CODEDATA_UNRECOVERABLE
+ * 画像からQRコードを特定できずデコードに失敗したとき: QR_IMAGEREADER_ERROR|QR_IMAGEREADER_NOT_FOUND_FINDER_PATTERN
+
+
+=== qr_decoder_decode_image ===
+{{{
+short qr_decoder_decode_image(
+ QrDecoderHandle decoder,
+ IplImage *src,
+ int adaptive_th_size=DEFAULT_ADAPTIVE_TH_SIZE,
+ int adaptive_th_delta=DEFAULT_ADAPTIVE_TH_DELTA
+);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * !IplImage *src : 画像バッファへのポインタ
+ * int adaptive_th_size : 動的二値化処理ブロックサイズ
+ * int adaptive_th_delta : 動的二値化処理差分閾値
+ * 戻り値: デコード結果ステータス。
+
+srcに与えられた画像をデコードする。
+
+srcとして指定したIplImage形式の画像バッファをデコーダの画像バッファとする。[[BR]]
+指定するバッファはtop-left origin (src->origin==0)で無ければならない。[[BR]]
+bottom-left origin (src->origin==1)の場合は,highguiのcvConvertImage()などでtop-left originに変換すること。
+
+== デコード済みデータ取得 ==
+=== qr_decoder_get_header ===
+{{{
+int qr_decoder_get_header(
+ QrDecoderHandle decoder,
+ QrCodeHeader *header
+);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * !QrCodeHeader *header : QRコードヘッダ構造体を格納するバッファへのポインタ
+ * 戻り値: 失敗時:0,成功時:1
+
+QRコードヘッダ構造体を取得し,headerに指定されたバッファに格納する。
+
+
+=== qr_decoder_get_body ===
+{{{
+int qr_decoder_get_body(
+ QrDecoderHandle decoder,
+ unsigned char *buf,
+ int buf_size
+);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * unsigned char *buf : QRコード本文を格納するバッファへのポインタ
+ * int buf_size : バッファサイズ(byte)
+ * 戻り値: 失敗時:0,成功時:格納された本文のbyte数
+
+QRコード本文を取得し,bufに指定されたバッファに格納する。
+
+格納された本文には,その形式に関わらず,終端文字'\0'が'''追加されない'''。[[BR]]
+ただしバッファは事前に0クリアされるので,qr_decoder_get_header()で取得できる本文のbyte数より大きなサイズのバッファを用意することで終端文字のかわりとできる。
+
+== デコーダ状態取得 ==
+=== qr_decoder_get_status ===
+{{{
+short qr_decoder_get_status(QrDecoderHandle decoder);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * 戻り値: ステータスコード
+
+ステータスは[source:/trunk/src/libdecodeqr/qrerror.h#latest qrerror.h]で定義された値のうち該当するものをOR処理したものとなる。
+
+=== qr_decoder_is_busy ===
+{{{
+int qr_decoder_is_busy(QrDecoderHandle decoder);
+}}}
+
+ * 引数:
+ * !QrDecoderHandle decoder : QRデコーダハンドル
+ * 戻り値: デコード中:1, アイドル:0
+
+デコード実行中か否かの状態を戻す。
+
+== バージョン情報 ==
+バージョン情報は "Major.Minor.Teeny Suffix (Revision)" から構成され,Major, Minor, Teenyはリリース時に更新される。[[BR]]
+開発中バージョンは,時期リリース予定の"Major.Minor.Teeny"のあとにSuffixとして"-dev"を付加し,開発中バージョン間は Revisionで区別する。
+
+=== qr_decoder_version ===
+{{{
+char *qr_decoder_version();
+}}}
+
+ * 引数: なし
+ * 戻り値: バージョン情報 (文字列)へのポインタ
+
+=== qr_decoder_version_major ===
+{{{
+int qr_decoder_version_major();
+}}}
+
+ * 引数: なし
+ * 戻り値: メジャーバージョン
+
+=== qr_decoder_version_minor ===
+{{{
+int qr_decoder_version_minor();
+}}}
+
+ * 引数: なし
+ * 戻り値: マイナーバージョン
+
+=== qr_decoder_version_teeny ===
+{{{
+int qr_decoder_version_teeny();
+}}}
+
+ * 引数: なし
+ * 戻り値: ティニアバージョン
+
+
+=== qr_decoder_version_suffix ===
+{{{
+char *qr_decoder_version_suffix();
+}}}
+
+ * 引数: なし
+ * 戻り値: バージョンサフィックス(文字列)へのポインタ
+
+=== qr_decoder_version_revision ===
+{{{
+char *qr_decoder_version_revision();
+}}}
+
+ * 引数: なし
+ * 戻り値: リビジョン情報(文字列)へのポインタ
+
+----
+{{{
+#!html
+<div style='text-align:right'>
+}}}
+Last-modified: [[LastModified]]
+{{{
+#!html
+</div>
+}}}
diff --git a/doc/HackingGuide.ja b/doc/HackingGuide.ja
new file mode 100644
index 0000000..8c70290
--- /dev/null
+++ b/doc/HackingGuide.ja
@@ -0,0 +1,132 @@
+= Hacking Guide =
+覚え書きなど
+
+== 認識アルゴリズム ==
+''FIXME''
+
+== BCHおよびリードソロモン復号 ==
+JIS X 0510に書いてあるデコード方法を使うよりは普通にピーターソン法で解いた方が楽。
+特に「附属書B 誤り訂正復号手順」は誤訳も多く,わざとわかりにくく書いてあるとしか思えない。
+
+型番情報および形式情報のBCH復号は,ピーターソン法で誤り位置を求め,求まった位置のbitを反転するだけ。
+
+本文の復号は,ピーターソン法でm個の誤り位置J(0)~J(m-1)を検出した後,エラーシンドロームS(n)が
+
+{{{
+S(n) = Σ{r(i) * a(n*i)}
+ = Σ{s(i) * a(n*i)} + Σ{e(J(x)) * a(J(x)*n)}
+ = Σ{e(J(x)) * a(J(x)*n)}
+
+ ただし
+ r(x): 末尾からx byte目の受信データ
+ s(x): 末尾からx byte目の送信データ
+ e(x): 末尾からx byte目のエラーの大きさ
+ a(x): GF(2^8)の指数表現xの元
+}}}
+
+となることを利用して連立方程式
+
+{{{
+e(J(0)) + ... + e(J(m-1)) = S(0)
+e(J(0)) * a(J(0)) + ... + e(J(m-1)) * a(J(m-1)) = S(1)
+ :
+e(J(0)) * a(J(0) * (m-1)) + ... + e(J(m-1)) * a(J(m-1) * (m-1)) = S(m-1)
+}}}
+
+を解いてe(J(0))~e(J(m-1))を求め,求まった値をr(J(x))に加算することで行える。
+
+{{{
+r(x) = s(x) + e(x)
+s(x) = r(x) - e(x)
+
+ガロア体では減算と加算は等価だから
+
+s(x) = r(x) + e(x)
+}}}
+
+本来GF(n^m)のリードソロモンはデータ長がn^m-1である必要があるが,未使用の上位桁を0で埋めることによりデータ長を縮小することができる。JIS X 0510の表12~18で定義されている「RSブロック」はこれを利用してデータ長(総コード長)を縮小しているものと考えられる(ただし未検証)。[[BR]]
+リードソロモン復号を既存のライブラリ(ex. http://www.ka9q.net/code/fec/ など)に置き換える場合には,上位byteを0パディングしてデータ長を255byteにしなければならない可能性がある。
+
+== 内部構造 ==
+いいかげんなクラス図:[[BR]]
+[[Image(class_diagram.png)]]
+
+=== Qr ===
+==== ImageReader ====
+画像解析クラス
+ * [source:/trunk/src/libdecodeqr/imagereader.h#latest imagereader.h]
+ * [source:/trunk/src/libdecodeqr/imagereader.cpp#latest imagereader.cpp]
+
+==== Qr ====
+QRコード (Iterator)
+
+ * [source:/trunk/src/libdecodeqr/container.h#latest container.h]
+ * [source:/trunk/src/libdecodeqr/container.cpp#latest container.cpp]
+
+==== FormatInfo ====
+形式情報 (Iterator)
+
+ * [source:/trunk/src/libdecodeqr/formatinfo.h#latest formatinfo.h]
+ * [source:/trunk/src/libdecodeqr/formatinfo.cpp#latest formatinfo.cpp]
+
+==== PattarnMaker ====
+マスクパターン生成抽象クラス
+ * [source:/trunk/src/libdecodeqr/formatinfo.h#latest formatinfo.h]
+ * [source:/trunk/src/libdecodeqr/formatinfo.cpp#latest formatinfo.cpp]
+
+==== PattarnMaker000 ====
+==== PattarnMaker001 ====
+==== PattarnMaker010 ====
+==== PattarnMaker011 ====
+==== PattarnMaker100 ====
+==== PattarnMaker101 ====
+==== PattarnMaker110 ====
+==== PattarnMaker111 ====
+
+==== CodeData ====
+QRコード本文 (Iterator)
+ * [source:/trunk/src/libdecodeqr/codedata.h#latest codedata.h]
+ * [source:/trunk/src/libdecodeqr/codedata.cpp#latest codedata.cpp]
+
+==== CodeBlock ====
+QRコード本文リードソロモンデータブロック (Iterator)
+ * [source:/trunk/src/libdecodeqr/codedata.h#latest codedata.h]
+ * [source:/trunk/src/libdecodeqr/codedata.cpp#latest codedata.cpp]
+
+==== BitStream ====
+bit処理用疑似IO
+ * [source:/trunk/src/libdecodeqr/bitstream.h#latest bitstream.h]
+ * [source:/trunk/src/libdecodeqr/bitstream.cpp#latest bitstream.cpp]
+
+==== ECI ====
+ECI構造体デコードモジュール
+ * [source:/trunk/src/libdecodeqr/ecidecoder.h#latest ecidecoder.h]
+ * [source:/trunk/src/libdecodeqr/ecidecoder.cpp#latest ecidecoder.cpp]
+
+===== Decoder =====
+===== NumericalDecoder =====
+===== AlphabeticalDecoder =====
+===== ByteDecoder =====
+===== GenericDecoder =====
+===== KanjiDecoder =====
+
+=== Galois ===
+ガロア体演算パッケージ
+ * [source:/trunk/src/libdecodeqr/galois.h#latest galois.h]
+ * [source:/trunk/src/libdecodeqr/galois.cpp#latest galois.cpp]
+
+==== Field ====
+ガロア体母集合 (Flyweight Factory)
+
+同じ生成多項式を持つNomialを全て格納
+
+==== Nomial ====
+ガロア体要素 (Flyweight)
+
+オブジェクトはFieldクラス生成時に生成される
+
+==== Polynomial ====
+ガロア体多項式および行列
+
+==== BCH ====
+BCH演算
diff --git a/doc/LGPL b/doc/LGPL
new file mode 100644
index 0000000..5ab7695
--- /dev/null
+++ b/doc/LGPL
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/doc/README b/doc/README
new file mode 100644
index 0000000..ce5ce76
--- /dev/null
+++ b/doc/README
@@ -0,0 +1,86 @@
+= libdecodeqr =
+
+== Whta's this? ==
+"libdecodeqr" is a C/C++ library for docoding QR code, which based on JIS X 0510 and ISO/IEC18004.
+
+This library is able to decode miscellaneous images those are taken with a file, with a webcam, with a scanner, and so on.
+
+== Features ==
+ * Supports miscellaneous image formats and input devices.
+ * Hi-Speed decoding.
+ * Completely Free.
+
+== Requirements ==
+ * g++ / VC++6
+ * [http://www.sourceforge.net/projects/opencvlibrary/ OpenCV] 0.9.7 or later
+ * Gtk2 for UN*X (required by OpenCV)
+
+== Download ==
+=== Binary Release ===
+Sorry, Not available yet.
+
+=== Latest Stable Source Code ===
+ * version 0.9.3 http://http://trac.koka-in.org/libdecodeqr/attachment/wiki/WikiStart/libdecodeqr-0.9.3.tar.bz2
+
+=== Latest Development Source Code ===
+We use Subversion for source revision control and code sharing.
+
+{{{
+ svn co svn://svn.koka-in.org/libdecodeqr/trunk
+}}}
+
+== How to use ==
+=== Build and Intstall ===
+see BuildAndInstall for detail.
+
+==== Windows ====
+ 1. open $(archive_dir)/src/libdecodeqr/libdecodeqr.dsw
+ 1. build the project (press [F7] key)
+or
+ 1. start command prompt
+ 1. run VCVARS32.BAT
+ 1. nmake libdecodeqr.mak
+
+The Libraly file and header files are NOT installed automaticaly.
+After building, set places of decodeqr.h, qrtypes.h, qrerror.h and libdecodeqr.lib to your environments if you need.
+
+==== UN*X ====
+ 1. $ cd $(archive_dir)/src/
+ 1. $ ./configure
+ 1. $ make
+ 1. $ sudo make install
+
+=== API Reference ===
+see ApiReference
+
+=== Sample Codes ===
+ * [source:trunk/src/sample/simple/simpletest.cpp#latest simple usage]
+ * [source:trunk/src/sample/webcam/webcam.cpp#latest with webcam]
+
+== How to Hack ==
+see HackingGuide
+
+== Contact Us ==
+=== Web Page ===
+http://trac.koka-in.org/libdecodeqr
+
+=== Mailing List ===
+mailto:libdecodeqr@koka-in.org
+
+To subscribe this list, please send the following phrase
+{{{
+subscribe Your-Last-Name Your-First-Name
+}}}
+e.g.
+{{{
+subscribe NISHI Takao
+}}}
+in the mail body (not subject) to the address <libdecodeqr-ctl@koka-in.org>.
+
+== Copying ==
+Copyright (c) 2007 NISHI Takao <zophos@koka-in.org>,
+JMA (Japan Medical Association) and
+!NaCl (Network Applied Communication Laboratory Ltd.) All rights reserved.[[BR]]
+This is free software with ABSOLUTELY NO WARRANTY.
+
+You can redistribute and/or modify it under the terms of LGPL.
diff --git a/git-daemon-export-ok b/git-daemon-export-ok
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/git-daemon-export-ok
diff --git a/img/01-1.jpg b/img/01-1.jpg
new file mode 100644
index 0000000..6990be7
--- /dev/null
+++ b/img/01-1.jpg
Binary files differ
diff --git a/img/01-2.jpg b/img/01-2.jpg
new file mode 100644
index 0000000..d4107ed
--- /dev/null
+++ b/img/01-2.jpg
Binary files differ
diff --git a/img/01-3.jpg b/img/01-3.jpg
new file mode 100644
index 0000000..5d15780
--- /dev/null
+++ b/img/01-3.jpg
Binary files differ
diff --git a/img/01-4.jpg b/img/01-4.jpg
new file mode 100644
index 0000000..883c34e
--- /dev/null
+++ b/img/01-4.jpg
Binary files differ
diff --git a/img/02-1.jpg b/img/02-1.jpg
new file mode 100644
index 0000000..c1f4e82
--- /dev/null
+++ b/img/02-1.jpg
Binary files differ
diff --git a/img/02-2.jpg b/img/02-2.jpg
new file mode 100644
index 0000000..83e2311
--- /dev/null
+++ b/img/02-2.jpg
Binary files differ
diff --git a/img/02-3.jpg b/img/02-3.jpg
new file mode 100644
index 0000000..26b1628
--- /dev/null
+++ b/img/02-3.jpg
Binary files differ
diff --git a/img/02-4.jpg b/img/02-4.jpg
new file mode 100644
index 0000000..35f9c69
--- /dev/null
+++ b/img/02-4.jpg
Binary files differ
diff --git a/img/03-1.jpg b/img/03-1.jpg
new file mode 100644
index 0000000..0ef85a3
--- /dev/null
+++ b/img/03-1.jpg
Binary files differ
diff --git a/img/03-2.jpg b/img/03-2.jpg
new file mode 100644
index 0000000..2f9ad51
--- /dev/null
+++ b/img/03-2.jpg
Binary files differ
diff --git a/img/03-3.jpg b/img/03-3.jpg
new file mode 100644
index 0000000..dd6905b
--- /dev/null
+++ b/img/03-3.jpg
Binary files differ
diff --git a/img/03-4.jpg b/img/03-4.jpg
new file mode 100644
index 0000000..a7d5b36
--- /dev/null
+++ b/img/03-4.jpg
Binary files differ
diff --git a/img/04-1.jpg b/img/04-1.jpg
new file mode 100644
index 0000000..e09d847
--- /dev/null
+++ b/img/04-1.jpg
Binary files differ
diff --git a/img/04-2.jpg b/img/04-2.jpg
new file mode 100644
index 0000000..10b4b72
--- /dev/null
+++ b/img/04-2.jpg
Binary files differ
diff --git a/img/04-3.jpg b/img/04-3.jpg
new file mode 100644
index 0000000..d84d0ed
--- /dev/null
+++ b/img/04-3.jpg
Binary files differ
diff --git a/img/04-4.jpg b/img/04-4.jpg
new file mode 100644
index 0000000..a880f14
--- /dev/null
+++ b/img/04-4.jpg
Binary files differ
diff --git a/img/05-1.jpg b/img/05-1.jpg
new file mode 100644
index 0000000..955b97b
--- /dev/null
+++ b/img/05-1.jpg
Binary files differ
diff --git a/img/05-2.jpg b/img/05-2.jpg
new file mode 100644
index 0000000..88e7910
--- /dev/null
+++ b/img/05-2.jpg
Binary files differ
diff --git a/img/05-3.jpg b/img/05-3.jpg
new file mode 100644
index 0000000..deb0643
--- /dev/null
+++ b/img/05-3.jpg
Binary files differ
diff --git a/img/05-4.jpg b/img/05-4.jpg
new file mode 100644
index 0000000..22c3276
--- /dev/null
+++ b/img/05-4.jpg
Binary files differ
diff --git a/img/06-1.jpg b/img/06-1.jpg
new file mode 100644
index 0000000..667aa9d
--- /dev/null
+++ b/img/06-1.jpg
Binary files differ
diff --git a/img/06-2.jpg b/img/06-2.jpg
new file mode 100644
index 0000000..67148ba
--- /dev/null
+++ b/img/06-2.jpg
Binary files differ
diff --git a/img/06-3.jpg b/img/06-3.jpg
new file mode 100644
index 0000000..3216f9f
--- /dev/null
+++ b/img/06-3.jpg
Binary files differ
diff --git a/img/06-4.jpg b/img/06-4.jpg
new file mode 100644
index 0000000..aeec0fd
--- /dev/null
+++ b/img/06-4.jpg
Binary files differ
diff --git a/img/125.bmp b/img/125.bmp
new file mode 100644
index 0000000..62416b6
--- /dev/null
+++ b/img/125.bmp
Binary files differ
diff --git a/img/qr.png b/img/qr.png
new file mode 100644
index 0000000..b65fb34
--- /dev/null
+++ b/img/qr.png
Binary files differ
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..617d14a
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,45 @@
+#
+# Makefile.in -- a part of libdecodeqr
+#
+# Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+# JMA (Japan Medical Association)
+# NaCl (Network Applied Communication Laboratory Ltd.)
+#
+# This is free software with ABSOLUTELY NO WARRANTY.
+# You can redistribute and/or modify it under the terms of LGPL.
+#
+# $Id: Makefile 20 2006-11-20 03:26:52Z zophos $
+#
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+includedir = @includedir@
+
+MAJOR=@MAJOR@
+MINOR=@MINOR@
+TEENY=@TEENY@
+
+CXX=@CXX@
+CPPFLAGS=@CPPFLAGS@ @CXXFLAGS@
+AR=@AR@
+LD=@LD@
+LDFLAGS=@LDFLAGS@
+LIBCV=@LIBCV@
+LIBHIGHGUI=@LIBHIGHGUI@
+INSTALL=@INSTALL@
+
+export prefix exec_prefix libdir includedir MAJOR MINOR TEENY CXX CPPFLAGS AR ARFLAGS LD LDFLAGS LIBCV LIBHIGHGUI INSTALL
+
+dirs:=libdecodeqr @SAMPLE@
+.PHONY: $(dirs)
+
+all: $(dirs)
+
+$(dirs):
+ cd $@ && $(MAKE)
+
+install: $(dirs)
+ for x in $(dirs); do cd $$x && $(MAKE) install && cd ../;done
+
+clean:
+ for x in $(dirs); do cd $$x && $(MAKE) clean && cd ../;done
diff --git a/src/configure b/src/configure
new file mode 100755
index 0000000..3a02f12
--- /dev/null
+++ b/src/configure
@@ -0,0 +1,5620 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61 for libdecodeqr package.
+#
+# Report bugs to <zophos@koka-in.org>.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME='libdecodeqr'
+PACKAGE_TARNAME='libdecodeqr'
+PACKAGE_VERSION='package'
+PACKAGE_STRING='libdecodeqr package'
+PACKAGE_BUGREPORT='zophos@koka-in.org'
+
+ac_unique_file="$srcdir/libdecodeqr/imagereader.cpp"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+CXX
+CXXFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CXX
+EXEEXT
+OBJEXT
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+AR
+LD
+LN
+LIBCV
+SAMPLE
+LIBHIGHGUI
+CXXCPP
+GREP
+EGREP
+MAJOR
+MINOR
+TEENY
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CXX
+CXXFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CCC
+CXXCPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+ eval enable_$ac_feature=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+ eval enable_$ac_feature=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+ eval with_$ac_package=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+ eval with_$ac_package=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures libdecodeqr package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/libdecodeqr]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of libdecodeqr package:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-optimize turn off debug information (CC -g option).
+ --enable-sample build sample programs.
+ --enable-debugmessage turn on debug message.
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-cv=NAME specify libcv (eg, cv0.9.7)
+ --with-highgui=NAME specify libhighgui (eg, highgui0.9.7)
+
+Some influential environment variables:
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CXXCPP C++ preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <zophos@koka-in.org>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" || continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+libdecodeqr configure package
+generated by GNU Autoconf 2.61
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by libdecodeqr $as_me package, which was
+generated by GNU Autoconf 2.61. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+# Checks for programs.
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+#
+# Check if don't want -g option
+#
+# Check whether --enable-optimize was given.
+if test "${enable_optimize+set}" = set; then
+ enableval=$enable_optimize; enable_optimize=$enableval
+else
+ enable_optimize=no
+fi
+
+if test x"$enable_optimize" = xyes; then
+ CXXFLAGS="$CXXFLAGS -O2"
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5
+echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5
+echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CXXFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ld; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$LD"; then
+ ac_cv_prog_LD="$LD" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_LD="${ac_tool_prefix}ld"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+LD=$ac_cv_prog_LD
+if test -n "$LD"; then
+ { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LD"; then
+ ac_ct_LD=$LD
+ # Extract the first word of "ld", so it can be a program name with args.
+set dummy ld; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_LD"; then
+ ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_LD="ld"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LD=$ac_cv_prog_ac_ct_LD
+if test -n "$ac_ct_LD"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_LD" >&5
+echo "${ECHO_T}$ac_ct_LD" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_LD" = x; then
+ LD=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ LD=$ac_ct_LD
+ fi
+else
+ LD="$ac_cv_prog_LD"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ln", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ln; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_LN+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$LN"; then
+ ac_cv_prog_LN="$LN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_LN="${ac_tool_prefix}ln"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+LN=$ac_cv_prog_LN
+if test -n "$LN"; then
+ { echo "$as_me:$LINENO: result: $LN" >&5
+echo "${ECHO_T}$LN" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LN"; then
+ ac_ct_LN=$LN
+ # Extract the first word of "ln", so it can be a program name with args.
+set dummy ln; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_LN+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_LN"; then
+ ac_cv_prog_ac_ct_LN="$ac_ct_LN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_LN="ln"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LN=$ac_cv_prog_ac_ct_LN
+if test -n "$ac_ct_LN"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_LN" >&5
+echo "${ECHO_T}$ac_ct_LN" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_LN" = x; then
+ LN=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ LN=$ac_ct_LN
+ fi
+else
+ LN="$ac_cv_prog_LN"
+fi
+
+
+# Checks for libraries.
+
+# Check whether --with-cv was given.
+if test "${with_cv+set}" = set; then
+ withval=$with_cv; LIBCVNAME=$withval
+else
+ LIBCVNAME=cv
+fi
+
+
+as_ac_Lib=`echo "ac_cv_lib_$LIBCVNAME''_cvCreateImage" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for cvCreateImage in -l$LIBCVNAME" >&5
+echo $ECHO_N "checking for cvCreateImage in -l$LIBCVNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$LIBCVNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cvCreateImage ();
+int
+main ()
+{
+return cvCreateImage ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ LIBCV=-l$LIBCVNAME
+fi
+
+if test -z "$LIBCV"; then
+ echo
+ echo "If your system already has OpenCV, append place of the libcv.la"
+ echo "to your LDFLAGS environment variables. eg,"
+ echo
+ echo 'LDFLAGS="$LDFLAGS -L/usr/local/opencv/lib";export LDFLAGS'
+ echo
+ { { echo "$as_me:$LINENO: error: libcv.la not found." >&5
+echo "$as_me: error: libcv.la not found." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+# Check whether --enable-sample was given.
+if test "${enable_sample+set}" = set; then
+ enableval=$enable_sample; enable_sample=$enableval
+fi
+
+if test x"$enable_sample" != xno; then
+ SAMPLE=sample
+
+# Check whether --with-highgui was given.
+if test "${with_highgui+set}" = set; then
+ withval=$with_highgui; LIBHIGHGUINAME=$withval
+else
+ LIBHIGHGUINAME=highgui
+fi
+
+else
+ SAMPLE=""
+ LIBHIGHGUINAME=no
+fi
+if test x"$LIBHIGHGUINAME" = xno ; then
+ SAMPLE=""
+ LIBHIGHGUINAME=highgui
+else
+ as_ac_Lib=`echo "ac_cv_lib_$LIBHIGHGUINAME''_cvShowImage" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for cvShowImage in -l$LIBHIGHGUINAME" >&5
+echo $ECHO_N "checking for cvShowImage in -l$LIBHIGHGUINAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$LIBHIGHGUINAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cvShowImage ();
+int
+main ()
+{
+return cvShowImage ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ LIBHIGHGUI=-l$LIBHIGHGUINAME
+fi
+
+ if test -z "$LIBHIGHGUI"; then
+ echo
+ echo "If your system already has OpenCV, append place of the libhighgui.la"
+ echo "to your LDFLAGS environment variables. eg,"
+ echo
+ echo 'LDFLAGS="$LDFLAGS -L/usr/local/opencv/lib";export LDFLAGS'
+ echo
+ { { echo "$as_me:$LINENO: error: libhighgui.la not found." >&5
+echo "$as_me: error: libhighgui.la not found." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+
+
+
+# Checks for header files.
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
+if test -z "$CXXCPP"; then
+ if test "${ac_cv_prog_CXXCPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CXXCPP needs to be expanded
+ for CXXCPP in "$CXX -E" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+ CXXCPP=$ac_cv_prog_CXXCPP
+else
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+ # Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_GREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+ # Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_EGREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+for ac_header in memory.h netinet/in.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## --------------------------------- ##
+## Report this to zophos@koka-in.org ##
+## --------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+if test "${ac_cv_header_cv_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for cv.h" >&5
+echo $ECHO_N "checking for cv.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_cv_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_cv_h" >&5
+echo "${ECHO_T}$ac_cv_header_cv_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking cv.h usability" >&5
+echo $ECHO_N "checking cv.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <cv.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking cv.h presence" >&5
+echo $ECHO_N "checking cv.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <cv.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: cv.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: cv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: cv.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: cv.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: cv.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: cv.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: cv.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: cv.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: cv.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: cv.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: cv.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: cv.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: cv.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: cv.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: cv.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: cv.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## --------------------------------- ##
+## Report this to zophos@koka-in.org ##
+## --------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for cv.h" >&5
+echo $ECHO_N "checking for cv.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_cv_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_cv_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_cv_h" >&5
+echo "${ECHO_T}$ac_cv_header_cv_h" >&6; }
+
+fi
+if test $ac_cv_header_cv_h = yes; then
+ HAVE_CV_H=yes
+fi
+
+
+if test -z "$HAVE_CV_H"; then
+ echo
+ echo "If your system already has OpenCV, append place of the cv.h"
+ echo "to your CPPFLAGS environment variables. eg,"
+ echo
+ echo 'CPPFLAGS="$CPPFLAGS -I/usr/local/opencv/cv/include";export CPPFLAGS'
+ echo
+ { { echo "$as_me:$LINENO: error: cv.h not found." >&5
+echo "$as_me: error: cv.h not found." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
+echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdbool_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <stdbool.h>
+#ifndef bool
+ "error: bool is not defined"
+#endif
+#ifndef false
+ "error: false is not defined"
+#endif
+#if false
+ "error: false is not 0"
+#endif
+#ifndef true
+ "error: true is not defined"
+#endif
+#if true != 1
+ "error: true is not 1"
+#endif
+#ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+#endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
+ bool e = &s;
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ enum { j = false, k = true, l = false * true, m = true * 256 };
+ _Bool n[m];
+ char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+# if defined __xlc__ || defined __GNUC__
+ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+ reported by James Lemley on 2005-10-05; see
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+ This test is not quite right, since xlc is allowed to
+ reject this program, as the initializer for xlcbug is
+ not one of the forms that C requires support for.
+ However, doing the test right would require a runtime
+ test, and that would make cross-compilation harder.
+ Let us hope that IBM fixes the xlc bug, and also adds
+ support for this kind of constant expression. In the
+ meantime, this test will reject xlc, which is OK, since
+ our stdbool.h substitute should suffice. We also test
+ this with GCC, where it should work, to detect more
+ quickly whether someone messes up the test in the
+ future. */
+ char digs[] = "0123456789";
+ int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+# endif
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
+
+int
+main ()
+{
+
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_stdbool_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdbool_h=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; }
+{ echo "$as_me:$LINENO: checking for _Bool" >&5
+echo $ECHO_N "checking for _Bool... $ECHO_C" >&6; }
+if test "${ac_cv_type__Bool+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef _Bool ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type__Bool=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type__Bool=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
+echo "${ECHO_T}$ac_cv_type__Bool" >&6; }
+if test $ac_cv_type__Bool = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STDBOOL_H 1
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset cs;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
+if test "${ac_cv_c_inline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_c_inline=$ac_kw
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6; }
+
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef size_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_size_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_size_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+
+# Checks for library functions.
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+
+for ac_func in memset snprintf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then
+ enableval=$enable_debug; enable_debugmessage=$enableval
+else
+ enable_debugmessage=no
+fi
+
+if test x"$enable_debugmessage" = xyes; then
+ CPPFLAGS="$CPPFLAGS -D_DEBUG"
+fi
+
+
+# Get version info
+libdecodeqr=$srcdir/libdecodeqr
+decodeqr_major_version=`grep '#define LIBDECODEQR_VERSION_MAJOR' $libdecodeqr/version.h`
+decodeqr_minor_version=`grep '#define LIBDECODEQR_VERSION_MINOR' $libdecodeqr/version.h`
+decodeqr_teeny_version=`grep '#define LIBDECODEQR_VERSION_TEENY' $libdecodeqr/version.h`
+
+MAJOR=`expr "$decodeqr_major_version" : '#define LIBDECODEQR_VERSION_MAJOR \([0-9]*\)'`
+MINOR=`expr "$decodeqr_minor_version" : '#define LIBDECODEQR_VERSION_MINOR \([0-9]*\)'`
+TEENY=`expr "$decodeqr_teeny_version" : '#define LIBDECODEQR_VERSION_TEENY \([0-9]*\)'`
+
+
+
+
+
+ac_config_files="$ac_config_files Makefile libdecodeqr/Makefile test/Makefile sample/Makefile sample/simple/Makefile sample/webcam/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by libdecodeqr $as_me package, which was
+generated by GNU Autoconf 2.61. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+libdecodeqr config.status package
+configured by $0, generated by GNU Autoconf 2.61,
+ with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ CONFIG_SHELL=$SHELL
+ export CONFIG_SHELL
+ exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "libdecodeqr/Makefile") CONFIG_FILES="$CONFIG_FILES libdecodeqr/Makefile" ;;
+ "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+ "sample/Makefile") CONFIG_FILES="$CONFIG_FILES sample/Makefile" ;;
+ "sample/simple/Makefile") CONFIG_FILES="$CONFIG_FILES sample/simple/Makefile" ;;
+ "sample/webcam/Makefile") CONFIG_FILES="$CONFIG_FILES sample/webcam/Makefile" ;;
+
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+AR!$AR$ac_delim
+LD!$LD$ac_delim
+LN!$LN$ac_delim
+LIBCV!$LIBCV$ac_delim
+SAMPLE!$SAMPLE$ac_delim
+LIBHIGHGUI!$LIBHIGHGUI$ac_delim
+CXXCPP!$CXXCPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+MAJOR!$MAJOR$ac_delim
+MINOR!$MINOR$ac_delim
+TEENY!$TEENY$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 61; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ ac_file_inputs="$ac_file_inputs $ac_f"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input="Generated from "`IFS=:
+ echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ fi
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin";;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+ esac
+ ;;
+
+
+
+ esac
+
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/src/configure.in b/src/configure.in
new file mode 100644
index 0000000..2e0212c
--- /dev/null
+++ b/src/configure.in
@@ -0,0 +1,128 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT(libdecodeqr, package, zophos@koka-in.org)
+AC_CONFIG_SRCDIR([$srcdir/libdecodeqr/imagereader.cpp])
+dnl AC_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_LANG_CPLUSPLUS
+
+#
+# Check if don't want -g option
+#
+AC_ARG_ENABLE(optimize,
+ [ --enable-optimize turn off debug information (CC -g option). ],
+ [enable_optimize=$enableval], [enable_optimize=no])
+if test x"$enable_optimize" = xyes; then
+ CXXFLAGS="$CXXFLAGS -O2"
+fi
+
+AC_PROG_CXX
+AC_PROG_INSTALL
+AC_CHECK_TOOL(AR,ar)
+AC_CHECK_TOOL(LD,ld)
+AC_CHECK_TOOL(LN,ln)
+
+# Checks for libraries.
+AC_ARG_WITH(cv,
+ [ --with-cv=NAME specify libcv (eg, cv0.9.7)],
+ [ LIBCVNAME=$withval ], [ LIBCVNAME=cv ])
+AC_CHECK_LIB($LIBCVNAME,cvCreateImage,LIBCV=-l$LIBCVNAME,)
+if test -z "$LIBCV"; then
+ echo
+ echo "If your system already has OpenCV, append place of the libcv.la"
+ echo "to your LDFLAGS environment variables. eg,"
+ echo
+ echo 'LDFLAGS="$LDFLAGS -L/usr/local/opencv/lib";export LDFLAGS'
+ echo
+ AC_MSG_ERROR(libcv.la not found.)
+fi
+AC_SUBST(LIBCV)
+
+
+AC_ARG_ENABLE(sample,
+ [ --enable-sample build sample programs.],
+ [enable_sample=$enableval],)
+if test x"$enable_sample" != xno; then
+ SAMPLE=sample
+ AC_ARG_WITH(highgui,
+ [ --with-highgui=NAME specify libhighgui (eg, highgui0.9.7)],
+ [ LIBHIGHGUINAME=$withval ], [ LIBHIGHGUINAME=highgui ])
+else
+ SAMPLE=""
+ LIBHIGHGUINAME=no
+fi
+if test x"$LIBHIGHGUINAME" = xno ; then
+ SAMPLE=""
+ LIBHIGHGUINAME=highgui
+else
+ AC_CHECK_LIB($LIBHIGHGUINAME,cvShowImage,LIBHIGHGUI=-l$LIBHIGHGUINAME,)
+ if test -z "$LIBHIGHGUI"; then
+ echo
+ echo "If your system already has OpenCV, append place of the libhighgui.la"
+ echo "to your LDFLAGS environment variables. eg,"
+ echo
+ echo 'LDFLAGS="$LDFLAGS -L/usr/local/opencv/lib";export LDFLAGS'
+ echo
+ AC_MSG_ERROR(libhighgui.la not found.)
+ fi
+fi
+AC_SUBST(SAMPLE)
+AC_SUBST(LIBHIGHGUI)
+
+
+# Checks for header files.
+AC_CHECK_HEADERS([memory.h netinet/in.h])
+
+AC_CHECK_HEADER(cv.h,HAVE_CV_H=yes,)
+if test -z "$HAVE_CV_H"; then
+ echo
+ echo "If your system already has OpenCV, append place of the cv.h"
+ echo "to your CPPFLAGS environment variables. eg,"
+ echo
+ echo 'CPPFLAGS="$CPPFLAGS -I/usr/local/opencv/cv/include";export CPPFLAGS'
+ echo
+ AC_MSG_ERROR(cv.h not found.)
+fi
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_HEADER_STDC
+AC_CHECK_FUNCS([memset snprintf])
+
+AC_ARG_ENABLE(debug,
+ [ --enable-debugmessage turn on debug message.],
+ [enable_debugmessage=$enableval], [enable_debugmessage=no])
+if test x"$enable_debugmessage" = xyes; then
+ CPPFLAGS="$CPPFLAGS -D_DEBUG"
+fi
+
+
+# Get version info
+libdecodeqr=$srcdir/libdecodeqr
+decodeqr_major_version=`grep '#define LIBDECODEQR_VERSION_MAJOR' $libdecodeqr/version.h`
+decodeqr_minor_version=`grep '#define LIBDECODEQR_VERSION_MINOR' $libdecodeqr/version.h`
+decodeqr_teeny_version=`grep '#define LIBDECODEQR_VERSION_TEENY' $libdecodeqr/version.h`
+
+MAJOR=`expr "$decodeqr_major_version" : '#define LIBDECODEQR_VERSION_MAJOR \([0-9]*\)'`
+MINOR=`expr "$decodeqr_minor_version" : '#define LIBDECODEQR_VERSION_MINOR \([0-9]*\)'`
+TEENY=`expr "$decodeqr_teeny_version" : '#define LIBDECODEQR_VERSION_TEENY \([0-9]*\)'`
+
+AC_SUBST(MAJOR)
+AC_SUBST(MINOR)
+AC_SUBST(TEENY)
+
+AC_OUTPUT([Makefile
+libdecodeqr/Makefile
+test/Makefile
+sample/Makefile
+sample/simple/Makefile
+sample/webcam/Makefile])
diff --git a/src/install-sh b/src/install-sh
new file mode 100755
index 0000000..6ce63b9
--- /dev/null
+++ b/src/install-sh
@@ -0,0 +1,294 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+#
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd=$cpprog
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "$0: no input file specified" >&2
+ exit 1
+else
+ :
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d "$dst" ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=$mkdirprog
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f "$src" ] || [ -d "$src" ]
+ then
+ :
+ else
+ echo "$0: $src does not exist" >&2
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "$0: no destination specified" >&2
+ exit 1
+ else
+ :
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d "$dst" ]
+ then
+ dst=$dst/`basename "$src"`
+ else
+ :
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+ '
+IFS="${IFS-$defaultIFS}"
+
+oIFS=$IFS
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS=$oIFS
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp=$pathcomp$1
+ shift
+
+ if [ ! -d "$pathcomp" ] ;
+ then
+ $mkdirprog "$pathcomp"
+ else
+ :
+ fi
+
+ pathcomp=$pathcomp/
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd "$dst" &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename "$dst"`
+ else
+ dstfile=`basename "$dst" $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename "$dst"`
+ else
+ :
+ fi
+
+# Make a couple of temp file names in the proper directory.
+
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+# Trap to clean up temp files at exit.
+
+ trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd "$src" "$dsttmp" &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
+
+# Now remove or move aside any old file at destination location. We try this
+# two ways since rm can't unlink itself on some systems and the destination
+# file might be busy for other reasons. In this case, the final cleanup
+# might fail but the new file should still install successfully.
+
+{
+ if [ -f "$dstdir/$dstfile" ]
+ then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
+ $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
+ {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit
+ }
+ else
+ :
+ fi
+} &&
+
+# Now rename the file to the real destination.
+
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+
+fi &&
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+
+{
+ (exit 0); exit
+}
diff --git a/src/libdecodeqr/Makefile.in b/src/libdecodeqr/Makefile.in
new file mode 100644
index 0000000..950c2fc
--- /dev/null
+++ b/src/libdecodeqr/Makefile.in
@@ -0,0 +1,65 @@
+#
+# Makefile.in -- a part of libdecodeqr
+#
+# Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+# JMA (Japan Medical Association)
+# NaCl (Network Applied Communication Laboratory Ltd.)
+#
+# This is free software with ABSOLUTELY NO WARRANTY.
+# You can redistribute and/or modify it under the terms of LGPL.
+#
+# $Id: Makefile 20 2006-11-20 03:26:52Z zophos $
+#
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+includedir = @includedir@
+
+MAJOR=@MAJOR@
+MINOR=@MINOR@
+TEENY=@TEENY@
+
+BASENAME=libdecodeqr
+LIBNAME_A=$(BASENAME).a
+SONAME=$(BASENAME).so.$(MAJOR)
+LIBNAME_SO=$(BASENAME).so.$(MAJOR).$(MINOR).$(TEENY)
+
+CXX=@CXX@
+CPPFLAGS=@CPPFLAGS@ @CXXFLAGS@ -fPIC -c
+
+AR=@AR@
+ARFLAGS=rcs
+
+LD=@LD@
+LDFLAGS=@LDFLAGS@ -shared -soname $(SONAME)
+LIBCV=@LIBCV@
+LIBS=$(LIBCV)
+
+INSTALL=@INSTALL@
+LDCONFIG=/sbin/ldconfig
+LN=@LN@
+
+.SUFFIXES: .cpp .o
+.cpp.o:
+ $(CXX) $(CPPFLAGS) $<
+
+sources:=$(wildcard *.cpp)
+objs:=$(patsubst %.cpp,%.o,$(wildcard *.cpp))
+dsts:=$(LIBNAME_A) $(LIBNAME_SO) decodeqr.h
+
+all: $(dsts)
+
+$(LIBNAME_A): $(objs)
+ $(AR) $(ARFLAGS) $@ $(objs)
+
+$(LIBNAME_SO): $(objs)
+ $(LD) -o $@ $(objs) $(LDFLAGS) $(LIBS)
+
+install: $(dsts)
+ $(INSTALL) -m 0755 $(LIBNAME_A) $(LIBNAME_SO) $(libdir)
+ $(LDCONFIG) -n $(libdir)
+ $(LN) -sf $(libdir)/$(LIBNAME_SO) $(libdir)/$(BASENAME).so
+ $(INSTALL) -m 0644 decodeqr.h qrerror.h qrtypes.h $(includedir)
+
+clean:
+ -rm *.a *.o *.so.*
diff --git a/src/libdecodeqr/bitstream.cpp b/src/libdecodeqr/bitstream.cpp
new file mode 100644
index 0000000..d84904b
--- /dev/null
+++ b/src/libdecodeqr/bitstream.cpp
@@ -0,0 +1,147 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// bitstream.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: bitstream.cpp 36 2007-02-21 23:22:03Z zophos $
+//
+#include "bitstream.h"
+
+namespace Qr{
+ BitStream::BitStream()
+ {
+ this->data=NULL;
+ this->byte_size=0;
+ this->bit_size=0;
+ this->_pos=0;
+ }
+ BitStream::BitStream(void *src,int size)
+ {
+ this->byte_size=size;
+ this->bit_size=size<<3;
+ this->data=new unsigned char[size];
+ memcpy(this->data,src,size);
+ this->_pos=0;
+ }
+ BitStream::~BitStream()
+ {
+ if(this->data)
+ delete this->data;
+ }
+
+ bool BitStream::is_eod()
+ {
+ return(this->_pos>=this->bit_size);
+ }
+ int BitStream::position()
+ {
+ return(this->_pos);
+ }
+ int BitStream::seek(int pos)
+ {
+ this->_pos+=pos;
+ if(this->_pos<0)
+ this->_pos=0;
+ if(this->_pos>this->bit_size)
+ this->_pos=this->bit_size;
+
+ return(this->_pos);
+ }
+ void BitStream::rewind()
+ {
+ this->_pos=0;
+ }
+
+ unsigned char *BitStream::read(int read_bits)
+ {
+ int byte_size=(read_bits>>3)+(read_bits&0x07?1:0);
+ unsigned char *buf=new unsigned char[byte_size];
+ memset(buf,0,byte_size);
+
+ this->read(buf,byte_size,read_bits);
+
+ return(buf);
+ }
+ int BitStream::read(void *dst,int buf_size,int read_bits)
+ {
+ memset(dst,0,buf_size);
+
+ if(read_bits>(buf_size<<3))
+ read_bits=buf_size<<3;
+
+ int end_bit=this->_pos+read_bits-1;
+ if(end_bit>=this->bit_size){
+ end_bit=this->bit_size-1;
+ read_bits=this->bit_size-this->_pos;
+ }
+ int remain_bits=(end_bit+1)&0x07;
+ int offset=this->_pos>>3;
+ int read_bytes=(read_bits>>3)+(read_bits&0x07?1:0);
+
+ if(read_bytes<buf_size){
+ int diff=buf_size-read_bytes;
+ unsigned char *tmp=(unsigned char *)dst;
+ tmp+=diff;
+ dst=tmp;
+ }
+
+ if(remain_bits){
+ unsigned char *src=data+offset;
+ unsigned char *tmp=(unsigned char *)dst;
+
+ int i=0;
+ if(read_bytes==(end_bit>>3)-offset+1){
+ tmp++;
+ i++;
+ }
+ for(;i<read_bytes;i++,src++,tmp++){
+ *tmp=*src<<remain_bits;
+ }
+ remain_bits=8-remain_bits;
+ src=data+(end_bit>>3);
+ tmp--;
+ for(i=0;i<read_bytes;i++,src--,tmp--){
+ *tmp|=*src>>remain_bits;
+ }
+ }
+ else{
+ memcpy(dst,this->data+offset,read_bytes);
+ }
+
+ unsigned char mask=0xff;
+ switch(8-(read_bits&0x07)){
+ case 1:
+ mask=0x7f;
+ break;
+ case 2:
+ mask=0x3f;
+ break;
+ case 3:
+ mask=0x1f;
+ break;
+ case 4:
+ mask=0x0f;
+ break;
+ case 5:
+ mask=0x07;
+ break;
+ case 6:
+ mask=0x03;
+ break;
+ case 7:
+ mask=0x01;
+ break;
+ }
+ *((unsigned char *)dst)&=mask;
+ this->_pos+=read_bits;
+
+ return(read_bits);
+ }
+
+}
diff --git a/src/libdecodeqr/bitstream.h b/src/libdecodeqr/bitstream.h
new file mode 100644
index 0000000..754864d
--- /dev/null
+++ b/src/libdecodeqr/bitstream.h
@@ -0,0 +1,48 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// bitstream.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: bitstream.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __QR_BITSTREAM__
+#define __QR_BITSTREAM__
+
+#include <memory.h>
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+namespace Qr{
+ class BitStream{
+ public:
+ unsigned char *data;
+ int byte_size;
+ int bit_size;
+
+ private:
+ int _pos;
+
+ public:
+ BitStream();
+ BitStream(void *src,int size);
+ ~BitStream();
+
+ bool is_eod();
+ int position();
+ int seek(int pos);
+ void rewind();
+
+ unsigned char *read(int read_bits);
+ int read(void *dst,int buf_size,int bitsize);
+ };
+};
+
+#endif
diff --git a/src/libdecodeqr/codedata.cpp b/src/libdecodeqr/codedata.cpp
new file mode 100644
index 0000000..62ac4b3
--- /dev/null
+++ b/src/libdecodeqr/codedata.cpp
@@ -0,0 +1,506 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// codedata.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: codedata.cpp 36 2007-02-21 23:22:03Z zophos $
+//
+#include "codedata.h"
+
+namespace Qr{
+
+ /////////////////////////////////////////////////////////////////////////
+ //
+ // RS block structure table
+ // ( from JISX0510(2004) 8.5.1 Table.12-18 pp.30-36)
+ //
+ // [version][level]={
+ // Tw: total words,
+ // Sb: number of smaller RS blocks,
+ // Tcs: total codes in each smaller RS block,
+ // Dcs: data codes in each smaller RS block,
+ // Ec: error correctable words in each block
+ // }
+ //
+ // level M: 0
+ // L: 1
+ // H: 2
+ // Q: 3
+ //
+ // Tcl: total codes in each largerer RS block = Tcs + 1
+ // Dcs: data codes in each larger RS block = Dcs + 1
+ // Lb: Number of larger RS blocks = (Tw - Sb * Tcs) / Tcl
+ // Tb: Total RS Blocks = Sb + Lb
+ //
+ const static int RS_BLOCK_ALIGN[41][4][5]={
+ // version 0 (not exist, just a dummy)
+ {{0,0,0,0,0},{0,0,0,0,0},
+ {0,0,0,0,0},{0,0,0,0,0}},
+
+ // version 1
+ {{26,1,26,16,4},{26,1,26,19,2},
+ {26,1,26,9,8},{26,1,26,13,6}},
+ {{44,1,44,28,8},{44,1,44,34,4},
+ {44,1,44,16,14},{44,1,44,22,11}},
+ {{70,1,70,44,13},{70,1,70,55,7},
+ {70,2,35,13,11},{70,2,35,17,9}},
+ {{100,2,50,32,9},{100,1,100,80,10},
+ {100,4,25,9,8},{100,2,50,24,13}},
+
+ {{134,2,67,43,12},{134,1,134,108,13},
+ {134,2,33,11,11},{134,2,33,15,9}},
+ {{172,4,43,27,8},{172,2,86,68,9},
+ {172,4,43,15,14},{172,4,43,19,12}},
+ {{196,4,49,31,9},{196,2,98,78,10},
+ {196,4,39,13,13},{196,2,32,14,9}},
+ {{242,2,60,38,11},{242,2,121,97,12},
+ {242,4,40,14,13},{242,4,40,18,11}},
+ {{292,3,58,36,11},{292,2,146,116,15},
+ {292,4,36,12,12},{292,4,36,16,10}},
+
+ // version 10
+ {{346,4,69,43,13},{346,2,86,68,9},
+ {346,6,43,15,14},{346,6,43,19,12}},
+ {{404,1,80,50,15},{404,4,101,81,10},
+ {404,3,36,12,12},{404,4,50,22,14}},
+ {{466,6,58,36,11},{466,2,116,92,12},
+ {466,7,42,14,14},{466,4,46,20,14}},
+ {{532,8,59,37,11},{532,4,133,107,13},
+ {532,12,33,11,11},{532,8,44,20,12}},
+ {{581,5,65,41,12},{581,5,109,87,11},
+ {581,11,36,12,12},{581,5,54,24,15}},
+
+ {{655,5,65,41,12},{655,5,109,87,11},
+ {655,11,36,12,12},{655,5,54,24,15}},
+ {{733,7,73,45,14},{733,5,122,98,12},
+ {733,3,45,15,15},{733,15,43,19,12}},
+ {{815,10,74,46,14},{815,1,135,107,14},
+ {815,2,42,14,14},{815,1,50,22,14}},
+ {{901,9,69,43,13},{901,5,150,120,15},
+ {901,2,42,14,14},{901,17,50,22,14}},
+ {{991,3,70,44,13},{991,3,141,113,14},
+ {991,9,39,13,13},{991,17,47,21,13}},
+
+ // version 20
+ {{1085,3,67,41,13},{1085,3,135,107,14},
+ {1085,15,43,15,14},{1085,15,54,24,15}},
+ {{1156,17,68,42,13},{1156,4,144,116,14},
+ {1156,19,46,16,15},{1156,17,50,22,14}},
+ {{1258,17,74,46,14},{1258,2,139,111,14},
+ {1258,34,37,13,12},{1258,7,54,24,15}},
+ {{1364,4,75,47,14},{1364,4,151,121,15},
+ {1364,16,45,15,15},{1364,11,54,24,15}},
+ {{1474,6,73,45,14},{1474,6,147,117,15},
+ {1474,30,46,16,15},{1474,11,54,24,15}},
+
+ {{1588,8,75,47,14},{1588,8,132,106,13},
+ {1588,22,45,15,15},{1588,7,54,24,15}},
+ {{1706,19,74,46,14},{1706,10,142,114,14},
+ {1706,33,46,16,15},{1706,28,50,22,14}},
+ {{1828,22,73,45,14},{1828,8,152,122,15},
+ {1828,12,45,15,15},{1828,8,53,23,15}},
+ {{1921,3,73,45,14},{1921,3,147,117,15},
+ {1921,11,45,15,15},{1921,4,54,24,15}},
+ {{2051,21,73,45,14},{2051,7,146,116,15},
+ {2051,19,45,15,15},{2051,21,73,45,14}},
+
+ // version 30
+ {{2185,19,75,47,14},{2185,5,145,115,15},
+ {2185,23,45,15,15},{2185,15,54,24,15}},
+ {{2323,2,74,46,14},{2323,13,145,115,15},
+ {2323,23,45,15,15},{2323,42,54,24,15}},
+ {{2465,10,74,46,14},{2465,17,145,115,15},
+ {2465,19,45,15,15},{2465,10,54,24,15}},
+ {{2611,14,74,46,14},{2611,17,145,115,15},
+ {2611,11,45,15,15},{2611,29,54,24,15}},
+ {{2761,14,74,46,14},{2761,13,145,115,15},
+ {2761,46,16,15,},{2761,44,54,24,15}},
+
+ {{2876,12,75,47,14},{2876,12,151,121,15},
+ {2876,22,45,15,15},{2876,39,54,24,15}},
+ {{3034,6,75,47,14},{3034,6,151,121,15},
+ {3034,2,45,15,15},{3034,46,54,24,15}},
+ {{3196,29,74,46,14},{3196,17,152,122,15},
+ {3196,24,45,15,15},{3196,49,54,24,15}},
+ {{3362,13,74,46,14},{3362,4,152,122,15},
+ {3362,42,45,15,15},{3362,48,54,24,15}},
+ {{3532,40,75,47,14},{3532,20,147,117,15},
+ {3532,10,45,15,15},{3532,43,54,24,15}},
+
+ // version 40
+ {{3706,18,75,47,14},{3706,19,148,118,15},
+ {3706,20,45,15,15},{3706,34,54,24,15}}
+ };
+
+ /////////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ CodeBlock::CodeBlock(int total_words,int data_words,int capability,
+ Galois::Field *gf)
+ {
+ this->total_words=total_words;
+ this->data_words=data_words;
+ this->capability=capability;
+ this->_gf=gf;
+
+ this->data=new unsigned char[this->total_words];
+ this->clear();
+ }
+ CodeBlock::~CodeBlock()
+ {
+ delete this->data;
+ }
+
+ void CodeBlock::clear()
+ {
+ memset(this->data,0,this->total_words);
+ this->_size=0;
+ }
+
+ unsigned char *CodeBlock::push(unsigned char data)
+ {
+ if(this->_size>=this->total_words)
+ return(NULL);
+
+ this->data[this->_size]=data;
+ this->_size++;
+ return(&(this->data[this->_size-1]));
+ }
+ bool CodeBlock::has_vacant_data()
+ {
+ return(this->_size<this->data_words);
+ }
+
+ int CodeBlock::error_correct()
+ {
+ Galois::BCH *bch=new Galois::BCH(this->_gf,
+ this->total_words,
+ this->capability);
+
+ int i,j;
+ for(i=this->total_words-1,j=0;i>=0;i--,j++){
+ bch->set(j,this->_gf->vect2nomial(this->data[i]));
+ }
+ int errors=bch->decode();
+ if(errors<=0){
+ delete bch;
+ return(errors);
+ }
+
+
+ //
+ // get each error size
+ //
+ //
+ // JISX0510:2004 Appendix B (p.64) step c) makes us mistake.
+ //
+ // s(n): n.th digit of sent data on GF(2^8)
+ // r(n): n.th digit of received data on GF(2^8)
+ // e(n): n.th error data on GF(2^8)
+ //
+ // If there was 3 errors on 1st ,2nd ,and n.th digit, received
+ // data R can be express shown as below;
+ //
+ // R = ( r(0), r(1), r(2), ... r(n) )
+ // = ( s(0), s(1)+e(0), s(2)+e(1), ... s(n)+e(2) )
+ //
+ // Error syndromes ES(n) are;
+ //
+ // ES(0) = sum{r(i) * a(0*i)}
+ // = sum{s(i)} +e(0) +e(1) +e(2)
+ // = e(0) +e(1) +e(2)
+ // ES(1) = sum{r(i)*a(1*i)}
+ // = sum{s(i)*a(i)} +a(1)*e(0) +a(2)*e(1) +a(n)*e(2)
+ // = a(1)*e(0) +a(2)*e(1) +a(n)*e(2)
+ // :
+ //
+ // ES(x) = sum{r(i)*a(x*i)}
+ // = sum{s(i)*a(x*i)} +a(x)*e(0) +a(2*x)*e(1) +a(n*x)*e(2)
+ // = a(x)*e(0) +a(2*x)*e(1) +a(n*x)*e(2)
+ //
+ // where a(x) is primitive of GF(2^8)
+ //
+ // So, each error size e(n) can be taken following equatation;
+ //
+ // e(0) +e(1) +e(2) =ES(0)
+ // a(1)*e(0) +a(2)*e(1) +a(n)*e(2) =ES(1)
+ // a(2)*e(0) +a(4)*e(1) +a(2*n)*e(2) =ES(2)
+ //
+ Galois::Polynomial *mat=new Galois::Polynomial(errors,
+ errors+1);
+ for(j=0;j<errors;j++){
+ for(i=0;i<errors;i++){
+ mat->set(j,i,this->_gf->exp2nomial(j*bch->error_pos[i]));
+ }
+ mat->set(j,i,bch->syndromes[j]);
+ }
+ Galois::Polynomial *err=mat->solve();
+
+ if(err){
+ //
+ // correct received data
+ //
+ //
+ // s(n) = r(n) + e(n)
+ //
+ // s(n): n.th digit of send data on GF(2^8)
+ // r(n): n.th digit of recieved data on GF(2^8)
+ // e(n): error size of n.th digit on GF(2^8)
+ //
+ for(i=0;i<errors;i++){
+ int p=this->total_words-bch->error_pos[i]-1;
+ this->data[p]=(*this->_gf->vect2nomial(this->data[p])+
+ *err->get(i)).to_vect();
+ }
+ delete err;
+ }
+ else{
+ errors=-1;
+ }
+
+ delete mat;
+ delete bch;
+
+ return(errors);
+ }
+
+
+ /////////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ CodeData::CodeData(int version,int level)
+ {
+ this->_gf=new Galois::Field(8);
+
+ this->version=version;
+ this->level=level;
+
+ this->total_words=RS_BLOCK_ALIGN[version][level][0];
+ int larger_block_words=RS_BLOCK_ALIGN[version][level][2]+1;
+ int larger_block_datas=RS_BLOCK_ALIGN[version][level][3]+1;
+ int larger_blocks=(this->total_words-
+ RS_BLOCK_ALIGN[version][level][1]*
+ RS_BLOCK_ALIGN[version][level][2]
+ )/larger_block_words;
+
+ this->data_blocks=RS_BLOCK_ALIGN[version][level][1]+larger_blocks;
+
+ this->data_words=RS_BLOCK_ALIGN[version][level][1]*
+ RS_BLOCK_ALIGN[version][level][3]+
+ larger_blocks*larger_block_datas;
+
+ this->data=new CodeBlock *[this->data_blocks];
+
+ int i;
+ for(i=0;i<RS_BLOCK_ALIGN[version][level][1];i++){
+ this->data[i]=new CodeBlock(
+ RS_BLOCK_ALIGN[version][level][2],
+ RS_BLOCK_ALIGN[version][level][3],
+ RS_BLOCK_ALIGN[version][level][4],
+ this->_gf);
+ }
+ for(i=RS_BLOCK_ALIGN[version][level][1];i<this->data_blocks;i++){
+ this->data[i]=new CodeBlock(
+ larger_block_words,
+ larger_block_datas,
+ RS_BLOCK_ALIGN[version][level][4],
+ this->_gf);
+ }
+
+ this->length=0;
+ this->byte_length=0;
+ this->_raw_data=NULL;
+
+
+ this->_size=0;
+ this->_index=0;
+
+ this->status=0;
+ }
+ CodeData::~CodeData()
+ {
+ if(this->_raw_data)
+ delete this->_raw_data;
+
+ for(int i=0;i<this->data_blocks;i++){
+ delete this->data[i];
+ }
+ delete this->data;
+ delete this->_gf;
+ }
+
+ void CodeData::clear()
+ {
+ for(int i=0;i<this->data_blocks;i++){
+ this->data[i]->clear();
+ }
+
+ this->length=0;
+ this->byte_length=0;
+ if(this->_raw_data){
+ delete this->_raw_data;
+ this->_raw_data=NULL;
+ }
+ this->_size=0;
+ this->_index=0;
+
+ this->status=0;
+ }
+
+ unsigned char *CodeData::push(unsigned char data)
+ {
+ if(this->_size<this->data_words){
+ for(int i=0;i<this->data_blocks;i++){
+ this->_index=(this->_index+i)%this->data_blocks;
+ if(this->data[this->_index]->has_vacant_data()){
+ unsigned char *ret=this->data[this->_index]->push(data);
+ this->_size++;
+ this->_index++;
+ return(ret);
+ }
+ }
+ throw;
+ }
+ else{
+ this->_index=this->_index%this->data_blocks;
+ unsigned char *ret=this->data[this->_index]->push(data);
+ this->_size++;
+ this->_index++;
+ return(ret);
+ }
+ }
+
+ unsigned char *CodeData::dump()
+ {
+ unsigned char *buf=new unsigned char[this->total_words];
+ for(int i=0,j=0;i<data_blocks;i++){
+ memcpy(buf+j,this->data[i]->data,
+ this->data[i]->total_words);
+ j+=this->data[i]->total_words;
+ }
+
+ return(buf);
+ }
+ unsigned char *CodeData::dump_block(int index)
+ {
+ unsigned char *buf=new unsigned char[this->data[index]->total_words];
+ memcpy(buf,this->data[index]->data,
+ this->data[index]->total_words);
+
+ return(buf);
+ }
+ unsigned char *CodeData::dump_data()
+ {
+ unsigned char *buf=new unsigned char[this->data_words];
+ for(int i=0,j=0;i<data_blocks;i++){
+ memcpy(buf+j,this->data[i]->data,
+ this->data[i]->data_words);
+ j+=this->data[i]->data_words;
+ }
+
+ return(buf);
+ }
+
+ unsigned char *CodeData::raw_data()
+ {
+ return(this->_raw_data);
+ }
+
+ int CodeData::decode()
+ {
+ if(this->_raw_data)
+ return(0);
+
+ int ret=this->_error_correct();
+ if(ret<0)
+ this->status|=QR_CODEDATA_UNRECOVERABLE;
+
+ unsigned char *tmp=this->dump_data();
+ BitStream *bitstream=new BitStream(tmp,this->data_words);
+ delete tmp;
+
+ unsigned char mode=0;
+ Qr::ECI::Decoder *decoder=NULL;
+ do{
+ bitstream->read(&mode,sizeof(mode),4);
+ switch(mode){
+ case 0: // end of data
+ decoder=NULL;
+ break;
+ case 1:
+ decoder=new Qr::ECI::NumericalDecoder();
+ break;
+ case 2: // arabic and numeric
+ decoder=new Qr::ECI::AlphabeticalDecoder();
+ break;
+ case 4: // 8-bit byte
+ decoder=new Qr::ECI::ByteDecoder();
+ break;
+ case 8: // kanji
+ decoder=new Qr::ECI::KanjiDecoder();
+ break;
+ case 7: // ECI
+ case 3: // joint
+ case 5: // FNC1 1st
+ case 9: // FNC1 2nd
+ default:
+ this->status|=QR_CODEDATA_NOT_SUPPORT_ECI;
+ decoder=NULL;
+ }
+
+ if(!decoder)
+ break;
+
+ int ret=decoder->decode(this->version,bitstream);
+ if(ret){
+ if(this->_raw_data){
+ unsigned char *buf=this->_raw_data;
+ int sz=this->byte_length+decoder->byte_length;
+ this->_raw_data=new unsigned char[sz];
+ memcpy(this->_raw_data,buf,this->byte_length);
+ delete buf;
+ memcpy(this->_raw_data+this->byte_length,
+ decoder->raw_data(),
+ decoder->byte_length);
+ }
+ else{
+ this->_raw_data=new unsigned char[decoder->byte_length];
+ memcpy(this->_raw_data,
+ decoder->raw_data(),
+ decoder->byte_length);
+ }
+ this->length+=decoder->length;
+ this->byte_length+=decoder->byte_length;
+
+ delete decoder;
+ }
+ }while(!bitstream->is_eod());
+
+ delete bitstream;
+
+ return(ret);
+ }
+
+ int CodeData::_error_correct()
+ {
+ int ret=0;
+ for(int i=0;i<this->data_blocks;i++){
+ int c=this->data[i]->error_correct();
+ if(ret<0||c<0){
+ ret=-1;
+ }
+ else
+ ret+=c;
+ }
+
+ return(ret);
+ }
+}
diff --git a/src/libdecodeqr/codedata.h b/src/libdecodeqr/codedata.h
new file mode 100644
index 0000000..e43e8d8
--- /dev/null
+++ b/src/libdecodeqr/codedata.h
@@ -0,0 +1,95 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// codedata.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: codedata.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __QR_CODE_DATA__
+#define __QR_CODE_DATA__
+
+#include <memory.h>
+#include "galois.h"
+#include "bitstream.h"
+#include "ecidecoder.h"
+#include "qrerror.h"
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#define QR_CODE_DATA_GX 0x11d //G(x)=x^8+x^4+x^3+x^2+1
+
+namespace Qr{
+ class CodeBlock{
+ public:
+ int total_words;
+ int data_words;
+ int capability;
+ unsigned char *data;
+ short status;
+
+ private:
+ int _size;
+ Galois::Field *_gf;
+
+ public:
+ CodeBlock(int total_words,int data_words,int capability,
+ Galois::Field *gf);
+ ~CodeBlock();
+
+ void clear();
+ unsigned char *push(unsigned char data);
+ bool has_vacant_data();
+
+ int error_correct();
+ };
+
+ class CodeData{
+ public:
+ int version;
+ int level;
+
+ int total_words; // total words (data+ecc)
+ int data_words; // number of data words
+ int data_blocks; // number of rs_block
+ CodeBlock **data;
+
+ int length; // number of decoded charactors
+ int byte_length;
+
+ short status;
+ private:
+ Galois::Field *_gf;
+
+ int _size;
+ int _index;
+
+ unsigned char *_raw_data;
+
+ public:
+ CodeData(int version,int level);
+ ~CodeData();
+
+ void clear();
+ unsigned char *push(unsigned char data);
+
+ unsigned char *dump();
+ unsigned char *dump_block(int index);
+ unsigned char *dump_data();
+ unsigned char *raw_data();
+
+ int decode();
+
+ private:
+ int _error_correct();
+ };
+};
+
+#endif
diff --git a/src/libdecodeqr/container.cpp b/src/libdecodeqr/container.cpp
new file mode 100644
index 0000000..4221e7d
--- /dev/null
+++ b/src/libdecodeqr/container.cpp
@@ -0,0 +1,288 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// container.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: container.cpp 36 2007-02-21 23:22:03Z zophos $
+//
+#include "container.h"
+
+namespace Qr{
+
+ Qr::Qr()
+ {
+ this->model=2;
+ this->version=0;
+ this->cells_par_side=0;
+
+ this->formatinfo=new FormatInfo();
+ this->codedata=NULL;
+
+ this->status=0;
+ }
+ Qr::~Qr()
+ {
+ if(this->codedata)
+ delete this->codedata;
+
+ delete this->formatinfo;
+ }
+
+ int Qr::set_version(int v)
+ {
+ if(v<1||v>40){
+ this->status|=QR_VERSIONINFO_INVALID;
+ throw(0);
+ }
+
+ this->version=v;
+ this->cells_par_side=this->version*4+17;
+ return(this->version);
+ }
+ int Qr::decode_version(unsigned char *data)
+ {
+ // FIXME
+ return(this->version);
+ }
+
+ int Qr::decode_formatinfo(unsigned short data)
+ {
+ this->status&=(~QR_FORMATINFO_ERROR);
+
+ int ret=this->formatinfo->decode_formatinfo(data);
+ this->status|=this->formatinfo->status;
+
+ if(this->codedata)
+ delete this->codedata;
+
+ this->codedata=new CodeData(this->version,this->formatinfo->level);
+
+ return(ret);
+ }
+
+ Qr *Qr::init_each_finder_pattern_pixel()
+ {
+ this->_finder_c=0;
+ return(this);
+ }
+ Qr *Qr::init_each_timing_pattern_pixel()
+ {
+ this->_timing_c=0;
+ return(this);
+ }
+ Qr *Qr::init_each_alignment_pattern_pixel()
+ {
+ this->_alignment_x=2;
+ this->_alignment_y=1;
+ this->_alignment_i=-2;
+ this->_alignment_j=-2;
+ return(this);
+ }
+ Qr *Qr::init_each_version_pattern_pixel()
+ {
+ this->_version_c=0;
+ return(this);
+ }
+ Qr *Qr::init_each_formatinfo_pattern_pixel()
+ {
+ this->formatinfo->init_each_pattern_pixel();
+ return(this);
+ }
+ Qr *Qr::init_each_function_pattern_pixel()
+ {
+ this->init_each_finder_pattern_pixel();
+ this->init_each_timing_pattern_pixel();
+ this->init_each_alignment_pattern_pixel();
+ this->init_each_version_pattern_pixel();
+ this->init_each_formatinfo_pattern_pixel();
+ return(this);
+ }
+
+ Qr *Qr::each_finder_pattern_pixel(int *x,int *y)
+ {
+ int c=this->_finder_c;
+
+ //
+ // 8x8x3 pixels
+ //
+ if(this->_finder_c<64){
+ *x=c%8;
+ *y=c/8;
+ }
+ else if(this->_finder_c<128){
+ c-=64;
+ *x=this->cells_par_side-8+c%8;
+ *y=c/8;
+ }
+ else if(this->_finder_c<192){
+ c-=128;
+ *x=c%8;
+ *y=this->cells_par_side-8+c/8;
+ }
+ else
+ return(NULL);
+
+ this->_finder_c++;
+ return(this);
+ }
+
+ Qr *Qr::each_timing_pattern_pixel(int *x,int *y)
+ {
+ if(this->_timing_c<this->cells_par_side){
+ *x=6;
+ *y=this->_timing_c;
+ }
+ else if(this->_timing_c<this->cells_par_side*2){
+ *x=this->_timing_c-this->cells_par_side;
+ *y=6;
+ }
+ else
+ return(NULL);
+
+ this->_timing_c++;
+ return(this);
+ }
+
+ Qr *Qr::each_alignment_pattern_pixel(int *x,int *y)
+ {
+ int c=alignment_pattern_addr[this->version][0]+1;
+
+ if((this->_alignment_y==1)&&(this->_alignment_x>=c-1)){
+ this->_alignment_y++;
+ if(this->_alignment_y==1||this->_alignment_y==c-1)
+ this->_alignment_x=2;
+ else
+ this->_alignment_x=1;
+ }
+ if(this->_alignment_y>=c)
+ return(NULL);
+
+ *x=alignment_pattern_addr[version][this->_alignment_x]+
+ this->_alignment_j;
+ *y=alignment_pattern_addr[version][this->_alignment_y]+
+ this->_alignment_i;
+
+ this->_alignment_j++;
+ if(this->_alignment_j>2){
+ this->_alignment_j=-2;
+ this->_alignment_i++;
+
+ if(this->_alignment_i>2){
+ this->_alignment_i=-2;
+ this->_alignment_x++;
+
+ if((this->_alignment_x>=c)||
+ ((this->_alignment_y==1)&&(this->_alignment_x>=c-1))){
+ this->_alignment_y++;
+ if(this->_alignment_y==1||this->_alignment_y==c-1)
+ this->_alignment_x=2;
+ else
+ this->_alignment_x=1;
+ }
+ }
+ }
+
+ return(this);
+ }
+
+ Qr *Qr::each_version_pattern_pixel(int *x,int *y)
+ {
+ if(this->version<7)
+ return(NULL);
+
+ if(this->_version_c<18){
+ *x=version_info_addr[0][this->_version_c][0];
+ *y=version_info_addr[0][this->_version_c][1];
+ }
+ else if(this->_version_c<36){
+ *x=version_info_addr[1][this->_version_c-18][0];
+ *y=version_info_addr[1][this->_version_c-18][1];
+ }
+ else
+ return(NULL);
+
+ if(*x<0)
+ *x+=this->cells_par_side;
+ if(*y<0)
+ *y+=this->cells_par_side;
+ this->_version_c++;
+ return(this);
+ }
+ Qr *Qr::each_version_pattern_pixel(int pos,int *x,int *y)
+ {
+ if(this->version<7)
+ return(NULL);
+
+ if(this->_version_c<18){
+ *x=version_info_addr[pos][this->_version_c][0];
+ *y=version_info_addr[pos][this->_version_c][1];
+ }
+ else
+ return(NULL);
+
+ if(*x<0)
+ *x+=this->cells_par_side;
+ if(*y<0)
+ *y+=this->cells_par_side;
+ this->_version_c++;
+ return(this);
+ }
+
+ Qr *Qr::each_formatinfo_pattern_pixel(int *x,int *y)
+ {
+ if(this->formatinfo->each_pattern_pixel(x,y)){
+ if(*x<0)
+ *x+=this->cells_par_side;
+ if(*y<0)
+ *y+=this->cells_par_side;
+ return(this);
+ }
+ else
+ return(NULL);
+ }
+ Qr *Qr::each_formatinfo_pattern_pixel(int pos,int *x,int *y)
+ {
+ if(this->formatinfo->each_pattern_pixel(pos,x,y)){
+ if(*x<0)
+ *x+=this->cells_par_side;
+ if(*y<0)
+ *y+=this->cells_par_side;
+ return(this);
+ }
+ else
+ return(NULL);
+ }
+
+ Qr *Qr::each_function_pattern_pixel(int *x,int *y)
+ {
+ if(this->each_finder_pattern_pixel(x,y))
+ return(this);
+ if(this->each_timing_pattern_pixel(x,y))
+ return(this);
+ if(this->each_alignment_pattern_pixel(x,y))
+ return(this);
+ if(this->each_version_pattern_pixel(x,y))
+ return(this);
+ return(this->each_formatinfo_pattern_pixel(x,y));
+ }
+
+ unsigned char *Qr::push_codedata(unsigned char data)
+ {
+ return(this->codedata->push(data));
+ }
+
+
+ int Qr::decode_codedata()
+ {
+ int ret=this->codedata->decode();
+ this->status|=this->codedata->status;
+
+ return(ret);
+ }
+}
diff --git a/src/libdecodeqr/container.h b/src/libdecodeqr/container.h
new file mode 100644
index 0000000..2a951e9
--- /dev/null
+++ b/src/libdecodeqr/container.h
@@ -0,0 +1,175 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// container.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: container.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __QR_CONTAINER__
+#define __QR_CONTAINER__
+
+#include "qrerror.h"
+#include "formatinfo.h"
+#include "codedata.h"
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#define QR_VERSION_INFO_GX 0x1f25 // G(x)=x^12+x^11+x^10+x^9+x^8+x^5+x^2+1
+#define QR_VERSION_INFO_DATA_SIZE 18
+
+namespace Qr{
+ //
+ // alignment pattern center coordinates
+ // ( from JISX0510(2004) Appendix E Table.1 p.71)
+ //
+ // {{number of data without me,coord_1,...coord_n},...}
+ //
+ // number of alignment pattern = (number of data)^2 - 3
+ //
+ const int alignment_pattern_addr[41][8]={
+ // version 0 (not exist, just a dummy)
+ {0,0,0,0,0,0,0,0},
+
+ // version 1
+ {0,0,0,0,0,0,0,0},
+ {2,6,18,0,0,0,0,0},
+ {2,6,22,0,0,0,0,0},
+ {2,6,26,0,0,0,0,0},
+
+ {2,6,30,0,0,0,0,0},
+ {2,6,34,0,0,0,0,0},
+ {3,6,22,38,0,0,0,0},
+ {3,6,24,42,0,0,0,0},
+ {3,6,26,46,0,0,0,0},
+
+ // version 10
+ {3,6,28,50,0,0,0,0},
+ {3,6,30,54,0,0,0,0},
+ {3,6,32,58,0,0,0,0},
+ {3,6,34,62,0,0,0,0},
+ {4,6,26,46,66,0,0,0},
+
+ {4,6,26,48,70,0,0,0},
+ {4,6,26,50,74,0,0,0},
+ {4,6,30,54,78,0,0,0},
+ {4,6,30,56,82,0,0,0},
+ {4,6,30,58,86,0,0,0},
+
+ // version 20
+ {4,6,34,62,90,0,0,0},
+ {5,6,28,50,72,94,0,0},
+ {5,6,26,50,74,98,0,0},
+ {5,6,30,54,78,102,0,0},
+ {5,6,28,54,80,106,0,0},
+
+ {5,6,32,58,84,110,0,0},
+ {5,6,30,58,86,114,0,0},
+ {5,6,34,62,90,118,0,0},
+ {6,6,26,50,74,98,122,0},
+ {6,6,30,54,78,102,126,0},
+
+ // version 30
+ {6,6,26,52,78,104,130,0},
+ {6,6,30,56,82,108,134,0},
+ {6,6,34,60,86,112,138,0},
+ {6,6,30,58,96,114,142,0},
+ {6,6,34,62,90,118,146,0},
+
+ {7,6,30,54,78,102,126,150},
+ {7,6,24,50,76,102,128,154},
+ {7,6,28,54,80,106,132,158},
+ {7,6,32,58,84,110,136,162},
+ {7,6,26,54,82,110,138,166},
+
+ // version 40
+ {7,6,30,58,86,114,142,170}
+ };
+
+ //
+ // version info;
+ // array of {x,y}; minus value means SymbolLength - Value;
+ // e.g; symbol size = 21 x 21, values {1,-1} points {1,20} module
+ //
+ const int version_info_addr[2][18][2]={
+ {
+ {-11,0},{-10,0},{-9,0},
+ {-11,1},{-10,1},{-9,1},
+ {-11,2},{-10,2},{-9,2},
+ {-11,3},{-10,3},{-9,3},
+ {-11,4},{-10,4},{-9,4},
+ {-11,5},{-10,5},{-9,5}
+ },
+ {
+ {0,-11},{0,-10},{0,-9},
+ {1,-11},{1,-10},{1,-9},
+ {2,-11},{2,-10},{2,-9},
+ {3,-11},{3,-10},{3,-9},
+ {4,-11},{4,-10},{4,-9},
+ {5,-11},{5,-10},{5,-9}
+ }
+ };
+
+ class Qr{
+ public:
+ int model;
+ int version;
+ int cells_par_side;
+
+ //int finder_pattern;
+ //int timing_pattern;
+ //int alignment_pattern;
+
+ short status;
+
+ FormatInfo *formatinfo;
+ CodeData *codedata;
+
+ private:
+ int _finder_c;
+ int _timing_c;
+ int _alignment_x;
+ int _alignment_y;
+ int _alignment_i;
+ int _alignment_j;
+ int _version_c;
+
+ public:
+ Qr();
+ ~Qr();
+
+ int set_version(int v);
+ int decode_version(unsigned char *data); //FIXME
+
+ int decode_formatinfo(unsigned short data);
+
+ Qr *init_each_finder_pattern_pixel();
+ Qr *init_each_timing_pattern_pixel();
+ Qr *init_each_alignment_pattern_pixel();
+ Qr *init_each_version_pattern_pixel();
+ Qr *init_each_formatinfo_pattern_pixel();
+ Qr *init_each_function_pattern_pixel();
+
+ Qr *each_finder_pattern_pixel(int *x,int *y);
+ Qr *each_timing_pattern_pixel(int *x,int *y);
+ Qr *each_alignment_pattern_pixel(int *x,int *y);
+ Qr *each_version_pattern_pixel(int *x,int *y);
+ Qr *each_version_pattern_pixel(int pos,int *x,int *y);
+ Qr *each_formatinfo_pattern_pixel(int *x,int *y);
+ Qr *each_formatinfo_pattern_pixel(int pos,int *x,int *y);
+ Qr *each_function_pattern_pixel(int *x,int *y);
+
+ unsigned char *push_codedata(unsigned char data);
+ int decode_codedata();
+ };
+
+}
+
+#endif
diff --git a/src/libdecodeqr/decodeqr.h b/src/libdecodeqr/decodeqr.h
new file mode 100644
index 0000000..e65f17f
--- /dev/null
+++ b/src/libdecodeqr/decodeqr.h
@@ -0,0 +1,286 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// libdecodeqr.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: decodeqr.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __QR_DECODER__
+#define __QR_DECODER__
+
+#include <cv.h>
+#include "qrerror.h"
+#include "qrtypes.h"
+
+#define DEFAULT_ADAPTIVE_TH_SIZE 25
+#define DEFAULT_ADAPTIVE_TH_DELTA 10
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////////////////
+//
+// initializer
+//
+// ARGS: none
+// RETURN:
+// QrDecoderHandle handle
+//
+extern QrDecoderHandle qr_decoder_open();
+
+/////////////////////////////////////////////////////////////////////////
+//
+// initializer with source image size
+//
+// ARGS:
+// int width: pixel width of source image
+// int height: pixel height of source image
+// int depth: image depth (bit par pixel; use OpenCV IPL_DEPTH_*)
+// int channel: number of image channel
+//
+// RETURN:
+// QrDecoderHandle handle
+//
+// NOTE:
+// 24-bit full color image has IPL_DEPTH_8U depth and 3 channels.
+//
+extern QrDecoderHandle qr_decoder_open_with_image_size(
+ int width,int height,int depth,int channel);
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// finalizer
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+//
+// RETURN: none
+//
+extern void qr_decoder_close(QrDecoderHandle decoder);
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// get status
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+//
+// RETURN: status code
+//
+extern short qr_decoder_get_status(QrDecoderHandle decoder);
+
+/////////////////////////////////////////////////////////////////////////
+//
+// get working status
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+//
+// RETURN: status code
+//
+extern int qr_decoder_is_busy(QrDecoderHandle decoder);
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// set source image size
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+// int width: pixel width of source image
+// int height: pixel height of source image
+// int depth: image depth (bit par pixel; use OpenCV IPL_DEPTH_*)
+// int channel: number of image channel
+//
+// RETURN:
+// QrDecoderHandle handle
+//
+// NOTE:
+// This method provide same function as qr_decoder_open_with_image_size().
+//
+extern QrDecoderHandle qr_decoder_set_image_size(
+ QrDecoderHandle decoder,int width,int height,int depth,int channel);
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// preset gaven image as source image
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+// IplImage *src: source image
+//
+// RETURN:
+// QrDecoderHandle handle
+//
+extern QrDecoderHandle qr_decoder_set_image_buffer(
+ QrDecoderHandle decoder,IplImage *src);
+
+/////////////////////////////////////////////////////////////////////////
+//
+// get source image buffer
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+//
+// RETURN:
+// IplImage *: pointer to buffer source image|NULL
+//
+// NOTE:
+// See OpenCV reference manual to access to IplImage *
+//
+extern IplImage *qr_decoder_get_image_buffer(QrDecoderHandle decoder);
+
+extern IplImage *qr_decoder_get_transformed_image_buffer(
+ QrDecoderHandle decoder);
+extern IplImage *qr_decoder_get_binarized_image_buffer(
+ QrDecoderHandle decoder);
+extern IplImage *qr_decoder_get_tmp_image_buffer(
+ QrDecoderHandle decoder);
+
+/////////////////////////////////////////////////////////////////////////
+//
+// decode preset source image
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+// int adaptive_th_size: value of AdaptiveThreshold size
+// int adaptive_th_delta: value of AdaptiveThreshold delta
+//
+// RETURN:
+// short: status code of decoder
+//
+// NOTE:
+// On succeeded, status code has 0x2000.
+// See qrtypes.h for details of status code.
+//
+// In case of adaptive_th_size=0, binarizing methods will be
+// used cvThreshlod() instead of cvAdaptiveThreshold()
+//
+#ifdef __cplusplus
+extern short qr_decoder_decode(QrDecoderHandle decoder,
+ int adaptive_th_size=
+ DEFAULT_ADAPTIVE_TH_SIZE,
+ int adaptive_th_delta=
+ DEFAULT_ADAPTIVE_TH_DELTA);
+#else
+extern short qr_decoder_decode(QrDecoderHandle decoder,
+ int adaptive_th_size,
+ int adaptive_th_delta);
+#endif
+
+/////////////////////////////////////////////////////////////////////////
+//
+// decode gaven image
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+// IplImage *src: image to decode
+// int adaptive_th_size: value of AdaptiveThreshold size
+// int adaptive_th_delta: value of AdaptiveThreshold delta
+//
+// RETURN:
+// short: status code of decoder
+//
+#ifdef __cplusplus
+extern short qr_decoder_decode_image(QrDecoderHandle decoder,
+ IplImage *src,
+ int adaptive_th_size=
+ DEFAULT_ADAPTIVE_TH_SIZE,
+ int adaptive_th_delta=
+ DEFAULT_ADAPTIVE_TH_DELTA);
+#else
+extern short qr_decoder_decode_image(QrDecoderHandle decoder,
+ IplImage *src,
+ int adaptive_th_size,
+ int adaptive_th_delta);
+#endif
+
+/////////////////////////////////////////////////////////////////////////
+//
+// get abstruction of decoded data
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+// QrCodeHeader *header: pointer to buffer of header
+//
+// RETURN:
+// 1 (on success)||0 (on error)
+//
+extern int qr_decoder_get_header(QrDecoderHandle decoder,
+ QrCodeHeader *header);
+
+/////////////////////////////////////////////////////////////////////////
+//
+// get decoded text data
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+// unsigned char *buf: pointer to buffer of header
+// int buf_size: buffer size
+//
+// RETURN:
+// copied data size||0 (on error)
+//
+// NOTE:
+// The data DOES NOT TERMINATE with null.
+// To get actual buffer size, use QrCodeHeader's .byte_size element.
+//
+extern int qr_decoder_get_body(QrDecoderHandle decoder,
+ unsigned char *buf,int buf_size);
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// get vertexes of decoded code region
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+//
+// RETURN:
+// Pointer to CvPoint[4] which consist vertexes of code region
+//
+extern CvPoint *qr_decoder_get_coderegion_vertexes(QrDecoderHandle decoder);
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// get Box array of decoded finder patterns
+//
+// ARGS:
+// QrDecoderHandle decoder: handler
+//
+// RETURN:
+// Pointer to CvBox2D[3] which consist boxes of finder pattern
+//
+extern CvBox2D *qr_decoder_get_finderpattern_boxes(QrDecoderHandle decoder);
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// version information
+//
+extern char *qr_decoder_version();
+extern char *qr_decoder_version_description();
+extern char *qr_decoder_version_product();
+extern int qr_decoder_version_major();
+extern int qr_decoder_version_minor();
+extern int qr_decoder_version_teeny();
+extern char *qr_decoder_version_suffix();
+extern char *qr_decoder_version_revision();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/libdecodeqr/ecidecoder.cpp b/src/libdecodeqr/ecidecoder.cpp
new file mode 100644
index 0000000..7c4dec1
--- /dev/null
+++ b/src/libdecodeqr/ecidecoder.cpp
@@ -0,0 +1,341 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// ecidecoder.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: ecidecoder.cpp 36 2007-02-21 23:22:03Z zophos $
+//
+#include "ecidecoder.h"
+
+namespace Qr{
+ namespace ECI{
+
+ //
+ // length of charactor count indicator
+ // [version][mode]
+ //
+ const static int CHARACTOR_COUNTS[41][4]={
+ //
+ // version 0 (not exist, just a dummy)
+ //
+ {0,0,0,0},
+ //
+ // version 1-9
+ //
+ {10,9,8,8},{10,9,8,8},{10,9,8,8},{10,9,8,8},
+ {10,9,8,8},{10,9,8,8},{10,9,8,8},{10,9,8,8},{10,9,8,8},
+ //
+ // version 10-26
+ //
+ {12,11,16,10},{12,11,16,10},{12,11,16,10},{12,11,16,10},{12,11,16,10},
+ {12,11,16,10},{12,11,16,10},{12,11,16,10},{12,11,16,10},{12,11,16,10},
+ {12,11,16,10},{12,11,16,10},{12,11,16,10},{12,11,16,10},{12,11,16,10},
+ {12,11,16,10},{12,11,16,10},
+ //
+ // version 27-40
+ //
+ {14,13,16,12},{14,13,16,12},{14,13,16,12},
+ {14,13,16,12},{14,13,16,12},{14,13,16,12},{14,13,16,12},{14,13,16,12},
+ {14,13,16,12},{14,13,16,12},{14,13,16,12},{14,13,16,12},{14,13,16,12},
+ {14,13,16,12}
+ };
+
+ //
+ // number to alphabet conversion table
+ //
+ const static char NUM2ALPABET[45]={
+ 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39, // 0-9
+ 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a, // A-J
+ 0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54, // K-T
+ 0x55,0x56,0x57,0x58,0x59,0x5a, // U-Z
+ 0x20,0x23,0x25,0x2a,0x2b,0x2d,0x2e,0x2f,0x3a
+ };
+
+ Decoder::Decoder()
+ {
+ this->mode=0;
+ this->length=0;
+ this->byte_length=0;
+ this->eci_mode=20;
+
+ this->_raw_data=NULL;
+ this->_bit_par_block=0;
+ this->_char_par_block=0;
+ this->_byte_par_char=0;
+
+ this->_read_length=0;
+ this->_written_length=0;
+ }
+
+ Decoder::~Decoder()
+ {
+ if(this->_raw_data)
+ delete this->_raw_data;
+ }
+
+ unsigned char *Decoder::raw_data()
+ {
+ return(this->_raw_data);
+ }
+
+ int Decoder::decode(int version,BitStream *bitstream)
+ {
+ this->_read_header(version,bitstream);
+ int blocks=this->length/this->_char_par_block+
+ (this->length%this->_char_par_block?1:0);
+
+ for(int i=0;i<blocks;i++){
+ if(!this->_read_data(bitstream))
+ break;
+ }
+
+ return(this->length);
+ }
+ int Decoder::_read_header(int version,BitStream *bitstream)
+ {
+ int charactor_count=this->_get_charactor_count(version);
+ bitstream->read(&(this->length),sizeof(this->length),
+ charactor_count);
+ this->length=ntohl(this->length);
+ this->byte_length=this->length*this->_byte_par_char;
+
+ int storage_sz=this->byte_length;
+ if(this->mode!=4)
+ storage_sz++;
+
+ this->_raw_data=new unsigned char[storage_sz];
+ memset(this->_raw_data,0,storage_sz);
+ this->_current_pos=this->_raw_data;
+
+ return(bitstream->position());
+ }
+ int Decoder::_get_charactor_count(int version)
+ {
+ return(0);
+ }
+ int Decoder::_read_data(BitStream *bitstream)
+ {
+ return(0);
+ }
+
+ NumericalDecoder::NumericalDecoder()
+ {
+ this->mode=1;
+ this->_bit_par_block=10;
+ this->_char_par_block=3;
+ this->_byte_par_char=1;
+ }
+ int NumericalDecoder::_get_charactor_count(int version)
+ {
+ return(CHARACTOR_COUNTS[version][0]);
+ }
+ int NumericalDecoder::_read_data(BitStream *bitstream)
+ {
+ if(bitstream->is_eod())
+ return(0);
+
+ int read_bits=this->_bit_par_block;
+ int write_bytes=this->_char_par_block*this->_byte_par_char;
+ switch(this->length-this->_read_length){
+ case 0:
+ return(0);
+ case 1:
+ read_bits=4;
+ write_bytes=1;
+ break;
+ case 2:
+ read_bits=7;
+ write_bytes=2;
+ break;
+ }
+ this->_read_buf=0;
+ bitstream->read(&(this->_read_buf),sizeof(this->_read_buf),
+ read_bits);
+ this->_read_buf=ntohs(this->_read_buf);
+ this->_read_length+=write_bytes;
+
+ int remain_bytes=this->byte_length-this->_written_length;
+ if(write_bytes>remain_bytes)
+ write_bytes=remain_bytes;
+
+ char format_str[5];
+ snprintf(format_str,5,"%%0%dd",write_bytes);
+ int ret=snprintf((char *)this->_current_pos,
+ write_bytes+1,
+ format_str,
+ this->_read_buf);
+
+ if(ret<0)
+ ret=0-ret;
+ this->_current_pos+=ret;
+ this->_written_length+=ret;
+
+ return(ret);
+ }
+
+
+ AlphabeticalDecoder::AlphabeticalDecoder()
+ {
+ this->mode=2;
+ this->_bit_par_block=11;
+ this->_char_par_block=2;
+ this->_byte_par_char=1;
+ }
+ int AlphabeticalDecoder::_get_charactor_count(int version)
+ {
+ return(CHARACTOR_COUNTS[version][1]);
+ }
+ int AlphabeticalDecoder::_read_data(BitStream *bitstream)
+ {
+ if(bitstream->is_eod())
+ return(0);
+
+ int read_bits=this->_bit_par_block;
+ int write_bytes=this->_char_par_block*this->_byte_par_char;
+ switch(this->length-this->_read_length){
+ case 0:
+ return(0);
+ case 1:
+ read_bits=6;
+ write_bytes=1;
+ break;
+ }
+ this->_read_buf=0;
+ bitstream->read(&(this->_read_buf),sizeof(this->_read_buf),
+ read_bits);
+ this->_read_buf=ntohs(this->_read_buf);
+ this->_read_length+=write_bytes;
+
+ int remain_bytes=this->byte_length-this->_written_length;
+ int ret=0;
+ if(read_bits==this->_bit_par_block){
+ int x=this->_read_buf/45;
+ char c=NUM2ALPABET[x];
+ if(remain_bytes>0){
+ if(snprintf((char *)this->_current_pos,2,"%c",c)>0){
+ ret++;
+ this->_current_pos++;
+ remain_bytes--;
+ this->_written_length++;
+ }
+ }
+ }
+ if(remain_bytes>0){
+ int x=this->_read_buf%45;
+ char c=NUM2ALPABET[x];
+ if(snprintf((char *)this->_current_pos,2,"%c",c)>0){
+ ret++;
+ this->_current_pos++;
+ remain_bytes--;
+ this->_written_length++;
+ }
+ }
+
+ return(ret);
+ }
+
+ ByteDecoder::ByteDecoder()
+ {
+ this->mode=4;
+ this->_bit_par_block=8;
+ this->_char_par_block=1;
+ this->_byte_par_char=1;
+ }
+ int ByteDecoder::_get_charactor_count(int version)
+ {
+ return(CHARACTOR_COUNTS[version][2]);
+ }
+ int ByteDecoder::_read_data(BitStream *bitstream)
+ {
+ if(bitstream->is_eod())
+ return(0);
+
+ int read_bits=this->_bit_par_block;
+ int write_bytes=this->_char_par_block*this->_byte_par_char;
+ this->_read_buf=0;
+ bitstream->read(&(this->_read_buf),sizeof(this->_read_buf),
+ read_bits);
+ this->_read_length+=write_bytes;
+
+ if(this->byte_length-this->_written_length){
+ *this->_current_pos=(unsigned char)this->_read_buf;
+ this->_current_pos++;
+ this->_written_length++;
+ return(1);
+ }
+ else{
+ return(0);
+ }
+ }
+
+ GenericDecoder::GenericDecoder()
+ {
+ this->mode=7;
+ }
+ int GenericDecoder::_get_charactor_count(int version)
+ {
+ return(0);
+ }
+ int GenericDecoder::_read_data(BitStream *bitstream)
+ {
+ return(0);
+ }
+
+ KanjiDecoder::KanjiDecoder()
+ {
+ this->mode=8;
+ this->_bit_par_block=13;
+ this->_char_par_block=1;
+ this->_byte_par_char=2;
+ }
+ int KanjiDecoder::_get_charactor_count(int version)
+ {
+ return(CHARACTOR_COUNTS[version][3]);
+ }
+ int KanjiDecoder::_read_data(BitStream *bitstream)
+ {
+ if(bitstream->is_eod())
+ return(0);
+
+ int read_bits=this->_bit_par_block;
+ int write_bytes=this->_char_par_block*this->_byte_par_char;
+ if(this->length-this->_read_length<=0)
+ return(0);
+
+ this->_read_buf=0;
+ bitstream->read(&(this->_read_buf),sizeof(this->_read_buf),
+ read_bits);
+ this->_read_buf=ntohs(this->_read_buf);
+ this->_read_length++;
+
+ if(this->byte_length-this->_written_length>=write_bytes){
+ int c=this->_read_buf/0xc0;
+ c*=0x100;
+ c+=this->_read_buf%0xc0;
+ if(c>=0x1f00)
+ c+=0xc140;
+ else
+ c+=0x8140;
+
+ unsigned char c1=(unsigned char)(c/0x100);
+ unsigned char c2=(unsigned char)(c%0x100);
+
+ *this->_current_pos=c1;
+ *(this->_current_pos+1)=c2;
+ this->_current_pos+=2;
+ this->_written_length+=2;
+ return(2);
+ }
+ else
+ return(0);
+ }
+ };
+};
+
+
diff --git a/src/libdecodeqr/ecidecoder.h b/src/libdecodeqr/ecidecoder.h
new file mode 100644
index 0000000..1708302
--- /dev/null
+++ b/src/libdecodeqr/ecidecoder.h
@@ -0,0 +1,110 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// ecidecoder.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: ecidecoder.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __QR_ECI_DECODER__
+#define __QR_ECI_DECODER__
+
+#include <stdio.h>
+
+#ifdef WIN32
+#include <winsock2.h>
+#define snprintf _snprintf
+#else
+#include <netinet/in.h>
+#endif
+
+#include "bitstream.h"
+
+namespace Qr{
+ namespace ECI{
+ class Decoder{
+ public:
+ int mode;
+ int length;
+ int byte_length;
+ int eci_mode;
+
+ protected:
+ unsigned char *_raw_data;
+ int _bit_par_block;
+ int _char_par_block;
+ int _byte_par_char;
+
+ int _read_length;
+ int _written_length;
+ unsigned char *_current_pos;
+
+ public:
+ Decoder();
+ ~Decoder();
+
+ unsigned char *raw_data();
+ virtual int decode(int version,BitStream *bitstream);
+
+ private:
+ virtual int _read_header(int version,BitStream *bitstream);
+ virtual int _get_charactor_count(int version)=0;
+ virtual int _read_data(BitStream *bitstream);
+ };
+
+ class NumericalDecoder :public Decoder{
+ private:
+ short _read_buf;
+ public:
+ NumericalDecoder();
+ private:
+ virtual int _get_charactor_count(int version);
+ virtual int _read_data(BitStream *bitstream);
+ };
+
+ class AlphabeticalDecoder :public Decoder{
+ private:
+ short _read_buf;
+ public:
+ AlphabeticalDecoder();
+ private:
+ virtual int _get_charactor_count(int version);
+ virtual int _read_data(BitStream *bitstream);
+ };
+
+ class ByteDecoder :public Decoder{
+ private:
+ char _read_buf;
+ public:
+ ByteDecoder();
+ private:
+ virtual int _get_charactor_count(int version);
+ virtual int _read_data(BitStream *bitstream);
+ };
+
+ class GenericDecoder :public Decoder{
+ public:
+ GenericDecoder();
+ private:
+ virtual int _get_charactor_count(int version);
+ virtual int _read_data(BitStream *bitstream);
+ };
+
+ class KanjiDecoder :public Decoder{
+ private:
+ short _read_buf;
+ public:
+ KanjiDecoder();
+ private:
+ virtual int _get_charactor_count(int version);
+ virtual int _read_data(BitStream *bitstream);
+ };
+ };
+}
+
+#endif
diff --git a/src/libdecodeqr/formatinfo.cpp b/src/libdecodeqr/formatinfo.cpp
new file mode 100644
index 0000000..f99ef2d
--- /dev/null
+++ b/src/libdecodeqr/formatinfo.cpp
@@ -0,0 +1,195 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// formatinfo.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: formatinfo.cpp 36 2007-02-21 23:22:03Z zophos $
+//
+#include "formatinfo.h"
+
+namespace Qr{
+ unsigned char MaskPatterner000::pixel(int i,int j)
+ {
+ return((i+j)%2?0:255);
+ }
+ unsigned char MaskPatterner001::pixel(int i,int j)
+ {
+ return(i%2?0:255);
+ }
+ unsigned char MaskPatterner010::pixel(int i,int j)
+ {
+ return(j%3?0:255);
+ }
+ unsigned char MaskPatterner011::pixel(int i,int j)
+ {
+ return((i+j)%3?0:255);
+ }
+ unsigned char MaskPatterner100::pixel(int i,int j)
+ {
+ return((i/2+j/3)%2?0:255);
+ }
+ unsigned char MaskPatterner101::pixel(int i,int j)
+ {
+ return(((i*j)%2)+((i*j)%3)?0:255);
+ }
+ unsigned char MaskPatterner110::pixel(int i,int j)
+ {
+ return((((i*j)%2)+((i*j)%3))%2?0:255);
+ }
+ unsigned char MaskPatterner111::pixel(int i,int j)
+ {
+ return((((i*j)%3)+((i*j)%2))%2?0:255);
+ }
+
+ FormatInfo::FormatInfo()
+ {
+ this->level=0;
+ this->mask_pattern=0;
+ this->status=0;
+
+ this->_patterner=NULL;
+ }
+ FormatInfo::~FormatInfo()
+ {
+ if(this->_patterner)
+ delete this->_patterner;
+ }
+
+ int FormatInfo::set_level(int l)
+ {
+ this->level=l;
+ if(l<0||l>3){
+ this->status|=QR_FORMATINFO_INVALID_LEVEL;
+ this->level=0;
+ }
+ return(this->level);
+ }
+ int FormatInfo::set_mask_pattern(int m)
+ {
+ if(this->_patterner)
+ delete this->_patterner;
+
+ this->mask_pattern=m;
+ switch(this->mask_pattern){
+ case 0:
+ this->_patterner=new MaskPatterner000();
+ break;
+ case 1:
+ this->_patterner=new MaskPatterner001();
+ break;
+ case 2:
+ this->_patterner=new MaskPatterner010();
+ break;
+ case 3:
+ this->_patterner=new MaskPatterner011();
+ break;
+ case 4:
+ this->_patterner=new MaskPatterner100();
+ break;
+ case 5:
+ this->_patterner=new MaskPatterner101();
+ break;
+ case 6:
+ this->_patterner=new MaskPatterner110();
+ break;
+ case 7:
+ this->_patterner=new MaskPatterner111();
+ break;
+ }
+
+ return(this->mask_pattern);
+ }
+
+ int FormatInfo::decode_formatinfo(unsigned short data)
+ {
+ data^=QR_FORMAT_INFO_XOR_MASK;
+
+ this->status=0;
+ int ret=this->_error_correct(&data);
+
+ this->set_level(data>>13);
+ this->set_mask_pattern((data>>10)&0x7);
+
+ if(ret<0)
+ this->status|=QR_FORMATINFO_UNRECOVERABLE;
+
+ return(ret);
+ }
+
+ int FormatInfo::_error_correct(unsigned short *src)
+ {
+ Galois::Field *gf=new Galois::Field(4);
+ Galois::BCH *bch=new Galois::BCH(gf,15,3);
+ unsigned short mask=0x01;
+ int i;
+ for(i=0;i<15;i++,mask<<=1){
+ if(*src&mask)
+ bch->set(i,gf->exp2nomial(0));
+ else
+ bch->set(i,gf->zero());
+ }
+ int errors=bch->decode();
+ if(errors>0){
+ mask=0x01;
+ for(i=0;i<errors;i++)
+ (*src)^=(mask<<bch->error_pos[i]);
+ }
+
+ delete bch;
+ delete gf;
+ return(errors);
+ }
+
+ unsigned char FormatInfo::mask_pixel(int i,int j){
+ return(this->_patterner->pixel(i,j));
+ }
+
+ FormatInfo *FormatInfo::init_each_pattern_pixel()
+ {
+ this->_pattern_c=0;
+ return(this);
+ }
+ FormatInfo *FormatInfo::each_pattern_pixel(int *x,int *y)
+ {
+ if(this->_pattern_c<16){
+ *x=format_info_addr[0][this->_pattern_c][0];
+ *y=format_info_addr[0][this->_pattern_c][1];
+ }
+ else if(this->_pattern_c<32){
+ *x=format_info_addr[1][this->_pattern_c-16][0];
+ *y=format_info_addr[1][this->_pattern_c-16][1];
+ }
+ else
+ return(NULL);
+
+ this->_pattern_c++;
+ return(this);
+ }
+ FormatInfo *FormatInfo::each_pattern_pixel(int pos,int *x,int *y)
+ {
+ switch(pos){
+ case 0:
+ if(this->_pattern_c>14)
+ return(NULL);
+ break;
+ case 1:
+ if(this->_pattern_c>15)
+ return(NULL);
+ break;
+ default:
+ return(NULL);
+ }
+
+ *x=format_info_addr[pos][this->_pattern_c][0];
+ *y=format_info_addr[pos][this->_pattern_c][1];
+
+ this->_pattern_c++;
+ return(this);
+ }
+}
diff --git a/src/libdecodeqr/formatinfo.h b/src/libdecodeqr/formatinfo.h
new file mode 100644
index 0000000..e4cefd7
--- /dev/null
+++ b/src/libdecodeqr/formatinfo.h
@@ -0,0 +1,113 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// formatinfo.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: formatinfo.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __QR_FORMAT_INFO__
+#define __QR_FORMAT_INFO__
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#include "qrerror.h"
+#include "galois.h"
+
+#define QR_FORMAT_INFO_GX 0x537 // G(x)=x^10+x^8+x^5+x^4+x^2+x+1
+#define QR_FORMAT_INFO_XOR_MASK 0x5412 //0101010000010010B
+#define QR_FORMAT_INFO_DATA_SIZE 15
+
+namespace Qr{
+ //
+ // format info;
+ // matrix of (x,y); minus value means SymbolLength - Value;
+ // e.g; symbol size = 21 x 21, values {1,-1} points {1,20} module
+ //
+ const int format_info_addr[2][16][2]={
+ {
+ {0,8},{1,8},{2,8},{3,8},{4,8},{5,8},{7,8},
+ {8,8},{8,7},{8,5},{8,4},{8,3},{8,2},{8,1},{8,0}
+ },
+ {
+ {8,-8}, // always black
+ {8,-1},{8,-2},{8,-3},{8,-4},{8,-5},{8,-6},{8,-7},
+ {-8,8},{-7,8},{-6,8},{-5,8},{-4,8},{-3,8},{-2,8},{-1,8}
+ }
+ };
+
+ class MaskPatterner{
+ public:
+ virtual unsigned char pixel(int i,int j)=0;
+ };
+ class MaskPatterner000:public MaskPatterner{
+ public:
+ virtual unsigned char pixel(int i,int j);
+ };
+ class MaskPatterner001:public MaskPatterner{
+ public:
+ virtual unsigned char pixel(int i,int j);
+ };
+ class MaskPatterner010:public MaskPatterner{
+ public:
+ virtual unsigned char pixel(int i,int j);
+ };
+ class MaskPatterner011:public MaskPatterner{
+ public:
+ virtual unsigned char pixel(int i,int j);
+ };
+ class MaskPatterner100:public MaskPatterner{
+ public:
+ virtual unsigned char pixel(int i,int j);
+ };
+ class MaskPatterner101:public MaskPatterner{
+ public:
+ virtual unsigned char pixel(int i,int j);
+ };
+ class MaskPatterner110:public MaskPatterner{
+ public:
+ virtual unsigned char pixel(int i,int j);
+ };
+ class MaskPatterner111:public MaskPatterner{
+ public:
+ virtual unsigned char pixel(int i,int j);
+ };
+
+ class FormatInfo{
+ public:
+ int level;
+ int mask_pattern;
+ short status;
+
+ private:
+ MaskPatterner *_patterner;
+
+ int _pattern_c;
+
+ public:
+ FormatInfo();
+ ~FormatInfo();
+
+ int set_level(int l);
+ int set_mask_pattern(int m);
+
+ int decode_formatinfo(unsigned short data);
+
+ unsigned char mask_pixel(int i,int j);
+
+ FormatInfo *init_each_pattern_pixel();
+ FormatInfo *each_pattern_pixel(int *x,int *y);
+ FormatInfo *each_pattern_pixel(int pos,int *x,int *y);
+
+ private:
+ int _error_correct(unsigned short *src);
+ };
+}
+#endif
diff --git a/src/libdecodeqr/galois.cpp b/src/libdecodeqr/galois.cpp
new file mode 100644
index 0000000..78b6508
--- /dev/null
+++ b/src/libdecodeqr/galois.cpp
@@ -0,0 +1,593 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// galois.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: galois.cpp 38 2007-02-23 21:16:42Z zophos $
+//
+#include "galois.h"
+
+namespace Galois{
+
+ /////////////////////////////////////////////////////////////////////
+ //
+ // galois field GF(2^4); G(x)=x^10+x^8+x^5+x^4+x^2+x+1
+ //
+
+ //
+ // generator polynomial
+ //
+ static const int bch_15_5_generator_polynomial[11]={
+ 1,1,1,0,1,1,0,0,1,0,1
+ };
+
+ //
+ // exponent -> vector notation convert table
+ //
+ static const unsigned int gf2_4_exp2vect[16]={
+ 1,2,4,8,3,6,12,11,5,10,7,14,15,13,9,0
+ };
+
+ //
+ // vector -> exponent notation convert table
+ //
+ static const unsigned int gf2_4_vect2exp[16]={
+ 15,0,1,4,2,8,5,10,3,14,9,7,6,13,11,12
+ };
+
+ /////////////////////////////////////////////////////////////////////
+ //
+ // galois field GF(2^8); G(x)=X^8+x^4+x^3+x^2+1
+ //
+
+ //
+ // generator polynomial
+ //
+ static const int bch_16_8_generator_polynomial[9]={
+ 1,0,1,1,1,0,0,0,1
+ };
+
+ //
+ // exponent -> vector notation convert table
+ //
+ static const unsigned int gf2_8_exp2vect[256]={
+ 1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,
+ 76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,
+ 157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,
+ 70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,
+ 95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,
+ 253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,
+ 217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,
+ 129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,
+ 133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,
+ 168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,
+ 230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,
+ 227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,
+ 130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,
+ 81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,
+ 18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,
+ 44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0
+ };
+
+ //
+ // vector -> exponent notation convert table
+ //
+ static const unsigned int gf2_8_vect2exp[256]={
+ 255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,
+ 4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,
+ 5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,
+ 29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,
+ 6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,
+ 54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,
+ 30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,
+ 202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,
+ 7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,
+ 227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,
+ 55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,
+ 242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,
+ 31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,
+ 108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,
+ 203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,
+ 79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175
+ };
+
+ //
+ // G(x)=x^12+x^11+x^10+x^9+x^8+x^5+x^2+1
+ //
+ static const int bch_18_6_generator_polynomial[13]={
+ 1,0,1,0,0,1,0,0,1,1,1,1,1
+ };
+
+
+ /////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ Nomial::Nomial(void *gf,unsigned int x)
+ {
+ this->val=x;
+ this->_gf=gf;
+ ((Field *)(this->_gf))->pool[x]=this;
+ }
+
+ Nomial *Nomial::instance(void *gf,unsigned int x)
+ {
+ x=x%(((Field *)gf)->pool_size());
+ if(!((Field *)gf)->pool[x])
+ new Nomial(gf,x);
+
+ return(((Field *)gf)->pool[x]);
+ }
+
+ Nomial *Nomial::dup()
+ {
+ return(Nomial::instance(this->_gf,this->val));
+ }
+
+
+ unsigned int Nomial::to_exp()
+ {
+ return(this->val);
+ }
+ unsigned int Nomial::to_vect()
+ {
+ return(((Field *)this->_gf)->exp2vect[this->val]);
+ }
+
+ inline int Nomial::m()
+ {
+ return(((Field *)(this->_gf))->m);
+ }
+ inline int Nomial::n()
+ {
+ return(((Field *)(this->_gf))->n);
+ }
+ inline unsigned int Nomial::exp2vect(unsigned int x)
+ {
+ return(((Field *)(this->_gf))->exp2vect[x]);
+ }
+ inline unsigned int Nomial::vect2exp(unsigned int x)
+ {
+ return(((Field *)(this->_gf))->vect2exp[x]);
+ }
+
+ bool Nomial::is_zero()
+ {
+ return(this->to_vect()==0);
+ }
+ bool Nomial::operator==(Nomial x)
+ {
+ return(this->val==x.val);
+ }
+ bool Nomial::operator!=(Nomial x)
+ {
+ return(this->val!=x.val);
+ }
+ Nomial Nomial::operator+(Nomial x)
+ {
+ return(*Nomial::instance(this->_gf,
+ this->vect2exp(this->to_vect()^
+ x.to_vect())));
+ }
+ Nomial Nomial::operator-(Nomial x)
+ {
+ return(*this+x);
+ }
+ Nomial Nomial::operator*(Nomial x)
+ {
+ if(this->is_zero()||x.is_zero())
+ return(*(((Field *)(this->_gf))->zero()));
+ else
+ return(*Nomial::instance(this->_gf,(this->val+x.val)%this->n()));
+
+ }
+ Nomial Nomial::operator/(Nomial x)
+ {
+ if(x.is_zero())
+ throw(x);
+ else if(this->is_zero())
+ return(*(((Field *)(this->_gf))->zero()));
+ else
+ return(*Nomial::instance(this->_gf,
+ (this->val+this->n()-x.val)%this->n()));
+ }
+
+ /////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ Field::Field(int m)
+ {
+ this->_need_delete=false;
+
+ this->m=m;
+ int i;
+ for(i=0,this->n=1;i<m;i++)
+ this->n*=2;
+ this->n-=1;
+
+ switch(this->m){
+ case 4:
+ this->exp2vect=(unsigned int *)gf2_4_exp2vect;
+ this->vect2exp=(unsigned int *)gf2_4_vect2exp;
+ break;
+ case 8:
+ this->exp2vect=(unsigned int *)gf2_8_exp2vect;
+ this->vect2exp=(unsigned int *)gf2_8_vect2exp;
+ break;
+ default:
+ throw;
+ }
+
+ this->_pool_size=this->n+1;
+ this->pool=new Nomial *[this->_pool_size];
+ for(i=0;i<this->_pool_size;i++){
+ this->pool[i]=NULL;
+ Nomial::instance(this,i);
+ }
+ }
+ Field::~Field()
+ {
+ delete this->pool;
+ if(this->_need_delete){
+ delete this->exp2vect;
+ delete this->vect2exp;
+ }
+ }
+
+ int Field::pool_size()
+ {
+ return(this->_pool_size);
+ }
+
+ Nomial *Field::exp2nomial(unsigned int x)
+ {
+ return(this->pool[x%(this->n)]);
+ }
+ Nomial *Field::vect2nomial(unsigned int x)
+ {
+ return(this->pool[this->vect2exp[x%(this->n)]]);
+ }
+ Nomial *Field::zero()
+ {
+ return(this->pool[this->n]);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ Polynomial::Polynomial()
+ {
+ this->cols=0;
+ this->rows=0;
+
+ this->nomial=NULL;
+ }
+
+ Polynomial::Polynomial(int rows)
+ {
+ this->cols=1;
+ this->rows=rows;
+
+ this->nomial=new Galois::Nomial *[this->rows];
+ }
+ Polynomial::Polynomial(int cols,int rows)
+ {
+ this->cols=cols;
+ this->rows=rows;
+
+ this->nomial=new Nomial *[this->cols*this->rows];
+ }
+ Polynomial::~Polynomial()
+ {
+ delete this->nomial;
+ }
+
+ Polynomial *Polynomial::dup()
+ {
+ Polynomial *ret=new Polynomial(this->cols,this->rows);
+ memcpy(ret->nomial,this->nomial,
+ sizeof(Nomial *)*this->cols*this->rows);
+
+ return(ret);
+ }
+ Polynomial *Polynomial::dup(int count)
+ {
+ return(this->dup(0,0,count,count));
+ }
+ Polynomial *Polynomial::dup(int start_col,int start_row,int count)
+ {
+ return(this->dup(start_col,start_row,count,count));
+ }
+ Polynomial *Polynomial::dup(int start_col,int start_row,
+ int col_count,int row_count)
+ {
+ Polynomial *ret=new Polynomial(col_count,row_count);
+
+ for(int i=0,c=start_col;i<col_count;i++,c++){
+ for(int j=0,r=start_row;j<row_count;j++,r++){
+ ret->set(i,j,this->get(c,r));
+ }
+ }
+
+ return(ret);
+ }
+
+
+ Nomial *Polynomial::set(int row,Nomial *val)
+ {
+ return(this->set(0,row,val));
+ }
+ Nomial *Polynomial::set(int col,int row,Nomial *val)
+ {
+ this->nomial[col*rows+row]=val->dup();
+ return(this->nomial[col*rows+row]);
+ }
+
+ Nomial *Polynomial::get(int row)
+ {
+ return(this->get(0,row));
+ }
+ Nomial *Polynomial::get(int col,int row)
+ {
+ return(this->nomial[col*rows+row]->dup());
+ }
+
+
+ /////////////////////////////////////////////////////////////////////
+ //
+ // LU analyze with pivot selection
+ //
+ Polynomial *Polynomial::lu()
+ {
+ Polynomial *buf=this->dup();
+ Polynomial *ret=buf->_lu(buf);
+ if(!ret)
+ delete buf;
+ return(ret);
+ }
+ Polynomial *Polynomial::lu(int count)
+ {
+ Polynomial *buf=this->dup(0,0,count);
+ Polynomial *ret=buf->_lu(buf);
+ if(!ret)
+ delete buf;
+ return(ret);
+ }
+ Polynomial *Polynomial::lu(int start_col,int start_row,int count)
+ {
+ Polynomial *buf=this->dup(start_col,start_row,count);
+ Polynomial *ret=buf->_lu(buf);
+ if(!ret)
+ delete buf;
+ return(ret);
+ }
+
+ Polynomial *Polynomial::_lu(Polynomial *buf)
+ {
+ int count=buf->cols,i,j;
+ if(buf->rows<buf->cols)
+ count=buf->rows;
+
+ for(j=0;j<count;j++){
+ Nomial *l;
+ //
+ // pivot
+ //
+ for(i=j;i<count;i++){
+ l=buf->get(i,j);
+ if(!l->is_zero())
+ break;
+ }
+ if(i>=count)
+ return(NULL);
+ else if(i>j)
+ buf->swap_col(j,i);
+
+ for(i=j+1;i<count;i++){
+ Nomial *n=&(*buf->get(i,j)/(*l));
+ buf->set(i,j,n);
+ for(int k=j+1;k<count;k++){
+ Nomial *m=&(*buf->get(i,k)-*buf->get(j,k)**n);
+ *buf->set(i,k,m);
+ }
+ }
+ }
+ return(buf);
+ }
+
+ /////////////////////////////////////////////////////////////////////
+ //
+ // Gaussian elimination
+ //
+ Polynomial *Polynomial::solve()
+ {
+ Polynomial *lu=this->lu();
+ if(lu){
+ Polynomial *ret=this->solve(lu);
+ delete lu;
+ return(ret);
+ }
+ else{
+ return(NULL);
+ }
+ }
+
+ Polynomial *Polynomial::solve(Polynomial *lu)
+ {
+ if(!lu)
+ return(NULL);
+
+ if(lu->rows!=this->cols+1)
+ throw((void *)NULL);
+
+ //
+ // check rank
+ //
+ int rank=0,i,j,k;
+ for(j=0;j<lu->cols;j++){
+ bool is_zero_cols=true;
+ for(k=j;k<lu->cols;k++){
+ is_zero_cols&=lu->get(j,k)->is_zero();
+ }
+ if(!is_zero_cols)
+ rank++;
+ }
+ if(rank<lu->cols)
+ return(NULL);
+
+ Polynomial *ret=new Polynomial(lu->cols);
+ for(i=0;i<lu->cols;i++){
+ ret->set(i,lu->get(i,lu->cols));
+ }
+
+ for(j=0;j<lu->cols;j++){
+ for(i=j+1;i<lu->cols;i++){
+ ret->set(i,&(*ret->get(i)-*ret->get(j)**lu->get(i,j)));
+ }
+ }
+ for(j=lu->cols-1;j>=0;j--){
+ for(int i=j+1;i<lu->cols;i++){
+ ret->set(j,&(*ret->get(j)-
+ *lu->get(j,i)**ret->get(i)));
+ }
+ ret->set(j,&(*ret->get(j)/(*lu->get(j,j))));
+ }
+ return(ret);
+ }
+
+ void Polynomial::swap_col(int i,int j)
+ {
+ size_t sz=sizeof(Nomial *)*this->rows;
+
+ Nomial **tmp=new Nomial *[this->rows];
+
+ memcpy(tmp,this->nomial+i*this->rows,sz);
+ memcpy(this->nomial+i*this->rows,
+ this->nomial+j*this->rows,sz);
+ memcpy(this->nomial+j*this->rows,tmp,sz);
+
+ delete tmp;
+ }
+
+
+ /////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ BCH::BCH(Field *gf,int size,int capability)
+ {
+ this->_gf=gf;
+ this->rows=size;
+ this->cols=1;
+ this->_capability=capability;
+ this->error_size=0;
+ this->error_pos=NULL;
+ this->nomial=new Galois::Nomial *[this->rows];
+ this->syndrome_size=0;
+ this->syndromes=NULL;
+ }
+ BCH::~BCH()
+ {
+ if(this->error_pos)
+ delete this->error_pos;
+
+ if(this->syndromes)
+ delete this->syndromes;
+ }
+
+ int BCH::decode(int syndrome_base)
+ {
+ //
+ // error syndromes
+ //
+ this->syndrome_size=this->_capability*2+syndrome_base;
+ this->syndromes=new Galois::Nomial *[this->syndrome_size];
+
+ int errors=0,i;
+ for(i=0;i<this->syndrome_size;i++){
+ this->syndromes[i]=this->_error_syndrome(i);
+ if(!this->syndromes[i]->is_zero())
+ errors++;
+ }
+ if(!errors)
+ return(0);
+
+ //
+ // calculate error position variables
+ //
+ Galois::Polynomial *err=NULL;
+ for(errors=this->_capability;errors>0;errors--){
+ Galois::Polynomial *mat=new Galois::Polynomial(errors,
+ errors+1);
+
+ for(int j=0;j<errors;j++){
+ for(i=0;i<=errors;i++){
+ mat->set(j,i,this->syndromes[i+j+syndrome_base]);
+ }
+ }
+
+ err=mat->solve();
+ delete mat;
+
+ if(err)
+ break;
+ }
+ if(!err){
+ this->error_size=-1;
+ return(-1);
+ }
+
+ if(err){
+ //
+ // get error position
+ //
+ this->error_pos=new int[errors];
+ memset(this->error_pos,-1,errors);
+
+ int c,i,j;
+ for(j=0,c=0;j<this->rows;j++){
+ Galois::Nomial *sigma=err->get(0);
+ for(i=1;i<errors;i++){
+ sigma=&(*sigma+*err->get(i)*
+ *this->_gf->exp2nomial(j*i));
+ }
+ sigma=&(*sigma+*this->_gf->exp2nomial(j*i));
+
+ if(sigma->is_zero()){
+ if(c<errors){
+ this->error_pos[c]=j;
+ }
+ c++;
+ }
+ }
+ delete err;
+ if(c==errors)
+ this->error_size=errors;
+ else
+ this->error_size=-1;
+ }
+
+ return(this->error_size);
+ }
+
+ Galois::Nomial *BCH::_error_syndrome(int d)
+ {
+ Galois::Nomial *x=this->_gf->zero();
+
+ for(int i=0;i<this->rows;i++){
+ x=&(*x+*this->get(i)*
+ *this->_gf->exp2nomial(i*d));
+ }
+
+ return(x->dup());
+ }
+
+}
diff --git a/src/libdecodeqr/galois.h b/src/libdecodeqr/galois.h
new file mode 100644
index 0000000..f362c07
--- /dev/null
+++ b/src/libdecodeqr/galois.h
@@ -0,0 +1,134 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// galois.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: galois.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __GALOIS__
+#define __GALOIS__
+
+#include <memory.h>
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+namespace Galois{
+ class Nomial{
+ public:
+ unsigned int val;
+
+ private:
+ void *_gf;
+
+ public:
+ static Nomial *instance(void * gf,unsigned int x);
+ Nomial *dup();
+
+ unsigned int to_exp();
+ unsigned int to_vect();
+
+ inline int m();
+ inline int n();
+ inline unsigned int exp2vect(unsigned int x);
+ inline unsigned int vect2exp(unsigned int x);
+
+ bool is_zero();
+ bool operator==(Nomial x);
+ bool operator!=(Nomial x);
+ Nomial operator+(Nomial x);
+ Nomial operator-(Nomial x);
+ Nomial operator*(Nomial x);
+ Nomial operator/(Nomial x);
+
+ protected:
+ Nomial(void * gf,unsigned int x);
+ };
+
+ class Field{
+ public:
+ int m;
+ int n;
+ unsigned int *exp2vect;
+ unsigned int *vect2exp;
+ Nomial **pool;
+ private:
+ int _pool_size;
+ bool _need_delete;
+
+ public:
+ Field(int m);
+ ~Field();
+
+ int pool_size();
+
+ Nomial *exp2nomial(unsigned int x);
+ Nomial *vect2nomial(unsigned int x);
+ Nomial *zero();
+ };
+
+
+ class Polynomial{
+ public:
+ int cols;
+ int rows;
+ Nomial **nomial;
+
+ Polynomial();
+ Polynomial(int rows);
+ Polynomial(int cols,int rows);
+ ~Polynomial();
+
+ Polynomial *dup();
+ Polynomial *dup(int count);
+ Polynomial *dup(int start_col,int start_row,int count);
+ Polynomial *dup(int start_col,int start_row,
+ int col_count,int row_count);
+
+ Nomial *set(int row,Nomial *val);
+ Nomial *set(int col,int row,Nomial *val);
+
+ Nomial *get(int row);
+ Nomial *get(int col,int row);
+
+ Polynomial *lu();
+ Polynomial *lu(int count);
+ Polynomial *lu(int start_col,int start_row,int count);
+ Polynomial *_lu(Polynomial *buf);
+
+ Polynomial *solve();
+ Polynomial *solve(Polynomial *lu);
+
+ void swap_col(int i,int j);
+ };
+
+ class BCH :public Polynomial{
+ public:
+ int error_size;
+ int *error_pos;
+ int syndrome_size;
+ Galois::Nomial **syndromes;
+
+ private:
+ Field *_gf;
+ int _capability;
+
+ public:
+ BCH(Field *gf,int size,int capability);
+ ~BCH();
+
+ int decode(int syndorome_base=0);
+
+ private:
+ Galois::Nomial *_error_syndrome(int d);
+ };
+}
+
+#endif
diff --git a/src/libdecodeqr/imagereader.cpp b/src/libdecodeqr/imagereader.cpp
new file mode 100644
index 0000000..8bb7f29
--- /dev/null
+++ b/src/libdecodeqr/imagereader.cpp
@@ -0,0 +1,1099 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// imagereader.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: imagereader.cpp 36 2007-02-21 23:22:03Z zophos $
+//
+#include "imagereader.h"
+
+namespace Qr{
+
+ //
+ // avoid cvBoundingRect() fxxcin' bug.
+ //
+ typedef struct{
+ CvRect feret;
+ CvSeq *contour;
+ } ImageReaderCandidate;
+
+
+ /////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ ImageReader::ImageReader()
+ {
+ this->_init();
+ }
+ ImageReader::ImageReader(int width,int height,int depth,int channel)
+ {
+ this->_init();
+ this->_alloc_image(width,height,depth,channel);
+ }
+ ImageReader::~ImageReader()
+ {
+ if(this->qr)
+ delete this->qr;
+
+ if(this->_seq_code_area_contour)
+ cvRelease((void **)&this->_seq_code_area_contour);
+
+ cvRelease((void **)&this->_seq_finder_pattern);
+ cvReleaseMemStorage(&this->_stor_tmp);
+ cvReleaseMemStorage(&this->_stor);
+
+ this->release_image();
+ }
+
+ void ImageReader::_init()
+ {
+ memset(this->_coderegion_vertexes,0,sizeof(CvPoint)*4);
+ memset(this->_finderpattern_boxes,0,sizeof(CvBox2D)*3);
+
+ this->_img_src_internal=NULL;
+ this->_img_src=NULL;
+ this->_img_transformed=NULL;
+ this->_img_binarized=NULL;
+ this->_img_tmp_1c=NULL;
+
+ this->_stor=cvCreateMemStorage(0);
+ this->_stor_tmp=cvCreateMemStorage(0);
+
+ this->_seq_finder_pattern=cvCreateSeq(CV_SEQ_ELTYPE_GENERIC,
+ sizeof(CvSeq),
+ sizeof(CvBox2D),
+ this->_stor);
+ this->_seq_code_area_contour=NULL;
+
+ this->status=0;
+ this->qr=NULL;
+ }
+ void ImageReader::_alloc_image(int width,int height,int depth,int channel)
+ {
+ this->_img_src_internal=cvCreateImage(cvSize(width,height),
+ depth,channel);
+ cvZero(this->_img_src_internal);
+ this->_img_src=this->_img_src_internal;
+
+ this->_img_transformed=cvCloneImage(this->_img_src);
+ this->_img_binarized=cvCreateImage(cvSize(this->_img_src->width,
+ this->_img_src->height),
+ IPL_DEPTH_8U,1);
+ cvZero(this->_img_binarized);
+ this->_img_tmp_1c=cvCloneImage(this->_img_binarized);
+ }
+
+ IplImage *ImageReader::set_image(IplImage *src)
+ {
+ this->release_image();
+
+ this->_img_src=src;
+ this->_img_transformed=cvCloneImage(this->_img_src);
+ this->_img_binarized=cvCreateImage(cvSize(this->_img_src->width,
+ this->_img_src->height),
+ IPL_DEPTH_8U,1);
+ cvZero(this->_img_binarized);
+ this->_img_tmp_1c=cvCloneImage(this->_img_binarized);
+
+ return(this->_img_src);
+ }
+
+ IplImage *ImageReader::set_image(int width,int height,
+ int depth,int channel)
+ {
+ this->release_image();
+ this->_alloc_image(width,height,depth,channel);
+
+ return(this->_img_src);
+ }
+
+ void ImageReader::release_image()
+ {
+ if(this->_img_tmp_1c)
+ cvReleaseImage(&this->_img_tmp_1c);
+ if(this->_img_binarized)
+ cvReleaseImage(&this->_img_binarized);
+ if(this->_img_transformed)
+ cvReleaseImage(&this->_img_transformed);
+ if(this->_img_src_internal)
+ cvReleaseImage(&this->_img_src_internal);
+
+ this->_img_tmp_1c=NULL;
+ this->_img_binarized=NULL;
+ this->_img_transformed=NULL;
+ this->_img_src_internal=NULL;
+ this->_img_src=NULL;
+ }
+
+
+ IplImage *ImageReader::src_buffer()
+ {
+ return(this->_img_src);
+ }
+ IplImage *ImageReader::transformed_buffer()
+ {
+ return(this->_img_transformed);
+ }
+ IplImage *ImageReader::binarized_buffer()
+ {
+ return(this->_img_binarized);
+ }
+ IplImage *ImageReader::tmp_buffer()
+ {
+ return(this->_img_tmp_1c);
+ }
+ CvPoint *ImageReader::coderegion_vertexes()
+ {
+ return(this->_coderegion_vertexes);
+ }
+ CvBox2D *ImageReader::finderpattern_boxes()
+ {
+ return(this->_finderpattern_boxes);
+ }
+
+
+ Qr *ImageReader::decode(int adaptive_th_size,
+ int adaptive_th_delta)
+ {
+ if(this->status&QR_IMAGEREADER_WORKING)
+ return(NULL);
+
+ if(!this->_img_src){
+ this->status=(QR_IMAGEREADER_ERROR|
+ QR_IMAGEREADER_NOT_INVALID_SRC_IMAGE);
+ return(NULL);
+ }
+
+ this->status=QR_IMAGEREADER_WORKING;
+
+ cvResetImageROI(this->_img_transformed);
+ cvResetImageROI(this->_img_binarized);
+ cvResetImageROI(this->_img_tmp_1c);
+
+ Qr *ret=this->_decode(adaptive_th_size,adaptive_th_delta);
+
+ this->status^=QR_IMAGEREADER_WORKING;
+ return(ret);
+ }
+
+ Qr *ImageReader::decode(IplImage *src,
+ int adaptive_th_size,
+ int adaptive_th_delta)
+ {
+ if(this->status&QR_IMAGEREADER_WORKING)
+ return(NULL);
+
+ this->status=QR_IMAGEREADER_WORKING;
+
+ this->set_image(src);
+ Qr *ret=this->_decode(adaptive_th_size,adaptive_th_delta);
+
+ this->_img_src=NULL;
+
+ this->status^=QR_IMAGEREADER_WORKING;
+ return(ret);
+ }
+
+
+ Qr *ImageReader::_decode(int adaptive_th_size,int adaptive_th_delta)
+ {
+ if(this->qr){
+ delete this->qr;
+ this->qr=NULL;
+ }
+
+ memset(this->_coderegion_vertexes,0,sizeof(CvPoint)*4);
+ memset(this->_finderpattern_boxes,0,sizeof(CvBox2D)*3);
+
+ //
+ // binarize
+ //
+ if(this->_img_src->nChannels>1)
+ cvCvtColor(this->_img_src,this->_img_tmp_1c,CV_BGR2GRAY);
+ else
+ cvCopy(this->_img_src,this->_img_tmp_1c);
+
+ cvSmooth(this->_img_tmp_1c,this->_img_binarized,CV_MEDIAN,3);
+ cvCopy(this->_img_binarized,this->_img_tmp_1c);
+ if(adaptive_th_size>0)
+ cvAdaptiveThreshold(this->_img_tmp_1c,
+ this->_img_binarized,
+ 128,CV_ADAPTIVE_THRESH_MEAN_C,
+ CV_THRESH_BINARY_INV,
+ adaptive_th_size,
+ adaptive_th_delta);
+ else
+ cvThreshold(this->_img_tmp_1c,
+ this->_img_binarized,
+ adaptive_th_delta,
+ 255,CV_THRESH_BINARY_INV);
+
+ //
+ // find finder patterns from binarized image
+ //
+ this->_find_finder_pattern();
+ if(this->_seq_finder_pattern->total!=3){
+ this->status|=(QR_IMAGEREADER_ERROR|
+ QR_IMAGEREADER_NOT_FOUND_FINDER_PATTERN);
+ return(NULL);
+ }
+
+ //
+ // find code area from binarized image using finder patterns
+ //
+ this->_find_code_area_contour(FIND_CODE_AREA_POLY_APPROX_TH);
+
+ if(!this->_seq_code_area_contour||
+ this->_seq_code_area_contour->total!=4){
+ this->status|=(QR_IMAGEREADER_ERROR|
+ QR_IMAGEREADER_NOT_FOUND_CODE_AREA);
+ return(NULL);
+ }
+
+ //
+ // perspective transform from source image
+ //
+ this->_transform_image();
+ IplImage *code_matrix=NULL;
+ for(int th=POSTERIZED_TH_LOW;th<=POSTERIZED_TH_HI&&(!code_matrix);
+ th+=POSTERIZED_TH_STEP){
+
+ this->_create_posterized_image(adaptive_th_size,
+ adaptive_th_delta*3,
+ th,
+ POSTERIZED_TH_HI);
+ code_matrix=this->_get_code_matrix();
+ }
+
+ if(!code_matrix){
+ this->status|=(QR_IMAGEREADER_ERROR|
+ QR_IMAGEREADER_NOT_DETERMINABLE_CODE_AREA);
+ return(NULL);
+ }
+
+ this->qr=new Qr();
+ this->qr->set_version((code_matrix->width-17)/4);
+ if(this->qr->version>=7){
+ //FIXME this->_verify_code_version();
+ }
+
+ if(this->_get_format_info(code_matrix,0)<0){
+ if((this->_get_format_info(code_matrix,1)<0)&&
+ (this->qr->formatinfo->status&QR_FORMATINFO_INVALID_LEVEL)){
+ this->_get_format_info(code_matrix,0);
+ if(this->qr->formatinfo->status&QR_FORMATINFO_INVALID_LEVEL){
+ cvReleaseImage(&code_matrix);
+ this->status|=(QR_IMAGEREADER_ERROR|
+ this->qr->formatinfo->status);
+ return(NULL);
+ }
+ }
+ }
+
+ IplImage *function_patterns=this->_get_function_patterns();
+
+ this->_unmask_code_matrix(code_matrix,function_patterns);
+ this->_read_code_word(code_matrix,function_patterns);
+
+ cvReleaseImage(&function_patterns);
+ cvReleaseImage(&code_matrix);
+
+ int errors=this->qr->decode_codedata();
+
+#ifdef _DEBUG
+ fprintf(stderr,"errors=%d\n",errors);
+#endif
+ this->status|=(QR_IMAGEREADER_DECODED|this->qr->status);
+
+ return(this->qr);
+ }
+
+ CvSeq *ImageReader::_find_finder_pattern()
+ {
+ IplImage *src=this->_img_binarized;
+ cvClearSeq(this->_seq_finder_pattern);
+
+ // for contour list
+ cvClearMemStorage(this->_stor_tmp);
+ CvSeq *cont=cvCreateSeq(CV_SEQ_ELTYPE_POINT,
+ sizeof(CvSeq),sizeof(CvPoint),
+ this->_stor_tmp);
+
+ //
+ // Find all contours.
+ //
+ // cvFindContours() spoil source image.
+ //
+ CvRect roi=cvGetImageROI(src);
+ cvSetImageROI(this->_img_tmp_1c,roi);
+ cvCopy(src,this->_img_tmp_1c);
+
+ cvFindContours(this->_img_tmp_1c,
+ this->_stor_tmp,&cont,sizeof(CvContour),
+ CV_RETR_LIST,CV_CHAIN_APPROX_NONE,cvPoint(0,0));
+
+ cvResetImageROI(this->_img_tmp_1c);
+
+ // for marker candidates list
+ CvSeq *candidates=cvCreateSeq(CV_SEQ_ELTYPE_GENERIC,
+ sizeof(CvSeq),sizeof(ImageReaderCandidate),
+ this->_stor_tmp);
+ //
+ // check each block
+ //
+ CvSeq *cont_head=cont;
+ for(;cont;cont=cont->h_next){
+ CvRect feret=cvBoundingRect(cont);
+ double area=fabs(cvContourArea(cont));
+ double area_ratio=area/(double)(feret.width*feret.height);
+ double feret_ratio=((feret.width<feret.height)?
+ (double)feret.width/(double)feret.height:
+ (double)feret.height/(double)feret.width);
+
+ //
+ // search square
+ //
+ if(area>=MIN_AREA &&
+ area_ratio>=MIN_AREA_RATIO &&
+ feret_ratio>=MIN_FERET_RATIO){
+ ImageReaderCandidate c;
+ c.feret.x=feret.x;
+ c.feret.y=feret.y;
+ c.feret.width=feret.width;
+ c.feret.height=feret.height;
+ c.contour=cont;
+ cvSeqPush(candidates,&c);
+ }
+ else{
+ cvClearSeq(cont);
+ }
+ }
+ cvRelease((void **)&cont_head);
+
+ //
+ // check each sqare has inner squire
+ //
+ int i;
+ for(i=0;i<candidates->total;i++){
+ ImageReaderCandidate *cand1=
+ (ImageReaderCandidate *)cvGetSeqElem(candidates,i);
+
+ int inner_contour=0;
+ int j;
+ for(j=0;j<candidates->total;j++){
+ if(i==j)
+ continue;
+
+ ImageReaderCandidate *cand2=
+ (ImageReaderCandidate *)cvGetSeqElem(candidates,j);
+ CvRect max_rect=cvMaxRect(&(cand1->feret),&(cand2->feret));
+ if(cand1->feret.x==max_rect.x&&
+ cand1->feret.y==max_rect.y&&
+ cand1->feret.width==max_rect.width&&
+ cand1->feret.height==max_rect.height)
+ inner_contour++;
+ }
+
+ //
+ // There were 2 squires (white and black) inside a squire,
+ // the most outer squire assumed as position marker.
+ //
+ if(inner_contour==2){
+ CvBox2D box=cvMinAreaRect2(cand1->contour);
+ cvSeqPush(this->_seq_finder_pattern,&box);
+ }
+ }
+
+ //
+ // clear buffers
+ //
+ for(i=0;i<candidates->total;i++){
+ ImageReaderCandidate *cand1=
+ (ImageReaderCandidate *)cvGetSeqElem(candidates,i);
+ cvClearSeq(cand1->contour);
+ }
+ //cvClearSeq(candidates);
+ cvRelease((void **)&candidates);
+
+ cvClearMemStorage(this->_stor_tmp);
+
+ return(this->_seq_finder_pattern);
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ CvSeq *ImageReader::_find_code_area_contour(double th)
+ {
+ IplImage *src=this->_img_binarized;
+ IplImage *mask=this->_img_tmp_1c;
+ cvZero(mask);
+
+ cvClearMemStorage(this->_stor_tmp);
+
+ //
+ // create position maker mask
+ //
+ CvBox2D box;
+ CvPoint2D32f pt_32f[4];
+ CvSeq *markers_vertex=cvCreateSeq(CV_SEQ_ELTYPE_POINT,
+ sizeof(CvSeq),
+ sizeof(CvPoint),
+ this->_stor_tmp);
+
+
+ int c=this->_seq_finder_pattern->total,i;
+ for(i=0;i<c;i++){
+ box=*(CvBox2D *)cvGetSeqElem(this->_seq_finder_pattern,i);
+ this->_finderpattern_boxes[i]=box;
+
+ //
+ // set 2-cells margin for fale-safe
+ //
+ box.size.width+=box.size.width/7.0F*4.0F;
+ box.size.height+=box.size.height/7.0F*4.0F;
+
+ //
+ // get each position maker's vertex
+ //
+ cvBoxPoints(box,pt_32f);
+ for(int j=0;j<4;j++){
+ CvPoint p=cvPointFrom32f(pt_32f[j]);
+ cvSeqPush(markers_vertex,&p);
+ }
+ }
+
+ //
+ // create Minimal-area bounding rectangle which condist
+ // every position makers
+ //
+ box=cvMinAreaRect2(markers_vertex);
+ cvRelease((void **)&markers_vertex);
+
+ //
+ // create code area mask
+ //
+ cvBoxPoints(box,pt_32f);
+ CvPoint *points=new CvPoint[4];
+ for(i=0;i<4;i++){
+ points[i]=cvPointFrom32f(pt_32f[i]);
+ }
+ i=4;
+ cvFillPoly(mask,&points,&i,1,cvScalarAll(255));
+ delete points;
+
+ //
+ // apply mask to src image and reduce noise using opening
+ //
+ cvAnd(src,mask,mask);
+ cvErode(mask,mask,NULL,1);
+ cvDilate(mask,mask,NULL,1);
+
+ //
+ // get contours of masked image
+ //
+ CvSeq *cont=cvCreateSeq(CV_SEQ_ELTYPE_POINT,
+ sizeof(CvSeq),sizeof(CvPoint),
+ this->_stor_tmp);
+ cvFindContours(mask,cont->storage,&cont,sizeof(CvContour),
+ CV_RETR_EXTERNAL,CV_CHAIN_APPROX_NONE,cvPoint(0,0));
+
+ //
+ // calcurate convex hull that assumed as code area
+ //
+ CvSeq *pts=cvCreateSeq(CV_SEQ_ELTYPE_POINT,
+ sizeof(CvSeq),sizeof(CvPoint),
+ this->_stor_tmp);
+ CvSeq *cont_head=cont;
+ for(;cont;cont=cont->h_next){
+ int c=cont->total;
+ for(i=0;i<c;i++){
+ CvPoint pt=*((CvPoint *)cvGetSeqElem(cont,i));
+ cvSeqPush(pts,&pt);
+ }
+ cvClearSeq(cont);
+ }
+ cvRelease((void **)&cont_head);
+
+ CvSeq *hull=cvConvexHull2(pts);
+
+ //
+ // polygonal approximation to reduce noise
+ //
+ if(this->_seq_code_area_contour){
+ cvClearSeq(this->_seq_code_area_contour);
+ cvRelease((void **)&this->_seq_code_area_contour);
+ this->_seq_code_area_contour=NULL;
+ }
+ if(hull){
+ int hullcount=hull->total;
+ CvMat* vector=cvCreateMat(1,hullcount,CV_32SC2);
+ for(i=0;i<hullcount;i++ ){
+ CV_MAT_ELEM(*vector,CvPoint,0,i)=
+ **CV_GET_SEQ_ELEM(CvPoint*,hull,i);
+ }
+ CvContour header;
+ CvSeqBlock block;
+ this->_seq_code_area_contour=cvApproxPoly(
+ cvPointSeqFromMat(CV_SEQ_KIND_CURVE+CV_SEQ_FLAG_CLOSED,
+ vector, &header, &block),
+ sizeof(CvContour),
+ this->_stor,
+ CV_POLY_APPROX_DP,th,0);
+
+ cvRelease((void **)&hull);
+ }
+
+ return(this->_seq_code_area_contour);
+ }
+
+
+ CvRect ImageReader::_transform_image()
+ {
+ IplImage *src=this->_img_src;
+ IplImage *dst=this->_img_transformed;
+ cvResetImageROI(dst);
+
+ //
+ // get code area's Centor of Gravity
+ //
+ int i;
+ int c=this->_seq_code_area_contour->total;
+ CvPoint2D32f cog;
+ cog.x=0.0F;
+ cog.y=0.0F;
+ for(i=0;i<c;i++){
+ CvPoint2D32f p=cvPointTo32f(
+ *(CvPoint *)cvGetSeqElem(this->_seq_code_area_contour,i));
+ cog.x+=p.x;
+ cog.y+=p.y;
+ }
+ cog.x/=(float)c;
+ cog.y/=(float)c;
+
+ //
+ // sort code_area_contour by clock-wise
+ //
+ cvSeqSort(this->_seq_code_area_contour,seq_cmp_by_clockwise,&cog);
+
+
+ //
+ // calculates matrix of perspective transform
+ //
+ // The src rectangle transform to a square which left-top vertex
+ // is same as src rectangle and each side length is same as top side
+ // length of src.
+ //
+ CvPoint2D32f spts[4];
+ CvPoint2D32f dpts[4];
+ float max_d=0.0F;
+ int offset=0;
+
+#ifdef _DEBUG
+ fprintf(stderr,"target region: ");
+#endif
+ for(i=0;i<c;i++){
+ this->_coderegion_vertexes[i]=*(CvPoint *)cvGetSeqElem(
+ this->_seq_code_area_contour,i);
+ spts[i]=cvPointTo32f(this->_coderegion_vertexes[i]);
+
+ //
+ // find nearest finder pattern
+ //
+ int j=0;
+ float tmp_d=0.0F;
+ float min_d=(this->_finderpattern_boxes[j].center.x-spts[i].x)*
+ (this->_finderpattern_boxes[j].center.x-spts[i].x)+
+ (this->_finderpattern_boxes[j].center.y-spts[i].y)*
+ (this->_finderpattern_boxes[j].center.y-spts[i].y);
+
+ for(j=1;j<3;j++){
+ tmp_d=(this->_finderpattern_boxes[j].center.x-spts[i].x)*
+ (this->_finderpattern_boxes[j].center.x-spts[i].x)+
+ (this->_finderpattern_boxes[j].center.y-spts[i].y)*
+ (this->_finderpattern_boxes[j].center.y-spts[i].y);
+
+ if(min_d>tmp_d)
+ min_d=tmp_d;
+ }
+ if(max_d<min_d){
+ max_d=min_d;
+ offset=i;
+ }
+
+#ifdef _DEBUG
+ fprintf(stderr,"(%.0lf,%.0lf) ",spts[i].x,spts[i].y);
+#endif
+ }
+
+ offset=(offset+2)%4;
+
+#ifdef _DEBUG
+ fprintf(stderr,", rotation offset=%d\n",offset);
+#endif
+
+ float side_len=cvSqrt((spts[0].x-spts[1].x)*(spts[0].x-spts[1].x)+
+ (spts[0].y-spts[1].y)*(spts[0].y-spts[1].y));
+ for(i=0;i<4;i++)
+ dpts[i]=cvPoint2D32f(0.0,0.0);
+
+ dpts[(offset+1)%4].x+=side_len;
+ dpts[(offset+2)%4].x+=side_len;
+ dpts[(offset+2)%4].y+=side_len;
+ dpts[(offset+3)%4].y+=side_len;
+
+ CvMat *map=cvCreateMat(3,3,CV_64FC1);
+
+ cvWarpPerspectiveQMatrix(spts,dpts,map);
+
+ //
+ // perspective transform
+ //
+ cvWarpPerspective(src,dst,map);
+ cvReleaseMat(&map);
+
+ //
+ // set ROI as code area
+ //
+ CvRect roi=cvRect((int)dpts[offset].x,(int)dpts[offset].y,
+ (int)side_len+1,(int)side_len+1);
+ cvSetImageROI(dst,roi);
+
+ return(roi);
+ }
+
+
+ void ImageReader::_create_posterized_image(int block_size,
+ double delta,
+ int low_th,
+ int hi_th)
+ {
+ IplImage *src=this->_img_transformed;
+ IplImage *dst=this->_img_binarized;
+ IplImage *buf=this->_img_tmp_1c;
+
+ CvRect roi=cvGetImageROI(src);
+ cvSetImageROI(buf,roi);
+ cvSetImageROI(dst,roi);
+
+ if(this->_img_src->nChannels>1)
+ cvCvtColor(src,buf,CV_BGR2GRAY);
+ else
+ cvCopy(src,buf);
+
+ if(block_size>0)
+ apaptive_white_leveling(buf,dst,128,
+ CV_ADAPTIVE_THRESH_MEAN_C,
+ CV_THRESH_BINARY_INV,
+ block_size,delta);
+ else
+ cvThreshold(buf,dst,delta,
+ 255,CV_THRESH_BINARY_INV);
+
+ int a=0;
+ int b=0;
+ if(hi_th>low_th){
+ a=128/(hi_th-low_th);
+ b=-a*low_th;
+ }
+ else{
+ hi_th=low_th;
+ }
+
+ uchar lut_data[256];
+ int i;
+ for(i=0;i<low_th;i++)
+ lut_data[i]=0;
+ for(i=low_th;i<hi_th;i++)
+ lut_data[i]=a*i+b;
+ for(i=hi_th;i<256;i++)
+ lut_data[i]=255;
+ CvMat lut=cvMat(1,256,CV_8UC1,lut_data);
+ cvLUT(dst,buf,&lut);
+ cvCopy(buf,dst);
+
+ CvRect roi_mask=roi;
+ cvDilate(buf,buf,NULL,1);
+ cvErode(buf,buf,NULL,1);
+
+ roi_mask.x+=1;
+ roi_mask.y+=1;
+ roi_mask.width-=2;
+ roi_mask.height-=2;
+ cvSetImageROI(buf,roi_mask);
+ cvSet(buf,cvScalarAll(0));
+ cvSetImageROI(buf,roi);
+ cvOr(dst,buf,dst);
+
+ cvResetImageROI(buf);
+ }
+
+
+ IplImage *ImageReader::_get_code_matrix()
+ {
+ IplImage *src=this->_img_binarized;
+
+ double cell_size=this->_get_cell_size();
+ if(cell_size<=0.0)
+ return(NULL);
+
+ CvRect roi=cvGetImageROI(src);
+ int version=(int)(((double)roi.width/cell_size-17.0)/4.0);
+ int w=4*version+17;
+
+ IplImage *dst=cvCreateImage(cvSize(w,w),IPL_DEPTH_8U,1);
+ cvResize(src,dst);
+
+
+#ifdef _DEBUG
+ fprintf(stderr,"version=%d (%dx%d); %lfpixel/module\n",
+ version,w,w,cell_size*cell_size);
+#endif
+ return(dst);
+ }
+
+ int ImageReader::_get_format_info(IplImage *src,int pos)
+ {
+ unsigned int raw_data=0;
+ this->qr->init_each_formatinfo_pattern_pixel();
+ int x,y;
+ while(this->qr->each_formatinfo_pattern_pixel(pos,&x,&y)){
+ raw_data<<=1;
+ if(CV_IMAGE_ELEM(src,uchar,y,x)==255)
+ raw_data|=0x01;
+ }
+
+#ifdef _DEBUG
+ fprintf(stderr,"format Info=%04x, ",raw_data);
+#endif
+
+ int ret=this->qr->decode_formatinfo(raw_data);
+
+#ifdef _DEBUG
+ fprintf(stderr,"corrected %d errors ",ret);
+
+ char l[2]={0,0};
+ switch(this->qr->formatinfo->level){
+ case 0:
+ l[0]='M';
+ break;
+ case 1:
+ l[0]='L';
+ break;
+ case 2:
+ l[0]='H';
+ break;
+ case 3:
+ l[0]='Q';
+ }
+ int m=0;
+ if(this->qr->formatinfo->mask_pattern&0x4)
+ m|=0x100;
+ if(this->qr->formatinfo->mask_pattern&0x2)
+ m|=0x10;
+ if(this->qr->formatinfo->mask_pattern&0x1)
+ m|=0x1;
+
+ fprintf(stderr," =>level %s, mask %03x\n",l,m);
+#endif
+
+ return(ret);
+ }
+
+ IplImage *ImageReader::_get_function_patterns()
+ {
+ IplImage *buf=cvCreateImage(cvSize(this->qr->cells_par_side,
+ this->qr->cells_par_side),
+ IPL_DEPTH_8U,1);
+ cvZero(buf);
+
+ int x,y;
+ this->qr->init_each_function_pattern_pixel();
+ while(this->qr->each_function_pattern_pixel(&x,&y)){
+ CV_IMAGE_ELEM(buf,uchar,y,x)=255;
+ }
+
+ cvNot(buf,buf);
+
+ return(buf);
+ }
+
+ void ImageReader::_unmask_code_matrix(IplImage *src,
+ IplImage *function_patterns)
+ {
+ IplImage *mask=this->_get_mask_pattern();
+ IplImage *unproc=cvCloneImage(mask);
+
+ cvAnd(function_patterns,unproc,unproc);
+ cvXor(src,mask,src,unproc);
+
+ cvReleaseImage(&unproc);
+ cvReleaseImage(&mask);
+ }
+
+ int ImageReader::_read_code_word(IplImage *src,IplImage *mask)
+ {
+ //
+ // erace timing pattern
+ //
+ IplImage *codes=cvCreateImage(cvSize(src->width-1,src->height-1),
+ IPL_DEPTH_8U,1);
+ cvZero(codes);
+ IplImage *funcs=cvCloneImage(codes);
+
+ CvRect roi=cvGetImageROI(src);
+
+ CvRect r=cvRect(7,0,roi.width-7,6);
+ cvSetImageROI(src,r);
+ cvSetImageROI(mask,r);
+ r.x-=1;
+ cvSetImageROI(codes,r);
+ cvSetImageROI(funcs,r);
+ cvCopy(src,codes);
+ cvCopy(mask,funcs);
+
+ r=cvRect(0,7,6,roi.height-6);
+ cvSetImageROI(src,r);
+ cvSetImageROI(mask,r);
+ r.y-=1;
+ cvSetImageROI(codes,r);
+ cvSetImageROI(funcs,r);
+ cvCopy(src,codes);
+ cvCopy(mask,funcs);
+
+ r=cvRect(7,7,roi.width-7,roi.height-7);
+ cvSetImageROI(src,r);
+ cvSetImageROI(mask,r);
+ r.x-=1;
+ r.y-=1;
+ cvSetImageROI(codes,r);
+ cvSetImageROI(funcs,r);
+ cvCopy(src,codes);
+ cvCopy(mask,funcs);
+
+ cvSetImageROI(src,roi);
+ cvSetImageROI(mask,roi);
+
+ cvResetImageROI(codes);
+ cvResetImageROI(funcs);
+
+ //
+ // read code from matrix
+ //
+ uchar data=0;
+ int bit_count=0,word_count=0;
+ int dir=-1;
+ int x=codes->width-1;
+ int y=codes->height-1;
+
+ do{
+ data<<=1;
+ bit_count++;
+ if(CV_IMAGE_ELEM(codes,uchar,y,x)>=128)
+ data|=1;
+ if(!(bit_count%8)){
+ if(this->qr->push_codedata(data))
+ word_count++;
+ data=0;
+ }
+
+ if(x&0x1){
+ if(CV_IMAGE_ELEM(funcs,uchar,y,x-1))
+ x--;
+ else{
+ do{
+ y+=dir;
+ if(y<0||y>=codes->height){
+ x-=2;
+ dir*=-1;
+ y+=dir;
+ if(x<0)
+ break;
+ }
+ }while(!CV_IMAGE_ELEM(funcs,uchar,y,x));
+ }
+ }
+ else{
+ x++;
+ do{
+ y+=dir;
+ if(y>=0&&y<codes->height){
+ if(CV_IMAGE_ELEM(funcs,uchar,y,x)){
+ break;
+ }
+ else if(CV_IMAGE_ELEM(funcs,uchar,y,x-1)){
+ x--;
+ break;
+ }
+ else{
+ y+=dir;
+ }
+ }
+ else{
+ x-=2;
+ dir*=-1;
+ y+=dir;
+ if(x<0)
+ break;
+ }
+ }while(!CV_IMAGE_ELEM(funcs,uchar,y,x));
+ }
+ }while(x>=0);
+
+ if(data){
+ if(this->qr->push_codedata(data))
+ word_count++;
+ }
+
+ cvReleaseImage(&funcs);
+ cvReleaseImage(&codes);
+
+#ifdef _DEBUG
+ fprintf(stderr,"%d words in %d blocks <= %d bits, %d words were read.\n",
+ this->qr->codedata->total_words,
+ this->qr->codedata->data_blocks,
+ bit_count,word_count);
+#endif
+
+ return(bit_count);
+ }
+
+
+ /////////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ double ImageReader::_get_cell_size()
+ {
+ IplImage *src=this->_img_binarized;
+ this->_find_finder_pattern();
+
+ int c=this->_seq_finder_pattern->total;
+ if(c!=3)
+ return(-1.0);
+
+ double cell_size=0.0;
+ for(int i=0;i<c;i++){
+ CvBox2D box=*(CvBox2D *)cvGetSeqElem(this->_seq_finder_pattern,
+ i);
+ cell_size+=box.size.width+box.size.height;
+ }
+
+ cell_size/=42.0;
+
+ return(cell_size);
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ //
+ //
+ //
+ IplImage *ImageReader::_get_mask_pattern()
+ {
+ IplImage *mask=cvCreateImage(cvSize(this->qr->cells_par_side,
+ this->qr->cells_par_side),
+ IPL_DEPTH_8U,1);
+ cvZero(mask);
+
+ CvRect roi=cvGetImageROI(mask);
+ roi.width+=roi.x;
+ roi.height+=roi.y;
+
+ for(int y=roi.y;y<roi.height;y++){
+ for(int x=roi.x;x<roi.width;x++){
+ CV_IMAGE_ELEM(mask,uchar,y,x)=this->qr->
+ formatinfo->mask_pixel(y,x);
+ }
+ }
+
+ return(mask);
+ }
+
+
+ /////////////////////////////////////////////////////////////////////////
+ //
+ // sort by clock-wise
+ //
+ static int seq_cmp_by_clockwise(const void *_a,const void *_b,void *_cog)
+ {
+ CvPoint* a = (CvPoint*)_a;
+ CvPoint* b = (CvPoint*)_b;
+ CvPoint2D32f *cog=(CvPoint2D32f *)_cog;
+
+ float aa=cvFastArctan((float)(a->y)-cog->y,cog->x-(float)(a->x));
+ float ba=cvFastArctan((float)(b->y)-cog->y,cog->x-(float)(b->x));
+
+ return(aa < ba ? 1 : aa > ba ? -1 : 0);
+ }
+
+ /////////////////////////////////////////////////////////////////////////
+ //
+ // following code originates in OpenCV/cv/src/cvadapthresh.cpp
+ //
+ void apaptive_white_leveling(const CvArr* src,
+ CvArr* dst,
+ double middle_value,
+ int adaptive_method,
+ int threshold_type,
+ int block_size,
+ double param1)
+ {
+ CV_FUNCNAME( "apaptive_white_leveling" );
+ CvMat src_stub, dst_stub;
+ CvMat *srcMat,*dstMat,*mean,*mask;
+
+ __BEGIN__
+ if( adaptive_method != CV_ADAPTIVE_THRESH_MEAN_C &&
+ adaptive_method != CV_ADAPTIVE_THRESH_GAUSSIAN_C )
+ CV_ERROR( CV_StsBadArg,
+ "Only CV_ADAPTIVE_THRESH_MEAN_C and CV_ADAPTIVE_THRESH_GAUSSIAN_C "
+ "adaptive method are acceptable" );
+
+ if( threshold_type != CV_THRESH_BINARY &&
+ threshold_type != CV_THRESH_BINARY_INV )
+ CV_ERROR( CV_StsBadArg, "Only CV_TRESH_BINARY and CV_THRESH_BINARY_INV "
+ "threshold types are acceptable" );
+
+ srcMat=cvGetMat(src, &src_stub );
+ dstMat=cvGetMat(dst, &dst_stub );
+
+ if( !CV_ARE_CNS_EQ( srcMat, dstMat ))
+ CV_ERROR( CV_StsUnmatchedFormats, "" );
+
+ if( CV_MAT_TYPE(dstMat->type) != CV_8UC1 )
+ CV_ERROR( CV_StsUnsupportedFormat, "" );
+
+ if( !CV_ARE_SIZES_EQ( srcMat, dstMat ) )
+ CV_ERROR( CV_StsUnmatchedSizes, "" );
+
+ mean=cvCreateMat(srcMat->rows,srcMat->cols,CV_8UC1);
+ mask=cvCreateMat(srcMat->rows,srcMat->cols,CV_8UC1);
+
+ cvSmooth( srcMat, mean, adaptive_method == CV_ADAPTIVE_THRESH_MEAN_C ?
+ CV_BLUR : CV_GAUSSIAN, block_size, block_size );
+ cvSubS(mean,cvRealScalar(param1),mean);
+ cvAbsDiff(srcMat,mean,dstMat);
+ cvCmp(srcMat,mean,mask,CV_CMP_GT);
+ cvAddS(dstMat,cvRealScalar(middle_value),dstMat,mask);
+ cvNot(mask,mask);
+ cvSubRS(dstMat,cvRealScalar(middle_value),dstMat,mask);
+
+ if(threshold_type!=CV_THRESH_BINARY)
+ cvNot(dstMat,dstMat);
+
+ cvReleaseMat( &mask );
+ cvReleaseMat( &mean );
+
+ __END__
+
+ }
+
+}
diff --git a/src/libdecodeqr/imagereader.h b/src/libdecodeqr/imagereader.h
new file mode 100644
index 0000000..956592d
--- /dev/null
+++ b/src/libdecodeqr/imagereader.h
@@ -0,0 +1,127 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// imagereader.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: imagereader.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __QR_IMAGE_READER__
+#define __QR_IMAGE_READER__
+
+#ifdef _DEBUG
+#include <stdio.h>
+#endif
+
+#include <cv.h>
+#include <memory.h>
+#include "qrerror.h"
+#include "container.h"
+
+
+/////////////////////////////////////////////////////////////////////////
+//
+// image processing parameters
+//
+#define DEFAULT_ADAPTIVE_TH_SIZE 25
+#define DEFAULT_ADAPTIVE_TH_DELTA 10
+#define MIN_AREA 49
+#define MIN_AREA_RATIO .65
+#define MIN_FERET_RATIO .7
+#define FIND_CODE_AREA_POLY_APPROX_TH 50
+#define POSTERIZED_TH_LOW 64
+#define POSTERIZED_TH_HI 96
+#define POSTERIZED_TH_STEP 8
+
+namespace Qr{
+ class ImageReader{
+ public:
+ Qr *qr;
+ short status;
+
+ private:
+ IplImage *_img_src_internal;
+ IplImage *_img_src;
+ IplImage *_img_transformed;
+ IplImage *_img_binarized;
+ IplImage *_img_tmp_1c;
+ CvMemStorage *_stor;
+ CvMemStorage *_stor_tmp;
+ CvSeq *_seq_finder_pattern;
+ CvSeq *_seq_code_area_contour;
+ CvPoint _coderegion_vertexes[4];
+ CvBox2D _finderpattern_boxes[3];
+
+ public:
+ ImageReader();
+ ImageReader(int width,int height,
+ int depth=IPL_DEPTH_8U,
+ int channel=3);
+ ~ImageReader();
+
+ IplImage *set_image(IplImage *src);
+ uchar *set_image(uchar *buffer,int size);
+ IplImage *set_image(int width,int height,
+ int depth,int channel);
+ void release_image();
+
+ IplImage *src_buffer();
+ IplImage *transformed_buffer();
+ IplImage *binarized_buffer();
+ IplImage *tmp_buffer();
+ CvPoint *coderegion_vertexes();
+ CvBox2D *finderpattern_boxes();
+
+ Qr *decode(int adaptive_th_size=
+ DEFAULT_ADAPTIVE_TH_SIZE,
+ int adaptive_th_delta=
+ DEFAULT_ADAPTIVE_TH_DELTA);
+ Qr *decode(IplImage *src,
+ int adaptive_th_size=
+ DEFAULT_ADAPTIVE_TH_SIZE,
+ int adaptive_th_delta=
+ DEFAULT_ADAPTIVE_TH_DELTA);
+
+ private:
+ void _init();
+ void _alloc_image(int width,int height,
+ int depth,int channel);
+
+ Qr *_decode(int adaptive_th_size,int adaptive_th_delta);
+
+ CvSeq *_find_finder_pattern();
+ CvSeq *_find_code_area_contour(double th);
+ CvRect _transform_image();
+ void _create_posterized_image(int block_size,
+ double delta,
+ int low_th,
+ int hi_th);
+ IplImage *_get_code_matrix();
+ int _get_format_info(IplImage *src,int pos=0);
+ IplImage *_get_function_patterns();
+ void _unmask_code_matrix(IplImage *src,
+ IplImage *function_patterns);
+ int _read_code_word(IplImage *src,IplImage *mask);
+
+ double _get_cell_size();
+ IplImage *_get_mask_pattern();
+
+ };
+
+ static int seq_cmp_by_clockwise(const void *_a,
+ const void *_b,
+ void *_cog);
+
+ void apaptive_white_leveling(const CvArr* src,CvArr* dst,
+ double middle_value,int adaptive_method,
+ int threshold_type,int block_size,
+ double param1);
+
+}
+
+#endif
diff --git a/src/libdecodeqr/libdecodeqr.cpp b/src/libdecodeqr/libdecodeqr.cpp
new file mode 100644
index 0000000..b124b50
--- /dev/null
+++ b/src/libdecodeqr/libdecodeqr.cpp
@@ -0,0 +1,195 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// libdecodeqr.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: libdecodeqr.cpp 36 2007-02-21 23:22:03Z zophos $
+//
+#include "imagereader.h"
+#include "qrtypes.h"
+#include "version.h"
+
+extern "C" {
+
+QrDecoderHandle qr_decoder_open()
+{
+ Qr::ImageReader *imagereader=new Qr::ImageReader();
+ return((QrDecoderHandle)imagereader);
+}
+
+QrDecoderHandle qr_decoder_open_with_image_size(int width,int height,
+ int depth,int channel)
+{
+ Qr::ImageReader *imagereader=new Qr::ImageReader(width,height,
+ depth,channel);
+ return((QrDecoderHandle)imagereader);
+}
+
+void qr_decoder_close(QrDecoderHandle decoder)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ delete imagereader;
+}
+
+short qr_decoder_get_status(QrDecoderHandle decoder)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ return(imagereader->status);
+}
+
+int qr_decoder_is_busy(QrDecoderHandle decoder)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ return(imagereader->status&QR_IMAGEREADER_WORKING?1:0);
+}
+
+
+QrDecoderHandle qr_decoder_set_image_size(QrDecoderHandle decoder,
+ int width,int height,
+ int depth,int channel)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ imagereader->set_image(width,height,depth,channel);
+
+ return((QrDecoderHandle)imagereader);
+}
+
+
+IplImage *qr_decoder_get_image_buffer(QrDecoderHandle decoder)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ return(imagereader->src_buffer());
+}
+IplImage *qr_decoder_get_transformed_image_buffer(QrDecoderHandle decoder)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ return(imagereader->transformed_buffer());
+}
+IplImage *qr_decoder_get_binarized_image_buffer(QrDecoderHandle decoder)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ return(imagereader->binarized_buffer());
+}
+IplImage *qr_decoder_get_tmp_image_buffer(QrDecoderHandle decoder)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ return(imagereader->tmp_buffer());
+}
+
+QrDecoderHandle qr_decoder_set_image_buffer(QrDecoderHandle decoder,
+ IplImage *src)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ imagereader->set_image(src);
+
+ return((QrDecoderHandle)imagereader);
+}
+
+short qr_decoder_decode(QrDecoderHandle decoder,
+ int adaptive_th_size,
+ int adaptive_th_delta)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ imagereader->decode(adaptive_th_size,adaptive_th_delta);
+ return(imagereader->status);
+}
+
+short qr_decoder_decode_image(QrDecoderHandle decoder,
+ IplImage *src,
+ int adaptive_th_size,
+ int adaptive_th_delta)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ imagereader->decode(src,adaptive_th_size,adaptive_th_delta);
+ return(imagereader->status);
+}
+
+int qr_decoder_get_header(QrDecoderHandle decoder,
+ QrCodeHeader *header)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ if(!(imagereader->status&QR_IMAGEREADER_DECODED))
+ return(0);
+
+ header->model=imagereader->qr->model;
+ header->version=imagereader->qr->version;
+ header->level=imagereader->qr->formatinfo->level;
+ //header->mode=0;
+ //header->eci_mode=0;
+ header->charactor_size=imagereader->qr->codedata->length;
+ header->byte_size=imagereader->qr->codedata->byte_length;
+
+ return(1);
+}
+
+int qr_decoder_get_body(QrDecoderHandle decoder,
+ unsigned char *buf,
+ int buf_size)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ if(!(imagereader->status&QR_IMAGEREADER_DECODED))
+ return(0);
+
+ memset(buf,0,buf_size);
+ int size=imagereader->qr->codedata->byte_length;
+ if(size>buf_size)
+ size=buf_size;
+
+ memcpy(buf,imagereader->qr->codedata->raw_data(),size);
+
+ return(size);
+}
+
+CvPoint *qr_decoder_get_coderegion_vertexes(QrDecoderHandle decoder)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ return(imagereader->coderegion_vertexes());
+}
+
+CvBox2D *qr_decoder_get_finderpattern_boxes(QrDecoderHandle decoder)
+{
+ Qr::ImageReader *imagereader=(Qr::ImageReader *)decoder;
+ return(imagereader->finderpattern_boxes());
+}
+
+
+char *qr_decoder_version()
+{
+ return(LIBDECODEQR_VERSION);
+}
+char *qr_decoder_version_description()
+{
+ return(LIBDECODEQR_VERSION_DESCRIPTION);
+}
+char *qr_decoder_version_product()
+{
+ return(LIBDECODEQR_PRODUCTNAME);
+}
+int qr_decoder_version_major()
+{
+ return(LIBDECODEQR_VERSION_MAJOR);
+}
+int qr_decoder_version_minor()
+{
+ return(LIBDECODEQR_VERSION_MINOR);
+}
+int qr_decoder_version_teeny()
+{
+ return(LIBDECODEQR_VERSION_TEENY);
+}
+char *qr_decoder_version_suffix()
+{
+ return(LIBDECODEQR_VERSION_SUFFIX);
+}
+char *qr_decoder_version_revision()
+{
+ return(LIBDECODEQR_VERSION_REVISION);
+}
+
+}
diff --git a/src/libdecodeqr/libdecodeqr.dep b/src/libdecodeqr/libdecodeqr.dep
new file mode 100644
index 0000000..a6eb9c7
--- /dev/null
+++ b/src/libdecodeqr/libdecodeqr.dep
@@ -0,0 +1,80 @@
+# Microsoft Developer Studio Generated Dependency File, included by libdecodeqr.mak
+
+.\bitstream.cpp : \
+ ".\bitstream.h"\
+
+
+.\codedata.cpp : \
+ ".\bitstream.h"\
+ ".\codedata.h"\
+ ".\ecidecoder.h"\
+ ".\galois.h"\
+ ".\qrerror.h"\
+
+
+.\container.cpp : \
+ ".\bitstream.h"\
+ ".\codedata.h"\
+ ".\container.h"\
+ ".\ecidecoder.h"\
+ ".\formatinfo.h"\
+ ".\galois.h"\
+ ".\qrerror.h"\
+
+
+.\ecidecoder.cpp : \
+ ".\bitstream.h"\
+ ".\ecidecoder.h"\
+
+
+.\formatinfo.cpp : \
+ ".\formatinfo.h"\
+ ".\galois.h"\
+ ".\qrerror.h"\
+
+
+.\galois.cpp : \
+ ".\galois.h"\
+
+
+.\imagereader.cpp : \
+ ".\bitstream.h"\
+ ".\codedata.h"\
+ ".\container.h"\
+ ".\ecidecoder.h"\
+ ".\formatinfo.h"\
+ ".\galois.h"\
+ ".\imagereader.h"\
+ ".\qrerror.h"\
+ {$(INCLUDE)}"cv.h"\
+ {$(INCLUDE)}"cvcompat.h"\
+ {$(INCLUDE)}"cvtypes.h"\
+ {$(INCLUDE)}"cxcore.h"\
+ {$(INCLUDE)}"cxerror.h"\
+ {$(INCLUDE)}"cxtypes.h"\
+ {$(INCLUDE)}"emmintrin.h"\
+ {$(INCLUDE)}"mmintrin.h"\
+ {$(INCLUDE)}"xmmintrin.h"\
+
+
+.\libdecodeqr.cpp : \
+ ".\bitstream.h"\
+ ".\codedata.h"\
+ ".\container.h"\
+ ".\ecidecoder.h"\
+ ".\formatinfo.h"\
+ ".\galois.h"\
+ ".\imagereader.h"\
+ ".\qrerror.h"\
+ ".\qrtypes.h"\
+ ".\version.h"\
+ {$(INCLUDE)}"cv.h"\
+ {$(INCLUDE)}"cvcompat.h"\
+ {$(INCLUDE)}"cvtypes.h"\
+ {$(INCLUDE)}"cxcore.h"\
+ {$(INCLUDE)}"cxerror.h"\
+ {$(INCLUDE)}"cxtypes.h"\
+ {$(INCLUDE)}"emmintrin.h"\
+ {$(INCLUDE)}"mmintrin.h"\
+ {$(INCLUDE)}"xmmintrin.h"\
+
diff --git a/src/libdecodeqr/libdecodeqr.dsp b/src/libdecodeqr/libdecodeqr.dsp
new file mode 100644
index 0000000..8d70484
--- /dev/null
+++ b/src/libdecodeqr/libdecodeqr.dsp
@@ -0,0 +1,160 @@
+# Microsoft Developer Studio Project File - Name="libdecodeqr" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** ҏWȂł **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libdecodeqr - Win32 Debug
+!MESSAGE ͗LҲ̧قł͂܂B ۼުĂނ邽߂ɂ NMAKE gpĂB
+!MESSAGE [Ҳ̧ق̴߰] ނgpĎsĂ
+!MESSAGE
+!MESSAGE NMAKE /f "libdecodeqr.mak".
+!MESSAGE
+!MESSAGE NMAKE ̎sɍ\wł܂
+!MESSAGE ײݏϸۂ̐ݒ`܂B:
+!MESSAGE
+!MESSAGE NMAKE /f "libdecodeqr.mak" CFG="libdecodeqr - Win32 Debug"
+!MESSAGE
+!MESSAGE I”\ Ӱ:
+!MESSAGE
+!MESSAGE "libdecodeqr - Win32 Release" ("Win32 (x86) Static Library" p)
+!MESSAGE "libdecodeqr - Win32 Debug" ("Win32 (x86) Static Library" p)
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libdecodeqr - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD BASE RSC /l 0x411 /d "NDEBUG"
+# ADD RSC /l 0x411 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "libdecodeqr - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x411 /d "_DEBUG"
+# ADD RSC /l 0x411 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF
+
+# Begin Target
+
+# Name "libdecodeqr - Win32 Release"
+# Name "libdecodeqr - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\bitstream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\codedata.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\container.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ecidecoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\formatinfo.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\galois.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\imagereader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\libdecodeqr.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\bitstream.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\codedata.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\container.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ecidecoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\formatinfo.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\galois.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\imagereader.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\qrerror.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\qrtypes.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/src/libdecodeqr/libdecodeqr.dsw b/src/libdecodeqr/libdecodeqr.dsw
new file mode 100644
index 0000000..9f4ac8f
--- /dev/null
+++ b/src/libdecodeqr/libdecodeqr.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# x: ܰ߰ ̧ ҏW܂͍폜Ȃł!
+
+###############################################################################
+
+Project: "libdecodeqr"=".\libdecodeqr.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/src/libdecodeqr/libdecodeqr.mak b/src/libdecodeqr/libdecodeqr.mak
new file mode 100644
index 0000000..54552c1
--- /dev/null
+++ b/src/libdecodeqr/libdecodeqr.mak
@@ -0,0 +1,245 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on libdecodeqr.dsp
+!IF "$(CFG)" == ""
+CFG=libdecodeqr - Win32 Debug
+!MESSAGE Missing target. Using defualt "libdecodeqr - Win32 Debug".
+!ENDIF
+
+!IF "$(CFG)" != "libdecodeqr - Win32 Release" && "$(CFG)" != "libdecodeqr - Win32 Debug"
+!MESSAGE Mode "$(CFG)" is not valid.
+!MESSAGE
+!MESSAGE Valid modes are:
+!MESSAGE
+!MESSAGE "libdecodeqr - Win32 Release" (for "Win32 (x86) Static Library")
+!MESSAGE "libdecodeqr - Win32 Debug" (for "Win32 (x86) Static Library")
+!MESSAGE
+!MESSAGE eg:
+!MESSAGE
+!MESSAGE NMAKE /f "libdecodeqr.mak" CFG="libdecodeqr - Win32 Debug"
+!ERROR Invalid target are gaven.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == "libdecodeqr - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+ALL : "$(OUTDIR)\libdecodeqr.lib"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\bitstream.obj"
+ -@erase "$(INTDIR)\codedata.obj"
+ -@erase "$(INTDIR)\container.obj"
+ -@erase "$(INTDIR)\ecidecoder.obj"
+ -@erase "$(INTDIR)\formatinfo.obj"
+ -@erase "$(INTDIR)\galois.obj"
+ -@erase "$(INTDIR)\imagereader.obj"
+ -@erase "$(INTDIR)\libdecodeqr.obj"
+ -@erase "$(INTDIR)\vc60.idb"
+ -@erase "$(OUTDIR)\libdecodeqr.lib"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Fp"$(INTDIR)\libdecodeqr.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\libdecodeqr.bsc"
+BSC32_SBRS= \
+
+LIB32=link.exe -lib
+LIB32_FLAGS=/nologo /out:"$(OUTDIR)\libdecodeqr.lib"
+LIB32_OBJS= \
+ "$(INTDIR)\bitstream.obj" \
+ "$(INTDIR)\codedata.obj" \
+ "$(INTDIR)\container.obj" \
+ "$(INTDIR)\ecidecoder.obj" \
+ "$(INTDIR)\formatinfo.obj" \
+ "$(INTDIR)\galois.obj" \
+ "$(INTDIR)\imagereader.obj" \
+ "$(INTDIR)\libdecodeqr.obj"
+
+"$(OUTDIR)\libdecodeqr.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
+ $(LIB32) @<<
+ $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "libdecodeqr - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+ALL : "$(OUTDIR)\libdecodeqr.lib"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\bitstream.obj"
+ -@erase "$(INTDIR)\codedata.obj"
+ -@erase "$(INTDIR)\container.obj"
+ -@erase "$(INTDIR)\ecidecoder.obj"
+ -@erase "$(INTDIR)\formatinfo.obj"
+ -@erase "$(INTDIR)\galois.obj"
+ -@erase "$(INTDIR)\imagereader.obj"
+ -@erase "$(INTDIR)\libdecodeqr.obj"
+ -@erase "$(INTDIR)\vc60.idb"
+ -@erase "$(INTDIR)\vc60.pdb"
+ -@erase "$(OUTDIR)\libdecodeqr.lib"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"$(INTDIR)\libdecodeqr.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\libdecodeqr.bsc"
+BSC32_SBRS= \
+
+LIB32=link.exe -lib
+LIB32_FLAGS=/nologo /out:"$(OUTDIR)\libdecodeqr.lib"
+LIB32_OBJS= \
+ "$(INTDIR)\bitstream.obj" \
+ "$(INTDIR)\codedata.obj" \
+ "$(INTDIR)\container.obj" \
+ "$(INTDIR)\ecidecoder.obj" \
+ "$(INTDIR)\formatinfo.obj" \
+ "$(INTDIR)\galois.obj" \
+ "$(INTDIR)\imagereader.obj" \
+ "$(INTDIR)\libdecodeqr.obj"
+
+"$(OUTDIR)\libdecodeqr.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
+ $(LIB32) @<<
+ $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+
+!ENDIF
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("libdecodeqr.dep")
+!INCLUDE "libdecodeqr.dep"
+!ELSE
+!MESSAGE Warning: cannot find "libdecodeqr.dep"
+!ENDIF
+!ENDIF
+
+
+!IF "$(CFG)" == "libdecodeqr - Win32 Release" || "$(CFG)" == "libdecodeqr - Win32 Debug"
+SOURCE=.\bitstream.cpp
+
+"$(INTDIR)\bitstream.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\codedata.cpp
+
+"$(INTDIR)\codedata.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\container.cpp
+
+"$(INTDIR)\container.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\ecidecoder.cpp
+
+"$(INTDIR)\ecidecoder.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\formatinfo.cpp
+
+"$(INTDIR)\formatinfo.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\galois.cpp
+
+"$(INTDIR)\galois.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\imagereader.cpp
+
+"$(INTDIR)\imagereader.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\libdecodeqr.cpp
+
+"$(INTDIR)\libdecodeqr.obj" : $(SOURCE) "$(INTDIR)"
+
+
+
+!ENDIF
+
diff --git a/src/libdecodeqr/qrerror.h b/src/libdecodeqr/qrerror.h
new file mode 100644
index 0000000..cfd616d
--- /dev/null
+++ b/src/libdecodeqr/qrerror.h
@@ -0,0 +1,40 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// qrerror.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: qrerror.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __QR_ERROR_CODE__
+#define __QR_ERROR_CODE__
+
+#define QR_IMAGEREADER_WORKING 0x1000
+#define QR_IMAGEREADER_DECODED 0x2000
+
+#define QR_VERSIONINFO_ERROR 0x0f00
+#define QR_VERSIONINFO_INVALID 0x0100
+#define QR_VERSIONINFO_MISMATCH 0x0200
+#define QR_VERSIONINFO_UNRECOVERABLE 0x0800
+
+#define QR_FORMATINFO_ERROR 0x00f0
+#define QR_FORMATINFO_INVALID_LEVEL 0x0010
+#define QR_FORMATINFO_UNRECOVERABLE 0x0080
+
+#define QR_CODEDATA_ERROR 0x000f
+#define QR_CODEDATA_NOT_SUPPORT_ECI 0x0001
+#define QR_CODEDATA_LENGTH_MISMATCH 0x0002
+#define QR_CODEDATA_UNRECOVERABLE 0x0008
+
+#define QR_IMAGEREADER_ERROR 0x4000
+#define QR_IMAGEREADER_NOT_INVALID_SRC_IMAGE 0x0100
+#define QR_IMAGEREADER_NOT_FOUND_FINDER_PATTERN 0x0200
+#define QR_IMAGEREADER_NOT_FOUND_CODE_AREA 0x0400
+#define QR_IMAGEREADER_NOT_DETERMINABLE_CODE_AREA 0x0800
+
+#endif
diff --git a/src/libdecodeqr/qrtypes.h b/src/libdecodeqr/qrtypes.h
new file mode 100644
index 0000000..ae920a9
--- /dev/null
+++ b/src/libdecodeqr/qrtypes.h
@@ -0,0 +1,42 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// qrtypes.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: qrtypes.h 36 2007-02-21 23:22:03Z zophos $
+//
+#ifndef __QR_TYPES__
+#define __QR_TYPES__
+
+#define QR_LEVEL_M 0
+#define QR_LEVEL_L 1
+#define QR_LEVEL_H 2
+#define QR_LEVEL_Q 3
+
+#define QR_MODE_NUMBER 1
+#define QR_MODE_ALPHABET 2
+#define QR_MODE_JOINT 3
+#define QR_MODE_8BIT 4
+#define QR_MODE_FNC1_1 5
+#define QR_MODE_ECI 7
+#define QR_MODE_KANJI 8
+#define QR_MODE_FNC1_2 9
+
+typedef void * QrDecoderHandle;
+typedef struct{
+ int model;
+ int version;
+ int level;
+ //int mode; //not supported yet
+ //int eci_mode; //not supported yet
+ int charactor_size;
+ int byte_size;
+} QrCodeHeader;
+
+#endif
diff --git a/src/libdecodeqr/version.h b/src/libdecodeqr/version.h
new file mode 100644
index 0000000..acab5fe
--- /dev/null
+++ b/src/libdecodeqr/version.h
@@ -0,0 +1,42 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// version.h --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: version.h 6 2006-11-18 09:37:16Z zophos $
+//
+#ifndef __QR_LIBDECODEQR_VERSION__
+#define __QR_LIBDECODEQR_VERSION__
+
+#define LIBDECODEQR_PRODUCTNAME "libdecodeqr"
+#define LIBDECODEQR_VERSION_MAJOR 0
+#define LIBDECODEQR_VERSION_MINOR 9
+#define LIBDECODEQR_VERSION_TEENY 3
+#define LIBDECODEQR_VERSION_SUFFIX ""
+#define LIBDECODEQR_VERSION_REVISION "$Rev: 42 $"
+
+//
+// a voodoo magic
+//
+#define LIBDECODEQR_VERSION_CAT(a,b,c,d,e) LIBDECODEQR_VERSION_CATX(a,b,c,d,e)
+#define LIBDECODEQR_VERSION_CATX(a,b,c,d,e) #a "." #b "." #c d " (" e ")"
+
+#define LIBDECODEQR_VERSION LIBDECODEQR_VERSION_CAT(\
+ LIBDECODEQR_VERSION_MAJOR,\
+ LIBDECODEQR_VERSION_MINOR,\
+ LIBDECODEQR_VERSION_TEENY,\
+ LIBDECODEQR_VERSION_SUFFIX,\
+ LIBDECODEQR_VERSION_REVISION)
+
+#define LIBDECODEQR_VERSION_DESCRIPTION \
+ LIBDECODEQR_PRODUCTNAME " " LIBDECODEQR_VERSION
+
+static const char *libdecodeqr_version_description=
+ LIBDECODEQR_VERSION_DESCRIPTION;
+#endif
diff --git a/src/sample/Makefile.in b/src/sample/Makefile.in
new file mode 100644
index 0000000..8245b66
--- /dev/null
+++ b/src/sample/Makefile.in
@@ -0,0 +1,36 @@
+#
+# Makefile.in -- a part of libdecodeqr
+#
+# Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+# JMA (Japan Medical Association)
+# NaCl (Network Applied Communication Laboratory Ltd.)
+#
+# This is free software with ABSOLUTELY NO WARRANTY.
+# You can redistribute and/or modify it under the terms of LGPL.
+#
+# $Id: Makefile 20 2006-11-20 03:26:52Z zophos $
+#
+CXX=@CXX@
+CPPFLAGS=@CPPFLAGS@ @CXXFLAGS@ -c
+
+LIBCV=@LIBCV@
+LIBHIGHGUI=@LIBHIGHGUI@
+
+LDFLAGS=@LDFLAGS@
+
+export CXX CPPFLAGS LDFLAGS LIBCV LIBHIGHGUI
+
+dirs:=simple webcam
+.PHONY: $(dirs)
+
+all: $(dirs)
+
+$(dirs):
+ cd $@ && $(MAKE)
+
+install: $(dirs)
+
+clean:
+ for x in $(dirs); do cd $$x && $(MAKE) clean && cd ../;done
+
+
diff --git a/src/sample/simple/Makefile.in b/src/sample/simple/Makefile.in
new file mode 100644
index 0000000..b1a4373
--- /dev/null
+++ b/src/sample/simple/Makefile.in
@@ -0,0 +1,41 @@
+#
+# Makefile.in -- a part of libdecodeqr
+#
+# Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+# JMA (Japan Medical Association)
+# NaCl (Network Applied Communication Laboratory Ltd.)
+#
+# This is free software with ABSOLUTELY NO WARRANTY.
+# You can redistribute and/or modify it under the terms of LGPL.
+#
+# $Id: Makefile 20 2006-11-20 03:26:52Z zophos $
+#
+LIBDECODEQR_DIR=../../libdecodeqr
+
+CXX=@CXX@
+CPPFLAGS=@CPPFLAGS@ @CXXFLAGS@ -c -I$(LIBDECODEQR_DIR)
+
+LIBCV=@LIBCV@
+LIBHIGHGUI=@LIBHIGHGUI@
+LIBS=$(LIBCV) $(LIBHIGHGUI) -ldecodeqr
+
+LDFLAGS=@LDFLAGS@ -L$(LIBDECODEQR_DIR)
+
+VPATH=./:$(LIBDECODEQR_DIR)
+
+.SUFFIXES: .cpp .o
+.cpp.o:
+ $(CXX) $(CPPFLAGS) $<
+
+
+sources:=$(wildcard *.cpp)
+objs:=$(patsubst %.cpp,%.o,$(wildcard *.cpp))
+dst:=simpletest
+
+all: $(dst)
+
+$(dst): $(objs) libdecodeqr.a
+ $(CXX) $(LDFLAGS) -o $@ $(objs) $(LIBS)
+
+clean:
+ -rm *.o $(dst)
diff --git a/src/sample/simple/simple.dep b/src/sample/simple/simple.dep
new file mode 100644
index 0000000..b23481d
--- /dev/null
+++ b/src/sample/simple/simple.dep
@@ -0,0 +1,15 @@
+# Microsoft Developer Studio Generated Dependency File, included by simple.mak
+
+.\simpletest.cpp : \
+ "..\..\..\..\..\..\..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
+ "..\..\..\..\..\..\..\..\..\program files\opencv\cv\include\cv.h"\
+ "..\..\..\..\..\..\..\..\..\program files\opencv\cv\include\cvcompat.h"\
+ "..\..\..\..\..\..\..\..\..\program files\opencv\cv\include\cvtypes.h"\
+ "..\..\..\..\..\..\..\..\..\program files\opencv\cxcore\include\cxcore.h"\
+ "..\..\..\..\..\..\..\..\..\program files\opencv\cxcore\include\cxerror.h"\
+ "..\..\..\..\..\..\..\..\..\program files\opencv\cxcore\include\cxtypes.h"\
+ "..\..\..\..\..\..\..\..\..\program files\opencv\otherlibs\highgui\highgui.h"\
+ "..\..\decodeqr.h"\
+ "..\..\errorcode.h"\
+ "..\..\qrtypes.h"\
+
diff --git a/src/sample/simple/simple.dsp b/src/sample/simple/simple.dsp
new file mode 100644
index 0000000..aa1dd41
--- /dev/null
+++ b/src/sample/simple/simple.dsp
@@ -0,0 +1,105 @@
+# Microsoft Developer Studio Project File - Name="simple" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** ҏWȂł **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=simple - Win32 Debug
+!MESSAGE ͗LҲ̧قł͂܂B ۼުĂނ邽߂ɂ NMAKE gpĂB
+!MESSAGE [Ҳ̧ق̴߰] ނgpĎsĂ
+!MESSAGE
+!MESSAGE NMAKE /f "simple.mak".
+!MESSAGE
+!MESSAGE NMAKE ̎sɍ\wł܂
+!MESSAGE ײݏϸۂ̐ݒ`܂B:
+!MESSAGE
+!MESSAGE NMAKE /f "simple.mak" CFG="simple - Win32 Debug"
+!MESSAGE
+!MESSAGE I”\ Ӱ:
+!MESSAGE
+!MESSAGE "simple - Win32 Release" ("Win32 (x86) Console Application" p)
+!MESSAGE "simple - Win32 Debug" ("Win32 (x86) Console Application" p)
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "simple - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x411 /d "NDEBUG"
+# ADD RSC /l 0x411 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "simple - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x411 /d "_DEBUG"
+# ADD RSC /l 0x411 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib cv.lib cxcore.lib highgui.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "simple - Win32 Release"
+# Name "simple - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\simpletest.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=..\..\libdecodeqr\Debug\libdecodeqr.lib
+# End Source File
+# End Target
+# End Project
diff --git a/src/sample/simple/simple.dsw b/src/sample/simple/simple.dsw
new file mode 100644
index 0000000..3076a05
--- /dev/null
+++ b/src/sample/simple/simple.dsw
@@ -0,0 +1,41 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# x: ܰ߰ ̧ ҏW܂͍폜Ȃł!
+
+###############################################################################
+
+Project: "libdecodeqr"="..\..\libdecodeqr\libdecodeqr.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "simple"=".\simple.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/src/sample/simple/simple.mak b/src/sample/simple/simple.mak
new file mode 100644
index 0000000..cd4ca18
--- /dev/null
+++ b/src/sample/simple/simple.mak
@@ -0,0 +1,186 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on simple.dsp
+!IF "$(CFG)" == ""
+CFG=simple - Win32 Debug
+!MESSAGE Missing target. Using defualt "simple - Win32 Debug".
+!ENDIF
+
+!IF "$(CFG)" != "simple - Win32 Release" && "$(CFG)" != "simple - Win32 Debug"
+!MESSAGE Mode "$(CFG)" is not valid.
+!MESSAGE
+!MESSAGE Valid modes are:
+!MESSAGE
+!MESSAGE "simple - Win32 Release" (for "Win32 (x86) Static Library")
+!MESSAGE "simple - Win32 Debug" (for "Win32 (x86) Static Library")
+!MESSAGE
+!MESSAGE eg:
+!MESSAGE
+!MESSAGE NMAKE /f "simple.mak" CFG="webcam - Win32 Debug"
+!ERROR Invalid target are gaven.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == "simple - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+ALL : "$(OUTDIR)\simple.exe"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\simpletest.obj"
+ -@erase "$(INTDIR)\vc60.idb"
+ -@erase "$(OUTDIR)\simple.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\simple.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\simple.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\simple.pdb" /machine:I386 /out:"$(OUTDIR)\simple.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\simpletest.obj" \
+ "..\..\Debug\libdecodeqr.lib"
+
+"$(OUTDIR)\simple.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "simple - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+ALL : "$(OUTDIR)\simple.exe"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\simpletest.obj"
+ -@erase "$(INTDIR)\vc60.idb"
+ -@erase "$(INTDIR)\vc60.pdb"
+ -@erase "$(OUTDIR)\simple.exe"
+ -@erase "$(OUTDIR)\simple.ilk"
+ -@erase "$(OUTDIR)\simple.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\simple.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\simple.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib cv.lib cxcore.lib highgui.lib ws2_32.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\simple.pdb" /debug /machine:I386 /out:"$(OUTDIR)\simple.exe" /pdbtype:sept
+LINK32_OBJS= \
+ "$(INTDIR)\simpletest.obj" \
+ "..\..\Debug\libdecodeqr.lib"
+
+"$(OUTDIR)\simple.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("simple.dep")
+!INCLUDE "simple.dep"
+!ELSE
+!MESSAGE Warning: cannot find "simple.dep"
+!ENDIF
+!ENDIF
+
+
+!IF "$(CFG)" == "simple - Win32 Release" || "$(CFG)" == "simple - Win32 Debug"
+SOURCE=.\simpletest.cpp
+
+"$(INTDIR)\simpletest.obj" : $(SOURCE) "$(INTDIR)"
+
+
+
+!ENDIF
+
diff --git a/src/sample/simple/simpletest.cpp b/src/sample/simple/simpletest.cpp
new file mode 100644
index 0000000..aaa1812
--- /dev/null
+++ b/src/sample/simple/simpletest.cpp
@@ -0,0 +1,70 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// simpletest.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: simpletest.cpp 39 2007-02-23 22:30:08Z zophos $
+//
+#include <stdio.h>
+#include <highgui.h>
+#include "../../libdecodeqr/decodeqr.h"
+
+int main(int argc,char *argv[])
+{
+ cvNamedWindow("src",1);
+ //
+ // load image
+ //
+ IplImage *src=cvLoadImage(argv[1],1);
+ cvShowImage("src",src);
+
+ //
+ // show version info
+ //
+ printf("libdecodeqr version %s\n",qr_decoder_version());
+
+ //
+ // initialize
+ //
+ QrDecoderHandle decoder=qr_decoder_open();
+
+ //
+ // do decode using default parameter
+ //
+ short stat=qr_decoder_decode_image(decoder,src);
+ printf("STATUS=%04x\n",stat);
+
+ //
+ // get QR code header
+ //
+ QrCodeHeader header;
+ if(qr_decoder_get_header(decoder,&header)){
+ //
+ // get QR code text
+ // To null terminate, a buffer size is larger than body size.
+ //
+ char *buf=new char[header.byte_size+1];
+ qr_decoder_get_body(decoder,(unsigned char *)buf,header.byte_size+1);
+ printf("%s\n",buf);
+ }
+
+ //
+ // finalize
+ //
+ qr_decoder_close(decoder);
+
+ puts("");
+ puts("Hit any key to end.");
+ cvWaitKey(0);
+
+ cvDestroyAllWindows();
+ cvReleaseImage(&src);
+
+ return(0);
+}
diff --git a/src/sample/webcam/Makefile.in b/src/sample/webcam/Makefile.in
new file mode 100644
index 0000000..886934a
--- /dev/null
+++ b/src/sample/webcam/Makefile.in
@@ -0,0 +1,41 @@
+#
+# Makefile.in -- a part of libdecodeqr
+#
+# Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+# JMA (Japan Medical Association)
+# NaCl (Network Applied Communication Laboratory Ltd.)
+#
+# This is free software with ABSOLUTELY NO WARRANTY.
+# You can redistribute and/or modify it under the terms of LGPL.
+#
+# $Id: Makefile 20 2006-11-20 03:26:52Z zophos $
+#
+LIBDECODEQR_DIR=../../libdecodeqr
+
+CXX=@CXX@
+CPPFLAGS=@CPPFLAGS@ @CXXFLAGS@ -c -I$(LIBDECODEQR_DIR)
+
+LIBCV=@LIBCV@
+LIBHIGHGUI=@LIBHIGHGUI@
+LIBS=$(LIBCV) $(LIBHIGHGUI) -ldecodeqr
+
+LDFLAGS=@LDFLAGS@ -L$(LIBDECODEQR_DIR)
+
+VPATH=./:$(LIBDECODEQR_DIR)
+
+.SUFFIXES: .cpp .o
+.cpp.o:
+ $(CXX) $(CPPFLAGS) $<
+
+
+sources:=$(wildcard *.cpp)
+objs:=$(patsubst %.cpp,%.o,$(wildcard *.cpp))
+dst:=webcam
+
+all: $(dst)
+
+$(dst): $(objs) libdecodeqr.a
+ $(CXX) $(LDFLAGS) -o $@ $(objs) $(LIBS)
+
+clean:
+ -rm *.o $(dst)
diff --git a/src/sample/webcam/webcam.cpp b/src/sample/webcam/webcam.cpp
new file mode 100644
index 0000000..43648c2
--- /dev/null
+++ b/src/sample/webcam/webcam.cpp
@@ -0,0 +1,196 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// webcam.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: webcam.cpp 41 2007-02-25 19:42:28Z zophos $
+//
+#include <stdio.h>
+#include <string.h>
+#include <highgui.h>
+#include "../../libdecodeqr/decodeqr.h"
+
+int usage(char *program_name);
+
+int main(int argc,char *argv[])
+{
+ int show_bin_image=0;
+
+ if(argc>1){
+ if(strcmp(argv[1],"-d"))
+ return(usage(argv[0]));
+ else
+ show_bin_image=1;
+ }
+
+
+ //
+ // start camera
+ //
+ CvCapture *capture=cvCaptureFromCAM(0);
+ if(!capture)
+ return(-1);
+
+ //
+ // initialize qr decoder
+ //
+ QrDecoderHandle decoder=qr_decoder_open();
+ printf("libdecodeqr version %s\n",qr_decoder_version());
+
+
+ cvNamedWindow("src",1);
+
+ if(show_bin_image)
+ cvNamedWindow("bin",1);
+
+ puts("Hit [SPACE] key to grab, or any key to end.");
+ puts("");
+
+ //
+ // 1 shot grabing
+ //
+ //
+ // allocate grabed buffer to decoder
+ //
+ int key=-1;
+
+ IplImage *camera=cvQueryFrame(capture);
+ IplImage *src=NULL,*bin=NULL;
+ if(camera){
+ src=cvCloneImage(camera);
+ qr_decoder_set_image_buffer(decoder,src);
+ }
+ else
+ key=1;
+
+ unsigned char *text=NULL;
+ int text_size=0;
+
+ while(key<=0){
+ cvShowImage("src",camera);
+ key=cvWaitKey(150);
+
+ //
+ // when [SPACE] key pressed, do decode.
+ //
+ if(key==0x20&&!qr_decoder_is_busy(decoder)){
+ key=-1;
+
+ //
+ // if left-bottom origin (MS-Windows style) format,
+ // it must be converted to left-top origin.
+ //
+ if(camera->origin)
+ cvConvertImage(camera,src,CV_CVTIMG_FLIP);
+ else
+ cvCopy(camera,src);
+
+ //
+ // While decoding is a failure, decrease the
+ // adaptive_th_size parameter.
+ // Note that the adaptive_th_size must be odd.
+ //
+ short sz,stat;
+ for(sz=25,stat=0;
+ (sz>=3)&&((stat&QR_IMAGEREADER_DECODED)==0);
+ sz-=2)
+ stat=qr_decoder_decode(decoder,sz);
+
+ //
+ // for debug, show binarized image.
+ //
+ if(bin)
+ cvReleaseImage(&bin);
+ if(show_bin_image){
+ bin=cvCloneImage(qr_decoder_get_binarized_image_buffer(decoder));
+ cvShowImage("bin",bin);
+ }
+ printf("adaptive_th_size=%d, status=%04x\n",sz,stat);
+
+ //
+ // on suceed decoding, print decoded text.
+ //
+ QrCodeHeader header;
+ if(qr_decoder_get_header(decoder,&header)){
+ if(text_size<header.byte_size+1){
+ if(text)
+ delete text;
+
+ text_size=header.byte_size+1;
+ text=new unsigned char[text_size];
+ }
+ qr_decoder_get_body(decoder,text,text_size);
+ printf("%s\n\n",text);
+
+ //
+ // draw found code region with green line
+ //
+ CvPoint *vertexes=qr_decoder_get_coderegion_vertexes(decoder);
+ CvPoint pt=vertexes[3];
+ int i;
+ for(i=0;i<4;i++){
+ cvLine(src,pt,vertexes[i],CV_RGB(0,255,0),3);
+ pt=vertexes[i];
+ }
+
+ //
+ // draw found finder patterns with green ellipse
+ //
+ CvBox2D *boxes=qr_decoder_get_finderpattern_boxes(decoder);
+ for(i=0;i<3;i++){
+ CvSize sz=cvSize((int)boxes[i].size.width/2,
+ (int)boxes[i].size.height/2);
+ cvEllipse(src,
+ cvPointFrom32f(boxes[i].center),
+ sz,
+ boxes[i].angle,
+ 0,360,
+ CV_RGB(0,255,0),2);
+ }
+
+ if(src->origin)
+ cvConvertImage(src,src,CV_CVTIMG_FLIP);
+
+ cvShowImage("src",src);
+
+ //
+ // wait 1500msec.
+ //
+ key=cvWaitKey(1500);
+ }
+ }
+
+ camera=cvQueryFrame(capture);
+ if(!camera)
+ break;
+ }
+
+ if(text)
+ delete text;
+
+ qr_decoder_close(decoder);
+ if(bin)
+ cvReleaseImage(&bin);
+ if(src)
+ cvReleaseImage(&src);
+
+ cvReleaseCapture(&capture);
+
+ return(0);
+}
+
+
+int usage(char *program_name)
+{
+ fprintf(stderr,"usage: %s [-d|-h]\n",program_name);
+ fprintf(stderr,"-d\tturn on debug mode.\n");
+ fprintf(stderr,"-h\tshow thismessage and quit.\n\n");
+
+ return(-1);
+}
diff --git a/src/sample/webcam/webcam.dep b/src/sample/webcam/webcam.dep
new file mode 100644
index 0000000..3f09a20
--- /dev/null
+++ b/src/sample/webcam/webcam.dep
@@ -0,0 +1,15 @@
+# Microsoft Developer Studio Generated Dependency File, included by webcam.mak
+
+.\webcam.cpp : \
+ "..\..\..\..\..\..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\
+ "..\..\..\..\..\..\..\..\program files\opencv\cv\include\cv.h"\
+ "..\..\..\..\..\..\..\..\program files\opencv\cv\include\cvcompat.h"\
+ "..\..\..\..\..\..\..\..\program files\opencv\cv\include\cvtypes.h"\
+ "..\..\..\..\..\..\..\..\program files\opencv\cxcore\include\cxcore.h"\
+ "..\..\..\..\..\..\..\..\program files\opencv\cxcore\include\cxerror.h"\
+ "..\..\..\..\..\..\..\..\program files\opencv\cxcore\include\cxtypes.h"\
+ "..\..\..\..\..\..\..\..\program files\opencv\otherlibs\highgui\highgui.h"\
+ "..\..\libdecodeqr\decodeqr.h"\
+ "..\..\libdecodeqr\qrerror.h"\
+ "..\..\libdecodeqr\qrtypes.h"\
+
diff --git a/src/sample/webcam/webcam.dsp b/src/sample/webcam/webcam.dsp
new file mode 100644
index 0000000..3b1557d
--- /dev/null
+++ b/src/sample/webcam/webcam.dsp
@@ -0,0 +1,105 @@
+# Microsoft Developer Studio Project File - Name="webcam" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** ҏWȂł **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=webcam - Win32 Debug
+!MESSAGE ͗LҲ̧قł͂܂B ۼުĂނ邽߂ɂ NMAKE gpĂB
+!MESSAGE [Ҳ̧ق̴߰] ނgpĎsĂ
+!MESSAGE
+!MESSAGE NMAKE /f "webcam.mak".
+!MESSAGE
+!MESSAGE NMAKE ̎sɍ\wł܂
+!MESSAGE ײݏϸۂ̐ݒ`܂B:
+!MESSAGE
+!MESSAGE NMAKE /f "webcam.mak" CFG="webcam - Win32 Debug"
+!MESSAGE
+!MESSAGE I”\ Ӱ:
+!MESSAGE
+!MESSAGE "webcam - Win32 Release" ("Win32 (x86) Console Application" p)
+!MESSAGE "webcam - Win32 Debug" ("Win32 (x86) Console Application" p)
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "webcam - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x411 /d "NDEBUG"
+# ADD RSC /l 0x411 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "webcam - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x411 /d "_DEBUG"
+# ADD RSC /l 0x411 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib cv.lib cxcore.lib highgui.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "webcam - Win32 Release"
+# Name "webcam - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\webcam.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=..\..\libdecodeqr\Debug\libdecodeqr.lib
+# End Source File
+# End Target
+# End Project
diff --git a/src/sample/webcam/webcam.dsw b/src/sample/webcam/webcam.dsw
new file mode 100644
index 0000000..94f44d4
--- /dev/null
+++ b/src/sample/webcam/webcam.dsw
@@ -0,0 +1,41 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# x: ܰ߰ ̧ ҏW܂͍폜Ȃł!
+
+###############################################################################
+
+Project: "libdecodeqr"="..\..\libdecodeqr\libdecodeqr.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "webcam"=".\webcam.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/src/sample/webcam/webcam.mak b/src/sample/webcam/webcam.mak
new file mode 100644
index 0000000..62f5524
--- /dev/null
+++ b/src/sample/webcam/webcam.mak
@@ -0,0 +1,186 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on webcam.dsp
+!IF "$(CFG)" == ""
+CFG=webcam - Win32 Debug
+!MESSAGE Missing target. Using defualt "webcam - Win32 Debug".
+!ENDIF
+
+!IF "$(CFG)" != "webcam - Win32 Release" && "$(CFG)" != "webcam - Win32 Debug"
+!MESSAGE Mode "$(CFG)" is not valid.
+!MESSAGE
+!MESSAGE Valid modes are:
+!MESSAGE
+!MESSAGE "webcam - Win32 Release" (for "Win32 (x86) Static Library")
+!MESSAGE "webcam - Win32 Debug" (for "Win32 (x86) Static Library")
+!MESSAGE
+!MESSAGE eg:
+!MESSAGE
+!MESSAGE NMAKE /f "webcam.mak" CFG="webcam - Win32 Debug"
+!ERROR Invalid target are gaven.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == "webcam - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+ALL : "$(OUTDIR)\webcam.exe"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\vc60.idb"
+ -@erase "$(INTDIR)\webcam.obj"
+ -@erase "$(OUTDIR)\webcam.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\webcam.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\webcam.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\webcam.pdb" /machine:I386 /out:"$(OUTDIR)\webcam.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\webcam.obj" \
+ "..\..\libdecodeqr\Debug\libdecodeqr.lib"
+
+"$(OUTDIR)\webcam.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "webcam - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+ALL : "$(OUTDIR)\webcam.exe"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\vc60.idb"
+ -@erase "$(INTDIR)\vc60.pdb"
+ -@erase "$(INTDIR)\webcam.obj"
+ -@erase "$(OUTDIR)\webcam.exe"
+ -@erase "$(OUTDIR)\webcam.ilk"
+ -@erase "$(OUTDIR)\webcam.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\webcam.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+RSC=rc.exe
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\webcam.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib cv.lib cxcore.lib highgui.lib ws2_32.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\webcam.pdb" /debug /machine:I386 /out:"$(OUTDIR)\webcam.exe" /pdbtype:sept
+LINK32_OBJS= \
+ "$(INTDIR)\webcam.obj" \
+ "..\..\libdecodeqr\Debug\libdecodeqr.lib"
+
+"$(OUTDIR)\webcam.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("webcam.dep")
+!INCLUDE "webcam.dep"
+!ELSE
+!MESSAGE Warning: cannot find "webcam.dep"
+!ENDIF
+!ENDIF
+
+
+!IF "$(CFG)" == "webcam - Win32 Release" || "$(CFG)" == "webcam - Win32 Debug"
+SOURCE=.\webcam.cpp
+
+"$(INTDIR)\webcam.obj" : $(SOURCE) "$(INTDIR)"
+
+
+
+!ENDIF
+
diff --git a/src/test/Makefile.in b/src/test/Makefile.in
new file mode 100644
index 0000000..cdb4e25
--- /dev/null
+++ b/src/test/Makefile.in
@@ -0,0 +1,44 @@
+#
+# Makefile.in -- a part of libdecodeqr
+#
+# Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+# JMA (Japan Medical Association)
+# NaCl (Network Applied Communication Laboratory Ltd.)
+#
+# This is free software with ABSOLUTELY NO WARRANTY.
+# You can redistribute and/or modify it under the terms of LGPL.
+#
+# $Id:$
+#
+LIBDECODEQR_DIR=../libdecodeqr
+
+CXX=@CXX@
+CPPFLAGS=@CPPFLAGS@ @CXXFLAGS@ -c
+LDFLAGS=@LDFLAGS@
+
+VPATH=./:$(LIBDECODEQR_DIR)
+
+.SUFFIXES: .cpp .o
+.cpp.o:
+ $(CXX) $(CPPFLAGS) $<
+
+dst:=$(basename $(wildcard *.cpp))
+
+all: test-all
+
+test-all: test-galois test-codedata
+
+test-galois: test_galois
+ ./$<
+
+test-codedata: test_codedata
+ ./$<
+
+test_galois: test_galois.o galois.o
+ $(CXX) -o $@ test_galois.o galois.o
+
+test_codedata: test_codedata.o codedata.o bitstream.o galois.o ecidecoder.o
+ $(CXX) -o $@ test_codedata.o codedata.o bitstream.o galois.o ecidecoder.o
+
+clean:
+ -rm *.o $(dst)
diff --git a/src/test/test_codedata.cpp b/src/test/test_codedata.cpp
new file mode 100644
index 0000000..181dc53
--- /dev/null
+++ b/src/test/test_codedata.cpp
@@ -0,0 +1,72 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// test_codedata.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: test_codedata.cpp 36 2007-02-21 23:22:03Z zophos $
+//
+#include <stdio.h>
+#include <assert.h>
+#include "../libdecodeqr/codedata.h"
+
+int main(int argc,char *argv[])
+{
+ int i;
+ /*
+ Qr::CodeData *words=new Qr::CodeData(1,1);
+ unsigned char test_data2[26]={
+ 128,68,133,167,73,167,139,108,
+ 0,236,17,236,17,236,17,236,
+ 17,236,17,249,187,11,161,75,
+ 69,244
+ };
+ for(i=0;i<26;i++){
+ words->push(test_data2[i]);
+ }
+ */
+
+ Qr::CodeData *words=new Qr::CodeData(1,2);
+
+ puts("testing no-error data");
+ unsigned char sent[26]={
+ 32,65,205,69,41,220,46,128,
+ 236,42,159,74,221,244,169,239,
+ 150,138,70,237,85,224,96,74,
+ 219,61
+ };
+ for(i=0;i<26;i++){
+ words->push(sent[i]);
+ }
+ assert(words->decode()==0);
+
+ puts("testing 2 errors data");
+ words->clear();
+ unsigned char recv[26]={
+ 33,64,205,69,41,220,46,128,
+ 236,42,159,74,221,244,169,239,
+ 150,138,70,237,85,224,96,74,
+ 219,61
+ };
+ for(i=0;i<26;i++){
+ words->push(recv[i]);
+ }
+ assert(words->decode()==2);
+
+ puts("verifing corrected data");
+ unsigned char *corrected=words->dump();
+ for(i=0;i<26;i++){
+ assert(corrected[i]==sent[i]);
+ }
+
+ delete corrected;
+ delete words;
+
+ puts("done");
+ return(0);
+}
diff --git a/src/test/test_galois.cpp b/src/test/test_galois.cpp
new file mode 100644
index 0000000..cbdd62f
--- /dev/null
+++ b/src/test/test_galois.cpp
@@ -0,0 +1,52 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// test_galois.cpp --a part of libdecodeqr
+//
+// Copyright(C) 2007 NISHI Takao <zophos@koka-in.org>
+// JMA (Japan Medical Association)
+// NaCl (Network Applied Communication Laboratory Ltd.)
+//
+// This is free software with ABSOLUTELY NO WARRANTY.
+// You can redistribute and/or modify it under the terms of LGPL.
+//
+// $Id: test_galois.cpp 36 2007-02-21 23:22:03Z zophos $
+//
+#include <stdio.h>
+#include <assert.h>
+#include "../libdecodeqr/galois.h"
+
+int main(int argc,char *argv[])
+{
+ puts("testing gaussian elimination on GF(2^8)");
+
+ Galois::Field *gf=new Galois::Field(8);
+
+ //
+ // may return (1,2);
+ //
+ Galois::Polynomial *mat=new Galois::Polynomial(2,3);
+
+ mat->set(0,0,gf->exp2nomial(1));
+ mat->set(0,1,gf->exp2nomial(2));
+ mat->set(0,2,&(*gf->exp2nomial(1)*
+ *gf->exp2nomial(1)+
+ *gf->exp2nomial(2)*
+ *gf->exp2nomial(2))); //a^52
+ mat->set(1,0,gf->exp2nomial(2));
+ mat->set(1,1,gf->exp2nomial(4));
+ mat->set(1,2,&(*gf->exp2nomial(2)*
+ *gf->exp2nomial(1)+
+ *gf->exp2nomial(4)*
+ *gf->exp2nomial(2))); //a^226
+
+ Galois::Polynomial *a=mat->solve();
+
+ assert(a&&a->nomial[0]->val==1&&a->nomial[1]->val==2);
+
+ delete a;
+ delete mat;
+ delete gf;
+
+ puts("done");
+ return(0);
+}