Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
31b2262d
Commit
31b2262d
authored
Aug 25, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmaenc: use float planar sample format
parent
b1540fc8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
+19
-16
wma.c
libavcodec/wma.c
+1
-0
wma.h
libavcodec/wma.h
+2
-0
wmaenc.c
libavcodec/wmaenc.c
+16
-16
No files found.
libavcodec/wma.c
View file @
31b2262d
...
@@ -89,6 +89,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
...
@@ -89,6 +89,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
ff_dsputil_init
(
&
s
->
dsp
,
avctx
);
ff_dsputil_init
(
&
s
->
dsp
,
avctx
);
ff_fmt_convert_init
(
&
s
->
fmt_conv
,
avctx
);
ff_fmt_convert_init
(
&
s
->
fmt_conv
,
avctx
);
avpriv_float_dsp_init
(
&
s
->
fdsp
,
avctx
->
flags
&
CODEC_FLAG_BITEXACT
);
if
(
avctx
->
codec
->
id
==
AV_CODEC_ID_WMAV1
)
{
if
(
avctx
->
codec
->
id
==
AV_CODEC_ID_WMAV1
)
{
s
->
version
=
1
;
s
->
version
=
1
;
...
...
libavcodec/wma.h
View file @
31b2262d
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#ifndef AVCODEC_WMA_H
#ifndef AVCODEC_WMA_H
#define AVCODEC_WMA_H
#define AVCODEC_WMA_H
#include "libavutil/float_dsp.h"
#include "get_bits.h"
#include "get_bits.h"
#include "put_bits.h"
#include "put_bits.h"
#include "dsputil.h"
#include "dsputil.h"
...
@@ -137,6 +138,7 @@ typedef struct WMACodecContext {
...
@@ -137,6 +138,7 @@ typedef struct WMACodecContext {
float
lsp_pow_m_table2
[(
1
<<
LSP_POW_BITS
)];
float
lsp_pow_m_table2
[(
1
<<
LSP_POW_BITS
)];
DSPContext
dsp
;
DSPContext
dsp
;
FmtConvertContext
fmt_conv
;
FmtConvertContext
fmt_conv
;
AVFloatDSPContext
fdsp
;
#ifdef TRACE
#ifdef TRACE
int
frame_count
;
int
frame_count
;
...
...
libavcodec/wmaenc.c
View file @
31b2262d
...
@@ -97,23 +97,24 @@ static int encode_init(AVCodecContext * avctx){
...
@@ -97,23 +97,24 @@ static int encode_init(AVCodecContext * avctx){
}
}
static
void
apply_window_and_mdct
(
AVCodecContext
*
avctx
,
const
signed
short
*
audio
,
int
len
)
{
static
void
apply_window_and_mdct
(
AVCodecContext
*
avctx
,
const
AVFrame
*
frame
)
{
WMACodecContext
*
s
=
avctx
->
priv_data
;
WMACodecContext
*
s
=
avctx
->
priv_data
;
float
**
audio
=
(
float
**
)
frame
->
extended_data
;
int
len
=
frame
->
nb_samples
;
int
window_index
=
s
->
frame_len_bits
-
s
->
block_len_bits
;
int
window_index
=
s
->
frame_len_bits
-
s
->
block_len_bits
;
FFTContext
*
mdct
=
&
s
->
mdct_ctx
[
window_index
];
FFTContext
*
mdct
=
&
s
->
mdct_ctx
[
window_index
];
int
i
,
j
,
channel
;
int
ch
;
const
float
*
win
=
s
->
windows
[
window_index
];
const
float
*
win
=
s
->
windows
[
window_index
];
int
window_len
=
1
<<
s
->
block_len_bits
;
int
window_len
=
1
<<
s
->
block_len_bits
;
float
n
=
window_len
/
2
;
float
n
=
2
.
0
*
32768
.
0
/
window_len
;
for
(
channel
=
0
;
channel
<
avctx
->
channels
;
channel
++
)
{
for
(
ch
=
0
;
ch
<
avctx
->
channels
;
ch
++
)
{
memcpy
(
s
->
output
,
s
->
frame_out
[
channel
],
sizeof
(
float
)
*
window_len
);
memcpy
(
s
->
output
,
s
->
frame_out
[
ch
],
window_len
*
sizeof
(
*
s
->
output
));
j
=
channel
;
s
->
dsp
.
vector_fmul_scalar
(
s
->
frame_out
[
ch
],
audio
[
ch
],
n
,
len
);
for
(
i
=
0
;
i
<
len
;
i
++
,
j
+=
avctx
->
channels
){
s
->
dsp
.
vector_fmul_reverse
(
&
s
->
output
[
window_len
],
s
->
frame_out
[
ch
],
win
,
len
);
s
->
output
[
i
+
window_len
]
=
audio
[
j
]
/
n
*
win
[
window_len
-
i
-
1
];
s
->
fdsp
.
vector_fmul
(
s
->
frame_out
[
ch
],
s
->
frame_out
[
ch
],
win
,
len
);
s
->
frame_out
[
channel
][
i
]
=
audio
[
j
]
/
n
*
win
[
i
];
mdct
->
mdct_calc
(
mdct
,
s
->
coefs
[
ch
],
s
->
output
);
}
mdct
->
mdct_calc
(
mdct
,
s
->
coefs
[
channel
],
s
->
output
);
}
}
}
}
...
@@ -349,13 +350,12 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
...
@@ -349,13 +350,12 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
const
AVFrame
*
frame
,
int
*
got_packet_ptr
)
const
AVFrame
*
frame
,
int
*
got_packet_ptr
)
{
{
WMACodecContext
*
s
=
avctx
->
priv_data
;
WMACodecContext
*
s
=
avctx
->
priv_data
;
const
int16_t
*
samples
=
(
const
int16_t
*
)
frame
->
data
[
0
];
int
i
,
total_gain
,
ret
;
int
i
,
total_gain
,
ret
;
s
->
block_len_bits
=
s
->
frame_len_bits
;
//required by non variable block len
s
->
block_len_bits
=
s
->
frame_len_bits
;
//required by non variable block len
s
->
block_len
=
1
<<
s
->
block_len_bits
;
s
->
block_len
=
1
<<
s
->
block_len_bits
;
apply_window_and_mdct
(
avctx
,
samples
,
frame
->
nb_samples
);
apply_window_and_mdct
(
avctx
,
frame
);
if
(
s
->
ms_stereo
)
{
if
(
s
->
ms_stereo
)
{
float
a
,
b
;
float
a
,
b
;
...
@@ -426,7 +426,7 @@ AVCodec ff_wmav1_encoder = {
...
@@ -426,7 +426,7 @@ AVCodec ff_wmav1_encoder = {
.
init
=
encode_init
,
.
init
=
encode_init
,
.
encode2
=
encode_superframe
,
.
encode2
=
encode_superframe
,
.
close
=
ff_wma_end
,
.
close
=
ff_wma_end
,
.
sample_fmts
=
(
const
enum
AVSampleFormat
[]){
AV_SAMPLE_FMT_
S16
,
.
sample_fmts
=
(
const
enum
AVSampleFormat
[]){
AV_SAMPLE_FMT_
FLTP
,
AV_SAMPLE_FMT_NONE
},
AV_SAMPLE_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Windows Media Audio 1"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Windows Media Audio 1"
),
};
};
...
@@ -439,7 +439,7 @@ AVCodec ff_wmav2_encoder = {
...
@@ -439,7 +439,7 @@ AVCodec ff_wmav2_encoder = {
.
init
=
encode_init
,
.
init
=
encode_init
,
.
encode2
=
encode_superframe
,
.
encode2
=
encode_superframe
,
.
close
=
ff_wma_end
,
.
close
=
ff_wma_end
,
.
sample_fmts
=
(
const
enum
AVSampleFormat
[]){
AV_SAMPLE_FMT_
S16
,
.
sample_fmts
=
(
const
enum
AVSampleFormat
[]){
AV_SAMPLE_FMT_
FLTP
,
AV_SAMPLE_FMT_NONE
},
AV_SAMPLE_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Windows Media Audio 2"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Windows Media Audio 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