Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
4a48937e
"vscode:/vscode.git/clone" did not exist on "8e963d1c2a2b6ebf2880675516809bd9a39359a4"
Commit
4a48937e
authored
Sep 25, 2025
by
shengxinjing
Committed by
Michael Yang
Oct 09, 2025
Browse files
refactor: use builtin max and min
parent
967a82f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
model/models/llama4/process_image.go
model/models/llama4/process_image.go
+3
-3
model/models/mllama/process_image.go
model/models/mllama/process_image.go
+3
-3
No files found.
model/models/llama4/process_image.go
View file @
4a48937e
...
...
@@ -73,7 +73,7 @@ func (p ImageProcessor) bestResolution(img image.Point, possibleResolutions []im
for
i
,
res
:=
range
possibleResolutions
{
scaleW
:=
float64
(
res
.
X
)
/
float64
(
w
)
scaleH
:=
float64
(
res
.
Y
)
/
float64
(
h
)
scale
:=
m
ath
.
M
in
(
scaleW
,
scaleH
)
scale
:=
min
(
scaleW
,
scaleH
)
scales
[
i
]
=
scale
}
...
...
@@ -124,11 +124,11 @@ func (p ImageProcessor) maxResolution(imageRes, targetRes image.Point) image.Poi
if
scaleW
<
scaleH
{
newRes
=
image
.
Point
{
targetRes
.
X
,
int
(
math
.
Min
(
math
.
Floor
(
float64
(
imageRes
.
Y
)
*
scaleW
),
float64
(
targetRes
.
Y
))),
int
(
math
.
Floor
(
float64
(
imageRes
.
Y
)
*
scaleW
),
float64
(
targetRes
.
Y
))),
}
}
else
{
newRes
=
image
.
Point
{
int
(
m
ath
.
M
in
(
math
.
Floor
(
float64
(
imageRes
.
X
)
*
scaleH
),
float64
(
targetRes
.
X
))),
int
(
min
(
math
.
Floor
(
float64
(
imageRes
.
X
)
*
scaleH
),
float64
(
targetRes
.
X
))),
targetRes
.
Y
,
}
}
...
...
model/models/mllama/process_image.go
View file @
4a48937e
...
...
@@ -53,7 +53,7 @@ func (p ImageProcessor) fitToCanvas(imageSize, canvasSize image.Point) image.Poi
tw
:=
min
(
max
(
imageSize
.
X
,
p
.
imageSize
),
canvasSize
.
X
)
th
:=
min
(
max
(
imageSize
.
Y
,
p
.
imageSize
),
canvasSize
.
Y
)
r
:=
m
ath
.
M
in
(
r
:=
min
(
float64
(
tw
)
/
float64
(
imageSize
.
X
),
float64
(
th
)
/
float64
(
imageSize
.
Y
),
)
...
...
@@ -89,10 +89,10 @@ func (p ImageProcessor) optimalTiledCanvas(imageSize image.Point) image.Point {
if
minUpscale
==
0
{
minUpscale
=
s
}
else
{
minUpscale
=
m
ath
.
M
in
(
minUpscale
,
s
)
minUpscale
=
min
(
minUpscale
,
s
)
}
}
else
{
maxDownscale
=
ma
th
.
Ma
x
(
maxDownscale
,
s
)
maxDownscale
=
max
(
maxDownscale
,
s
)
}
}
...
...
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