Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
0da6315a
Commit
0da6315a
authored
20 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
fewer overflows
Originally committed as revision 3222 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
3f1899a8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/motion_est_template.c
+8
-5
8 additions, 5 deletions
libavcodec/motion_est_template.c
with
8 additions
and
5 deletions
libavcodec/motion_est_template.c
+
8
−
5
View file @
0da6315a
...
...
@@ -323,15 +323,16 @@ static int qpel_motion_search(MpegEncContext * s,
for
(
ny
=
-
3
;
ny
<=
3
;
ny
++
){
for
(
nx
=
-
3
;
nx
<=
3
;
nx
++
){
const
int
t2
=
nx
*
nx
*
(
tr
+
tl
-
2
*
t
)
+
4
*
nx
*
(
tr
-
tl
)
+
32
*
t
;
const
int
c2
=
nx
*
nx
*
(
r
+
l
-
2
*
c
)
+
4
*
nx
*
(
r
-
l
)
+
32
*
c
;
const
int
b2
=
nx
*
nx
*
(
br
+
bl
-
2
*
b
)
+
4
*
nx
*
(
br
-
bl
)
+
32
*
b
;
int
score
=
ny
*
ny
*
(
b2
+
t2
-
2
*
c2
)
+
4
*
ny
*
(
b2
-
t2
)
+
32
*
c2
;
//FIXME this could overflow (unlikely though)
const
int64_t
t2
=
nx
*
nx
*
(
tr
+
tl
-
2
*
t
)
+
4
*
nx
*
(
tr
-
tl
)
+
32
*
t
;
const
int64_t
c2
=
nx
*
nx
*
(
r
+
l
-
2
*
c
)
+
4
*
nx
*
(
r
-
l
)
+
32
*
c
;
const
int64_t
b2
=
nx
*
nx
*
(
br
+
bl
-
2
*
b
)
+
4
*
nx
*
(
br
-
bl
)
+
32
*
b
;
int
score
=
(
ny
*
ny
*
(
b2
+
t2
-
2
*
c2
)
+
4
*
ny
*
(
b2
-
t2
)
+
32
*
c2
+
512
)
>>
10
;
int
i
;
if
((
nx
&
3
)
==
0
&&
(
ny
&
3
)
==
0
)
continue
;
score
+=
1024
*
(
mv_penalty
[
4
*
mx
+
nx
-
pred_x
]
+
mv_penalty
[
4
*
my
+
ny
-
pred_y
])
*
penalty_factor
;
score
+=
(
mv_penalty
[
4
*
mx
+
nx
-
pred_x
]
+
mv_penalty
[
4
*
my
+
ny
-
pred_y
])
*
penalty_factor
;
// if(nx&1) score-=1024*c->penalty_factor;
// if(ny&1) score-=1024*c->penalty_factor;
...
...
@@ -350,6 +351,7 @@ static int qpel_motion_search(MpegEncContext * s,
}
}
else
{
int
tl
;
//FIXME this could overflow (unlikely though)
const
int
cx
=
4
*
(
r
-
l
);
const
int
cx2
=
r
+
l
-
2
*
c
;
const
int
cy
=
4
*
(
b
-
t
);
...
...
@@ -372,6 +374,7 @@ static int qpel_motion_search(MpegEncContext * s,
for
(
ny
=
-
3
;
ny
<=
3
;
ny
++
){
for
(
nx
=
-
3
;
nx
<=
3
;
nx
++
){
//FIXME this could overflow (unlikely though)
int
score
=
ny
*
nx
*
cxy
+
nx
*
nx
*
cx2
+
ny
*
ny
*
cy2
+
nx
*
cx
+
ny
*
cy
+
32
*
c
;
//FIXME factor
int
i
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment