Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
cf880ccb
Commit
cf880ccb
authored
Apr 04, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/error_resilience: Avoid race with updating the error_count
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
4a58d757
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
error_resilience.c
libavcodec/error_resilience.c
+7
-6
error_resilience.h
libavcodec/error_resilience.h
+2
-1
No files found.
libavcodec/error_resilience.c
View file @
cf880ccb
...
...
@@ -27,6 +27,7 @@
#include <limits.h>
#include "libavutil/atomic.h"
#include "libavutil/internal.h"
#include "avcodec.h"
#include "error_resilience.h"
...
...
@@ -813,20 +814,20 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
mask
&=
~
VP_START
;
if
(
status
&
(
ER_AC_ERROR
|
ER_AC_END
))
{
mask
&=
~
(
ER_AC_ERROR
|
ER_AC_END
);
s
->
error_count
-=
end_i
-
start_i
+
1
;
avpriv_atomic_int_add_and_fetch
(
&
s
->
error_count
,
start_i
-
end_i
-
1
)
;
}
if
(
status
&
(
ER_DC_ERROR
|
ER_DC_END
))
{
mask
&=
~
(
ER_DC_ERROR
|
ER_DC_END
);
s
->
error_count
-=
end_i
-
start_i
+
1
;
avpriv_atomic_int_add_and_fetch
(
&
s
->
error_count
,
start_i
-
end_i
-
1
)
;
}
if
(
status
&
(
ER_MV_ERROR
|
ER_MV_END
))
{
mask
&=
~
(
ER_MV_ERROR
|
ER_MV_END
);
s
->
error_count
-=
end_i
-
start_i
+
1
;
avpriv_atomic_int_add_and_fetch
(
&
s
->
error_count
,
start_i
-
end_i
-
1
)
;
}
if
(
status
&
ER_MB_ERROR
)
{
s
->
error_occurred
=
1
;
s
->
error_count
=
INT_MAX
;
avpriv_atomic_int_set
(
&
s
->
error_count
,
INT_MAX
)
;
}
if
(
mask
==
~
0x7F
)
{
...
...
@@ -839,7 +840,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
}
if
(
end_i
==
s
->
mb_num
)
s
->
error_count
=
INT_MAX
;
avpriv_atomic_int_set
(
&
s
->
error_count
,
INT_MAX
)
;
else
{
s
->
error_status_table
[
end_xy
]
&=
mask
;
s
->
error_status_table
[
end_xy
]
|=
status
;
...
...
@@ -854,7 +855,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
prev_status
&=
~
VP_START
;
if
(
prev_status
!=
(
ER_MV_END
|
ER_DC_END
|
ER_AC_END
))
{
s
->
error_occurred
=
1
;
s
->
error_count
=
INT_MAX
;
avpriv_atomic_int_set
(
&
s
->
error_count
,
INT_MAX
)
;
}
}
}
...
...
libavcodec/error_resilience.h
View file @
cf880ccb
...
...
@@ -61,7 +61,8 @@ typedef struct ERContext {
int
mb_stride
;
int
b8_stride
;
int
error_count
,
error_occurred
;
volatile
int
error_count
;
int
error_occurred
;
uint8_t
*
error_status_table
;
uint8_t
*
er_temp_buffer
;
int16_t
*
dc_val
[
3
];
...
...
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