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
381a7225
Commit
381a7225
authored
Nov 30, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegvideo: split the encoding-only parts of ff_MPV_frame_end() into a separate function
parent
b7254288
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
19 deletions
+46
-19
mpegvideo.c
libavcodec/mpegvideo.c
+2
-18
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+44
-1
No files found.
libavcodec/mpegvideo.c
View file @
381a7225
...
...
@@ -1657,12 +1657,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
return
0
;
}
/* generic function for encode/decode called after a
* frame has been coded/decoded. */
/* called after a frame has been decoded. */
void
ff_MPV_frame_end
(
MpegEncContext
*
s
)
{
int
i
;
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
/* redraw edges for the frame if decoding didn't complete */
...
...
@@ -1672,7 +1669,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
}
else
FF_ENABLE_DEPRECATION_WARNINGS
#endif
/* FF_API_XVMC */
if
(
(
s
->
er
.
error_count
||
s
->
encoding
)
&&
if
(
s
->
er
.
error_count
&&
!
s
->
avctx
->
hwaccel
&&
s
->
unrestricted_mv
&&
s
->
current_picture
.
reference
&&
...
...
@@ -1697,11 +1694,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
emms_c
();
s
->
last_pict_type
=
s
->
pict_type
;
s
->
last_lambda_for
[
s
->
pict_type
]
=
s
->
current_picture_ptr
->
f
.
quality
;
if
(
s
->
pict_type
!=
AV_PICTURE_TYPE_B
)
{
s
->
last_non_b_pict_type
=
s
->
pict_type
;
}
#if 0
/* copy back current_picture variables */
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
...
...
@@ -1713,20 +1705,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
assert(i < MAX_PICTURE_COUNT);
#endif
if
(
s
->
encoding
)
{
/* release non-reference frames */
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
)
{
if
(
!
s
->
picture
[
i
].
reference
)
ff_mpeg_unref_picture
(
s
,
&
s
->
picture
[
i
]);
}
}
// clear copies, to avoid confusion
#if 0
memset(&s->last_picture, 0, sizeof(Picture));
memset(&s->next_picture, 0, sizeof(Picture));
memset(&s->current_picture, 0, sizeof(Picture));
#endif
s
->
avctx
->
coded_frame
=
&
s
->
current_picture_ptr
->
f
;
if
(
s
->
current_picture
.
reference
)
ff_thread_report_progress
(
&
s
->
current_picture_ptr
->
tf
,
INT_MAX
,
0
);
...
...
libavcodec/mpegvideo_enc.c
View file @
381a7225
...
...
@@ -1359,6 +1359,49 @@ no_output_pic:
return
0
;
}
static
void
frame_end
(
MpegEncContext
*
s
)
{
int
i
;
if
(
s
->
unrestricted_mv
&&
s
->
current_picture
.
reference
&&
!
s
->
intra_only
)
{
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
s
->
avctx
->
pix_fmt
);
int
hshift
=
desc
->
log2_chroma_w
;
int
vshift
=
desc
->
log2_chroma_h
;
s
->
dsp
.
draw_edges
(
s
->
current_picture
.
f
.
data
[
0
],
s
->
linesize
,
s
->
h_edge_pos
,
s
->
v_edge_pos
,
EDGE_WIDTH
,
EDGE_WIDTH
,
EDGE_TOP
|
EDGE_BOTTOM
);
s
->
dsp
.
draw_edges
(
s
->
current_picture
.
f
.
data
[
1
],
s
->
uvlinesize
,
s
->
h_edge_pos
>>
hshift
,
s
->
v_edge_pos
>>
vshift
,
EDGE_WIDTH
>>
hshift
,
EDGE_WIDTH
>>
vshift
,
EDGE_TOP
|
EDGE_BOTTOM
);
s
->
dsp
.
draw_edges
(
s
->
current_picture
.
f
.
data
[
2
],
s
->
uvlinesize
,
s
->
h_edge_pos
>>
hshift
,
s
->
v_edge_pos
>>
vshift
,
EDGE_WIDTH
>>
hshift
,
EDGE_WIDTH
>>
vshift
,
EDGE_TOP
|
EDGE_BOTTOM
);
}
emms_c
();
s
->
last_pict_type
=
s
->
pict_type
;
s
->
last_lambda_for
[
s
->
pict_type
]
=
s
->
current_picture_ptr
->
f
.
quality
;
if
(
s
->
pict_type
!=
AV_PICTURE_TYPE_B
)
s
->
last_non_b_pict_type
=
s
->
pict_type
;
if
(
s
->
encoding
)
{
/* release non-reference frames */
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
)
{
if
(
!
s
->
picture
[
i
].
reference
)
ff_mpeg_unref_picture
(
s
,
&
s
->
picture
[
i
]);
}
}
s
->
avctx
->
coded_frame
=
&
s
->
current_picture_ptr
->
f
;
}
int
ff_MPV_encode_picture
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
pic_arg
,
int
*
got_packet
)
{
...
...
@@ -1414,7 +1457,7 @@ vbv_retry:
avctx
->
p_count
=
s
->
mb_num
-
s
->
i_count
-
s
->
skip_count
;
avctx
->
skip_count
=
s
->
skip_count
;
f
f_MPV_f
rame_end
(
s
);
frame_end
(
s
);
if
(
CONFIG_MJPEG_ENCODER
&&
s
->
out_format
==
FMT_MJPEG
)
ff_mjpeg_encode_picture_trailer
(
s
);
...
...
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