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
5e76b8bb
Commit
5e76b8bb
authored
Oct 14, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atrac3: use optimized float_interleave() function for stereo interleaving
parent
8af33cb3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
atrac3.c
libavcodec/atrac3.c
+19
-7
No files found.
libavcodec/atrac3.c
View file @
5e76b8bb
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
#include "dsputil.h"
#include "dsputil.h"
#include "bytestream.h"
#include "bytestream.h"
#include "fft.h"
#include "fft.h"
#include "fmtconvert.h"
#include "atrac.h"
#include "atrac.h"
#include "atrac3data.h"
#include "atrac3data.h"
...
@@ -107,7 +108,7 @@ typedef struct {
...
@@ -107,7 +108,7 @@ typedef struct {
//@}
//@}
//@{
//@{
/** data buffers */
/** data buffers */
float
outSamples
[
2048
];
float
*
outSamples
[
2
];
uint8_t
*
decoded_bytes_buffer
;
uint8_t
*
decoded_bytes_buffer
;
float
tempBuf
[
1070
];
float
tempBuf
[
1070
];
//@}
//@}
...
@@ -120,6 +121,7 @@ typedef struct {
...
@@ -120,6 +121,7 @@ typedef struct {
//@}
//@}
FFTContext
mdct_ctx
;
FFTContext
mdct_ctx
;
FmtConvertContext
fmt_conv
;
}
ATRAC3Context
;
}
ATRAC3Context
;
static
DECLARE_ALIGNED
(
32
,
float
,
mdct_window
)[
512
];
static
DECLARE_ALIGNED
(
32
,
float
,
mdct_window
)[
512
];
...
@@ -221,6 +223,8 @@ static av_cold int atrac3_decode_close(AVCodecContext *avctx)
...
@@ -221,6 +223,8 @@ static av_cold int atrac3_decode_close(AVCodecContext *avctx)
av_free
(
q
->
pUnits
);
av_free
(
q
->
pUnits
);
av_free
(
q
->
decoded_bytes_buffer
);
av_free
(
q
->
decoded_bytes_buffer
);
av_freep
(
&
q
->
outSamples
[
0
]);
ff_mdct_end
(
&
q
->
mdct_ctx
);
ff_mdct_end
(
&
q
->
mdct_ctx
);
return
0
;
return
0
;
...
@@ -824,7 +828,7 @@ static int atrac3_decode_frame(AVCodecContext *avctx,
...
@@ -824,7 +828,7 @@ static int atrac3_decode_frame(AVCodecContext *avctx,
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int
buf_size
=
avpkt
->
size
;
ATRAC3Context
*
q
=
avctx
->
priv_data
;
ATRAC3Context
*
q
=
avctx
->
priv_data
;
int
result
=
0
,
i
;
int
result
=
0
;
const
uint8_t
*
databuf
;
const
uint8_t
*
databuf
;
float
*
samples
=
data
;
float
*
samples
=
data
;
...
@@ -843,7 +847,7 @@ static int atrac3_decode_frame(AVCodecContext *avctx,
...
@@ -843,7 +847,7 @@ static int atrac3_decode_frame(AVCodecContext *avctx,
databuf
=
buf
;
databuf
=
buf
;
}
}
result
=
decodeFrame
(
q
,
databuf
,
q
->
channels
==
2
?
q
->
outSamples
:
samples
);
result
=
decodeFrame
(
q
,
databuf
,
q
->
channels
==
2
?
q
->
outSamples
[
0
]
:
samples
);
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Frame decoding error!
\n
"
);
av_log
(
NULL
,
AV_LOG_ERROR
,
"Frame decoding error!
\n
"
);
...
@@ -852,10 +856,8 @@ static int atrac3_decode_frame(AVCodecContext *avctx,
...
@@ -852,10 +856,8 @@ static int atrac3_decode_frame(AVCodecContext *avctx,
/* interleave */
/* interleave */
if
(
q
->
channels
==
2
)
{
if
(
q
->
channels
==
2
)
{
for
(
i
=
0
;
i
<
1024
;
i
++
)
{
q
->
fmt_conv
.
float_interleave
(
samples
,
(
const
float
**
)
q
->
outSamples
,
samples
[
i
*
2
]
=
q
->
outSamples
[
i
];
1024
,
2
);
samples
[
i
*
2
+
1
]
=
q
->
outSamples
[
1024
+
i
];
}
}
}
*
data_size
=
1024
*
q
->
channels
*
av_get_bytes_per_sample
(
avctx
->
sample_fmt
);
*
data_size
=
1024
*
q
->
channels
*
av_get_bytes_per_sample
(
avctx
->
sample_fmt
);
...
@@ -1003,6 +1005,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
...
@@ -1003,6 +1005,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
}
}
dsputil_init
(
&
dsp
,
avctx
);
dsputil_init
(
&
dsp
,
avctx
);
ff_fmt_convert_init
(
&
q
->
fmt_conv
,
avctx
);
q
->
pUnits
=
av_mallocz
(
sizeof
(
channel_unit
)
*
q
->
channels
);
q
->
pUnits
=
av_mallocz
(
sizeof
(
channel_unit
)
*
q
->
channels
);
if
(
!
q
->
pUnits
)
{
if
(
!
q
->
pUnits
)
{
...
@@ -1010,6 +1013,15 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
...
@@ -1010,6 +1013,15 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
if
(
avctx
->
channels
>
1
)
{
q
->
outSamples
[
0
]
=
av_mallocz
(
1024
*
2
*
sizeof
(
*
q
->
outSamples
[
0
]));
q
->
outSamples
[
1
]
=
q
->
outSamples
[
0
]
+
1024
;
if
(
!
q
->
outSamples
[
0
])
{
atrac3_decode_close
(
avctx
);
return
AVERROR
(
ENOMEM
);
}
}
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_FLT
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_FLT
;
return
0
;
return
0
;
}
}
...
...
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