lib/lowleveljpeg: s/ExtractFrom/ExtractYCbCrFrom/
diff --git a/lib/handsum/handsum.go b/lib/handsum/handsum.go index 3a95e9f..5bf52f4 100644 --- a/lib/handsum/handsum.go +++ b/lib/handsum/handsum.go
@@ -293,7 +293,7 @@ alphasQuadBlock := lowleveljpeg.QuadBlockU8{} dst := scaleSrc(src, &alphasQuadBlock) dstU8s := lowleveljpeg.Array6BlockU8{} - dstU8s.ExtractFrom(dst, 0, 0) + dstU8s.ExtractYCbCrFrom(dst, 0, 0) // Biasing the Chroma blocks by +8 shifts the neutral (gray) Chroma values // from 0x80 to 0x88. DC coefficient bias-and-quantization can losslessly
diff --git a/lib/lowleveljpeg/example_basic_test.go b/lib/lowleveljpeg/example_basic_test.go index e8c5c2e..575ceb5 100644 --- a/lib/lowleveljpeg/example_basic_test.go +++ b/lib/lowleveljpeg/example_basic_test.go
@@ -55,7 +55,7 @@ srcI16s := lowleveljpeg.Array6BlockI16{} for y := bounds.Min.Y; y < bounds.Max.Y; y += dy { for x := bounds.Min.X; x < bounds.Max.X; x += dx { - srcU8s.ExtractFrom(src, x, y) + srcU8s.ExtractYCbCrFrom(src, x, y) srcI16s.ForwardDCTFrom(&srcU8s) if err := enc.Add6(buf, &srcI16s); err != nil { log.Fatalf("enc.Add6: %v", err)
diff --git a/lib/lowleveljpeg/example_ycbcr444_test.go b/lib/lowleveljpeg/example_ycbcr444_test.go index eef0615..d493d24 100644 --- a/lib/lowleveljpeg/example_ycbcr444_test.go +++ b/lib/lowleveljpeg/example_ycbcr444_test.go
@@ -172,7 +172,7 @@ srcI16s := lowleveljpeg.Array3BlockI16{} for y := bounds.Min.Y; y < bounds.Max.Y; y += 8 { for x := bounds.Min.X; x < bounds.Max.X; x += 8 { - srcU8s.ExtractFrom(src, x, y) + srcU8s.ExtractYCbCrFrom(src, x, y) example.transform(&srcI16s, &srcU8s) if err := enc.Add3(buf, &srcI16s); err != nil { log.Fatalf("enc.Add3: %v", err)
diff --git a/lib/lowleveljpeg/extract.go b/lib/lowleveljpeg/extract.go index bc98fd1..ef22cec 100644 --- a/lib/lowleveljpeg/extract.go +++ b/lib/lowleveljpeg/extract.go
@@ -15,9 +15,9 @@ "image/color" ) -// ExtractFrom sets dst to a single channel (Gray) 8×8 MCU (Minimum Coded +// ExtractYCbCrFrom sets dst to a single channel (Gray) 8×8 MCU (Minimum Coded // Unit), with the given top-left corner, from the image m. -func (dst *Array1BlockU8) ExtractFrom(m image.Image, topLeftX int, topLeftY int) { +func (dst *Array1BlockU8) ExtractYCbCrFrom(m image.Image, topLeftX int, topLeftY int) { if dst == nil { return } @@ -57,10 +57,10 @@ fillRightAndDown(&dst[0], topLeftX, topLeftY, bounds.Max.X, bounds.Max.Y) } -// ExtractFrom sets dst to a three channel (Luma, Chroma-blue, Chroma-red) 8×8 -// 4:4:4 MCU (Minimum Coded Unit), with the given top-left corner, from the +// ExtractYCbCrFrom sets dst to a three channel (Luma, Chroma-blue, Chroma-red) +// 8×8 4:4:4 MCU (Minimum Coded Unit), with the given top-left corner, from the // image m. -func (dst *Array3BlockU8) ExtractFrom(m image.Image, topLeftX int, topLeftY int) { +func (dst *Array3BlockU8) ExtractYCbCrFrom(m image.Image, topLeftX int, topLeftY int) { if dst == nil { return } @@ -116,7 +116,7 @@ fillRightAndDown(&dst[2], topLeftX, topLeftY, bounds.Max.X, bounds.Max.Y) } -// ExtractFrom sets dst to a three channel (Luma, Chroma-blue, Chroma-red) +// ExtractYCbCrFrom sets dst to a three channel (Luma, Chroma-blue, Chroma-red) // 16×16 4:2:0 MCU (Minimum Coded Unit, with the given top-left corner, from // the image m. // @@ -127,7 +127,7 @@ // - Luma bottom right // - Chroma-blue // - Chroma-red -func (dst *Array6BlockU8) ExtractFrom(m image.Image, topLeftX int, topLeftY int) { +func (dst *Array6BlockU8) ExtractYCbCrFrom(m image.Image, topLeftX int, topLeftY int) { if dst == nil { return } @@ -137,10 +137,10 @@ } tmp := [4]Array3BlockU8{} - tmp[0].ExtractFrom(m, topLeftX+0, topLeftY+0) - tmp[1].ExtractFrom(m, topLeftX+8, topLeftY+0) - tmp[2].ExtractFrom(m, topLeftX+0, topLeftY+8) - tmp[3].ExtractFrom(m, topLeftX+8, topLeftY+8) + tmp[0].ExtractYCbCrFrom(m, topLeftX+0, topLeftY+0) + tmp[1].ExtractYCbCrFrom(m, topLeftX+8, topLeftY+0) + tmp[2].ExtractYCbCrFrom(m, topLeftX+0, topLeftY+8) + tmp[3].ExtractYCbCrFrom(m, topLeftX+8, topLeftY+8) dst[0] = tmp[0][0] dst[1] = tmp[1][0]
diff --git a/lib/lowleveljpeg/lowleveljpeg.go b/lib/lowleveljpeg/lowleveljpeg.go index c4c2e55..9d59418 100644 --- a/lib/lowleveljpeg/lowleveljpeg.go +++ b/lib/lowleveljpeg/lowleveljpeg.go
@@ -101,9 +101,9 @@ // AddN takes ArrayNBlockI16 arguments, which are post-FDCT (when encoding) or // pre-IDCT (when decoding) coefficients. // -// To get ArrayNBlockI16 values from pixels, use ExtractFrom on an image.Image -// (to get an array of BlockU8 values) and then FowardDCTFrom (to get an array -// of BlockI16 values). See Example_basic for an example. +// To get ArrayNBlockI16 values from pixels, use ExtractYCbCrFrom on an +// image.Image (to get an array of BlockU8 values) and then FowardDCTFrom (to +// get an array of BlockI16 values). See Example_basic for an example. // // An Encoder makes no allocations, other than the Encoder struct itself and // any allocations that the passed io.Writer makes.
diff --git a/lib/lowleveljpeg/lowleveljpeg_test.go b/lib/lowleveljpeg/lowleveljpeg_test.go index cb6bd1f..dfbeab1 100644 --- a/lib/lowleveljpeg/lowleveljpeg_test.go +++ b/lib/lowleveljpeg/lowleveljpeg_test.go
@@ -97,7 +97,7 @@ srcI16s := Array1BlockI16{} for y := bounds.Min.Y; y < bounds.Max.Y; y += 8 { for x := bounds.Min.X; x < bounds.Max.X; x += 8 { - srcU8s.ExtractFrom(src, x, y) + srcU8s.ExtractYCbCrFrom(src, x, y) srcI16s.ForwardDCTFrom(&srcU8s) if err := enc.Add1(buf, &srcI16s); err != nil { tt.Fatalf("enc.Add1: %v", err) @@ -110,7 +110,7 @@ srcI16s := Array3BlockI16{} for y := bounds.Min.Y; y < bounds.Max.Y; y += 8 { for x := bounds.Min.X; x < bounds.Max.X; x += 8 { - srcU8s.ExtractFrom(src, x, y) + srcU8s.ExtractYCbCrFrom(src, x, y) srcI16s.ForwardDCTFrom(&srcU8s) if err := enc.Add3(buf, &srcI16s); err != nil { tt.Fatalf("enc.Add3: %v", err)