1 /*
2 * Copyright (c) 2012
3 * MIPS Technologies, Inc., California.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * Author: Stanislav Ocovaj (socovaj@mips.com)
30 *
31 * AC3 fixed-point decoder for MIPS platforms
32 *
33 * This file is part of FFmpeg.
34 *
35 * FFmpeg is free software; you can redistribute it and/or
36 * modify it under the terms of the GNU Lesser General Public
37 * License as published by the Free Software Foundation; either
38 * version 2.1 of the License, or (at your option) any later version.
39 *
40 * FFmpeg is distributed in the hope that it will be useful,
41 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
43 * Lesser General Public License for more details.
44 *
45 * You should have received a copy of the GNU Lesser General Public
46 * License along with FFmpeg; if not, write to the Free Software
47 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
48 */
49
53 #define IMDCT_TYPE AV_TX_INT32_MDCT
54
56
58 {
59 50529027, 44278013, 39403370, 32292987, 27356480, 23729101, 20951060, 18755316
60 };
61
65 int dynrng,
67 {
70 int temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
71
72 mul = (dynrng & 0x1f) + 0x20;
77
79 temp1 =
src[
i+1] * mul;
81 temp2 =
src[
i+2] * mul;
82
83 temp1 = temp1 +
round;
85 temp3 =
src[
i+3] * mul;
86 temp2 = temp2 +
round;
87
89 temp4 =
src[
i + 4] * mul;
90 temp3 = temp3 +
round;
92
93 temp5 =
src[
i+5] * mul;
94 temp4 = temp4 +
round;
96 temp6 =
src[
i+6] * mul;
97
99 temp5 = temp5 +
round;
100 temp7 =
src[
i+7] * mul;
101 temp6 = temp6 +
round;
102
104 temp7 = temp7 +
round;
107
108 }
109 } else {
113
122 }
123 }
124 }
125
126 /**
127 * Downmix samples from original signal to stereo or mono (this is for 16-bit samples
128 * and fixed point decoder - original (for 32-bit samples) is in ac3dsp.c).
129 */
131 int out_ch,
int in_ch,
int len)
132 {
134 int v0, v1;
135 if (out_ch == 2) {
136 for (
i = 0;
i <
len;
i++) {
137 v0 = v1 = 0;
138 for (j = 0; j < in_ch; j++) {
141 }
144 }
145 } else if (out_ch == 1) {
146 for (
i = 0;
i <
len;
i++) {
147 v0 = 0;
148 for (j = 0; j < in_ch; j++)
151 }
152 }
153 }
154
157
159 {
"cons_noisegen",
"enable consistent noise generation",
OFFSET(consistent_noise_generation),
AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1,
PAR },
160 {
"drc_scale",
"percentage of dynamic range compression to apply",
OFFSET(drc_scale),
AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0,
PAR },
161 {
"heavy_compr",
"enable heavy dynamic range compression",
OFFSET(heavy_compression),
AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1,
PAR },
164 };
165
171 };
172
174 .
p.
name =
"ac3_fixed",
179 .priv_data_size = sizeof (AC3DecodeContext),
188 };