2011-07-14 04:11:19 +03:00
|
|
|
/*
|
2007-10-15 00:19:40 +03:00
|
|
|
* Copyright (C) 2007 Aurelien Jacobs <aurel@gnuage.org>
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2011-07-14 04:11:19 +03:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* huffman tree builder and VLC generator
|
|
|
|
*/
|
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#ifndef AVCODEC_HUFFMAN_H
|
|
|
|
#define AVCODEC_HUFFMAN_H
|
2007-10-15 00:19:40 +03:00
|
|
|
|
2021-07-30 13:13:45 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2016-05-14 11:45:01 +02:00
|
|
|
#include "vlc.h"
|
2007-10-15 00:19:40 +03:00
|
|
|
|
2012-09-27 11:19:53 +03:00
|
|
|
typedef struct Node {
|
2007-10-15 00:19:40 +03:00
|
|
|
int16_t sym;
|
|
|
|
int16_t n0;
|
|
|
|
uint32_t count;
|
|
|
|
} Node;
|
|
|
|
|
2008-03-08 19:57:13 +02:00
|
|
|
#define FF_HUFFMAN_FLAG_HNODE_FIRST 0x01
|
2008-03-08 20:08:16 +02:00
|
|
|
#define FF_HUFFMAN_FLAG_ZERO_COUNT 0x02
|
2013-05-21 14:40:01 +03:00
|
|
|
#define FF_HUFFMAN_BITS 10
|
2008-03-08 19:57:13 +02:00
|
|
|
|
2008-12-12 00:56:19 +02:00
|
|
|
typedef int (*HuffCmp)(const void *va, const void *vb);
|
2021-07-30 13:13:45 +02:00
|
|
|
int ff_huff_build_tree(void *logctx, VLC *vlc, int nb_codes, int nb_bits,
|
2008-12-12 00:56:19 +02:00
|
|
|
Node *nodes, HuffCmp cmp, int flags);
|
2007-10-15 00:19:40 +03:00
|
|
|
|
2014-06-09 15:49:35 +03:00
|
|
|
int ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats, int n, int skip0);
|
2012-08-22 04:57:45 +03:00
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#endif /* AVCODEC_HUFFMAN_H */
|