/*
 * this code is auto generated. do not edit. change the sources in tools/introspection/ instead.
 *
 * the parse tree:
 *
 * typedef
 *   struct dt_iop_demosaic_params_t
 *     enum dt_iop_demosaic_greeneq_t
 *       DT_IOP_GREEN_EQ_NO : disabled
 *       DT_IOP_GREEN_EQ_LOCAL : local average
 *       DT_IOP_GREEN_EQ_FULL : full average
 *       DT_IOP_GREEN_EQ_BOTH : full and local average
 *     green_eq 
 *       description: match greens
 *       default: DT_IOP_GREEN_EQ_NO
 * 
 *     float
 *     median_thrs 
 *       description: edge threshold
 *       default: 0.0
 *       range: 0.0 .. 1.0
 * 
 *     enum dt_iop_demosaic_smooth_t
 *       DEMOSAIC_SMOOTH_OFF : disabled
 *       DEMOSAIC_SMOOTH_1 : once
 *       DEMOSAIC_SMOOTH_2 : twice
 *       DEMOSAIC_SMOOTH_3 : three times
 *       DEMOSAIC_SMOOTH_4 : four times
 *       DEMOSAIC_SMOOTH_5 : five times
 *     color_smoothing 
 *       description: color smoothing
 *       default: DEMOSAIC_SMOOTH_OFF
 * 
 *     enum dt_iop_demosaic_method_t
 *       DT_IOP_DEMOSAIC_PPG : PPG
 *       DT_IOP_DEMOSAIC_AMAZE : AMaZE
 *       DT_IOP_DEMOSAIC_VNG4 : VNG4
 *       DT_IOP_DEMOSAIC_RCD : RCD
 *       DT_IOP_DEMOSAIC_LMMSE : LMMSE
 *       DT_IOP_DEMOSAIC_RCD_VNG : RCD + VNG4
 *       DT_IOP_DEMOSAIC_AMAZE_VNG : AMaZE + VNG4
 *       DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME : passthrough (monochrome)
 *       DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR : photosite color (debug)
 *       DT_IOP_DEMOSAIC_VNG : VNG
 *       DT_IOP_DEMOSAIC_MARKESTEIJN : Markesteijn 1-pass
 *       DT_IOP_DEMOSAIC_MARKESTEIJN_3 : Markesteijn 3-pass
 *       DT_IOP_DEMOSAIC_FDC : frequency domain chroma
 *       DT_IOP_DEMOSAIC_MARKEST3_VNG : Markesteijn 3-pass + VNG
 *       DT_IOP_DEMOSAIC_PASSTHR_MONOX : passthrough (monochrome)
 *       DT_IOP_DEMOSAIC_PASSTHR_COLORX : photosite color (debug)
 *     demosaicing_method 
 *       description: demosaicing method
 *       default: DT_IOP_DEMOSAIC_RCD
 * 
 *     enum dt_iop_demosaic_lmmse_t
 *       LMMSE_REFINE_0 : basic
 *       LMMSE_REFINE_1 : median
 *       LMMSE_REFINE_2 : 3x median
 *       LMMSE_REFINE_3 : refine & medians
 *       LMMSE_REFINE_4 : 2x refine + medians
 *     lmmse_refine 
 *       description: LMMSE refine
 *       default: LMMSE_REFINE_1
 * 
 *     float
 *     dual_thrs 
 *       description: dual threshold
 *       default: 0.20
 *       range: 0.0 .. 1.0
 * 
 * dt_iop_demosaic_params_t
 *
 */

#include "/build/darktable/src/darktable-4.0.0/src/iop/demosaic.c"

#ifdef __cplusplus
extern "C"
{
#endif

#include <string.h>
#include "common/introspection.h"

static dt_introspection_field_t introspection_linear[7+1]
#if !( defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406) )
= {
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_demosaic_greeneq_t", (char*)"green_eq", (char*)"green_eq", N_((char*)"match greens"), sizeof(((dt_iop_demosaic_params_t*)NULL)->green_eq), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, green_eq), NULL },
    /*entries*/ 4, /*values*/ NULL, /*Default*/ DT_IOP_GREEN_EQ_NO
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"median_thrs", (char*)"median_thrs", N_((char*)"edge threshold"), sizeof(((dt_iop_demosaic_params_t*)NULL)->median_thrs), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, median_thrs), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.0
  }
},
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_demosaic_smooth_t", (char*)"color_smoothing", (char*)"color_smoothing", N_((char*)"color smoothing"), sizeof(((dt_iop_demosaic_params_t*)NULL)->color_smoothing), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, color_smoothing), NULL },
    /*entries*/ 6, /*values*/ NULL, /*Default*/ DEMOSAIC_SMOOTH_OFF
  }
},
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_demosaic_method_t", (char*)"demosaicing_method", (char*)"demosaicing_method", N_((char*)"demosaicing method"), sizeof(((dt_iop_demosaic_params_t*)NULL)->demosaicing_method), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, demosaicing_method), NULL },
    /*entries*/ 16, /*values*/ NULL, /*Default*/ DT_IOP_DEMOSAIC_RCD
  }
},
{
  .Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_demosaic_lmmse_t", (char*)"lmmse_refine", (char*)"lmmse_refine", N_((char*)"LMMSE refine"), sizeof(((dt_iop_demosaic_params_t*)NULL)->lmmse_refine), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, lmmse_refine), NULL },
    /*entries*/ 5, /*values*/ NULL, /*Default*/ LMMSE_REFINE_1
  }
},
{
  .Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"dual_thrs", (char*)"dual_thrs", N_((char*)"dual threshold"), sizeof(((dt_iop_demosaic_params_t*)NULL)->dual_thrs), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, dual_thrs), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.20
  }
},
{
  .Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_demosaic_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_demosaic_params_t), 0, NULL },
    /*entries*/ 6, /*fields*/ NULL
  }
},
  { .header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL} }
}
#endif
;

static dt_introspection_t introspection = {
  8,
  4,
  "dt_iop_demosaic_params_t",
  sizeof(dt_iop_demosaic_params_t),
  &introspection_linear[7-1],
  sizeof(dt_iop_module_t),
  G_STRUCT_OFFSET(dt_iop_module_t, default_params)
};

dt_introspection_field_t* get_introspection_linear()
{
  return introspection_linear;
}

dt_introspection_t* get_introspection()
{
  return &introspection;
}

int introspection_init(struct dt_iop_module_so_t *self, int api_version)
{
  // here we check that the generated code matches the api at compile time and also at runtime
  if(introspection.api_version != DT_INTROSPECTION_VERSION || api_version != DT_INTROSPECTION_VERSION)
    return 1;

#if defined(__cplusplus) && !defined(__clang__) && defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) <= 406)
  introspection_linear[0].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_demosaic_greeneq_t", (char*)"green_eq", (char*)"green_eq", N_((char*)"match greens"), sizeof(((dt_iop_demosaic_params_t*)NULL)->green_eq), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, green_eq), NULL },
    /*entries*/ 4, /*values*/ NULL, /*Default*/ DT_IOP_GREEN_EQ_NO
  };
  introspection_linear[1].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"median_thrs", (char*)"median_thrs", N_((char*)"edge threshold"), sizeof(((dt_iop_demosaic_params_t*)NULL)->median_thrs), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, median_thrs), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.0
  };
  introspection_linear[2].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_demosaic_smooth_t", (char*)"color_smoothing", (char*)"color_smoothing", N_((char*)"color smoothing"), sizeof(((dt_iop_demosaic_params_t*)NULL)->color_smoothing), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, color_smoothing), NULL },
    /*entries*/ 6, /*values*/ NULL, /*Default*/ DEMOSAIC_SMOOTH_OFF
  };
  introspection_linear[3].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_demosaic_method_t", (char*)"demosaicing_method", (char*)"demosaicing_method", N_((char*)"demosaicing method"), sizeof(((dt_iop_demosaic_params_t*)NULL)->demosaicing_method), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, demosaicing_method), NULL },
    /*entries*/ 16, /*values*/ NULL, /*Default*/ DT_IOP_DEMOSAIC_RCD
  };
  introspection_linear[4].Enum = {
    { DT_INTROSPECTION_TYPE_ENUM, (char*)"dt_iop_demosaic_lmmse_t", (char*)"lmmse_refine", (char*)"lmmse_refine", N_((char*)"LMMSE refine"), sizeof(((dt_iop_demosaic_params_t*)NULL)->lmmse_refine), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, lmmse_refine), NULL },
    /*entries*/ 5, /*values*/ NULL, /*Default*/ LMMSE_REFINE_1
  };
  introspection_linear[5].Float = {
    { DT_INTROSPECTION_TYPE_FLOAT, (char*)"float", (char*)"dual_thrs", (char*)"dual_thrs", N_((char*)"dual threshold"), sizeof(((dt_iop_demosaic_params_t*)NULL)->dual_thrs), G_STRUCT_OFFSET(dt_iop_demosaic_params_t, dual_thrs), NULL },
    /*Min*/ 0.0, /*Max*/ 1.0, /*Default*/ 0.20
  };
  introspection_linear[6].Struct = {
    { DT_INTROSPECTION_TYPE_STRUCT, (char*)"dt_iop_demosaic_params_t", (char*)"", (char*)"", (char*)"", sizeof(dt_iop_demosaic_params_t), 0, NULL },
    /*entries*/ 6, /*fields*/ NULL
  };
  introspection_linear[7].header = {DT_INTROSPECTION_TYPE_NONE, NULL, NULL, NULL, NULL, 0, 0, NULL};
#endif

  for(int i = 0; i <= 7; i++)
    introspection_linear[i].header.so = self;

  static dt_introspection_type_enum_tuple_t f0[] = { 
    { "DT_IOP_GREEN_EQ_NO", DT_IOP_GREEN_EQ_NO, N_((char*)"disabled") },
    { "DT_IOP_GREEN_EQ_LOCAL", DT_IOP_GREEN_EQ_LOCAL, N_((char*)"local average") },
    { "DT_IOP_GREEN_EQ_FULL", DT_IOP_GREEN_EQ_FULL, N_((char*)"full average") },
    { "DT_IOP_GREEN_EQ_BOTH", DT_IOP_GREEN_EQ_BOTH, N_((char*)"full and local average") },
    { NULL, 0 },
  };
  static dt_introspection_type_enum_tuple_t f2[] = { 
    { "DEMOSAIC_SMOOTH_OFF", DEMOSAIC_SMOOTH_OFF, N_((char*)"disabled") },
    { "DEMOSAIC_SMOOTH_1", DEMOSAIC_SMOOTH_1, N_((char*)"once") },
    { "DEMOSAIC_SMOOTH_2", DEMOSAIC_SMOOTH_2, N_((char*)"twice") },
    { "DEMOSAIC_SMOOTH_3", DEMOSAIC_SMOOTH_3, N_((char*)"three times") },
    { "DEMOSAIC_SMOOTH_4", DEMOSAIC_SMOOTH_4, N_((char*)"four times") },
    { "DEMOSAIC_SMOOTH_5", DEMOSAIC_SMOOTH_5, N_((char*)"five times") },
    { NULL, 0 },
  };
  static dt_introspection_type_enum_tuple_t f3[] = { 
    { "DT_IOP_DEMOSAIC_PPG", DT_IOP_DEMOSAIC_PPG, N_((char*)"PPG") },
    { "DT_IOP_DEMOSAIC_AMAZE", DT_IOP_DEMOSAIC_AMAZE, N_((char*)"AMaZE") },
    { "DT_IOP_DEMOSAIC_VNG4", DT_IOP_DEMOSAIC_VNG4, N_((char*)"VNG4") },
    { "DT_IOP_DEMOSAIC_RCD", DT_IOP_DEMOSAIC_RCD, N_((char*)"RCD") },
    { "DT_IOP_DEMOSAIC_LMMSE", DT_IOP_DEMOSAIC_LMMSE, N_((char*)"LMMSE") },
    { "DT_IOP_DEMOSAIC_RCD_VNG", DT_IOP_DEMOSAIC_RCD_VNG, N_((char*)"RCD + VNG4") },
    { "DT_IOP_DEMOSAIC_AMAZE_VNG", DT_IOP_DEMOSAIC_AMAZE_VNG, N_((char*)"AMaZE + VNG4") },
    { "DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME", DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME, N_((char*)"passthrough (monochrome)") },
    { "DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR", DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR, N_((char*)"photosite color (debug)") },
    { "DT_IOP_DEMOSAIC_VNG", DT_IOP_DEMOSAIC_VNG, N_((char*)"VNG") },
    { "DT_IOP_DEMOSAIC_MARKESTEIJN", DT_IOP_DEMOSAIC_MARKESTEIJN, N_((char*)"Markesteijn 1-pass") },
    { "DT_IOP_DEMOSAIC_MARKESTEIJN_3", DT_IOP_DEMOSAIC_MARKESTEIJN_3, N_((char*)"Markesteijn 3-pass") },
    { "DT_IOP_DEMOSAIC_FDC", DT_IOP_DEMOSAIC_FDC, N_((char*)"frequency domain chroma") },
    { "DT_IOP_DEMOSAIC_MARKEST3_VNG", DT_IOP_DEMOSAIC_MARKEST3_VNG, N_((char*)"Markesteijn 3-pass + VNG") },
    { "DT_IOP_DEMOSAIC_PASSTHR_MONOX", DT_IOP_DEMOSAIC_PASSTHR_MONOX, N_((char*)"passthrough (monochrome)") },
    { "DT_IOP_DEMOSAIC_PASSTHR_COLORX", DT_IOP_DEMOSAIC_PASSTHR_COLORX, N_((char*)"photosite color (debug)") },
    { NULL, 0 },
  };
  static dt_introspection_type_enum_tuple_t f4[] = { 
    { "LMMSE_REFINE_0", LMMSE_REFINE_0, N_((char*)"basic") },
    { "LMMSE_REFINE_1", LMMSE_REFINE_1, N_((char*)"median") },
    { "LMMSE_REFINE_2", LMMSE_REFINE_2, N_((char*)"3x median") },
    { "LMMSE_REFINE_3", LMMSE_REFINE_3, N_((char*)"refine & medians") },
    { "LMMSE_REFINE_4", LMMSE_REFINE_4, N_((char*)"2x refine + medians") },
    { NULL, 0 },
  };
  static dt_introspection_field_t *f6[] = {
    &introspection_linear[0],
    &introspection_linear[1],
    &introspection_linear[2],
    &introspection_linear[3],
    &introspection_linear[4],
    &introspection_linear[5],
    NULL
  };

  introspection_linear[0].Enum.values = f0;
  introspection_linear[2].Enum.values = f2;
  introspection_linear[3].Enum.values = f3;
  introspection_linear[4].Enum.values = f4;
  introspection_linear[6].Struct.fields = f6;

  return 0;
}

void * get_p(const void * param, const char * name)
{
  dt_iop_demosaic_params_t * p = (dt_iop_demosaic_params_t*)param;
  if(!strcmp(name, "green_eq"))
    return &(p->green_eq);
  else if(!strcmp(name, "median_thrs"))
    return &(p->median_thrs);
  else if(!strcmp(name, "color_smoothing"))
    return &(p->color_smoothing);
  else if(!strcmp(name, "demosaicing_method"))
    return &(p->demosaicing_method);
  else if(!strcmp(name, "lmmse_refine"))
    return &(p->lmmse_refine);
  else if(!strcmp(name, "dual_thrs"))
    return &(p->dual_thrs);
  else
    return NULL;
}

dt_introspection_field_t * get_f(const char * name)
{
  if(!strcmp(name, "green_eq"))
    return &(introspection_linear[0]);
  else if(!strcmp(name, "median_thrs"))
    return &(introspection_linear[1]);
  else if(!strcmp(name, "color_smoothing"))
    return &(introspection_linear[2]);
  else if(!strcmp(name, "demosaicing_method"))
    return &(introspection_linear[3]);
  else if(!strcmp(name, "lmmse_refine"))
    return &(introspection_linear[4]);
  else if(!strcmp(name, "dual_thrs"))
    return &(introspection_linear[5]);
  else
    return NULL;
}

#ifdef __cplusplus
}
#endif

