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
b0464212
Commit
b0464212
authored
Nov 29, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/on2avc: Use avpriv_float_dsp_alloc()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
14285c33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
21 deletions
+25
-21
on2avc.c
libavcodec/on2avc.c
+25
-21
No files found.
libavcodec/on2avc.c
View file @
b0464212
...
@@ -47,7 +47,7 @@ enum WindowTypes {
...
@@ -47,7 +47,7 @@ enum WindowTypes {
typedef
struct
On2AVCContext
{
typedef
struct
On2AVCContext
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFloatDSPContext
fdsp
;
AVFloatDSPContext
*
fdsp
;
FFTContext
mdct
,
mdct_half
,
mdct_small
;
FFTContext
mdct
,
mdct_half
,
mdct_small
;
FFTContext
fft128
,
fft256
,
fft512
,
fft1024
;
FFTContext
fft128
,
fft256
,
fft512
,
fft1024
;
void
(
*
wtf
)(
struct
On2AVCContext
*
ctx
,
float
*
out
,
float
*
in
,
int
size
);
void
(
*
wtf
)(
struct
On2AVCContext
*
ctx
,
float
*
out
,
float
*
in
,
int
size
);
...
@@ -714,7 +714,7 @@ static int on2avc_reconstruct_stereo(On2AVCContext *c, AVFrame *dst, int offset)
...
@@ -714,7 +714,7 @@ static int on2avc_reconstruct_stereo(On2AVCContext *c, AVFrame *dst, int offset)
}
}
memcpy
(
out
,
saved
,
448
*
sizeof
(
float
));
memcpy
(
out
,
saved
,
448
*
sizeof
(
float
));
c
->
fdsp
.
vector_fmul_window
(
wout
,
saved
+
448
,
buf
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
wout
,
saved
+
448
,
buf
,
c
->
short_win
,
64
);
memcpy
(
wout
+
128
,
buf
+
64
,
448
*
sizeof
(
float
));
memcpy
(
wout
+
128
,
buf
+
64
,
448
*
sizeof
(
float
));
memcpy
(
saved
,
buf
+
512
,
448
*
sizeof
(
float
));
memcpy
(
saved
,
buf
+
512
,
448
*
sizeof
(
float
));
memcpy
(
saved
+
448
,
buf
+
7
*
128
+
64
,
64
*
sizeof
(
float
));
memcpy
(
saved
+
448
,
buf
+
7
*
128
+
64
,
64
*
sizeof
(
float
));
...
@@ -750,20 +750,20 @@ static int on2avc_reconstruct_channel(On2AVCContext *c, int channel,
...
@@ -750,20 +750,20 @@ static int on2avc_reconstruct_channel(On2AVCContext *c, int channel,
c
->
prev_window_type
==
WINDOW_TYPE_LONG_STOP
)
&&
c
->
prev_window_type
==
WINDOW_TYPE_LONG_STOP
)
&&
(
c
->
window_type
==
WINDOW_TYPE_LONG
||
(
c
->
window_type
==
WINDOW_TYPE_LONG
||
c
->
window_type
==
WINDOW_TYPE_LONG_START
))
{
c
->
window_type
==
WINDOW_TYPE_LONG_START
))
{
c
->
fdsp
.
vector_fmul_window
(
out
,
saved
,
buf
,
c
->
long_win
,
512
);
c
->
fdsp
->
vector_fmul_window
(
out
,
saved
,
buf
,
c
->
long_win
,
512
);
}
else
{
}
else
{
float
*
wout
=
out
+
448
;
float
*
wout
=
out
+
448
;
memcpy
(
out
,
saved
,
448
*
sizeof
(
float
));
memcpy
(
out
,
saved
,
448
*
sizeof
(
float
));
if
(
c
->
window_type
==
WINDOW_TYPE_8SHORT
)
{
if
(
c
->
window_type
==
WINDOW_TYPE_8SHORT
)
{
c
->
fdsp
.
vector_fmul_window
(
wout
+
0
*
128
,
saved
+
448
,
buf
+
0
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
wout
+
0
*
128
,
saved
+
448
,
buf
+
0
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
.
vector_fmul_window
(
wout
+
1
*
128
,
buf
+
0
*
128
+
64
,
buf
+
1
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
wout
+
1
*
128
,
buf
+
0
*
128
+
64
,
buf
+
1
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
.
vector_fmul_window
(
wout
+
2
*
128
,
buf
+
1
*
128
+
64
,
buf
+
2
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
wout
+
2
*
128
,
buf
+
1
*
128
+
64
,
buf
+
2
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
.
vector_fmul_window
(
wout
+
3
*
128
,
buf
+
2
*
128
+
64
,
buf
+
3
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
wout
+
3
*
128
,
buf
+
2
*
128
+
64
,
buf
+
3
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
.
vector_fmul_window
(
temp
,
buf
+
3
*
128
+
64
,
buf
+
4
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
temp
,
buf
+
3
*
128
+
64
,
buf
+
4
*
128
,
c
->
short_win
,
64
);
memcpy
(
wout
+
4
*
128
,
temp
,
64
*
sizeof
(
float
));
memcpy
(
wout
+
4
*
128
,
temp
,
64
*
sizeof
(
float
));
}
else
{
}
else
{
c
->
fdsp
.
vector_fmul_window
(
wout
,
saved
+
448
,
buf
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
wout
,
saved
+
448
,
buf
,
c
->
short_win
,
64
);
memcpy
(
wout
+
128
,
buf
+
64
,
448
*
sizeof
(
float
));
memcpy
(
wout
+
128
,
buf
+
64
,
448
*
sizeof
(
float
));
}
}
}
}
...
@@ -772,9 +772,9 @@ static int on2avc_reconstruct_channel(On2AVCContext *c, int channel,
...
@@ -772,9 +772,9 @@ static int on2avc_reconstruct_channel(On2AVCContext *c, int channel,
switch
(
c
->
window_type
)
{
switch
(
c
->
window_type
)
{
case
WINDOW_TYPE_8SHORT
:
case
WINDOW_TYPE_8SHORT
:
memcpy
(
saved
,
temp
+
64
,
64
*
sizeof
(
float
));
memcpy
(
saved
,
temp
+
64
,
64
*
sizeof
(
float
));
c
->
fdsp
.
vector_fmul_window
(
saved
+
64
,
buf
+
4
*
128
+
64
,
buf
+
5
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
saved
+
64
,
buf
+
4
*
128
+
64
,
buf
+
5
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
.
vector_fmul_window
(
saved
+
192
,
buf
+
5
*
128
+
64
,
buf
+
6
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
saved
+
192
,
buf
+
5
*
128
+
64
,
buf
+
6
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
.
vector_fmul_window
(
saved
+
320
,
buf
+
6
*
128
+
64
,
buf
+
7
*
128
,
c
->
short_win
,
64
);
c
->
fdsp
->
vector_fmul_window
(
saved
+
320
,
buf
+
6
*
128
+
64
,
buf
+
7
*
128
,
c
->
short_win
,
64
);
memcpy
(
saved
+
448
,
buf
+
7
*
128
+
64
,
64
*
sizeof
(
float
));
memcpy
(
saved
+
448
,
buf
+
7
*
128
+
64
,
64
*
sizeof
(
float
));
break
;
break
;
case
WINDOW_TYPE_LONG_START
:
case
WINDOW_TYPE_LONG_START
:
...
@@ -952,13 +952,14 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
...
@@ -952,13 +952,14 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
ff_fft_init
(
&
c
->
fft256
,
7
,
0
);
ff_fft_init
(
&
c
->
fft256
,
7
,
0
);
ff_fft_init
(
&
c
->
fft512
,
8
,
1
);
ff_fft_init
(
&
c
->
fft512
,
8
,
1
);
ff_fft_init
(
&
c
->
fft1024
,
9
,
1
);
ff_fft_init
(
&
c
->
fft1024
,
9
,
1
);
avpriv_float_dsp_init
(
&
c
->
fdsp
,
avctx
->
flags
&
CODEC_FLAG_BITEXACT
);
c
->
fdsp
=
avpriv_float_dsp_alloc
(
avctx
->
flags
&
CODEC_FLAG_BITEXACT
);
if
(
!
c
->
fdsp
)
return
AVERROR
(
ENOMEM
);
if
(
init_vlc
(
&
c
->
scale_diff
,
9
,
ON2AVC_SCALE_DIFFS
,
if
(
init_vlc
(
&
c
->
scale_diff
,
9
,
ON2AVC_SCALE_DIFFS
,
ff_on2avc_scale_diff_bits
,
1
,
1
,
ff_on2avc_scale_diff_bits
,
1
,
1
,
ff_on2avc_scale_diff_codes
,
4
,
4
,
0
))
{
ff_on2avc_scale_diff_codes
,
4
,
4
,
0
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Cannot init VLC
\n
"
);
goto
vlc_fail
;
return
AVERROR
(
ENOMEM
);
}
}
for
(
i
=
1
;
i
<
9
;
i
++
)
{
for
(
i
=
1
;
i
<
9
;
i
++
)
{
int
idx
=
i
-
1
;
int
idx
=
i
-
1
;
...
@@ -966,9 +967,7 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
...
@@ -966,9 +967,7 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
ff_on2avc_quad_cb_bits
[
idx
],
1
,
1
,
ff_on2avc_quad_cb_bits
[
idx
],
1
,
1
,
ff_on2avc_quad_cb_codes
[
idx
],
4
,
4
,
ff_on2avc_quad_cb_codes
[
idx
],
4
,
4
,
ff_on2avc_quad_cb_syms
[
idx
],
2
,
2
,
0
))
{
ff_on2avc_quad_cb_syms
[
idx
],
2
,
2
,
0
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Cannot init VLC
\n
"
);
goto
vlc_fail
;
on2avc_free_vlcs
(
c
);
return
AVERROR
(
ENOMEM
);
}
}
}
}
for
(
i
=
9
;
i
<
16
;
i
++
)
{
for
(
i
=
9
;
i
<
16
;
i
++
)
{
...
@@ -977,13 +976,16 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
...
@@ -977,13 +976,16 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
ff_on2avc_pair_cb_bits
[
idx
],
1
,
1
,
ff_on2avc_pair_cb_bits
[
idx
],
1
,
1
,
ff_on2avc_pair_cb_codes
[
idx
],
2
,
2
,
ff_on2avc_pair_cb_codes
[
idx
],
2
,
2
,
ff_on2avc_pair_cb_syms
[
idx
],
2
,
2
,
0
))
{
ff_on2avc_pair_cb_syms
[
idx
],
2
,
2
,
0
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Cannot init VLC
\n
"
);
goto
vlc_fail
;
on2avc_free_vlcs
(
c
);
return
AVERROR
(
ENOMEM
);
}
}
}
}
return
0
;
return
0
;
vlc_fail:
av_log
(
avctx
,
AV_LOG_ERROR
,
"Cannot init VLC
\n
"
);
on2avc_free_vlcs
(
c
);
av_freep
(
&
c
->
fdsp
);
return
AVERROR
(
ENOMEM
);
}
}
static
av_cold
int
on2avc_decode_close
(
AVCodecContext
*
avctx
)
static
av_cold
int
on2avc_decode_close
(
AVCodecContext
*
avctx
)
...
@@ -998,6 +1000,8 @@ static av_cold int on2avc_decode_close(AVCodecContext *avctx)
...
@@ -998,6 +1000,8 @@ static av_cold int on2avc_decode_close(AVCodecContext *avctx)
ff_fft_end
(
&
c
->
fft512
);
ff_fft_end
(
&
c
->
fft512
);
ff_fft_end
(
&
c
->
fft1024
);
ff_fft_end
(
&
c
->
fft1024
);
av_freep
(
&
c
->
fdsp
);
on2avc_free_vlcs
(
c
);
on2avc_free_vlcs
(
c
);
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