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
370b44cd
Commit
370b44cd
authored
Feb 21, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nellymoserenc: improve error checking in encode_init()
parent
333506c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
16 deletions
+24
-16
nellymoserenc.c
libavcodec/nellymoserenc.c
+24
-16
No files found.
libavcodec/nellymoserenc.c
View file @
370b44cd
...
@@ -127,10 +127,24 @@ static void apply_mdct(NellyMoserEncodeContext *s)
...
@@ -127,10 +127,24 @@ static void apply_mdct(NellyMoserEncodeContext *s)
s
->
mdct_ctx
.
mdct_calc
(
&
s
->
mdct_ctx
,
s
->
mdct_out
+
NELLY_BUF_LEN
,
s
->
buf
[
s
->
bufsel
]
+
NELLY_BUF_LEN
);
s
->
mdct_ctx
.
mdct_calc
(
&
s
->
mdct_ctx
,
s
->
mdct_out
+
NELLY_BUF_LEN
,
s
->
buf
[
s
->
bufsel
]
+
NELLY_BUF_LEN
);
}
}
static
av_cold
int
encode_end
(
AVCodecContext
*
avctx
)
{
NellyMoserEncodeContext
*
s
=
avctx
->
priv_data
;
ff_mdct_end
(
&
s
->
mdct_ctx
);
if
(
s
->
avctx
->
trellis
)
{
av_free
(
s
->
opt
);
av_free
(
s
->
path
);
}
return
0
;
}
static
av_cold
int
encode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
encode_init
(
AVCodecContext
*
avctx
)
{
{
NellyMoserEncodeContext
*
s
=
avctx
->
priv_data
;
NellyMoserEncodeContext
*
s
=
avctx
->
priv_data
;
int
i
;
int
i
,
ret
;
if
(
avctx
->
channels
!=
1
)
{
if
(
avctx
->
channels
!=
1
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Nellymoser supports only 1 channel
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Nellymoser supports only 1 channel
\n
"
);
...
@@ -147,7 +161,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
...
@@ -147,7 +161,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
avctx
->
frame_size
=
NELLY_SAMPLES
;
avctx
->
frame_size
=
NELLY_SAMPLES
;
s
->
avctx
=
avctx
;
s
->
avctx
=
avctx
;
ff_mdct_init
(
&
s
->
mdct_ctx
,
8
,
0
,
32768
.
0
);
if
((
ret
=
ff_mdct_init
(
&
s
->
mdct_ctx
,
8
,
0
,
32768
.
0
))
<
0
)
goto
error
;
ff_dsputil_init
(
&
s
->
dsp
,
avctx
);
ff_dsputil_init
(
&
s
->
dsp
,
avctx
);
/* Generate overlap window */
/* Generate overlap window */
...
@@ -158,23 +173,16 @@ static av_cold int encode_init(AVCodecContext *avctx)
...
@@ -158,23 +173,16 @@ static av_cold int encode_init(AVCodecContext *avctx)
if
(
s
->
avctx
->
trellis
)
{
if
(
s
->
avctx
->
trellis
)
{
s
->
opt
=
av_malloc
(
NELLY_BANDS
*
OPT_SIZE
*
sizeof
(
float
));
s
->
opt
=
av_malloc
(
NELLY_BANDS
*
OPT_SIZE
*
sizeof
(
float
));
s
->
path
=
av_malloc
(
NELLY_BANDS
*
OPT_SIZE
*
sizeof
(
uint8_t
));
s
->
path
=
av_malloc
(
NELLY_BANDS
*
OPT_SIZE
*
sizeof
(
uint8_t
));
if
(
!
s
->
opt
||
!
s
->
path
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
error
;
}
}
}
return
0
;
return
0
;
}
error:
encode_end
(
avctx
);
static
av_cold
int
encode_end
(
AVCodecContext
*
avctx
)
return
ret
;
{
NellyMoserEncodeContext
*
s
=
avctx
->
priv_data
;
ff_mdct_end
(
&
s
->
mdct_ctx
);
if
(
s
->
avctx
->
trellis
)
{
av_free
(
s
->
opt
);
av_free
(
s
->
path
);
}
return
0
;
}
}
#define find_best(val, table, LUT, LUT_add, LUT_size) \
#define find_best(val, table, LUT, LUT_add, LUT_size) \
...
...
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