LCOV - code coverage report
Current view: top level - frmts/ceos2 - ceossar.c (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 29 59 49.2 %
Date: 2026-03-21 01:28:04 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           7 : void InitCeosSARVolume(CeosSARVolume_t *volume, int32 file_name_convention)
      18             : {
      19           7 :     volume->Flavor = volume->Sensor = volume->ProductType = 0;
      20             : 
      21           7 :     volume->FileNamingConvention = file_name_convention;
      22             : 
      23           7 :     volume->VolumeDirectoryFile = volume->SARLeaderFile =
      24           7 :         volume->SARTrailerFile = volume->NullVolumeDirectoryFile =
      25           7 :             volume->ImageDesc.ImageDescValid = FALSE;
      26             : 
      27           7 :     volume->RecordList = NULL;
      28           7 : }
      29             : 
      30          33 : void CalcCeosSARImageFilePosition(CeosSARVolume_t *volume, int channel,
      31             :                                   int line, int *record, uint64_t *file_offset)
      32             : {
      33             :     struct CeosSARImageDesc *ImageDesc;
      34          33 :     int TotalRecords = 0;
      35          33 :     uint64_t TotalBytes = 0;
      36             : 
      37          33 :     if (record)
      38           0 :         *record = 0;
      39          33 :     if (file_offset)
      40          33 :         *file_offset = 0;
      41             : 
      42          33 :     if (volume)
      43             :     {
      44          33 :         if (volume->ImageDesc.ImageDescValid)
      45             :         {
      46          33 :             ImageDesc = &(volume->ImageDesc);
      47             : 
      48          33 :             switch (ImageDesc->ChannelInterleaving)
      49             :             {
      50           0 :                 case CEOS_IL_PIXEL:
      51           0 :                     TotalRecords = (line - 1) * ImageDesc->RecordsPerLine;
      52           0 :                     TotalBytes =
      53           0 :                         (uint64_t)(TotalRecords) * (ImageDesc->BytesPerRecord);
      54           0 :                     break;
      55           0 :                 case CEOS_IL_LINE:
      56           0 :                     TotalRecords =
      57           0 :                         (ImageDesc->NumChannels * (line - 1) + (channel - 1)) *
      58           0 :                         ImageDesc->RecordsPerLine;
      59           0 :                     TotalBytes =
      60           0 :                         (uint64_t)(TotalRecords) * (ImageDesc->BytesPerRecord);
      61           0 :                     break;
      62          33 :                 case CEOS_IL_BAND:
      63          33 :                     TotalRecords = (((channel - 1) * ImageDesc->Lines) *
      64          33 :                                     ImageDesc->RecordsPerLine) +
      65          33 :                                    (line - 1) * ImageDesc->RecordsPerLine;
      66          33 :                     TotalBytes =
      67          33 :                         (uint64_t)(TotalRecords) * (ImageDesc->BytesPerRecord);
      68          33 :                     break;
      69             :             }
      70          33 :             if (file_offset)
      71          33 :                 *file_offset = ImageDesc->FileDescriptorLength + TotalBytes;
      72          33 :             if (record)
      73           0 :                 *record = TotalRecords + 1;
      74             :         }
      75             :     }
      76          33 : }
      77             : 
      78           0 : int32 GetCeosSARImageData(CPL_UNUSED CeosSARVolume_t *volume,
      79             :                           CPL_UNUSED CeosRecord_t *processed_data_record,
      80             :                           CPL_UNUSED int channel, CPL_UNUSED int xoff,
      81             :                           CPL_UNUSED int xsize, CPL_UNUSED int bufsize,
      82             :                           CPL_UNUSED uchar *buffer)
      83             : {
      84           0 :     return 0;
      85             : }
      86             : 
      87           0 : void DetermineCeosSARPixelOrder(CPL_UNUSED CeosSARVolume_t *volume,
      88             :                                 CPL_UNUSED CeosRecord_t *record)
      89             : {
      90           0 : }
      91             : 
      92           0 : void GetCeosSAREmbeddedInfo(CPL_UNUSED CeosSARVolume_t *volume,
      93             :                             CPL_UNUSED CeosRecord_t *processed_data_record,
      94             :                             CPL_UNUSED CeosSAREmbeddedInfo_t *info)
      95             : {
      96           0 : }
      97             : 
      98           0 : void DeleteCeosSARVolume(CeosSARVolume_t *volume)
      99             : {
     100             :     Link_t *Links;
     101             : 
     102           0 :     if (volume)
     103             :     {
     104           0 :         if (volume->RecordList)
     105             :         {
     106           0 :             for (Links = volume->RecordList; Links != NULL; Links = Links->next)
     107             :             {
     108           0 :                 if (Links->object)
     109             :                 {
     110           0 :                     DeleteCeosRecord(Links->object);
     111           0 :                     Links->object = NULL;
     112             :                 }
     113             :             }
     114           0 :             DestroyList(volume->RecordList);
     115             :         }
     116           0 :         HFree(volume);
     117             :     }
     118           0 : }

Generated by: LCOV version 1.14