Quoth [email protected]:
> Quoth [email protected]:
> > Quoth [email protected]:
> > > Hello 9fans,
> > > For me, jpg(1) can't display most jpeg images I have.  So I made a go
> > > program that convert a jpeg image from stdin to a png image to stdout.
> > > Assume that Plan 9's png is not broken ;)
> > > 
> > > To test, go to https://thuychi.vn/anh.html
> > > Of 50 images, Plan 9's jpg could only decode 3.  The go library can
> > > decode all of them.
> > > 
> > > I hope that there will be go image/plan9 and a draw library that works
> > > on Plan 9 too...  Replace the jpg(1) programs with the Go version!
> > > 
> > > bind /bin/jpgtopng.rc /bin/jpg, I think at least abaco don't need to
> > > be modified.
> > > 
> > 
> > Great, I think you just reminded me of an old bug in jpg that I'd
> > been looking into (and then got distracted from). It looks like when
> > we decode jpg images, we mishandle progresive jpgs that have scans
> > that don't use interleaving, and have subsampled components. These
> > aren't too common, but you'll run across them in the wild.
> > 
> > Normally, we'll end up with the luminance channel coming through,
> > but the chroma channels completely broken.
> > Now that I'm looking at it again, I think this has something to do
> > with how we walk the scans; data either comes in MCU or scan order,
> > and we may be mangling this.
> > 
> > this may not be so hard to fix.
> > 
> 
> Alright, I think I found/fixed up the patch; there were two
> issues that we had; first, when decoding the DC components, for
> scans where Ns=1, we need to handle them in raster order, not
> MCU order[1].  The change to progressivedc() handles the Nf==1
> case to deal with the different scan order.
> 
> The second case was that we don't need to have all frame
> components present in the scan, and we needed to use Csj (the
> component selector to pick the appropriate mage components from
> the scan header.
> 
> [1] https://www.w3.org/Graphics/JPEG/itu-t81.pdf, A.2.2
> [2] https://www.w3.org/Graphics/JPEG/itu-t81.pdf, B.2.3
> 

Whoops, had an out of bounds write, and now that I'm paging it
in, I think I want to refactor the change and detangle a bit.


------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T33c04c0193c96a35-M9e590a637bd08c89cc18c557
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to