diff options
author | Christophe Gisquet <christophe.gisquet@gmail.com> | 2014-06-11 22:15:12 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-19 06:03:51 +0200 |
commit | e7fc5d53a02c07e75a2254839a452e1cbf830d3a (patch) | |
tree | 0ac6209a91af615223e59fb2b8b49dc87e602ea0 /libavcodec | |
parent | 042a82ca374b491903036872ebd487c5ceb17a63 (diff) | |
download | ffmpeg-e7fc5d53a02c07e75a2254839a452e1cbf830d3a.tar.gz |
huffyuv: change statistics initialization
Normally, a Laplace distribution is more typical of the residuals
encoded, but for noisy input, it's both better and simpler to be
safe and use a 1/d^2 distribution. Second hunk could use some
renormalization but it has effectively little impact.
Output size of ffvhuff on various 4:2:0 sequences:
context=0,1/d: 851974 27226 1137281
context=0,1/d²: 619081 25069 1051500
context=0,1/d³: 501983 30454 1290561
context=0,lapl: 500650 31754 1304082
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/huffyuvenc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 0ed2c1d127..157d67f281 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -400,7 +400,7 @@ static av_cold int encode_init(AVCodecContext *avctx) for (j = 0; j < s->vlc_n; j++) { int d = FFMIN(j, s->vlc_n - j); - s->stats[i][j] = 100000000 / (d + 1); + s->stats[i][j] = 100000000 / (d*d + 1); } } @@ -414,7 +414,7 @@ static av_cold int encode_init(AVCodecContext *avctx) int pels = s->width * s->height / (i ? 40 : 10); for (j = 0; j < s->vlc_n; j++) { int d = FFMIN(j, s->vlc_n - j); - s->stats[i][j] = pels/(d + 1); + s->stats[i][j] = pels/(d*d + 1); } } } else { |