[FFmpeg-devel] [PATCH 12/24] avcodec/mjpegenc: add support for non-YUVJ formats

Michael Niedermayer michael at niedermayer.cc
Wed May 2 02:30:11 EEST 2018


On Wed, May 02, 2018 at 12:22:10AM +0200, Paul B Mahol wrote:
> On 5/2/18, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > Hi
> >
> > On Tue, May 01, 2018 at 09:40:01PM +0200, Paul B Mahol wrote:
> >> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> >> ---
> >>  libavcodec/mjpegenc.c      | 5 ++++-
> >>  libavcodec/mpegvideo_enc.c | 3 +--
> >>  tests/lavf-regression.sh   | 2 +-
> >>  3 files changed, 6 insertions(+), 4 deletions(-)
> >
> > This doesnt work
> 
> It does work, if you want full range set full range as option.


> Check visually colors.

They vissually look wrong too same as the gimp color picker would suggest


> This happens because rgb is still marked incorrectly as limited range,
> so limited is picked instead.

no, that is not the problem.
We could take a mpeg2 file as input which is limited range "always"
that takes rgb completely out of the picture
and you still should have a jpeg file that will look wrong vissually 
in many jpeg decoders.

libavcodec supports the inofficial limited range extension so that will look
correct.


> 
> >
> > first create a input file
> > ./ffmpeg -f lavfi -i testsrc=640x480 test.ppm
> > (if you like check that this has correct white and black) 0,0,0 and
> > 255,255,255
> >
> > now convert to jpeg
> > ./ffmpeg -i test.ppm test.jpg
> > gimp test.jpg
> >
> > white and black have RGB values: 16,16,16 and 235,235,235 thats not correct
> > and also looks wrong
> >
> > the strict_std_compliance check that was before this cannot be just droped
> >
> > If you want jpeg images to interoperate with all software they must be full
> >
> > range
> > the limited range is a not entirely official feature. So it should not be
> > used by default
> > (that is AFAIK, things may have changed and maybe theres a official way now
> >  but from what i remember there was not for images)
> 
> Better check actual paper.

I think whoever changes what the encoder outputs should check it
its JFIF 1.02 for images. See "Conversion to and from RGB"

"Y, Cb, and Cr are converted from R, G, and B as defined in CCIR Recommendation 601
 but are normalized so as to occupy the full 256 levels of a 8-bit binary encoding."
 

 
[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180502/589b0ecf/attachment.sig>


More information about the ffmpeg-devel mailing list