From 7dca191b14d7660545e8c37f3c0228362ccda130 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Fri, 31 Jan 2020 20:13:11 +0200 Subject: [PATCH] genesys: Merge chip-specific motor tables into one --- backend/genesys/gl124.cpp | 2 +- backend/genesys/gl843.cpp | 2 +- backend/genesys/gl846.cpp | 2 +- backend/genesys/gl847.cpp | 2 +- backend/genesys/low.h | 5 +- backend/genesys/tables_motor_profile.cpp | 132 +++++++++-------------- 6 files changed, 58 insertions(+), 87 deletions(-) diff --git a/backend/genesys/gl124.cpp b/backend/genesys/gl124.cpp index 27be0bd34..1de4e0572 100644 --- a/backend/genesys/gl124.cpp +++ b/backend/genesys/gl124.cpp @@ -856,7 +856,7 @@ void CommandSetGl124::init_regs_for_scan_session(Genesys_Device* dev, const Gene } else { exposure_time = sensor.exposure_lperiod; } - const auto& motor_profile = sanei_genesys_get_motor_profile(*gl124_motor_profiles, + const auto& motor_profile = sanei_genesys_get_motor_profile(*s_motor_profiles, dev->model->motor_id, exposure_time); diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index a70a81926..7e1890b56 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -1170,7 +1170,7 @@ void CommandSetGl843::init_regs_for_scan_session(Genesys_Device* dev, const Gene if (exposure < 0) { throw std::runtime_error("Exposure not defined in sensor definition"); } - const auto& motor_profile = sanei_genesys_get_motor_profile(*gl843_motor_profiles, + const auto& motor_profile = sanei_genesys_get_motor_profile(*s_motor_profiles, dev->model->motor_id, exposure); diff --git a/backend/genesys/gl846.cpp b/backend/genesys/gl846.cpp index ee9311c0d..e533c68a9 100644 --- a/backend/genesys/gl846.cpp +++ b/backend/genesys/gl846.cpp @@ -705,7 +705,7 @@ void CommandSetGl846::init_regs_for_scan_session(Genesys_Device* dev, const Gene slope_dpi = slope_dpi * (1 + dummy); exposure_time = sensor.exposure_lperiod; - const auto& motor_profile = sanei_genesys_get_motor_profile(*gl846_motor_profiles, + const auto& motor_profile = sanei_genesys_get_motor_profile(*s_motor_profiles, dev->model->motor_id, exposure_time); diff --git a/backend/genesys/gl847.cpp b/backend/genesys/gl847.cpp index 488c5183e..e2eba4495 100644 --- a/backend/genesys/gl847.cpp +++ b/backend/genesys/gl847.cpp @@ -712,7 +712,7 @@ void CommandSetGl847::init_regs_for_scan_session(Genesys_Device* dev, const Gene slope_dpi = slope_dpi * (1 + dummy); exposure_time = sensor.exposure_lperiod; - const auto& motor_profile = sanei_genesys_get_motor_profile(*gl847_motor_profiles, + const auto& motor_profile = sanei_genesys_get_motor_profile(*s_motor_profiles, dev->model->motor_id, exposure_time); diff --git a/backend/genesys/low.h b/backend/genesys/low.h index d7f5dd2d7..8ad17d770 100644 --- a/backend/genesys/low.h +++ b/backend/genesys/low.h @@ -226,10 +226,7 @@ struct Motor_Profile MotorSlope slope; }; -extern StaticInit> gl843_motor_profiles; -extern StaticInit> gl846_motor_profiles; -extern StaticInit> gl847_motor_profiles; -extern StaticInit> gl124_motor_profiles; +extern StaticInit> s_motor_profiles; /*--------------------------------------------------------------------------*/ /* common functions needed by low level specific functions */ diff --git a/backend/genesys/tables_motor_profile.cpp b/backend/genesys/tables_motor_profile.cpp index ef13112b3..7a6d29f80 100644 --- a/backend/genesys/tables_motor_profile.cpp +++ b/backend/genesys/tables_motor_profile.cpp @@ -47,67 +47,69 @@ namespace genesys { -StaticInit> gl843_motor_profiles; +StaticInit> s_motor_profiles; -void genesys_init_motor_profile_tables_gl843() +void genesys_init_motor_profile_tables() { - gl843_motor_profiles.init(); + s_motor_profiles.init(); + + // gl843 auto profile = Motor_Profile(); profile.motor_id = MotorId::KVSS080; profile.exposure = 8000; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(44444, 500, 489); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::G4050; profile.exposure = 8016; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(7842, 320, 602); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::G4050; profile.exposure = 15624; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(9422, 254, 1004); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::G4050; profile.exposure = 42752; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(42752, 1706, 610); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::G4050; profile.exposure = 56064; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(28032, 2238, 604); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_4400F; profile.exposure = 11640; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(49152, 484, 1014); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_8400F; profile.exposure = 50000; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(8743, 300, 794); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); // BUG: this is a fallback slope that was selected previously profile.motor_id = MotorId::CANON_8600F; profile.exposure = 0; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(44444, 500, 489); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_8600F; @@ -115,273 +117,245 @@ void genesys_init_motor_profile_tables_gl843() profile.step_type = StepType::QUARTER; // FIXME: if the exposure is lower then we'll select another motor profile.slope = MotorSlope::create_from_steps(54612, 1500, 219); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::PLUSTEK_OPTICFILM_7200I; profile.exposure = 0; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(39682, 1191, 15); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::PLUSTEK_OPTICFILM_7300; profile.exposure = 0x2f44; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(31250, 1512, 6); - gl843_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::PLUSTEK_OPTICFILM_7500I; profile.exposure = 0; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(31250, 1375, 7); - gl843_motor_profiles->push_back(profile); -} + s_motor_profiles->push_back(profile); -StaticInit> gl846_motor_profiles; + // gl846 -void genesys_init_motor_profile_tables_gl846() -{ - gl846_motor_profiles.init(); - - auto profile = Motor_Profile(); + profile = Motor_Profile(); profile.motor_id = MotorId::IMG101; profile.exposure = 11000; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(22000, 1000, 1017); - - gl846_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::PLUSTEK_OPTICBOOK_3800; profile.exposure = 11000; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(22000, 1000, 1017); - gl846_motor_profiles->push_back(profile); -} + s_motor_profiles->push_back(profile); -/** - * database of motor profiles - */ + // gl847 -StaticInit> gl847_motor_profiles; - -void genesys_init_motor_profile_tables_gl847() -{ - gl847_motor_profiles.init(); - - auto profile = Motor_Profile(); + profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_100; profile.exposure = 2848; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 534, 255); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_100; profile.exposure = 1424; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 534, 255); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_100; profile.exposure = 1432; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 534, 255); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_100; profile.exposure = 2712; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(46876, 534, 279); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_100; profile.exposure = 5280; profile.step_type = StepType::EIGHTH; profile.slope = MotorSlope::create_from_steps(31680, 534, 247); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_200; profile.exposure = 2848; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 534, 255); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_200; profile.exposure = 1424; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 534, 255); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_200; profile.exposure = 1432; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 534, 255); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_200; profile.exposure = 2712; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(46876, 534, 279); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_200; profile.exposure = 5280; profile.step_type = StepType::EIGHTH; profile.slope = MotorSlope::create_from_steps(31680, 534, 247); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_200; profile.exposure = 10416; profile.step_type = StepType::EIGHTH; profile.slope = MotorSlope::create_from_steps(31680, 534, 247); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_700; profile.exposure = 2848; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 534, 255); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_700; profile.exposure = 1424; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 534, 255); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_700; profile.exposure = 1504; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 534, 255); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_700; profile.exposure = 2696; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(46876, 2022, 127); - gl847_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_700; profile.exposure = 10576; profile.step_type = StepType::EIGHTH; profile.slope = MotorSlope::create_from_steps(46876, 15864, 2); - gl847_motor_profiles->push_back(profile); -} + s_motor_profiles->push_back(profile); -StaticInit> gl124_motor_profiles; - -void genesys_init_motor_profile_tables_gl124() -{ - gl124_motor_profiles.init(); + // gl124 // NEXT LPERIOD=PREVIOUS*2-192 - Motor_Profile profile; + profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_110; profile.exposure = 2768; profile.step_type = StepType::FULL; profile.slope = MotorSlope::create_from_steps(62496, 335, 255); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_110; profile.exposure = 5360; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(62496, 335, 469); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_110; profile.exposure = 10528; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(62496, 2632, 3); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_110; profile.exposure = 20864; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(62496, 10432, 3); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_120; profile.exposure = 4608; profile.step_type = StepType::FULL; profile.slope = MotorSlope::create_from_steps(62496, 864, 127); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_120; profile.exposure = 5360; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(62496, 2010, 63); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_120; profile.exposure = 10528; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(62464, 2632, 3); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_120; profile.exposure = 20864; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(62592, 10432, 5); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_210; profile.exposure = 2768; profile.step_type = StepType::FULL; profile.slope = MotorSlope::create_from_steps(62496, 335, 255); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_210; profile.exposure = 5360; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(62496, 335, 469); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_210; profile.exposure = 10528; profile.step_type = StepType::HALF; profile.slope = MotorSlope::create_from_steps(62496, 2632, 3); - gl124_motor_profiles->push_back(profile); + s_motor_profiles->push_back(profile); profile = Motor_Profile(); profile.motor_id = MotorId::CANON_LIDE_210; profile.exposure = 20864; profile.step_type = StepType::QUARTER; profile.slope = MotorSlope::create_from_steps(62496, 10432, 4); - gl124_motor_profiles->push_back(profile); -} - -void genesys_init_motor_profile_tables() -{ - genesys_init_motor_profile_tables_gl843(); - genesys_init_motor_profile_tables_gl846(); - genesys_init_motor_profile_tables_gl847(); - genesys_init_motor_profile_tables_gl124(); + s_motor_profiles->push_back(profile); } } // namespace genesys