Go to the documentation of this file.
66 header->data_min = DBL_MAX;
67 header->data_max = -DBL_MAX;
69 #define CASE_N(a, t, rd) \
71 for (i = 0; i < header->naxisn[1]; i++) { \
72 for (j = 0; j < header->naxisn[0]; j++) { \
74 if (!header->blank_found || t != header->blank) { \
75 if (t > header->data_max) \
76 header->data_max = t; \
77 if (t < header->data_min) \
78 header->data_min = t; \
80 ptr8 += abs(a) >> 3; \
109 const uint8_t *ptr8 = *ptr;
110 int lines_read, bytes_left,
i,
ret;
125 bytes_left = (((lines_read + 35) / 36) * 36 - lines_read) * 80;
126 if (end - ptr8 < bytes_left)
154 if (end - ptr8 <
size)
187 const uint8_t *ptr8 = avpkt->
data, *end;
195 const int map[] = {2, 0, 1, 3};
202 end = ptr8 + avpkt->
size;
210 if (
header.naxisn[2] == 3) {
215 }
else if (
header.bitpix == 16) {
216 if (
header.naxisn[2] == 3) {
245 #define CASE_RGB(cas, dst, type, dref) \
247 for (k = 0; k < header.naxisn[2]; k++) { \
248 for (i = 0; i < avctx->height; i++) { \
249 dst = (type *) (p->data[map[k]] + (avctx->height - i - 1) * p->linesize[map[k]]); \
250 for (j = 0; j < avctx->width; j++) { \
252 if (!header.blank_found || t32 != header.blank) { \
253 t = t32 * header.bscale + header.bzero; \
255 t = fitsctx->blank_val; \
276 #define CASE_GRAY(cas, dst, type, t, rd) \
278 for (i = 0; i < avctx->height; i++) { \
279 dst = (type *) (p->data[0] + (avctx->height-i-1)* p->linesize[0]); \
280 for (j = 0; j < avctx->width; j++) { \
282 if (!header.blank_found || t != header.blank) { \
283 *dst++ = lrint(((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) * scale); \
285 *dst++ = fitsctx->blank_val; \
287 ptr8 += abs(cas) >> 3; \
294 CASE_GRAY(8, dst8, uint8_t, t8, ptr8[0]);
#define AV_PIX_FMT_GBRAP16
#define AV_LOG_WARNING
Something somehow does not look correct.
@ AV_CLASS_CATEGORY_DECODER
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
This structure describes decoded (raw) audio or video data.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
#define CASE_RGB(cas, dst, type, dref)
AVCodec p
The public AVCodec.
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
int avpriv_fits_header_parse_line(void *avcl, FITSHeader *header, const uint8_t line[80], AVDictionary ***metadata)
Parse a single header line.
#define AV_PIX_FMT_GRAY16
static int fits_read_header(AVCodecContext *avctx, const uint8_t **ptr, FITSHeader *header, const uint8_t *end, AVDictionary **metadata)
Read the fits header and store the values in FITSHeader pointed by header.
static int fill_data_min_max(const uint8_t *ptr8, FITSHeader *header, const uint8_t *end)
Calculate the data_min and data_max values from the data.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define CASE_GRAY(cas, dst, type, t, rd)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define AV_PIX_FMT_GBRP16
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
static const uint8_t header[24]
int avpriv_fits_header_init(FITSHeader *header, FITSHeaderState state)
Initialize a single header line.
#define i(width, name, range_min, range_max)
#define AV_OPT_FLAG_VIDEO_PARAM
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
main external API structure.
@ AV_OPT_TYPE_INT
Underlying C type is int.
AVDictionary * metadata
metadata.
static const AVClass fits_decoder_class
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
const FFCodec ff_fits_decoder
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
const VDPAUPixFmtMap * map
static void scale(int *out, const int *in, const int w, const int h, const int shift)
This structure stores compressed data.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int fits_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
static const AVOption fits_options[]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16