annotate huffman.h @ 10842:77dbd6ab2db9 libavcodec

Optimize ff_snow_horizontal_compose97i. this makes the 9/7 C wavelet at the decoder side 22% faster. The old code is changed to match the new in terms of the order of operations (which also makes it sligtly faster)
author michael
date Mon, 11 Jan 2010 02:52:50 +0000
parents 0dce4fe6e6f3
children 7dd2a45249a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5820
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
1 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8299
diff changeset
2 * @file libavcodec/huffman.h
5820
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
3 * huffman tree builder and VLC generator
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
4 * Copyright (C) 2007 Aurelien Jacobs <aurel@gnuage.org>
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
5 *
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
6 * This file is part of FFmpeg.
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
7 *
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
12 *
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
16 * Lesser General Public License for more details.
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
17 *
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
21 */
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
22
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6473
diff changeset
23 #ifndef AVCODEC_HUFFMAN_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6473
diff changeset
24 #define AVCODEC_HUFFMAN_H
5820
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
25
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
26 #include "avcodec.h"
9428
0dce4fe6e6f3 Rename bitstream.h to get_bits.h.
stefano
parents: 8718
diff changeset
27 #include "get_bits.h"
5820
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
28
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
29 typedef struct {
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
30 int16_t sym;
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
31 int16_t n0;
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
32 uint32_t count;
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
33 } Node;
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
34
6472
e39e03d99d24 huffman: pass hnode_first as a flag instead of as an argument on its own
aurel
parents: 5881
diff changeset
35 #define FF_HUFFMAN_FLAG_HNODE_FIRST 0x01
6473
e0cd9697ac6d huffman: add a zero_count flag and use it in fraps
aurel
parents: 6472
diff changeset
36 #define FF_HUFFMAN_FLAG_ZERO_COUNT 0x02
6472
e39e03d99d24 huffman: pass hnode_first as a flag instead of as an argument on its own
aurel
parents: 5881
diff changeset
37
8299
524cb7f5ad2b avoid POSIX reserved _t suffix
aurel
parents: 7760
diff changeset
38 typedef int (*HuffCmp)(const void *va, const void *vb);
5820
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
39 int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
8299
524cb7f5ad2b avoid POSIX reserved _t suffix
aurel
parents: 7760
diff changeset
40 Node *nodes, HuffCmp cmp, int flags);
5820
ffac546a3861 moves fraps huffman decoder to its own file, making it more generic
aurel
parents:
diff changeset
41
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6473
diff changeset
42 #endif /* AVCODEC_HUFFMAN_H */