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: 2025-01-18 12:42:00 Functions: 2 6 33.3 %

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

Generated by: LCOV version 1.14