⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 decode_graef.c

📁 解吸SEED格式的源代码
💻 C
字号:
#include "rdseed.h"#define MANTISSA_MASK 0xfff0					/* mask for mantissa */#define GAINRANGE_MASK 0x000f					/* mask for gainrange factor */#define SHIFT  4								/* # bits in mantissa */float grf[15] = {1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1,			0.5, 0.25, 0.125, 0.0625};void decode_graef (data_ptr, nsamples, index)char *data_ptr;int nsamples;int index;{	short *temp;								/* recovers sample from SEED */	int mantissa;								/* mantissa from SEED data */	int gainrange;								/* gain range factor */	int mult;									/* multiplier for terms above */	double sample;								/* sample value */	int i;										/* counter */	unsigned int tim1 , tim2;                   /*=====================================*//*=================|     define constants for decoding     |=================*/                   /*=====================================*/                   /*=====================================*//*=================|      calculate samples for CDSN       |=================*/                   /*=====================================*/	for (i = index; i < index + nsamples; i++, data_ptr += 2)	{		/* recover mantissa and gain range factor */		temp = (short *) data_ptr;		if (byteswap == TRUE) *temp = swap_2byte (*temp);		mantissa = ((int) *temp & MANTISSA_MASK) >> SHIFT;		gainrange = ((int) *temp & GAINRANGE_MASK);		/* determine multiplier from gain range factor and format definition */		/* because shift operator is used later, these are powers of two */		if ( mantissa >= 2048 ) mantissa -= 4096;		sample = (double) (mantissa *grf[gainrange]);		/* save sample in seismic data array */		*seismic_data_ptr = sample;		seismic_data_ptr += 1;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -