[FFmpeg-devel] [PATCH] Add FITS Demuxer

Paras Chadha paraschadha18 at gmail.com
Sun Jul 16 17:19:24 EEST 2017


On Fri, Jul 14, 2017 at 11:15 PM, Nicolas George <george at nsup.org> wrote:

> Le tridi 23 messidor, an CCXXV, Paras Chadha a écrit :
> > Hi, I have attached the dump of a FITS File containing 5 images and 4
> > binary table xtensions. The dump is taken using fdump utility. Please
> take
> > a look.
>
> Thanks for the dump. But it is you who know the format, thus it is you
> who can tell the most accurate things about it.
>
> Anyway, distributing the task between the demuxer and the decoder and
> deciding the format of the payload is absolutely necessary before any
> real work can proceed on the implementation.
>
>
> > This is the header of the first (primary) image.
> >
> > SIMPLE  =                    T / FITS STANDARD
> > BITPIX  =                    8 / Character information
> > NAXIS   =                    0 / No image data array present
> > EXTEND  =                    T / There may be standard extensions
> > DATE    = '21/09/99'           / Date file was written (dd/mm/yy) 19yy
> > ORIGIN  = 'CEA/SSL UC Berkeley' / EUVE Science Archive
> > CREATOR = 'STWFITS '           / Fitsio version 05-Aug-1997
> > TELESCOP= 'EUVE    '           / Extreme Ultraviolet Explorer
> > INSTTYPE= 'DS/S    '           / Instrument type (DS/S, SCANNER)
> > OBJECT  = '        '           / Name of observed object
> > RA_OBJ  =             79.17265 / R.A. of the object (degrees)
> > DEC_OBJ =             45.99862 / Declination of the object (degrees)
> > RA_PNT  =     79.1724000000003 / R.A. of the pointing direction (degrees)
> > DEC_PNT =               46.007 / Declination of the pointing direction
> (degrees)
> > RA_PROC =             79.17586 / R.A. used to process data (degrees)
> > DEC_PROC=             45.99578 / Declination used to process data
> (degrees)
> > DATE-OBS= '08/09/99 GMT'       / Start date of observation (dd/mm/yy)
> 19yy
> > TIME-OBS= '00:14:29 GMT'       / Start time of observation (hh:mm:ss GMT)
> > DATE-END= '13/09/99 GMT'       / End date of observation (dd/mm/yy) 19yy
> > TIME-END= '22:07:43 GMT'       / End time of observation (hh:mm:ss GMT)
> > OBS_MODE= 'POINTING'           / Inertial pointing mode
> > DITHER  = 'SPIRAL  '           / Spacecraft dither type (DITHERED,
> SPIRAL, NONE)
> > DETMODE = 'WSZ     '           / Detector position conversion mode (WSZ
> or XY)
> > OFF-AXIS=                    F / Was this pointing done off-axis
> > MOVING  =                    F / Did the source position vary during
> observation
> > DAYNIGHT= 'NIGHT   '           / Day/night data indicator (DAY, NIGHT,
> BOTH)
> > VALIDTIM=      132369.40583229 / Amount of telemetry present (seconds)
> > RA_UNIT = 'deg     '           / Units for Right Ascension
> > DEC_UNIT= 'deg     '           / Units for Declination
> > EQUINOX =                2000. / Coordinate equinox
> > RADECSYS= 'FK5     '           / Frame of reference of coordinates
> > TIMESYS = 'MJD     '           / MJD = JD - 2400000.5
> > TIMEZERO=                   0. / No time offset required for EUVE event
> times
> > TIMEUNIT= 's       '           / Units for TSTART, TSTOP, TIMEZERO
> > CLOCKCOR= 'NO      '           / Not corrected to UT
> > TIMEREF = 'LOCAL   '           / No corrections applied (barycentric,
> etc.)
> > TASSIGN = 'SATELLITE'          / Event times are assigned at the
> satellite
> > TSTART  =     987466469.376002 / Time of start of observation (seconds)
> > TSTOP   =     987977263.104001 / Time of end of observation (seconds)
> > MJDREF  =               40000. / MJD of SC clock start, 24.00 May 1968
> > EGOCSVER= 'egocs1.7.2'         / Software version used to produce this
> data
> > REFVERS = 'egodata1.15.2'      / Reference calibration dataset version
> used
> > COMMENT     ' '
> > COMMENT     'This file is part of the EUVE Science Archive. It contains'
> > COMMENT     'images and filter limits for one EUVE observation.'
> > COMMENT     ' '
> > COMMENT     'The EUVE Science Archive contains the science data from'
> > COMMENT     'observations performed with the EUVE telescopes. It forms
> one'
> > COMMENT     'part of the EUVE Permanent Archive. The other part of the'
> > COMMENT     'permanent archive is the EUVE Telemetry Archive, which is a'
> > COMMENT     'complete record of the raw telemetry from the EUVE mission.'
> > COMMENT     ' '
> > COMMENT     'For documentation of the contents of the EUVE Science
> Archive,'
> > COMMENT     'see the "EUVE Science Archive User's Guide".  The contents
> of'
> > COMMENT     'the EUVE Telemetry Archive are described in the "EUVE'
> > COMMENT     'Telemetry Archive User's Guide".'
> > COMMENT     ' '
> > COMMENT     'The EUVE Permanent Archive was produced by the Center for
> EUV'
> > COMMENT     'Astrophysics, a division of UC Berkeley's Space Science'
> > COMMENT     Laboratory.
> > COMMENT     ' '
> > END
> >
> > This will be followed by the data part whose size (in bits) is given by
> - |BITPIX| * GCOUNT * (PCOUNT + NAXIS1 * NAXIS2 * ... * NAXISm) = 0 in this
> case, so no data part is there
>
> You forgot to explain what should be done with an image without data.
>

Image without data means that there is no image. It is just the header
which can be ignored.
So, currently i am skipping over the header if it contains no image.


>
> >
> > This is the header of second image.
> >
> > XTENSION= 'IMAGE   '           / IMAGE extension
> > BITPIX  =                   16 / 8-bit bytes
> > NAXIS   =                    2 / 2-dimensional image
> > NAXIS1  =                 2048 / Number of image columns
> > NAXIS2  =                 2048 / Number of image rows
> > PCOUNT  =                    0 / Size of special data area
> > GCOUNT  =                    1 / Only one group
> > EXTNAME = 'ds      '           / Name of image
> > BSCALE  =                1.0E0 / Scale factor for pixel values
> > BZERO   =                0.0E0 / Offset for pixel values
> > CTYPE1  = 'RA---TAN'           / RA in tangent plane projection
> > CRVAL1  =     79.1726455688478 / RA at reference pixel
> > CRPIX1  =               1024.5 / reference pixel, axis 1
> > CDELT1  =  0.00126953120343387 / scale, axis 1
> > CUNIT1  = 'deg     '           / units of CRVAL1, CDELT1
> > CTYPE2  = 'DEC--TAN'           / DEC in tangent plane projection
> > CRVAL2  =     45.9986228942872 / DEC at reference pixel
> > CRPIX2  =               1024.5 / reference pixel, axis 2
> > CDELT2  =  0.00126953120343387 / scale, axis 2
> > CUNIT2  = 'deg     '           / units of CRVAL2, CDELT2
> > EXPTIME =             64971.06 / Primbsch/deadtime corrected exposure
> time
> > RAWEXP  =             86784.98 / Uncorrected exposure time
> > FILENAME= 'ds      '
> > ORIGIN  = 'CEA/SSL UC Berkeley' / EUVE Science Archive
> > CREATOR = 'STWFITS '           / Fitsio version 05-Aug-1997
> > TELESCOP= 'EUVE    '           / Extreme Ultraviolet Explorer
> > INSTTYPE= 'DS/S    '           / Instrument type (DS/S, SCANNER)
> > INSTRUME= 'DS/S    '           / Deep Survey - Spectrometer
> > DETNAM  = 'DS      '           / Deep Survey
> > OBJECT  = '        '           / Name of observed object
> > RA_OBJ  = '79.172646'          / R.A. of the object (degrees)
> > DEC_OBJ = '45.998624'          / Declination of the object (degrees)
> > RA_PNT  =     79.1724000000002 / R.A. of the pointing direction (degrees)
> > DEC_PNT =               46.007 / Declination of the pointing direction
> (degrees)
> > RA_PROC =             79.17586 / R.A. used to process data (degrees)
> > DEC_PROC=             45.99578 / Declination used to process data
> (degrees)
> > DATE-OBS= '08/09/99 GMT'       / Start date of observation (dd/mm/yy)
> 19yy
> > TIME-OBS= '00:14:29 GMT'       / Start time of observation (hh:mm:ss GMT)
> > DATE-END= '13/09/99 GMT'       / End date of observation (dd/mm/yy) 19yy
> > TIME-END= '22:07:43 GMT'       / End time of observation (hh:mm:ss GMT)
> > OBS_MODE= 'POINTING'           / Inertial pointing mode
> > DITHER  = 'SPIRAL  '           / Spacecraft dither type (DITHERED,
> SPIRAL, NONE)
> > DETMODE = 'WSZ     '           / Detector position conversion mode (WSZ
> or XY)
> > OFF-AXIS=                    F / Was this pointing done off-axis
> > MOVING  =                    F / Did the source position vary during
> observation
> > DAYNIGHT= 'NIGHT   '           / Day/night data indicator (DAY, NIGHT,
> BOTH)
> > VALIDTIM=      132369.40583229 / Amount of telemetry present (seconds)
> > RA_UNIT = 'deg     '           / Units for Right Ascension
> > DEC_UNIT= 'deg     '           / Units for Declination
> > EQUINOX =                2000. / Coordinate equinox
> > RADECSYS= 'FK5     '           / Frame of reference of coordinates
> > TIMESYS = 'MJD     '           / MJD = JD - 2400000.5
> > TIMEZERO=                   0. / No time offset required for EUVE event
> times
> > TIMEUNIT= 's       '           / Units for TSTART, TSTOP, TIMEZERO
> > CLOCKCOR= 'NO      '           / Not corrected to UT
> > TIMEREF = 'LOCAL   '           / No corrections applied (barycentric,
> etc.)
> > TASSIGN = 'SATELLITE'          / Event times are assigned at the
> satellite
> > TSTART  =     987466469.376001 / Time of start of observation (seconds)
> > TSTOP   =     987977263.104001 / Time of end of observation (seconds)
> > TIERRABS=                0.001 / Timing precision (seconds)
> > MJDREF  =               40000. / MJD of SC clock start, 24.00 May 1968
> > EGOCSVER= 'egocs1.7.2'         / Software version used to produce this
> data
> > REFVERS = 'egodata1.15.2'      / Reference calibration dataset version
> used
> > INHERIT =                    F / Do not inherit cards from the primary
> header
> > COMMENT     ' '
> > COMMENT     'This extension contains an image of the Deep Survey
> detector'
> > COMMENT     'for this observation. All events have been remapped onto
> the'
> > COMMENT     'sky.  The filter limits used to select events for inclusion'
> > COMMENT     'in this image are in the binary table extension named'
> > COMMENT     '"ds_limits" in this file.'
> > COMMENT     ' '
> > END
> >
> > Here also there is data part whose size is given by the same expression
>
> At a guess, all this could be parsed by the demuxer, using BITPIX and
> NAXIS* to populate codecpar->width, codecpar->height and
> codecpar->format and putting all the rest in string metadata, and only
> the data itself go in the packet payload.
>

Okay, i can fill height, width and format in demuxer itself.
By metadata above, do you mean AVStream meatdata ?
Actually i need BLANK, BSCALE, BZERO, DATAMIN and DATAMIN keywords in the
decoder to decode the image correctly. How can i access them there ?


>
> But you probably know better, so please have a loot at the fields in
> AVPacket and AVCodecParameters, and tell us what you think.
>
> Regards,
>
> --
>   Nicolas George
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


-- 
Have a Nice Day !


More information about the ffmpeg-devel mailing list