Revision f1efbca5 libavcodec/ac3dsp.c

View differences:

libavcodec/ac3dsp.c
50 50
    return v;
51 51
}
52 52

  
53
static void ac3_lshift_int16_c(int16_t *src, unsigned int len,
54
                               unsigned int shift)
55
{
56
    uint32_t *src32 = (uint32_t *)src;
57
    const uint32_t mask = ~(((1 << shift) - 1) << 16);
58
    int i;
59
    len >>= 1;
60
    for (i = 0; i < len; i += 8) {
61
        src32[i  ] = (src32[i  ] << shift) & mask;
62
        src32[i+1] = (src32[i+1] << shift) & mask;
63
        src32[i+2] = (src32[i+2] << shift) & mask;
64
        src32[i+3] = (src32[i+3] << shift) & mask;
65
        src32[i+4] = (src32[i+4] << shift) & mask;
66
        src32[i+5] = (src32[i+5] << shift) & mask;
67
        src32[i+6] = (src32[i+6] << shift) & mask;
68
        src32[i+7] = (src32[i+7] << shift) & mask;
69
    }
70
}
71

  
72
static void ac3_rshift_int32_c(int32_t *src, unsigned int len,
73
                               unsigned int shift)
74
{
75
    do {
76
        *src++ >>= shift;
77
        *src++ >>= shift;
78
        *src++ >>= shift;
79
        *src++ >>= shift;
80
        *src++ >>= shift;
81
        *src++ >>= shift;
82
        *src++ >>= shift;
83
        *src++ >>= shift;
84
        len -= 8;
85
    } while (len > 0);
86
}
87

  
53 88
av_cold void ff_ac3dsp_init(AC3DSPContext *c)
54 89
{
55 90
    c->ac3_exponent_min = ac3_exponent_min_c;
56 91
    c->ac3_max_msb_abs_int16 = ac3_max_msb_abs_int16_c;
92
    c->ac3_lshift_int16 = ac3_lshift_int16_c;
93
    c->ac3_rshift_int32 = ac3_rshift_int32_c;
57 94

  
58 95
    if (HAVE_MMX)
59 96
        ff_ac3dsp_init_x86(c);

Also available in: Unified diff