FFmpeg
Classes | Macros | Typedefs | Variables
fitsdec.c File Reference

FITS image decoder. More...

#include "avcodec.h"
#include "internal.h"
#include <float.h>
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
#include "fits.h"

Classes

struct  FITSContext
 

Macros

#define CASE_N(a, t, rd)
 
#define CASE_RGB(cas, dst, type, dref)
 
#define CASE_GRAY(cas, dst, type, t, rd)
 

Typedefs

typedef struct FITSContext FITSContext
 

Variables

AVCodec ff_fits_decoder
 

Detailed Description

FITS image decoder.

Specification: https://fits.gsfc.nasa.gov/fits_standard.html Version 3.0

Support all 2d images alongwith, bzero, bscale and blank keywords. RGBA images are supported as NAXIS3 = 3 or 4 i.e. Planes in RGBA order. Also CTYPE = 'RGB ' should be present. Also to interpret data, values are linearly scaled using min-max scaling but not RGB images.

Macro Definition Documentation

§ CASE_GRAY

#define CASE_GRAY (   cas,
  dst,
  type,
  t,
  rd 
)
Value:
case cas: \
for (i = 0; i < avctx->height; i++) { \
dst = (type *) (p->data[0] + (avctx->height-i-1)* p->linesize[0]); \
for (j = 0; j < avctx->width; j++) { \
t = rd; \
if (!header.blank_found || t != header.blank) { \
*dst++ = ((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) / (header.data_max - header.data_min); \
} else { \
*dst++ = fitsctx->blank_val; \
} \
ptr8 += abs(cas) >> 3; \
} \
} \
break

§ CASE_N

#define CASE_N (   a,
  t,
  rd 
)
Value:
case a: \
for (i = 0; i < header->naxisn[1]; i++) { \
for (j = 0; j < header->naxisn[0]; j++) { \
t = rd; \
if (!header->blank_found || t != header->blank) { \
if (t > header->data_max) \
header->data_max = t; \
if (t < header->data_min) \
header->data_min = t; \
} \
ptr8 += abs(a) >> 3; \
} \
} \
break

§ CASE_RGB

#define CASE_RGB (   cas,
  dst,
  type,
  dref 
)
Value:
case cas: \
for (k = 0; k < header.naxisn[2]; k++) { \
for (i = 0; i < avctx->height; i++) { \
dst = (type *) (p->data[map[k]] + (avctx->height - i - 1) * p->linesize[map[k]]); \
for (j = 0; j < avctx->width; j++) { \
t32 = dref(ptr8); \
if (!header.blank_found || t32 != header.blank) { \
t = t32 * header.bscale + header.bzero; \
} else { \
t = fitsctx->blank_val; \
} \
*dst++ = (type) t; \
ptr8 += cas >> 3; \
} \
} \
} \
break

Variable Documentation

§ ff_fits_decoder

AVCodec ff_fits_decoder
Initial value:
= {
.name = "fits",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_FITS,
.priv_data_size = sizeof(FITSContext),
.decode = fits_decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Flexible Image Transport System"),
.priv_class = &fits_decoder_class
}
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
Definition: fitsdec.c:42
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:959