Go to the documentation of this file.
65 header->data_min = DBL_MAX;
66 header->data_max = -DBL_MAX;
68 #define CASE_N(a, t, rd) \
70 for (i = 0; i < header->naxisn[1]; i++) { \
71 for (j = 0; j < header->naxisn[0]; j++) { \
73 if (!header->blank_found || t != header->blank) { \
74 if (t > header->data_max) \
75 header->data_max = t; \
76 if (t < header->data_min) \
77 header->data_min = t; \
79 ptr8 += abs(a) >> 3; \
108 const uint8_t *ptr8 = *ptr;
109 int lines_read, bytes_left,
i,
ret;
124 bytes_left = (((lines_read + 35) / 36) * 36 - lines_read) * 80;
125 if (end - ptr8 < bytes_left)
153 if (end - ptr8 <
size)
186 const uint8_t *ptr8 = avpkt->
data, *end;
194 const int map[] = {2, 0, 1, 3};
201 end = ptr8 + avpkt->
size;
209 if (
header.naxisn[2] == 3) {
214 }
else if (
header.bitpix == 16) {
215 if (
header.naxisn[2] == 3) {
244 #define CASE_RGB(cas, dst, type, dref) \
246 for (k = 0; k < header.naxisn[2]; k++) { \
247 for (i = 0; i < avctx->height; i++) { \
248 dst = (type *) (p->data[map[k]] + (avctx->height - i - 1) * p->linesize[map[k]]); \
249 for (j = 0; j < avctx->width; j++) { \
251 if (!header.blank_found || t32 != header.blank) { \
252 t = t32 * header.bscale + header.bzero; \
254 t = fitsctx->blank_val; \
275 #define CASE_GRAY(cas, dst, type, t, rd) \
277 for (i = 0; i < avctx->height; i++) { \
278 dst = (type *) (p->data[0] + (avctx->height-i-1)* p->linesize[0]); \
279 for (j = 0; j < avctx->width; j++) { \
281 if (!header.blank_found || t != header.blank) { \
282 *dst++ = lrint(((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) * scale); \
284 *dst++ = fitsctx->blank_val; \
286 ptr8 += abs(cas) >> 3; \
#define AV_PIX_FMT_GBRAP16
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_OPT_FLAG_VIDEO_PARAM
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.
#define CASE_RGB(cas, dst, type, dref)
static int fits_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
@ 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.
int key_frame
1 -> keyframe, 0-> not
static av_always_inline float scale(float x, float s)
#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)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#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_PICTURE_TYPE_I
Intra.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
enum AVPictureType pict_type
Picture type of the frame.
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.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
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...
const AVCodec ff_fits_decoder
main external API structure.
AVDictionary * metadata
metadata.
static const AVClass fits_decoder_class
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
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.
const VDPAUPixFmtMap * map
This structure stores compressed data.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
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