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
d9669eab
Commit
d9669eab
authored
Jun 14, 2012
by
Ronald S. Bultje
Committed by
Mans Rullgard
Jun 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwt: remove variable-length arrays
Signed-off-by:
Mans Rullgard
<
mans@mansr.com
>
parent
8e50c57d
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
74 deletions
+79
-74
dwt.c
libavcodec/dwt.c
+55
-54
dwt.h
libavcodec/dwt.h
+9
-9
snow.c
libavcodec/snow.c
+4
-0
snow.h
libavcodec/snow.h
+2
-0
snowdec.c
libavcodec/snowdec.c
+1
-1
snowenc.c
libavcodec/snowenc.c
+6
-6
snowdsp_mmx.c
libavcodec/x86/snowdsp_mmx.c
+2
-4
No files found.
libavcodec/dwt.c
View file @
d9669eab
...
@@ -243,9 +243,8 @@ static av_always_inline void inv_liftS(IDWTELEM *dst, IDWTELEM *src,
...
@@ -243,9 +243,8 @@ static av_always_inline void inv_liftS(IDWTELEM *dst, IDWTELEM *src,
}
}
#endif
/* ! liftS */
#endif
/* ! liftS */
static
void
horizontal_decompose53i
(
DWTELEM
*
b
,
int
width
)
static
void
horizontal_decompose53i
(
DWTELEM
*
b
,
DWTELEM
*
temp
,
int
width
)
{
{
DWTELEM
temp
[
width
];
const
int
width2
=
width
>>
1
;
const
int
width2
=
width
>>
1
;
int
x
;
int
x
;
const
int
w2
=
(
width
+
1
)
>>
1
;
const
int
w2
=
(
width
+
1
)
>>
1
;
...
@@ -311,8 +310,8 @@ static void vertical_decompose53iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
...
@@ -311,8 +310,8 @@ static void vertical_decompose53iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
b1
[
i
]
+=
(
b0
[
i
]
+
b2
[
i
]
+
2
)
>>
2
;
b1
[
i
]
+=
(
b0
[
i
]
+
b2
[
i
]
+
2
)
>>
2
;
}
}
static
void
spatial_decompose53i
(
DWTELEM
*
buffer
,
int
width
,
int
height
,
static
void
spatial_decompose53i
(
DWTELEM
*
buffer
,
DWTELEM
*
temp
,
int
stride
)
int
width
,
int
height
,
int
stride
)
{
{
int
y
;
int
y
;
DWTELEM
*
b0
=
buffer
+
mirror
(
-
2
-
1
,
height
-
1
)
*
stride
;
DWTELEM
*
b0
=
buffer
+
mirror
(
-
2
-
1
,
height
-
1
)
*
stride
;
...
@@ -323,9 +322,9 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
...
@@ -323,9 +322,9 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
DWTELEM
*
b3
=
buffer
+
mirror
(
y
+
2
,
height
-
1
)
*
stride
;
DWTELEM
*
b3
=
buffer
+
mirror
(
y
+
2
,
height
-
1
)
*
stride
;
if
(
y
+
1
<
(
unsigned
)
height
)
if
(
y
+
1
<
(
unsigned
)
height
)
horizontal_decompose53i
(
b2
,
width
);
horizontal_decompose53i
(
b2
,
temp
,
width
);
if
(
y
+
2
<
(
unsigned
)
height
)
if
(
y
+
2
<
(
unsigned
)
height
)
horizontal_decompose53i
(
b3
,
width
);
horizontal_decompose53i
(
b3
,
temp
,
width
);
if
(
y
+
1
<
(
unsigned
)
height
)
if
(
y
+
1
<
(
unsigned
)
height
)
vertical_decompose53iH0
(
b1
,
b2
,
b3
,
width
);
vertical_decompose53iH0
(
b1
,
b2
,
b3
,
width
);
...
@@ -337,9 +336,8 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
...
@@ -337,9 +336,8 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height,
}
}
}
}
static
void
horizontal_decompose97i
(
DWTELEM
*
b
,
int
width
)
static
void
horizontal_decompose97i
(
DWTELEM
*
b
,
DWTELEM
*
temp
,
int
width
)
{
{
DWTELEM
temp
[
width
];
const
int
w2
=
(
width
+
1
)
>>
1
;
const
int
w2
=
(
width
+
1
)
>>
1
;
lift
(
temp
+
w2
,
b
+
1
,
b
,
1
,
2
,
2
,
width
,
W_AM
,
W_AO
,
W_AS
,
1
,
1
);
lift
(
temp
+
w2
,
b
+
1
,
b
,
1
,
2
,
2
,
width
,
W_AM
,
W_AO
,
W_AS
,
1
,
1
);
...
@@ -389,8 +387,8 @@ static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
...
@@ -389,8 +387,8 @@ static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
b1
[
i
]
+=
(
W_DM
*
(
b0
[
i
]
+
b2
[
i
])
+
W_DO
)
>>
W_DS
;
b1
[
i
]
+=
(
W_DM
*
(
b0
[
i
]
+
b2
[
i
])
+
W_DO
)
>>
W_DS
;
}
}
static
void
spatial_decompose97i
(
DWTELEM
*
buffer
,
int
width
,
int
height
,
static
void
spatial_decompose97i
(
DWTELEM
*
buffer
,
DWTELEM
*
temp
,
int
stride
)
int
width
,
int
height
,
int
stride
)
{
{
int
y
;
int
y
;
DWTELEM
*
b0
=
buffer
+
mirror
(
-
4
-
1
,
height
-
1
)
*
stride
;
DWTELEM
*
b0
=
buffer
+
mirror
(
-
4
-
1
,
height
-
1
)
*
stride
;
...
@@ -403,9 +401,9 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
...
@@ -403,9 +401,9 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
DWTELEM
*
b5
=
buffer
+
mirror
(
y
+
4
,
height
-
1
)
*
stride
;
DWTELEM
*
b5
=
buffer
+
mirror
(
y
+
4
,
height
-
1
)
*
stride
;
if
(
y
+
3
<
(
unsigned
)
height
)
if
(
y
+
3
<
(
unsigned
)
height
)
horizontal_decompose97i
(
b4
,
width
);
horizontal_decompose97i
(
b4
,
temp
,
width
);
if
(
y
+
4
<
(
unsigned
)
height
)
if
(
y
+
4
<
(
unsigned
)
height
)
horizontal_decompose97i
(
b5
,
width
);
horizontal_decompose97i
(
b5
,
temp
,
width
);
if
(
y
+
3
<
(
unsigned
)
height
)
if
(
y
+
3
<
(
unsigned
)
height
)
vertical_decompose97iH0
(
b3
,
b4
,
b5
,
width
);
vertical_decompose97iH0
(
b3
,
b4
,
b5
,
width
);
...
@@ -423,20 +421,20 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
...
@@ -423,20 +421,20 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height,
}
}
}
}
void
ff_spatial_dwt
(
DWTELEM
*
buffer
,
int
width
,
int
height
,
int
stride
,
void
ff_spatial_dwt
(
DWTELEM
*
buffer
,
DWTELEM
*
temp
,
int
width
,
int
height
,
int
type
,
int
decomposition_count
)
int
stride
,
int
type
,
int
decomposition_count
)
{
{
int
level
;
int
level
;
for
(
level
=
0
;
level
<
decomposition_count
;
level
++
)
{
for
(
level
=
0
;
level
<
decomposition_count
;
level
++
)
{
switch
(
type
)
{
switch
(
type
)
{
case
DWT_97
:
case
DWT_97
:
spatial_decompose97i
(
buffer
,
spatial_decompose97i
(
buffer
,
temp
,
width
>>
level
,
height
>>
level
,
width
>>
level
,
height
>>
level
,
stride
<<
level
);
stride
<<
level
);
break
;
break
;
case
DWT_53
:
case
DWT_53
:
spatial_decompose53i
(
buffer
,
spatial_decompose53i
(
buffer
,
temp
,
width
>>
level
,
height
>>
level
,
width
>>
level
,
height
>>
level
,
stride
<<
level
);
stride
<<
level
);
break
;
break
;
...
@@ -444,9 +442,8 @@ void ff_spatial_dwt(DWTELEM *buffer, int width, int height, int stride,
...
@@ -444,9 +442,8 @@ void ff_spatial_dwt(DWTELEM *buffer, int width, int height, int stride,
}
}
}
}
static
void
horizontal_compose53i
(
IDWTELEM
*
b
,
int
width
)
static
void
horizontal_compose53i
(
IDWTELEM
*
b
,
IDWTELEM
*
temp
,
int
width
)
{
{
IDWTELEM
temp
[
width
];
const
int
width2
=
width
>>
1
;
const
int
width2
=
width
>>
1
;
const
int
w2
=
(
width
+
1
)
>>
1
;
const
int
w2
=
(
width
+
1
)
>>
1
;
int
x
;
int
x
;
...
@@ -506,6 +503,7 @@ static void spatial_compose53i_init(DWTCompose *cs, IDWTELEM *buffer,
...
@@ -506,6 +503,7 @@ static void spatial_compose53i_init(DWTCompose *cs, IDWTELEM *buffer,
}
}
static
void
spatial_compose53i_dy_buffered
(
DWTCompose
*
cs
,
slice_buffer
*
sb
,
static
void
spatial_compose53i_dy_buffered
(
DWTCompose
*
cs
,
slice_buffer
*
sb
,
IDWTELEM
*
temp
,
int
width
,
int
height
,
int
width
,
int
height
,
int
stride_line
)
int
stride_line
)
{
{
...
@@ -535,17 +533,18 @@ static void spatial_compose53i_dy_buffered(DWTCompose *cs, slice_buffer *sb,
...
@@ -535,17 +533,18 @@ static void spatial_compose53i_dy_buffered(DWTCompose *cs, slice_buffer *sb,
}
}
if
(
y
-
1
<
(
unsigned
)
height
)
if
(
y
-
1
<
(
unsigned
)
height
)
horizontal_compose53i
(
b0
,
width
);
horizontal_compose53i
(
b0
,
temp
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
if
(
y
+
0
<
(
unsigned
)
height
)
horizontal_compose53i
(
b1
,
width
);
horizontal_compose53i
(
b1
,
temp
,
width
);
cs
->
b0
=
b2
;
cs
->
b0
=
b2
;
cs
->
b1
=
b3
;
cs
->
b1
=
b3
;
cs
->
y
+=
2
;
cs
->
y
+=
2
;
}
}
static
void
spatial_compose53i_dy
(
DWTCompose
*
cs
,
IDWTELEM
*
buffer
,
int
width
,
static
void
spatial_compose53i_dy
(
DWTCompose
*
cs
,
IDWTELEM
*
buffer
,
int
height
,
int
stride
)
IDWTELEM
*
temp
,
int
width
,
int
height
,
int
stride
)
{
{
int
y
=
cs
->
y
;
int
y
=
cs
->
y
;
IDWTELEM
*
b0
=
cs
->
b0
;
IDWTELEM
*
b0
=
cs
->
b0
;
...
@@ -559,27 +558,26 @@ static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
...
@@ -559,27 +558,26 @@ static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
vertical_compose53iH0
(
b0
,
b1
,
b2
,
width
);
vertical_compose53iH0
(
b0
,
b1
,
b2
,
width
);
if
(
y
-
1
<
(
unsigned
)
height
)
if
(
y
-
1
<
(
unsigned
)
height
)
horizontal_compose53i
(
b0
,
width
);
horizontal_compose53i
(
b0
,
temp
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
if
(
y
+
0
<
(
unsigned
)
height
)
horizontal_compose53i
(
b1
,
width
);
horizontal_compose53i
(
b1
,
temp
,
width
);
cs
->
b0
=
b2
;
cs
->
b0
=
b2
;
cs
->
b1
=
b3
;
cs
->
b1
=
b3
;
cs
->
y
+=
2
;
cs
->
y
+=
2
;
}
}
static
void
av_unused
spatial_compose53i
(
IDWTELEM
*
buffer
,
int
width
,
static
void
av_unused
spatial_compose53i
(
IDWTELEM
*
buffer
,
IDWTELEM
*
temp
,
int
height
,
int
stride
)
int
width
,
int
height
,
int
stride
)
{
{
DWTCompose
cs
;
DWTCompose
cs
;
spatial_compose53i_init
(
&
cs
,
buffer
,
height
,
stride
);
spatial_compose53i_init
(
&
cs
,
buffer
,
height
,
stride
);
while
(
cs
.
y
<=
height
)
while
(
cs
.
y
<=
height
)
spatial_compose53i_dy
(
&
cs
,
buffer
,
width
,
height
,
stride
);
spatial_compose53i_dy
(
&
cs
,
buffer
,
temp
,
width
,
height
,
stride
);
}
}
void
ff_snow_horizontal_compose97i
(
IDWTELEM
*
b
,
int
width
)
void
ff_snow_horizontal_compose97i
(
IDWTELEM
*
b
,
IDWTELEM
*
temp
,
int
width
)
{
{
IDWTELEM
temp
[
width
];
const
int
w2
=
(
width
+
1
)
>>
1
;
const
int
w2
=
(
width
+
1
)
>>
1
;
#if 0 //maybe more understadable but slower
#if 0 //maybe more understadable but slower
...
@@ -693,8 +691,9 @@ static void spatial_compose97i_init(DWTCompose *cs, IDWTELEM *buffer, int height
...
@@ -693,8 +691,9 @@ static void spatial_compose97i_init(DWTCompose *cs, IDWTELEM *buffer, int height
}
}
static
void
spatial_compose97i_dy_buffered
(
DWTContext
*
dsp
,
DWTCompose
*
cs
,
static
void
spatial_compose97i_dy_buffered
(
DWTContext
*
dsp
,
DWTCompose
*
cs
,
slice_buffer
*
sb
,
int
width
,
slice_buffer
*
sb
,
IDWTELEM
*
temp
,
int
height
,
int
stride_line
)
int
width
,
int
height
,
int
stride_line
)
{
{
int
y
=
cs
->
y
;
int
y
=
cs
->
y
;
...
@@ -723,9 +722,9 @@ static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
...
@@ -723,9 +722,9 @@ static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
}
}
if
(
y
-
1
<
(
unsigned
)
height
)
if
(
y
-
1
<
(
unsigned
)
height
)
dsp
->
horizontal_compose97i
(
b0
,
width
);
dsp
->
horizontal_compose97i
(
b0
,
temp
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
if
(
y
+
0
<
(
unsigned
)
height
)
dsp
->
horizontal_compose97i
(
b1
,
width
);
dsp
->
horizontal_compose97i
(
b1
,
temp
,
width
);
cs
->
b0
=
b2
;
cs
->
b0
=
b2
;
cs
->
b1
=
b3
;
cs
->
b1
=
b3
;
...
@@ -734,8 +733,9 @@ static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
...
@@ -734,8 +733,9 @@ static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
cs
->
y
+=
2
;
cs
->
y
+=
2
;
}
}
static
void
spatial_compose97i_dy
(
DWTCompose
*
cs
,
IDWTELEM
*
buffer
,
int
width
,
static
void
spatial_compose97i_dy
(
DWTCompose
*
cs
,
IDWTELEM
*
buffer
,
int
height
,
int
stride
)
IDWTELEM
*
temp
,
int
width
,
int
height
,
int
stride
)
{
{
int
y
=
cs
->
y
;
int
y
=
cs
->
y
;
IDWTELEM
*
b0
=
cs
->
b0
;
IDWTELEM
*
b0
=
cs
->
b0
;
...
@@ -755,9 +755,9 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
...
@@ -755,9 +755,9 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
vertical_compose97iH0
(
b0
,
b1
,
b2
,
width
);
vertical_compose97iH0
(
b0
,
b1
,
b2
,
width
);
if
(
y
-
1
<
(
unsigned
)
height
)
if
(
y
-
1
<
(
unsigned
)
height
)
ff_snow_horizontal_compose97i
(
b0
,
width
);
ff_snow_horizontal_compose97i
(
b0
,
temp
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
if
(
y
+
0
<
(
unsigned
)
height
)
ff_snow_horizontal_compose97i
(
b1
,
width
);
ff_snow_horizontal_compose97i
(
b1
,
temp
,
width
);
cs
->
b0
=
b2
;
cs
->
b0
=
b2
;
cs
->
b1
=
b3
;
cs
->
b1
=
b3
;
...
@@ -766,13 +766,13 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
...
@@ -766,13 +766,13 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width,
cs
->
y
+=
2
;
cs
->
y
+=
2
;
}
}
static
void
av_unused
spatial_compose97i
(
IDWTELEM
*
buffer
,
int
width
,
static
void
av_unused
spatial_compose97i
(
IDWTELEM
*
buffer
,
IDWTELEM
*
temp
,
int
height
,
int
stride
)
int
width
,
int
height
,
int
stride
)
{
{
DWTCompose
cs
;
DWTCompose
cs
;
spatial_compose97i_init
(
&
cs
,
buffer
,
height
,
stride
);
spatial_compose97i_init
(
&
cs
,
buffer
,
height
,
stride
);
while
(
cs
.
y
<=
height
)
while
(
cs
.
y
<=
height
)
spatial_compose97i_dy
(
&
cs
,
buffer
,
width
,
height
,
stride
);
spatial_compose97i_dy
(
&
cs
,
buffer
,
temp
,
width
,
height
,
stride
);
}
}
void
ff_spatial_idwt_buffered_init
(
DWTCompose
*
cs
,
slice_buffer
*
sb
,
int
width
,
void
ff_spatial_idwt_buffered_init
(
DWTCompose
*
cs
,
slice_buffer
*
sb
,
int
width
,
...
@@ -795,9 +795,9 @@ void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
...
@@ -795,9 +795,9 @@ void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
}
}
void
ff_spatial_idwt_buffered_slice
(
DWTContext
*
dsp
,
DWTCompose
*
cs
,
void
ff_spatial_idwt_buffered_slice
(
DWTContext
*
dsp
,
DWTCompose
*
cs
,
slice_buffer
*
slice_buf
,
int
width
,
slice_buffer
*
slice_buf
,
IDWTELEM
*
temp
,
int
height
,
int
stride_line
,
int
typ
e
,
int
width
,
int
height
,
int
stride_lin
e
,
int
decomposition_count
,
int
y
)
int
type
,
int
decomposition_count
,
int
y
)
{
{
const
int
support
=
type
==
1
?
3
:
5
;
const
int
support
=
type
==
1
?
3
:
5
;
int
level
;
int
level
;
...
@@ -808,13 +808,13 @@ void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
...
@@ -808,13 +808,13 @@ void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
while
(
cs
[
level
].
y
<=
FFMIN
((
y
>>
level
)
+
support
,
height
>>
level
))
{
while
(
cs
[
level
].
y
<=
FFMIN
((
y
>>
level
)
+
support
,
height
>>
level
))
{
switch
(
type
)
{
switch
(
type
)
{
case
DWT_97
:
case
DWT_97
:
spatial_compose97i_dy_buffered
(
dsp
,
cs
+
level
,
slice_buf
,
spatial_compose97i_dy_buffered
(
dsp
,
cs
+
level
,
slice_buf
,
temp
,
width
>>
level
,
width
>>
level
,
height
>>
level
,
height
>>
level
,
stride_line
<<
level
);
stride_line
<<
level
);
break
;
break
;
case
DWT_53
:
case
DWT_53
:
spatial_compose53i_dy_buffered
(
cs
+
level
,
slice_buf
,
spatial_compose53i_dy_buffered
(
cs
+
level
,
slice_buf
,
temp
,
width
>>
level
,
width
>>
level
,
height
>>
level
,
height
>>
level
,
stride_line
<<
level
);
stride_line
<<
level
);
...
@@ -842,8 +842,9 @@ static void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width,
...
@@ -842,8 +842,9 @@ static void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width,
}
}
}
}
static
void
ff_spatial_idwt_slice
(
DWTCompose
*
cs
,
IDWTELEM
*
buffer
,
int
width
,
static
void
ff_spatial_idwt_slice
(
DWTCompose
*
cs
,
IDWTELEM
*
buffer
,
int
height
,
int
stride
,
int
type
,
IDWTELEM
*
temp
,
int
width
,
int
height
,
int
stride
,
int
type
,
int
decomposition_count
,
int
y
)
int
decomposition_count
,
int
y
)
{
{
const
int
support
=
type
==
1
?
3
:
5
;
const
int
support
=
type
==
1
?
3
:
5
;
...
@@ -855,26 +856,26 @@ static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width,
...
@@ -855,26 +856,26 @@ static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width,
while
(
cs
[
level
].
y
<=
FFMIN
((
y
>>
level
)
+
support
,
height
>>
level
))
{
while
(
cs
[
level
].
y
<=
FFMIN
((
y
>>
level
)
+
support
,
height
>>
level
))
{
switch
(
type
)
{
switch
(
type
)
{
case
DWT_97
:
case
DWT_97
:
spatial_compose97i_dy
(
cs
+
level
,
buffer
,
width
>>
level
,
spatial_compose97i_dy
(
cs
+
level
,
buffer
,
temp
,
width
>>
level
,
height
>>
level
,
stride
<<
level
);
height
>>
level
,
stride
<<
level
);
break
;
break
;
case
DWT_53
:
case
DWT_53
:
spatial_compose53i_dy
(
cs
+
level
,
buffer
,
width
>>
level
,
spatial_compose53i_dy
(
cs
+
level
,
buffer
,
temp
,
width
>>
level
,
height
>>
level
,
stride
<<
level
);
height
>>
level
,
stride
<<
level
);
break
;
break
;
}
}
}
}
}
}
void
ff_spatial_idwt
(
IDWTELEM
*
buffer
,
int
width
,
int
height
,
int
stride
,
void
ff_spatial_idwt
(
IDWTELEM
*
buffer
,
IDWTELEM
*
temp
,
int
width
,
int
height
,
int
type
,
int
decomposition_count
)
int
stride
,
int
type
,
int
decomposition_count
)
{
{
DWTCompose
cs
[
MAX_DECOMPOSITIONS
];
DWTCompose
cs
[
MAX_DECOMPOSITIONS
];
int
y
;
int
y
;
ff_spatial_idwt_init
(
cs
,
buffer
,
width
,
height
,
stride
,
type
,
ff_spatial_idwt_init
(
cs
,
buffer
,
width
,
height
,
stride
,
type
,
decomposition_count
);
decomposition_count
);
for
(
y
=
0
;
y
<
height
;
y
+=
4
)
for
(
y
=
0
;
y
<
height
;
y
+=
4
)
ff_spatial_idwt_slice
(
cs
,
buffer
,
width
,
height
,
stride
,
type
,
ff_spatial_idwt_slice
(
cs
,
buffer
,
temp
,
width
,
height
,
stride
,
type
,
decomposition_count
,
y
);
decomposition_count
,
y
);
}
}
...
@@ -883,7 +884,7 @@ static inline int w_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
...
@@ -883,7 +884,7 @@ static inline int w_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
{
{
int
s
,
i
,
j
;
int
s
,
i
,
j
;
const
int
dec_count
=
w
==
8
?
3
:
4
;
const
int
dec_count
=
w
==
8
?
3
:
4
;
int
tmp
[
32
*
32
];
int
tmp
[
32
*
32
]
,
tmp2
[
32
]
;
int
level
,
ori
;
int
level
,
ori
;
static
const
int
scale
[
2
][
2
][
4
][
4
]
=
{
static
const
int
scale
[
2
][
2
][
4
][
4
]
=
{
{
{
...
@@ -925,7 +926,7 @@ static inline int w_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
...
@@ -925,7 +926,7 @@ static inline int w_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
pix2
+=
line_size
;
pix2
+=
line_size
;
}
}
ff_spatial_dwt
(
tmp
,
w
,
h
,
32
,
type
,
dec_count
);
ff_spatial_dwt
(
tmp
,
tmp2
,
w
,
h
,
32
,
type
,
dec_count
);
s
=
0
;
s
=
0
;
assert
(
w
==
h
);
assert
(
w
==
h
);
...
...
libavcodec/dwt.h
View file @
d9669eab
...
@@ -50,7 +50,7 @@ typedef struct DWTContext {
...
@@ -50,7 +50,7 @@ typedef struct DWTContext {
void
(
*
vertical_compose97i
)(
IDWTELEM
*
b0
,
IDWTELEM
*
b1
,
IDWTELEM
*
b2
,
void
(
*
vertical_compose97i
)(
IDWTELEM
*
b0
,
IDWTELEM
*
b1
,
IDWTELEM
*
b2
,
IDWTELEM
*
b3
,
IDWTELEM
*
b4
,
IDWTELEM
*
b5
,
IDWTELEM
*
b3
,
IDWTELEM
*
b4
,
IDWTELEM
*
b5
,
int
width
);
int
width
);
void
(
*
horizontal_compose97i
)(
IDWTELEM
*
b
,
int
width
);
void
(
*
horizontal_compose97i
)(
IDWTELEM
*
b
,
IDWTELEM
*
temp
,
int
width
);
void
(
*
inner_add_yblock
)(
const
uint8_t
*
obmc
,
const
int
obmc_stride
,
void
(
*
inner_add_yblock
)(
const
uint8_t
*
obmc
,
const
int
obmc_stride
,
uint8_t
**
block
,
int
b_w
,
int
b_h
,
int
src_x
,
uint8_t
**
block
,
int
b_w
,
int
b_h
,
int
src_x
,
int
src_y
,
int
src_stride
,
slice_buffer
*
sb
,
int
src_y
,
int
src_stride
,
slice_buffer
*
sb
,
...
@@ -148,7 +148,7 @@ IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line);
...
@@ -148,7 +148,7 @@ IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line);
void
ff_snow_vertical_compose97i
(
IDWTELEM
*
b0
,
IDWTELEM
*
b1
,
IDWTELEM
*
b2
,
void
ff_snow_vertical_compose97i
(
IDWTELEM
*
b0
,
IDWTELEM
*
b1
,
IDWTELEM
*
b2
,
IDWTELEM
*
b3
,
IDWTELEM
*
b4
,
IDWTELEM
*
b5
,
IDWTELEM
*
b3
,
IDWTELEM
*
b4
,
IDWTELEM
*
b5
,
int
width
);
int
width
);
void
ff_snow_horizontal_compose97i
(
IDWTELEM
*
b
,
int
width
);
void
ff_snow_horizontal_compose97i
(
IDWTELEM
*
b
,
IDWTELEM
*
temp
,
int
width
);
void
ff_snow_inner_add_yblock
(
const
uint8_t
*
obmc
,
const
int
obmc_stride
,
void
ff_snow_inner_add_yblock
(
const
uint8_t
*
obmc
,
const
int
obmc_stride
,
uint8_t
**
block
,
int
b_w
,
int
b_h
,
int
src_x
,
uint8_t
**
block
,
int
b_w
,
int
b_h
,
int
src_x
,
int
src_y
,
int
src_stride
,
slice_buffer
*
sb
,
int
src_y
,
int
src_stride
,
slice_buffer
*
sb
,
...
@@ -157,18 +157,18 @@ void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
...
@@ -157,18 +157,18 @@ void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
int
ff_w53_32_c
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
);
int
ff_w53_32_c
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
);
int
ff_w97_32_c
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
);
int
ff_w97_32_c
(
void
*
v
,
uint8_t
*
pix1
,
uint8_t
*
pix2
,
int
line_size
,
int
h
);
void
ff_spatial_dwt
(
int
*
buffer
,
int
width
,
int
height
,
int
stride
,
int
typ
e
,
void
ff_spatial_dwt
(
int
*
buffer
,
int
*
temp
,
int
width
,
int
height
,
int
strid
e
,
int
decomposition_count
);
int
type
,
int
decomposition_count
);
void
ff_spatial_idwt_buffered_init
(
DWTCompose
*
cs
,
slice_buffer
*
sb
,
int
width
,
void
ff_spatial_idwt_buffered_init
(
DWTCompose
*
cs
,
slice_buffer
*
sb
,
int
width
,
int
height
,
int
stride_line
,
int
type
,
int
height
,
int
stride_line
,
int
type
,
int
decomposition_count
);
int
decomposition_count
);
void
ff_spatial_idwt_buffered_slice
(
DWTContext
*
dsp
,
DWTCompose
*
cs
,
void
ff_spatial_idwt_buffered_slice
(
DWTContext
*
dsp
,
DWTCompose
*
cs
,
slice_buffer
*
slice_buf
,
int
width
,
slice_buffer
*
slice_buf
,
IDWTELEM
*
temp
,
int
height
,
int
stride_line
,
int
typ
e
,
int
width
,
int
height
,
int
stride_lin
e
,
int
decomposition_count
,
int
y
);
int
type
,
int
decomposition_count
,
int
y
);
void
ff_spatial_idwt
(
IDWTELEM
*
buffer
,
int
width
,
int
height
,
int
stride
,
void
ff_spatial_idwt
(
IDWTELEM
*
buffer
,
IDWTELEM
*
temp
,
int
width
,
int
height
,
int
type
,
int
decomposition_count
);
int
stride
,
int
type
,
int
decomposition_count
);
void
ff_dwt_init
(
DWTContext
*
c
);
void
ff_dwt_init
(
DWTContext
*
c
);
void
ff_dwt_init_x86
(
DWTContext
*
c
);
void
ff_dwt_init_x86
(
DWTContext
*
c
);
...
...
libavcodec/snow.c
View file @
d9669eab
...
@@ -440,6 +440,8 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
...
@@ -440,6 +440,8 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
s
->
spatial_idwt_buffer
=
av_mallocz
(
width
*
height
*
sizeof
(
IDWTELEM
));
s
->
spatial_idwt_buffer
=
av_mallocz
(
width
*
height
*
sizeof
(
IDWTELEM
));
s
->
spatial_dwt_buffer
=
av_mallocz
(
width
*
height
*
sizeof
(
DWTELEM
));
//FIXME this does not belong here
s
->
spatial_dwt_buffer
=
av_mallocz
(
width
*
height
*
sizeof
(
DWTELEM
));
//FIXME this does not belong here
s
->
temp_dwt_buffer
=
av_mallocz
(
width
*
sizeof
(
DWTELEM
));
s
->
temp_idwt_buffer
=
av_mallocz
(
width
*
sizeof
(
IDWTELEM
));
for
(
i
=
0
;
i
<
MAX_REF_FRAMES
;
i
++
)
for
(
i
=
0
;
i
<
MAX_REF_FRAMES
;
i
++
)
for
(
j
=
0
;
j
<
MAX_REF_FRAMES
;
j
++
)
for
(
j
=
0
;
j
<
MAX_REF_FRAMES
;
j
++
)
...
@@ -618,7 +620,9 @@ av_cold void ff_snow_common_end(SnowContext *s)
...
@@ -618,7 +620,9 @@ av_cold void ff_snow_common_end(SnowContext *s)
int
plane_index
,
level
,
orientation
,
i
;
int
plane_index
,
level
,
orientation
,
i
;
av_freep
(
&
s
->
spatial_dwt_buffer
);
av_freep
(
&
s
->
spatial_dwt_buffer
);
av_freep
(
&
s
->
temp_dwt_buffer
);
av_freep
(
&
s
->
spatial_idwt_buffer
);
av_freep
(
&
s
->
spatial_idwt_buffer
);
av_freep
(
&
s
->
temp_idwt_buffer
);
s
->
m
.
me
.
temp
=
NULL
;
s
->
m
.
me
.
temp
=
NULL
;
av_freep
(
&
s
->
m
.
me
.
scratchpad
);
av_freep
(
&
s
->
m
.
me
.
scratchpad
);
...
...
libavcodec/snow.h
View file @
d9669eab
...
@@ -132,7 +132,9 @@ typedef struct SnowContext{
...
@@ -132,7 +132,9 @@ typedef struct SnowContext{
int16_t
(
*
ref_mvs
[
MAX_REF_FRAMES
])[
2
];
int16_t
(
*
ref_mvs
[
MAX_REF_FRAMES
])[
2
];
uint32_t
*
ref_scores
[
MAX_REF_FRAMES
];
uint32_t
*
ref_scores
[
MAX_REF_FRAMES
];
DWTELEM
*
spatial_dwt_buffer
;
DWTELEM
*
spatial_dwt_buffer
;
DWTELEM
*
temp_dwt_buffer
;
IDWTELEM
*
spatial_idwt_buffer
;
IDWTELEM
*
spatial_idwt_buffer
;
IDWTELEM
*
temp_idwt_buffer
;
int
colorspace_type
;
int
colorspace_type
;
int
chroma_h_shift
;
int
chroma_h_shift
;
int
chroma_v_shift
;
int
chroma_v_shift
;
...
...
libavcodec/snowdec.c
View file @
d9669eab
...
@@ -502,7 +502,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
...
@@ -502,7 +502,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
}
for
(;
yd
<
slice_h
;
yd
+=
4
){
for
(;
yd
<
slice_h
;
yd
+=
4
){
ff_spatial_idwt_buffered_slice
(
&
s
->
dwt
,
cs
,
&
s
->
sb
,
w
,
h
,
1
,
s
->
spatial_decomposition_type
,
s
->
spatial_decomposition_count
,
yd
);
ff_spatial_idwt_buffered_slice
(
&
s
->
dwt
,
cs
,
&
s
->
sb
,
s
->
temp_idwt_buffer
,
w
,
h
,
1
,
s
->
spatial_decomposition_type
,
s
->
spatial_decomposition_count
,
yd
);
}
}
if
(
s
->
qlog
==
LOSSLESS_QLOG
){
if
(
s
->
qlog
==
LOSSLESS_QLOG
){
...
...
libavcodec/snowenc.c
View file @
d9669eab
...
@@ -93,7 +93,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
...
@@ -93,7 +93,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
//FIXME pass the copy cleanly ?
//FIXME pass the copy cleanly ?
// memcpy(dwt_buffer, buffer, height * stride * sizeof(DWTELEM));
// memcpy(dwt_buffer, buffer, height * stride * sizeof(DWTELEM));
ff_spatial_dwt
(
buffer
,
width
,
height
,
stride
,
type
,
s
->
spatial_decomposition_count
);
ff_spatial_dwt
(
buffer
,
s
->
temp_dwt_buffer
,
width
,
height
,
stride
,
type
,
s
->
spatial_decomposition_count
);
for
(
level
=
0
;
level
<
s
->
spatial_decomposition_count
;
level
++
){
for
(
level
=
0
;
level
<
s
->
spatial_decomposition_count
;
level
++
){
for
(
orientation
=
level
?
1
:
0
;
orientation
<
4
;
orientation
++
){
for
(
orientation
=
level
?
1
:
0
;
orientation
<
4
;
orientation
++
){
...
@@ -118,7 +118,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
...
@@ -118,7 +118,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
for
(
xs
=
0
;
xs
<
Q2_STEP
;
xs
++
){
for
(
xs
=
0
;
xs
<
Q2_STEP
;
xs
++
){
memcpy
(
idwt2_buffer
,
best_dequant
,
height
*
stride
*
sizeof
(
IDWTELEM
));
memcpy
(
idwt2_buffer
,
best_dequant
,
height
*
stride
*
sizeof
(
IDWTELEM
));
dequantize_all
(
s
,
p
,
idwt2_buffer
,
width
,
height
);
dequantize_all
(
s
,
p
,
idwt2_buffer
,
width
,
height
);
ff_spatial_idwt
(
idwt2_buffer
,
width
,
height
,
stride
,
type
,
s
->
spatial_decomposition_count
);
ff_spatial_idwt
(
idwt2_buffer
,
s
->
temp_idwt_buffer
,
width
,
height
,
stride
,
type
,
s
->
spatial_decomposition_count
);
find_sse
(
s
,
p
,
best_score
,
score_stride
,
idwt2_buffer
,
s
->
spatial_idwt_buffer
,
level
,
orientation
);
find_sse
(
s
,
p
,
best_score
,
score_stride
,
idwt2_buffer
,
s
->
spatial_idwt_buffer
,
level
,
orientation
);
memcpy
(
idwt2_buffer
,
best_dequant
,
height
*
stride
*
sizeof
(
IDWTELEM
));
memcpy
(
idwt2_buffer
,
best_dequant
,
height
*
stride
*
sizeof
(
IDWTELEM
));
for
(
y
=
ys
;
y
<
b
->
height
;
y
+=
Q2_STEP
){
for
(
y
=
ys
;
y
<
b
->
height
;
y
+=
Q2_STEP
){
...
@@ -129,7 +129,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
...
@@ -129,7 +129,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
}
}
}
}
dequantize_all
(
s
,
p
,
idwt2_buffer
,
width
,
height
);
dequantize_all
(
s
,
p
,
idwt2_buffer
,
width
,
height
);
ff_spatial_idwt
(
idwt2_buffer
,
width
,
height
,
stride
,
type
,
s
->
spatial_decomposition_count
);
ff_spatial_idwt
(
idwt2_buffer
,
s
->
temp_idwt_buffer
,
width
,
height
,
stride
,
type
,
s
->
spatial_decomposition_count
);
find_sse
(
s
,
p
,
score
,
score_stride
,
idwt2_buffer
,
s
->
spatial_idwt_buffer
,
level
,
orientation
);
find_sse
(
s
,
p
,
score
,
score_stride
,
idwt2_buffer
,
s
->
spatial_idwt_buffer
,
level
,
orientation
);
for
(
y
=
ys
;
y
<
b
->
height
;
y
+=
Q2_STEP
){
for
(
y
=
ys
;
y
<
b
->
height
;
y
+=
Q2_STEP
){
for
(
x
=
xs
;
x
<
b
->
width
;
x
+=
Q2_STEP
){
for
(
x
=
xs
;
x
<
b
->
width
;
x
+=
Q2_STEP
){
...
@@ -1586,7 +1586,7 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
...
@@ -1586,7 +1586,7 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
memset
(
s
->
spatial_idwt_buffer
,
0
,
sizeof
(
*
s
->
spatial_idwt_buffer
)
*
width
*
height
);
memset
(
s
->
spatial_idwt_buffer
,
0
,
sizeof
(
*
s
->
spatial_idwt_buffer
)
*
width
*
height
);
ibuf
[
b
->
width
/
2
+
b
->
height
/
2
*
b
->
stride
]
=
256
*
16
;
ibuf
[
b
->
width
/
2
+
b
->
height
/
2
*
b
->
stride
]
=
256
*
16
;
ff_spatial_idwt
(
s
->
spatial_idwt_buffer
,
width
,
height
,
width
,
s
->
spatial_decomposition_type
,
s
->
spatial_decomposition_count
);
ff_spatial_idwt
(
s
->
spatial_idwt_buffer
,
s
->
temp_idwt_buffer
,
width
,
height
,
width
,
s
->
spatial_decomposition_type
,
s
->
spatial_decomposition_count
);
for
(
y
=
0
;
y
<
height
;
y
++
){
for
(
y
=
0
;
y
<
height
;
y
++
){
for
(
x
=
0
;
x
<
width
;
x
++
){
for
(
x
=
0
;
x
<
width
;
x
++
){
int64_t
d
=
s
->
spatial_idwt_buffer
[
x
+
y
*
width
]
*
16
;
int64_t
d
=
s
->
spatial_idwt_buffer
[
x
+
y
*
width
]
*
16
;
...
@@ -1775,7 +1775,7 @@ redo_frame:
...
@@ -1775,7 +1775,7 @@ redo_frame:
/* if(QUANTIZE2)
/* if(QUANTIZE2)
dwt_quantize(s, p, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type);
dwt_quantize(s, p, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type);
else*/
else*/
ff_spatial_dwt
(
s
->
spatial_dwt_buffer
,
w
,
h
,
w
,
s
->
spatial_decomposition_type
,
s
->
spatial_decomposition_count
);
ff_spatial_dwt
(
s
->
spatial_dwt_buffer
,
s
->
temp_dwt_buffer
,
w
,
h
,
w
,
s
->
spatial_decomposition_type
,
s
->
spatial_decomposition_count
);
if
(
s
->
pass1_rc
&&
plane_index
==
0
){
if
(
s
->
pass1_rc
&&
plane_index
==
0
){
int
delta_qlog
=
ratecontrol_1pass
(
s
,
pic
);
int
delta_qlog
=
ratecontrol_1pass
(
s
,
pic
);
...
@@ -1814,7 +1814,7 @@ redo_frame:
...
@@ -1814,7 +1814,7 @@ redo_frame:
}
}
}
}
ff_spatial_idwt
(
s
->
spatial_idwt_buffer
,
w
,
h
,
w
,
s
->
spatial_decomposition_type
,
s
->
spatial_decomposition_count
);
ff_spatial_idwt
(
s
->
spatial_idwt_buffer
,
s
->
temp_idwt_buffer
,
w
,
h
,
w
,
s
->
spatial_decomposition_type
,
s
->
spatial_decomposition_count
);
if
(
s
->
qlog
==
LOSSLESS_QLOG
){
if
(
s
->
qlog
==
LOSSLESS_QLOG
){
for
(
y
=
0
;
y
<
h
;
y
++
){
for
(
y
=
0
;
y
<
h
;
y
++
){
for
(
x
=
0
;
x
<
w
;
x
++
){
for
(
x
=
0
;
x
<
w
;
x
++
){
...
...
libavcodec/x86/snowdsp_mmx.c
View file @
d9669eab
...
@@ -26,9 +26,8 @@
...
@@ -26,9 +26,8 @@
#include "libavcodec/dwt.h"
#include "libavcodec/dwt.h"
#include "dsputil_mmx.h"
#include "dsputil_mmx.h"
static
void
ff_snow_horizontal_compose97i_sse2
(
IDWTELEM
*
b
,
int
width
){
static
void
ff_snow_horizontal_compose97i_sse2
(
IDWTELEM
*
b
,
IDWTELEM
*
temp
,
int
width
){
const
int
w2
=
(
width
+
1
)
>>
1
;
const
int
w2
=
(
width
+
1
)
>>
1
;
DECLARE_ALIGNED
(
16
,
IDWTELEM
,
temp
)[
width
>>
1
];
const
int
w_l
=
(
width
>>
1
);
const
int
w_l
=
(
width
>>
1
);
const
int
w_r
=
w2
-
1
;
const
int
w_r
=
w2
-
1
;
int
i
;
int
i
;
...
@@ -215,9 +214,8 @@ static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
...
@@ -215,9 +214,8 @@ static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
}
}
}
}
static
void
ff_snow_horizontal_compose97i_mmx
(
IDWTELEM
*
b
,
int
width
){
static
void
ff_snow_horizontal_compose97i_mmx
(
IDWTELEM
*
b
,
IDWTELEM
*
temp
,
int
width
){
const
int
w2
=
(
width
+
1
)
>>
1
;
const
int
w2
=
(
width
+
1
)
>>
1
;
IDWTELEM
temp
[
width
>>
1
];
const
int
w_l
=
(
width
>>
1
);
const
int
w_l
=
(
width
>>
1
);
const
int
w_r
=
w2
-
1
;
const
int
w_r
=
w2
-
1
;
int
i
;
int
i
;
...
...
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