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
bfc8a4da
Commit
bfc8a4da
authored
Jan 12, 2016
by
Kieran Kunhya
Committed by
Rostislav Pehlivanov
Jan 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diracdec: Add slice threading to HQ profile
parent
699c2ee5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
8 deletions
+30
-8
diracdec.c
libavcodec/diracdec.c
+30
-8
No files found.
libavcodec/diracdec.c
View file @
bfc8a4da
...
...
@@ -832,11 +832,13 @@ static int decode_lowdelay_slice(AVCodecContext *avctx, void *arg)
* VC-2 Specification ->
* 13.5.3 hq_slice(sx,sy)
*/
static
int
decode_hq_slice
(
DiracContext
*
s
,
GetBitContext
*
gb
,
int
slice_x
,
int
slice_y
)
static
int
decode_hq_slice
(
AVCodecContext
*
avctx
,
void
*
arg
)
{
int
i
,
quant
,
level
,
orientation
,
quant_idx
;
uint8_t
quants
[
MAX_DWT_LEVELS
][
4
];
DiracContext
*
s
=
avctx
->
priv_data
;
DiracSlice
*
slice
=
arg
;
GetBitContext
*
gb
=
&
slice
->
gb
;
skip_bits_long
(
gb
,
8
*
s
->
highquality
.
prefix_bytes
);
quant_idx
=
get_bits
(
gb
,
8
);
...
...
@@ -856,7 +858,7 @@ static int decode_hq_slice(DiracContext *s, GetBitContext *gb,
int
bits_end
=
get_bits_count
(
gb
)
+
bits_left
;
for
(
level
=
0
;
level
<
s
->
wavelet_depth
;
level
++
)
{
for
(
orientation
=
!!
level
;
orientation
<
4
;
orientation
++
)
{
decode_subband
(
s
,
gb
,
quants
[
level
][
orientation
],
slice
_x
,
slice_y
,
bits_end
,
decode_subband
(
s
,
gb
,
quants
[
level
][
orientation
],
slice
->
slice_x
,
slice
->
slice_y
,
bits_end
,
&
s
->
plane
[
i
].
band
[
level
][
orientation
],
NULL
);
}
}
...
...
@@ -873,7 +875,7 @@ static int decode_hq_slice(DiracContext *s, GetBitContext *gb,
static
int
decode_lowdelay
(
DiracContext
*
s
)
{
AVCodecContext
*
avctx
=
s
->
avctx
;
int
slice_x
,
slice_y
,
bytes
,
bufsize
;
int
slice_x
,
slice_y
,
bytes
=
0
,
bufsize
;
const
uint8_t
*
buf
;
DiracSlice
*
slices
;
int
slice_num
=
0
;
...
...
@@ -888,11 +890,31 @@ static int decode_lowdelay(DiracContext *s)
bufsize
=
get_bits_left
(
&
s
->
gb
);
if
(
s
->
hq_picture
)
{
for
(
slice_y
=
0
;
slice_y
<
s
->
num_y
;
slice_y
++
)
{
for
(
slice_x
=
0
;
slice_x
<
s
->
num_x
;
slice_x
++
)
{
decode_hq_slice
(
s
,
&
s
->
gb
,
slice_x
,
slice_y
);
int
i
;
for
(
slice_y
=
0
;
bufsize
>
0
&&
slice_y
<
s
->
num_y
;
slice_y
++
)
{
for
(
slice_x
=
0
;
bufsize
>
0
&&
slice_x
<
s
->
num_x
;
slice_x
++
)
{
bytes
=
s
->
highquality
.
prefix_bytes
+
1
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
if
(
bytes
<=
bufsize
/
8
)
bytes
+=
buf
[
bytes
]
*
s
->
highquality
.
size_scaler
+
1
;
}
slices
[
slice_num
].
bytes
=
bytes
;
slices
[
slice_num
].
slice_x
=
slice_x
;
slices
[
slice_num
].
slice_y
=
slice_y
;
init_get_bits
(
&
slices
[
slice_num
].
gb
,
buf
,
bufsize
);
slice_num
++
;
buf
+=
bytes
;
if
(
bufsize
/
8
>=
bytes
)
bufsize
-=
bytes
*
8
;
else
bufsize
=
0
;
}
}
avctx
->
execute
(
avctx
,
decode_hq_slice
,
slices
,
NULL
,
slice_num
,
sizeof
(
DiracSlice
));
}
else
{
for
(
slice_y
=
0
;
bufsize
>
0
&&
slice_y
<
s
->
num_y
;
slice_y
++
)
{
for
(
slice_x
=
0
;
bufsize
>
0
&&
slice_x
<
s
->
num_x
;
slice_x
++
)
{
...
...
@@ -2199,6 +2221,6 @@ AVCodec ff_dirac_decoder = {
.
init
=
dirac_decode_init
,
.
close
=
dirac_decode_end
,
.
decode
=
dirac_decode_frame
,
.
capabilities
=
AV_CODEC_CAP_DELAY
,
.
capabilities
=
AV_CODEC_CAP_DELAY
|
AV_CODEC_CAP_SLICE_THREADS
|
AV_CODEC_CAP_DR1
,
.
flush
=
dirac_decode_flush
,
};
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