Beispiel #1
0
int16_t WebRtcIlbcfix_Decode(iLBC_Dec_Inst_t * iLBCdec_inst,
				   const int16_t * encoded,
				   int16_t len,
				   int16_t * decoded,
				   int16_t * speechType)
{
	int i = 0;
	/* Allow for automatic switching between the frame sizes
	   (although you do get some discontinuity) */
	if ((len == ((iLBC_Dec_Inst_t *) iLBCdec_inst)->no_of_bytes) ||
	    (len == 2 * ((iLBC_Dec_Inst_t *) iLBCdec_inst)->no_of_bytes) ||
	    (len == 3 * ((iLBC_Dec_Inst_t *) iLBCdec_inst)->no_of_bytes)) {
		/* ok, do nothing */
	} else {
		/* Test if the mode has changed */
		if (((iLBC_Dec_Inst_t *) iLBCdec_inst)->mode == 20) {
			if ((len == NO_OF_BYTES_30MS) ||
			    (len == 2 * NO_OF_BYTES_30MS) ||
			    (len == 3 * NO_OF_BYTES_30MS)) {
				WebRtcIlbcfix_InitDecode(((iLBC_Dec_Inst_t *)
							  iLBCdec_inst), 30,
							 ((iLBC_Dec_Inst_t *)
							  iLBCdec_inst)->
							 use_enhancer);
			} else {
				/* Unsupported frame length */
				return (-1);
			}
		} else {
			if ((len == NO_OF_BYTES_20MS) ||
			    (len == 2 * NO_OF_BYTES_20MS) ||
			    (len == 3 * NO_OF_BYTES_20MS)) {
				WebRtcIlbcfix_InitDecode(((iLBC_Dec_Inst_t *)
							  iLBCdec_inst), 20,
							 ((iLBC_Dec_Inst_t *)
							  iLBCdec_inst)->
							 use_enhancer);
			} else {
				/* Unsupported frame length */
				return (-1);
			}
		}
	}

	while ((i * ((iLBC_Dec_Inst_t *) iLBCdec_inst)->no_of_bytes) < len) {
		WebRtcIlbcfix_DecodeImpl(&decoded
					 [i *
					  ((iLBC_Dec_Inst_t *) iLBCdec_inst)->
					  blockl],
					 (const uint16_t *)&encoded[i *
									  ((iLBC_Dec_Inst_t *) iLBCdec_inst)->no_of_words], (iLBC_Dec_Inst_t *) iLBCdec_inst, 1);
		i++;
	}
	/* iLBC does not support VAD/CNG yet */
	*speechType = 1;
	return (i * ((iLBC_Dec_Inst_t *) iLBCdec_inst)->blockl);
}
Beispiel #2
0
WebRtc_Word16 WebRtcIlbcfix_DecoderInit(iLBC_decinst_t *iLBCdec_inst, WebRtc_Word16 mode) {
  if ((mode==20)||(mode==30)) {
    WebRtcIlbcfix_InitDecode((iLBC_Dec_Inst_t*) iLBCdec_inst, mode, 1);
    return(0);
  } else {
    return(-1);
  }
}
Beispiel #3
0
int16_t WebRtcIlbcfix_DecoderInit(IlbcDecoderInstance* iLBCdec_inst,
                                  int16_t mode) {
  if ((mode==20)||(mode==30)) {
    WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, mode, 1);
    return(0);
  } else {
    return(-1);
  }
}
Beispiel #4
0
static av_cold int ilbc_decode_init(AVCodecContext *avctx)
{
    ILBCDecContext *s  = avctx->priv_data;
    int mode;

    if ((mode = get_mode(avctx)) < 0) {
        av_log(avctx, AV_LOG_ERROR, "iLBC frame mode not indicated\n");
        return AVERROR(EINVAL);
    }

    WebRtcIlbcfix_InitDecode(&s->decoder, mode, s->enhance);

    avctx->channels       = 1;
    avctx->channel_layout = AV_CH_LAYOUT_MONO;
    avctx->sample_rate    = 8000;
    avctx->sample_fmt     = AV_SAMPLE_FMT_S16;

    return 0;
}
Beispiel #5
0
int16_t WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance *iLBCdec_inst) {
  WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 30, 1);
  return(0);
}
Beispiel #6
0
void WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance* iLBCdec_inst) {
  WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 30, 1);
}
Beispiel #7
0
WebRtc_Word16 WebRtcIlbcfix_Decoderinit30Ms(iLBC_decinst_t *iLBCdec_inst) {
  WebRtcIlbcfix_InitDecode((iLBC_Dec_Inst_t*) iLBCdec_inst, 30, 1);
  return(0);
}