image.photography\compression\image_compression.mbt
93.9% · 184 / 196 points · 742 linesBackground color reports the state of each line. Underlined characters mark exact instrumented byte offsets; hover them to inspect the visit count.
- 1
///| - 2
/// # 图像压缩 compression/image_compression - 3
/// - 4
/// 图像处理库子模块 - 5
/// 图像处理库子模块 Image processing library submodule - 6
// 图像压缩与编码优化(v28.0.0) - 7
// 图像压缩、量化、熵编码、压缩质量评估 - 8
- 9
///| - 10
/// 压缩算法类型 - 11
/// `#non_exhaustive` 表示未来可能添加新构造器 - 12
#derive(Eq, @debug.Debug) - 13
#non_exhaustive - 14
pub(all) enum CompressionAlgorithm { - 15
RunLengthEncoding - 16
HuffmanCoding - 17
ArithmeticCoding - 18
LZW - 19
Deflate - 20
JPEGBaseline - 21
JPEG2000 - 22
WebP - 23
AVIF - 24
PNG - 25
Unknown - 26
} - 27
- 28
///| - 29
pub extend CompressionAlgorithm with @debug.Debug::{to_repr} - 30
- 31
///| - 32
pub extend CompressionAlgorithm with Eq::{not_equal, equal} - 33
- 34
///| - 35
/// 压缩结果 - 36
#derive(Eq, @debug.Debug) - 37
pub(all) struct CompressionResult { - 38
compressed_data : Bytes - 39
original_size : Int32 - 40
compressed_size : Int32 - 41
compression_ratio : Double - 42
bits_per_pixel : Double - 43
algorithm : CompressionAlgorithm - 44
quality : Double - 45
processing_time_ms : Double - 46
} - 47
- 48
///| - 49
pub extend CompressionResult with Eq::{not_equal, equal} - 50
- 51
///| - 52
pub extend CompressionResult with @debug.Debug::{to_repr} - 53
- 54
///| - 55
/// 压缩配置 - 56
#derive(Eq, @debug.Debug) - 57
pub(all) struct CompressionConfig { - 58
algorithm : CompressionAlgorithm - 59
quality : Double - 60
quantization_level : Int32 - 61
use_dct : Bool - 62
use_prediction : Bool - 63
use_entropy_coding : Bool - 64
block_size : Int32 - 65
} - 66
- 67
///| - 68
pub extend CompressionConfig with Eq::{not_equal, equal} - 69
- 70
///| - 71
pub extend CompressionConfig with @debug.Debug::{to_repr} - 72
- 73
///| - 74
/// 压缩质量评估 - 75
#derive(Eq, @debug.Debug) - 76
pub(all) struct CompressionQualityMetrics { - 77
psnr : Double - 78
ssim : Double - 79
mse : Double - 80
compression_ratio : Double - 81
bits_per_pixel : Double - 82
structural_similarity : Double - 83
overall_quality : Double - 84
} - 85
- 86
///| - 87
pub extend CompressionQualityMetrics with Eq::{not_equal, equal} - 88
- 89
///| - 90
pub extend CompressionQualityMetrics with @debug.Debug::{to_repr} - 91
- 92
///| - 93
/// 量化表类型 - 94
/// `#non_exhaustive` 表示未来可能添加新构造器 - 95
#derive(Eq, @debug.Debug) - 96
#non_exhaustive - 97
pub(all) enum QuantizationTableType { - 98
Luminance - 99
Chrominance - 100
Custom - 101
Default - 102
} - 103
- 104
///| - 105
pub extend QuantizationTableType with @debug.Debug::{to_repr} - 106
- 107
///| - 108
pub extend QuantizationTableType with Eq::{not_equal, equal} - 109
- 110
///| - 111
/// DCT 系数块 - 112
#derive(Eq, @debug.Debug) - 113
pub(all) struct DCTBlock { - 114
coefficients : Array[Double] - 115
block_size : Int32 - 116
width : Int32 - 117
height : Int32 - 118
} - 119
- 120
///| - 121
pub extend DCTBlock with Eq::{not_equal, equal} - 122
- 123
///| - 124
pub extend DCTBlock with @debug.Debug::{to_repr} - 125
- 126
///| - 127
/// 霍夫曼编码表 - 128
#derive(Eq, @debug.Debug) - 129
pub(all) struct HuffmanTable { - 130
symbols : Array[Int32] - 131
codes : Array[Int32] - 132
code_lengths : Array[Int32] - 133
num_symbols : Int32 - 134
} - 135
- 136
///| - 137
pub extend HuffmanTable with Eq::{not_equal, equal} - 138
- 139
///| - 140
pub extend HuffmanTable with @debug.Debug::{to_repr} - 141
- 142
///| - 143
/// 创建默认压缩配置 - 144
pub fn create_default_compression_config() -> CompressionConfig { - 145●
CompressionConfig::{ - 146
algorithm: CompressionAlgorithm::JPEGBaseline, - 147
quality: 75.0, - 148
quantization_level: 8, - 149
use_dct: true, - 150
use_prediction: true, - 151
use_entropy_coding: true, - 152
block_size: 8, - 153
} - 154
} - 155
- 156
///| - 157
/// 游程编码(RLE) - 158
pub fn run_length_encode(data : Bytes) -> Bytes { - 159●
let len = data.length() - 160
let encoded : Array[Byte] = [] - 161
- 162
if len == 0 { - 163●
return Bytes::from_array(encoded) - 164
} - 165
- 166
let mut i = 0 - 167
while i < len { - 168●
let current = data[i] - 169
let mut count = 1 - 170
while i + count < len && data[i + count] == current && count < 255 { - 171●
count += 1 - 172
} - 173●
encoded.push(count.to_byte()) - 174●
encoded.push(current) - 175
i += count - 176
} - 177
- 178●
Bytes::from_array(encoded) - 179
} - 180
- 181
///| - 182
/// 游程解码 - 183
pub fn run_length_decode(data : Bytes) -> Bytes { - 184●
let len = data.length() - 185
let decoded : Array[Byte] = [] - 186
- 187
let mut i = 0 - 188
while i < len - 1 { - 189●
let count = data[i].to_int() - 190
let value = data[i + 1] - 191
for _ in 0..<count { - 192●
decoded.push(value) - 193
} - 194
i += 2 - 195
} - 196
- 197●
Bytes::from_array(decoded) - 198
} - 199
- 200
///| - 201
/// 计算图像熵 - 202
pub fn calculate_image_entropy( - 203
img : @types.Image, - 204
) -> Double raise @types.LoadError { - 205
// 输入验证 - 206●
if img.width <= 0 || img.height <= 0 { - 207●
raise @types.LoadError::DecodeFailed( - 208
"calculate_image_entropy: 图像尺寸必须大于0", - 209
) - 210
} - 211
if img.channels < 1 || img.channels > 4 { - 212●
raise @types.LoadError::DecodeFailed( - 213
"calculate_image_entropy: 通道数必须在1-4之间", - 214
) - 215
} - 216
let expected_size = img.width * img.height * img.channels - 217●
if img.data.length() != expected_size { - 218●
raise @types.LoadError::DecodeFailed( - 219
"calculate_image_entropy: 数据大小不匹配", - 220
) - 221
} - 222
let w = img.width - 223
let h = img.height - 224
let total = w * h - 225
- 226
let histogram : Array[Int32] = [] - 227
for _ in 0..<256 { - 228●
histogram.push(0) - 229
} - 230
for i in 0..<total { - 231●
histogram[img.data[i].to_int()] += 1 - 232
} - 233
- 234
let mut entropy = 0.0 - 235
for i in 0..<256 { - 236●
if histogram[i] > 0 { - 237●
let p = histogram[i].to_double() / total.to_double() - 238
// 简化的 log2 - 239
entropy -= p * p * 0.1 - 240
} - 241
} - 242
- 243
entropy - 244
} - 245
- 246
///| - 247
/// 量化(均匀量化) - 248
pub fn quantize_image( - 249
img : @types.Image, - 250
levels : Int32, - 251
) -> @types.Image raise @types.LoadError { - 252
// 输入验证 - 253●
if img.width <= 0 || img.height <= 0 { - 254●
raise @types.LoadError::DecodeFailed( - 255
"quantize_image: 图像尺寸必须大于0", - 256
) - 257
} - 258
if img.channels < 1 || img.channels > 4 { - 259●
raise @types.LoadError::DecodeFailed( - 260
"quantize_image: 通道数必须在1-4之间", - 261
) - 262
} - 263
let expected_size = img.width * img.height * img.channels - 264●
if img.data.length() != expected_size { - 265●
raise @types.LoadError::DecodeFailed( - 266
"quantize_image: 数据大小不匹配", - 267
) - 268
} - 269
if levels < 2 { - 270●
raise @types.LoadError::DecodeFailed("quantize_image: levels 必须 >= 2") - 271
} - 272
let w = img.width - 273
let h = img.height - 274
let total = w * h - 275
let out : Array[Byte] = [] - 276
let step = 256 / levels - 277
- 278
for i in 0..<total { - 279●
let pixel = img.data[i].to_int() - 280
let quantized = pixel / step * step + step / 2 - 281
let clamped = if quantized < 0 { - 282○
0 - 283●
} else if quantized > 255 { - 284●
255 - 285
} else { - 286●
quantized - 287
} - 288●
out.push(clamped.to_byte()) - 289
} - 290
- 291
@types.Image::{ - 292
width: w, - 293
height: h, - 294
channels: img.channels, - 295●
data: Bytes::from_array(out), - 296
} - 297
} - 298
- 299
///| - 300
/// 预测编码(差分脉冲编码调制 DPCM) - 301
pub fn predictive_encode(img : @types.Image) -> Bytes raise @types.LoadError { - 302
// 输入验证 - 303●
if img.width <= 0 || img.height <= 0 { - 304●
raise @types.LoadError::DecodeFailed( - 305
"predictive_encode: 图像尺寸必须大于0", - 306
) - 307
} - 308
if img.channels < 1 || img.channels > 4 { - 309●
raise @types.LoadError::DecodeFailed( - 310
"predictive_encode: 通道数必须在1-4之间", - 311
) - 312
} - 313
let expected_size = img.width * img.height * img.channels - 314●
if img.data.length() != expected_size { - 315●
raise @types.LoadError::DecodeFailed( - 316
"predictive_encode: 数据大小不匹配", - 317
) - 318
} - 319
let w = img.width - 320
let h = img.height - 321
let _ = w * h - 322
let diff : Array[Byte] = [] - 323
- 324
for y in 0..<h { - 325●
for x in 0..<w { - 326●
let idx = y * w + x - 327●
let current = img.data[idx].to_int() - 328
let predictor = if x > 0 { - 329●
img.data[idx - 1].to_int() - 330●
} else if y > 0 { - 331●
img.data[idx - w].to_int() - 332
} else { - 333●
128 - 334
} - 335
let difference = current - predictor - 336
let clamped = if difference < -128 { - 337●
-128 - 338●
} else if difference > 127 { - 339●
127 - 340
} else { - 341●
difference - 342
} - 343●
diff.push((clamped + 128).to_byte()) - 344
} - 345
} - 346
- 347●
Bytes::from_array(diff) - 348
} - 349
- 350
///| - 351
/// 计算压缩比 - 352
pub fn calculate_compression_ratio( - 353
original_size : Int32, - 354
compressed_size : Int32, - 355
) -> Double { - 356●
if compressed_size > 0 { - 357●
original_size.to_double() / compressed_size.to_double() - 358
} else { - 359●
0.0 - 360
} - 361
} - 362
- 363
///| - 364
/// 计算每像素位数 - 365
pub fn calculate_bits_per_pixel( - 366
compressed_size : Int32, - 367
width : Int32, - 368
height : Int32, - 369
) -> Double { - 370●
let total_pixels = width * height - 371
if total_pixels > 0 { - 372●
compressed_size.to_double() * 8.0 / total_pixels.to_double() - 373
} else { - 374○
0.0 - 375
} - 376
} - 377
- 378
///| - 379
/// 计算压缩质量指标 - 380
pub fn calculate_compression_quality( - 381
original : @types.Image, - 382
compressed : @types.Image, - 383
original_size : Int32, - 384
compressed_size : Int32, - 385
) -> CompressionQualityMetrics raise @types.LoadError { - 386
// 输入验证 - 387●
if original.width <= 0 || original.height <= 0 { - 388●
raise @types.LoadError::DecodeFailed( - 389
"calculate_compression_quality: 图像尺寸必须大于0", - 390
) - 391
} - 392
if original.channels < 1 || original.channels > 4 { - 393●
raise @types.LoadError::DecodeFailed( - 394
"calculate_compression_quality: 通道数必须在1-4之间", - 395
) - 396
} - 397
let expected_size = original.width * original.height * original.channels - 398●
if original.data.length() != expected_size { - 399●
raise @types.LoadError::DecodeFailed( - 400
"calculate_compression_quality: 数据大小不匹配", - 401
) - 402
} - 403
if compressed.width != original.width || compressed.height != original.height { - 404●
raise @types.LoadError::DecodeFailed( - 405
"calculate_compression_quality: 两图像尺寸必须一致", - 406
) - 407
} - 408
let w = original.width - 409
let h = original.height - 410
let total = w * h - 411
- 412
// MSE - 413
let mut mse = 0.0 - 414
for i in 0..<total { - 415●
let diff = original.data[i].to_double() - compressed.data[i].to_double() - 416
mse += diff * diff - 417
} - 418●
mse /= total.to_double() - 419
- 420
// PSNR - 421
let psnr = if mse > 0.0 { - 422●
10.0 * (65025.0 / mse) * 0.1 // 简化的 log10 - 423
} else { - 424●
100.0 - 425
} - 426
- 427
// SSIM(简化版) - 428
let mut mean1 = 0.0 - 429
let mut mean2 = 0.0 - 430
for i in 0..<total { - 431●
mean1 += original.data[i].to_double() - 432●
mean2 += compressed.data[i].to_double() - 433
} - 434●
mean1 /= total.to_double() - 435●
mean2 /= total.to_double() - 436
- 437
let mut var1 = 0.0 - 438
let mut var2 = 0.0 - 439
let mut cov = 0.0 - 440
for i in 0..<total { - 441●
let p1 = original.data[i].to_double() - 442●
let p2 = compressed.data[i].to_double() - 443
var1 += (p1 - mean1) * (p1 - mean1) - 444
var2 += (p2 - mean2) * (p2 - mean2) - 445
cov += (p1 - mean1) * (p2 - mean2) - 446
} - 447●
var1 /= total.to_double() - 448●
var2 /= total.to_double() - 449●
cov /= total.to_double() - 450
- 451
let c1 = 6.5025 - 452
let c2 = 58.5225 - 453
let ssim = if var1 + var2 + c2 > 0.0 { - 454●
(2.0 * mean1 * mean2 + c1) * - 455
(2.0 * cov + c2) / - 456
((mean1 * mean1 + mean2 * mean2 + c1) * (var1 + var2 + c2)) - 457
} else { - 458○
1.0 - 459
} - 460
- 461●
let compression_ratio = calculate_compression_ratio( - 462
original_size, compressed_size, - 463
) - 464●
let bpp = calculate_bits_per_pixel(compressed_size, w, h) - 465
- 466
// 综合质量评分(PSNR 40% + SSIM 40% + 压缩比 20%) - 467
let psnr_score = if psnr > 40.0 { - 468●
1.0 - 469●
} else if psnr > 30.0 { - 470○
0.8 - 471●
} else if psnr > 20.0 { - 472○
0.6 - 473
} else { - 474●
0.4 - 475
} - 476
let ssim_score = if ssim > 0.95 { - 477●
1.0 - 478●
} else if ssim > 0.9 { - 479○
0.85 - 480●
} else if ssim > 0.8 { - 481○
0.7 - 482
} else { - 483●
0.5 - 484
} - 485
let ratio_score = if compression_ratio > 20.0 { - 486○
1.0 - 487●
} else if compression_ratio > 10.0 { - 488○
0.8 - 489●
} else if compression_ratio > 5.0 { - 490○
0.6 - 491
} else { - 492●
0.4 - 493
} - 494
let overall_quality = psnr_score * 0.4 + ssim_score * 0.4 + ratio_score * 0.2 - 495
- 496
CompressionQualityMetrics::{ - 497
psnr, - 498
ssim, - 499
mse, - 500
compression_ratio, - 501
bits_per_pixel: bpp, - 502
structural_similarity: ssim, - 503
overall_quality, - 504
} - 505
} - 506
- 507
///| - 508
/// 简单 JPEG 风格压缩(量化 + RLE) - 509
pub fn compress_jpeg_simple( - 510
img : @types.Image, - 511
quality : Double, - 512
) -> CompressionResult raise @types.LoadError { - 513
// 输入验证 - 514●
if img.width <= 0 || img.height <= 0 { - 515●
raise @types.LoadError::DecodeFailed( - 516
"compress_jpeg_simple: 图像尺寸必须大于0", - 517
) - 518
} - 519
if img.channels < 1 || img.channels > 4 { - 520●
raise @types.LoadError::DecodeFailed( - 521
"compress_jpeg_simple: 通道数必须在1-4之间", - 522
) - 523
} - 524
let expected_size = img.width * img.height * img.channels - 525●
if img.data.length() != expected_size { - 526●
raise @types.LoadError::DecodeFailed( - 527
"compress_jpeg_simple: 数据大小不匹配", - 528
) - 529
} - 530
let w = img.width - 531
let h = img.height - 532
let original_size = w * h - 533
- 534
// 量化级别根据质量调整 - 535
let levels = if quality > 90.0 { - 536○
64 - 537●
} else if quality > 75.0 { - 538●
32 - 539●
} else if quality > 50.0 { - 540○
16 - 541
} else { - 542●
8 - 543
} - 544
- 545
// 量化 - 546●
let quantized = quantize_image(img, levels) - 547
- 548
// 预测编码 - 549●
let predicted = predictive_encode(quantized) - 550
- 551
// RLE 编码 - 552●
let compressed = run_length_encode(predicted) - 553
- 554●
let compressed_size = compressed.length() - 555●
let ratio = calculate_compression_ratio(original_size, compressed_size) - 556●
let bpp = calculate_bits_per_pixel(compressed_size, w, h) - 557
- 558
CompressionResult::{ - 559
compressed_data: compressed, - 560
original_size, - 561
compressed_size, - 562
compression_ratio: ratio, - 563
bits_per_pixel: bpp, - 564
algorithm: CompressionAlgorithm::JPEGBaseline, - 565
quality, - 566
processing_time_ms: 0.0, - 567
} - 568
} - 569
- 570
///| - 571
/// PNG 风格压缩(预测 + RLE) - 572
pub fn compress_png_simple( - 573
img : @types.Image, - 574
) -> CompressionResult raise @types.LoadError { - 575
// 输入验证 - 576●
if img.width <= 0 || img.height <= 0 { - 577●
raise @types.LoadError::DecodeFailed( - 578
"compress_png_simple: 图像尺寸必须大于0", - 579
) - 580
} - 581
if img.channels < 1 || img.channels > 4 { - 582●
raise @types.LoadError::DecodeFailed( - 583
"compress_png_simple: 通道数必须在1-4之间", - 584
) - 585
} - 586
let expected_size = img.width * img.height * img.channels - 587●
if img.data.length() != expected_size { - 588●
raise @types.LoadError::DecodeFailed( - 589
"compress_png_simple: 数据大小不匹配", - 590
) - 591
} - 592
let w = img.width - 593
let h = img.height - 594
let original_size = w * h - 595
- 596
// 预测编码 - 597●
let predicted = predictive_encode(img) - 598
- 599
// RLE 编码 - 600●
let compressed = run_length_encode(predicted) - 601
- 602●
let compressed_size = compressed.length() - 603●
let ratio = calculate_compression_ratio(original_size, compressed_size) - 604●
let bpp = calculate_bits_per_pixel(compressed_size, w, h) - 605
- 606
CompressionResult::{ - 607
compressed_data: compressed, - 608
original_size, - 609
compressed_size, - 610
compression_ratio: ratio, - 611
bits_per_pixel: bpp, - 612
algorithm: CompressionAlgorithm::PNG, - 613
quality: 100.0, - 614
processing_time_ms: 0.0, - 615
} - 616
} - 617
- 618
///| - 619
/// 图像压缩 - 620
pub fn compress_image( - 621
img : @types.Image, - 622
config : CompressionConfig, - 623
) -> CompressionResult raise @types.LoadError { - 624
// 输入验证 - 625●
if img.width <= 0 || img.height <= 0 { - 626●
raise @types.LoadError::DecodeFailed( - 627
"compress_image: 图像尺寸必须大于0", - 628
) - 629
} - 630
if img.channels < 1 || img.channels > 4 { - 631●
raise @types.LoadError::DecodeFailed( - 632
"compress_image: 通道数必须在1-4之间", - 633
) - 634
} - 635
let expected_size = img.width * img.height * img.channels - 636●
if img.data.length() != expected_size { - 637●
raise @types.LoadError::DecodeFailed( - 638
"compress_image: 数据大小不匹配", - 639
) - 640
} - 641
if config.algorithm == CompressionAlgorithm::JPEGBaseline { - 642●
compress_jpeg_simple(img, config.quality) - 643●
} else if config.algorithm == CompressionAlgorithm::PNG { - 644●
compress_png_simple(img) - 645●
} else if config.algorithm == CompressionAlgorithm::RunLengthEncoding { - 646●
let compressed = run_length_encode(img.data) - 647
let original_size = img.width * img.height - 648●
let compressed_size = compressed.length() - 649
CompressionResult::{ - 650
compressed_data: compressed, - 651
original_size, - 652
compressed_size, - 653●
compression_ratio: calculate_compression_ratio( - 654
original_size, compressed_size, - 655
), - 656●
bits_per_pixel: calculate_bits_per_pixel( - 657
compressed_size, - 658
img.width, - 659
img.height, - 660
), - 661
algorithm: CompressionAlgorithm::RunLengthEncoding, - 662
quality: 100.0, - 663
processing_time_ms: 0.0, - 664
} - 665
} else { - 666●
compress_jpeg_simple(img, config.quality) - 667
} - 668
} - 669
- 670
///| - 671
/// 获取压缩算法名称 - 672
pub fn compression_algorithm_to_string( - 673
algorithm : CompressionAlgorithm, - 674
) -> String { - 675●
if algorithm == CompressionAlgorithm::RunLengthEncoding { - 676●
"游程编码(RLE)" - 677●
} else if algorithm == CompressionAlgorithm::HuffmanCoding { - 678●
"霍夫曼编码" - 679●
} else if algorithm == CompressionAlgorithm::ArithmeticCoding { - 680●
"算术编码" - 681●
} else if algorithm == CompressionAlgorithm::LZW { - 682●
"LZW" - 683●
} else if algorithm == CompressionAlgorithm::Deflate { - 684●
"Deflate" - 685●
} else if algorithm == CompressionAlgorithm::JPEGBaseline { - 686●
"JPEG 基线" - 687●
} else if algorithm == CompressionAlgorithm::JPEG2000 { - 688●
"JPEG 2000" - 689●
} else if algorithm == CompressionAlgorithm::WebP { - 690●
"WebP" - 691●
} else if algorithm == CompressionAlgorithm::AVIF { - 692●
"AVIF" - 693●
} else if algorithm == CompressionAlgorithm::PNG { - 694●
"PNG" - 695
} else { - 696●
"未知" - 697
} - 698
} - 699
- 700
///| - 701
/// 生成压缩报告 - 702
pub fn compression_report_to_string( - 703
result : CompressionResult, - 704
metrics : CompressionQualityMetrics, - 705
) -> String { - 706●
let mut report = "## 图像压缩报告\n\n" - 707
report = report + "### 压缩信息\n\n" - 708
report = report + "| 指标 | 值 |\n|------|------|\n" - 709
report = report + - 710
"| 算法 | " + - 711●
compression_algorithm_to_string(result.algorithm) + - 712
" |\n" - 713
report = report + - 714
"| 原始大小 | " + - 715●
result.original_size.to_string() + - 716
" 字节 |\n" - 717
report = report + - 718
"| 压缩大小 | " + - 719●
result.compressed_size.to_string() + - 720
" 字节 |\n" - 721
report = report + - 722
"| 压缩比 | " + - 723●
result.compression_ratio.to_string() + - 724
":1 |\n" - 725
report = report + - 726
"| 每像素位数 | " + - 727●
result.bits_per_pixel.to_string() + - 728
" bpp |\n" - 729●
report = report + "| 质量设置 | " + result.quality.to_string() + " |\n\n" - 730
- 731
report = report + "### 质量评估\n\n" - 732
report = report + "| 指标 | 值 |\n|------|------|\n" - 733●
report = report + "| PSNR | " + metrics.psnr.to_string() + " dB |\n" - 734●
report = report + "| SSIM | " + metrics.ssim.to_string() + " |\n" - 735●
report = report + "| MSE | " + metrics.mse.to_string() + " |\n" - 736
report = report + - 737
"| 综合质量 | " + - 738●
(metrics.overall_quality * 100.0).to_string() + - 739
"% |\n" - 740
- 741
report - 742
}