mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
Add more resolution options
This commit is contained in:
1 parent
2ba11c9b3d
commit
e93c8b728f
11 files changed
+94
-2
No files matched your search
@@ -14,4 +14,16 @@ pub enum CommonResolution {
|
||||
ThreeK,
|
||||
/// Models: Nano Banana Pro
|
||||
FourK,
|
||||
|
||||
/// Used by Nano Banana 2 (and others)
|
||||
HalfK,
|
||||
|
||||
/// Used by the Seedance family (and others)
|
||||
FourEightyP,
|
||||
|
||||
/// Used by the Seedance family (and others)
|
||||
SevenTwentyP,
|
||||
|
||||
/// Used by the Seedance family (and others)
|
||||
TenEightyP,
|
||||
}
|
||||
+2
@@ -135,6 +135,8 @@ fn plan_resolution(
|
||||
// No 3K option; default to 2K
|
||||
Ok(Some(Nb2Res::TwoK))
|
||||
}
|
||||
// HalfK, FourEightyP, SevenTwentyP, TenEightyP — nearest supported is OneK
|
||||
Some(R::HalfK | R::FourEightyP | R::SevenTwentyP | R::TenEightyP) => Ok(Some(Nb2Res::OneK)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -135,6 +135,8 @@ fn plan_resolution(
|
||||
// No 3K option; default to 2K
|
||||
Ok(Some(NbpRes::TwoK))
|
||||
}
|
||||
// HalfK, FourEightyP, SevenTwentyP, TenEightyP — nearest supported is OneK
|
||||
Some(R::HalfK | R::FourEightyP | R::SevenTwentyP | R::TenEightyP) => Ok(Some(NbpRes::OneK)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -202,6 +202,11 @@ fn plan_resolution(
|
||||
Some(CommonResolution::FourK) => Ok(Some(FalNbpResolution::FourK)),
|
||||
// No 3K option; fall back to 2K
|
||||
Some(CommonResolution::ThreeK) => Ok(Some(FalNbpResolution::TwoK)),
|
||||
// Fall back to nearest supported resolution
|
||||
Some(CommonResolution::HalfK) => Ok(Some(FalNbpResolution::OneK)),
|
||||
Some(CommonResolution::FourEightyP) => Ok(Some(FalNbpResolution::OneK)),
|
||||
Some(CommonResolution::SevenTwentyP) => Ok(Some(FalNbpResolution::OneK)),
|
||||
Some(CommonResolution::TenEightyP) => Ok(Some(FalNbpResolution::OneK)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -167,6 +167,10 @@ fn plan_resolution(
|
||||
Some(CommonResolution::TwoK) => Ok(Some(Seedance1p5ProMultiFunctionVideoGenResolution::TenEightyP)),
|
||||
Some(CommonResolution::ThreeK) => Ok(Some(Seedance1p5ProMultiFunctionVideoGenResolution::TenEightyP)),
|
||||
Some(CommonResolution::FourK) => Ok(Some(Seedance1p5ProMultiFunctionVideoGenResolution::TenEightyP)),
|
||||
// HalfK and FourEightyP map to the lowest supported resolution
|
||||
Some(CommonResolution::HalfK | CommonResolution::FourEightyP) => Ok(Some(Seedance1p5ProMultiFunctionVideoGenResolution::FourEightyP)),
|
||||
Some(CommonResolution::SevenTwentyP) => Ok(Some(Seedance1p5ProMultiFunctionVideoGenResolution::SevenTwentyP)),
|
||||
Some(CommonResolution::TenEightyP) => Ok(Some(Seedance1p5ProMultiFunctionVideoGenResolution::TenEightyP)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,4 +14,16 @@ pub enum CommonResolution {
|
||||
ThreeK,
|
||||
/// Models: Nano Banana Pro
|
||||
FourK,
|
||||
|
||||
/// Used by Nano Banana 2 (and others)
|
||||
HalfK,
|
||||
|
||||
/// Used by the Seedance family (and others)
|
||||
FourEightyP,
|
||||
|
||||
/// Used by the Seedance family (and others)
|
||||
SevenTwentyP,
|
||||
|
||||
/// Used by the Seedance family (and others)
|
||||
TenEightyP,
|
||||
}
|
||||
+5
@@ -8,5 +8,10 @@ pub fn resolution_to_artcraft_nano_banana_pro(resolution: CommonResolution) -> N
|
||||
// NB: ThreeK doesn't exist in Nano Banana Pro, use FourK as nearest higher resolution
|
||||
CommonResolution::ThreeK => NanoBananaProMultiFunctionImageGenImageResolution::FourK,
|
||||
CommonResolution::FourK => NanoBananaProMultiFunctionImageGenImageResolution::FourK,
|
||||
// Fall back to nearest supported resolution
|
||||
CommonResolution::HalfK => NanoBananaProMultiFunctionImageGenImageResolution::OneK,
|
||||
CommonResolution::FourEightyP => NanoBananaProMultiFunctionImageGenImageResolution::OneK,
|
||||
CommonResolution::SevenTwentyP => NanoBananaProMultiFunctionImageGenImageResolution::OneK,
|
||||
CommonResolution::TenEightyP => NanoBananaProMultiFunctionImageGenImageResolution::OneK,
|
||||
}
|
||||
}
|
||||
+4
@@ -144,5 +144,9 @@ fn convert_desktop_resolution(res: CommonResolution2) -> RouterCommonResolution
|
||||
CommonResolution2::TwoK => RouterCommonResolution::TwoK,
|
||||
CommonResolution2::ThreeK => RouterCommonResolution::ThreeK,
|
||||
CommonResolution2::FourK => RouterCommonResolution::FourK,
|
||||
CommonResolution2::HalfK => RouterCommonResolution::HalfK,
|
||||
CommonResolution2::FourEightyP => RouterCommonResolution::FourEightyP,
|
||||
CommonResolution2::SevenTwentyP => RouterCommonResolution::SevenTwentyP,
|
||||
CommonResolution2::TenEightyP => RouterCommonResolution::TenEightyP,
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,17 @@ pub enum CommonResolution {
|
||||
ThreeK,
|
||||
FourK,
|
||||
|
||||
// TODO: Add 480p(?), 720p(?), 1080p, etc. as there are some models that use these
|
||||
/// Used by Nano Banana 2 (and others)
|
||||
HalfK,
|
||||
|
||||
/// Used by the Seedance family (and others)
|
||||
FourEightyP,
|
||||
|
||||
/// Used by the Seedance family (and others)
|
||||
SevenTwentyP,
|
||||
|
||||
/// Used by the Seedance family (and others)
|
||||
TenEightyP,
|
||||
}
|
||||
|
||||
impl_enum_display_and_debug_using_to_str!(CommonResolution);
|
||||
@@ -37,6 +47,10 @@ impl CommonResolution {
|
||||
Self::TwoK => "two_k",
|
||||
Self::ThreeK => "three_k",
|
||||
Self::FourK => "four_k",
|
||||
Self::HalfK => "half_k",
|
||||
Self::FourEightyP => "four_eighty_p",
|
||||
Self::SevenTwentyP => "seven_twenty_p",
|
||||
Self::TenEightyP => "ten_eighty_p",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +60,10 @@ impl CommonResolution {
|
||||
"two_k" => Ok(Self::TwoK),
|
||||
"three_k" => Ok(Self::ThreeK),
|
||||
"four_k" => Ok(Self::FourK),
|
||||
"half_k" => Ok(Self::HalfK),
|
||||
"four_eighty_p" => Ok(Self::FourEightyP),
|
||||
"seven_twenty_p" => Ok(Self::SevenTwentyP),
|
||||
"ten_eighty_p" => Ok(Self::TenEightyP),
|
||||
_ => Err(EnumError::CouldNotConvertFromString(value.to_string())),
|
||||
}
|
||||
}
|
||||
@@ -56,6 +74,10 @@ impl CommonResolution {
|
||||
Self::TwoK,
|
||||
Self::ThreeK,
|
||||
Self::FourK,
|
||||
Self::HalfK,
|
||||
Self::FourEightyP,
|
||||
Self::SevenTwentyP,
|
||||
Self::TenEightyP,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -76,6 +98,10 @@ mod tests {
|
||||
assert_serialization(CommonResolution::TwoK, "two_k");
|
||||
assert_serialization(CommonResolution::ThreeK, "three_k");
|
||||
assert_serialization(CommonResolution::FourK, "four_k");
|
||||
assert_serialization(CommonResolution::HalfK, "half_k");
|
||||
assert_serialization(CommonResolution::FourEightyP, "four_eighty_p");
|
||||
assert_serialization(CommonResolution::SevenTwentyP, "seven_twenty_p");
|
||||
assert_serialization(CommonResolution::TenEightyP, "ten_eighty_p");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -84,6 +110,10 @@ mod tests {
|
||||
assert_eq!(CommonResolution::TwoK.to_str(), "two_k");
|
||||
assert_eq!(CommonResolution::ThreeK.to_str(), "three_k");
|
||||
assert_eq!(CommonResolution::FourK.to_str(), "four_k");
|
||||
assert_eq!(CommonResolution::HalfK.to_str(), "half_k");
|
||||
assert_eq!(CommonResolution::FourEightyP.to_str(), "four_eighty_p");
|
||||
assert_eq!(CommonResolution::SevenTwentyP.to_str(), "seven_twenty_p");
|
||||
assert_eq!(CommonResolution::TenEightyP.to_str(), "ten_eighty_p");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -92,6 +122,10 @@ mod tests {
|
||||
assert_eq!(CommonResolution::from_str("two_k").unwrap(), CommonResolution::TwoK);
|
||||
assert_eq!(CommonResolution::from_str("three_k").unwrap(), CommonResolution::ThreeK);
|
||||
assert_eq!(CommonResolution::from_str("four_k").unwrap(), CommonResolution::FourK);
|
||||
assert_eq!(CommonResolution::from_str("half_k").unwrap(), CommonResolution::HalfK);
|
||||
assert_eq!(CommonResolution::from_str("four_eighty_p").unwrap(), CommonResolution::FourEightyP);
|
||||
assert_eq!(CommonResolution::from_str("seven_twenty_p").unwrap(), CommonResolution::SevenTwentyP);
|
||||
assert_eq!(CommonResolution::from_str("ten_eighty_p").unwrap(), CommonResolution::TenEightyP);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -108,11 +142,15 @@ mod tests {
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
let mut variants = CommonResolution::all_variants();
|
||||
assert_eq!(variants.len(), 4);
|
||||
assert_eq!(variants.len(), 8);
|
||||
assert_eq!(variants.pop_first(), Some(CommonResolution::OneK));
|
||||
assert_eq!(variants.pop_first(), Some(CommonResolution::TwoK));
|
||||
assert_eq!(variants.pop_first(), Some(CommonResolution::ThreeK));
|
||||
assert_eq!(variants.pop_first(), Some(CommonResolution::FourK));
|
||||
assert_eq!(variants.pop_first(), Some(CommonResolution::HalfK));
|
||||
assert_eq!(variants.pop_first(), Some(CommonResolution::FourEightyP));
|
||||
assert_eq!(variants.pop_first(), Some(CommonResolution::SevenTwentyP));
|
||||
assert_eq!(variants.pop_first(), Some(CommonResolution::TenEightyP));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -168,5 +168,9 @@ fn map_resolution(res: CommonResolution) -> RouterResolution {
|
||||
CommonResolution::TwoK => RouterResolution::TwoK,
|
||||
CommonResolution::ThreeK => RouterResolution::ThreeK,
|
||||
CommonResolution::FourK => RouterResolution::FourK,
|
||||
CommonResolution::HalfK => RouterResolution::HalfK,
|
||||
CommonResolution::FourEightyP => RouterResolution::FourEightyP,
|
||||
CommonResolution::SevenTwentyP => RouterResolution::SevenTwentyP,
|
||||
CommonResolution::TenEightyP => RouterResolution::TenEightyP,
|
||||
}
|
||||
}
|
||||
+4
@@ -178,5 +178,9 @@ fn map_resolution(res: CommonResolution) -> RouterResolution {
|
||||
CommonResolution::TwoK => RouterResolution::TwoK,
|
||||
CommonResolution::ThreeK => RouterResolution::ThreeK,
|
||||
CommonResolution::FourK => RouterResolution::FourK,
|
||||
CommonResolution::HalfK => RouterResolution::HalfK,
|
||||
CommonResolution::FourEightyP => RouterResolution::FourEightyP,
|
||||
CommonResolution::SevenTwentyP => RouterResolution::SevenTwentyP,
|
||||
CommonResolution::TenEightyP => RouterResolution::TenEightyP,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user