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,2013 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   decomp/schemes/wlsb.h
00022  * @brief  Window-based Least Significant Bits (W-LSB) decoding
00023  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
00024  * @author Didier Barvaux <didier@barvaux.org>
00025  */
00026 
00027 #ifndef ROHC_DECOMP_SCHEMES_WLSB_H
00028 #define ROHC_DECOMP_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 <stddef.h>
00036 #ifdef __KERNEL__
00037 #       include <linux/types.h>
00038 #else
00039 #       include <stdbool.h>
00040 #endif
00041 
00042 
00043 /* The definition of the Least Significant Bits decoding object is private */
00044 struct rohc_lsb_decode;
00045 
00046 
00047 /** The different reference values for LSB decoding */
00048 typedef enum
00049 {
00050         ROHC_LSB_REF_MINUS_1 = 0,  /**< Use the 'ref -1' reference value */
00051         ROHC_LSB_REF_0       = 1,  /**< Use the 'ref 0' reference value */
00052         ROHC_LSB_REF_MAX           /**< The number of different reference values */
00053 
00054 } rohc_lsb_ref_t;
00055 
00056 
00057 
00058 /*
00059  * Function prototypes
00060  */
00061 
00062 struct rohc_lsb_decode * ROHC_EXPORT rohc_lsb_new(const rohc_lsb_shift_t p,
00063                                                                                                                                   const size_t max_len)
00064         __attribute__((warn_unused_result));
00065 
00066 void ROHC_EXPORT rohc_lsb_free(struct rohc_lsb_decode *const lsb);
00067 
00068 rohc_lsb_shift_t ROHC_EXPORT lsb_get_p(const struct rohc_lsb_decode *const lsb)
00069         __attribute__((warn_unused_result, nonnull(1), pure));
00070 
00071 bool ROHC_EXPORT rohc_lsb_decode(const struct rohc_lsb_decode *const lsb,
00072                                  const rohc_lsb_ref_t ref_type,
00073                                  const uint32_t v_ref_d_offset,
00074                                  const uint32_t m,
00075                                  const size_t k,
00076                                  const rohc_lsb_shift_t p,
00077                                  uint32_t *const decoded)
00078         __attribute__((warn_unused_result, nonnull(1, 7)));
00079 
00080 void ROHC_EXPORT rohc_lsb_set_ref(struct rohc_lsb_decode *const lsb,
00081                                   const uint32_t v_ref_d,
00082                                   const bool keep_ref_minus_1)
00083         __attribute__((nonnull(1)));
00084 
00085 uint32_t ROHC_EXPORT rohc_lsb_get_ref(const struct rohc_lsb_decode *const lsb,
00086                                       const rohc_lsb_ref_t ref_type)
00087         __attribute__((nonnull(1), warn_unused_result));
00088 
00089 #endif
00090