/* * SpanDSP - a series of DSP components for telephony * * g722_encode.c - The ITU G.722 codec, encode part. * * Written by Steve Underwood <[email protected]> * * Copyright (C) 2005 Steve Underwood * * All rights reserved. * * Despite my general liking of the GPL, I place my own contributions * to this code in the public domain for the benefit of all mankind - * even the slimy ones who might try to proprietize my work and use it * to my detriment. * * Based on a single channel 64kbps only G.722 codec which is: * ***** Copyright (c) CMU 1993 ***** * Computer Science, Speech Group * Chengxiang Lu and Alex Hauptmann * * $Id: g722_encode.c,v 1.14 2006/07/07 16:37:49 steveu Exp $ * * Modifications for WebRtc, 2011/04/28, by tlegrand: * -Removed usage of inttypes.h and tgmath.h * -Changed to use WebRtc types * -Added option to run encoder bitexact with ITU-T reference implementation */ /*! \file */ #include <memory.h> #include <stdio.h> #include <stdlib.h> #include "modules/third_party/g722/g722_enc_dec.h" #if !defined(FALSE) #define FALSE … #endif #if !defined(TRUE) #define TRUE … #endif static __inline int16_t saturate(int32_t amp) { … } /*- End of function --------------------------------------------------------*/ static void block4(G722EncoderState *s, int band, int d) { … } /*- End of function --------------------------------------------------------*/ G722EncoderState* WebRtc_g722_encode_init(G722EncoderState* s, int rate, int options) { … } /*- End of function --------------------------------------------------------*/ int WebRtc_g722_encode_release(G722EncoderState *s) { … } /*- End of function --------------------------------------------------------*/ /* WebRtc, tlegrand: * Only define the following if bit-exactness with reference implementation * is needed. Will only have any effect if input signal is saturated. */ //#define RUN_LIKE_REFERENCE_G722 #ifdef RUN_LIKE_REFERENCE_G722 int16_t limitValues (int16_t rl) { int16_t yl; yl = (rl > 16383) ? 16383 : ((rl < -16384) ? -16384 : rl); return (yl); } #endif size_t WebRtc_g722_encode(G722EncoderState *s, uint8_t g722_data[], const int16_t amp[], size_t len) { … } /*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/