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
3701d499
Commit
3701d499
authored
Nov 24, 2017
by
Rostislav Pehlivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error_resilience: remove avpriv_atomic usage
Signed-off-by:
Rostislav Pehlivanov
<
atomnuker@gmail.com
>
parent
590136e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
error_resilience.c
libavcodec/error_resilience.c
+10
-10
error_resilience.h
libavcodec/error_resilience.h
+2
-1
No files found.
libavcodec/error_resilience.c
View file @
3701d499
...
@@ -807,7 +807,7 @@ void ff_er_frame_start(ERContext *s)
...
@@ -807,7 +807,7 @@ void ff_er_frame_start(ERContext *s)
memset
(
s
->
error_status_table
,
ER_MB_ERROR
|
VP_START
|
ER_MB_END
,
memset
(
s
->
error_status_table
,
ER_MB_ERROR
|
VP_START
|
ER_MB_END
,
s
->
mb_stride
*
s
->
mb_height
*
sizeof
(
uint8_t
));
s
->
mb_stride
*
s
->
mb_height
*
sizeof
(
uint8_t
));
s
->
error_count
=
3
*
s
->
mb_num
;
atomic_init
(
&
s
->
error_count
,
3
*
s
->
mb_num
)
;
s
->
error_occurred
=
0
;
s
->
error_occurred
=
0
;
}
}
...
@@ -852,20 +852,20 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
...
@@ -852,20 +852,20 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
mask
&=
~
VP_START
;
mask
&=
~
VP_START
;
if
(
status
&
(
ER_AC_ERROR
|
ER_AC_END
))
{
if
(
status
&
(
ER_AC_ERROR
|
ER_AC_END
))
{
mask
&=
~
(
ER_AC_ERROR
|
ER_AC_END
);
mask
&=
~
(
ER_AC_ERROR
|
ER_AC_END
);
a
vpriv_atomic_int_add_and_fetch
(
&
s
->
error_count
,
start_i
-
end_i
-
1
);
a
tomic_fetch_add
(
&
s
->
error_count
,
start_i
-
end_i
-
1
);
}
}
if
(
status
&
(
ER_DC_ERROR
|
ER_DC_END
))
{
if
(
status
&
(
ER_DC_ERROR
|
ER_DC_END
))
{
mask
&=
~
(
ER_DC_ERROR
|
ER_DC_END
);
mask
&=
~
(
ER_DC_ERROR
|
ER_DC_END
);
a
vpriv_atomic_int_add_and_fetch
(
&
s
->
error_count
,
start_i
-
end_i
-
1
);
a
tomic_fetch_add
(
&
s
->
error_count
,
start_i
-
end_i
-
1
);
}
}
if
(
status
&
(
ER_MV_ERROR
|
ER_MV_END
))
{
if
(
status
&
(
ER_MV_ERROR
|
ER_MV_END
))
{
mask
&=
~
(
ER_MV_ERROR
|
ER_MV_END
);
mask
&=
~
(
ER_MV_ERROR
|
ER_MV_END
);
a
vpriv_atomic_int_add_and_fetch
(
&
s
->
error_count
,
start_i
-
end_i
-
1
);
a
tomic_fetch_add
(
&
s
->
error_count
,
start_i
-
end_i
-
1
);
}
}
if
(
status
&
ER_MB_ERROR
)
{
if
(
status
&
ER_MB_ERROR
)
{
s
->
error_occurred
=
1
;
s
->
error_occurred
=
1
;
a
vpriv_atomic_int_set
(
&
s
->
error_count
,
INT_MAX
);
a
tomic_store
(
&
s
->
error_count
,
INT_MAX
);
}
}
if
(
mask
==
~
0x7F
)
{
if
(
mask
==
~
0x7F
)
{
...
@@ -878,7 +878,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
...
@@ -878,7 +878,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
}
}
if
(
end_i
==
s
->
mb_num
)
if
(
end_i
==
s
->
mb_num
)
a
vpriv_atomic_int_set
(
&
s
->
error_count
,
INT_MAX
);
a
tomic_store
(
&
s
->
error_count
,
INT_MAX
);
else
{
else
{
s
->
error_status_table
[
end_xy
]
&=
mask
;
s
->
error_status_table
[
end_xy
]
&=
mask
;
s
->
error_status_table
[
end_xy
]
|=
status
;
s
->
error_status_table
[
end_xy
]
|=
status
;
...
@@ -893,7 +893,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
...
@@ -893,7 +893,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
prev_status
&=
~
VP_START
;
prev_status
&=
~
VP_START
;
if
(
prev_status
!=
(
ER_MV_END
|
ER_DC_END
|
ER_AC_END
))
{
if
(
prev_status
!=
(
ER_MV_END
|
ER_DC_END
|
ER_AC_END
))
{
s
->
error_occurred
=
1
;
s
->
error_occurred
=
1
;
a
vpriv_atomic_int_set
(
&
s
->
error_count
,
INT_MAX
);
a
tomic_store
(
&
s
->
error_count
,
INT_MAX
);
}
}
}
}
}
}
...
@@ -910,10 +910,10 @@ void ff_er_frame_end(ERContext *s)
...
@@ -910,10 +910,10 @@ void ff_er_frame_end(ERContext *s)
/* We do not support ER of field pictures yet,
/* We do not support ER of field pictures yet,
* though it should not crash if enabled. */
* though it should not crash if enabled. */
if
(
!
s
->
avctx
->
error_concealment
||
s
->
error_count
==
0
||
if
(
!
s
->
avctx
->
error_concealment
||
!
atomic_load
(
&
s
->
error_count
)
||
s
->
avctx
->
lowres
||
s
->
avctx
->
lowres
||
!
er_supported
(
s
)
||
!
er_supported
(
s
)
||
s
->
error_count
==
3
*
s
->
mb_width
*
atomic_load
(
&
s
->
error_count
)
==
3
*
s
->
mb_width
*
(
s
->
avctx
->
skip_top
+
s
->
avctx
->
skip_bottom
))
{
(
s
->
avctx
->
skip_top
+
s
->
avctx
->
skip_bottom
))
{
return
;
return
;
}
}
...
@@ -927,7 +927,7 @@ void ff_er_frame_end(ERContext *s)
...
@@ -927,7 +927,7 @@ void ff_er_frame_end(ERContext *s)
if
(
mb_x
==
s
->
mb_width
if
(
mb_x
==
s
->
mb_width
&&
s
->
avctx
->
codec_id
==
AV_CODEC_ID_MPEG2VIDEO
&&
s
->
avctx
->
codec_id
==
AV_CODEC_ID_MPEG2VIDEO
&&
(
FFALIGN
(
s
->
avctx
->
height
,
16
)
&
16
)
&&
(
FFALIGN
(
s
->
avctx
->
height
,
16
)
&
16
)
&&
s
->
error_count
==
3
*
s
->
mb_width
*
(
s
->
avctx
->
skip_top
+
s
->
avctx
->
skip_bottom
+
1
)
&&
atomic_load
(
&
s
->
error_count
)
==
3
*
s
->
mb_width
*
(
s
->
avctx
->
skip_top
+
s
->
avctx
->
skip_bottom
+
1
)
)
{
)
{
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"ignoring last missing slice
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"ignoring last missing slice
\n
"
);
return
;
return
;
...
...
libavcodec/error_resilience.h
View file @
3701d499
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#define AVCODEC_ERROR_RESILIENCE_H
#define AVCODEC_ERROR_RESILIENCE_H
#include <stdint.h>
#include <stdint.h>
#include <stdatomic.h>
#include "avcodec.h"
#include "avcodec.h"
#include "me_cmp.h"
#include "me_cmp.h"
...
@@ -60,7 +61,7 @@ typedef struct ERContext {
...
@@ -60,7 +61,7 @@ typedef struct ERContext {
ptrdiff_t
mb_stride
;
ptrdiff_t
mb_stride
;
ptrdiff_t
b8_stride
;
ptrdiff_t
b8_stride
;
volatile
int
error_count
;
atomic_
int
error_count
;
int
error_occurred
;
int
error_occurred
;
uint8_t
*
error_status_table
;
uint8_t
*
error_status_table
;
uint8_t
*
er_temp_buffer
;
uint8_t
*
er_temp_buffer
;
...
...
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