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
9af4eaa8
Commit
9af4eaa8
authored
Aug 26, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atrac3: use float planar sample format
parent
461ba7e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
37 deletions
+7
-37
atrac3.c
libavcodec/atrac3.c
+7
-37
No files found.
libavcodec/atrac3.c
View file @
9af4eaa8
...
...
@@ -111,7 +111,6 @@ typedef struct {
//@}
//@{
/** data buffers */
float
*
outSamples
[
2
];
uint8_t
*
decoded_bytes_buffer
;
float
tempBuf
[
1070
];
//@}
...
...
@@ -197,7 +196,7 @@ static int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
}
static
av_cold
int
init_atrac3_transforms
(
ATRAC3Context
*
q
,
int
is_float
)
{
static
av_cold
int
init_atrac3_transforms
(
ATRAC3Context
*
q
)
{
float
enc_window
[
256
];
int
i
;
...
...
@@ -213,7 +212,7 @@ static av_cold int init_atrac3_transforms(ATRAC3Context *q, int is_float) {
}
/* Initialize the MDCT transform. */
return
ff_mdct_init
(
&
q
->
mdct_ctx
,
9
,
1
,
is_float
?
1
.
0
/
32768
:
1
.
0
);
return
ff_mdct_init
(
&
q
->
mdct_ctx
,
9
,
1
,
1
.
0
/
32768
);
}
/**
...
...
@@ -226,7 +225,6 @@ static av_cold int atrac3_decode_close(AVCodecContext *avctx)
av_free
(
q
->
pUnits
);
av_free
(
q
->
decoded_bytes_buffer
);
av_freep
(
&
q
->
outSamples
[
0
]);
ff_mdct_end
(
&
q
->
mdct_ctx
);
...
...
@@ -837,8 +835,6 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
ATRAC3Context
*
q
=
avctx
->
priv_data
;
int
result
;
const
uint8_t
*
databuf
;
float
*
samples_flt
;
int16_t
*
samples_s16
;
if
(
buf_size
<
avctx
->
block_align
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
...
...
@@ -852,8 +848,6 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
result
;
}
samples_flt
=
(
float
*
)
q
->
frame
.
data
[
0
];
samples_s16
=
(
int16_t
*
)
q
->
frame
.
data
[
0
];
/* Check if we need to descramble and what buffer to pass on. */
if
(
q
->
scrambled_stream
)
{
...
...
@@ -863,27 +857,13 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
databuf
=
buf
;
}
if
(
q
->
channels
==
1
&&
avctx
->
sample_fmt
==
AV_SAMPLE_FMT_FLT
)
result
=
decodeFrame
(
q
,
databuf
,
&
samples_flt
);
else
result
=
decodeFrame
(
q
,
databuf
,
q
->
outSamples
);
result
=
decodeFrame
(
q
,
databuf
,
(
float
**
)
q
->
frame
.
extended_data
);
if
(
result
!=
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Frame decoding error!
\n
"
);
return
result
;
}
/* interleave */
if
(
q
->
channels
==
2
&&
avctx
->
sample_fmt
==
AV_SAMPLE_FMT_FLT
)
{
q
->
fmt_conv
.
float_interleave
(
samples_flt
,
(
const
float
**
)
q
->
outSamples
,
SAMPLES_PER_FRAME
,
2
);
}
else
if
(
avctx
->
sample_fmt
==
AV_SAMPLE_FMT_S16
)
{
q
->
fmt_conv
.
float_to_int16_interleave
(
samples_s16
,
(
const
float
**
)
q
->
outSamples
,
SAMPLES_PER_FRAME
,
q
->
channels
);
}
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
q
->
frame
;
...
...
@@ -1005,12 +985,9 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
vlcs_initialized
=
1
;
}
if
(
avctx
->
request_sample_fmt
==
AV_SAMPLE_FMT_FLT
)
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_FLT
;
else
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_FLTP
;
if
((
ret
=
init_atrac3_transforms
(
q
,
avctx
->
sample_fmt
==
AV_SAMPLE_FMT_FLT
)))
{
if
((
ret
=
init_atrac3_transforms
(
q
)))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error initializing MDCT
\n
"
);
av_freep
(
&
q
->
decoded_bytes_buffer
);
return
ret
;
...
...
@@ -1048,15 +1025,6 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
return
AVERROR
(
ENOMEM
);
}
if
(
avctx
->
channels
>
1
||
avctx
->
sample_fmt
==
AV_SAMPLE_FMT_S16
)
{
q
->
outSamples
[
0
]
=
av_mallocz
(
SAMPLES_PER_FRAME
*
avctx
->
channels
*
sizeof
(
*
q
->
outSamples
[
0
]));
q
->
outSamples
[
1
]
=
q
->
outSamples
[
0
]
+
SAMPLES_PER_FRAME
;
if
(
!
q
->
outSamples
[
0
])
{
atrac3_decode_close
(
avctx
);
return
AVERROR
(
ENOMEM
);
}
}
avcodec_get_frame_defaults
(
&
q
->
frame
);
avctx
->
coded_frame
=
&
q
->
frame
;
...
...
@@ -1075,4 +1043,6 @@ AVCodec ff_atrac3_decoder =
.
decode
=
atrac3_decode_frame
,
.
capabilities
=
CODEC_CAP_SUBFRAMES
|
CODEC_CAP_DR1
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Atrac 3 (Adaptive TRansform Acoustic Coding 3)"
),
.
sample_fmts
=
(
const
enum
AVSampleFormat
[])
{
AV_SAMPLE_FMT_FLTP
,
AV_SAMPLE_FMT_NONE
},
};
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