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
13705b69
Commit
13705b69
authored
Dec 30, 2005
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mem corruption fix
Originally committed as revision 4789 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
f0efbde7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
35 deletions
+37
-35
snow.c
libavcodec/snow.c
+37
-35
No files found.
libavcodec/snow.c
View file @
13705b69
...
@@ -589,9 +589,11 @@ static void slice_buffer_destroy(slice_buffer * buf)
...
@@ -589,9 +589,11 @@ static void slice_buffer_destroy(slice_buffer * buf)
static
uint8_t
qexp
[
QROOT
];
static
uint8_t
qexp
[
QROOT
];
static
inline
int
mirror
(
int
v
,
int
m
){
static
inline
int
mirror
(
int
v
,
int
m
){
if
(
v
<
0
)
return
-
v
;
while
((
unsigned
)
v
>
(
unsigned
)
m
){
else
if
(
v
>
m
)
return
2
*
m
-
v
;
v
=-
v
;
else
return
v
;
if
(
v
<
0
)
v
+=
2
*
m
;
}
return
v
;
}
}
static
inline
void
put_symbol
(
RangeCoder
*
c
,
uint8_t
*
state
,
int
v
,
int
is_signed
){
static
inline
void
put_symbol
(
RangeCoder
*
c
,
uint8_t
*
state
,
int
v
,
int
is_signed
){
...
@@ -1095,13 +1097,13 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height, int str
...
@@ -1095,13 +1097,13 @@ static void spatial_decompose53i(DWTELEM *buffer, int width, int height, int str
DWTELEM
*
b3
=
buffer
+
mirror
(
y
+
2
,
height
-
1
)
*
stride
;
DWTELEM
*
b3
=
buffer
+
mirror
(
y
+
2
,
height
-
1
)
*
stride
;
{
START_TIMER
{
START_TIMER
if
(
b1
<=
b3
)
horizontal_decompose53i
(
b2
,
width
);
if
(
y
+
1
<
(
unsigned
)
height
)
horizontal_decompose53i
(
b2
,
width
);
if
(
y
+
2
<
height
)
horizontal_decompose53i
(
b3
,
width
);
if
(
y
+
2
<
(
unsigned
)
height
)
horizontal_decompose53i
(
b3
,
width
);
STOP_TIMER
(
"horizontal_decompose53i"
)}
STOP_TIMER
(
"horizontal_decompose53i"
)}
{
START_TIMER
{
START_TIMER
if
(
b1
<=
b3
)
vertical_decompose53iH0
(
b1
,
b2
,
b3
,
width
);
if
(
y
+
1
<
(
unsigned
)
height
)
vertical_decompose53iH0
(
b1
,
b2
,
b3
,
width
);
if
(
b0
<=
b2
)
vertical_decompose53iL0
(
b0
,
b1
,
b2
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
vertical_decompose53iL0
(
b0
,
b1
,
b2
,
width
);
STOP_TIMER
(
"vertical_decompose53i*"
)}
STOP_TIMER
(
"vertical_decompose53i*"
)}
b0
=
b2
;
b0
=
b2
;
...
@@ -1245,17 +1247,17 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height, int str
...
@@ -1245,17 +1247,17 @@ static void spatial_decompose97i(DWTELEM *buffer, int width, int height, int str
DWTELEM
*
b5
=
buffer
+
mirror
(
y
+
4
,
height
-
1
)
*
stride
;
DWTELEM
*
b5
=
buffer
+
mirror
(
y
+
4
,
height
-
1
)
*
stride
;
{
START_TIMER
{
START_TIMER
if
(
b3
<=
b5
)
horizontal_decompose97i
(
b4
,
width
);
if
(
y
+
3
<
(
unsigned
)
height
)
horizontal_decompose97i
(
b4
,
width
);
if
(
y
+
4
<
height
)
horizontal_decompose97i
(
b5
,
width
);
if
(
y
+
4
<
(
unsigned
)
height
)
horizontal_decompose97i
(
b5
,
width
);
if
(
width
>
400
){
if
(
width
>
400
){
STOP_TIMER
(
"horizontal_decompose97i"
)
STOP_TIMER
(
"horizontal_decompose97i"
)
}}
}}
{
START_TIMER
{
START_TIMER
if
(
b3
<=
b5
)
vertical_decompose97iH0
(
b3
,
b4
,
b5
,
width
);
if
(
y
+
3
<
(
unsigned
)
height
)
vertical_decompose97iH0
(
b3
,
b4
,
b5
,
width
);
if
(
b2
<=
b4
)
vertical_decompose97iL0
(
b2
,
b3
,
b4
,
width
);
if
(
y
+
2
<
(
unsigned
)
height
)
vertical_decompose97iL0
(
b2
,
b3
,
b4
,
width
);
if
(
b1
<=
b3
)
vertical_decompose97iH1
(
b1
,
b2
,
b3
,
width
);
if
(
y
+
1
<
(
unsigned
)
height
)
vertical_decompose97iH1
(
b1
,
b2
,
b3
,
width
);
if
(
b0
<=
b2
)
vertical_decompose97iL1
(
b0
,
b1
,
b2
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
vertical_decompose97iL1
(
b0
,
b1
,
b2
,
width
);
if
(
width
>
400
){
if
(
width
>
400
){
STOP_TIMER
(
"vertical_decompose97i"
)
STOP_TIMER
(
"vertical_decompose97i"
)
...
@@ -1368,13 +1370,13 @@ static void spatial_compose53i_dy_buffered(dwt_compose_t *cs, slice_buffer * sb,
...
@@ -1368,13 +1370,13 @@ static void spatial_compose53i_dy_buffered(dwt_compose_t *cs, slice_buffer * sb,
DWTELEM
*
b3
=
slice_buffer_get_line
(
sb
,
mirror3
*
stride_line
);
DWTELEM
*
b3
=
slice_buffer_get_line
(
sb
,
mirror3
*
stride_line
);
{
START_TIMER
{
START_TIMER
if
(
mirror1
<=
mirror3
)
vertical_compose53iL0
(
b1
,
b2
,
b3
,
width
);
if
(
y
+
1
<
(
unsigned
)
height
)
vertical_compose53iL0
(
b1
,
b2
,
b3
,
width
);
if
(
mirror0
<=
mirror2
)
vertical_compose53iH0
(
b0
,
b1
,
b2
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
vertical_compose53iH0
(
b0
,
b1
,
b2
,
width
);
STOP_TIMER
(
"vertical_compose53i*"
)}
STOP_TIMER
(
"vertical_compose53i*"
)}
{
START_TIMER
{
START_TIMER
if
(
y
-
1
>=
0
)
horizontal_compose53i
(
b0
,
width
);
if
(
y
-
1
<
(
unsigned
)
height
)
horizontal_compose53i
(
b0
,
width
);
if
(
mirror0
<=
mirror2
)
horizontal_compose53i
(
b1
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
horizontal_compose53i
(
b1
,
width
);
STOP_TIMER
(
"horizontal_compose53i"
)}
STOP_TIMER
(
"horizontal_compose53i"
)}
cs
->
b0
=
b2
;
cs
->
b0
=
b2
;
...
@@ -1390,13 +1392,13 @@ static void spatial_compose53i_dy(dwt_compose_t *cs, DWTELEM *buffer, int width,
...
@@ -1390,13 +1392,13 @@ static void spatial_compose53i_dy(dwt_compose_t *cs, DWTELEM *buffer, int width,
DWTELEM
*
b3
=
buffer
+
mirror
(
y
+
2
,
height
-
1
)
*
stride
;
DWTELEM
*
b3
=
buffer
+
mirror
(
y
+
2
,
height
-
1
)
*
stride
;
{
START_TIMER
{
START_TIMER
if
(
b1
<=
b3
)
vertical_compose53iL0
(
b1
,
b2
,
b3
,
width
);
if
(
y
+
1
<
(
unsigned
)
height
)
vertical_compose53iL0
(
b1
,
b2
,
b3
,
width
);
if
(
b0
<=
b2
)
vertical_compose53iH0
(
b0
,
b1
,
b2
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
vertical_compose53iH0
(
b0
,
b1
,
b2
,
width
);
STOP_TIMER
(
"vertical_compose53i*"
)}
STOP_TIMER
(
"vertical_compose53i*"
)}
{
START_TIMER
{
START_TIMER
if
(
y
-
1
>=
0
)
horizontal_compose53i
(
b0
,
width
);
if
(
y
-
1
<
(
unsigned
)
height
)
horizontal_compose53i
(
b0
,
width
);
if
(
b0
<=
b2
)
horizontal_compose53i
(
b1
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
horizontal_compose53i
(
b1
,
width
);
STOP_TIMER
(
"horizontal_compose53i"
)}
STOP_TIMER
(
"horizontal_compose53i"
)}
cs
->
b0
=
b2
;
cs
->
b0
=
b2
;
...
@@ -1526,17 +1528,17 @@ static void spatial_compose97i_dy_buffered(dwt_compose_t *cs, slice_buffer * sb,
...
@@ -1526,17 +1528,17 @@ static void spatial_compose97i_dy_buffered(dwt_compose_t *cs, slice_buffer * sb,
if
(
y
>
0
&&
y
+
4
<
height
){
if
(
y
>
0
&&
y
+
4
<
height
){
vertical_compose97i
(
b0
,
b1
,
b2
,
b3
,
b4
,
b5
,
width
);
vertical_compose97i
(
b0
,
b1
,
b2
,
b3
,
b4
,
b5
,
width
);
}
else
{
}
else
{
if
(
mirror3
<=
mirror5
)
vertical_compose97iL1
(
b3
,
b4
,
b5
,
width
);
if
(
y
+
3
<
(
unsigned
)
height
)
vertical_compose97iL1
(
b3
,
b4
,
b5
,
width
);
if
(
mirror2
<=
mirror4
)
vertical_compose97iH1
(
b2
,
b3
,
b4
,
width
);
if
(
y
+
2
<
(
unsigned
)
height
)
vertical_compose97iH1
(
b2
,
b3
,
b4
,
width
);
if
(
mirror1
<=
mirror3
)
vertical_compose97iL0
(
b1
,
b2
,
b3
,
width
);
if
(
y
+
1
<
(
unsigned
)
height
)
vertical_compose97iL0
(
b1
,
b2
,
b3
,
width
);
if
(
mirror0
<=
mirror2
)
vertical_compose97iH0
(
b0
,
b1
,
b2
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
vertical_compose97iH0
(
b0
,
b1
,
b2
,
width
);
}
}
if
(
width
>
400
){
if
(
width
>
400
){
STOP_TIMER
(
"vertical_compose97i"
)}}
STOP_TIMER
(
"vertical_compose97i"
)}}
{
START_TIMER
{
START_TIMER
if
(
y
-
1
>=
0
)
horizontal_compose97i
(
b0
,
width
);
if
(
y
-
1
<
(
unsigned
)
height
)
horizontal_compose97i
(
b0
,
width
);
if
(
mirror0
<=
mirror2
)
horizontal_compose97i
(
b1
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
horizontal_compose97i
(
b1
,
width
);
if
(
width
>
400
&&
mirror0
<=
mirror2
){
if
(
width
>
400
&&
mirror0
<=
mirror2
){
STOP_TIMER
(
"horizontal_compose97i"
)}}
STOP_TIMER
(
"horizontal_compose97i"
)}}
...
@@ -1565,16 +1567,16 @@ static void spatial_compose97i_dy(dwt_compose_t *cs, DWTELEM *buffer, int width,
...
@@ -1565,16 +1567,16 @@ static void spatial_compose97i_dy(dwt_compose_t *cs, DWTELEM *buffer, int width,
}
}
{
START_TIMER
{
START_TIMER
if
(
b3
<=
b5
)
vertical_compose97iL1
(
b3
,
b4
,
b5
,
width
);
if
(
y
+
3
<
(
unsigned
)
height
)
vertical_compose97iL1
(
b3
,
b4
,
b5
,
width
);
if
(
b2
<=
b4
)
vertical_compose97iH1
(
b2
,
b3
,
b4
,
width
);
if
(
y
+
2
<
(
unsigned
)
height
)
vertical_compose97iH1
(
b2
,
b3
,
b4
,
width
);
if
(
b1
<=
b3
)
vertical_compose97iL0
(
b1
,
b2
,
b3
,
width
);
if
(
y
+
1
<
(
unsigned
)
height
)
vertical_compose97iL0
(
b1
,
b2
,
b3
,
width
);
if
(
b0
<=
b2
)
vertical_compose97iH0
(
b0
,
b1
,
b2
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
vertical_compose97iH0
(
b0
,
b1
,
b2
,
width
);
if
(
width
>
400
){
if
(
width
>
400
){
STOP_TIMER
(
"vertical_compose97i"
)}}
STOP_TIMER
(
"vertical_compose97i"
)}}
{
START_TIMER
{
START_TIMER
if
(
y
-
1
>=
0
)
horizontal_compose97i
(
b0
,
width
);
if
(
y
-
1
<
(
unsigned
)
height
)
horizontal_compose97i
(
b0
,
width
);
if
(
b0
<=
b2
)
horizontal_compose97i
(
b1
,
width
);
if
(
y
+
0
<
(
unsigned
)
height
)
horizontal_compose97i
(
b1
,
width
);
if
(
width
>
400
&&
b0
<=
b2
){
if
(
width
>
400
&&
b0
<=
b2
){
STOP_TIMER
(
"horizontal_compose97i"
)}}
STOP_TIMER
(
"horizontal_compose97i"
)}}
...
@@ -3199,13 +3201,13 @@ static void iterative_me(SnowContext *s){
...
@@ -3199,13 +3201,13 @@ static void iterative_me(SnowContext *s){
dia_change
|=
check_block
(
s
,
mb_x
,
mb_y
,
(
int
[
2
]){
block
->
mx
+
square
[
i
][
0
],
block
->
my
+
square
[
i
][
1
]},
0
,
&
best_rd
);
dia_change
|=
check_block
(
s
,
mb_x
,
mb_y
,
(
int
[
2
]){
block
->
mx
+
square
[
i
][
0
],
block
->
my
+
square
[
i
][
1
]},
0
,
&
best_rd
);
}
while
(
dia_change
);
}
while
(
dia_change
);
//FIXME or try the standard 2 pass qpel or similar
//FIXME or try the standard 2 pass qpel or similar
#if 1
for
(
i
=
0
;
i
<
3
;
i
++
){
for
(
i
=
0
;
i
<
3
;
i
++
){
color
[
i
]
=
get_dc
(
s
,
mb_x
,
mb_y
,
i
);
color
[
i
]
=
get_dc
(
s
,
mb_x
,
mb_y
,
i
);
}
}
check_block
(
s
,
mb_x
,
mb_y
,
color
,
1
,
&
best_rd
);
check_block
(
s
,
mb_x
,
mb_y
,
color
,
1
,
&
best_rd
);
//FIXME RD style color selection
//FIXME RD style color selection
#endif
if
(
!
same_block
(
block
,
&
backup
)){
if
(
!
same_block
(
block
,
&
backup
)){
if
(
tb
!=
&
null_block
)
tb
->
type
&=
~
BLOCK_OPT
;
if
(
tb
!=
&
null_block
)
tb
->
type
&=
~
BLOCK_OPT
;
if
(
lb
!=
&
null_block
)
lb
->
type
&=
~
BLOCK_OPT
;
if
(
lb
!=
&
null_block
)
lb
->
type
&=
~
BLOCK_OPT
;
...
...
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