[FFmpeg-soc] [soc]: r538 - qcelp/qcelpdec.c
reynaldo
subversion at mplayerhq.hu
Fri Jul 27 09:42:33 CEST 2007
Author: reynaldo
Date: Fri Jul 27 09:42:33 2007
New Revision: 538
Log:
LSP freq interpolation draft
Modified:
qcelp/qcelpdec.c
Modified: qcelp/qcelpdec.c
==============================================================================
--- qcelp/qcelpdec.c (original)
+++ qcelp/qcelpdec.c Fri Jul 27 09:42:33 2007
@@ -47,6 +47,7 @@ typedef struct {
QCELPFrame *frame;
uint8_t erasure_count;
uint8_t ifq_count;
+ float prev_lspf[10];
} QCELPContext;
static int qcelp_decode_init(AVCodecContext *avctx);
@@ -58,6 +59,7 @@ static int qcelp_decode_close(AVCodecCon
static int qcelp_decode_init(AVCodecContext *avctx)
{
QCELPContext *q = (QCELPContext *) avctx->priv_data;
+ int i;
avctx->sample_rate = 8000;
avctx->channels = 1;
@@ -68,6 +70,11 @@ static int qcelp_decode_init(AVCodecCont
if(q->frame == NULL)
return -1;
+ for(i=0; i<10; i++)
+ {
+ q->prev_lspf[i]=0.0;
+ }
+
return 0;
}
@@ -398,6 +405,53 @@ static int qcelp_do_pitchfilter(QCELPFra
return 0;
}
+/**
+ * 2.4.3.3.4
+ */
+void qcelp_do_interpolate_lspf(qcelp_packet_rate rate, float *prev_lspf,
+ float *curr_lspf)
+{
+ int i,j;
+ float curr_weight, prev_weight;
+
+ switch(rate)
+ {
+ case RATE_FULL:
+ case RATE_HALF:
+ case RATE_QUARTER:
+ for(i=0;i<9;i+=3)
+ {
+ switch(i)
+ {
+ case 0:
+ prev_weight=0.75;
+ curr_weight=0.25;
+ break;
+ case 3:
+ prev_weight=curr_weight=0.5;
+ break;
+ default: /* 6 */
+ prev_weight=0.25;
+ curr_weight=0.75;
+ }
+
+ for(j=0;j<3;j++)
+ {
+ curr_lspf[i+j]=prev_weight*prev_lspf[i+j]+
+ curr_weight*curr_lspf[i+j];
+ }
+ }
+ break;
+ case RATE_OCTAVE:
+ for(i=0;i<10;i++)
+ curr_lspf[i]=0.375*prev_lspf[i]+0.625*curr_lspf[i];
+ break;
+ case I_F_Q:
+ for(i=0;i<10;i++)
+ curr_lspf[i]=prev_lspf[i];
+ }
+}
+
static int qcelp_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, uint8_t *buf, int buf_size)
{
More information about the FFmpeg-soc
mailing list