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
e04912c0
Commit
e04912c0
authored
Feb 03, 2016
by
Timothy Gu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diracdec: Split DWTPlane struct from Plane
parent
58ded09b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
26 deletions
+30
-26
dirac_dwt.h
libavcodec/dirac_dwt.h
+9
-0
diracdec.c
libavcodec/diracdec.c
+21
-26
No files found.
libavcodec/dirac_dwt.h
View file @
e04912c0
...
@@ -34,6 +34,15 @@ typedef struct DWTCompose {
...
@@ -34,6 +34,15 @@ typedef struct DWTCompose {
int
y
;
int
y
;
}
DWTCompose
;
}
DWTCompose
;
typedef
struct
DWTPlane
{
int
width
;
int
height
;
int
stride
;
uint8_t
*
buf
;
uint8_t
*
buf_base
;
uint8_t
*
tmp
;
}
DWTPlane
;
struct
DWTContext
;
struct
DWTContext
;
// Possible prototypes for vertical_compose functions
// Possible prototypes for vertical_compose functions
...
...
libavcodec/diracdec.c
View file @
e04912c0
...
@@ -101,17 +101,12 @@ typedef struct SubBand {
...
@@ -101,17 +101,12 @@ typedef struct SubBand {
}
SubBand
;
}
SubBand
;
typedef
struct
Plane
{
typedef
struct
Plane
{
DWTPlane
idwt
;
int
width
;
int
width
;
int
height
;
int
height
;
ptrdiff_t
stride
;
ptrdiff_t
stride
;
int
idwt_width
;
int
idwt_height
;
int
idwt_stride
;
uint8_t
*
idwt_buf
;
uint8_t
*
idwt_buf_base
;
uint8_t
*
idwt_tmp
;
/* block length */
/* block length */
uint8_t
xblen
;
uint8_t
xblen
;
uint8_t
yblen
;
uint8_t
yblen
;
...
@@ -290,10 +285,10 @@ static int alloc_sequence_buffers(DiracContext *s)
...
@@ -290,10 +285,10 @@ static int alloc_sequence_buffers(DiracContext *s)
w
=
FFALIGN
(
CALC_PADDING
(
w
,
MAX_DWT_LEVELS
),
8
);
/* FIXME: Should this be 16 for SSE??? */
w
=
FFALIGN
(
CALC_PADDING
(
w
,
MAX_DWT_LEVELS
),
8
);
/* FIXME: Should this be 16 for SSE??? */
h
=
top_padding
+
CALC_PADDING
(
h
,
MAX_DWT_LEVELS
)
+
max_yblen
/
2
;
h
=
top_padding
+
CALC_PADDING
(
h
,
MAX_DWT_LEVELS
)
+
max_yblen
/
2
;
s
->
plane
[
i
].
idwt
_
buf_base
=
av_mallocz_array
((
w
+
max_xblen
),
h
*
(
2
<<
s
->
pshift
));
s
->
plane
[
i
].
idwt
.
buf_base
=
av_mallocz_array
((
w
+
max_xblen
),
h
*
(
2
<<
s
->
pshift
));
s
->
plane
[
i
].
idwt
_
tmp
=
av_malloc_array
((
w
+
16
),
2
<<
s
->
pshift
);
s
->
plane
[
i
].
idwt
.
tmp
=
av_malloc_array
((
w
+
16
),
2
<<
s
->
pshift
);
s
->
plane
[
i
].
idwt
_buf
=
s
->
plane
[
i
].
idwt_
buf_base
+
(
top_padding
*
w
)
*
(
2
<<
s
->
pshift
);
s
->
plane
[
i
].
idwt
.
buf
=
s
->
plane
[
i
].
idwt
.
buf_base
+
(
top_padding
*
w
)
*
(
2
<<
s
->
pshift
);
if
(
!
s
->
plane
[
i
].
idwt
_buf_base
||
!
s
->
plane
[
i
].
idwt_
tmp
)
if
(
!
s
->
plane
[
i
].
idwt
.
buf_base
||
!
s
->
plane
[
i
].
idwt
.
tmp
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
...
@@ -354,8 +349,8 @@ static void free_sequence_buffers(DiracContext *s)
...
@@ -354,8 +349,8 @@ static void free_sequence_buffers(DiracContext *s)
memset
(
s
->
delay_frames
,
0
,
sizeof
(
s
->
delay_frames
));
memset
(
s
->
delay_frames
,
0
,
sizeof
(
s
->
delay_frames
));
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
av_freep
(
&
s
->
plane
[
i
].
idwt
_
buf_base
);
av_freep
(
&
s
->
plane
[
i
].
idwt
.
buf_base
);
av_freep
(
&
s
->
plane
[
i
].
idwt
_
tmp
);
av_freep
(
&
s
->
plane
[
i
].
idwt
.
tmp
);
}
}
s
->
buffer_stride
=
0
;
s
->
buffer_stride
=
0
;
...
@@ -939,9 +934,9 @@ static void init_planes(DiracContext *s)
...
@@ -939,9 +934,9 @@ static void init_planes(DiracContext *s)
p
->
width
=
s
->
seq
.
width
>>
(
i
?
s
->
chroma_x_shift
:
0
);
p
->
width
=
s
->
seq
.
width
>>
(
i
?
s
->
chroma_x_shift
:
0
);
p
->
height
=
s
->
seq
.
height
>>
(
i
?
s
->
chroma_y_shift
:
0
);
p
->
height
=
s
->
seq
.
height
>>
(
i
?
s
->
chroma_y_shift
:
0
);
p
->
idwt
_
width
=
w
=
CALC_PADDING
(
p
->
width
,
s
->
wavelet_depth
);
p
->
idwt
.
width
=
w
=
CALC_PADDING
(
p
->
width
,
s
->
wavelet_depth
);
p
->
idwt
_
height
=
h
=
CALC_PADDING
(
p
->
height
,
s
->
wavelet_depth
);
p
->
idwt
.
height
=
h
=
CALC_PADDING
(
p
->
height
,
s
->
wavelet_depth
);
p
->
idwt
_stride
=
FFALIGN
(
p
->
idwt_
width
,
8
)
<<
(
1
+
s
->
pshift
);
p
->
idwt
.
stride
=
FFALIGN
(
p
->
idwt
.
width
,
8
)
<<
(
1
+
s
->
pshift
);
for
(
level
=
s
->
wavelet_depth
-
1
;
level
>=
0
;
level
--
)
{
for
(
level
=
s
->
wavelet_depth
-
1
;
level
>=
0
;
level
--
)
{
w
=
w
>>
1
;
w
=
w
>>
1
;
...
@@ -950,9 +945,9 @@ static void init_planes(DiracContext *s)
...
@@ -950,9 +945,9 @@ static void init_planes(DiracContext *s)
SubBand
*
b
=
&
p
->
band
[
level
][
orientation
];
SubBand
*
b
=
&
p
->
band
[
level
][
orientation
];
b
->
pshift
=
s
->
pshift
;
b
->
pshift
=
s
->
pshift
;
b
->
ibuf
=
p
->
idwt
_
buf
;
b
->
ibuf
=
p
->
idwt
.
buf
;
b
->
level
=
level
;
b
->
level
=
level
;
b
->
stride
=
p
->
idwt
_
stride
<<
(
s
->
wavelet_depth
-
level
);
b
->
stride
=
p
->
idwt
.
stride
<<
(
s
->
wavelet_depth
-
level
);
b
->
width
=
w
;
b
->
width
=
w
;
b
->
height
=
h
;
b
->
height
=
h
;
b
->
orientation
=
orientation
;
b
->
orientation
=
orientation
;
...
@@ -1734,7 +1729,7 @@ static int dirac_decode_frame_internal(DiracContext *s)
...
@@ -1734,7 +1729,7 @@ static int dirac_decode_frame_internal(DiracContext *s)
/* [DIRAC_STD] 13.5.1 low_delay_transform_data() */
/* [DIRAC_STD] 13.5.1 low_delay_transform_data() */
for
(
comp
=
0
;
comp
<
3
;
comp
++
)
{
for
(
comp
=
0
;
comp
<
3
;
comp
++
)
{
Plane
*
p
=
&
s
->
plane
[
comp
];
Plane
*
p
=
&
s
->
plane
[
comp
];
memset
(
p
->
idwt
_buf
,
0
,
p
->
idwt_stride
*
p
->
idwt_
height
);
memset
(
p
->
idwt
.
buf
,
0
,
p
->
idwt
.
stride
*
p
->
idwt
.
height
);
}
}
if
(
!
s
->
zero_res
)
{
if
(
!
s
->
zero_res
)
{
if
((
ret
=
decode_lowdelay
(
s
))
<
0
)
if
((
ret
=
decode_lowdelay
(
s
))
<
0
)
...
@@ -1752,11 +1747,11 @@ static int dirac_decode_frame_internal(DiracContext *s)
...
@@ -1752,11 +1747,11 @@ static int dirac_decode_frame_internal(DiracContext *s)
if
(
!
s
->
zero_res
&&
!
s
->
low_delay
)
if
(
!
s
->
zero_res
&&
!
s
->
low_delay
)
{
{
memset
(
p
->
idwt
_buf
,
0
,
p
->
idwt_stride
*
p
->
idwt_
height
);
memset
(
p
->
idwt
.
buf
,
0
,
p
->
idwt
.
stride
*
p
->
idwt
.
height
);
decode_component
(
s
,
comp
);
/* [DIRAC_STD] 13.4.1 core_transform_data() */
decode_component
(
s
,
comp
);
/* [DIRAC_STD] 13.4.1 core_transform_data() */
}
}
ret
=
ff_spatial_idwt_init
(
&
d
,
p
->
idwt
_buf
,
p
->
idwt_width
,
p
->
idwt_height
,
p
->
idwt_
stride
,
ret
=
ff_spatial_idwt_init
(
&
d
,
p
->
idwt
.
buf
,
p
->
idwt
.
width
,
p
->
idwt
.
height
,
p
->
idwt
.
stride
,
s
->
wavelet_idx
+
2
,
s
->
wavelet_depth
,
p
->
idwt
_
tmp
,
s
->
bit_depth
);
s
->
wavelet_idx
+
2
,
s
->
wavelet_depth
,
p
->
idwt
.
tmp
,
s
->
bit_depth
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
...
@@ -1766,8 +1761,8 @@ static int dirac_decode_frame_internal(DiracContext *s)
...
@@ -1766,8 +1761,8 @@ static int dirac_decode_frame_internal(DiracContext *s)
ff_spatial_idwt_slice2
(
&
d
,
y
+
16
);
/* decode */
ff_spatial_idwt_slice2
(
&
d
,
y
+
16
);
/* decode */
s
->
diracdsp
.
put_signed_rect_clamped
[
idx
](
frame
+
y
*
p
->
stride
,
s
->
diracdsp
.
put_signed_rect_clamped
[
idx
](
frame
+
y
*
p
->
stride
,
p
->
stride
,
p
->
stride
,
p
->
idwt
_buf
+
y
*
p
->
idwt_
stride
,
p
->
idwt
.
buf
+
y
*
p
->
idwt
.
stride
,
p
->
idwt
_
stride
,
p
->
width
,
16
);
p
->
idwt
.
stride
,
p
->
width
,
16
);
}
}
}
else
{
/* inter */
}
else
{
/* inter */
int
rowheight
=
p
->
ybsep
*
p
->
stride
;
int
rowheight
=
p
->
ybsep
*
p
->
stride
;
...
@@ -1804,9 +1799,9 @@ static int dirac_decode_frame_internal(DiracContext *s)
...
@@ -1804,9 +1799,9 @@ static int dirac_decode_frame_internal(DiracContext *s)
mctmp
+=
(
start
-
dsty
)
*
p
->
stride
+
p
->
xoffset
;
mctmp
+=
(
start
-
dsty
)
*
p
->
stride
+
p
->
xoffset
;
ff_spatial_idwt_slice2
(
&
d
,
start
+
h
);
/* decode */
ff_spatial_idwt_slice2
(
&
d
,
start
+
h
);
/* decode */
/* NOTE: add_rect_clamped hasn't been templated hence the shifts.
/* NOTE: add_rect_clamped hasn't been templated hence the shifts.
* idwt
_
stride is passed as pixels, not in bytes as in the rest of the decoder */
* idwt
.
stride is passed as pixels, not in bytes as in the rest of the decoder */
s
->
diracdsp
.
add_rect_clamped
(
frame
+
start
*
p
->
stride
,
mctmp
,
p
->
stride
,
s
->
diracdsp
.
add_rect_clamped
(
frame
+
start
*
p
->
stride
,
mctmp
,
p
->
stride
,
(
int16_t
*
)(
p
->
idwt
_buf
)
+
start
*
(
p
->
idwt_stride
>>
1
),
(
p
->
idwt_
stride
>>
1
),
p
->
width
,
h
);
(
int16_t
*
)(
p
->
idwt
.
buf
)
+
start
*
(
p
->
idwt
.
stride
>>
1
),
(
p
->
idwt
.
stride
>>
1
),
p
->
width
,
h
);
dsty
+=
p
->
ybsep
;
dsty
+=
p
->
ybsep
;
}
}
...
...
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