LCOV - code coverage report
Current view: top level - frmts/ceos2 - ceossar.c (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 27 55 49.1 %
Date: 2024-11-21 22:18:42 Functions: 2 6 33.3 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  * $Id$
       3             :  *
       4             :  * Project:  ASI CEOS Translator
       5             :  * Purpose:  Functions related to CeosSARVolume_t.
       6             :  * Author:   Paul Lahaie, pjlahaie@atlsci.com
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 2000, Atlantis Scientific Inc
      10             :  *
      11             :  * SPDX-License-Identifier: MIT
      12             :  ****************************************************************************/
      13             : 
      14             : #include "ceos.h"
      15             : 
      16             : extern Link_t *RecipeFunctions;
      17             : 
      18           4 : void InitCeosSARVolume(CeosSARVolume_t *volume, int32 file_name_convention)
      19             : {
      20           4 :     volume->Flavor = volume->Sensor = volume->ProductType = 0;
      21             : 
      22           4 :     volume->FileNamingConvention = file_name_convention;
      23             : 
      24           4 :     volume->VolumeDirectoryFile = volume->SARLeaderFile =
      25           4 :         volume->SARTrailerFile = volume->NullVolumeDirectoryFile =
      26           4 :             volume->ImageDesc.ImageDescValid = FALSE;
      27             : 
      28           4 :     volume->RecordList = NULL;
      29           4 : }
      30             : 
      31          20 : void CalcCeosSARImageFilePosition(CeosSARVolume_t *volume, int channel,
      32             :                                   int line, int *record, int *file_offset)
      33             : {
      34             :     struct CeosSARImageDesc *ImageDesc;
      35          20 :     int TotalRecords = 0, TotalBytes = 0;
      36             : 
      37          20 :     if (record)
      38           0 :         *record = 0;
      39          20 :     if (file_offset)
      40          20 :         *file_offset = 0;
      41             : 
      42          20 :     if (volume)
      43             :     {
      44          20 :         if (volume->ImageDesc.ImageDescValid)
      45             :         {
      46          20 :             ImageDesc = &(volume->ImageDesc);
      47             : 
      48          20 :             switch (ImageDesc->ChannelInterleaving)
      49             :             {
      50           0 :                 case CEOS_IL_PIXEL:
      51           0 :                     TotalRecords = (line - 1) * ImageDesc->RecordsPerLine;
      52           0 :                     TotalBytes = (TotalRecords) * (ImageDesc->BytesPerRecord);
      53           0 :                     break;
      54           0 :                 case CEOS_IL_LINE:
      55           0 :                     TotalRecords =
      56           0 :                         (ImageDesc->NumChannels * (line - 1) + (channel - 1)) *
      57           0 :                         ImageDesc->RecordsPerLine;
      58           0 :                     TotalBytes = (TotalRecords) * (ImageDesc->BytesPerRecord);
      59           0 :                     break;
      60          20 :                 case CEOS_IL_BAND:
      61          20 :                     TotalRecords = (((channel - 1) * ImageDesc->Lines) *
      62          20 :                                     ImageDesc->RecordsPerLine) +
      63          20 :                                    (line - 1) * ImageDesc->RecordsPerLine;
      64          20 :                     TotalBytes = (TotalRecords) * (ImageDesc->BytesPerRecord);
      65          20 :                     break;
      66             :             }
      67          20 :             if (file_offset)
      68          20 :                 *file_offset = ImageDesc->FileDescriptorLength + TotalBytes;
      69          20 :             if (record)
      70           0 :                 *record = TotalRecords + 1;
      71             :         }
      72             :     }
      73          20 : }
      74             : 
      75           0 : int32 GetCeosSARImageData(CPL_UNUSED CeosSARVolume_t *volume,
      76             :                           CPL_UNUSED CeosRecord_t *processed_data_record,
      77             :                           CPL_UNUSED int channel, CPL_UNUSED int xoff,
      78             :                           CPL_UNUSED int xsize, CPL_UNUSED int bufsize,
      79             :                           CPL_UNUSED uchar *buffer)
      80             : {
      81           0 :     return 0;
      82             : }
      83             : 
      84           0 : void DetermineCeosSARPixelOrder(CPL_UNUSED CeosSARVolume_t *volume,
      85             :                                 CPL_UNUSED CeosRecord_t *record)
      86             : {
      87           0 : }
      88             : 
      89           0 : void GetCeosSAREmbeddedInfo(CPL_UNUSED CeosSARVolume_t *volume,
      90             :                             CPL_UNUSED CeosRecord_t *processed_data_record,
      91             :                             CPL_UNUSED CeosSAREmbeddedInfo_t *info)
      92             : {
      93           0 : }
      94             : 
      95           0 : void DeleteCeosSARVolume(CeosSARVolume_t *volume)
      96             : {
      97             :     Link_t *Links;
      98             : 
      99           0 :     if (volume)
     100             :     {
     101           0 :         if (volume->RecordList)
     102             :         {
     103           0 :             for (Links = volume->RecordList; Links != NULL; Links = Links->next)
     104             :             {
     105           0 :                 if (Links->object)
     106             :                 {
     107           0 :                     DeleteCeosRecord(Links->object);
     108           0 :                     Links->object = NULL;
     109             :                 }
     110             :             }
     111           0 :             DestroyList(volume->RecordList);
     112             :         }
     113           0 :         HFree(volume);
     114             :     }
     115           0 : }

Generated by: LCOV version 1.14