mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-25 08:24:43 +01:00
Format code
This commit is contained in:
parent
12542856a0
commit
8805861ea4
1 changed files with 25 additions and 26 deletions
|
@ -528,36 +528,35 @@ private open class ImageProcessorCommandTask(context: Context) :
|
||||||
handleCancel()
|
handleCancel()
|
||||||
return try {
|
return try {
|
||||||
val fileUri = Uri.fromFile(file)
|
val fileUri = Uri.fromFile(file)
|
||||||
val output = measureTime(
|
val output = measureTime(TAG, "[handleCommand] Elapsed time", {
|
||||||
TAG, "[handleCommand] Elapsed time", {
|
when (cmd.method) {
|
||||||
when (cmd.method) {
|
ImageProcessorService.METHOD_ZERO_DCE -> ZeroDce(
|
||||||
ImageProcessorService.METHOD_ZERO_DCE -> ZeroDce(
|
context, cmd.maxWidth, cmd.maxHeight,
|
||||||
context, cmd.maxWidth, cmd.maxHeight,
|
cmd.args["iteration"] as? Int ?: 8
|
||||||
cmd.args["iteration"] as? Int ?: 8
|
).infer(
|
||||||
).infer(
|
fileUri
|
||||||
fileUri
|
)
|
||||||
)
|
|
||||||
|
|
||||||
ImageProcessorService.METHOD_DEEP_LAP_PORTRAIT -> DeepLab3Portrait(
|
ImageProcessorService.METHOD_DEEP_LAP_PORTRAIT -> DeepLab3Portrait(
|
||||||
context, cmd.maxWidth, cmd.maxHeight,
|
context, cmd.maxWidth, cmd.maxHeight,
|
||||||
cmd.args["radius"] as? Int ?: 16
|
cmd.args["radius"] as? Int ?: 16
|
||||||
).infer(fileUri)
|
).infer(fileUri)
|
||||||
|
|
||||||
ImageProcessorService.METHOD_ESRGAN -> Esrgan(
|
ImageProcessorService.METHOD_ESRGAN -> Esrgan(
|
||||||
context, cmd.maxWidth, cmd.maxHeight
|
context, cmd.maxWidth, cmd.maxHeight
|
||||||
).infer(fileUri)
|
).infer(fileUri)
|
||||||
|
|
||||||
ImageProcessorService.METHOD_ARBITRARY_STYLE_TRANSFER -> ArbitraryStyleTransfer(
|
ImageProcessorService.METHOD_ARBITRARY_STYLE_TRANSFER -> ArbitraryStyleTransfer(
|
||||||
context, cmd.maxWidth, cmd.maxHeight,
|
context, cmd.maxWidth, cmd.maxHeight,
|
||||||
cmd.args["styleUri"] as Uri,
|
cmd.args["styleUri"] as Uri,
|
||||||
cmd.args["weight"] as Float
|
cmd.args["weight"] as Float
|
||||||
).infer(fileUri)
|
).infer(fileUri)
|
||||||
|
|
||||||
else -> throw IllegalArgumentException(
|
else -> throw IllegalArgumentException(
|
||||||
"Unknown method: ${cmd.method}"
|
"Unknown method: ${cmd.method}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
handleCancel()
|
handleCancel()
|
||||||
saveBitmap(output, cmd.filename, file)
|
saveBitmap(output, cmd.filename, file)
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Add table
Reference in a new issue