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.

80 lines
2.2KB

  1. /*
  2. * FITS image format common prototypes and structures
  3. * Copyright (c) 2017 Paras Chadha
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #ifndef AVCODEC_FITS_H
  22. #define AVCODEC_FITS_H
  23. typedef enum FITSHeaderState {
  24. STATE_SIMPLE,
  25. STATE_XTENSION,
  26. STATE_BITPIX,
  27. STATE_NAXIS,
  28. STATE_NAXIS_N,
  29. STATE_PCOUNT,
  30. STATE_GCOUNT,
  31. STATE_REST,
  32. } FITSHeaderState;
  33. /**
  34. * Structure to store the header keywords in FITS file
  35. */
  36. typedef struct FITSHeader {
  37. FITSHeaderState state;
  38. unsigned naxis_index;
  39. int bitpix;
  40. int64_t blank;
  41. int blank_found;
  42. int naxis;
  43. int naxisn[999];
  44. int pcount;
  45. int gcount;
  46. int groups;
  47. int rgb; /**< 1 if file contains RGB image, 0 otherwise */
  48. int image_extension;
  49. double bscale;
  50. double bzero;
  51. int data_min_found;
  52. double data_min;
  53. int data_max_found;
  54. double data_max;
  55. } FITSHeader;
  56. /**
  57. * Initialize a single header line
  58. * @param header pointer to the header
  59. * @param state current state of parsing the header
  60. * @return 0 if successful otherwise AVERROR_INVALIDDATA
  61. */
  62. int avpriv_fits_header_init(FITSHeader *header, FITSHeaderState state);
  63. /**
  64. * Parse a single header line
  65. * @param avcl used in av_log
  66. * @param header pointer to the header
  67. * @param line one header line
  68. * @param metadata used to store metadata while decoding
  69. * @return 0 if successful otherwise AVERROR_INVALIDDATA
  70. */
  71. int avpriv_fits_header_parse_line(void *avcl, FITSHeader *header, const uint8_t line[80], AVDictionary ***metadata);
  72. #endif /* AVCODEC_FITS_H */