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
31bf37cb
Commit
31bf37cb
authored
Dec 26, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/ylc: add frame threading support
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
341d3ee4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
ylc.c
libavcodec/ylc.c
+23
-2
No files found.
libavcodec/ylc.c
View file @
31bf37cb
...
...
@@ -31,6 +31,7 @@
#include "get_bits.h"
#include "huffyuvdsp.h"
#include "internal.h"
#include "thread.h"
#include "unary.h"
typedef
struct
YLCContext
{
...
...
@@ -282,6 +283,7 @@ static int decode_frame(AVCodecContext *avctx,
int
TL
[
4
]
=
{
128
,
128
,
128
,
128
};
int
L
[
4
]
=
{
128
,
128
,
128
,
128
};
YLCContext
*
s
=
avctx
->
priv_data
;
ThreadFrame
frame
=
{
.
f
=
data
};
const
uint8_t
*
buf
=
avpkt
->
data
;
int
ret
,
x
,
y
,
toffset
,
boffset
;
AVFrame
*
const
p
=
data
;
...
...
@@ -303,7 +305,7 @@ static int decode_frame(AVCodecContext *avctx,
if
(
toffset
>=
boffset
||
boffset
>=
avpkt
->
size
)
return
AVERROR_INVALIDDATA
;
if
((
ret
=
ff_
get_buffer
(
avctx
,
p
,
0
))
<
0
)
if
((
ret
=
ff_
thread_get_buffer
(
avctx
,
&
frame
,
0
))
<
0
)
return
ret
;
av_fast_malloc
(
&
s
->
table_bits
,
&
s
->
table_bits_size
,
...
...
@@ -447,6 +449,24 @@ static int decode_frame(AVCodecContext *avctx,
return
avpkt
->
size
;
}
#if HAVE_THREADS
static
int
init_thread_copy
(
AVCodecContext
*
avctx
)
{
YLCContext
*
s
=
avctx
->
priv_data
;
memset
(
&
s
->
vlc
[
0
],
0
,
sizeof
(
VLC
));
memset
(
&
s
->
vlc
[
1
],
0
,
sizeof
(
VLC
));
memset
(
&
s
->
vlc
[
2
],
0
,
sizeof
(
VLC
));
memset
(
&
s
->
vlc
[
3
],
0
,
sizeof
(
VLC
));
s
->
table_bits
=
NULL
;
s
->
table_bits_size
=
0
;
s
->
bitstream_bits
=
NULL
;
s
->
bitstream_bits_size
=
0
;
return
0
;
}
#endif
static
av_cold
int
decode_end
(
AVCodecContext
*
avctx
)
{
YLCContext
*
s
=
avctx
->
priv_data
;
...
...
@@ -470,7 +490,8 @@ AVCodec ff_ylc_decoder = {
.
id
=
AV_CODEC_ID_YLC
,
.
priv_data_size
=
sizeof
(
YLCContext
),
.
init
=
decode_init
,
.
init_thread_copy
=
ONLY_IF_THREADS_ENABLED
(
init_thread_copy
),
.
close
=
decode_end
,
.
decode
=
decode_frame
,
.
capabilities
=
AV_CODEC_CAP_DR1
,
.
capabilities
=
AV_CODEC_CAP_DR1
|
AV_CODEC_CAP_FRAME_THREADS
,
};
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