~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to frmts/aigrid/gridlib.c

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: gridlib.c 17435 2009-07-23 22:36:32Z rouault $
 
2
 * $Id: gridlib.c 22159 2011-04-14 18:18:54Z warmerdam $
3
3
 *
4
4
 * Project:  Arc/Info Binary Grid Translator
5
5
 * Purpose:  Grid file reading code.
29
29
 
30
30
#include "aigrid.h"
31
31
 
32
 
CPL_CVSID("$Id: gridlib.c 17435 2009-07-23 22:36:32Z rouault $");
 
32
CPL_CVSID("$Id: gridlib.c 22159 2011-04-14 18:18:54Z warmerdam $");
33
33
 
34
34
/************************************************************************/
35
35
/*                    AIGProcessRaw32bitFloatBlock()                    */
549
549
/*      Read a single block of integer grid data.                       */
550
550
/************************************************************************/
551
551
 
552
 
CPLErr AIGReadBlock( FILE * fp, GUInt32 nBlockOffset, int nBlockSize,
 
552
CPLErr AIGReadBlock( VSILFILE * fp, GUInt32 nBlockOffset, int nBlockSize,
553
553
                     int nBlockXSize, int nBlockYSize,
554
 
                     GInt32 *panData, int nCellType )
 
554
                     GInt32 *panData, int nCellType, int bCompressed )
555
555
 
556
556
{
557
557
    GByte       *pabyRaw, *pabyCur;
613
613
    nDataSize = nBlockSize;
614
614
    
615
615
/* -------------------------------------------------------------------- */
616
 
/*      Handle float files directly.                                    */
 
616
/*      Handle float files and uncompressed integer files directly.     */
617
617
/* -------------------------------------------------------------------- */
618
618
    if( nCellType == AIG_CELLTYPE_FLOAT )
619
619
    {
625
625
        return CE_None;
626
626
    }
627
627
 
 
628
    if( nCellType == AIG_CELLTYPE_INT && !bCompressed  )
 
629
    {
 
630
        AIGProcessRaw32BitBlock( pabyRaw+2, nDataSize, nMin,
 
631
                                 nBlockXSize, nBlockYSize,
 
632
                                 panData );
 
633
        CPLFree( pabyRaw );
 
634
        return CE_None;
 
635
    }
 
636
 
628
637
/* -------------------------------------------------------------------- */
629
638
/*      Collect minimum value.                                          */
630
639
/* -------------------------------------------------------------------- */
783
792
 
784
793
{
785
794
    char        *pszHDRFilename;
786
 
    FILE        *fp;
 
795
    VSILFILE    *fp;
787
796
    GByte       abyData[308];
788
797
 
789
798
/* -------------------------------------------------------------------- */
818
827
/*      Read the block size information.                                */
819
828
/* -------------------------------------------------------------------- */
820
829
    memcpy( &(psInfo->nCellType), abyData+16, 4 );
 
830
    memcpy( &(psInfo->bCompressed), abyData+20, 4 );
821
831
    memcpy( &(psInfo->nBlocksPerRow), abyData+288, 4 );
822
832
    memcpy( &(psInfo->nBlocksPerColumn), abyData+292, 4 );
823
833
    memcpy( &(psInfo->nBlockXSize), abyData+296, 4 );
827
837
    
828
838
#ifdef CPL_LSB
829
839
    psInfo->nCellType = CPL_SWAP32( psInfo->nCellType );
 
840
    psInfo->bCompressed = CPL_SWAP32( psInfo->bCompressed );
830
841
    psInfo->nBlocksPerRow = CPL_SWAP32( psInfo->nBlocksPerRow );
831
842
    psInfo->nBlocksPerColumn = CPL_SWAP32( psInfo->nBlocksPerColumn );
832
843
    psInfo->nBlockXSize = CPL_SWAP32( psInfo->nBlockXSize );
835
846
    CPL_SWAPDOUBLE( &(psInfo->dfCellSizeY) );
836
847
#endif
837
848
 
 
849
    psInfo->bCompressed = !psInfo->bCompressed;
 
850
 
838
851
    return( CE_None );
839
852
}
840
853
 
850
863
 
851
864
{
852
865
    char        *pszHDRFilename;
853
 
    FILE        *fp;
 
866
    VSILFILE    *fp;
854
867
    int         nLength, i;
855
868
    GInt32      nValue;
856
869
    GUInt32     *panIndex;
976
989
 
977
990
{
978
991
    char        *pszHDRFilename;
979
 
    FILE        *fp;
 
992
    VSILFILE    *fp;
980
993
    double      adfBound[4];
981
994
 
982
995
/* -------------------------------------------------------------------- */
1031
1044
 
1032
1045
{
1033
1046
    char        *pszHDRFilename;
1034
 
    FILE        *fp;
 
1047
    VSILFILE    *fp;
1035
1048
    double      adfStats[4];
1036
1049
 
1037
1050
    psInfo->dfMin = 0.0;