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; \ 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)
129 if (header->
rgb && (header->
naxis != 3 || (header->
naxisn[2] != 3 && header->
naxisn[2] != 4))) {
134 if (!header->
rgb && header->
naxis != 2) {
144 size = abs(header->
bitpix) >> 3;
145 for (i = 0; i < header->
naxis; i++) {
146 if (header->
naxisn[i] > SIZE_MAX / size) {
150 size *= header->
naxisn[i];
153 if (end - ptr8 < size)
186 const int map[] = {2, 0, 1, 3};
201 if (header.
naxisn[2] == 3) {
206 }
else if (header.
bitpix == 16) {
207 if (header.
naxisn[2] == 3) {
236 #define CASE_RGB(cas, dst, type, dref) \ 238 for (k = 0; k < header.naxisn[2]; k++) { \ 239 for (i = 0; i < avctx->height; i++) { \ 240 dst = (type *) (p->data[map[k]] + (avctx->height - i - 1) * p->linesize[map[k]]); \ 241 for (j = 0; j < avctx->width; j++) { \ 243 if (!header.blank_found || t32 != header.blank) { \ 244 t = t32 * header.bscale + header.bzero; \ 246 t = fitsctx->blank_val; \ 260 #define CASE_GRAY(cas, dst, type, t, rd) \ 262 for (i = 0; i < avctx->height; i++) { \ 263 dst = (type *) (p->data[0] + (avctx->height-i-1)* p->linesize[0]); \ 264 for (j = 0; j < avctx->width; j++) { \ 266 if (!header.blank_found || t != header.blank) { \ 267 *dst++ = ((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) / (header.data_max - header.data_min); \ 269 *dst++ = fitsctx->blank_val; \ 271 ptr8 += abs(cas) >> 3; \ 316 .priv_class = &fits_decoder_class
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
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.
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
const char * av_default_item_name(void *ptr)
Return the context name.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
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 void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define CASE_GRAY(cas, dst, type, t, rd)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
#define CASE_RGB(cas, dst, type, dref)
static av_cold int end(AVCodecContext *avctx)
AVDictionary * metadata
metadata.
static const uint8_t header[24]
static int fits_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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 NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
#define AV_PIX_FMT_GBRAP16
int avpriv_fits_header_init(FITSHeader *header, FITSHeaderState state)
Initialize a single header line.
enum AVPictureType pict_type
Picture type of the frame.
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GRAY16
Libavcodec external API header.
int avpriv_fits_header_parse_line(void *avcl, FITSHeader *header, const uint8_t line[80], AVDictionary ***metadata)
Parse a single header line.
#define AV_OPT_FLAG_VIDEO_PARAM
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Describe the class of an AVClass context structure.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
const VDPAUPixFmtMap * map
common internal api header.
static const AVClass fits_decoder_class
planar GBRA 4:4:4:4 32bpp
int key_frame
1 -> keyframe, 0-> not
static const AVOption fits_options[]
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.