Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

decompressor_unexpected_chroma_sampling when transcoding image from CandyCam app. #8

Closed
MarsVard opened this issue Nov 23, 2018 · 4 comments
Labels
bug Something isn't working fixed - waiting for release Marks issues that have been fixed and will ship with the next release.

Comments

@MarsVard
Copy link

I'm not sure if it's a specific issue with their app or if something is missing from this library. But I noticed this in my user base.

I will update this thread as soon as I have more information.

W/SpectrumLogger: requestid:5, error:decompressor_unexpected_chroma_sampling
    SpectrumException{name='decompressor_unexpected_chroma_sampling', message='decompressor_unexpected_chroma_sampling', location='image::ChromaSamplingMode facebook::spectrum::plugins::jpeg::LibJpegDecompressor::_chromaSamplingMode():103', description='decompressor_unexpected_chroma_sampling#-image::ChromaSamplingMode facebook::spectrum::plugins::jpeg::LibJpegDecompressor::_chromaSamplingMode():103'}
@lambdapioneer
Copy link
Contributor

lambdapioneer commented Nov 25, 2018

Hey @MarsVard, thanks for rising the issue!

I've been able to reproduce this by capturing an image with "Candy Camera" and decoding/transcoding with the sample Spectrum app. I've also downloaded the image to my development device and observed that it is using 4:1:1 chroma sub-sampling:

$ identify -verbose myimage.jpg | grep sampling
    jpeg:sampling-factor: 4x1,1x1,1x1

Our C++ code is incomplete regarding this particular sub-sampling mode of 4:1:1. It's also missing 4:4:0. The reason for this is that we didn't have evidence that these mode are practically used. This seems to be the case though and I'll try to push an update this week,.

Code pointer of supported chroma sub-sampling to date: https://github.com/facebookincubator/spectrum/blob/master/cpp/spectrum/image/Specification.h#L23-L31

/**
 * Chroma sampling describe the number of luma information per chroma
 * information.
 */
enum class ChromaSamplingMode {
  S444 = 0,
  S420 = 1,
  S422 = 2,
};

This is a super helpful information for us, thanks a lot for sharing!

@lambdapioneer lambdapioneer added the bug Something isn't working label Nov 25, 2018
facebook-github-bot pushed a commit that referenced this issue Nov 28, 2018
Summary:
Adding support for 4:1:1 and 4:4:0 sub-sampling as discussed in #8

**Test plan**

Followed the reproduction steps from the file with a file captured in 4:1:1 as input.

Before:
 ```
SpectrumException{
  name='decompressor_unexpected_chroma_sampling',
  message='decompressor_unexpected_chroma_sampling',
  location='image::ChromaSamplingMode     facebook::spectrum::plugins::jpeg::LibJpegDecompressor::_chromaSamplingMode():103',
  ...
```

After:
```
SpectrumResult{
  ruleName='base',
  inputImageSpecification=ImageSpecification{size=ImageSize{width=1431, height=2688}, format=jpeg, pixelSpecification=ImagePixelSpecification{colorModel=RGB, bytesPerPixel=3, alphaInfo=NONE, componentsOrder=NATURAL}, orientation=UP, chromaSamplingMode=S411, metadata=ImageMetadata{}},
  outputImageSpecification=ImageSpecification{size=ImageSize{width=533, height=1000}, format=jpeg, pixelSpecification=ImagePixelSpecification{colorModel=RGB, bytesPerPixel=3, alphaInfo=NONE, componentsOrder=NATURAL}, orientation=UP, chromaSamplingMode=S420, metadata=ImageMetadata{}},
  totalBytesRead=1854587,
  totalBytesWritten=58664
}
```

Reviewed By: cuva

Differential Revision: D13233286

fbshipit-source-id: 408cf5f74a6c1dedefa35b92449923e3c73b8dc6
@lambdapioneer
Copy link
Contributor

Fixed in master by d36ba0e and will be going out with the next release :)

@lambdapioneer lambdapioneer added the fixed - waiting for release Marks issues that have been fixed and will ship with the next release. label Nov 29, 2018
@MarsVard
Copy link
Author

That's fast! Awesome!

@lambdapioneer
Copy link
Contributor

This is fixed with the 1.0.0 release: https://github.com/facebookincubator/spectrum/releases/tag/v1.0.0

Closing :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed - waiting for release Marks issues that have been fixed and will ship with the next release.
Projects
None yet
Development

No branches or pull requests

3 participants
@lambdapioneer @MarsVard and others