Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Main
Synchronet
Commits
c27b2b52
Commit
c27b2b52
authored
2 years ago
by
Deucе
Browse files
Options
Downloads
Patches
Plain Diff
Fix off-by-one error and increase precision
Cleans up artifacts in interpolated values nicely.
parent
2cbfed2d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/conio/scale.c
+10
-10
10 additions, 10 deletions
src/conio/scale.c
with
10 additions
and
10 deletions
src/conio/scale.c
+
10
−
10
View file @
c27b2b52
...
@@ -784,25 +784,25 @@ pointy_scale3(uint32_t* src, uint32_t* dest, int width, int height)
...
@@ -784,25 +784,25 @@ pointy_scale3(uint32_t* src, uint32_t* dest, int width, int height)
}
}
static
uint32_t
static
uint32_t
blend
(
const
uint32_t
c1
,
const
uint32_t
c2
,
int
weight
)
blend
(
const
uint32_t
c1
,
const
uint32_t
c2
,
u
int
16_t
weight
)
{
{
uint8_t
yuv1
[
4
];
uint8_t
yuv1
[
4
];
uint8_t
yuv2
[
4
];
uint8_t
yuv2
[
4
];
uint8_t
yuv3
[
4
];
uint8_t
yuv3
[
4
];
const
double
iw
=
256
-
weight
;
const
uint16_t
iw
=
65535
-
weight
;
*
(
uint32_t
*
)
yuv1
=
r2y
[
c1
];
*
(
uint32_t
*
)
yuv1
=
r2y
[
c1
];
*
(
uint32_t
*
)
yuv2
=
r2y
[
c2
];
*
(
uint32_t
*
)
yuv2
=
r2y
[
c2
];
#ifdef __BIG_ENDIAN__
#ifdef __BIG_ENDIAN__
yuv3
[
0
]
=
0
;
yuv3
[
0
]
=
0
;
yuv3
[
1
]
=
(
yuv1
[
1
]
*
iw
+
yuv2
[
1
]
*
weight
)
/
256
;
yuv3
[
1
]
=
(
yuv1
[
1
]
*
iw
+
yuv2
[
1
]
*
weight
)
/
65535
;
yuv3
[
2
]
=
(
yuv1
[
2
]
*
iw
+
yuv2
[
2
]
*
weight
)
/
256
;
yuv3
[
2
]
=
(
yuv1
[
2
]
*
iw
+
yuv2
[
2
]
*
weight
)
/
65535
;
yuv3
[
3
]
=
(
yuv1
[
3
]
*
iw
+
yuv2
[
3
]
*
weight
)
/
256
;
yuv3
[
3
]
=
(
yuv1
[
3
]
*
iw
+
yuv2
[
3
]
*
weight
)
/
65535
;
#else
#else
yuv3
[
3
]
=
0
;
yuv3
[
3
]
=
0
;
yuv3
[
2
]
=
(
yuv1
[
2
]
*
iw
+
yuv2
[
2
]
*
weight
)
/
256
;
yuv3
[
2
]
=
(
yuv1
[
2
]
*
iw
+
yuv2
[
2
]
*
weight
)
/
65535
;
yuv3
[
1
]
=
(
yuv1
[
1
]
*
iw
+
yuv2
[
1
]
*
weight
)
/
256
;
yuv3
[
1
]
=
(
yuv1
[
1
]
*
iw
+
yuv2
[
1
]
*
weight
)
/
65535
;
yuv3
[
0
]
=
(
yuv1
[
0
]
*
iw
+
yuv2
[
0
]
*
weight
)
/
256
;
yuv3
[
0
]
=
(
yuv1
[
0
]
*
iw
+
yuv2
[
0
]
*
weight
)
/
65535
;
#endif
#endif
return
y2r
[
*
(
uint32_t
*
)
yuv3
];
return
y2r
[
*
(
uint32_t
*
)
yuv3
];
...
@@ -829,7 +829,7 @@ interpolate_width(uint32_t* src, uint32_t* dst, int width, int height, int newwi
...
@@ -829,7 +829,7 @@ interpolate_width(uint32_t* src, uint32_t* dst, int width, int height, int newwi
*
dst
=
src
[
width
*
y
+
x
];
*
dst
=
src
[
width
*
y
+
x
];
}
}
else
{
else
{
const
double
weight
=
xpos
-
xposi
;
const
uint16_t
weight
=
xpos
*
65536
;
// Now pick the two pixels
// Now pick the two pixels
const
uint32_t
pix1
=
src
[
y
*
width
+
xposi
];
const
uint32_t
pix1
=
src
[
y
*
width
+
xposi
];
uint32_t
pix2
;
uint32_t
pix2
;
...
@@ -899,7 +899,7 @@ interpolate_height(uint32_t* src, uint32_t* dst, int width, int height, int newh
...
@@ -899,7 +899,7 @@ interpolate_height(uint32_t* src, uint32_t* dst, int width, int height, int newh
dst
+=
width
;
dst
+=
width
;
}
}
else
{
else
{
const
uint
8
_t
weight
=
ypos
*
25
6
;
const
uint
16
_t
weight
=
ypos
*
6553
6
;
for
(
x
=
0
;
x
<
width
;
x
++
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
// Now pick the two pixels
// Now pick the two pixels
const
uint32_t
pix1
=
tline
[
x
];
const
uint32_t
pix1
=
tline
[
x
];
...
...
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