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
0b0a7a75
Commit
0b0a7a75
authored
Nov 30, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegvideo: move encode-only parts of common_end() to encode_end()
parent
d0d111d0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
22 deletions
+24
-22
mpegvideo.c
libavcodec/mpegvideo.c
+9
-22
mpegvideo.h
libavcodec/mpegvideo.h
+1
-0
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+14
-0
No files found.
libavcodec/mpegvideo.c
View file @
0b0a7a75
...
...
@@ -280,7 +280,7 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
return
0
;
}
static
void
free_picture_tables
(
Picture
*
pic
)
void
ff_
free_picture_tables
(
Picture
*
pic
)
{
int
i
;
...
...
@@ -409,7 +409,7 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared)
fail:
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Error allocating a picture.
\n
"
);
ff_mpeg_unref_picture
(
s
,
pic
);
free_picture_tables
(
pic
);
f
f_f
ree_picture_tables
(
pic
);
return
AVERROR
(
ENOMEM
);
}
...
...
@@ -433,7 +433,7 @@ void ff_mpeg_unref_picture(MpegEncContext *s, Picture *pic)
av_buffer_unref
(
&
pic
->
hwaccel_priv_buf
);
if
(
pic
->
needs_realloc
)
free_picture_tables
(
pic
);
f
f_f
ree_picture_tables
(
pic
);
memset
((
uint8_t
*
)
pic
+
off
,
0
,
sizeof
(
*
pic
)
-
off
);
}
...
...
@@ -449,7 +449,7 @@ do {\
av_buffer_unref(&dst->table);\
dst->table = av_buffer_ref(src->table);\
if (!dst->table) {\
free_picture_tables(dst);\
f
f_f
ree_picture_tables(dst);\
return AVERROR(ENOMEM);\
}\
}\
...
...
@@ -1233,32 +1233,19 @@ void ff_MPV_common_end(MpegEncContext *s)
av_freep
(
&
s
->
bitstream_buffer
);
s
->
allocated_bitstream_buffer_size
=
0
;
av_freep
(
&
s
->
avctx
->
stats_out
);
av_freep
(
&
s
->
ac_stats
);
av_freep
(
&
s
->
q_intra_matrix
);
av_freep
(
&
s
->
q_inter_matrix
);
av_freep
(
&
s
->
q_intra_matrix16
);
av_freep
(
&
s
->
q_inter_matrix16
);
av_freep
(
&
s
->
input_picture
);
av_freep
(
&
s
->
reordered_input_picture
);
av_freep
(
&
s
->
dct_offset
);
if
(
s
->
picture
)
{
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
)
{
free_picture_tables
(
&
s
->
picture
[
i
]);
f
f_f
ree_picture_tables
(
&
s
->
picture
[
i
]);
ff_mpeg_unref_picture
(
s
,
&
s
->
picture
[
i
]);
}
}
av_freep
(
&
s
->
picture
);
free_picture_tables
(
&
s
->
last_picture
);
f
f_f
ree_picture_tables
(
&
s
->
last_picture
);
ff_mpeg_unref_picture
(
s
,
&
s
->
last_picture
);
free_picture_tables
(
&
s
->
current_picture
);
f
f_f
ree_picture_tables
(
&
s
->
current_picture
);
ff_mpeg_unref_picture
(
s
,
&
s
->
current_picture
);
free_picture_tables
(
&
s
->
next_picture
);
f
f_f
ree_picture_tables
(
&
s
->
next_picture
);
ff_mpeg_unref_picture
(
s
,
&
s
->
next_picture
);
free_picture_tables
(
&
s
->
new_picture
);
ff_mpeg_unref_picture
(
s
,
&
s
->
new_picture
);
free_context_frame
(
s
);
...
...
@@ -1409,7 +1396,7 @@ int ff_find_unused_picture(MpegEncContext *s, int shared)
if
(
ret
>=
0
&&
ret
<
MAX_PICTURE_COUNT
)
{
if
(
s
->
picture
[
ret
].
needs_realloc
)
{
s
->
picture
[
ret
].
needs_realloc
=
0
;
free_picture_tables
(
&
s
->
picture
[
ret
]);
f
f_f
ree_picture_tables
(
&
s
->
picture
[
ret
]);
ff_mpeg_unref_picture
(
s
,
&
s
->
picture
[
ret
]);
avcodec_get_frame_defaults
(
&
s
->
picture
[
ret
].
f
);
}
...
...
libavcodec/mpegvideo.h
View file @
0b0a7a75
...
...
@@ -927,5 +927,6 @@ void ff_wmv2_encode_mb(MpegEncContext * s,
int
ff_mpeg_ref_picture
(
MpegEncContext
*
s
,
Picture
*
dst
,
Picture
*
src
);
void
ff_mpeg_unref_picture
(
MpegEncContext
*
s
,
Picture
*
picture
);
void
ff_free_picture_tables
(
Picture
*
pic
);
#endif
/* AVCODEC_MPEGVIDEO_H */
libavcodec/mpegvideo_enc.c
View file @
0b0a7a75
...
...
@@ -847,6 +847,20 @@ av_cold int ff_MPV_encode_end(AVCodecContext *avctx)
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
s
->
tmp_frames
);
i
++
)
av_frame_free
(
&
s
->
tmp_frames
[
i
]);
ff_free_picture_tables
(
&
s
->
new_picture
);
ff_mpeg_unref_picture
(
s
,
&
s
->
new_picture
);
av_freep
(
&
s
->
avctx
->
stats_out
);
av_freep
(
&
s
->
ac_stats
);
av_freep
(
&
s
->
q_intra_matrix
);
av_freep
(
&
s
->
q_inter_matrix
);
av_freep
(
&
s
->
q_intra_matrix16
);
av_freep
(
&
s
->
q_inter_matrix16
);
av_freep
(
&
s
->
input_picture
);
av_freep
(
&
s
->
reordered_input_picture
);
av_freep
(
&
s
->
dct_offset
);
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