| 1 | /*=========================================================================== |
| 2 | * |
| 3 | * PUBLIC DOMAIN NOTICE |
| 4 | * National Center for Biotechnology Information |
| 5 | * |
| 6 | * This software/database is a "United States Government Work" under the |
| 7 | * terms of the United States Copyright Act. It was written as part of |
| 8 | * the author's official duties as a United States Government employee and |
| 9 | * thus cannot be copyrighted. This software/database is freely available |
| 10 | * to the public for use. The National Library of Medicine and the U.S. |
| 11 | * Government have not placed any restriction on its use or reproduction. |
| 12 | * |
| 13 | * Although all reasonable efforts have been taken to ensure the accuracy |
| 14 | * and reliability of the software and data, the NLM and the U.S. |
| 15 | * Government do not and cannot warrant the performance or results that |
| 16 | * may be obtained by using this software or data. The NLM and the U.S. |
| 17 | * Government disclaim all warranties, express or implied, including |
| 18 | * warranties of performance, merchantability or fitness for any particular |
| 19 | * purpose. |
| 20 | * |
| 21 | * Please cite the author in any work or product based on this material. |
| 22 | * |
| 23 | * =========================================================================== |
| 24 | * |
| 25 | */ |
| 26 | #include <vdb/extern.h>cxx . . $ `<file>/interfaces/vdb/extern.h`/ |
| 27 | |
| 28 | #include "v0-decompress.h"cxx . . $ `<file>/libs/sraxf/v0-decompress.h`/ |
| 29 | #include "v0-decompress-local.h"cxx . . $ `<file>/libs/sraxf/v0-decompress-local.h`/ |
| 30 | #include <klib/data-buffer.h>cxx . . $ `<file>/interfaces/klib/data-buffer.h`/ |
| 31 | #include <klib/sort.h>cxx . . $ `<file>/interfaces/klib/sort.h`/ |
| 32 | #include <sysalloc.h>cxx . . $ `<file>/interfaces/os/unix/sysalloc.h`/ |
| 33 | |
| 34 | #include <math.h> |
| 35 | |
| 36 | /* local data |
| 37 | */ |
| 38 | SRALocalcxx . . $ SRALocal# gv_localcxx . . $ gv_local.; |
| 39 | |
| 40 | static |
| 41 | void *sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( KDataBuffercxx . . $ KDataBuffer# *dst, KDataBuffercxx . . $ KDataBuffer# *alt, size_t bytes ) |
| 42 | { |
| 43 | rc_tcxx . . $ rc_t# rc; |
| 44 | |
| 45 | /* whatever was in dst, put it in alt */ |
| 46 | KDataBufferWhackcxx . . $ KDataBufferWhack(ceb637c95b5887ee). ( alt ); |
| 47 | #if 0 |
| 48 | *alt = *dst; |
| 49 | #else |
| 50 | KDataBufferSubcxx . . $ KDataBufferSub(b55ff7396da76372). ( dst, alt, 0, UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`! ); |
| 51 | KDataBufferWhackcxx . . $ KDataBufferWhack(ceb637c95b5887ee).(dst); |
| 52 | #endif |
| 53 | |
| 54 | /* allocate a new space */ |
| 55 | rc = (uint32_tcxx . . $ uint32_t#)KDataBufferMakeBytescxx . . $ `interfaces/klib/data-buffer.h:110:9`! ( dst, (uint32_t)bytes ); |
| 56 | if ( rc != 0 ) |
| 57 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 58 | |
| 59 | #if 1 |
| 60 | #define BZERO_SIZEcxx . . $ `libs/sraxf/v0-decompress.c:60:9`! 256 |
| 61 | if (bytes > BZERO_SIZEcxx . . $ `libs/sraxf/v0-decompress.c:60:9`!) |
| 62 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&((char *)dst->basecxx . . $ KDataBuffer#base.)[bytes-BZERO_SIZEcxx . . $ `libs/sraxf/v0-decompress.c:60:9`!], 0, BZERO_SIZEcxx . . $ `libs/sraxf/v0-decompress.c:60:9`!); |
| 63 | else |
| 64 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(dst->basecxx . . $ KDataBuffer#base., 0, bytes); |
| 65 | #undef BZERO_SIZEcxx . . $ `libs/sraxf/v0-decompress.c:60:9`! |
| 66 | #endif |
| 67 | |
| 68 | /* return a pointer to it just like malloc */ |
| 69 | return dst -> basecxx . . $ KDataBuffer#base.; |
| 70 | } |
| 71 | |
| 72 | /* |
| 73 | */ |
| 74 | static void _s_undelta_4_channelcxx . . $ _s_undelta_4_channel(b72bcd91d3e2311e). (int slen, int tlen, void* src, int ssize) |
| 75 | { |
| 76 | int i, j; |
| 77 | char* cptr = (char*)src; |
| 78 | short* sptr = (short*)src; |
| 79 | int* iptr = (int*)src; |
| 80 | |
| 81 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (tlen); |
| 82 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ((ssize&3) == 0); /* make sure we have all 4 channels in it */ |
| 83 | |
| 84 | for (i=0, j=0; i<ssize/tlen; i+=4, j++) |
| 85 | { |
| 86 | /* after each slen the actual data is stored as is, |
| 87 | * this shift happens at the begining as well |
| 88 | */ |
| 89 | if (j%slen == 0) { i += 4; j++; } |
| 90 | |
| 91 | switch (tlen) |
| 92 | { |
| 93 | case 4: *(iptr+i+0) += *(iptr+i-4); |
| 94 | *(iptr+i+1) += *(iptr+i-3); |
| 95 | *(iptr+i+2) += *(iptr+i-2); |
| 96 | *(iptr+i+3) += *(iptr+i-1); |
| 97 | break; |
| 98 | |
| 99 | case 2: *(sptr+i+0) += *(sptr+i-4); |
| 100 | *(sptr+i+1) += *(sptr+i-3); |
| 101 | *(sptr+i+2) += *(sptr+i-2); |
| 102 | *(sptr+i+3) += *(sptr+i-1); |
| 103 | break; |
| 104 | |
| 105 | default: |
| 106 | case 1: *(cptr+i+0) += *(cptr+i-4); |
| 107 | *(cptr+i+1) += *(cptr+i-3); |
| 108 | *(cptr+i+2) += *(cptr+i-2); |
| 109 | *(cptr+i+3) += *(cptr+i-1); |
| 110 | break; |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /* |
| 116 | */ |
| 117 | static void _s_exponent_4_channelcxx . . $ _s_exponent_4_channel(846b19f8bc6820f5). (int slen, void* dst, int dsize, const void* src, int ssize, float sim, float snm) |
| 118 | { |
| 119 | int i; |
| 120 | float* fptr = (float*)dst; |
| 121 | short* sptr = (short*)src; |
| 122 | |
| 123 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ((ssize&3) == 0); /* make sure we have all 4 channels in it */ |
| 124 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (ssize*2 == dsize); |
| 125 | |
| 126 | for (i=0; i<ssize>>1; i+=4) /* the source buffer is full of short values, therefore ssize>>1 */ |
| 127 | { |
| 128 | *(fptr+i+0) = expf ((float)*(sptr+i+0)/LOG_MAIN_MULTIPLIERcxx . . $ `libs/sraxf/v0-decompress-local.h:74:9`!)/10 + sim; |
| 129 | *(fptr+i+1) = expf ((float)*(sptr+i+1)/LOG_SUB_MULTIPLIERcxx . . $ `libs/sraxf/v0-decompress-local.h:75:9`! )/10 + snm; |
| 130 | *(fptr+i+2) = expf ((float)*(sptr+i+2)/LOG_SUB_MULTIPLIERcxx . . $ `libs/sraxf/v0-decompress-local.h:75:9`! )/10 + snm; |
| 131 | *(fptr+i+3) = expf ((float)*(sptr+i+3)/LOG_SUB_MULTIPLIERcxx . . $ `libs/sraxf/v0-decompress-local.h:75:9`! )/10 + snm; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | /* |
| 136 | */ |
| 137 | static int _s_decompress_zlibcxx . . $ _s_decompress_zlib(8a3a8481beb8a97d). ( void* dst, const void* src, int dsize, int ssize ) |
| 138 | { |
| 139 | z_streamcxx . . $ z_stream# c_stream; /* decompression stream */ |
| 140 | |
| 141 | memsetcxx . . $ memset(d1de1e4fb215f1c6).( &c_stream, 0, sizeof( c_stream ) ); |
| 142 | c_stream.next_incxx . . $ z_stream_s#next_in. = ( Bytefcxx . . $ Bytef#* )src; |
| 143 | c_stream.next_outcxx . . $ z_stream_s#next_out. = ( Bytefcxx . . $ Bytef#* )dst; |
| 144 | c_stream.avail_incxx . . $ z_stream_s#avail_in. = ( uIntcxx . . $ uInt# )ssize; |
| 145 | c_stream.avail_outcxx . . $ z_stream_s#avail_out. = ( uIntcxx . . $ uInt# )dsize; |
| 146 | |
| 147 | if ( Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`! != inflateInitcxx . . $ `<external>/8929586433573063152/zlib.h:1934:11`! ( &c_stream ) ) |
| 148 | { |
| 149 | inflateEndcxx . . $ inflateEnd(486a74ec0f38e374). ( &c_stream ); |
| 150 | return 1; |
| 151 | } |
| 152 | |
| 153 | if ( Z_STREAM_ENDcxx . . $ `<external>/8929586433573063152/zlib.h:182:9`! != inflatecxx . . $ inflate(bbdd8fdeb65a331e). ( &c_stream, Z_FINISHcxx . . $ `<external>/8929586433573063152/zlib.h:176:9`! ) && |
| 154 | Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`! != inflateSynccxx . . $ inflateSync(486a74ec0f38e374).( &c_stream ) ) |
| 155 | { |
| 156 | inflateEndcxx . . $ inflateEnd(486a74ec0f38e374). ( &c_stream ); |
| 157 | return 1; |
| 158 | } |
| 159 | |
| 160 | if ( Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`! != inflateEndcxx . . $ inflateEnd(486a74ec0f38e374). ( &c_stream ) ) |
| 161 | { |
| 162 | return 1; |
| 163 | } |
| 164 | |
| 165 | return 0; |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | */ |
| 170 | static int64_tcxx . . $ int64_t# CCcxx . . $ `interfaces/kfc/callconv.h:44:11`! _s_cmp_keycxx . . $ _s_cmp_key(9f7cc50b76e72596). (const void* keyptr, const void* idxptr, void *data) |
| 171 | { |
| 172 | SRALookup_tcxx . . $ SRALookup_t# plook = data; |
| 173 | static uint32_tcxx . . $ uint32_t# mask [33] = {0x00000000, 0x80000000, 0xC0000000, 0xE0000000, |
| 174 | 0xF0000000, 0xF8000000, 0xFC000000, 0xFE000000, |
| 175 | 0xFF000000, 0xFF800000, 0xFFC00000, 0xFFE00000, |
| 176 | 0xFFF00000, 0xFFF80000, 0xFFFC0000, 0xFFFE0000, |
| 177 | 0xFFFF0000, 0xFFFF8000, 0xFFFFC000, 0xFFFFE000, |
| 178 | 0xFFFFF000, 0xFFFFF800, 0xFFFFFC00, 0xFFFFFE00, |
| 179 | 0xFFFFFF00, 0xFFFFFF80, 0xFFFFFFC0, 0xFFFFFFE0, |
| 180 | 0xFFFFFFF0, 0xFFFFFFF8, 0xFFFFFFFC, 0xFFFFFFFE, |
| 181 | 0xFFFFFFFF}; |
| 182 | |
| 183 | uint16_tcxx . . $ uint16_t# index = *(uint16_tcxx . . $ uint16_t#*)idxptr; |
| 184 | uint32_tcxx . . $ uint32_t# keyBits = *(uint32_tcxx . . $ uint32_t#*)keyptr & mask[plook[index].nbitscxx . . $ SRALookup#nbits.]; |
| 185 | uint32_tcxx . . $ uint32_t# lookupBits = plook[index].bitscxx . . $ SRALookup#bits.; |
| 186 | |
| 187 | return (int64_tcxx . . $ int64_t#)keyBits - (int64_tcxx . . $ int64_t#)lookupBits; |
| 188 | } |
| 189 | |
| 190 | /* |
| 191 | * decompresses positions for 454 platform, and restores their actual values |
| 192 | * |
| 193 | */ |
| 194 | int sra_decompress_poscxx . . $ sra_decompress_pos(7d0d1b8ee7ff5b4d). ( KDataBuffercxx . . $ KDataBuffer# *dst, KDataBuffercxx . . $ KDataBuffer# *alt, const void* src, int ssize ) |
| 195 | { |
| 196 | uchar_tcxx . . $ uchar_t# magic; /* compression type magic */ |
| 197 | const uchar_tcxx . . $ uchar_t#* pepos; /* ptr to encoded positions */ |
| 198 | uchar_tcxx . . $ uchar_t#* popos; /* ptr to output positions */ |
| 199 | uint16_tcxx . . $ uint16_t#* pspos; /* ptr to short values after restoration */ |
| 200 | uchar_tcxx . . $ uchar_t#* iptr; /* ptr to index in lookup table */ |
| 201 | uchar_tcxx . . $ uchar_t# indx; /* actual index */ |
| 202 | uint16_tcxx . . $ uint16_t# offset, shift, osize, pos, rbpos, nbits, i; |
| 203 | uint32_tcxx . . $ uint32_t# lval; /* _get_long reads into it */ |
| 204 | |
| 205 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (gv_local.lookup_454_pos_initialized); |
| 206 | |
| 207 | rbpos = 0; |
| 208 | offset = 0; |
| 209 | pepos = src; |
| 210 | |
| 211 | /* get magic and size of data |
| 212 | */ |
| 213 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pepos, &offset, rbpos, &magic, 1); |
| 214 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pepos, &offset, rbpos, &osize, 1); |
| 215 | |
| 216 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`! || magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!); |
| 217 | |
| 218 | /* decompress zlib |
| 219 | */ |
| 220 | if (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`!) /* it is always applied on top of huffman */ |
| 221 | { |
| 222 | shift = 3; /* magic + length */ |
| 223 | popos = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize + 100 ); /* generosity */ |
| 224 | |
| 225 | if (_s_decompress_zlibcxx . . $ _s_decompress_zlib(8a3a8481beb8a97d).(popos, pepos+shift, (int)osize + 100, ssize-shift)) |
| 226 | return 1; |
| 227 | |
| 228 | rbpos = 0; /* read bit position */ |
| 229 | offset = 0; |
| 230 | ssize = osize; |
| 231 | pepos = popos; |
| 232 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pepos, &offset, rbpos, &magic, 1); |
| 233 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pepos, &offset, rbpos, &osize, 1); |
| 234 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!); |
| 235 | magic = SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`!; /* to make sure an extra allocated buffer will be destroyed */ |
| 236 | } |
| 237 | |
| 238 | popos = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, osize ); |
| 239 | |
| 240 | |
| 241 | /* decompress huffman |
| 242 | */ |
| 243 | pos = 0; |
| 244 | while (pos < osize) |
| 245 | { |
| 246 | uint32_tcxx . . $ uint32_t# offset32 = offset; |
| 247 | if (ssize-offset > 4) nbits = 32; |
| 248 | else nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos; |
| 249 | |
| 250 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! ( pepos, nbits, &offset32, &rbpos, &lval, 0, (ssize << 3) ); |
| 251 | offset = (uint16_tcxx . . $ uint16_t#)offset32; |
| 252 | |
| 253 | iptr = (uchar_tcxx . . $ uchar_t#*) kbsearchcxx . . $ kbsearch(3404bbaeea24c259). ( &lval, gv_localcxx . . $ gv_local..idx_454_poscxx . . $ SRALocal#idx_454_pos., |
| 254 | POS_454_HUFF_TREESIZEcxx . . $ `libs/sraxf/v0-decompress-local.h:57:9`!, sizeof(uint16_tcxx . . $ uint16_t#), _s_cmp_keycxx . . $ _s_cmp_key(9f7cc50b76e72596)., gv_localcxx . . $ gv_local..lookup_454_poscxx . . $ SRALocal#lookup_454_pos. ); |
| 255 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (iptr); |
| 256 | indx = *iptr; |
| 257 | |
| 258 | offset += ((rbpos+(uint16_tcxx . . $ uint16_t#)gv_localcxx . . $ gv_local..lookup_454_poscxx . . $ SRALocal#lookup_454_pos.[indx].nbitscxx . . $ SRALookup#nbits.) >> 3); |
| 259 | rbpos = ((rbpos+(uint16_tcxx . . $ uint16_t#)gv_localcxx . . $ gv_local..lookup_454_poscxx . . $ SRALocal#lookup_454_pos.[indx].nbitscxx . . $ SRALookup#nbits.) & 7); |
| 260 | |
| 261 | if (indx < POS_454_MAX_POINTcxx . . $ `libs/sraxf/v0-decompress-local.h:72:9`!) |
| 262 | *(popos+pos) = indx; |
| 263 | else |
| 264 | { |
| 265 | uchar_tcxx . . $ uchar_t# val; |
| 266 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pepos, &offset, rbpos, &val, 1); |
| 267 | *(popos+pos) = val; |
| 268 | } |
| 269 | pos++; |
| 270 | } |
| 271 | |
| 272 | /* undelta |
| 273 | */ |
| 274 | pspos = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, (osize*sizeof(uint16_tcxx . . $ uint16_t#)+3)&~3); /** align to 4-byte **/ |
| 275 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (pspos); |
| 276 | |
| 277 | *(pspos+0) = *(popos+0); |
| 278 | for (i=1; i<osize; i++) |
| 279 | *(pspos+i) = *(pspos+i-1) + *(popos+i); |
| 280 | |
| 281 | /* set element size to 16 bits */ |
| 282 | KDataBufferCastcxx . . $ KDataBufferCast(13b757a54c5fcf8d). ( dst, dst, 16, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! ); |
| 283 | |
| 284 | /* crop size to osize */ |
| 285 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ( osize <= dst -> elem_count ); |
| 286 | KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4). ( dst, osize ); |
| 287 | |
| 288 | return 0; |
| 289 | } |
| 290 | |
| 291 | |
| 292 | int sra_decompress_prb_454cxx . . $ sra_decompress_prb_454(7d0d1b8ee7ff5b4d). ( KDataBuffercxx . . $ KDataBuffer# *dst, KDataBuffercxx . . $ KDataBuffer# *alt, const void* src, int ssize ) |
| 293 | { |
| 294 | uchar_tcxx . . $ uchar_t# magic; |
| 295 | const uchar_tcxx . . $ uchar_t#* peprb; |
| 296 | uchar_tcxx . . $ uchar_t#* poprb; |
| 297 | #if !SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 298 | uint16_t* iptr; |
| 299 | #endif |
| 300 | uint16_tcxx . . $ uint16_t# offset, shift, osize, pos, rbpos, nbits; |
| 301 | uchar_tcxx . . $ uchar_t# indx; |
| 302 | uint32_tcxx . . $ uint32_t# lval; |
| 303 | |
| 304 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (gv_local.lookup_454_prb_initialized); |
| 305 | |
| 306 | rbpos = 0; /* read bit position */ |
| 307 | offset = 0; |
| 308 | peprb = src; |
| 309 | |
| 310 | /* get magic and size of data |
| 311 | */ |
| 312 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (peprb, &offset, rbpos, &magic, 1); |
| 313 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (peprb, &offset, rbpos, &osize, 1); |
| 314 | |
| 315 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`! || magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!); |
| 316 | |
| 317 | /* decompress zlib |
| 318 | */ |
| 319 | if (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`!) |
| 320 | { |
| 321 | shift = 3; /* magic + length */ |
| 322 | /**** HACK: in some runs osize was truncated/corrupted???? Giving it some more space *****/ |
| 323 | poprb = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize+200 ); |
| 324 | |
| 325 | if (_s_decompress_zlibcxx . . $ _s_decompress_zlib(8a3a8481beb8a97d).(poprb, peprb+shift, (int)osize + 200, ssize-shift)) |
| 326 | return 1; |
| 327 | |
| 328 | rbpos = 0; /* read bit position */ |
| 329 | offset = 0; |
| 330 | ssize = osize; |
| 331 | peprb = poprb; |
| 332 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (peprb, &offset, rbpos, &magic, 1); |
| 333 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (peprb, &offset, rbpos, &osize, 1); |
| 334 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!); |
| 335 | } |
| 336 | |
| 337 | poprb = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, (osize+3)&~3); /** align to 4-byte boundary **/ |
| 338 | |
| 339 | |
| 340 | /* decompress huffman |
| 341 | */ |
| 342 | pos = 0; |
| 343 | while (pos < osize) |
| 344 | { |
| 345 | uint32_tcxx . . $ uint32_t# offset32 = offset; |
| 346 | if (ssize-offset > 4) nbits = 32; |
| 347 | else nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos; |
| 348 | |
| 349 | if ((offset > (uint32_tcxx . . $ uint32_t#)ssize) || (nbits == 0)) |
| 350 | return 1; |
| 351 | |
| 352 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (peprb, nbits, &offset32, &rbpos, &lval, 0, (ssize << 3)); |
| 353 | offset = (uint16_tcxx . . $ uint16_t#)offset32; |
| 354 | |
| 355 | #if SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 356 | indx = (uchar_tcxx . . $ uchar_t#) gv_localcxx . . $ gv_local..rlookup_454_prbcxx . . $ SRALocal#rlookup_454_prb. [lval>>16]; |
| 357 | #else |
| 358 | iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_454_prb, |
| 359 | PRB_454_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_454_prb); |
| 360 | assert (iptr); |
| 361 | indx = *iptr; |
| 362 | #endif |
| 363 | |
| 364 | offset += ((rbpos+(uint16_tcxx . . $ uint16_t#)gv_localcxx . . $ gv_local..lookup_454_prbcxx . . $ SRALocal#lookup_454_prb.[indx].nbitscxx . . $ SRALookup#nbits.) >> 3); |
| 365 | rbpos = ((rbpos+(uint16_tcxx . . $ uint16_t#)gv_localcxx . . $ gv_local..lookup_454_prbcxx . . $ SRALocal#lookup_454_prb.[indx].nbitscxx . . $ SRALookup#nbits.) & 7); |
| 366 | |
| 367 | if (indx < PRB_454_MAX_POINTcxx . . $ `libs/sraxf/v0-decompress-local.h:71:9`!) |
| 368 | *(poprb+pos) = indx; |
| 369 | else |
| 370 | { |
| 371 | uchar_tcxx . . $ uchar_t# val; |
| 372 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (peprb, &offset, rbpos, &val, 1); |
| 373 | *(poprb+pos) = val; |
| 374 | } |
| 375 | pos++; |
| 376 | } |
| 377 | |
| 378 | /* crop size to osize */ |
| 379 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ( osize <= dst -> elem_count ); |
| 380 | KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4). ( dst, osize ); |
| 381 | |
| 382 | return 0; |
| 383 | } |
| 384 | |
| 385 | int sra_decompress_clpcxx . . $ sra_decompress_clp(7d0d1b8ee7ff5b4d). ( KDataBuffercxx . . $ KDataBuffer# *dst, KDataBuffercxx . . $ KDataBuffer# *alt, const void* src, int ssize ) |
| 386 | { |
| 387 | uchar_tcxx . . $ uchar_t# magic; |
| 388 | const uchar_tcxx . . $ uchar_t#* peclp; |
| 389 | uchar_tcxx . . $ uchar_t#* poclp; |
| 390 | uint32_tcxx . . $ uint32_t# osize, offset; |
| 391 | uint16_tcxx . . $ uint16_t# rbpos, shift; |
| 392 | |
| 393 | rbpos = 0; |
| 394 | offset = 0; |
| 395 | peclp = src; |
| 396 | |
| 397 | /* get magic and size of data |
| 398 | */ |
| 399 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (peclp, &offset, rbpos, &magic, 1); |
| 400 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (peclp, 32, &offset, &rbpos, &osize, 1, (ssize << 3)); |
| 401 | |
| 402 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`!); |
| 403 | |
| 404 | shift = 5; /* magic + length */ |
| 405 | poclp = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize + 100 ); |
| 406 | |
| 407 | if (_s_decompress_zlibcxx . . $ _s_decompress_zlib(8a3a8481beb8a97d).(poclp, peclp+shift, (int)osize + 100, ssize-shift)) |
| 408 | return 1; |
| 409 | |
| 410 | /* crop size to osize */ |
| 411 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ( osize <= dst -> elem_count ); |
| 412 | KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4). ( dst, osize ); |
| 413 | |
| 414 | return 0; |
| 415 | } |
| 416 | |
| 417 | int sra_decompress_sig_454cxx . . $ sra_decompress_sig_454(7d0d1b8ee7ff5b4d). ( KDataBuffercxx . . $ KDataBuffer# *dst, KDataBuffercxx . . $ KDataBuffer# *alt, const void* src, int ssize ) |
| 418 | { |
| 419 | uchar_tcxx . . $ uchar_t# magic; |
| 420 | const uchar_tcxx . . $ uchar_t#* pesig; |
| 421 | uchar_tcxx . . $ uchar_t#* posig; |
| 422 | #if !SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 423 | uint16_t* iptr; |
| 424 | #endif |
| 425 | uint16_tcxx . . $ uint16_t# offset, shift, osize, pos, rbpos, wbpos, indx, nbits; |
| 426 | uint32_tcxx . . $ uint32_t# lval; |
| 427 | |
| 428 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (gv_local.lookup_454_sig_initialized); |
| 429 | |
| 430 | rbpos = 0; |
| 431 | offset = 0; |
| 432 | pesig = src; |
| 433 | |
| 434 | /* get magic and size of data |
| 435 | */ |
| 436 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pesig, &offset, rbpos, &magic, 1); |
| 437 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &osize, 1); |
| 438 | |
| 439 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`! || magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!); |
| 440 | |
| 441 | /* decompress zlib |
| 442 | */ |
| 443 | if (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`!) |
| 444 | { |
| 445 | shift = 3; /* magic + length */ |
| 446 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize + 100 ); |
| 447 | |
| 448 | if (_s_decompress_zlibcxx . . $ _s_decompress_zlib(8a3a8481beb8a97d).(posig, pesig+shift, (int)osize + 100, ssize-shift)) |
| 449 | return 1; |
| 450 | |
| 451 | rbpos = 0; /* read bit position */ |
| 452 | offset = 0; |
| 453 | ssize = osize; |
| 454 | pesig = posig; |
| 455 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pesig, &offset, rbpos, &magic, 1); |
| 456 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &osize, 1); |
| 457 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!); |
| 458 | } |
| 459 | |
| 460 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize ); |
| 461 | |
| 462 | /* decompress huffman |
| 463 | */ |
| 464 | pos = 0; |
| 465 | wbpos = 0; /* write bit position */ |
| 466 | while (pos < osize) |
| 467 | { |
| 468 | uint32_tcxx . . $ uint32_t# offset32 = offset; |
| 469 | if (ssize-offset > 4) nbits = 32; |
| 470 | else nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos; |
| 471 | |
| 472 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, nbits, &offset32, &rbpos, &lval, 0, (ssize << 3)); |
| 473 | offset = (uint16_tcxx . . $ uint16_t#)offset32; |
| 474 | |
| 475 | #if SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 476 | indx = gv_localcxx . . $ gv_local..rlookup_454_sigcxx . . $ SRALocal#rlookup_454_sig. [lval>>16]; |
| 477 | #else |
| 478 | iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_454_sig, |
| 479 | SIG_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_454_sig); |
| 480 | assert (iptr); |
| 481 | indx = *iptr; |
| 482 | #endif |
| 483 | |
| 484 | offset += ((rbpos+(uint16_tcxx . . $ uint16_t#)gv_localcxx . . $ gv_local..lookup_454_sigcxx . . $ SRALocal#lookup_454_sig.[indx].nbitscxx . . $ SRALookup#nbits.) >> 3); |
| 485 | rbpos = ((rbpos+(uint16_tcxx . . $ uint16_t#)gv_localcxx . . $ gv_local..lookup_454_sigcxx . . $ SRALocal#lookup_454_sig.[indx].nbitscxx . . $ SRALookup#nbits.) & 7); |
| 486 | |
| 487 | if (indx < SIG_MAX_POINTcxx . . $ `libs/sraxf/v0-decompress-local.h:65:9`!) |
| 488 | { |
| 489 | indx = bswap_16cxx . . $ bswap_16(a18c05e4017afb3d). (indx); |
| 490 | _put_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:160:9`! (indx, posig, &pos, wbpos); |
| 491 | } |
| 492 | else |
| 493 | { |
| 494 | uint16_tcxx . . $ uint16_t# val; |
| 495 | if ((int)nbits - (int)gv_localcxx . . $ gv_local..lookup_454_sigcxx . . $ SRALocal#lookup_454_sig.[indx].nbitscxx . . $ SRALookup#nbits. >= 16) |
| 496 | { |
| 497 | val = (uint16_tcxx . . $ uint16_t#)((lval >> (16-gv_localcxx . . $ gv_local..lookup_454_sigcxx . . $ SRALocal#lookup_454_sig.[indx].nbitscxx . . $ SRALookup#nbits.)) & 0xFFFF); |
| 498 | offset += 2; |
| 499 | } |
| 500 | else |
| 501 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &val, 1); |
| 502 | |
| 503 | val = bswap_16cxx . . $ bswap_16(a18c05e4017afb3d). (val); |
| 504 | _put_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:160:9`! (val, posig, &pos, wbpos); |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | /* crop size to osize */ |
| 509 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ( osize <= dst -> elem_count ); |
| 510 | KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4). ( dst, osize ); |
| 511 | |
| 512 | return 0; |
| 513 | } |
| 514 | |
| 515 | int sra_decompress_prb_slxcxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d). ( KDataBuffercxx . . $ KDataBuffer# *dst, KDataBuffercxx . . $ KDataBuffer# *alt, const void* src, int ssize ) |
| 516 | { |
| 517 | uchar_tcxx . . $ uchar_t# magic; |
| 518 | char byte; |
| 519 | char qmin, qmax; |
| 520 | const uchar_tcxx . . $ uchar_t#* peprb; |
| 521 | uchar_tcxx . . $ uchar_t#* poprb; |
| 522 | uint32_tcxx . . $ uint32_t# osize, offset, rbpos, pos; |
| 523 | uint16_tcxx . . $ uint16_t# fix_seq_len, shift; |
| 524 | |
| 525 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (gv_local.lookup_slx_prb_initialized); |
| 526 | |
| 527 | rbpos = 0; |
| 528 | offset = 0; |
| 529 | peprb = src; |
| 530 | |
| 531 | /* get magic and size of data |
| 532 | */ |
| 533 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (peprb, &offset, rbpos, &magic, 1); |
| 534 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (peprb, 32, &offset, &rbpos, &osize, 1, (ssize << 3)); |
| 535 | |
| 536 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`! || magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`! || magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`!); |
| 537 | |
| 538 | /* decompress zlib |
| 539 | */ |
| 540 | if (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`!) |
| 541 | { |
| 542 | shift = 5; /* magic + length */ |
| 543 | poprb = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize + 100); |
| 544 | if (_s_decompress_zlibcxx . . $ _s_decompress_zlib(8a3a8481beb8a97d).(poprb, peprb+shift, (int)osize + 100, ssize-shift)) |
| 545 | return 1; |
| 546 | |
| 547 | rbpos = 0; |
| 548 | offset = 0; |
| 549 | ssize = osize; |
| 550 | peprb = poprb; |
| 551 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (peprb, &offset, rbpos, &magic, 1); |
| 552 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (peprb, 32, &offset, &rbpos, &osize, 1, (ssize << 3)); |
| 553 | |
| 554 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`! || magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`!); |
| 555 | } |
| 556 | |
| 557 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (peprb, &offset, rbpos, &qmin, 1); |
| 558 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (peprb, &offset, rbpos, &qmax, 1); |
| 559 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (peprb, &offset, rbpos, &fix_seq_len, 1); |
| 560 | |
| 561 | poprb = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, osize+100); /** huffman decode can read too much ***/ |
| 562 | |
| 563 | /* decompress huffman |
| 564 | */ |
| 565 | if (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!) |
| 566 | { |
| 567 | #if !SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 568 | uchar_t* iptr; |
| 569 | #endif |
| 570 | uchar_tcxx . . $ uchar_t# indx; |
| 571 | unioncxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0# { char ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[4]; uint32_tcxx . . $ uint32_t# valcxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#val.; } uval; |
| 572 | uint32_tcxx . . $ uint32_t# lval; |
| 573 | |
| 574 | |
| 575 | pos = 0; |
| 576 | while (pos < osize) |
| 577 | { |
| 578 | if (offset > (uint32_tcxx . . $ uint32_t#)ssize) |
| 579 | return 1; |
| 580 | |
| 581 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (peprb, 4, &offset, &rbpos, &lval, 0, (ssize << 3)); |
| 582 | |
| 583 | #if SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 584 | indx = gv_localcxx . . $ gv_local..rlookup_slx_prbcxx . . $ SRALocal#rlookup_slx_prb. [lval>>24]; |
| 585 | #else |
| 586 | iptr = (uchar_t*) kbsearch (&lval, gv_local.idx_slx_prb, |
| 587 | PRB_SLX_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_slx_prb); |
| 588 | assert (iptr); |
| 589 | indx = *iptr; |
| 590 | #endif |
| 591 | |
| 592 | offset += ((rbpos+(uint16_tcxx . . $ uint16_t#)gv_localcxx . . $ gv_local..lookup_slx_prbcxx . . $ SRALocal#lookup_slx_prb.[indx].nbitscxx . . $ SRALookup#nbits.) >> 3); |
| 593 | rbpos = ((rbpos+(uint16_tcxx . . $ uint16_t#)gv_localcxx . . $ gv_local..lookup_slx_prbcxx . . $ SRALocal#lookup_slx_prb.[indx].nbitscxx . . $ SRALookup#nbits.) & 7); |
| 594 | |
| 595 | switch (indx) |
| 596 | { |
| 597 | case 0: /* max min min min */ |
| 598 | uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[3] = uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[2] = uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[1] = qmin; uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[0] = qmax; |
| 599 | break; |
| 600 | |
| 601 | case 1: /* -5 -5 -5 -5 */ |
| 602 | uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[3] = uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[2] = uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[1] = uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[0] = -5; |
| 603 | break; |
| 604 | |
| 605 | case 2: /* val -val min min */ |
| 606 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (peprb, 6, &offset, &rbpos, &lval, 1, (ssize << 3)); |
| 607 | byte = (char)(lval >> 26); /* only 6 bits are needed */ |
| 608 | uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[3] = uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[2] = qmin; uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[1] = -byte; uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[0] = byte; |
| 609 | break; |
| 610 | |
| 611 | case 3: /* val min -val min */ |
| 612 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (peprb, 6, &offset, &rbpos, &lval, 1, (ssize << 3)); |
| 613 | byte = (char)(lval >> 26); /* only 6 bits are needed */ |
| 614 | uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[3] = uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[1] = qmin; uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[2] = -byte; uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[0] = byte; |
| 615 | break; |
| 616 | |
| 617 | case 4: /* val min min -val */ |
| 618 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (peprb, 6, &offset, &rbpos, &lval, 1, (ssize << 3)); |
| 619 | byte = (char)(lval >> 26); /* only 6 bits are needed */ |
| 620 | uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[2] = uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[1] = qmin; uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[3] = -byte; uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[0] = byte; |
| 621 | break; |
| 622 | |
| 623 | case 5: |
| 624 | default: |
| 625 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (peprb, 32, &offset, &rbpos, (uint32_t *)&uval.c[0], 1, (ssize << 3)); |
| 626 | /*uval.val = lval*/; |
| 627 | break; |
| 628 | } |
| 629 | memmovecxx . . $ memmove(cc817cb175f282d). (poprb+pos, &uval.ccxx . . $ sra_decompress_prb_slx(7d0d1b8ee7ff5b4d).$anonymous_type_0#c.[0], sizeof(uint32_tcxx . . $ uint32_t#)); |
| 630 | pos += 4; |
| 631 | } |
| 632 | } |
| 633 | else |
| 634 | if (magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`!) |
| 635 | { |
| 636 | memmovecxx . . $ memmove(cc817cb175f282d). (poprb, peprb+9, osize); |
| 637 | } |
| 638 | |
| 639 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ( osize <= dst -> elem_count ); |
| 640 | KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4). ( dst, osize ); |
| 641 | |
| 642 | return 0; |
| 643 | } |
| 644 | |
| 645 | static void _s_decode_slxcxx . . $ _s_decode_slx(877f00551fb65637). (uchar_tcxx . . $ uchar_t# magic, const uchar_tcxx . . $ uchar_t#* pesig, uchar_tcxx . . $ uchar_t#* posig, uint32_tcxx . . $ uint32_t# osize, uint32_tcxx . . $ uint32_t# offset, uint32_tcxx . . $ uint32_t# rbpos, int ssize) |
| 646 | { |
| 647 | uint32_tcxx . . $ uint32_t# pos = 0; |
| 648 | uint16_tcxx . . $ uint16_t# fix_seq_len; |
| 649 | |
| 650 | if (magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!) |
| 651 | { |
| 652 | int32_tcxx . . $ int32_t# baseline = 0; |
| 653 | float fval; |
| 654 | uint16_tcxx . . $ uint16_t# uval; |
| 655 | |
| 656 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &fix_seq_len, 1); |
| 657 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &baseline, 1, (ssize << 3)); |
| 658 | |
| 659 | rbpos = 0; /* read bit position */ |
| 660 | |
| 661 | |
| 662 | while (pos < osize) |
| 663 | { |
| 664 | uval = 0; |
| 665 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &uval, 1); |
| 666 | fval = (float) (uval-baseline); |
| 667 | memmovecxx . . $ memmove(cc817cb175f282d). (posig+pos, &fval, sizeof(float)); |
| 668 | pos += sizeof(float); |
| 669 | } |
| 670 | } |
| 671 | else |
| 672 | if (magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`!) |
| 673 | { |
| 674 | unioncxx . . $ _s_decode_slx(877f00551fb65637).$anonymous_type_1# { float fvalcxx . . $ _s_decode_slx(877f00551fb65637).$anonymous_type_1#fval.; uint32_tcxx . . $ uint32_t# uvalcxx . . $ _s_decode_slx(877f00551fb65637).$anonymous_type_1#uval.; } uf; |
| 675 | float fval; |
| 676 | float fmin; |
| 677 | short sval; |
| 678 | |
| 679 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &fix_seq_len, 1); |
| 680 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &sval, 1); |
| 681 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &uf.uval, 1, (ssize << 3)); |
| 682 | |
| 683 | fmin = (float) sval; |
| 684 | rbpos = 0; /* read bit position */ |
| 685 | |
| 686 | |
| 687 | while (pos < osize) |
| 688 | { |
| 689 | sval = 0; |
| 690 | fval = uf.fvalcxx . . $ _s_decode_slx(877f00551fb65637).$anonymous_type_1#fval.; |
| 691 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &sval, 1); |
| 692 | fval *= sval; fval += fmin; |
| 693 | memmovecxx . . $ memmove(cc817cb175f282d). (posig+pos, &fval, sizeof(float)); |
| 694 | pos += sizeof(float); |
| 695 | } |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | int sra_decompress_sig_slxcxx . . $ sra_decompress_sig_slx(7d0d1b8ee7ff5b4d). ( KDataBuffercxx . . $ KDataBuffer# *dst, KDataBuffercxx . . $ KDataBuffer# *alt, const void* src, int ssize ) |
| 700 | { |
| 701 | uchar_tcxx . . $ uchar_t# magic; |
| 702 | const uchar_tcxx . . $ uchar_t#* pesig; |
| 703 | uchar_tcxx . . $ uchar_t#* posig; |
| 704 | #if !SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 705 | uint16_t* iptr; |
| 706 | #endif |
| 707 | uint16_tcxx . . $ uint16_t# indx, fix_seq_len, shift; |
| 708 | uint32_tcxx . . $ uint32_t# pos, rbpos, wbpos, nbits; |
| 709 | uint32_tcxx . . $ uint32_t# offset, osize, lval; |
| 710 | unioncxx . . $ sra_decompress_sig_slx(7d0d1b8ee7ff5b4d).$anonymous_type_2# { float fvalcxx . . $ sra_decompress_sig_slx(7d0d1b8ee7ff5b4d).$anonymous_type_2#fval.; uint32_tcxx . . $ uint32_t# uvalcxx . . $ sra_decompress_sig_slx(7d0d1b8ee7ff5b4d).$anonymous_type_2#uval.; } sim, snm; /* minimum level of signal and noise */ |
| 711 | |
| 712 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (gv_local.lookup_slx_sig_initialized); |
| 713 | |
| 714 | rbpos = 0; |
| 715 | offset = 0; |
| 716 | pesig = src; |
| 717 | |
| 718 | /* get magic and size of data |
| 719 | */ |
| 720 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pesig, &offset, rbpos, &magic, 1); |
| 721 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3)); |
| 722 | |
| 723 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`! || magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`! || |
| 724 | magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`! || |
| 725 | magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!); |
| 726 | |
| 727 | /* decompress zlib |
| 728 | */ |
| 729 | if (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`!) |
| 730 | { |
| 731 | shift = 5; /* magic + length */ |
| 732 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize + 100 ); |
| 733 | |
| 734 | if (_s_decompress_zlibcxx . . $ _s_decompress_zlib(8a3a8481beb8a97d).(posig, pesig+shift, (int)osize + 100, ssize-shift)) |
| 735 | return 1; |
| 736 | |
| 737 | rbpos = 0; /* read bit position */ |
| 738 | offset = 0; |
| 739 | ssize = osize; |
| 740 | pesig = posig; |
| 741 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pesig, &offset, rbpos, &magic, 1); |
| 742 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3)); |
| 743 | |
| 744 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`! || magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || |
| 745 | magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`! || magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!); |
| 746 | } |
| 747 | |
| 748 | /* decompress huffman |
| 749 | */ |
| 750 | if (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!) |
| 751 | { |
| 752 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &fix_seq_len, 1); |
| 753 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &sim.uval, 1, (ssize << 3)); |
| 754 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &snm.uval, 1, (ssize << 3)); |
| 755 | |
| 756 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ((osize&3) == 0); /* make shure it can be devided by 4 */ |
| 757 | |
| 758 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, osize); |
| 759 | |
| 760 | pos = 0; |
| 761 | wbpos = 0; /* write bit position */ |
| 762 | |
| 763 | while (pos < osize) |
| 764 | { |
| 765 | if (ssize-offset > 4) nbits = 32; |
| 766 | else nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos; |
| 767 | |
| 768 | if (offset > (uint32_tcxx . . $ uint32_t#)ssize) |
| 769 | return 1; |
| 770 | |
| 771 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, nbits, &offset, &rbpos, &lval, 0, (ssize << 3)); |
| 772 | |
| 773 | #if SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 774 | indx = gv_localcxx . . $ gv_local..rlookup_slx_sigcxx . . $ SRALocal#rlookup_slx_sig. [lval>>16]; |
| 775 | #else |
| 776 | iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_slx_sig, |
| 777 | SIG_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_slx_sig); |
| 778 | assert (iptr); |
| 779 | indx = *iptr; |
| 780 | #endif |
| 781 | |
| 782 | offset += ((rbpos+(uint32_tcxx . . $ uint32_t#)gv_localcxx . . $ gv_local..lookup_slx_sigcxx . . $ SRALocal#lookup_slx_sig.[indx].nbitscxx . . $ SRALookup#nbits.) >> 3); |
| 783 | rbpos = ((rbpos+(uint32_tcxx . . $ uint32_t#)gv_localcxx . . $ gv_local..lookup_slx_sigcxx . . $ SRALocal#lookup_slx_sig.[indx].nbitscxx . . $ SRALookup#nbits.) & 7); |
| 784 | |
| 785 | if (indx < SIG_MAX_POINTcxx . . $ `libs/sraxf/v0-decompress-local.h:65:9`!) |
| 786 | { |
| 787 | indx = bswap_16cxx . . $ bswap_16(a18c05e4017afb3d). ((uint16_tcxx . . $ uint16_t#)(indx-SIG_MID_POINTcxx . . $ `libs/sraxf/v0-decompress-local.h:64:9`!)); |
| 788 | _put_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:160:9`! (indx, posig, &pos, wbpos); |
| 789 | } |
| 790 | else |
| 791 | { |
| 792 | uint16_tcxx . . $ uint16_t# val; |
| 793 | if ((int)nbits - (int)gv_localcxx . . $ gv_local..lookup_slx_sigcxx . . $ SRALocal#lookup_slx_sig.[indx].nbitscxx . . $ SRALookup#nbits. >= 16) |
| 794 | { |
| 795 | val = (short)((lval >> (16-gv_localcxx . . $ gv_local..lookup_slx_sigcxx . . $ SRALocal#lookup_slx_sig.[indx].nbitscxx . . $ SRALookup#nbits.)) & 0xFFFF); |
| 796 | offset += 2; |
| 797 | } |
| 798 | else |
| 799 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &val, 1); |
| 800 | |
| 801 | val = bswap_16cxx . . $ bswap_16(a18c05e4017afb3d). (val); |
| 802 | _put_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:160:9`! (val, posig, &pos, wbpos); |
| 803 | } |
| 804 | } |
| 805 | |
| 806 | _s_undelta_4_channelcxx . . $ _s_undelta_4_channel(b72bcd91d3e2311e). (fix_seq_len, sizeof(uint16_tcxx . . $ uint16_t#), posig, osize); |
| 807 | |
| 808 | pesig = posig; |
| 809 | ssize = osize; |
| 810 | osize = osize << 1; |
| 811 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize ); |
| 812 | |
| 813 | _s_exponent_4_channelcxx . . $ _s_exponent_4_channel(846b19f8bc6820f5). (fix_seq_len, posig, osize, pesig, ssize, sim.fvalcxx . . $ sra_decompress_sig_slx(7d0d1b8ee7ff5b4d).$anonymous_type_2#fval., snm.fvalcxx . . $ sra_decompress_sig_slx(7d0d1b8ee7ff5b4d).$anonymous_type_2#fval.); |
| 814 | } |
| 815 | else |
| 816 | if (magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`! || magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!) |
| 817 | { |
| 818 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ((osize&3) == 0); /* make shure it can be devided by 4 */ |
| 819 | osize *= 2; /* desination size is 4 bytes per channel, but the original is 2 */ |
| 820 | |
| 821 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize ); |
| 822 | |
| 823 | _s_decode_slxcxx . . $ _s_decode_slx(877f00551fb65637). (magic, pesig, posig, osize, offset, rbpos, ssize); |
| 824 | } |
| 825 | |
| 826 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ( osize <= dst -> elem_count ); |
| 827 | KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4). ( dst, osize ); |
| 828 | |
| 829 | return 0; |
| 830 | } |
| 831 | |
| 832 | int sra_decompress_intcxx . . $ sra_decompress_int(7d0d1b8ee7ff5b4d). ( KDataBuffercxx . . $ KDataBuffer# *dst, KDataBuffercxx . . $ KDataBuffer# *alt, const void* src, int ssize ) |
| 833 | { |
| 834 | uchar_tcxx . . $ uchar_t# magic; |
| 835 | const uchar_tcxx . . $ uchar_t#* pesig; |
| 836 | uchar_tcxx . . $ uchar_t#* posig; |
| 837 | #if !SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 838 | uint16_t* iptr; |
| 839 | #endif |
| 840 | uint16_tcxx . . $ uint16_t# indx, fix_seq_len, shift; |
| 841 | uint32_tcxx . . $ uint32_t# pos, rbpos, wbpos, nbits; |
| 842 | uint32_tcxx . . $ uint32_t# offset, osize, lval; |
| 843 | unioncxx . . $ sra_decompress_int(7d0d1b8ee7ff5b4d).$anonymous_type_3# { float fvalcxx . . $ sra_decompress_int(7d0d1b8ee7ff5b4d).$anonymous_type_3#fval.; uint32_tcxx . . $ uint32_t# uvalcxx . . $ sra_decompress_int(7d0d1b8ee7ff5b4d).$anonymous_type_3#uval.; } sim, snm; /* minimum level of signal and noise */ |
| 844 | |
| 845 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (gv_local.lookup_slx_int_initialized); |
| 846 | |
| 847 | rbpos = 0; |
| 848 | offset = 0; |
| 849 | pesig = src; |
| 850 | |
| 851 | /* get magic and size of data |
| 852 | */ |
| 853 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pesig, &offset, rbpos, &magic, 1); |
| 854 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3)); |
| 855 | |
| 856 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`! || magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`! || |
| 857 | magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`! || |
| 858 | magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!); |
| 859 | |
| 860 | /* decompress zlib |
| 861 | */ |
| 862 | if (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`!) |
| 863 | { |
| 864 | shift = 5; /* magic + length */ |
| 865 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize + 100 ); |
| 866 | |
| 867 | if (_s_decompress_zlibcxx . . $ _s_decompress_zlib(8a3a8481beb8a97d).(posig, pesig+shift, (int)osize + 100, ssize-shift)) |
| 868 | return 1; |
| 869 | |
| 870 | rbpos = 0; /* read bit position */ |
| 871 | offset = 0; |
| 872 | ssize = osize; |
| 873 | pesig = posig; |
| 874 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pesig, &offset, rbpos, &magic, 1); |
| 875 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3)); |
| 876 | |
| 877 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`! || magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || |
| 878 | magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`! || magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!); |
| 879 | } |
| 880 | |
| 881 | /* decompress huffman |
| 882 | */ |
| 883 | if (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!) |
| 884 | { |
| 885 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &fix_seq_len, 1); |
| 886 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &sim.uval, 1, (ssize << 3)); |
| 887 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &snm.uval, 1, (ssize << 3)); |
| 888 | |
| 889 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ((osize&3) == 0); /* make shure it can be devided by 4 */ |
| 890 | |
| 891 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, osize); |
| 892 | |
| 893 | pos = 0; |
| 894 | wbpos = 0; /* write bit position */ |
| 895 | |
| 896 | while (pos < osize) |
| 897 | { |
| 898 | if (ssize-offset > 4) nbits = 32; |
| 899 | else nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos; |
| 900 | |
| 901 | if (offset > (uint32_tcxx . . $ uint32_t#)ssize) |
| 902 | return 1; |
| 903 | |
| 904 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, nbits, &offset, &rbpos, &lval, 0, (ssize << 3)); |
| 905 | |
| 906 | #if SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 907 | indx = gv_localcxx . . $ gv_local..rlookup_slx_intcxx . . $ SRALocal#rlookup_slx_int. [lval>>16]; |
| 908 | #else |
| 909 | iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_slx_int, |
| 910 | INT_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_slx_int); |
| 911 | assert (iptr); |
| 912 | indx = *iptr; |
| 913 | #endif |
| 914 | |
| 915 | offset += ((rbpos+(uint32_tcxx . . $ uint32_t#)gv_localcxx . . $ gv_local..lookup_slx_intcxx . . $ SRALocal#lookup_slx_int.[indx].nbitscxx . . $ SRALookup#nbits.) >> 3); |
| 916 | rbpos = ((rbpos+(uint32_tcxx . . $ uint32_t#)gv_localcxx . . $ gv_local..lookup_slx_intcxx . . $ SRALocal#lookup_slx_int.[indx].nbitscxx . . $ SRALookup#nbits.) & 7); |
| 917 | |
| 918 | if (indx < INT_MAX_POINTcxx . . $ `libs/sraxf/v0-decompress-local.h:67:9`!) |
| 919 | { |
| 920 | indx = bswap_16cxx . . $ bswap_16(a18c05e4017afb3d). ((uint16_tcxx . . $ uint16_t#)(indx-INT_MID_POINTcxx . . $ `libs/sraxf/v0-decompress-local.h:66:9`!)); |
| 921 | _put_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:160:9`! (indx, posig, &pos, wbpos); |
| 922 | } |
| 923 | else |
| 924 | { |
| 925 | uint16_tcxx . . $ uint16_t# val; |
| 926 | if ((int)nbits - (int)gv_localcxx . . $ gv_local..lookup_slx_intcxx . . $ SRALocal#lookup_slx_int.[indx].nbitscxx . . $ SRALookup#nbits. >= 16) |
| 927 | { |
| 928 | val = (short)((lval >> (16-gv_localcxx . . $ gv_local..lookup_slx_intcxx . . $ SRALocal#lookup_slx_int.[indx].nbitscxx . . $ SRALookup#nbits.)) & 0xFFFF); |
| 929 | offset += 2; |
| 930 | } |
| 931 | else |
| 932 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &val, 1); |
| 933 | |
| 934 | val = bswap_16cxx . . $ bswap_16(a18c05e4017afb3d). (val); |
| 935 | _put_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:160:9`! (val, posig, &pos, wbpos); |
| 936 | } |
| 937 | } |
| 938 | |
| 939 | _s_undelta_4_channelcxx . . $ _s_undelta_4_channel(b72bcd91d3e2311e). (fix_seq_len, sizeof(uint16_tcxx . . $ uint16_t#), posig, osize); |
| 940 | |
| 941 | pesig = posig; |
| 942 | ssize = osize; |
| 943 | osize = osize << 1; |
| 944 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, osize); |
| 945 | |
| 946 | _s_exponent_4_channelcxx . . $ _s_exponent_4_channel(846b19f8bc6820f5). (fix_seq_len, posig, osize, pesig, ssize, sim.fvalcxx . . $ sra_decompress_int(7d0d1b8ee7ff5b4d).$anonymous_type_3#fval., snm.fvalcxx . . $ sra_decompress_int(7d0d1b8ee7ff5b4d).$anonymous_type_3#fval.); |
| 947 | } |
| 948 | else |
| 949 | if (magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`! || magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!) |
| 950 | { |
| 951 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ((osize&3) == 0); /* make shure it can be devided by 4 */ |
| 952 | osize *= 2; /* desination size is 4 bytes per channel, but the original is 2 */ |
| 953 | |
| 954 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, osize); |
| 955 | |
| 956 | _s_decode_slxcxx . . $ _s_decode_slx(877f00551fb65637). (magic, pesig, posig, osize, offset, rbpos, ssize); |
| 957 | } |
| 958 | |
| 959 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ( osize <= dst -> elem_count ); |
| 960 | KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4). ( dst, osize ); |
| 961 | |
| 962 | return 0; |
| 963 | } |
| 964 | |
| 965 | int sra_decompress_nsecxx . . $ sra_decompress_nse(7d0d1b8ee7ff5b4d). ( KDataBuffercxx . . $ KDataBuffer# *dst, KDataBuffercxx . . $ KDataBuffer# *alt, const void* src, int ssize ) |
| 966 | { |
| 967 | uchar_tcxx . . $ uchar_t# magic; |
| 968 | const uchar_tcxx . . $ uchar_t#* pesig; |
| 969 | uchar_tcxx . . $ uchar_t#* posig; |
| 970 | #if !SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 971 | uint16_t* iptr; |
| 972 | #endif |
| 973 | uint16_tcxx . . $ uint16_t# indx, fix_seq_len, shift; |
| 974 | uint32_tcxx . . $ uint32_t# pos, rbpos, wbpos, nbits; |
| 975 | uint32_tcxx . . $ uint32_t# offset, osize, lval; |
| 976 | unioncxx . . $ sra_decompress_nse(7d0d1b8ee7ff5b4d).$anonymous_type_4# { float fvalcxx . . $ sra_decompress_nse(7d0d1b8ee7ff5b4d).$anonymous_type_4#fval.; uint32_tcxx . . $ uint32_t# uvalcxx . . $ sra_decompress_nse(7d0d1b8ee7ff5b4d).$anonymous_type_4#uval.; } sim, snm; /* minimum level of signal and noise */ |
| 977 | |
| 978 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (gv_local.lookup_slx_nse_initialized); |
| 979 | |
| 980 | rbpos = 0; |
| 981 | offset = 0; |
| 982 | pesig = src; |
| 983 | |
| 984 | /* get magic and size of data |
| 985 | */ |
| 986 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pesig, &offset, rbpos, &magic, 1); |
| 987 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3)); |
| 988 | |
| 989 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`! || magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`! || |
| 990 | magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`! || |
| 991 | magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!); |
| 992 | |
| 993 | /* decompress zlib |
| 994 | */ |
| 995 | if (magic == SRA_CT_ZLIBcxx . . $ `libs/sraxf/v0-decompress.h:39:9`!) |
| 996 | { |
| 997 | shift = 5; /* magic + length */ |
| 998 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). ( dst, alt, osize + 100 ); |
| 999 | |
| 1000 | if (_s_decompress_zlibcxx . . $ _s_decompress_zlib(8a3a8481beb8a97d).(posig, pesig+shift, (int)osize + 100, ssize-shift)) |
| 1001 | return 1; |
| 1002 | |
| 1003 | rbpos = 0; /* read bit position */ |
| 1004 | offset = 0; |
| 1005 | ssize = osize; |
| 1006 | pesig = posig; |
| 1007 | _get_bytecxx . . $ `libs/sraxf/v0-decompress-local.h:186:9`! (pesig, &offset, rbpos, &magic, 1); |
| 1008 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &osize, 1, (ssize << 3)); |
| 1009 | |
| 1010 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`! || magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || |
| 1011 | magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`! || magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!); |
| 1012 | } |
| 1013 | |
| 1014 | /* decompress huffman |
| 1015 | */ |
| 1016 | if (magic == SRA_CT_HUFFMANcxx . . $ `libs/sraxf/v0-decompress.h:38:9`!) |
| 1017 | { |
| 1018 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &fix_seq_len, 1); |
| 1019 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &sim.uval, 1, (ssize << 3)); |
| 1020 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, 32, &offset, &rbpos, &snm.uval, 1, (ssize << 3)); |
| 1021 | |
| 1022 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ((osize&3) == 0); /* make shure it can be devided by 4 */ |
| 1023 | |
| 1024 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, osize); |
| 1025 | |
| 1026 | /* decompress huffman |
| 1027 | */ |
| 1028 | pos = 0; |
| 1029 | wbpos = 0; /* write bit position */ |
| 1030 | |
| 1031 | while (pos < osize) |
| 1032 | { |
| 1033 | if (ssize-offset > 4) nbits = 32; |
| 1034 | else nbits = ((ssize-offset)==4?32:((ssize-offset)==3?24:((ssize-offset)==2?16:8)))-rbpos; |
| 1035 | |
| 1036 | if (offset > (uint32_tcxx . . $ uint32_t#)ssize) |
| 1037 | return 1; |
| 1038 | |
| 1039 | _get_longcxx . . $ `libs/sraxf/v0-decompress-local.h:224:9`! (pesig, nbits, &offset, &rbpos, &lval, 0, (ssize << 3)); |
| 1040 | |
| 1041 | #if SRA_DECOMPRESS_USE_REVERSE_LOOKUPcxx . . $ `libs/sraxf/v0-decompress-local.h:34:9`! |
| 1042 | indx = gv_localcxx . . $ gv_local..rlookup_slx_nsecxx . . $ SRALocal#rlookup_slx_nse. [lval>>16]; |
| 1043 | #else |
| 1044 | iptr = (uint16_t*) kbsearch (&lval, gv_local.idx_slx_nse, |
| 1045 | NSE_HUFF_TREESIZE, sizeof(uint16_t), _s_cmp_key, gv_local.lookup_slx_nse); |
| 1046 | assert (iptr); |
| 1047 | indx = *iptr; |
| 1048 | #endif |
| 1049 | |
| 1050 | offset += ((rbpos+(uint32_tcxx . . $ uint32_t#)gv_localcxx . . $ gv_local..lookup_slx_nsecxx . . $ SRALocal#lookup_slx_nse.[indx].nbitscxx . . $ SRALookup#nbits.) >> 3); |
| 1051 | rbpos = ((rbpos+(uint32_tcxx . . $ uint32_t#)gv_localcxx . . $ gv_local..lookup_slx_nsecxx . . $ SRALocal#lookup_slx_nse.[indx].nbitscxx . . $ SRALookup#nbits.) & 7); |
| 1052 | |
| 1053 | if (indx < NSE_MAX_POINTcxx . . $ `libs/sraxf/v0-decompress-local.h:69:9`!) |
| 1054 | { |
| 1055 | indx = bswap_16cxx . . $ bswap_16(a18c05e4017afb3d). ((uint16_tcxx . . $ uint16_t#)(indx-NSE_MID_POINTcxx . . $ `libs/sraxf/v0-decompress-local.h:68:9`!)); |
| 1056 | _put_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:160:9`! (indx, posig, &pos, wbpos); |
| 1057 | } |
| 1058 | else |
| 1059 | { |
| 1060 | uint16_tcxx . . $ uint16_t# val; |
| 1061 | if ((int)nbits - (int)gv_localcxx . . $ gv_local..lookup_slx_intcxx . . $ SRALocal#lookup_slx_int.[indx].nbitscxx . . $ SRALookup#nbits. >= 16) |
| 1062 | { |
| 1063 | val = (short)((lval >> (16-gv_localcxx . . $ gv_local..lookup_slx_nsecxx . . $ SRALocal#lookup_slx_nse.[indx].nbitscxx . . $ SRALookup#nbits.)) & 0xFFFF); |
| 1064 | offset += 2; |
| 1065 | } |
| 1066 | else |
| 1067 | _get_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:201:9`! (pesig, &offset, rbpos, &val, 1); |
| 1068 | |
| 1069 | val = bswap_16cxx . . $ bswap_16(a18c05e4017afb3d). (val); |
| 1070 | _put_shortcxx . . $ `libs/sraxf/v0-decompress-local.h:160:9`! (val, posig, &pos, wbpos); |
| 1071 | } |
| 1072 | } |
| 1073 | |
| 1074 | _s_undelta_4_channelcxx . . $ _s_undelta_4_channel(b72bcd91d3e2311e). (fix_seq_len, sizeof(uint16_tcxx . . $ uint16_t#), posig, osize); |
| 1075 | |
| 1076 | pesig = posig; |
| 1077 | ssize = osize; |
| 1078 | osize = osize << 1; |
| 1079 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, osize); |
| 1080 | |
| 1081 | _s_exponent_4_channelcxx . . $ _s_exponent_4_channel(846b19f8bc6820f5). (fix_seq_len, posig, osize, pesig, ssize, sim.fvalcxx . . $ sra_decompress_nse(7d0d1b8ee7ff5b4d).$anonymous_type_4#fval., snm.fvalcxx . . $ sra_decompress_nse(7d0d1b8ee7ff5b4d).$anonymous_type_4#fval.); |
| 1082 | } |
| 1083 | else |
| 1084 | if (magic == SRA_CT_UNCOMPRESSEDcxx . . $ `libs/sraxf/v0-decompress.h:37:9`! || magic == SRA_CT_NORMALIZEDcxx . . $ `libs/sraxf/v0-decompress.h:41:9`! || magic == SRA_CT_BASELINEDcxx . . $ `libs/sraxf/v0-decompress.h:42:9`!) |
| 1085 | { |
| 1086 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ((osize&3) == 0); /* make shure it can be devided by 4 */ |
| 1087 | osize *= 2; /* desination size is 4 bytes per channel, but the original is 2 */ |
| 1088 | |
| 1089 | posig = sra_alloccxx . . $ sra_alloc(834b9c59edf919a7). (dst, alt, osize); |
| 1090 | |
| 1091 | _s_decode_slxcxx . . $ _s_decode_slx(877f00551fb65637). (magic, pesig, posig, osize, offset, rbpos, ssize); |
| 1092 | } |
| 1093 | |
| 1094 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`! ( osize <= dst -> elem_count ); |
| 1095 | KDataBufferResizecxx . . $ KDataBufferResize(daabdf243431d3e4). ( dst, osize ); |
| 1096 | |
| 1097 | return 0; |
| 1098 | } |
| 1099 |