summaryrefslogtreecommitdiff
path: root/libavcodec/fits.h
diff options
context:
space:
mode:
authorParas Chadha <paraschadha18@gmail.com>2017-08-29 22:46:44 +0530
committerPaul B Mahol <onemda@gmail.com>2017-08-30 12:13:01 +0200
commit61e4db4bb730409798dff8d87d83459cb888786e (patch)
treeb4a6f7ffadd4f3ece2176f42cc952b7e9106a972 /libavcodec/fits.h
parent7fbc0825773eb597c5a3f5679a8d58ced0d9456f (diff)
Add FITS Decoder
Signed-off-by: Paras Chadha <paraschadha18@gmail.com>
Diffstat (limited to 'libavcodec/fits.h')
-rw-r--r--libavcodec/fits.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/libavcodec/fits.h b/libavcodec/fits.h
new file mode 100644
index 0000000000..2cf9e7c131
--- /dev/null
+++ b/libavcodec/fits.h
@@ -0,0 +1,79 @@
+/*
+ * FITS image format common prototypes and structures
+ * Copyright (c) 2017 Paras Chadha
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_FITS_H
+#define AVCODEC_FITS_H
+
+typedef enum FITSHeaderState {
+ STATE_SIMPLE,
+ STATE_XTENSION,
+ STATE_BITPIX,
+ STATE_NAXIS,
+ STATE_NAXIS_N,
+ STATE_PCOUNT,
+ STATE_GCOUNT,
+ STATE_REST,
+} FITSHeaderState;
+
+/**
+ * Structure to store the header keywords in FITS file
+ */
+typedef struct FITSHeader {
+ FITSHeaderState state;
+ unsigned naxis_index;
+ int bitpix;
+ int64_t blank;
+ int blank_found;
+ int naxis;
+ int naxisn[999];
+ int pcount;
+ int gcount;
+ int groups;
+ int rgb; /**< 1 if file contains RGB image, 0 otherwise */
+ int image_extension;
+ double bscale;
+ double bzero;
+ int data_min_found;
+ double data_min;
+ int data_max_found;
+ double data_max;
+} FITSHeader;
+
+
+/**
+ * Initialize a single header line
+ * @param header pointer to the header
+ * @param state current state of parsing the header
+ * @return 0 if successful otherwise AVERROR_INVALIDDATA
+ */
+int avpriv_fits_header_init(FITSHeader *header, FITSHeaderState state);
+
+/**
+ * Parse a single header line
+ * @param avcl used in av_log
+ * @param header pointer to the header
+ * @param line one header line
+ * @param metadata used to store metadata while decoding
+ * @return 0 if successful otherwise AVERROR_INVALIDDATA
+ */
+int avpriv_fits_header_parse_line(void *avcl, FITSHeader *header, const uint8_t line[80], AVDictionary ***metadata);
+
+#endif /* AVCODEC_FITS_H */