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
21dcecc3
Commit
21dcecc3
authored
Oct 14, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atrac1: use optimized float_interleave() function for stereo interleaving
parent
96b5702e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
atrac1.c
libavcodec/atrac1.c
+19
-7
No files found.
libavcodec/atrac1.c
View file @
21dcecc3
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include "get_bits.h"
#include "get_bits.h"
#include "dsputil.h"
#include "dsputil.h"
#include "fft.h"
#include "fft.h"
#include "fmtconvert.h"
#include "sinewin.h"
#include "sinewin.h"
#include "atrac.h"
#include "atrac.h"
...
@@ -78,10 +79,11 @@ typedef struct {
...
@@ -78,10 +79,11 @@ typedef struct {
DECLARE_ALIGNED
(
32
,
float
,
mid
)[
256
];
DECLARE_ALIGNED
(
32
,
float
,
mid
)[
256
];
DECLARE_ALIGNED
(
32
,
float
,
high
)[
512
];
DECLARE_ALIGNED
(
32
,
float
,
high
)[
512
];
float
*
bands
[
3
];
float
*
bands
[
3
];
DECLARE_ALIGNED
(
32
,
float
,
out_samples
)[
AT1_MAX_CHANNELS
][
AT1_SU_SAMPLE
S
];
float
*
out_samples
[
AT1_MAX_CHANNEL
S
];
FFTContext
mdct_ctx
[
3
];
FFTContext
mdct_ctx
[
3
];
int
channels
;
int
channels
;
DSPContext
dsp
;
DSPContext
dsp
;
FmtConvertContext
fmt_conv
;
}
AT1Ctx
;
}
AT1Ctx
;
/** size of the transform in samples in the long mode for each QMF band */
/** size of the transform in samples in the long mode for each QMF band */
...
@@ -276,7 +278,7 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -276,7 +278,7 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int
buf_size
=
avpkt
->
size
;
AT1Ctx
*
q
=
avctx
->
priv_data
;
AT1Ctx
*
q
=
avctx
->
priv_data
;
int
ch
,
ret
,
i
,
out_size
;
int
ch
,
ret
,
out_size
;
GetBitContext
gb
;
GetBitContext
gb
;
float
*
samples
=
data
;
float
*
samples
=
data
;
...
@@ -313,12 +315,10 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -313,12 +315,10 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
at1_subband_synthesis
(
q
,
su
,
q
->
channels
==
1
?
samples
:
q
->
out_samples
[
ch
]);
at1_subband_synthesis
(
q
,
su
,
q
->
channels
==
1
?
samples
:
q
->
out_samples
[
ch
]);
}
}
/* interleave
; FIXME, should create/use a DSP function
*/
/* interleave */
if
(
q
->
channels
==
2
)
{
if
(
q
->
channels
==
2
)
{
for
(
i
=
0
;
i
<
AT1_SU_SAMPLES
;
i
++
)
{
q
->
fmt_conv
.
float_interleave
(
samples
,
(
const
float
**
)
q
->
out_samples
,
samples
[
i
*
2
]
=
q
->
out_samples
[
0
][
i
];
AT1_SU_SAMPLES
,
2
);
samples
[
i
*
2
+
1
]
=
q
->
out_samples
[
1
][
i
];
}
}
}
*
data_size
=
out_size
;
*
data_size
=
out_size
;
...
@@ -339,6 +339,15 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
...
@@ -339,6 +339,15 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
}
}
q
->
channels
=
avctx
->
channels
;
q
->
channels
=
avctx
->
channels
;
if
(
avctx
->
channels
==
2
)
{
q
->
out_samples
[
0
]
=
av_malloc
(
2
*
AT1_SU_SAMPLES
*
sizeof
(
*
q
->
out_samples
[
0
]));
q
->
out_samples
[
1
]
=
q
->
out_samples
[
0
]
+
AT1_SU_SAMPLES
;
if
(
!
q
->
out_samples
[
0
])
{
av_freep
(
&
q
->
out_samples
[
0
]);
return
AVERROR
(
ENOMEM
);
}
}
/* Init the mdct transforms */
/* Init the mdct transforms */
ff_mdct_init
(
&
q
->
mdct_ctx
[
0
],
6
,
1
,
-
1
.
0
/
(
1
<<
15
));
ff_mdct_init
(
&
q
->
mdct_ctx
[
0
],
6
,
1
,
-
1
.
0
/
(
1
<<
15
));
ff_mdct_init
(
&
q
->
mdct_ctx
[
1
],
8
,
1
,
-
1
.
0
/
(
1
<<
15
));
ff_mdct_init
(
&
q
->
mdct_ctx
[
1
],
8
,
1
,
-
1
.
0
/
(
1
<<
15
));
...
@@ -349,6 +358,7 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
...
@@ -349,6 +358,7 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
atrac_generate_tables
();
atrac_generate_tables
();
dsputil_init
(
&
q
->
dsp
,
avctx
);
dsputil_init
(
&
q
->
dsp
,
avctx
);
ff_fmt_convert_init
(
&
q
->
fmt_conv
,
avctx
);
q
->
bands
[
0
]
=
q
->
low
;
q
->
bands
[
0
]
=
q
->
low
;
q
->
bands
[
1
]
=
q
->
mid
;
q
->
bands
[
1
]
=
q
->
mid
;
...
@@ -367,6 +377,8 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
...
@@ -367,6 +377,8 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
static
av_cold
int
atrac1_decode_end
(
AVCodecContext
*
avctx
)
{
static
av_cold
int
atrac1_decode_end
(
AVCodecContext
*
avctx
)
{
AT1Ctx
*
q
=
avctx
->
priv_data
;
AT1Ctx
*
q
=
avctx
->
priv_data
;
av_freep
(
&
q
->
out_samples
[
0
]);
ff_mdct_end
(
&
q
->
mdct_ctx
[
0
]);
ff_mdct_end
(
&
q
->
mdct_ctx
[
0
]);
ff_mdct_end
(
&
q
->
mdct_ctx
[
1
]);
ff_mdct_end
(
&
q
->
mdct_ctx
[
1
]);
ff_mdct_end
(
&
q
->
mdct_ctx
[
2
]);
ff_mdct_end
(
&
q
->
mdct_ctx
[
2
]);
...
...
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