More OKed parts of the QCELP decoder
patch by Kenan Gillet, kenan.gillet gmail com Originally committed as revision 15797 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
3d4fc61064
commit
2ae1a9b264
@ -378,4 +378,54 @@ static const qcelp_vector * const qcelp_lspvq[5] = {
|
|||||||
qcelp_lspvq5
|
qcelp_lspvq5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* circular codebook for rate 1 frames in x*100 form
|
||||||
|
*
|
||||||
|
* TIA/EIA/IS-733 2.4.6.1-2
|
||||||
|
*/
|
||||||
|
static const int16_t qcelp_rate_full_codebook[128] = {
|
||||||
|
10, -65, -59, 12, 110, 34, -134, 157,
|
||||||
|
104, -84, -34, -115, 23, -101, 3, 45,
|
||||||
|
-101, -16, -59, 28, -45, 134, -67, 22,
|
||||||
|
61, -29, 226, -26, -55, -179, 157, -51,
|
||||||
|
-220, -93, -37, 60, 118, 74, -48, -95,
|
||||||
|
-181, 111, 36, -52, -215, 78, -112, 39,
|
||||||
|
-17, -47, -223, 19, 12, -98, -142, 130,
|
||||||
|
54, -127, 21, -12, 39, -48, 12, 128,
|
||||||
|
6, -167, 82, -102, -79, 55, -44, 48,
|
||||||
|
-20, -53, 8, -61, 11, -70, -157, -168,
|
||||||
|
20, -56, -74, 78, 33, -63, -173, -2,
|
||||||
|
-75, -53, -146, 77, 66, -29, 9, -75,
|
||||||
|
65, 119, -43, 76, 233, 98, 125, -156,
|
||||||
|
-27, 78, -9, 170, 176, 143, -148, -7,
|
||||||
|
27, -136, 5, 27, 18, 139, 204, 7,
|
||||||
|
-184, -197, 52, -3, 78, -189, 8, -65
|
||||||
|
};
|
||||||
|
#define QCELP_RATE_FULL_CODEBOOK_RATIO .01
|
||||||
|
|
||||||
|
/**
|
||||||
|
* circular codebook for rate 1/2 frames in x*2 form
|
||||||
|
*
|
||||||
|
* TIA/EIA/IS-733 2.4.6.1-1
|
||||||
|
*/
|
||||||
|
static const int8_t qcelp_rate_half_codebook[128] = {
|
||||||
|
0, -4, 0, -3, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, -3, -2, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 5,
|
||||||
|
0, 0, 0, 0, 0, 0, 4, 0,
|
||||||
|
0, 3, 2, 0, 3, 4, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 3, 0, 0,
|
||||||
|
-3, 3, 0, 0, -2, 0, 3, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, -5, 0,
|
||||||
|
0, 0, 0, 3, 0, 0, 0, 3,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 4,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 3, 6, -3, -4, 0, -3, -3,
|
||||||
|
3, -3, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
#define QCELP_RATE_HALF_CODEBOOK_RATIO 0.5
|
||||||
|
|
||||||
#endif /* AVCODEC_QCELPDATA_H */
|
#endif /* AVCODEC_QCELPDATA_H */
|
||||||
|
@ -38,6 +38,19 @@
|
|||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
static void weighted_vector_sumf(float *out,
|
||||||
|
const float *in_a,
|
||||||
|
const float *in_b,
|
||||||
|
float weight_coeff_a,
|
||||||
|
float weight_coeff_b,
|
||||||
|
int length) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < length; i++)
|
||||||
|
out[i] = weight_coeff_a * in_a[i]
|
||||||
|
+ weight_coeff_b * in_b[i];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply filter in pitch-subframe steps.
|
* Apply filter in pitch-subframe steps.
|
||||||
*
|
*
|
||||||
@ -90,6 +103,22 @@ static const float *do_pitchfilter(float memory[303],
|
|||||||
return memory + 143;
|
return memory + 143;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int buf_size2framerate(const int buf_size) {
|
||||||
|
switch (buf_size) {
|
||||||
|
case 35:
|
||||||
|
return RATE_FULL;
|
||||||
|
case 17:
|
||||||
|
return RATE_HALF;
|
||||||
|
case 8:
|
||||||
|
return RATE_QUARTER;
|
||||||
|
case 4:
|
||||||
|
return RATE_OCTAVE;
|
||||||
|
case 1:
|
||||||
|
return SILENCE;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static void warn_insufficient_frame_quality(AVCodecContext *avctx,
|
static void warn_insufficient_frame_quality(AVCodecContext *avctx,
|
||||||
const char *message) {
|
const char *message) {
|
||||||
av_log(avctx, AV_LOG_WARNING, "Frame #%d, IFQ: %s\n", avctx->frame_number, message);
|
av_log(avctx, AV_LOG_WARNING, "Frame #%d, IFQ: %s\n", avctx->frame_number, message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user