RQ_N(3)

✨ NAME ✨

rq_query β€” the RaptorQ Query Functions, straight out of the Librecast Programmer's Manual πŸ’–


πŸŽ€ 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. that's the whole vibe check right there 🫢


πŸ’… DESCRIPTION πŸ’…

okay so bestie, these functions are literally just getters ✨ β€” each RaptorQ query function hands you back the value of its own RaptorQ parameter. no side quests, no surprises, just vibes.

here's the cast of characters πŸ‘‘:

  • F β€” Transfer Length (F): a 40-bit unsigned integer. it's a non-negative integer that is at most 946270874880. this is the transfer length of the object, measured in units of octets.
  • T β€” Symbol Size (T): a 16-bit unsigned integer. it's a positive integer that is less than 2^^16. this is the size of a symbol, in units of octets. it MUST be a multiple of Al β€” like, non-negotiable, bestie 🚨
  • Al β€” A symbol alignment parameter (Al): an 8-bit unsigned integer.
  • Z β€” The number of source blocks (Z): a 16-bit unsigned integer.
  • K β€” The number of source symbols.
  • KP β€” (K') The number of source and padding symbols.
the parameter rq has to be a pointer to a RaptorQ context that was initialized with rq_init(3) β€” no uninitialized chaos allowed πŸ™ˆ

🌈 RETURN VALUE 🌈

these functions return the RQ parameters as unsigned integers. that's it, that's the tea β˜•


πŸ’€ ERRORS πŸ’€

these functions do not return errors. not one. they simply cannot fail, and honestly? iconic.


πŸ¦‹ 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;
}

and then, one last time, because cleaning up after yourself is main character energy ✨:

rq_free(rq); /* free context when done */

so the flow is: make the context with rq_init, peek at the parameters with the query functions, print them all pretty, then rq_free it before you dip. N shows up in that printout as the number of sub-blocks, just so you know what you're looking at πŸ‘€


⭐ SEE ALSO ⭐

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


and that's the page, bestie πŸ’– this one came out of the <b>LCRQ</b> corner of the Librecast Programmer's Manual, dated <b>2022-07-07</b> β€” go forth and query your parameters, you absolute legend πŸ‘‘βœ¨

πŸ“¦ where this page comes from