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
0ffc8415
Commit
0ffc8415
authored
May 18, 2011
by
Ronald S. Bultje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264: fix loopfilter with threading at slice boundaries.
parent
89a20987
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
h264.c
libavcodec/h264.c
+10
-7
No files found.
libavcodec/h264.c
View file @
0ffc8415
...
@@ -2557,7 +2557,7 @@ static int fill_filter_caches(H264Context *h, int mb_type){
...
@@ -2557,7 +2557,7 @@ static int fill_filter_caches(H264Context *h, int mb_type){
return
0
;
return
0
;
}
}
static
void
loop_filter
(
H264Context
*
h
){
static
void
loop_filter
(
H264Context
*
h
,
int
start_x
,
int
end_x
){
MpegEncContext
*
const
s
=
&
h
->
s
;
MpegEncContext
*
const
s
=
&
h
->
s
;
uint8_t
*
dest_y
,
*
dest_cb
,
*
dest_cr
;
uint8_t
*
dest_y
,
*
dest_cb
,
*
dest_cr
;
int
linesize
,
uvlinesize
,
mb_x
,
mb_y
;
int
linesize
,
uvlinesize
,
mb_x
,
mb_y
;
...
@@ -2566,7 +2566,7 @@ static void loop_filter(H264Context *h){
...
@@ -2566,7 +2566,7 @@ static void loop_filter(H264Context *h){
const
int
pixel_shift
=
h
->
pixel_shift
;
const
int
pixel_shift
=
h
->
pixel_shift
;
if
(
h
->
deblocking_filter
)
{
if
(
h
->
deblocking_filter
)
{
for
(
mb_x
=
0
;
mb_x
<
s
->
mb_width
;
mb_x
++
){
for
(
mb_x
=
start_x
;
mb_x
<
end_x
;
mb_x
++
){
for
(
mb_y
=
end_mb_y
-
FRAME_MBAFF
;
mb_y
<=
end_mb_y
;
mb_y
++
){
for
(
mb_y
=
end_mb_y
-
FRAME_MBAFF
;
mb_y
<=
end_mb_y
;
mb_y
++
){
int
mb_xy
,
mb_type
;
int
mb_xy
,
mb_type
;
mb_xy
=
h
->
mb_xy
=
mb_x
+
mb_y
*
s
->
mb_stride
;
mb_xy
=
h
->
mb_xy
=
mb_x
+
mb_y
*
s
->
mb_stride
;
...
@@ -2632,6 +2632,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
...
@@ -2632,6 +2632,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
H264Context
*
h
=
*
(
void
**
)
arg
;
H264Context
*
h
=
*
(
void
**
)
arg
;
MpegEncContext
*
const
s
=
&
h
->
s
;
MpegEncContext
*
const
s
=
&
h
->
s
;
const
int
part_mask
=
s
->
partitioned_frame
?
(
AC_END
|
AC_ERROR
)
:
0x7F
;
const
int
part_mask
=
s
->
partitioned_frame
?
(
AC_END
|
AC_ERROR
)
:
0x7F
;
int
lf_x_start
=
s
->
mb_x
;
s
->
mb_skip_run
=
-
1
;
s
->
mb_skip_run
=
-
1
;
...
@@ -2670,6 +2671,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
...
@@ -2670,6 +2671,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
if
((
s
->
workaround_bugs
&
FF_BUG_TRUNCATED
)
&&
h
->
cabac
.
bytestream
>
h
->
cabac
.
bytestream_end
+
2
){
if
((
s
->
workaround_bugs
&
FF_BUG_TRUNCATED
)
&&
h
->
cabac
.
bytestream
>
h
->
cabac
.
bytestream_end
+
2
){
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
(
AC_END
|
DC_END
|
MV_END
)
&
part_mask
);
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
(
AC_END
|
DC_END
|
MV_END
)
&
part_mask
);
if
(
s
->
mb_x
>=
lf_x_start
)
loop_filter
(
h
,
lf_x_start
,
s
->
mb_x
+
1
);
return
0
;
return
0
;
}
}
if
(
ret
<
0
||
h
->
cabac
.
bytestream
>
h
->
cabac
.
bytestream_end
+
2
)
{
if
(
ret
<
0
||
h
->
cabac
.
bytestream
>
h
->
cabac
.
bytestream_end
+
2
)
{
...
@@ -2679,8 +2681,8 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
...
@@ -2679,8 +2681,8 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
}
}
if
(
++
s
->
mb_x
>=
s
->
mb_width
)
{
if
(
++
s
->
mb_x
>=
s
->
mb_width
)
{
s
->
mb_x
=
0
;
loop_filter
(
h
,
lf_x_start
,
s
->
mb_x
)
;
loop_filter
(
h
)
;
s
->
mb_x
=
lf_x_start
=
0
;
ff_draw_horiz_band
(
s
,
16
*
s
->
mb_y
,
16
);
ff_draw_horiz_band
(
s
,
16
*
s
->
mb_y
,
16
);
++
s
->
mb_y
;
++
s
->
mb_y
;
if
(
FIELD_OR_MBAFF_PICTURE
)
{
if
(
FIELD_OR_MBAFF_PICTURE
)
{
...
@@ -2693,6 +2695,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
...
@@ -2693,6 +2695,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
if
(
eos
||
s
->
mb_y
>=
s
->
mb_height
)
{
if
(
eos
||
s
->
mb_y
>=
s
->
mb_height
)
{
tprintf
(
s
->
avctx
,
"slice end %d %d
\n
"
,
get_bits_count
(
&
s
->
gb
),
s
->
gb
.
size_in_bits
);
tprintf
(
s
->
avctx
,
"slice end %d %d
\n
"
,
get_bits_count
(
&
s
->
gb
),
s
->
gb
.
size_in_bits
);
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
(
AC_END
|
DC_END
|
MV_END
)
&
part_mask
);
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
(
AC_END
|
DC_END
|
MV_END
)
&
part_mask
);
if
(
s
->
mb_x
>
lf_x_start
)
loop_filter
(
h
,
lf_x_start
,
s
->
mb_x
);
return
0
;
return
0
;
}
}
}
}
...
@@ -2714,13 +2717,12 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
...
@@ -2714,13 +2717,12 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
if
(
ret
<
0
){
if
(
ret
<
0
){
av_log
(
h
->
s
.
avctx
,
AV_LOG_ERROR
,
"error while decoding MB %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
av_log
(
h
->
s
.
avctx
,
AV_LOG_ERROR
,
"error while decoding MB %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
,
s
->
mb_y
,
(
AC_ERROR
|
DC_ERROR
|
MV_ERROR
)
&
part_mask
);
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
,
s
->
mb_y
,
(
AC_ERROR
|
DC_ERROR
|
MV_ERROR
)
&
part_mask
);
return
-
1
;
return
-
1
;
}
}
if
(
++
s
->
mb_x
>=
s
->
mb_width
){
if
(
++
s
->
mb_x
>=
s
->
mb_width
){
s
->
mb_x
=
0
;
loop_filter
(
h
,
lf_x_start
,
s
->
mb_x
)
;
loop_filter
(
h
)
;
s
->
mb_x
=
lf_x_start
=
0
;
ff_draw_horiz_band
(
s
,
16
*
s
->
mb_y
,
16
);
ff_draw_horiz_band
(
s
,
16
*
s
->
mb_y
,
16
);
++
s
->
mb_y
;
++
s
->
mb_y
;
if
(
FIELD_OR_MBAFF_PICTURE
)
{
if
(
FIELD_OR_MBAFF_PICTURE
)
{
...
@@ -2747,6 +2749,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
...
@@ -2747,6 +2749,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
tprintf
(
s
->
avctx
,
"slice end %d %d
\n
"
,
get_bits_count
(
&
s
->
gb
),
s
->
gb
.
size_in_bits
);
tprintf
(
s
->
avctx
,
"slice end %d %d
\n
"
,
get_bits_count
(
&
s
->
gb
),
s
->
gb
.
size_in_bits
);
if
(
get_bits_count
(
&
s
->
gb
)
==
s
->
gb
.
size_in_bits
){
if
(
get_bits_count
(
&
s
->
gb
)
==
s
->
gb
.
size_in_bits
){
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
(
AC_END
|
DC_END
|
MV_END
)
&
part_mask
);
ff_er_add_slice
(
s
,
s
->
resync_mb_x
,
s
->
resync_mb_y
,
s
->
mb_x
-
1
,
s
->
mb_y
,
(
AC_END
|
DC_END
|
MV_END
)
&
part_mask
);
if
(
s
->
mb_x
>
lf_x_start
)
loop_filter
(
h
,
lf_x_start
,
s
->
mb_x
);
return
0
;
return
0
;
}
else
{
}
else
{
...
...
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