mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit '10f160768b824f00933f33bc69f1fae89a25dfc8'
* commit '10f160768b824f00933f33bc69f1fae89a25dfc8': g722: Reduce number of pointers passed to g722_apply_qmf() function Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
9f1792982e
@ -104,7 +104,7 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
for (j = 0; j < avpkt->size; j++) {
|
for (j = 0; j < avpkt->size; j++) {
|
||||||
int ilow, ihigh, rlow, rhigh, dhigh;
|
int ilow, ihigh, rlow, rhigh, dhigh;
|
||||||
int xout1, xout2;
|
int xout[2];
|
||||||
|
|
||||||
ihigh = get_bits(&gb, 2);
|
ihigh = get_bits(&gb, 2);
|
||||||
ilow = get_bits(&gb, 6 - skip);
|
ilow = get_bits(&gb, 6 - skip);
|
||||||
@ -122,10 +122,9 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
c->prev_samples[c->prev_samples_pos++] = rlow + rhigh;
|
c->prev_samples[c->prev_samples_pos++] = rlow + rhigh;
|
||||||
c->prev_samples[c->prev_samples_pos++] = rlow - rhigh;
|
c->prev_samples[c->prev_samples_pos++] = rlow - rhigh;
|
||||||
c->dsp.apply_qmf(c->prev_samples + c->prev_samples_pos - 24,
|
c->dsp.apply_qmf(c->prev_samples + c->prev_samples_pos - 24, xout);
|
||||||
&xout1, &xout2);
|
*out_buf++ = av_clip_int16(xout[0] >> 11);
|
||||||
*out_buf++ = av_clip_int16(xout1 >> 11);
|
*out_buf++ = av_clip_int16(xout[1] >> 11);
|
||||||
*out_buf++ = av_clip_int16(xout2 >> 11);
|
|
||||||
if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) {
|
if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) {
|
||||||
memmove(c->prev_samples, c->prev_samples + c->prev_samples_pos - 22,
|
memmove(c->prev_samples, c->prev_samples + c->prev_samples_pos - 22,
|
||||||
22 * sizeof(c->prev_samples[0]));
|
22 * sizeof(c->prev_samples[0]));
|
||||||
|
@ -29,15 +29,15 @@ static const int16_t qmf_coeffs[12] = {
|
|||||||
3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11,
|
3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void g722_apply_qmf(const int16_t *prev_samples, int *xout1, int *xout2)
|
static void g722_apply_qmf(const int16_t *prev_samples, int xout[2])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
*xout1 = 0;
|
xout[0] = 0;
|
||||||
*xout2 = 0;
|
xout[1] = 0;
|
||||||
for (i = 0; i < 12; i++) {
|
for (i = 0; i < 12; i++) {
|
||||||
MAC16(*xout2, prev_samples[2*i ], qmf_coeffs[i ]);
|
MAC16(xout[1], prev_samples[2*i ], qmf_coeffs[i ]);
|
||||||
MAC16(*xout1, prev_samples[2*i+1], qmf_coeffs[11-i]);
|
MAC16(xout[0], prev_samples[2*i+1], qmf_coeffs[11-i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef struct G722DSPContext {
|
typedef struct G722DSPContext {
|
||||||
void (*apply_qmf)(const int16_t *prev_samples, int *xout1, int *xout2);
|
void (*apply_qmf)(const int16_t *prev_samples, int xout[2]);
|
||||||
} G722DSPContext;
|
} G722DSPContext;
|
||||||
|
|
||||||
void ff_g722dsp_init(G722DSPContext *c);
|
void ff_g722dsp_init(G722DSPContext *c);
|
||||||
|
@ -138,12 +138,12 @@ static const int16_t low_quant[33] = {
|
|||||||
static inline void filter_samples(G722Context *c, const int16_t *samples,
|
static inline void filter_samples(G722Context *c, const int16_t *samples,
|
||||||
int *xlow, int *xhigh)
|
int *xlow, int *xhigh)
|
||||||
{
|
{
|
||||||
int xout1, xout2;
|
int xout[2];
|
||||||
c->prev_samples[c->prev_samples_pos++] = samples[0];
|
c->prev_samples[c->prev_samples_pos++] = samples[0];
|
||||||
c->prev_samples[c->prev_samples_pos++] = samples[1];
|
c->prev_samples[c->prev_samples_pos++] = samples[1];
|
||||||
c->dsp.apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2);
|
c->dsp.apply_qmf(c->prev_samples + c->prev_samples_pos - 24, xout);
|
||||||
*xlow = xout1 + xout2 >> 14;
|
*xlow = xout[0] + xout[1] >> 14;
|
||||||
*xhigh = xout1 - xout2 >> 14;
|
*xhigh = xout[0] - xout[1] >> 14;
|
||||||
if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) {
|
if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) {
|
||||||
memmove(c->prev_samples,
|
memmove(c->prev_samples,
|
||||||
c->prev_samples + c->prev_samples_pos - 22,
|
c->prev_samples + c->prev_samples_pos - 22,
|
||||||
|
Loading…
Reference in New Issue
Block a user