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
59279bf2
Commit
59279bf2
authored
Feb 15, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/huffyuvenc: only allocate stats_out when it will be used
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
776cda74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
huffyuvenc.c
libavcodec/huffyuvenc.c
+7
-5
No files found.
libavcodec/huffyuvenc.c
View file @
59279bf2
...
...
@@ -217,11 +217,13 @@ static av_cold int encode_init(AVCodecContext *avctx)
ff_huffyuv_common_init
(
avctx
);
avctx
->
extradata
=
av_mallocz
(
3
*
MAX_N
+
4
);
#define STATS_OUT_SIZE 21*MAX_N*3 + 4
avctx
->
stats_out
=
av_mallocz
(
STATS_OUT_SIZE
);
// 21*256*3(%llu ) + 3(\n) + 1(0) = 16132
if
(
!
avctx
->
extradata
||
!
avctx
->
stats_out
)
{
av_freep
(
&
avctx
->
stats_out
);
if
(
!
avctx
->
extradata
)
return
AVERROR
(
ENOMEM
);
if
(
s
->
flags
&
CODEC_FLAG_PASS1
)
{
#define STATS_OUT_SIZE 21*MAX_N*3 + 4
avctx
->
stats_out
=
av_mallocz
(
STATS_OUT_SIZE
);
// 21*256*3(%llu ) + 3(\n) + 1(0) = 16132
if
(
!
avctx
->
stats_out
)
return
AVERROR
(
ENOMEM
);
}
s
->
version
=
2
;
...
...
@@ -956,7 +958,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if
(
end
<=
p
)
return
AVERROR
(
ENOMEM
);
}
}
else
}
else
if
(
avctx
->
stats_out
)
avctx
->
stats_out
[
0
]
=
'\0'
;
if
(
!
(
s
->
avctx
->
flags2
&
CODEC_FLAG2_NO_OUTPUT
))
{
flush_put_bits
(
&
s
->
pb
);
...
...
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