Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e32aaba3
Commit
e32aaba3
authored
Nov 07, 2011
by
Vitor Sessak
Committed by
Michael Niedermayer
Nov 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegaudiodec: move imdct36() to MPADSPContext
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
df9c1cfb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
135 deletions
+158
-135
mpegaudiodec.c
libavcodec/mpegaudiodec.c
+21
-135
mpegaudiodsp.c
libavcodec/mpegaudiodsp.c
+3
-0
mpegaudiodsp.h
libavcodec/mpegaudiodsp.h
+5
-0
mpegaudiodsp_template.c
libavcodec/mpegaudiodsp_template.c
+129
-0
No files found.
libavcodec/mpegaudiodec.c
View file @
e32aaba3
...
@@ -58,7 +58,7 @@ typedef struct GranuleDef {
...
@@ -58,7 +58,7 @@ typedef struct GranuleDef {
int
preflag
;
int
preflag
;
int
short_start
,
long_end
;
/* long/short band indexes */
int
short_start
,
long_end
;
/* long/short band indexes */
uint8_t
scale_factors
[
40
];
uint8_t
scale_factors
[
40
];
INTFLOAT
sb_hybrid
[
SBLIMIT
*
18
];
/* 576 samples */
DECLARE_ALIGNED
(
16
,
INTFLOAT
,
sb_hybrid
)
[
SBLIMIT
*
18
];
/* 576 samples */
}
GranuleDef
;
}
GranuleDef
;
typedef
struct
MPADecodeContext
{
typedef
struct
MPADecodeContext
{
...
@@ -129,7 +129,10 @@ static uint16_t band_index_long[9][23];
...
@@ -129,7 +129,10 @@ static uint16_t band_index_long[9][23];
static
INTFLOAT
is_table
[
2
][
16
];
static
INTFLOAT
is_table
[
2
][
16
];
static
INTFLOAT
is_table_lsf
[
2
][
2
][
16
];
static
INTFLOAT
is_table_lsf
[
2
][
2
][
16
];
static
INTFLOAT
csa_table
[
8
][
4
];
static
INTFLOAT
csa_table
[
8
][
4
];
static
INTFLOAT
mdct_win
[
8
][
36
];
/** Window for MDCT. Note that only the component [0,17] and [20,37] are used,
the components 18 and 19 are there only to assure 128-bit alignment for asm
*/
DECLARE_ALIGNED
(
16
,
static
INTFLOAT
,
mdct_win
)[
8
][
40
];
static
int16_t
division_tab3
[
1
<<
6
];
static
int16_t
division_tab3
[
1
<<
6
];
static
int16_t
division_tab5
[
1
<<
8
];
static
int16_t
division_tab5
[
1
<<
8
];
...
@@ -455,15 +458,17 @@ static av_cold int decode_init(AVCodecContext * avctx)
...
@@ -455,15 +458,17 @@ static av_cold int decode_init(AVCodecContext * avctx)
if
(
j
==
2
)
if
(
j
==
2
)
mdct_win
[
j
][
i
/
3
]
=
FIXHR
((
d
/
(
1
<<
5
)));
mdct_win
[
j
][
i
/
3
]
=
FIXHR
((
d
/
(
1
<<
5
)));
else
else
{
mdct_win
[
j
][
i
]
=
FIXHR
((
d
/
(
1
<<
5
)));
int
idx
=
i
<
18
?
i
:
i
+
2
;
mdct_win
[
j
][
idx
]
=
FIXHR
((
d
/
(
1
<<
5
)));
}
}
}
}
}
/* NOTE: we do frequency inversion adter the MDCT by changing
/* NOTE: we do frequency inversion adter the MDCT by changing
the sign of the right window coefs */
the sign of the right window coefs */
for
(
j
=
0
;
j
<
4
;
j
++
)
{
for
(
j
=
0
;
j
<
4
;
j
++
)
{
for
(
i
=
0
;
i
<
36
;
i
+=
2
)
{
for
(
i
=
0
;
i
<
40
;
i
+=
2
)
{
mdct_win
[
j
+
4
][
i
]
=
mdct_win
[
j
][
i
];
mdct_win
[
j
+
4
][
i
]
=
mdct_win
[
j
][
i
];
mdct_win
[
j
+
4
][
i
+
1
]
=
-
mdct_win
[
j
][
i
+
1
];
mdct_win
[
j
+
4
][
i
+
1
]
=
-
mdct_win
[
j
][
i
+
1
];
}
}
...
@@ -478,32 +483,9 @@ static av_cold int decode_init(AVCodecContext * avctx)
...
@@ -478,32 +483,9 @@ static av_cold int decode_init(AVCodecContext * avctx)
}
}
#define C3 FIXHR(0.86602540378443864676/2)
#define C3 FIXHR(0.86602540378443864676/2)
#define C4 FIXHR(0.70710678118654752439/2) //0.5 / cos(pi*(9)/36)
/* 0.5 / cos(pi*(2*i+1)/36) */
#define C5 FIXHR(0.51763809020504152469/2) //0.5 / cos(pi*(5)/36)
static
const
INTFLOAT
icos36
[
9
]
=
{
#define C6 FIXHR(1.93185165257813657349/4) //0.5 / cos(pi*(15)/36)
FIXR
(
0
.
50190991877167369479
),
FIXR
(
0
.
51763809020504152469
),
//0
FIXR
(
0
.
55168895948124587824
),
FIXR
(
0
.
61038729438072803416
),
FIXR
(
0
.
70710678118654752439
),
//1
FIXR
(
0
.
87172339781054900991
),
FIXR
(
1
.
18310079157624925896
),
FIXR
(
1
.
93185165257813657349
),
//2
FIXR
(
5
.
73685662283492756461
),
};
/* 0.5 / cos(pi*(2*i+1)/36) */
static
const
INTFLOAT
icos36h
[
9
]
=
{
FIXHR
(
0
.
50190991877167369479
/
2
),
FIXHR
(
0
.
51763809020504152469
/
2
),
//0
FIXHR
(
0
.
55168895948124587824
/
2
),
FIXHR
(
0
.
61038729438072803416
/
2
),
FIXHR
(
0
.
70710678118654752439
/
2
),
//1
FIXHR
(
0
.
87172339781054900991
/
2
),
FIXHR
(
1
.
18310079157624925896
/
4
),
FIXHR
(
1
.
93185165257813657349
/
4
),
//2
// FIXHR(5.73685662283492756461),
};
/* 12 points IMDCT. We compute it "by hand" by factorizing obvious
/* 12 points IMDCT. We compute it "by hand" by factorizing obvious
cases. */
cases. */
...
@@ -524,7 +506,7 @@ static void imdct12(INTFLOAT *out, INTFLOAT *in)
...
@@ -524,7 +506,7 @@ static void imdct12(INTFLOAT *out, INTFLOAT *in)
in3
=
MULH3
(
in3
,
C3
,
4
);
in3
=
MULH3
(
in3
,
C3
,
4
);
t1
=
in0
-
in4
;
t1
=
in0
-
in4
;
t2
=
MULH3
(
in1
-
in5
,
icos36h
[
4
]
,
2
);
t2
=
MULH3
(
in1
-
in5
,
C4
,
2
);
out
[
7
]
=
out
[
7
]
=
out
[
10
]
=
t1
+
t2
;
out
[
10
]
=
t1
+
t2
;
...
@@ -534,112 +516,20 @@ static void imdct12(INTFLOAT *out, INTFLOAT *in)
...
@@ -534,112 +516,20 @@ static void imdct12(INTFLOAT *out, INTFLOAT *in)
in0
+=
SHR
(
in4
,
1
);
in0
+=
SHR
(
in4
,
1
);
in4
=
in0
+
in2
;
in4
=
in0
+
in2
;
in5
+=
2
*
in1
;
in5
+=
2
*
in1
;
in1
=
MULH3
(
in5
+
in3
,
icos36h
[
1
]
,
1
);
in1
=
MULH3
(
in5
+
in3
,
C5
,
1
);
out
[
8
]
=
out
[
8
]
=
out
[
9
]
=
in4
+
in1
;
out
[
9
]
=
in4
+
in1
;
out
[
2
]
=
out
[
2
]
=
out
[
3
]
=
in4
-
in1
;
out
[
3
]
=
in4
-
in1
;
in0
-=
in2
;
in0
-=
in2
;
in5
=
MULH3
(
in5
-
in3
,
icos36h
[
7
]
,
2
);
in5
=
MULH3
(
in5
-
in3
,
C6
,
2
);
out
[
0
]
=
out
[
0
]
=
out
[
5
]
=
in0
-
in5
;
out
[
5
]
=
in0
-
in5
;
out
[
6
]
=
out
[
6
]
=
out
[
11
]
=
in0
+
in5
;
out
[
11
]
=
in0
+
in5
;
}
}
/* cos(pi*i/18) */
#define C1 FIXHR(0.98480775301220805936/2)
#define C2 FIXHR(0.93969262078590838405/2)
#define C3 FIXHR(0.86602540378443864676/2)
#define C4 FIXHR(0.76604444311897803520/2)
#define C5 FIXHR(0.64278760968653932632/2)
#define C6 FIXHR(0.5/2)
#define C7 FIXHR(0.34202014332566873304/2)
#define C8 FIXHR(0.17364817766693034885/2)
/* using Lee like decomposition followed by hand coded 9 points DCT */
static
void
imdct36
(
INTFLOAT
*
out
,
INTFLOAT
*
buf
,
INTFLOAT
*
in
,
INTFLOAT
*
win
)
{
int
i
,
j
;
INTFLOAT
t0
,
t1
,
t2
,
t3
,
s0
,
s1
,
s2
,
s3
;
INTFLOAT
tmp
[
18
],
*
tmp1
,
*
in1
;
for
(
i
=
17
;
i
>=
1
;
i
--
)
in
[
i
]
+=
in
[
i
-
1
];
for
(
i
=
17
;
i
>=
3
;
i
-=
2
)
in
[
i
]
+=
in
[
i
-
2
];
for
(
j
=
0
;
j
<
2
;
j
++
)
{
tmp1
=
tmp
+
j
;
in1
=
in
+
j
;
t2
=
in1
[
2
*
4
]
+
in1
[
2
*
8
]
-
in1
[
2
*
2
];
t3
=
in1
[
2
*
0
]
+
SHR
(
in1
[
2
*
6
],
1
);
t1
=
in1
[
2
*
0
]
-
in1
[
2
*
6
];
tmp1
[
6
]
=
t1
-
SHR
(
t2
,
1
);
tmp1
[
16
]
=
t1
+
t2
;
t0
=
MULH3
(
in1
[
2
*
2
]
+
in1
[
2
*
4
]
,
C2
,
2
);
t1
=
MULH3
(
in1
[
2
*
4
]
-
in1
[
2
*
8
]
,
-
2
*
C8
,
1
);
t2
=
MULH3
(
in1
[
2
*
2
]
+
in1
[
2
*
8
]
,
-
C4
,
2
);
tmp1
[
10
]
=
t3
-
t0
-
t2
;
tmp1
[
2
]
=
t3
+
t0
+
t1
;
tmp1
[
14
]
=
t3
+
t2
-
t1
;
tmp1
[
4
]
=
MULH3
(
in1
[
2
*
5
]
+
in1
[
2
*
7
]
-
in1
[
2
*
1
],
-
C3
,
2
);
t2
=
MULH3
(
in1
[
2
*
1
]
+
in1
[
2
*
5
],
C1
,
2
);
t3
=
MULH3
(
in1
[
2
*
5
]
-
in1
[
2
*
7
],
-
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out
[(
9
+
4
)
*
SBLIMIT
]
=
MULH3
(
t1
,
win
[
9
+
4
],
1
)
+
buf
[
9
+
4
];
out
[(
8
-
4
)
*
SBLIMIT
]
=
MULH3
(
t1
,
win
[
8
-
4
],
1
)
+
buf
[
8
-
4
];
buf
[
9
+
4
]
=
MULH3
(
t0
,
win
[
18
+
9
+
4
],
1
);
buf
[
8
-
4
]
=
MULH3
(
t0
,
win
[
18
+
8
-
4
],
1
);
}
/* return the number of decoded frames */
/* return the number of decoded frames */
static
int
mp_decode_layer1
(
MPADecodeContext
*
s
)
static
int
mp_decode_layer1
(
MPADecodeContext
*
s
)
{
{
...
@@ -1361,7 +1251,7 @@ static void compute_antialias(MPADecodeContext *s, GranuleDef *g)
...
@@ -1361,7 +1251,7 @@ static void compute_antialias(MPADecodeContext *s, GranuleDef *g)
static
void
compute_imdct
(
MPADecodeContext
*
s
,
GranuleDef
*
g
,
static
void
compute_imdct
(
MPADecodeContext
*
s
,
GranuleDef
*
g
,
INTFLOAT
*
sb_samples
,
INTFLOAT
*
mdct_buf
)
INTFLOAT
*
sb_samples
,
INTFLOAT
*
mdct_buf
)
{
{
INTFLOAT
*
win
,
*
win1
,
*
out_ptr
,
*
ptr
,
*
buf
,
*
ptr1
;
INTFLOAT
*
win
,
*
out_ptr
,
*
ptr
,
*
buf
,
*
ptr1
;
INTFLOAT
out2
[
12
];
INTFLOAT
out2
[
12
];
int
i
,
j
,
mdct_long_end
,
sblimit
;
int
i
,
j
,
mdct_long_end
,
sblimit
;
...
@@ -1390,23 +1280,19 @@ static void compute_imdct(MPADecodeContext *s, GranuleDef *g,
...
@@ -1390,23 +1280,19 @@ static void compute_imdct(MPADecodeContext *s, GranuleDef *g,
buf
=
mdct_buf
;
buf
=
mdct_buf
;
ptr
=
g
->
sb_hybrid
;
ptr
=
g
->
sb_hybrid
;
for
(
j
=
0
;
j
<
mdct_long_end
;
j
++
)
{
for
(
j
=
0
;
j
<
mdct_long_end
;
j
++
)
{
int
win_idx
=
(
g
->
switch_point
&&
j
<
2
)
?
0
:
g
->
block_type
;
/* apply window & overlap with previous buffer */
/* apply window & overlap with previous buffer */
out_ptr
=
sb_samples
+
j
;
out_ptr
=
sb_samples
+
j
;
/* select window */
/* select window */
if
(
g
->
switch_point
&&
j
<
2
)
win
=
mdct_win
[
win_idx
+
(
4
&
-
(
j
&
1
))];
win1
=
mdct_win
[
0
];
s
->
mpadsp
.
RENAME
(
imdct36
)(
out_ptr
,
buf
,
ptr
,
win
);
else
win1
=
mdct_win
[
g
->
block_type
];
/* select frequency inversion */
win
=
win1
+
((
4
*
36
)
&
-
(
j
&
1
));
imdct36
(
out_ptr
,
buf
,
ptr
,
win
);
out_ptr
+=
18
*
SBLIMIT
;
out_ptr
+=
18
*
SBLIMIT
;
ptr
+=
18
;
ptr
+=
18
;
buf
+=
18
;
buf
+=
18
;
}
}
for
(
j
=
mdct_long_end
;
j
<
sblimit
;
j
++
)
{
for
(
j
=
mdct_long_end
;
j
<
sblimit
;
j
++
)
{
/* select frequency inversion */
/* select frequency inversion */
win
=
mdct_win
[
2
]
+
((
4
*
36
)
&
-
(
j
&
1
))
;
win
=
mdct_win
[
2
+
(
4
&
-
(
j
&
1
))]
;
out_ptr
=
sb_samples
+
j
;
out_ptr
=
sb_samples
+
j
;
for
(
i
=
0
;
i
<
6
;
i
++
)
{
for
(
i
=
0
;
i
<
6
;
i
++
)
{
...
...
libavcodec/mpegaudiodsp.c
View file @
e32aaba3
...
@@ -35,6 +35,9 @@ void ff_mpadsp_init(MPADSPContext *s)
...
@@ -35,6 +35,9 @@ void ff_mpadsp_init(MPADSPContext *s)
s
->
dct32_float
=
dct
.
dct32
;
s
->
dct32_float
=
dct
.
dct32
;
s
->
dct32_fixed
=
ff_dct32_fixed
;
s
->
dct32_fixed
=
ff_dct32_fixed
;
s
->
imdct36_float
=
ff_imdct36_float
;
s
->
imdct36_fixed
=
ff_imdct36_fixed
;
if
(
ARCH_ARM
)
ff_mpadsp_init_arm
(
s
);
if
(
ARCH_ARM
)
ff_mpadsp_init_arm
(
s
);
if
(
HAVE_MMX
)
ff_mpadsp_init_mmx
(
s
);
if
(
HAVE_MMX
)
ff_mpadsp_init_mmx
(
s
);
if
(
HAVE_ALTIVEC
)
ff_mpadsp_init_altivec
(
s
);
if
(
HAVE_ALTIVEC
)
ff_mpadsp_init_altivec
(
s
);
...
...
libavcodec/mpegaudiodsp.h
View file @
e32aaba3
...
@@ -28,6 +28,8 @@ typedef struct MPADSPContext {
...
@@ -28,6 +28,8 @@ typedef struct MPADSPContext {
int
*
dither_state
,
int16_t
*
samples
,
int
incr
);
int
*
dither_state
,
int16_t
*
samples
,
int
incr
);
void
(
*
dct32_float
)(
float
*
dst
,
const
float
*
src
);
void
(
*
dct32_float
)(
float
*
dst
,
const
float
*
src
);
void
(
*
dct32_fixed
)(
int
*
dst
,
const
int
*
src
);
void
(
*
dct32_fixed
)(
int
*
dst
,
const
int
*
src
);
void
(
*
imdct36_float
)(
float
*
out
,
float
*
buf
,
float
*
in
,
float
*
win
);
void
(
*
imdct36_fixed
)(
int
*
out
,
int
*
buf
,
int
*
in
,
int
*
win
);
}
MPADSPContext
;
}
MPADSPContext
;
void
ff_mpadsp_init
(
MPADSPContext
*
s
);
void
ff_mpadsp_init
(
MPADSPContext
*
s
);
...
@@ -61,4 +63,7 @@ void ff_mpadsp_apply_window_fixed(int32_t *synth_buf, int32_t *window,
...
@@ -61,4 +63,7 @@ void ff_mpadsp_apply_window_fixed(int32_t *synth_buf, int32_t *window,
int
*
dither_state
,
int16_t
*
samples
,
int
*
dither_state
,
int16_t
*
samples
,
int
incr
);
int
incr
);
void
ff_imdct36_fixed
(
int
*
out
,
int
*
buf
,
int
*
in
,
int
*
win
);
void
ff_imdct36_float
(
float
*
out
,
float
*
buf
,
float
*
in
,
float
*
win
);
#endif
/* AVCODEC_MPEGAUDIODSP_H */
#endif
/* AVCODEC_MPEGAUDIODSP_H */
libavcodec/mpegaudiodsp_template.c
View file @
e32aaba3
...
@@ -39,7 +39,12 @@ static inline float round_sample(float *sum)
...
@@ -39,7 +39,12 @@ static inline float round_sample(float *sum)
#define MACS(rt, ra, rb) rt+=(ra)*(rb)
#define MACS(rt, ra, rb) rt+=(ra)*(rb)
#define MULS(ra, rb) ((ra)*(rb))
#define MULS(ra, rb) ((ra)*(rb))
#define MULH3(x, y, s) ((s)*(y)*(x))
#define MLSS(rt, ra, rb) rt-=(ra)*(rb)
#define MLSS(rt, ra, rb) rt-=(ra)*(rb)
#define MULLx(x, y, s) ((y)*(x))
#define FIXHR(x) ((float)(x))
#define FIXR(x) ((float)(x))
#define SHR(a,b) ((a)*(1.0f/(1<<(b))))
#else
#else
...
@@ -57,6 +62,11 @@ static inline int round_sample(int64_t *sum)
...
@@ -57,6 +62,11 @@ static inline int round_sample(int64_t *sum)
# define MULS(ra, rb) MUL64(ra, rb)
# define MULS(ra, rb) MUL64(ra, rb)
# define MACS(rt, ra, rb) MAC64(rt, ra, rb)
# define MACS(rt, ra, rb) MAC64(rt, ra, rb)
# define MLSS(rt, ra, rb) MLS64(rt, ra, rb)
# define MLSS(rt, ra, rb) MLS64(rt, ra, rb)
# define MULH3(x, y, s) MULH((s)*(x), y)
# define MULLx(x, y, s) MULL(x,y,s)
# define SHR(a,b) ((a)>>(b))
# define FIXR(a) ((int)((a) * FRAC_ONE + 0.5))
# define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5))
#endif
#endif
DECLARE_ALIGNED
(
16
,
MPA_INT
,
RENAME
(
ff_mpa_synth_window
))[
512
+
256
];
DECLARE_ALIGNED
(
16
,
MPA_INT
,
RENAME
(
ff_mpa_synth_window
))[
512
+
256
];
...
@@ -203,3 +213,122 @@ void av_cold RENAME(ff_mpa_synth_init)(MPA_INT *window)
...
@@ -203,3 +213,122 @@ void av_cold RENAME(ff_mpa_synth_init)(MPA_INT *window)
for
(
j
=
0
;
j
<
16
;
j
++
)
for
(
j
=
0
;
j
<
16
;
j
++
)
window
[
512
+
128
+
16
*
i
+
j
]
=
window
[
64
*
i
+
48
-
j
];
window
[
512
+
128
+
16
*
i
+
j
]
=
window
[
64
*
i
+
48
-
j
];
}
}
/* cos(pi*i/18) */
#define C1 FIXHR(0.98480775301220805936/2)
#define C2 FIXHR(0.93969262078590838405/2)
#define C3 FIXHR(0.86602540378443864676/2)
#define C4 FIXHR(0.76604444311897803520/2)
#define C5 FIXHR(0.64278760968653932632/2)
#define C6 FIXHR(0.5/2)
#define C7 FIXHR(0.34202014332566873304/2)
#define C8 FIXHR(0.17364817766693034885/2)
/* 0.5 / cos(pi*(2*i+1)/36) */
static
const
INTFLOAT
icos36
[
9
]
=
{
FIXR
(
0
.
50190991877167369479
),
FIXR
(
0
.
51763809020504152469
),
FIXR
(
0
.
55168895948124587824
),
FIXR
(
0
.
61038729438072803416
),
FIXR
(
0
.
70710678118654752439
),
FIXR
(
0
.
87172339781054900991
),
FIXR
(
1
.
18310079157624925896
),
FIXR
(
1
.
93185165257813657349
),
FIXR
(
5
.
73685662283492756461
),
};
/* 0.5 / cos(pi*(2*i+1)/36) */
static
const
INTFLOAT
icos36h
[
9
]
=
{
FIXHR
(
0
.
50190991877167369479
/
2
),
FIXHR
(
0
.
51763809020504152469
/
2
),
FIXHR
(
0
.
55168895948124587824
/
2
),
FIXHR
(
0
.
61038729438072803416
/
2
),
FIXHR
(
0
.
70710678118654752439
/
2
),
FIXHR
(
0
.
87172339781054900991
/
2
),
FIXHR
(
1
.
18310079157624925896
/
4
),
FIXHR
(
1
.
93185165257813657349
/
4
),
};
/* using Lee like decomposition followed by hand coded 9 points DCT */
void
RENAME
(
ff_imdct36
)(
INTFLOAT
*
out
,
INTFLOAT
*
buf
,
INTFLOAT
*
in
,
INTFLOAT
*
win
)
{
int
i
,
j
;
INTFLOAT
t0
,
t1
,
t2
,
t3
,
s0
,
s1
,
s2
,
s3
;
INTFLOAT
tmp
[
18
],
*
tmp1
,
*
in1
;
for
(
i
=
17
;
i
>=
1
;
i
--
)
in
[
i
]
+=
in
[
i
-
1
];
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1
=
MULH3
(
t3
+
t2
,
icos36h
[
j
],
2
);
s3
=
MULLx
(
t3
-
t2
,
icos36
[
8
-
j
],
FRAC_BITS
);
t0
=
s0
+
s1
;
t1
=
s0
-
s1
;
out
[(
9
+
j
)
*
SBLIMIT
]
=
MULH3
(
t1
,
win
[
9
+
j
],
1
)
+
buf
[
9
+
j
];
out
[(
8
-
j
)
*
SBLIMIT
]
=
MULH3
(
t1
,
win
[
8
-
j
],
1
)
+
buf
[
8
-
j
];
buf
[
9
+
j
]
=
MULH3
(
t0
,
win
[
20
+
9
+
j
],
1
);
buf
[
8
-
j
]
=
MULH3
(
t0
,
win
[
20
+
8
-
j
],
1
);
t0
=
s2
+
s3
;
t1
=
s2
-
s3
;
out
[(
9
+
8
-
j
)
*
SBLIMIT
]
=
MULH3
(
t1
,
win
[
9
+
8
-
j
],
1
)
+
buf
[
9
+
8
-
j
];
out
[(
j
)
*
SBLIMIT
]
=
MULH3
(
t1
,
win
[
j
],
1
)
+
buf
[
j
];
buf
[
9
+
8
-
j
]
=
MULH3
(
t0
,
win
[
20
+
9
+
8
-
j
],
1
);
buf
[
+
j
]
=
MULH3
(
t0
,
win
[
20
+
j
],
1
);
i
+=
4
;
}
s0
=
tmp
[
16
];
s1
=
MULH3
(
tmp
[
17
],
icos36h
[
4
],
2
);
t0
=
s0
+
s1
;
t1
=
s0
-
s1
;
out
[(
9
+
4
)
*
SBLIMIT
]
=
MULH3
(
t1
,
win
[
9
+
4
],
1
)
+
buf
[
9
+
4
];
out
[(
8
-
4
)
*
SBLIMIT
]
=
MULH3
(
t1
,
win
[
8
-
4
],
1
)
+
buf
[
8
-
4
];
buf
[
9
+
4
]
=
MULH3
(
t0
,
win
[
20
+
9
+
4
],
1
);
buf
[
8
-
4
]
=
MULH3
(
t0
,
win
[
20
+
8
-
4
],
1
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment