You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 vuotta sitten
3 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
3 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * This file is part of Aptdec.
  3. * Copyright (c) 2004-2009 Thierry Leconte (F4DWV), Xerbo (xerbo@protonmail.com) 2019-2022
  4. * Copyright (c) 2021 Jon Beniston (M7RCE)
  5. *
  6. * Aptdec is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. *
  19. */
  20. #ifndef APT_H
  21. #define APT_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #if defined(__GNUC__) && (__GNUC__ >= 4)
  26. #define APT_API __attribute__((visibility("default")))
  27. #elif defined(_MSC_VER)
  28. #ifdef APT_API_EXPORT
  29. #define APT_API __declspec(dllexport)
  30. #elif APT_API_STATIC
  31. #define APT_API
  32. #else if
  33. #define APT_API __declspec(dllimport)
  34. #endif
  35. #else
  36. #define APT_API
  37. #endif
  38. // Maximum height of an APT image in number of rows
  39. #define APT_MAX_HEIGHT 3000
  40. // Width in pixels of sync
  41. #define APT_SYNC_WIDTH 39
  42. // Width in pixels of space
  43. #define APT_SPC_WIDTH 47
  44. // Width in pixels of telemetry
  45. #define APT_TELE_WIDTH 45
  46. // Width in pixels of a single channel image
  47. #define APT_CH_WIDTH 909
  48. #define APT_FRAME_LEN 128
  49. #define APT_CH_OFFSET (APT_SYNC_WIDTH + APT_SPC_WIDTH + APT_CH_WIDTH + APT_TELE_WIDTH)
  50. // Width in pixels of full frame, including sync, space, images and telemetry
  51. #define APT_IMG_WIDTH 2080
  52. // Offset in pixels to channel A
  53. #define APT_CHA_OFFSET (APT_SYNC_WIDTH + APT_SPC_WIDTH)
  54. // Offset in pixels to channel B
  55. #define APT_CHB_OFFSET (APT_SYNC_WIDTH + APT_SPC_WIDTH + APT_CH_WIDTH + APT_TELE_WIDTH + APT_SYNC_WIDTH + APT_SPC_WIDTH)
  56. #define APT_TOTAL_TELE (APT_SYNC_WIDTH + APT_SPC_WIDTH + APT_TELE_WIDTH + APT_SYNC_WIDTH + APT_SPC_WIDTH + APT_TELE_WIDTH)
  57. // Number of rows required for apt_calibrate
  58. #define APT_CALIBRATION_ROWS 192
  59. // Channel ID returned by apt_calibrate
  60. // NOAA-15: https://nssdc.gsfc.nasa.gov/nmc/experiment/display.action?id=1998-030A-01
  61. // Channel 1: visible (0.58-0.68 um)
  62. // Channel 2: near-IR (0.725-1.0 um)
  63. // Channel 3A: near-IR (1.58-1.64 um)
  64. // Channel 3B: mid-infrared (3.55-3.93 um)
  65. // Channel 4: thermal-infrared (10.3-11.3 um)
  66. // Channel 5: thermal-infrared (11.5-12.5 um)
  67. typedef enum apt_channel {
  68. APT_CHANNEL_UNKNOWN,
  69. APT_CHANNEL_1,
  70. APT_CHANNEL_2,
  71. APT_CHANNEL_3A,
  72. APT_CHANNEL_4,
  73. APT_CHANNEL_5,
  74. APT_CHANNEL_3B
  75. } apt_channel_t;
  76. // Width in elements of apt_image_t.prow arrays
  77. #define APT_PROW_WIDTH 2150
  78. // apt_getpixelrow callback function to get audio samples.
  79. // context is the same as passed to apt_getpixelrow.
  80. typedef int (*apt_getsamples_t)(void *context, float *samples, int count);
  81. typedef struct {
  82. float *prow[APT_MAX_HEIGHT]; // Row buffers
  83. int nrow; // Number of rows
  84. int zenith; // Row in image where satellite reaches peak elevation
  85. apt_channel_t chA, chB; // ID of each channel
  86. char name[256]; // Stripped filename
  87. char *palette; // Filename of palette
  88. } apt_image_t;
  89. typedef struct {
  90. float r, g, b;
  91. } apt_rgb_t;
  92. int APT_API apt_init(double sample_rate);
  93. int APT_API apt_getpixelrow(float *pixelv, int nrow, int *zenith, int reset, apt_getsamples_t getsamples, void *context);
  94. void APT_API apt_histogramEqualise(float **prow, int nrow, int offset, int width);
  95. void APT_API apt_linearEnhance(float **prow, int nrow, int offset, int width);
  96. apt_channel_t APT_API apt_calibrate(float **prow, int nrow, int offset, int width);
  97. void APT_API apt_denoise(float **prow, int nrow, int offset, int width);
  98. void APT_API apt_flipImage(apt_image_t *img, int width, int offset);
  99. int APT_API apt_cropNoise(apt_image_t *img);
  100. void APT_API apt_calibrate_thermal(int satnum, apt_image_t *img, int offset, int width);
  101. void APT_API apt_calibrate_visible(int satnum, apt_image_t *img, int offset, int width);
  102. // Moved to apt_calibrate_thermal
  103. #define apt_temperature apt_calibrate_thermal
  104. apt_rgb_t APT_API apt_applyPalette(char *palette, int val);
  105. apt_rgb_t APT_API apt_RGBcomposite(apt_rgb_t top, float top_a, apt_rgb_t bottom, float bottom_a);
  106. extern char APT_API apt_TempPalette[256 * 3];
  107. extern char APT_API apt_PrecipPalette[58 * 3];
  108. #ifdef __cplusplus
  109. }
  110. #endif
  111. #endif