;+
; NAME:
; 	RESTORE_FFI	
; PURPOSE:
;       Restore a low-8 image by reference to a compressed image	
; CALLING SEQUENCE:
;	img = restore_ffi(low8,comp) returns a corrected image that uses
;	  a compressed image (comp) to reference the low-8 image (low8).
; WRITTEN:
;	HSH, March 25, 1992 
;-
function restore_ffi,low8,comp
;
de_comp = sxt_decomp(comp)
gain = de_comp/256
rest = gain*256 + low8 
;
; find the discrepancies and correct them
;
diff = rest - de_comp
highs = where(diff gt 128, n_highs)
lows  = where(diff lt -128, n_lows)
if n_highs ne 0 then rest(highs) = rest(highs) - 256
if n_lows ne 0 then rest(lows)  = rest(lows)  + 256
return, rest
end
