Lines Matching refs:header

50  * This is called if the values are not present in the header.
52 * @param header pointer to the header
56 static int fill_data_min_max(const uint8_t *ptr8, FITSHeader *header, const uint8_t *end)
66 header->data_min = DBL_MAX;
67 header->data_max = -DBL_MAX;
68 switch (header->bitpix) {
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; \
98 * Read the fits header and store the values in FITSHeader pointed by header
101 * @param header pointer to the FITSHeader
106 static int fits_read_header(AVCodecContext *avctx, const uint8_t **ptr, FITSHeader *header,
113 lines_read = 1; // to account for first header line, SIMPLE or XTENSION which is not included in packet...
114 avpriv_fits_header_init(header, STATE_BITPIX);
118 ret = avpriv_fits_header_parse_line(avctx, header, ptr8, &metadata);
130 if (header->rgb && (header->naxis != 3 || (header->naxisn[2] != 3 && header->naxisn[2] != 4))) {
131 av_log(avctx, AV_LOG_ERROR, "File contains RGB image but NAXIS = %d and NAXIS3 = %d\n", header->naxis, header->naxisn[2]);
135 if (!header->rgb && header->naxis != 2) {
136 av_log(avctx, AV_LOG_ERROR, "unsupported number of dimensions, NAXIS = %d\n", header->naxis);
140 if (header->blank_found && (header->bitpix == -32 || header->bitpix == -64)) {
141 av_log(avctx, AV_LOG_WARNING, "BLANK keyword found but BITPIX = %d\n. Ignoring BLANK", header->bitpix);
142 header->blank_found = 0;
145 size = abs(header->bitpix) >> 3;
146 for (i = 0; i < header->naxis; i++) {
147 if (size == 0 || header->naxisn[i] > SIZE_MAX / size) {
151 size *= header->naxisn[i];
158 if (!header->rgb && (!header->data_min_found || !header->data_max_found)) {
159 ret = fill_data_min_max(ptr8, header, end);
161 av_log(avctx, AV_LOG_ERROR, "invalid BITPIX, %d\n", header->bitpix);
169 header->data_min = (header->data_min - header->bzero) / header->bscale;
170 header->data_max = (header->data_max - header->bzero) / header->bscale;
172 if (!header->rgb && header->data_min >= header->data_max) {
173 if (header->data_min > header->data_max) {
174 av_log(avctx, AV_LOG_ERROR, "data min/max (%g %g) is invalid\n", header->data_min, header->data_max);
178 header->data_max ++;
199 FITSHeader header;
204 ret = fits_read_header(avctx, &ptr8, &header, end, &p->metadata);
208 if (header.rgb) {
209 if (header.bitpix == 8) {
210 if (header.naxisn[2] == 3) {
215 } else if (header.bitpix == 16) {
216 if (header.naxisn[2] == 3) {
222 av_log(avctx, AV_LOG_ERROR, "unsupported BITPIX = %d\n", header.bitpix);
226 if (header.bitpix == 8) {
233 if ((ret = ff_set_dimensions(avctx, header.naxisn[0], header.naxisn[1])) < 0)
243 if (header.rgb) {
244 switch(header.bitpix) {
247 for (k = 0; k < header.naxisn[2]; k++) { \
252 if (!header.blank_found || t32 != header.blank) { \
253 t = t32 * header.bscale + header.bzero; \
268 double scale = header.data_max - header.data_min;
275 switch (header.bitpix) {
282 if (!header.blank_found || t != header.blank) { \
283 *dst++ = lrint(((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) * scale); \
299 av_log(avctx, AV_LOG_ERROR, "invalid BITPIX, %d\n", header.bitpix);