ROHC compression/decompression library
wlsb.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2011,2012,2013 Didier Barvaux
00003  * Copyright 2007,2009,2010 Viveris Technologies
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 /**
00021  * @file   src/comp/schemes/wlsb.h
00022  * @brief  Window-based Least Significant Bits (W-LSB) encoding
00023  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
00024  * @author David Moreau from TAS
00025  */
00026 
00027 #ifndef ROHC_COMP_SCHEMES_WLSB_H
00028 #define ROHC_COMP_SCHEMES_WLSB_H
00029 
00030 #include "interval.h" /* for rohc_lsb_shift_t */
00031 #include "dllexport.h"
00032 
00033 #include <stdlib.h>
00034 #include <stdint.h>
00035 #include <stdbool.h>
00036 
00037 
00038 /* The definition of the W-LSB encoding object is private */
00039 struct c_wlsb;
00040 
00041 
00042 /*
00043  * Public function prototypes:
00044  */
00045 
00046 struct c_wlsb * ROHC_EXPORT c_create_wlsb(const size_t bits,
00047                                           const size_t window_width,
00048                                           const rohc_lsb_shift_t p)
00049         __attribute__((warn_unused_result));
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         __attribute__((warn_unused_result, nonnull(1, 3)));
00060 bool ROHC_EXPORT wlsb_get_k_32bits(const struct c_wlsb *const wlsb,
00061                                    const uint32_t value,
00062                                    size_t *const bits_nr)
00063         __attribute__((warn_unused_result, nonnull(1, 3)));
00064 bool ROHC_EXPORT wlsb_get_kp_32bits(const struct c_wlsb *const wlsb,
00065                                     const uint32_t value,
00066                                     const rohc_lsb_shift_t p,
00067                                     size_t *const bits_nr)
00068         __attribute__((warn_unused_result, nonnull(1, 4)));
00069 
00070 void ROHC_EXPORT c_ack_sn_wlsb(struct c_wlsb *const s, const uint32_t sn)
00071         __attribute__((nonnull(1)));
00072 
00073 #endif
00074