/*******************************************************************
 * morpho_easy_hdr.h
 * [CP932/CRLF] { ‚  •„†‰»•ûŽ®Ž©“®”»’è—p }
 *------------------------------------------------------------------
 * Copyright (C) 2010-2012 Morpho,Inc.
 *******************************************************************/

#ifndef MORPHO_EASY_HDR_H
#define MORPHO_EASY_HDR_H

/*******************************************************************/

#include "morpho_api.h"
#include "morpho_error.h"
#include "morpho_image_data.h"
#include "morpho_rect_int.h"

/*******************************************************************/

#define MORPHO_EASY_HDR_VER "Morpho EasyHDR Ver.2.0.1 2012/07/18"

/*-----------------------------------------------------------------*/

/* (input-limitaion) */

#define MORPHO_EASY_HDR_MIN_IMAGE_WIDTH    100
#define MORPHO_EASY_HDR_MAX_IMAGE_WIDTH   8192
#define MORPHO_EASY_HDR_MIN_IMAGE_HEIGHT   100
#define MORPHO_EASY_HDR_MAX_IMAGE_HEIGHT  8192
#define MORPHO_EASY_HDR_MIN_NIMAGES   2
#define MORPHO_EASY_HDR_MAX_NIMAGES  10

/*-----------------------------------------------------------------*/

/* (parameter) */

#define MORPHO_EASY_HDR_DISABLED 0
#define MORPHO_EASY_HDR_ENABLED  1

#define MORPHO_EASY_HDR_IMAGE_ALIGNMENT_DEFAULT  MORPHO_EASY_HDR_ENABLED

#define MORPHO_EASY_HDR_GHOST_REMOVAL_DEFAULT  MORPHO_EASY_HDR_ENABLED

#define MORPHO_EASY_HDR_AUTO_SCALING_DEFAULT  MORPHO_EASY_HDR_ENABLED

#define MORPHO_EASY_HDR_FACE_DETECTION_DEFAULT  MORPHO_EASY_HDR_ENABLED

#define MORPHO_EASY_HDR_FAIL_SOFT_MERGING_DEFAULT  MORPHO_EASY_HDR_ENABLED

#define MORPHO_EASY_HDR_GHOST_DETECTION_SENSITIVITY_LEVEL_MIN      0
#define MORPHO_EASY_HDR_GHOST_DETECTION_SENSITIVITY_LEVEL_MAX     10
#define MORPHO_EASY_HDR_GHOST_DETECTION_SENSITIVITY_LEVEL_DEFAULT  7

#define MORPHO_EASY_HDR_MERGE_SMOOTHNESS_LEVEL_MIN      0
#define MORPHO_EASY_HDR_MERGE_SMOOTHNESS_LEVEL_MAX     10
#define MORPHO_EASY_HDR_MERGE_SMOOTHNESS_LEVEL_DEFAULT  6

#define MORPHO_EASY_HDR_MERGE_PARAM_MIN        0
#define MORPHO_EASY_HDR_MERGE_PARAM_MAX      255
#define MORPHO_EASY_HDR_MERGE_PARAM1_DEFAULT   0
#define MORPHO_EASY_HDR_MERGE_PARAM2_DEFAULT 128
#define MORPHO_EASY_HDR_MERGE_PARAM3_DEFAULT   0
#define MORPHO_EASY_HDR_MERGE_PARAM4_DEFAULT 255

#define MORPHO_EASY_HDR_RELIABLE_RECT_RATE_THRESHOLD_MIN       0
#define MORPHO_EASY_HDR_RELIABLE_RECT_RATE_THRESHOLD_MAX     100
#define MORPHO_EASY_HDR_RELIABLE_RECT_RATE_THRESHOLD_DEFAULT  80

#define MORPHO_EASY_HDR_GHOST_RATE_THRESHOLD_MIN       0
#define MORPHO_EASY_HDR_GHOST_RATE_THRESHOLD_MAX     100
#define MORPHO_EASY_HDR_GHOST_RATE_THRESHOLD_DEFAULT  90

#define MORPHO_EASY_HDR_CC_OFFSET_MIN          0
#define MORPHO_EASY_HDR_CC_OFFSET_MAX        255
#define MORPHO_EASY_HDR_CC_Y_OFFSET_DEFAULT    0
#define MORPHO_EASY_HDR_CC_C_OFFSET_DEFAULT    0

#define MORPHO_EASY_HDR_CC_GAIN_MIN        100
#define MORPHO_EASY_HDR_CC_GAIN_MAX       2000
#define MORPHO_EASY_HDR_CC_Y_GAIN_DEFAULT 1000
#define MORPHO_EASY_HDR_CC_C_GAIN_DEFAULT 1000

#define MORPHO_EASY_HDR_CC_GAMMA_MIN        100
#define MORPHO_EASY_HDR_CC_GAMMA_MAX       2000
#define MORPHO_EASY_HDR_CC_Y_GAMMA_DEFAULT 1000
#define MORPHO_EASY_HDR_CC_C_GAMMA_DEFAULT 1000

/*-----------------------------------------------------------------*/

/* (merge-status) */

#define MORPHO_EASY_HDR_OK                             0x00000000
#define MORPHO_EASY_HDR_ERROR_IMAGE_ALIGNMENT_FAILURE  0x00000001
#define MORPHO_EASY_HDR_ERROR_EXP_ESTIMATION_FAILURE   0x00000002
#define MORPHO_EASY_HDR_ERROR_MOSTLY_GHOST             0x00000004
#define MORPHO_EASY_HDR_ERROR_INTERNAL                 0x80000000

/*******************************************************************/

typedef struct _morpho_EasyHDR morpho_EasyHDR;
typedef struct _morpho_EasyHDR_Callback morpho_EasyHDR_Callback;

/*-----------------------------------------------------------------*/

/** EasyHDR */
struct _morpho_EasyHDR
{
    void *p; /**< “à•”\‘¢‘̂ւ̃|ƒCƒ“ƒ^ */
};

/** EasyHDR Callback (for multi-thread processing) */
struct _morpho_EasyHDR_Callback
{
    void *p; /**< ƒR[ƒ‹ƒoƒbƒNŠÖ”‚Ì‘æˆêˆø”‚Æ‚µ‚Ä“n‚³‚ê‚é’l */

    void * (* thread_create )(void *p, int index, void *(*start_routine)(void *arg), void *arg);
    int    (* thread_destroy)(void *p, void *thread);
    int    (* thread_join   )(void *p, void *thread, void **value_ptr);

    void * (* mutex_create )(void *p);
    int    (* mutex_destroy)(void *p, void *mutex);
    int    (* mutex_lock   )(void *p, void *mutex);
    int    (* mutex_trylock)(void *p, void *mutex);
    int    (* mutex_unlock )(void *p, void *mutex);

    void * (* cond_create   )(void *p);
    int    (* cond_destroy  )(void *p, void *cond);
    int    (* cond_wait     )(void *p, void *cond, void *lock);
    int    (* cond_signal   )(void *p, void *cond);
    int    (* cond_broadcast)(void *p, void *cond);
};

/*******************************************************************/

#ifdef __cplusplus
extern "C"
{
#endif

/*-----------------------------------------------------------------*/

/**
 * ƒo[ƒWƒ‡ƒ“•¶Žš—ñ‚ðŽæ“¾
 *
 * @return ƒo[ƒWƒ‡ƒ“•¶Žš—ñ(MORPHO_EASY_HDR_VER)
 */
MORPHO_API(char const *)
morpho_EasyHDR_getVersion(void);

/*-----------------------------------------------------------------*/

/**
 * •K—v‚ȃƒ‚ƒŠƒTƒCƒY‚ðŽæ“¾
 *
 * @param[in]  max_width   “ü—͉摜‚̍ő啝
 * @param[in]  max_height  “ü—͉摜‚̍ő卂‚³
 * @param[in]  format      ‰æ‘œƒtƒH[ƒ}ƒbƒg•¶Žš—ñ
 *
 * @return •K—v‚ȃƒ‚ƒŠƒTƒCƒY(byte)
 */
MORPHO_API(int)
morpho_EasyHDR_getBufferSize(
    int max_width,
    int max_height,
    char const *format);

/**
 * ‰Šú‰»
 *
 * Žg—pƒXƒŒƒbƒh”‚É0ˆÈ‰º‚Ì’l‚ðÝ’肵‚½ê‡A
 * •ªŠ„ŽÀs‚ðs‚¤B
 *
 * Žg—pƒXƒŒƒbƒh”‚É1ˆÈã‚Ì’l‚ðÝ’肵‚½ê‡A
 * ˆêŠ‡ŽÀs‚ðs‚¤B
 *
 * Žg—pƒXƒŒƒbƒh”‚É2ˆÈã‚Ì’l‚ðÝ’肵‚½ê‡A
 * ƒ}ƒ‹ƒ`ƒXƒŒƒbƒh‚É‚æ‚é•À—ñŽÀs(ˆêŠ‡ŽÀs)‚ðs‚¤B
 * callback ‚É“KØ‚È’l‚ðÝ’è‚·‚é•K—v‚ ‚èB
 *
 * yŽÀsó‘Ô‚Ì‘JˆÚz
 *     ?_UNKNOWN ¨ 0_INITIALIZED
 *
 * @param[in,out]  p            EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     buffer       EasyHDR‚ÉŠ„‚è“–‚Ă郁ƒ‚ƒŠ‚ւ̃|ƒCƒ“ƒ^
 * @param[in]      buffer_size  EasyHDR‚ÉŠ„‚è“–‚Ă郁ƒ‚ƒŠ‚̃TƒCƒY
 * @param[in]      nthreads     Žg—pƒXƒŒƒbƒh” (ƒRƒA”)
 * @param[in]      callback     ƒR[ƒ‹ƒoƒbƒNŠÖ”ŒQ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_initialize(
    morpho_EasyHDR *p,
    void *buffer,
    int buffer_size,
    int nthreads,
    morpho_EasyHDR_Callback const *callback);

/**
 * ƒNƒŠ[ƒ“ƒAƒbƒv
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p  EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_finalize(
    morpho_EasyHDR *p);

/*-----------------------------------------------------------------*/

/**
 * ‡¬‚ÌŠJŽnEŽÀs
 * setImageFormat() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * yŽÀsó‘Ô‚Ì‘JˆÚ (ˆêŠ‡ŽÀsŽž)z
 *     0_INITIALIZED ¨ (1_PROCESSING) ¨ 0_INITIALIZED (ˆ—Š®—¹)
 *                                     ¨ 2_SUSPENDED   (suspend()ŒÄ‚яo‚µ)
 *
 * yŽÀsó‘Ô‚Ì‘JˆÚ (•ªŠ„ŽÀsŽž)z
 *     0_INITIALIZED ¨ 3_PAUSED      (ˆ—’†)
 *                   ¨ 0_INITIALIZED (ˆ—Š®—¹)
 *
 * @param[in,out]  p             EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     output_image  Œ‹‰Ê‰æ‘œ (u1–‡–ځv‚Ì“ü—͉摜‚ðŽw’è‰Â”\)
 * @param[in,out]  input_images  “ü—͉摜ŒQ (ƒGƒ“ƒWƒ“‚É‚æ‚Á‚ď‘‚«Š·‚¦‚ç‚ê‚é)
 * @param[in]      nimages       “ü—͉摜‚̐”
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_merge(
    morpho_EasyHDR *p,
    morpho_ImageData *output_image,
    morpho_ImageData *input_images[],
    int nimages);

/*-----------------------------------------------------------------*/

/**
 * ‡¬‚ÌŒp‘±ŽÀs
 *
 * merge() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * •ªŠ„ŽÀsŽž(initialize() ‚Å nthreads ‚É 0 ‚ðŽw’肵‚½‚Æ‚«)‚Ì‚Ý—LŒø
 *
 * yŽÀsó‘Ô‚Ì‘JˆÚ (•ªŠ„ŽÀsŽž)z
 *     3_PAUSED ¨ 3_PAUSED      (ˆ—’†)
 *              ¨ 0_INITIALIZED (ˆ—Š®—¹)
 *
 * @param[in,out]  p  EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_process(
    morpho_EasyHDR *p);

/*-----------------------------------------------------------------*/

/**
 * ‡¬‚Ì’†’f (•ÊƒRƒ“ƒeƒLƒXƒg‚©‚ç‚̌Ăяo‚µ‚É‚æ‚é)
 * merge() ŽÀs’†‚ÉŽÀs‰Â”\
 *
 * yŽÀsó‘Ô‚Ì‘JˆÚ (ˆêŠ‡ŽÀsŽž)z
 *     1_PROCESSING ¨ 2_SUSPENDED
 *
 * @param[in,out]  p  EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_suspend(
    morpho_EasyHDR *p);

/**
 * ‡¬‚̍ĊJ
 * suspend() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * yŽÀsó‘Ô‚Ì‘JˆÚ (ˆêŠ‡ŽÀsŽž)z
 *     2_SUSPENDED ¨ (1_PROCESSING) ¨ 0_INITIALIZED (ˆ—Š®—¹)
 *                                   ¨ 2_SUSPENDED   (suspend()ŒÄ‚яo‚µ)
 *
 * @param[in,out]  p  EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_resume(
    morpho_EasyHDR *p);

/*-----------------------------------------------------------------*/

/**
 * ‰æ‘œƒtƒH[ƒ}ƒbƒg‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p       EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      format  ‰æ‘œƒtƒH[ƒ}ƒbƒg‚ð‚ ‚ç‚í‚·•¶Žš—ñ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setImageFormat(
    morpho_EasyHDR *p,
    char const *format);

/**
 * ‰æ‘œƒtƒH[ƒ}ƒbƒg‚̎擾
 * setImageFormat() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p            EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     buffer       ‰æ‘œƒtƒH[ƒ}ƒbƒg‚ð‚ ‚ç‚í‚·•¶Žš—ñ‚ªŠi”[‚³‚ê‚éƒoƒbƒtƒ@
 * @param[in]      buffer_size  ƒoƒbƒtƒ@‚̃TƒCƒY(I’[•¶ŽšŠÜ‚Þ)
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getImageFormat(
    morpho_EasyHDR *p,
    char *buffer,
    int buffer_size);

/*-----------------------------------------------------------------*/

/**
 * ˆÊ’u‡‚킹(Žè‚Ô‚ê•â³)‚Ì—L–³‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * value:
 *   MOR_EASY_HDR_ENABLED  : ˆÊ’u‡‚킹‚ ‚è
 *   MOR_EASY_HDR_DISABLED : ˆÊ’u‡‚킹‚È‚µ
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      value  Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setImageAlignmentStatus(
    morpho_EasyHDR *p,
    int value);

/**
 * ˆÊ’u‡‚킹(Žè‚Ô‚ê•â³)‚Ì—L–³‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     value  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getImageAlignmentStatus(
    morpho_EasyHDR *p,
    int *value);

/*-----------------------------------------------------------------*/

/**
 * ƒS[ƒXƒgœ‹Ž(”íŽÊ‘Ì‚Ô‚ê•â³)‚Ì—L–³‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * value:
 *   MOR_EASY_HDR_ENABLED  : ƒS[ƒXƒgœ‹Ž‚ ‚è
 *   MOR_EASY_HDR_DISABLED : ƒS[ƒXƒgœ‹Ž‚È‚µ
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      value  Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setGhostRemovalStatus(
    morpho_EasyHDR *p,
    int value);

/**
 * ƒS[ƒXƒgœ‹Ž(”íŽÊ‘Ì‚Ô‚ê•â³)‚Ì—L–³‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     value  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getGhostRemovalStatus(
    morpho_EasyHDR *p,
    int *value);

/*-----------------------------------------------------------------*/

/**
 * Ž©“®Šg‘å(ƒNƒŠƒbƒsƒ“ƒO)‚Ì—L–³‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * value:
 *   MOR_EASY_HDR_ENABLED  : Ž©“®Šg‘å‚ ‚è
 *   MOR_EASY_HDR_DISABLED : Ž©“®Šg‘å‚È‚µ
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      value  Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setAutoScalingStatus(
    morpho_EasyHDR *p,
    int value);

/**
 * Ž©“®Šg‘å(ƒNƒŠƒbƒsƒ“ƒO)‚Ì—L–³‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     value  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getAutoScalingStatus(
    morpho_EasyHDR *p,
    int *value);

/*-----------------------------------------------------------------*/

/**
 * ŠçŒŸo•â³‚Ì—L–³‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * value:
 *   MOR_EASY_HDR_ENABLED  : ŠçŒŸo•â³‚ ‚è
 *   MOR_EASY_HDR_DISABLED : ŠçŒŸo•â³‚È‚µ
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      value  Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setFaceDetectionStatus(
    morpho_EasyHDR *p,
    int value);

/**
 * ŠçŒŸo•â³‚Ì—L–³‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     value  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getFaceDetectionStatus(
    morpho_EasyHDR *p,
    int *value);

/*-----------------------------------------------------------------*/

/**
 * Fail-soft-merging ‚Ì—L–³‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * value:
 *   MOR_EASY_HDR_ENABLED  : Fail-soft-merging ‚ ‚è
 *   MOR_EASY_HDR_DISABLED : Fail-soft-merging ‚È‚µ
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      value  Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setFailSoftMergingStatus(
    morpho_EasyHDR *p,
    int value);

/**
 * Fail-soft-merging ‚Ì—L–³‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     value  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getFailSoftMergingStatus(
    morpho_EasyHDR *p,
    int *value);

/*-----------------------------------------------------------------*/

/**
 * ƒS[ƒXƒg”»’芴“xƒŒƒxƒ‹‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      value  Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setGhostDetectionSensitivityLevel(
    morpho_EasyHDR *p,
    int value);

/**
 * ƒS[ƒXƒg”»’芴“xƒŒƒxƒ‹‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     value  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getGhostDetectionSensitivityLevel(
    morpho_EasyHDR *p,
    int *value);

/*-----------------------------------------------------------------*/

/**
 * ‡¬‚È‚ß‚ç‚©‚³‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      value  Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setMergeSmoothnessLevel(
    morpho_EasyHDR *p,
    int value);

/**
 * ‡¬‚È‚ß‚ç‚©‚³‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p      EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     value  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getMergeSmoothnessLevel(
    morpho_EasyHDR *p,
    int *value);

/*-----------------------------------------------------------------*/

/**
 * ‡¬ƒpƒ‰ƒ[ƒ^‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p       EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      value1  Ý’è’l
 * @param[in]      value2  Ý’è’l
 * @param[in]      value3  Ý’è’l
 * @param[in]      value4  Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setMergeParameters(
    morpho_EasyHDR *p,
    int value1,
    int value2,
    int value3,
    int value4);

/**
 * ‡¬ƒpƒ‰ƒ[ƒ^‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p       EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     value1  Ý’è’lŠi”[æ
 * @param[out]     value2  Ý’è’lŠi”[æ
 * @param[out]     value3  Ý’è’lŠi”[æ
 * @param[out]     value4  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getMergeParameters(
    morpho_EasyHDR *p,
    int *value1,
    int *value2,
    int *value3,
    int *value4);

/*-----------------------------------------------------------------*/

/**
 * —LŒø—̈æ臒l‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p     EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      rate  Ý’è’l (’†‰› rate % ‹éŒ`)
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setReliableRectRateThreshold(
    morpho_EasyHDR *p,
    int rate);

/**
 * —LŒø—̈æ臒l‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p     EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     rate  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getReliableRectRateThreshold(
    morpho_EasyHDR *p,
    int *rate);

/**
 * —LŒø—̈æ‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 * (—LŒø‚È’l‚ªƒZƒbƒg‚³‚ê‚é‚Ì‚Í merge() Œã)
 *
 * @param[in,out]  p     EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     rect  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getReliableRect(
    morpho_EasyHDR *p,
    morpho_RectInt *rect);

/*-----------------------------------------------------------------*/

/**
 * ƒS[ƒXƒgŠ„‡è‡’l‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p     EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      rate  Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setGhostRateThreshold(
    morpho_EasyHDR *p,
    int rate);

/**
 * ƒS[ƒXƒgŠ„‡è‡’l‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p     EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     rate  Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getGhostRateThreshold(
    morpho_EasyHDR *p,
    int *rate);

/*-----------------------------------------------------------------*/

/**
 * F•â³ƒpƒ‰ƒ[ƒ^‚̐ݒè
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p         EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[in]      y_offset  Ý’è’l
 * @param[in]      y_gain    Ý’è’l
 * @param[in]      y_gamma   Ý’è’l
 * @param[in]      c_offset  Ý’è’l
 * @param[in]      c_gain    Ý’è’l
 * @param[in]      c_gamma   Ý’è’l
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_setColorCorrectionParameters(
    morpho_EasyHDR *p,
    int y_offset,
    int y_gain,
    int y_gamma,
    int c_offset,
    int c_gain,
    int c_gamma);

/**
 * F•â³ƒpƒ‰ƒ[ƒ^‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p         EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     y_offset  Ý’è’lŠi”[æ
 * @param[out]     y_gain    Ý’è’lŠi”[æ
 * @param[out]     y_gamma   Ý’è’lŠi”[æ
 * @param[out]     c_offset  Ý’è’lŠi”[æ
 * @param[out]     c_gain    Ý’è’lŠi”[æ
 * @param[out]     c_gamma   Ý’è’lŠi”[æ
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_getColorCorrectionParameters(
    morpho_EasyHDR *p,
    int *y_offset,
    int *y_gain,
    int *y_gamma,
    int *c_offset,
    int *c_gain,
    int *c_gamma);

/*-----------------------------------------------------------------*/

/**
 * ‡¬ƒXƒe[ƒ^ƒX‚̎擾
 * initialize() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * ƒXƒe[ƒ^ƒXƒR[ƒh
 *   MORPHO_EASY_HDR_OK
 *   MORPHO_EASY_HDR_ERROR_*
 *
 * @param[in,out]  p  EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 *
 * @return ƒXƒe[ƒ^ƒXƒR[ƒh (MORPHO_EASMORPHO_EASY_HDR_ERROR_
 */
MORPHO_API(int)
morpho_EasyHDR_getMergeStatus(
    morpho_EasyHDR *p);

/*-----------------------------------------------------------------*/

/**
 * ƒTƒ€ƒlƒCƒ‹‚̍쐬 (o—͉摜‚̏k¬)
 * morpho_EasyHDR_setImageFormat() ŽÀsŒã‚ÉŽÀs‰Â”\
 *
 * @param[in,out]  p                EasyHDR ƒCƒ“ƒXƒ^ƒ“ƒX
 * @param[out]     thumbnail_image  o—͉摜
 * @param[in]      output_image     “ü—͉摜
 *
 * @return ƒGƒ‰[ƒR[ƒh (see morpho_error.h)
 */
MORPHO_API(int)
morpho_EasyHDR_makeThumbnail(
    morpho_EasyHDR *p,
    morpho_ImageData *thumbnail_image,
    morpho_ImageData const *output_image);

/*-----------------------------------------------------------------*/

#ifdef __cplusplus
} /* extern "C" */
#endif

/*******************************************************************/

#endif /* !MORPHO_EASY_HDR_H */

/*******************************************************************/
/* [EOF] */