;+ ;FUNCTION: ; MVN_SWIA_PACKET_DECOMPRESS ;PURPOSE: ; Function to decompress a compressed telemetry packet. ; Adaptation of Davin's IDL adaptation of PRH's C code for packet including header. ; Contains a bunch of functions for manipulating individual bits and bytes. ;AUTHOR: ; Jasper Halekas ;CALLING SEQUENCE: ; Result = MVN_SWIA_PACKET_DECOMPRESS(Bfr) ;INPUTS: ; Bfr: The compressed packet (bytes), including CCSDS header ;OUTPUTS: ; Returns the uncompressed packet (bytes), including header, length field updated ; ; $LastChangedBy: jhalekas $ ; $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $ ; $LastChangedRevision: 12551 $ ; $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/idl_socware/trunk/projects/maven/swia/mvn_swia_packet_decompress.pro $ ; ;- function mvn_pfdpu_getbit,bfr,bitinx inx = bitinx / 8 bit = bitinx mod 8 bmask = [128b,64b,32b,16b,8b,4b,2b,1b] bitinx++ return , (bfr[Inx] and bmask[bit]) ne 0 end function mvn_pfdpu_GetBits,bfr,bitinx, leng if leng gt (n_elements(bfr)*8 - bitinx) then begin return,0 endif r=0 for i=0,leng-1 do begin ; for(i=0;i