yading@10
|
1 /*
|
yading@10
|
2 * Format Conversion Utils
|
yading@10
|
3 * Copyright (c) 2000, 2001 Fabrice Bellard
|
yading@10
|
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
|
yading@10
|
5 *
|
yading@10
|
6 * This file is part of FFmpeg.
|
yading@10
|
7 *
|
yading@10
|
8 * FFmpeg is free software; you can redistribute it and/or
|
yading@10
|
9 * modify it under the terms of the GNU Lesser General Public
|
yading@10
|
10 * License as published by the Free Software Foundation; either
|
yading@10
|
11 * version 2.1 of the License, or (at your option) any later version.
|
yading@10
|
12 *
|
yading@10
|
13 * FFmpeg is distributed in the hope that it will be useful,
|
yading@10
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@10
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@10
|
16 * Lesser General Public License for more details.
|
yading@10
|
17 *
|
yading@10
|
18 * You should have received a copy of the GNU Lesser General Public
|
yading@10
|
19 * License along with FFmpeg; if not, write to the Free Software
|
yading@10
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@10
|
21 */
|
yading@10
|
22
|
yading@10
|
23 #ifndef AVCODEC_FMTCONVERT_H
|
yading@10
|
24 #define AVCODEC_FMTCONVERT_H
|
yading@10
|
25
|
yading@10
|
26 #include "avcodec.h"
|
yading@10
|
27
|
yading@10
|
28 typedef struct FmtConvertContext {
|
yading@10
|
29 /**
|
yading@10
|
30 * Convert an array of int32_t to float and multiply by a float value.
|
yading@10
|
31 * @param dst destination array of float.
|
yading@10
|
32 * constraints: 16-byte aligned
|
yading@10
|
33 * @param src source array of int32_t.
|
yading@10
|
34 * constraints: 16-byte aligned
|
yading@10
|
35 * @param len number of elements to convert.
|
yading@10
|
36 * constraints: multiple of 8
|
yading@10
|
37 */
|
yading@10
|
38 void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len);
|
yading@10
|
39
|
yading@10
|
40 /**
|
yading@10
|
41 * Convert an array of float to an array of int16_t.
|
yading@10
|
42 *
|
yading@10
|
43 * Convert floats from in the range [-32768.0,32767.0] to ints
|
yading@10
|
44 * without rescaling
|
yading@10
|
45 *
|
yading@10
|
46 * @param dst destination array of int16_t.
|
yading@10
|
47 * constraints: 16-byte aligned
|
yading@10
|
48 * @param src source array of float.
|
yading@10
|
49 * constraints: 16-byte aligned
|
yading@10
|
50 * @param len number of elements to convert.
|
yading@10
|
51 * constraints: multiple of 8
|
yading@10
|
52 */
|
yading@10
|
53 void (*float_to_int16)(int16_t *dst, const float *src, long len);
|
yading@10
|
54
|
yading@10
|
55 /**
|
yading@10
|
56 * Convert multiple arrays of float to an interleaved array of int16_t.
|
yading@10
|
57 *
|
yading@10
|
58 * Convert floats from in the range [-32768.0,32767.0] to ints
|
yading@10
|
59 * without rescaling
|
yading@10
|
60 *
|
yading@10
|
61 * @param dst destination array of interleaved int16_t.
|
yading@10
|
62 * constraints: 16-byte aligned
|
yading@10
|
63 * @param src source array of float arrays, one for each channel.
|
yading@10
|
64 * constraints: 16-byte aligned
|
yading@10
|
65 * @param len number of elements to convert.
|
yading@10
|
66 * constraints: multiple of 8
|
yading@10
|
67 * @param channels number of channels
|
yading@10
|
68 */
|
yading@10
|
69 void (*float_to_int16_interleave)(int16_t *dst, const float **src,
|
yading@10
|
70 long len, int channels);
|
yading@10
|
71
|
yading@10
|
72 /**
|
yading@10
|
73 * Convert multiple arrays of float to an array of interleaved float.
|
yading@10
|
74 *
|
yading@10
|
75 * @param dst destination array of interleaved float.
|
yading@10
|
76 * constraints: 16-byte aligned
|
yading@10
|
77 * @param src source array of float arrays, one for each channel.
|
yading@10
|
78 * constraints: 16-byte aligned
|
yading@10
|
79 * @param len number of elements to convert.
|
yading@10
|
80 * constraints: multiple of 8
|
yading@10
|
81 * @param channels number of channels
|
yading@10
|
82 */
|
yading@10
|
83 void (*float_interleave)(float *dst, const float **src, unsigned int len,
|
yading@10
|
84 int channels);
|
yading@10
|
85 } FmtConvertContext;
|
yading@10
|
86
|
yading@10
|
87 void ff_float_interleave_c(float *dst, const float **src, unsigned int len,
|
yading@10
|
88 int channels);
|
yading@10
|
89
|
yading@10
|
90 void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx);
|
yading@10
|
91
|
yading@10
|
92 void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx);
|
yading@10
|
93 void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx);
|
yading@10
|
94 void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx);
|
yading@10
|
95 void ff_fmt_convert_init_mips(FmtConvertContext *c);
|
yading@10
|
96
|
yading@10
|
97 /* ffdshow custom code */
|
yading@10
|
98 void float_interleave(float *dst, const float **src, long len, int channels);
|
yading@10
|
99 void float_interleave_noscale(float *dst, const float **src, long len, int channels);
|
yading@10
|
100
|
yading@10
|
101 #endif /* AVCODEC_FMTCONVERT_H */
|