ROHC compression/decompression library
interval.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 interval.h
00019  * @brief Compute the interpretation interval for LSB and W-LSB encoding
00020  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
00021  */
00022 
00023 #ifndef INTERVAL_H
00024 #define INTERVAL_H
00025 
00026 #include <stdlib.h>
00027 #include <stdint.h>
00028 
00029 
00030 /**
00031  * @brief the different values of the shift parameter of the LSB algorithm
00032  *
00033  * The shift parameter is also named 'p' in some RFCs.
00034  *
00035  * Some values are the real values to use directly. Some others are code
00036  * that means that the real value to use shall be computed from the number
00037  * of least significant bits that are transmitted.
00038  */
00039 typedef enum
00040 {
00041         ROHC_LSB_SHIFT_IP_ID  =  0,  /**< real value for IP-ID */
00042         ROHC_LSB_SHIFT_RTP_TS =  2,  /**< need to compute real value for RTP TS */
00043         ROHC_LSB_SHIFT_RTP_SN =  3,  /**< need to compute real value for RTP SN */
00044         ROHC_LSB_SHIFT_ESP_SN =  3,  /**< need to compute real value for ESP SN */
00045         ROHC_LSB_SHIFT_SN     = -1,  /**< real value for non-RTP SN */
00046         ROHC_LSB_SHIFT_STATS  = -1,  /**< real value for internal statistics */
00047 } rohc_lsb_shift_t;
00048 
00049 
00050 /*
00051  * Public function prototypes:
00052  */
00053 
00054 void rohc_f_16bits(const uint16_t v_ref,
00055                    const size_t k,
00056                    const rohc_lsb_shift_t p,
00057                    uint16_t *const min,
00058                    uint16_t *const max);
00059 
00060 void rohc_f_32bits(const uint32_t v_ref,
00061                    const size_t k,
00062                    const rohc_lsb_shift_t p,
00063                    uint32_t *const min,
00064                    uint32_t *const max);
00065 
00066 #endif
00067