[SCM] libav/experimental: huffman: pass hnode_first as a flag instead of as an argument on its own

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:16:37 UTC 2013


The following commit has been merged in the experimental branch:
commit bac02ed3c5004f4944cdeb97c4341925196b50d8
Author: Aurelien Jacobs <aurel at gnuage.org>
Date:   Sat Mar 8 17:57:13 2008 +0000

    huffman: pass hnode_first as a flag instead of as an argument on its own
    
    Originally committed as revision 12373 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/huffman.c b/libavcodec/huffman.c
index 43a7855..0bc1bc6 100644
--- a/libavcodec/huffman.c
+++ b/libavcodec/huffman.c
@@ -64,7 +64,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head)
  * first nb_codes nodes.count must be set
  */
 int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
-                       Node *nodes, huff_cmp_t cmp, int hnode_first)
+                       Node *nodes, huff_cmp_t cmp, int flags)
 {
     int i, j;
     int cur_node;
@@ -90,7 +90,8 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
         for(j = cur_node; j > 0; j--){
             if(nodes[j].count > nodes[j-1].count ||
                (nodes[j].count == nodes[j-1].count &&
-                (!hnode_first || nodes[j].n0==j-1 || nodes[j].n0==j-2 ||
+                (!(flags & FF_HUFFMAN_FLAG_HNODE_FIRST) ||
+                 nodes[j].n0==j-1 || nodes[j].n0==j-2 ||
                  (nodes[j].sym!=HNODE && nodes[j-1].sym!=HNODE))))
                 break;
             FFSWAP(Node, nodes[j], nodes[j-1]);
diff --git a/libavcodec/huffman.h b/libavcodec/huffman.h
index 57fbefa..0b6ff40 100644
--- a/libavcodec/huffman.h
+++ b/libavcodec/huffman.h
@@ -32,8 +32,10 @@ typedef struct {
     uint32_t count;
 } Node;
 
+#define FF_HUFFMAN_FLAG_HNODE_FIRST 0x01
+
 typedef int (*huff_cmp_t)(const void *va, const void *vb);
 int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
-                       Node *nodes, huff_cmp_t cmp, int hnode_first);
+                       Node *nodes, huff_cmp_t cmp, int flags);
 
 #endif /* FFMPEG_HUFFMAN_H */
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index 26943e5..1b59ecd 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -224,7 +224,8 @@ static void vp6_build_huff_tree(vp56_context_t *s, uint8_t coeff_model[],
     }
 
     /* then build the huffman tree accodring to probabilities */
-    ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp, 1);
+    ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp,
+                       FF_HUFFMAN_FLAG_HNODE_FIRST);
 }
 
 static void vp6_parse_coeff_models(vp56_context_t *s)

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list