FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
resample_init.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.net>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config.h"
22 
23 #include "libavutil/cpu.h"
24 #include "libavutil/arm/cpu.h"
25 #include "libavutil/internal.h"
26 #include "libavutil/samplefmt.h"
27 
28 #include "libavresample/resample.h"
29 
30 #include "asm-offsets.h"
31 
32 AV_CHECK_OFFSET(struct ResampleContext, filter_bank, FILTER_BANK);
33 AV_CHECK_OFFSET(struct ResampleContext, filter_length, FILTER_LENGTH);
34 AV_CHECK_OFFSET(struct ResampleContext, src_incr, SRC_INCR);
35 AV_CHECK_OFFSET(struct ResampleContext, phase_shift, PHASE_SHIFT);
36 AV_CHECK_OFFSET(struct ResampleContext, phase_mask, PHASE_MASK);
37 
38 void ff_resample_one_flt_neon(struct ResampleContext *c, void *dst0,
39  int dst_index, const void *src0,
40  unsigned int index, int frac);
41 void ff_resample_one_s16_neon(struct ResampleContext *c, void *dst0,
42  int dst_index, const void *src0,
43  unsigned int index, int frac);
44 void ff_resample_one_s32_neon(struct ResampleContext *c, void *dst0,
45  int dst_index, const void *src0,
46  unsigned int index, int frac);
47 
48 void ff_resample_linear_flt_neon(struct ResampleContext *c, void *dst0,
49  int dst_index, const void *src0,
50  unsigned int index, int frac);
51 
53  enum AVSampleFormat sample_fmt)
54 {
56  if (have_neon(cpu_flags)) {
57  switch (sample_fmt) {
58  case AV_SAMPLE_FMT_FLTP:
59  if (c->linear)
61  else
63  break;
64  case AV_SAMPLE_FMT_S16P:
65  if (!c->linear)
67  break;
68  case AV_SAMPLE_FMT_S32P:
69  if (!c->linear)
71  break;
72  }
73  }
74 }
float, planar
Definition: samplefmt.h:69
AV_CHECK_OFFSET(struct ResampleContext, filter_bank, FILTER_BANK)
static atomic_int cpu_flags
Definition: cpu.c:50
#define FILTER_BANK
Definition: asm-offsets.h:23
void ff_resample_one_s16_neon(struct ResampleContext *c, void *dst0, int dst_index, const void *src0, unsigned int index, int frac)
#define PHASE_MASK
Definition: asm-offsets.h:26
#define av_cold
Definition: attributes.h:82
#define SRC_INCR
Definition: asm-offsets.h:25
void ff_resample_linear_flt_neon(struct ResampleContext *c, void *dst0, int dst_index, const void *src0, unsigned int index, int frac)
common internal API header
void ff_resample_one_flt_neon(struct ResampleContext *c, void *dst0, int dst_index, const void *src0, unsigned int index, int frac)
av_cold void ff_audio_resample_init_arm(ResampleContext *c, enum AVSampleFormat sample_fmt)
Definition: resample_init.c:52
#define have_neon(flags)
Definition: cpu.h:26
signed 32 bits, planar
Definition: samplefmt.h:68
void ff_resample_one_s32_neon(struct ResampleContext *c, void *dst0, int dst_index, const void *src0, unsigned int index, int frac)
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
int index
Definition: gxfenc.c:89
#define src0
Definition: h264pred.c:138
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:93
#define FILTER_LENGTH
Definition: asm-offsets.h:24
void(* resample_one)(struct ResampleContext *c, void *dst0, int dst_index, const void *src0, unsigned int index, int frac)
Definition: resample.h:45
#define PHASE_SHIFT
Definition: asm-offsets.h:25
static double c[64]
signed 16 bits, planar
Definition: samplefmt.h:67