Go to the documentation of this file.
63 const int16_t *consts,
77 t1[
i >> 1] += in[hop +
i] * consts[hop +
i];
83 memset(
t1, 0,
sizeof(
t1));
95 const int16_t *consts)
101 const int16_t *consts)
166 int nsamples,
int nchannels)
171 if (position < nsamples) {
172 for (
c = 0;
c < nchannels;
c++)
174 36 *
sizeof(int16_t));
179 for (; nsamples >= 8; nsamples -= 8, pcm += 16 * nchannels) {
181 for (
c = 0;
c < nchannels;
c++) {
182 int16_t *x = &
X[
c][position];
183 x[0] =
AV_RN16(pcm + 14*nchannels + 2*
c);
184 x[1] =
AV_RN16(pcm + 6*nchannels + 2*
c);
185 x[2] =
AV_RN16(pcm + 12*nchannels + 2*
c);
186 x[3] =
AV_RN16(pcm + 8*nchannels + 2*
c);
187 x[4] =
AV_RN16(pcm + 0*nchannels + 2*
c);
188 x[5] =
AV_RN16(pcm + 4*nchannels + 2*
c);
189 x[6] =
AV_RN16(pcm + 2*nchannels + 2*
c);
190 x[7] =
AV_RN16(pcm + 10*nchannels + 2*
c);
199 int nsamples,
int nchannels)
204 if (position < nsamples) {
205 for (
c = 0;
c < nchannels;
c++)
207 72 *
sizeof(int16_t));
211 if (position % 16 == 8) {
214 for (
c = 0;
c < nchannels;
c++) {
215 int16_t *x = &
X[
c][position];
216 x[0] =
AV_RN16(pcm + 14*nchannels + 2*
c);
217 x[2] =
AV_RN16(pcm + 12*nchannels + 2*
c);
218 x[3] =
AV_RN16(pcm + 0*nchannels + 2*
c);
219 x[4] =
AV_RN16(pcm + 10*nchannels + 2*
c);
220 x[5] =
AV_RN16(pcm + 2*nchannels + 2*
c);
221 x[6] =
AV_RN16(pcm + 8*nchannels + 2*
c);
222 x[7] =
AV_RN16(pcm + 4*nchannels + 2*
c);
223 x[8] =
AV_RN16(pcm + 6*nchannels + 2*
c);
225 pcm += 16 * nchannels;
229 for (; nsamples >= 16; nsamples -= 16, pcm += 32 * nchannels) {
231 for (
c = 0;
c < nchannels;
c++) {
232 int16_t *x = &
X[
c][position];
233 x[0] =
AV_RN16(pcm + 30*nchannels + 2*
c);
234 x[1] =
AV_RN16(pcm + 14*nchannels + 2*
c);
235 x[2] =
AV_RN16(pcm + 28*nchannels + 2*
c);
236 x[3] =
AV_RN16(pcm + 16*nchannels + 2*
c);
237 x[4] =
AV_RN16(pcm + 26*nchannels + 2*
c);
238 x[5] =
AV_RN16(pcm + 18*nchannels + 2*
c);
239 x[6] =
AV_RN16(pcm + 24*nchannels + 2*
c);
240 x[7] =
AV_RN16(pcm + 20*nchannels + 2*
c);
241 x[8] =
AV_RN16(pcm + 22*nchannels + 2*
c);
242 x[9] =
AV_RN16(pcm + 6*nchannels + 2*
c);
243 x[10] =
AV_RN16(pcm + 12*nchannels + 2*
c);
244 x[11] =
AV_RN16(pcm + 0*nchannels + 2*
c);
245 x[12] =
AV_RN16(pcm + 10*nchannels + 2*
c);
246 x[13] =
AV_RN16(pcm + 2*nchannels + 2*
c);
247 x[14] =
AV_RN16(pcm + 8*nchannels + 2*
c);
248 x[15] =
AV_RN16(pcm + 4*nchannels + 2*
c);
254 for (
c = 0;
c < nchannels;
c++) {
255 int16_t *x = &
X[
c][position];
256 x[-7] =
AV_RN16(pcm + 14*nchannels + 2*
c);
257 x[1] =
AV_RN16(pcm + 6*nchannels + 2*
c);
258 x[2] =
AV_RN16(pcm + 12*nchannels + 2*
c);
259 x[3] =
AV_RN16(pcm + 0*nchannels + 2*
c);
260 x[4] =
AV_RN16(pcm + 10*nchannels + 2*
c);
261 x[5] =
AV_RN16(pcm + 2*nchannels + 2*
c);
262 x[6] =
AV_RN16(pcm + 8*nchannels + 2*
c);
263 x[7] =
AV_RN16(pcm + 4*nchannels + 2*
c);
271 uint32_t scale_factor[2][8],
289 uint32_t scale_factor[2][8],
301 tmp0 =
FFABS(sb_sample_f[
blk][0][sb]);
302 tmp1 =
FFABS(sb_sample_f[
blk][1][sb]);
317 tmp0 = sb_sample_f[
blk][0][sb];
318 tmp1 = sb_sample_f[
blk][1][sb];
319 sb_sample_j[
blk][0] = (tmp0 >> 1) + (tmp1 >> 1);
320 sb_sample_j[
blk][1] = (tmp0 >> 1) - (tmp1 >> 1);
346 if ((scale_factor[0][sb] + scale_factor[1][sb]) > x + y) {
348 scale_factor[0][sb] = x;
349 scale_factor[1][sb] = y;
351 sb_sample_f[
blk][0][sb] = sb_sample_j[
blk][0];
352 sb_sample_f[
blk][1][sb] = sb_sample_j[
blk][1];
370 if (
s->increment == 1)
static int sbc_enc_process_input_8s(int position, const uint8_t *pcm, int16_t X[2][SBC_X_BUFFER_SIZE], int nsamples, int nchannels)
const int16_t ff_sbcdsp_analysis_consts_fixed8_simd_even[80+64]
const int16_t ff_sbcdsp_analysis_consts_fixed4_simd_odd[40+16]
static void sbc_analyze_8_simd(const int16_t *in, int32_t *out, const int16_t *consts)
static void sbc_analyze_4b_4s_simd(SBCDSPContext *s, int16_t *x, int32_t *out, int out_stride)
static void sbc_analyze_1b_8s_simd_odd(SBCDSPContext *s, int16_t *x, int32_t *out, int out_stride)
void ff_sbcdsp_init_x86(SBCDSPContext *s)
#define SBC_PROTO_FIXED_SCALE
static int sbc_calc_scalefactors_j(int32_t sb_sample_f[16][2][8], uint32_t scale_factor[2][8], int blocks, int subbands)
static void sbc_analyze_4b_8s_simd(SBCDSPContext *s, int16_t *x, int32_t *out, int out_stride)
const int16_t ff_sbcdsp_analysis_consts_fixed4_simd_even[40+16]
av_cold void ff_sbcdsp_init(SBCDSPContext *s)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static int sbc_enc_process_input_4s(int position, const uint8_t *pcm, int16_t X[2][SBC_X_BUFFER_SIZE], int nsamples, int nchannels)
static void sbc_calc_scalefactors(int32_t sb_sample_f[16][2][8], uint32_t scale_factor[2][8], int blocks, int channels, int subbands)
#define SBC_X_BUFFER_SIZE
#define i(width, name, range_min, range_max)
static void sbc_analyze_4_simd(const int16_t *in, int32_t *out, const int16_t *consts)
av_cold void ff_sbcdsp_init_arm(SBCDSPContext *s)
static av_always_inline void sbc_analyze_simd(const int16_t *in, int32_t *out, const int16_t *consts, unsigned subbands)
const int16_t ff_sbcdsp_analysis_consts_fixed8_simd_odd[80+64]
#define SBC_COS_TABLE_FIXED_SCALE
static void sbc_analyze_1b_8s_simd_even(SBCDSPContext *s, int16_t *x, int32_t *out, int out_stride)