ROHC compression/decompression library
wlsb.h
Go to the documentation of this file.
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 wlsb.h
00019  * @brief Window-based Least Significant Bits (W-LSB) encoding
00020  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
00021  * @author David Moreau from TAS
00022  * @author The hackers from ROHC for Linux
00023  */
00024 
00025 #ifndef WLSB_H
00026 #define WLSB_H
00027 
00028 #include "interval.h" /* for rohc_lsb_shift_t */
00029 #include "dllexport.h"
00030 
00031 #include <stdlib.h>
00032 #include <stdint.h>
00033 #include <stdbool.h>
00034 
00035 
00036 /// Default window width for W-LSB encoding
00037 #define C_WINDOW_WIDTH 4
00038 
00039 /* The definition of the W-LSB encoding object is private */
00040 struct c_wlsb;
00041 
00042 
00043 /*
00044  * Public function prototypes:
00045  */
00046 
00047 struct c_wlsb * ROHC_EXPORT c_create_wlsb(const size_t bits,
00048                                           const size_t window_width,
00049                                           const rohc_lsb_shift_t p);
00050 void ROHC_EXPORT c_destroy_wlsb(struct c_wlsb *s);
00051 
00052 void ROHC_EXPORT c_add_wlsb(struct c_wlsb *const wlsb,
00053                             const uint32_t sn,
00054                             const uint32_t value);
00055 
00056 bool ROHC_EXPORT wlsb_get_k_16bits(const struct c_wlsb *const wlsb,
00057                                    const uint16_t value,
00058                                    size_t *const bits_nr);
00059 bool ROHC_EXPORT wlsb_get_k_32bits(const struct c_wlsb *const wlsb,
00060                                    const uint32_t value,
00061                                    size_t *const bits_nr);
00062 
00063 void ROHC_EXPORT c_ack_sn_wlsb(struct c_wlsb *s, const uint32_t sn);
00064 
00065 int ROHC_EXPORT c_sum_wlsb(struct c_wlsb *s);
00066 int ROHC_EXPORT c_mean_wlsb(struct c_wlsb *s);
00067 
00068 #endif
00069