Lines Matching refs:header
55 static int fill_data_min_max(const uint8_t *ptr8, FITSHeader *header, const uint8_t *end) in fill_data_min_max() argument
65 header->data_min = DBL_MAX; in fill_data_min_max()
66 header->data_max = -DBL_MAX; in fill_data_min_max()
67 switch (header->bitpix) { in fill_data_min_max()
70 for (i = 0; i < header->naxisn[1]; i++) { \ in fill_data_min_max()
71 for (j = 0; j < header->naxisn[0]; j++) { \ in fill_data_min_max()
73 if (!header->blank_found || t != header->blank) { \ in fill_data_min_max()
74 if (t > header->data_max) \ in fill_data_min_max()
75 header->data_max = t; \ in fill_data_min_max()
76 if (t < header->data_min) \ in fill_data_min_max()
77 header->data_min = t; \ in fill_data_min_max()
105 static int fits_read_header(AVCodecContext *avctx, const uint8_t **ptr, FITSHeader *header, in fits_read_header() argument
113 avpriv_fits_header_init(header, STATE_BITPIX); in fits_read_header()
117 ret = avpriv_fits_header_parse_line(avctx, header, ptr8, &metadata); in fits_read_header()
129 if (header->rgb && (header->naxis != 3 || (header->naxisn[2] != 3 && header->naxisn[2] != 4))) { in fits_read_header()
130 …RROR, "File contains RGB image but NAXIS = %d and NAXIS3 = %d\n", header->naxis, header->naxisn[2]… in fits_read_header()
134 if (!header->rgb && header->naxis != 2) { in fits_read_header()
135 … av_log(avctx, AV_LOG_ERROR, "unsupported number of dimensions, NAXIS = %d\n", header->naxis); in fits_read_header()
139 if (header->blank_found && (header->bitpix == -32 || header->bitpix == -64)) { in fits_read_header()
140 …og(avctx, AV_LOG_WARNING, "BLANK keyword found but BITPIX = %d\n. Ignoring BLANK", header->bitpix); in fits_read_header()
141 header->blank_found = 0; in fits_read_header()
144 size = abs(header->bitpix) >> 3; in fits_read_header()
145 for (i = 0; i < header->naxis; i++) { in fits_read_header()
146 if (size == 0 || header->naxisn[i] > SIZE_MAX / size) { in fits_read_header()
150 size *= header->naxisn[i]; in fits_read_header()
157 if (!header->rgb && (!header->data_min_found || !header->data_max_found)) { in fits_read_header()
158 ret = fill_data_min_max(ptr8, header, end); in fits_read_header()
160 av_log(avctx, AV_LOG_ERROR, "invalid BITPIX, %d\n", header->bitpix); in fits_read_header()
168 header->data_min = (header->data_min - header->bzero) / header->bscale; in fits_read_header()
169 header->data_max = (header->data_max - header->bzero) / header->bscale; in fits_read_header()
171 if (!header->rgb && header->data_min >= header->data_max) { in fits_read_header()
172 if (header->data_min > header->data_max) { in fits_read_header()
173 …v_log(avctx, AV_LOG_ERROR, "data min/max (%g %g) is invalid\n", header->data_min, header->data_max… in fits_read_header()
177 header->data_max ++; in fits_read_header()
198 FITSHeader header; in fits_decode_frame() local
203 ret = fits_read_header(avctx, &ptr8, &header, end, &p->metadata); in fits_decode_frame()
207 if (header.rgb) { in fits_decode_frame()
208 if (header.bitpix == 8) { in fits_decode_frame()
209 if (header.naxisn[2] == 3) { in fits_decode_frame()
214 } else if (header.bitpix == 16) { in fits_decode_frame()
215 if (header.naxisn[2] == 3) { in fits_decode_frame()
221 av_log(avctx, AV_LOG_ERROR, "unsupported BITPIX = %d\n", header.bitpix); in fits_decode_frame()
225 if (header.bitpix == 8) { in fits_decode_frame()
232 if ((ret = ff_set_dimensions(avctx, header.naxisn[0], header.naxisn[1])) < 0) in fits_decode_frame()
242 if (header.rgb) { in fits_decode_frame()
243 switch(header.bitpix) { in fits_decode_frame()
246 for (k = 0; k < header.naxisn[2]; k++) { \ in fits_decode_frame()
251 if (!header.blank_found || t32 != header.blank) { \ in fits_decode_frame()
252 t = t32 * header.bscale + header.bzero; \ in fits_decode_frame()
267 double scale = header.data_max - header.data_min; in fits_decode_frame()
274 switch (header.bitpix) { in fits_decode_frame()
281 if (!header.blank_found || t != header.blank) { \ in fits_decode_frame()
282 … *dst++ = lrint(((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) * scale); \ in fits_decode_frame()
298 av_log(avctx, AV_LOG_ERROR, "invalid BITPIX, %d\n", header.bitpix); in fits_decode_frame()