ROHC compression/decompression library
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 2 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * This program is distributed in the hope that it will be useful, 00008 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 * GNU General Public License for more details. 00011 * 00012 * You should have received a copy of the GNU General Public License 00013 * along with this program; if not, write to the Free Software 00014 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00015 */ 00016 00017 /** 00018 * @file lsb.h 00019 * @brief Least Significant Bits (LSB) encoding 00020 * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com> 00021 * @author The hackers from ROHC for Linux 00022 */ 00023 00024 #ifndef LSB_H 00025 #define LSB_H 00026 00027 #include <stdlib.h> 00028 #include <stdint.h> 00029 00030 00031 /** 00032 * @brief Least Significant Bits decoding object 00033 */ 00034 struct d_lsb_decode 00035 { 00036 /// The current reference value 00037 uint32_t v_ref_d; 00038 /// The previous reference value 00039 uint32_t old_v_ref_d; 00040 /// The p shift parameter (see 4.5.1 in the RFC 3095) 00041 short p; 00042 }; 00043 00044 00045 /* 00046 * Function prototypes 00047 */ 00048 00049 void d_lsb_init(struct d_lsb_decode *const lsb, 00050 const uint32_t v_ref_d, 00051 const short p); 00052 00053 int d_lsb_decode32(const struct d_lsb_decode *const lsb, 00054 const uint32_t m, 00055 const size_t k, 00056 uint32_t *const decoded); 00057 int d_lsb_decode16(const struct d_lsb_decode *const lsb, 00058 const uint16_t m, 00059 const size_t k, 00060 uint16_t *const decoded); 00061 00062 void d_lsb_update(struct d_lsb_decode *const lsb, const uint32_t v_ref_d); 00063 00064 void d_lsb_sync_ref(struct d_lsb_decode *const lsb); 00065 00066 uint32_t d_get_lsb_ref(struct d_lsb_decode *const lsb); 00067 uint32_t d_get_lsb_old_ref(struct d_lsb_decode *const lsb); 00068 00069 #endif 00070