Revision 756e3467 libavcodec/ra144dec.c

View differences:

libavcodec/ra144dec.c
26 26
#include "avcodec.h"
27 27
#include "get_bits.h"
28 28
#include "ra144.h"
29
#include "celp_filters.h"
30 29

  
31 30

  
32 31
static av_cold int ra144_decode_init(AVCodecContext * avctx)
......
45 44
static void do_output_subblock(RA144Context *ractx, const uint16_t  *lpc_coefs,
46 45
                               int gval, GetBitContext *gb)
47 46
{
48
    uint16_t buffer_a[40];
49
    uint16_t *block;
50 47
    int cba_idx = get_bits(gb, 7); // index of the adaptive CB, 0 if none
51 48
    int gain    = get_bits(gb, 8);
52 49
    int cb1_idx = get_bits(gb, 7);
53 50
    int cb2_idx = get_bits(gb, 7);
54
    int m[3];
55

  
56
    if (cba_idx) {
57
        cba_idx += BLOCKSIZE/2 - 1;
58
        ff_copy_and_dup(buffer_a, ractx->adapt_cb, cba_idx);
59
        m[0] = (ff_irms(buffer_a) * gval) >> 12;
60
    } else {
61
        m[0] = 0;
62
    }
63

  
64
    m[1] = (ff_cb1_base[cb1_idx] * gval) >> 8;
65
    m[2] = (ff_cb2_base[cb2_idx] * gval) >> 8;
66

  
67
    memmove(ractx->adapt_cb, ractx->adapt_cb + BLOCKSIZE,
68
            (BUFFERSIZE - BLOCKSIZE) * sizeof(*ractx->adapt_cb));
69

  
70
    block = ractx->adapt_cb + BUFFERSIZE - BLOCKSIZE;
71

  
72
    ff_add_wav(block, gain, cba_idx, m, cba_idx? buffer_a: NULL,
73
               ff_cb1_vects[cb1_idx], ff_cb2_vects[cb2_idx]);
74

  
75
    memcpy(ractx->curr_sblock, ractx->curr_sblock + 40,
76
           10*sizeof(*ractx->curr_sblock));
77 51

  
78
    if (ff_celp_lp_synthesis_filter(ractx->curr_sblock + 10, lpc_coefs,
79
                                    block, BLOCKSIZE, 10, 1, 0xfff))
80
        memset(ractx->curr_sblock, 0, 50*sizeof(*ractx->curr_sblock));
52
    ff_subblock_synthesis(ractx, lpc_coefs, cba_idx, cb1_idx, cb2_idx, gval,
53
                          gain);
81 54
}
82 55

  
83 56
/** Uncompress one block (20 bytes -> 160*2 bytes). */

Also available in: Unified diff