ROHC compression/decompression library
Defines | Functions
sdvl.h File Reference

Self-Describing Variable-Length (SDVL) encoding. More...

#include "rohc.h"
#include <stdbool.h>
Include dependency graph for sdvl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MAX_BITS_IN_1_BYTE_SDVL   7
#define MAX_BITS_IN_2_BYTE_SDVL   14
#define MAX_BITS_IN_3_BYTE_SDVL   21
#define MAX_BITS_IN_4_BYTE_SDVL   29

Functions

bool sdvl_can_value_be_encoded (uint32_t value)
 Can the given value be encoded with SDVL?
int c_bytesSdvl (int value, int length)
 Find out how many bytes are needed to represent the value using Self-Describing Variable-Length (SDVL) encoding.
boolean c_encodeSdvl (unsigned char *dest, int value, int length)
 Encode a value using Self-Describing Variable-Length (SDVL) encoding.
int d_sdvalue_size (const unsigned char *data)
 Find out a size of the Self-Describing Variable-Length (SDVL) value.
int d_sdvalue_decode (const unsigned char *data)
 Decode a Self-Describing Variable-Length (SDVL) value.

Detailed Description

Self-Describing Variable-Length (SDVL) encoding.

Author:
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
The hackers from ROHC for Linux

Define Documentation

#define MAX_BITS_IN_1_BYTE_SDVL   7

Maximum number of bits in 1 SDVL-encoded byte

Referenced by c_bytesSdvl().

#define MAX_BITS_IN_2_BYTE_SDVL   14

Maximum number of bits in 2 SDVL-encoded byte

Referenced by c_bytesSdvl().

#define MAX_BITS_IN_3_BYTE_SDVL   21

Maximum number of bits in 3 SDVL-encoded byte

Referenced by c_bytesSdvl().

#define MAX_BITS_IN_4_BYTE_SDVL   29

Function Documentation

int c_bytesSdvl ( int  value,
int  length 
)

Find out how many bytes are needed to represent the value using Self-Describing Variable-Length (SDVL) encoding.

See 4.5.6 in the RFC 3095 for details about SDVL encoding.

Parameters:
valueThe value to encode
lengthThe length of the value to encode (-1 to let the SDVL encoding find the length itself)
Returns:
The size needed to represent the SDVL-encoded value

References MAX_BITS_IN_1_BYTE_SDVL, MAX_BITS_IN_2_BYTE_SDVL, MAX_BITS_IN_3_BYTE_SDVL, MAX_BITS_IN_4_BYTE_SDVL, and rohc_debugf.

Referenced by c_encodeSdvl(), code_cid_values(), code_EXT3_packet(), f_append_cid(), rtp_code_dynamic_rtp_part(), and rtp_header_flags_and_fields().

boolean c_encodeSdvl ( unsigned char *  dest,
int  value,
int  length 
)

Encode a value using Self-Describing Variable-Length (SDVL) encoding.

See 4.5.6 in the RFC 3095 for details about SDVL encoding.

Parameters:
destThe destination to write the SDVL-encoded to
valueThe value to encode
lengthThe length of the value to encode
Returns:
Whether the SDVL encoding is successful or not (failure may be due to a value greater than 2^29)

References c_bytesSdvl(), ROHC_FALSE, and ROHC_TRUE.

Referenced by code_cid_values(), code_EXT3_packet(), f_append_cid(), rtp_code_dynamic_rtp_part(), and rtp_header_flags_and_fields().

int d_sdvalue_decode ( const unsigned char *  data)

Decode a Self-Describing Variable-Length (SDVL) value.

See 4.5.6 in the RFC 3095 for details about SDVL encoding.

Parameters:
dataThe SDVL data to decode
Returns:
The decoded value

References GET_BIT_0_4, GET_BIT_0_5, GET_BIT_0_6, GET_BIT_0_7, GET_BIT_5_7, GET_BIT_6_7, and GET_BIT_7.

Referenced by c_deliver_feedback(), decode_extension3(), and rtp_decode_dynamic_rtp().

int d_sdvalue_size ( const unsigned char *  data)

Find out a size of the Self-Describing Variable-Length (SDVL) value.

See 4.5.6 in the RFC 3095 for details about SDVL encoding.

Parameters:
dataThe SDVL data to analyze
Returns:
The size of the SDVL value (possible values are 1-4)

References GET_BIT_5_7, GET_BIT_6_7, GET_BIT_7, and rohc_debugf.

Referenced by c_deliver_feedback(), decode_extension3(), rtp_decode_dynamic_rtp(), rtp_detect_ir_dyn_size(), and rtp_detect_ir_size().

bool sdvl_can_value_be_encoded ( uint32_t  value)

Can the given value be encoded with SDVL?

See 4.5.6 in the RFC 3095 for details about SDVL encoding.

Parameters:
valueThe value to encode
Returns:
Whether the value can be encoded with SDVL or not

Referenced by c_add_ts().