image-rs / jpeg-decoder

JPEG decoder written in Rust -- currently in maintenance mode
Apache License 2.0
148 stars 89 forks source link

Support more chroma subsampling ratios #48

Closed kaksmet closed 7 years ago

kaksmet commented 8 years ago

Implementing a generic integer upsampler will allow us to support most chroma subsampling ratios.

samuknet commented 8 years ago

Would this be something I could work on/help with? I'm quite new to Rust, though.

kaksmet commented 8 years ago

Absolutely, it should be easy enough for you.

You can start by adding a UpsamplerGeneric(u8, u8) struct to upsampler.rs. It's fields should be used to store the horizontal and vertical scaling factors. Then in choose_upsampler, return UpsamplerGeneric where UnsupportedFeature::SubsamplingRatio is currently returned. The last step is to implement the Upsample trait. Nearest neighbour sampling will be good enough here.

Feel free to ask for help if you need it.

(I enjoyed your presentation btw)

samuknet commented 8 years ago

Ok great :) Currently working on this, might come back with some questions. And thanks, glad you liked it :)

samuknet commented 8 years ago

Where do you reckon is a good start point for implementing the nearest neighbour sampling? Could you give me a few pointers? :)

kaksmet commented 8 years ago

Nearest neighbour sampling means that the nearest pixel is chosen, no blending between pixels is performed. In practice this means that when you are implementing upsample_row you will basically just write each input pixel n times to output, where n is the horizontal scaling factor. Then do the same thing again, but in the vertical direction.

ghost commented 7 years ago

I would like to work on this.

kaksmet commented 7 years ago

@iamrohit7 that would be great. It doesn't seem like @samuknet is still working on this.

samuknet commented 7 years ago

@iamrohit7 go for it! I'll be following along :)