[FFmpeg-devel] [PATCH] Implement optimal huffman encoding for (M)JPEG.

Michael Niedermayer michael at niedermayer.cc
Wed Dec 28 14:50:50 EET 2016


On Wed, Dec 28, 2016 at 01:22:14AM -0500, Jerry Jiang wrote:
> Hey everyone,
> 
> I made a completely new patch to both fix the newline corruption (hopefully),
> and to address comments. Also, I found that one of the tests wasn't being
> checked, so I fixed that too.
> 
> > your patch is missing docs (document -huffman optimal by creating mjpeg
> > encoder section in doc/encoders.texi)
> 
> Added.
> 
> > and changelog entry (Optimal Huffman tables for MJPEG encoding).
> 
> Added.
> 
> > For readability, '1' and '2', which are just arbitrary numbers, could
> > be expressed with enums (starting with 0, as we do in the C world ;-)).
> 
> Fixed.
> 
> > Doesn't ffmpeg have a macro for this? FFSIGN(a->prob - b->prob); ?
> 
> Fixed using FFDIFFSIGN.
> 
> ---
>  Changelog                                    |   1 +
>  doc/encoders.texi                            |  21 +++
>  libavcodec/Makefile                          |   8 +-
>  libavcodec/mjpegenc.c                        | 265 +++++++++++++++++++--------
>  libavcodec/mjpegenc.h                        |  68 ++++++-
>  libavcodec/mjpegenc_common.c                 | 161 ++++++++++++++--
>  libavcodec/mjpegenc_common.h                 |   2 +
>  libavcodec/mjpegenc_huffman.c                | 190 +++++++++++++++++++
>  libavcodec/mjpegenc_huffman.h                |  71 +++++++
>  libavcodec/mpegvideo.h                       |   1 +
>  libavcodec/mpegvideo_enc.c                   |   5 +-
>  libavcodec/tests/.gitignore                  |   1 +
>  libavcodec/tests/mjpegenc_huffman.c          | 144 +++++++++++++++
>  tests/fate/libavcodec.mak                    |   6 +
>  tests/fate/vcodec.mak                        |   4 +-
>  tests/ref/vsynth/vsynth1-mjpeg-huffman       |   4 +
>  tests/ref/vsynth/vsynth1-mjpeg-trell-huffman |   4 +
>  tests/ref/vsynth/vsynth2-mjpeg-huffman       |   4 +
>  tests/ref/vsynth/vsynth2-mjpeg-trell-huffman |   4 +
>  tests/ref/vsynth/vsynth3-mjpeg-huffman       |   4 +
>  tests/ref/vsynth/vsynth3-mjpeg-trell-huffman |   4 +
>  21 files changed, 865 insertions(+), 107 deletions(-)
>  create mode 100644 libavcodec/mjpegenc_huffman.c
>  create mode 100644 libavcodec/mjpegenc_huffman.h
>  create mode 100644 libavcodec/tests/mjpegenc_huffman.c
>  create mode 100644 tests/ref/vsynth/vsynth1-mjpeg-huffman
>  create mode 100644 tests/ref/vsynth/vsynth1-mjpeg-trell-huffman
>  create mode 100644 tests/ref/vsynth/vsynth2-mjpeg-huffman
>  create mode 100644 tests/ref/vsynth/vsynth2-mjpeg-trell-huffman
>  create mode 100644 tests/ref/vsynth/vsynth3-mjpeg-huffman
>  create mode 100644 tests/ref/vsynth/vsynth3-mjpeg-trell-huffman

missing some reference files, failing fate:
reference file './tests/ref/vsynth/vsynth_lena-mjpeg-huffman' not found
./tests/fate-run.sh: 374: ./tests/fate-run.sh: cannot open tests/data/fate/vsynth_lena-mjpeg-huffman.diff: No such file
Test vsynth_lena-mjpeg-huffman failed. Look at tests/data/fate/vsynth_lena-mjpeg-huffman.err for details.
make: *** [fate-vsynth_lena-mjpeg-huffman] Error 1
make: *** Waiting for unfinished jobs....
reference file './tests/ref/vsynth/vsynth_lena-mjpeg-trell-huffman' not found
./tests/fate-run.sh: 374: ./tests/fate-run.sh: cannot open tests/data/fate/vsynth_lena-mjpeg-trell-huffman.diff: No such file
Test vsynth_lena-mjpeg-trell-huffman failed. Look at tests/data/fate/vsynth_lena-mjpeg-trell-huffman.err for details.
make: *** [fate-vsynth_lena-mjpeg-trell-huffman] Error 1

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161228/ac96bb97/attachment.sig>


More information about the ffmpeg-devel mailing list