FreeCalypso > hg > gsm-codec-lib
view libgsmfr2/unpack_frame.c @ 282:9ee8ad3d4d30
frtest: rm gsmfr-hand-test and gsmfr-max-out utils
These hack programs were never properly documented and were written
only as part of a debug chase, in pursuit of a bug that ultimately
turned out to be in our then-hacky patch to osmo-bts-sysmo,
before beginning of proper patches in Osmocom. These hack programs
need to be dropped from the present sw package because they depend
on old libgsm, and we are eliminating that dependency.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 14 Apr 2024 05:44:47 +0000 |
parents | f0220c141d2c |
children |
line wrap: on
line source
/* * This module holds our gsmfr_unpack_frame() function: unpacking a single * GSM-FR frame from libgsm/RTP format into a broken-down struct of params. */ #include <stdint.h> #include "tw_gsmfr.h" void gsmfr_unpack_frame(const uint8_t *frame, struct gsmfr_param_frame *param) { const uint8_t *c = frame; unsigned sub; param->LARc[0] = (*c++ & 0xF) << 2; param->LARc[0] |= (*c >> 6) & 0x3; param->LARc[1] = *c++ & 0x3F; param->LARc[2] = (*c >> 3) & 0x1F; param->LARc[3] = (*c++ & 0x7) << 2; param->LARc[3] |= (*c >> 6) & 0x3; param->LARc[4] = (*c >> 2) & 0xF; param->LARc[5] = (*c++ & 0x3) << 2; param->LARc[5] |= (*c >> 6) & 0x3; param->LARc[6] = (*c >> 3) & 0x7; param->LARc[7] = *c++ & 0x7; for (sub = 0; sub < 4; sub++) { param->Nc[sub] = (*c >> 1) & 0x7F; param->bc[sub] = (*c++ & 0x1) << 1; param->bc[sub] |= (*c >> 7) & 0x1; param->Mc[sub] = (*c >> 5) & 0x3; param->xmaxc[sub] = (*c++ & 0x1F) << 1; param->xmaxc[sub] |= (*c >> 7) & 0x1; param->xMc[sub][0] = (*c >> 4) & 0x7; param->xMc[sub][1] = (*c >> 1) & 0x7; param->xMc[sub][2] = (*c++ & 0x1) << 2; param->xMc[sub][2] |= (*c >> 6) & 0x3; param->xMc[sub][3] = (*c >> 3) & 0x7; param->xMc[sub][4] = *c++ & 0x7; param->xMc[sub][5] = (*c >> 5) & 0x7; param->xMc[sub][6] = (*c >> 2) & 0x7; param->xMc[sub][7] = (*c++ & 0x3) << 1; param->xMc[sub][7] |= (*c >> 7) & 0x1; param->xMc[sub][8] = (*c >> 4) & 0x7; param->xMc[sub][9] = (*c >> 1) & 0x7; param->xMc[sub][10] = (*c++ & 0x1) << 2; param->xMc[sub][10] |= (*c >> 6) & 0x3; param->xMc[sub][11] = (*c >> 3) & 0x7; param->xMc[sub][12] = *c++ & 0x7; } }