Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test fails with libjpeg on Mac #18

Open
edvakf opened this issue Aug 27, 2015 · 2 comments
Open

test fails with libjpeg on Mac #18

edvakf opened this issue Aug 27, 2015 · 2 comments

Comments

@edvakf
Copy link
Contributor

edvakf commented Aug 27, 2015

I was trying around with this branch #15 and found out that there is a failing test using libjpeg whereas it is passing with libjpeg-turbo.

$ CGO_CFLAGS=-I/usr/local/opt/jpeg/include CGO_LDFLAGS=-L/usr/local/opt/jpeg/lib go test -a -test.v .
=== RUN   TestDecode
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecode (1.70s)
=== RUN   TestDecodeScaled
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecodeScaled (0.12s)
=== RUN   TestDecodeIntoRGBA
--- SKIP: TestDecodeIntoRGBA (0.00s)
    jpeg_test.go:109: This build is not support DecodeIntoRGBA.
=== RUN   TestDecodeScaledIntoRGBA
--- SKIP: TestDecodeScaledIntoRGBA (0.00s)
    jpeg_test.go:128: This build is not support DecodeIntoRGBA.
=== RUN   TestDecodeScaledIntoRGB
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecodeScaledIntoRGB (0.12s)
=== RUN   TestDecodeSubsampledImage
 - test: checkerboard_444.jpg
 - test: checkerboard_440.jpg
 - test: checkerboard_422.jpg
 - test: checkerboard_420.jpg
--- PASS: TestDecodeSubsampledImage (0.07s)
=== RUN   TestDecodeAndEncode
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecodeAndEncode (0.07s)
=== RUN   TestDecodeAndEncodeSubsampledImages
 - test: checkerboard_444.jpg
 - test: checkerboard_440.jpg
 - test: checkerboard_422.jpg
 - test: checkerboard_420.jpg
--- PASS: TestDecodeAndEncodeSubsampledImages (0.01s)
=== RUN   TestDecodeConfig
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecodeConfig (0.00s)
=== RUN   TestNewYCbCrAlignedWithLandscape
--- PASS: TestNewYCbCrAlignedWithLandscape (0.00s)
=== RUN   TestNewYCbCrAlignedWithPortrait
--- PASS: TestNewYCbCrAlignedWithPortrait (0.00s)
=== RUN   TestDecodeTestdataFromGoStdlib
--- FAIL: TestDecodeTestdataFromGoStdlib (0.11s)
    testdata_test.go:110: testdata/video-001.221212.jpeg: at (93, 0): got {96 11 0 255} want {34 106 166}
FAIL
exit status 1
FAIL    github.com/pixiv/go-libjpeg/jpeg    2.209s
$ CGO_CFLAGS=-I/usr/local/opt/jpeg-turbo/include CGO_LDFLAGS=-L/usr/local/opt/jpeg-turbo/lib go test -a -test.v .
=== RUN   TestDecode
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecode (1.69s)
=== RUN   TestDecodeScaled
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecodeScaled (0.11s)
=== RUN   TestDecodeIntoRGBA
--- SKIP: TestDecodeIntoRGBA (0.00s)
    jpeg_test.go:109: This build is not support DecodeIntoRGBA.
=== RUN   TestDecodeScaledIntoRGBA
--- SKIP: TestDecodeScaledIntoRGBA (0.00s)
    jpeg_test.go:128: This build is not support DecodeIntoRGBA.
=== RUN   TestDecodeScaledIntoRGB
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecodeScaledIntoRGB (0.13s)
=== RUN   TestDecodeSubsampledImage
 - test: checkerboard_444.jpg
 - test: checkerboard_440.jpg
 - test: checkerboard_422.jpg
 - test: checkerboard_420.jpg
--- PASS: TestDecodeSubsampledImage (0.06s)
=== RUN   TestDecodeAndEncode
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecodeAndEncode (0.03s)
=== RUN   TestDecodeAndEncodeSubsampledImages
 - test: checkerboard_444.jpg
 - test: checkerboard_440.jpg
 - test: checkerboard_422.jpg
 - test: checkerboard_420.jpg
--- PASS: TestDecodeAndEncodeSubsampledImages (0.01s)
=== RUN   TestDecodeConfig
 - test: cosmos.jpg
 - test: kinkaku.jpg
--- PASS: TestDecodeConfig (0.00s)
=== RUN   TestNewYCbCrAlignedWithLandscape
--- PASS: TestNewYCbCrAlignedWithLandscape (0.00s)
=== RUN   TestNewYCbCrAlignedWithPortrait
--- PASS: TestNewYCbCrAlignedWithPortrait (0.00s)
=== RUN   TestDecodeTestdataFromGoStdlib
--- PASS: TestDecodeTestdataFromGoStdlib (0.11s)
PASS
ok      github.com/pixiv/go-libjpeg/jpeg    2.149s

libjpeg version 8g and libjpeg-turbo 1.4.1 installed with homebrew.

@edvakf
Copy link
Contributor Author

edvakf commented Aug 27, 2015

It turned out that the lowest tolerance values for libjpeg-turbo are;

var imageTests = []imageTest{
    {"testdata/video-001.221212.png", "testdata/video-001.221212.jpeg", 8 << 6},
    // {"testdata/video-001.cmyk.png", "testdata/video-001.cmyk.jpeg", 8 << 8},
    {"testdata/video-001.png", "testdata/video-001.jpeg", 8 << 8},
    {"testdata/video-001.png", "testdata/video-001.progressive.jpeg", 8 << 8},
    {"testdata/video-001.png", "testdata/video-001.rgb.jpeg", 8 << 13},
    {"testdata/video-005.gray.png", "testdata/video-005.gray.jpeg", 8 << 8},
}

On the other hand, those for libjpeg are;

var imageTests = []imageTest{
    {"testdata/video-001.221212.png", "testdata/video-001.221212.jpeg", 8 << 11},
    // {"testdata/video-001.cmyk.png", "testdata/video-001.cmyk.jpeg", 8 << 8},
    {"testdata/video-001.png", "testdata/video-001.jpeg", 8 << 8},
    {"testdata/video-001.png", "testdata/video-001.progressive.jpeg", 8 << 8},
    {"testdata/video-001.png", "testdata/video-001.rgb.jpeg", 8 << 13},
    {"testdata/video-005.gray.png", "testdata/video-005.gray.jpeg", 8 << 8},
}

@edvakf
Copy link
Contributor Author

edvakf commented Aug 28, 2015

We should probably stop comparing dot by dot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant