script: add truncate-progressive-jpeg.go

"script/confirm-matches-djpeg.sh test/data/*.jpeg" shows differences on
"test/data/peacock.progressive.scan00[0-8].jpeg".
This commit is contained in:
Nigel Tao committed 2023-06-01 22:32:37 +10:00
1 parent 50d765839c
commit 27a3197727
15 files changed
+134 -10

No files matched your search

+13 -10
View File
@@ -146,16 +146,19 @@ pub struct decoder? implements base.image_decoder(
// is a special case, meaning the scan holds (8 - Al) bits.
//
// The test/data/peacock.progressive.jpeg file has 10 scans:
// 1. Ss = 0 Se = 0 Ah = 0 Al = 1 3 components (Y, Cb, Cr)
// 2. Ss = 1 Se = 5 Ah = 0 Al = 2 1 component (Y)
// 3. Ss = 1 Se = 63 Ah = 0 Al = 1 1 component (Cr)
// 4. Ss = 1 Se = 63 Ah = 0 Al = 1 1 component (Cb)
// 5. Ss = 6 Se = 63 Ah = 0 Al = 2 1 component (Y)
// 6. Ss = 1 Se = 63 Ah = 2 Al = 1 1 component (Y)
// 7. Ss = 0 Se = 0 Ah = 1 Al = 0 3 components (Y, Cb, Cr)
// 8. Ss = 1 Se = 63 Ah = 1 Al = 0 1 component (Cr)
// 9. Ss = 1 Se = 63 Ah = 1 Al = 0 1 component (Cb)
// 10. Ss = 1 Se = 63 Ah = 1 Al = 0 1 component (Y)
// 0: Ss = 0 Se = 0 Ah = 0 Al = 1 3 components (Y, Cb, Cr)
// 1: Ss = 1 Se = 5 Ah = 0 Al = 2 1 component (Y)
// 2: Ss = 1 Se = 63 Ah = 0 Al = 1 1 component (Cr)
// 3: Ss = 1 Se = 63 Ah = 0 Al = 1 1 component (Cb)
// 4: Ss = 6 Se = 63 Ah = 0 Al = 2 1 component (Y)
// 5: Ss = 1 Se = 63 Ah = 2 Al = 1 1 component (Y)
// 6: Ss = 0 Se = 0 Ah = 1 Al = 0 3 components (Y, Cb, Cr)
// 7: Ss = 1 Se = 63 Ah = 1 Al = 0 1 component (Cr)
// 8: Ss = 1 Se = 63 Ah = 1 Al = 0 1 component (Cb)
// 9: Ss = 1 Se = 63 Ah = 1 Al = 0 1 component (Y)
//
// This matches /usr/bin/cjpeg's default script for progressive YCbCr:
// https://github.com/libjpeg-turbo/libjpeg-turbo/blob/2192560d74e6e6cf99dd05928885573be00a8208/jcparam.c#L517-L535
//
// The first scan holds the high 7 bits of all components' DC
// coefficients.