mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
sbc: ensure 16-byte buffer position alignment for 4 subbands encoding
Buffer position in X array was not always 16-bytes aligned. Strict 16-byte alignment is strictly required for powerpc altivec simd optimizations because altivec does not have support for unaligned vector loads at all.
This commit is contained in:
parent
e4eb467010
commit
4d2f0daba1
2 changed files with 4 additions and 4 deletions
|
|
@ -924,7 +924,7 @@ static void sbc_encoder_init(struct sbc_encoder_state *state,
|
|||
const struct sbc_frame *frame)
|
||||
{
|
||||
memset(&state->X, 0, sizeof(state->X));
|
||||
state->position = SBC_X_BUFFER_SIZE - frame->subbands * 9;
|
||||
state->position = (SBC_X_BUFFER_SIZE - frame->subbands * 9) & ~7;
|
||||
|
||||
sbc_init_primitives(state);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,12 +231,12 @@ static SBC_ALWAYS_INLINE int sbc_encoder_process_input_s4_internal(
|
|||
/* handle X buffer wraparound */
|
||||
if (position < nsamples) {
|
||||
if (nchannels > 0)
|
||||
memcpy(&X[0][SBC_X_BUFFER_SIZE - 36], &X[0][position],
|
||||
memcpy(&X[0][SBC_X_BUFFER_SIZE - 40], &X[0][position],
|
||||
36 * sizeof(int16_t));
|
||||
if (nchannels > 1)
|
||||
memcpy(&X[1][SBC_X_BUFFER_SIZE - 36], &X[1][position],
|
||||
memcpy(&X[1][SBC_X_BUFFER_SIZE - 40], &X[1][position],
|
||||
36 * sizeof(int16_t));
|
||||
position = SBC_X_BUFFER_SIZE - 36;
|
||||
position = SBC_X_BUFFER_SIZE - 40;
|
||||
}
|
||||
|
||||
#define PCM(i) (big_endian ? \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue