Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
af7acbb4
Commit
af7acbb4
authored
Nov 17, 2020
by
Andreas Rheinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/motionpixels: Make decoder init-threadsafe
Signed-off-by:
Andreas Rheinhardt
<
andreas.rheinhardt@gmail.com
>
parent
cc18bcdd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
motionpixels.c
libavcodec/motionpixels.c
+10
-2
motionpixels_tablegen.h
libavcodec/motionpixels_tablegen.h
+1
-2
No files found.
libavcodec/motionpixels.c
View file @
af7acbb4
...
...
@@ -19,6 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/thread.h"
#include "config.h"
#include "avcodec.h"
#include "get_bits.h"
#include "bswapdsp.h"
...
...
@@ -65,6 +69,7 @@ static av_cold int mp_decode_end(AVCodecContext *avctx)
static
av_cold
int
mp_decode_init
(
AVCodecContext
*
avctx
)
{
av_unused
static
AVOnce
init_static_once
=
AV_ONCE_INIT
;
MotionPixelsContext
*
mp
=
avctx
->
priv_data
;
int
w4
=
(
avctx
->
width
+
3
)
&
~
3
;
int
h4
=
(
avctx
->
height
+
3
)
&
~
3
;
...
...
@@ -74,7 +79,6 @@ static av_cold int mp_decode_init(AVCodecContext *avctx)
return
AVERROR_INVALIDDATA
;
}
motionpixels_tableinit
();
mp
->
avctx
=
avctx
;
ff_bswapdsp_init
(
&
mp
->
bdsp
);
mp
->
changes_map
=
av_mallocz_array
(
avctx
->
width
,
h4
);
...
...
@@ -89,6 +93,10 @@ static av_cold int mp_decode_init(AVCodecContext *avctx)
if
(
!
mp
->
frame
)
return
AVERROR
(
ENOMEM
);
#if !CONFIG_HARDCODED_TABLES
ff_thread_once
(
&
init_static_once
,
motionpixels_tableinit
);
#endif
return
0
;
}
...
...
@@ -348,5 +356,5 @@ AVCodec ff_motionpixels_decoder = {
.
close
=
mp_decode_end
,
.
decode
=
mp_decode_frame
,
.
capabilities
=
AV_CODEC_CAP_DR1
,
.
caps_internal
=
FF_CODEC_CAP_INIT_CLEANUP
,
.
caps_internal
=
FF_CODEC_CAP_INIT_CLEANUP
|
FF_CODEC_CAP_INIT_THREADSAFE
,
};
libavcodec/motionpixels_tablegen.h
View file @
af7acbb4
...
...
@@ -84,8 +84,7 @@ static av_cold void mp_build_rgb_yuv_table(YuvPixel *p)
static
av_cold
void
motionpixels_tableinit
(
void
)
{
if
(
!
mp_rgb_yuv_table
[
0
].
u
)
mp_build_rgb_yuv_table
(
mp_rgb_yuv_table
);
mp_build_rgb_yuv_table
(
mp_rgb_yuv_table
);
}
#endif
/* CONFIG_HARDCODED_TABLES */
...
...
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