Code Monkey home page Code Monkey logo

Comments (4)

stapelberg avatar stapelberg commented on June 7, 2024

This is the stack trace of where the (first) error occurs:

log.Panicf({0x4b72eb?, 0x17?}, {0xc00011abc0?, 0x493d4b?, 0xc0006c4000?})
	/home/michael/sdk/go1.18/src/log/log.go:392 +0x67
github.com/stapelberg/scan2drive/internal/stdjpeg.(*decoder).readByteStuffedByte(0xc0006c4000?)
	/home/michael/go/src/github.com/stapelberg/scan2drive/internal/stdjpeg/reader.go:219 +0xf8
github.com/stapelberg/scan2drive/internal/stdjpeg.(*decoder).ensureNBits(0xc0006c4000, 0x8)
	/home/michael/go/src/github.com/stapelberg/scan2drive/internal/stdjpeg/huffman.go:50 +0x2b
github.com/stapelberg/scan2drive/internal/stdjpeg.(*decoder).decodeHuffman(0xc0006c4000, 0xc0006c6060)
	/home/michael/go/src/github.com/stapelberg/scan2drive/internal/stdjpeg/huffman.go:184 +0x45
github.com/stapelberg/scan2drive/internal/stdjpeg.(*decoder).processSOS(0xc0006c4000, 0xa)
	/home/michael/go/src/github.com/stapelberg/scan2drive/internal/stdjpeg/scan.go:254 +0xd7d
github.com/stapelberg/scan2drive/internal/stdjpeg.(*decoder).decode(0xc0006c4000, {0x4d57e0?, 0xc0001201b0?}, 0x0)
	/home/michael/go/src/github.com/stapelberg/scan2drive/internal/stdjpeg/reader.go:632 +0x19b
github.com/stapelberg/scan2drive/internal/stdjpeg.Decode(...)
	/home/michael/go/src/github.com/stapelberg/scan2drive/internal/stdjpeg/reader.go:781
main.incompat()
	/home/michael/go/src/github.com/stapelberg/scan2drive/_incompat/incompat.go:18 +0xf2
main.main()
	/home/michael/go/src/github.com/stapelberg/scan2drive/_incompat/incompat.go:28 +0x19
exit status 2

Compilation exited abnormally with code 1 at Sat Apr 16 14:21:40

from scan2drive.

stapelberg avatar stapelberg commented on June 7, 2024

When encoding a 4960x16 image file of all-red pixels, the entropy-coded segment differs in an additional 2 bytes:

--- scan2drive/internal/neonjpeg	2022-04-16 16:31:38.979975747 +0200
+++ image/jpeg 2022-04-16 16:31:38.983309143 +0200
@@ -39,5 +39,5 @@
 00000260  e8 a2 8a f9 93 f7 10 a2  8a 28 00 a2 8a 28 00 a2  |.........(...(..|
 00000270  8a 28 00 a2 8a 28 00 a2  8a 28 00 a2 8a 28 00 a2  |.(...(...(...(..|
 *
-00000730  8a 28 00 a2 8a 28 00 a2  8a ff d9                 |.(...(.....|
-0000073b
+00000730  8a 28 00 a2 8a 28 00 a2  8a 28 03 ff d9           |.(...(...(...|
+0000073d

from scan2drive.

stapelberg avatar stapelberg commented on June 7, 2024

While the above fixes fix some of the issues, there are still others that are harder to diagnose.

Perhaps linking against turbojpeg using cgo is preferable after all (behind a build tag), even if it means that building the optimized version becomes significantly harder (you’ll need aarch64-linux-gnu-gcc installed, and an arm64 version of libturbojpeg.a).

from scan2drive.

stapelberg avatar stapelberg commented on June 7, 2024

Preliminary results on a Raspberry Pi 4:

  • 1.88s using neonjpeg
  • 1.36s using turbojpeg, encoding 1 scanline at a time
  • 1.24s using turbojpeg, encoding 16 scanlines at a time

Unfortunately, neither https://github.com/pixiv/go-libjpeg nor https://github.com/bmharper/turbo support a streaming API, so we’ll need a custom fork (temporarily at least).

from scan2drive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.