wagpa / go-quiteok

A small encode/decoder implementation of the QuiteOk Image Format
MIT License
1 stars 0 forks source link

Parallelization #1

Open wagpa opened 1 year ago

wagpa commented 1 year ago

Try to parallelize as much of the decoder (and encode) as possible.

(Mostly to learn goroutines)

wagpa commented 1 year ago

Use a worker pool with one master. The master decodes the byte stream in linear, adding the found byte blocks (op with its data bytes) to a buffer.

The worker pool then selects blocks that can be decoded at that time. The order would be something like this.

  1. OpRgba (any time)
  2. OpRgb (when previous)
  3. OpRun (when previous)
  4. OpDiff (when previous)
  5. OpLuma (when previous)
  6. OpIndex (when all previous to pixel with matching hash)
wagpa commented 1 year ago

The seen (hash map) buffer could be modified to store multiple hashes with the pixel index they came from.