ROHC compression/decompression library
Defines | Functions
ts_sc_comp.c File Reference

Scaled RTP Timestamp encoding. More...

#include "ts_sc_comp.h"
#include "sdvl.h"
#include "rohc_traces_internal.h"
#include <stdlib.h>
#include <assert.h>
Include dependency graph for ts_sc_comp.c:

Defines

#define ts_debug(entity_struct, format,...)

Functions

int c_create_sc (struct ts_sc_comp *const ts_sc, const size_t wlsb_window_width, rohc_trace_callback_t callback)
 Create the ts_sc_comp object.
void c_destroy_sc (struct ts_sc_comp *const ts_sc)
 Destroy the ts_sc_comp object.
void c_add_ts (struct ts_sc_comp *const ts_sc, const uint32_t ts, const uint16_t sn)
 Store the new TS, calculate new values and update the state.
bool nb_bits_scaled (const struct ts_sc_comp ts_sc, size_t *const bits_nr)
 Return the number of bits needed to encode TS_SCALED.
void add_scaled (const struct ts_sc_comp *const ts_sc, uint16_t sn)
 Add a new TS_SCALED value to the ts_sc_comp object.
uint32_t get_ts_stride (const struct ts_sc_comp ts_sc)
 Return the TS_STRIDE value.
uint32_t get_ts_scaled (const struct ts_sc_comp ts_sc)
 Return the TS_SCALED value.
bool rohc_ts_sc_is_deducible (const struct ts_sc_comp ts_sc)
 Whether TimeStamp (TS) is deducible from the Sequence Number (SN) or not.

Detailed Description

Scaled RTP Timestamp encoding.

Author:
David Moreau from TAS
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
Didier Barvaux <didier@barvaux.org>

Define Documentation

#define ts_debug (   entity_struct,
  format,
  ... 
)
Value:
rohc_debug(entity_struct, ROHC_TRACE_COMP, ROHC_PROFILE_GENERAL, \
                   format, ##__VA_ARGS__)

Print debug messages for the ts_sc_comp module

Referenced by c_add_ts().


Function Documentation

void add_scaled ( const struct ts_sc_comp *const  ts_sc,
uint16_t  sn 
)

Add a new TS_SCALED value to the ts_sc_comp object.

Parameters:
ts_scThe ts_sc_comp object
snThe Sequence Number

References c_add_wlsb(), ts_sc_comp::scaled_window, and ts_sc_comp::ts_scaled.

void c_add_ts ( struct ts_sc_comp *const  ts_sc,
const uint32_t  ts,
const uint16_t  sn 
)
int c_create_sc ( struct ts_sc_comp *const  ts_sc,
const size_t  wlsb_window_width,
rohc_trace_callback_t  callback 
)

Create the ts_sc_comp object.

Parameters:
ts_scThe ts_sc_comp object to create
wlsb_window_widthThe width of the W-LSB sliding window to use for TS_STRIDE (must be > 0)
callbackThe trace callback
Returns:
1 if creation is successful, 0 otherwise

References ts_sc_comp::are_old_val_init, c_create_wlsb(), INIT_TS, ts_sc_comp::is_deducible, ts_sc_comp::nr_init_stride_packets, ts_sc_comp::old_sn, ts_sc_comp::old_ts, rohc_error, ROHC_LSB_SHIFT_RTP_TS, ROHC_PROFILE_GENERAL, ROHC_TRACE_COMP, ts_sc_comp::scaled_window, ts_sc_comp::sn, ts_sc_comp::state, ts_sc_comp::trace_callback, ts_sc_comp::ts, ts_sc_comp::ts_delta, ts_sc_comp::ts_offset, ts_sc_comp::ts_scaled, and ts_sc_comp::ts_stride.

void c_destroy_sc ( struct ts_sc_comp *const  ts_sc)

Destroy the ts_sc_comp object.

Parameters:
ts_scThe ts_sc_comp object to destroy

References c_destroy_wlsb(), and ts_sc_comp::scaled_window.

uint32_t get_ts_scaled ( const struct ts_sc_comp  ts_sc)

Return the TS_SCALED value.

Parameters:
ts_scThe ts_sc_comp object
Returns:
The TS_SCALED value

References ts_sc_comp::ts_scaled.

uint32_t get_ts_stride ( const struct ts_sc_comp  ts_sc)

Return the TS_STRIDE value.

Parameters:
ts_scThe ts_sc_comp object
Returns:
TS_STRIDE value

References ts_sc_comp::ts_stride.

Referenced by rtp_header_flags_and_fields().

bool nb_bits_scaled ( const struct ts_sc_comp  ts_sc,
size_t *const  bits_nr 
)

Return the number of bits needed to encode TS_SCALED.

Parameters:
ts_scThe ts_sc_comp object
bits_nrOUT: The number of bits needed
Returns:
true in case of success, false if the minimal number of bits can not be found

References ts_sc_comp::scaled_window, ts_sc_comp::ts_scaled, and wlsb_get_k_32bits().

bool rohc_ts_sc_is_deducible ( const struct ts_sc_comp  ts_sc)

Whether TimeStamp (TS) is deducible from the Sequence Number (SN) or not.

Parameters:
ts_scThe TS SCALED compression context
Returns:
true if TS is deducible from SN, false otherwise

References ts_sc_comp::is_deducible.