FreeCalypso > hg > gsm-codec-lib
view libgsmfrp/good_frame.c @ 274:52c667f17d2c
libgsmfr2: implement gsmfr_0610_encode_frame() wrapper
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 14 Apr 2024 02:57:18 +0000 |
parents | f081a6850fb5 |
children |
line wrap: on
line source
/* * In this module we implement preprocessing of received good frames. */ #include <stdint.h> #include <string.h> #include "gsm_fr_preproc.h" #include "internal.h" void gsmfr_preproc_good_frame(struct gsmfr_preproc_state *st, gsm_byte *frame) { int sid; /* always set correct magic */ frame[0] = 0xD0 | frame[0] & 0x0F; /* now classify by SID */ sid = gsmfr_preproc_sid_classify(frame); switch (sid) { case 0: /* good speech frame */ st->rx_state = SPEECH; memcpy(&st->speech_frame, frame, sizeof(gsm_frame)); return; case 1: /* invalid SID frame */ /* state-dependent handling, similar to BFI */ gsmfr_preproc_invalid_sid(st, frame); return; case 2: /* valid SID frame */ st->rx_state = COMFORT_NOISE; gsmfr_preproc_sid2cn(st, frame); return; } }