Scroll to navigation

RQ Query(3) Librecast Programmer's Manual RQ Query(3)

NAME

rq_query - RaptorQ Query Functions

SYNOPSIS

#include <lcrq.h>
uint8_t rq_Al(const rq_t * const rq);
uint64_t rq_F(const rq_t * const rq);
uint16_t rq_K(const rq_t * const rq);
uint16_t rq_KP(const rq_t * const rq);
uint16_t rq_T(const rq_t * const rq);
uint16_t rq_N(const rq_t * const rq);
uint8_t rq_Z(const rq_t * const rq);

Compile and link with -llcrq.

DESCRIPTION

The RaptorQ query functions return the value of their respective RaptorQ parameters.

F Transfer Length (F): 40-bit unsigned integer. A non-negative integer that is at most 946270874880. This is the transfer length of the object in units of octets.

T Symbol Size (T): 16-bit unsigned integer. A positive integer that is less than 2^^16. This is the size of a symbol in units of octets. This MUST be a multiple of Al.

Al A symbol alignment parameter (Al): 8-bit unsigned integer.

Z The number of source blocks (Z): 16-bit unsigned integer.

K The number of source symbols.

KP (K') The number of source and padding symbols.

The parameter rq must be a pointer to RaptorQ context initialized with rq_init(3)

RETURN VALUE

These functions return the RQ parameters as unsigned integers.

ERRORS

These functions do not return errors.

EXAMPLE

Program source

/* params - example program to create RaptorQ context and print derived parameters */
#include <lcrq.h>
#include <stdio.h>
#include <stdlib.h>
int usage(const char *progname)
{

fprintf(stderr, "usage: `%s F T` (F = object size, T = symbol size)0, progname); } int main(int argc, char *argv[]) {
rq_t *rq;
uint64_t F;
uint16_t T, K, KP, N, Z;
uint8_t Al;
if (argc != 3) return usage(argv[0]);
F = atoll(argv[1]);
T = atoll(argv[2]);
/* initialize RaptorQ context */
rq = rq_init(F, T);
/* Query parameters */
K = rq_K(rq);
KP = rq_KP(rq);
N = rq_N(rq);
Z = rq_Z(rq);
/* free RaptorQ context */
rq_free(rq);
printf("F %12lusize of object to encode (40 bits)0, F);
printf("T %12usymbol (payload) size0, T);
printf("K %12unumber of original symbols0, K);
printf("K' %12unumber of symbols, including padding symbols0, KP);
printf("N %12unumber of sub-blocks0, N);
printf("Z %12unumber of blocks0, Z);
return 0; } rq_free(rq); /* free context when done */

SEE ALSO

rq_init(3), rq_free(3), rq_decode(3), rq_encode(3), rq_symbol(3), lcrq(7)

2022-07-07 LCRQ