mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 17:32:06 +00:00
avcodec/huffman: Use logcontext instead of AVCodecContext
Said AVCodecContext is only used for logging; it furthermore avoids an avcodec.h inclusion. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
a449fb35ca
commit
b75dc8bd70
@ -29,7 +29,6 @@
|
|||||||
#include "libavutil/qsort.h"
|
#include "libavutil/qsort.h"
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
|
|
||||||
#include "avcodec.h"
|
|
||||||
#include "huffman.h"
|
#include "huffman.h"
|
||||||
#include "vlc.h"
|
#include "vlc.h"
|
||||||
|
|
||||||
@ -154,7 +153,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags, int nb_bi
|
|||||||
* nodes size must be 2*nb_codes
|
* nodes size must be 2*nb_codes
|
||||||
* first nb_codes nodes.count must be set
|
* first nb_codes nodes.count must be set
|
||||||
*/
|
*/
|
||||||
int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bits,
|
int ff_huff_build_tree(void *logctx, VLC *vlc, int nb_codes, int nb_bits,
|
||||||
Node *nodes, HuffCmp cmp, int flags)
|
Node *nodes, HuffCmp cmp, int flags)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -168,7 +167,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sum >> 31) {
|
if (sum >> 31) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(logctx, AV_LOG_ERROR,
|
||||||
"Too high symbol frequencies. "
|
"Too high symbol frequencies. "
|
||||||
"Tree construction is not possible\n");
|
"Tree construction is not possible\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -193,7 +192,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bit
|
|||||||
cur_node++;
|
cur_node++;
|
||||||
}
|
}
|
||||||
if (build_huff_tree(vlc, nodes, nb_codes * 2 - 2, flags, nb_bits) < 0) {
|
if (build_huff_tree(vlc, nodes, nb_codes * 2 - 2, flags, nb_bits) < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Error building tree\n");
|
av_log(logctx, AV_LOG_ERROR, "Error building tree\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
#ifndef AVCODEC_HUFFMAN_H
|
#ifndef AVCODEC_HUFFMAN_H
|
||||||
#define AVCODEC_HUFFMAN_H
|
#define AVCODEC_HUFFMAN_H
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "vlc.h"
|
#include "vlc.h"
|
||||||
|
|
||||||
typedef struct Node {
|
typedef struct Node {
|
||||||
@ -40,7 +41,7 @@ typedef struct Node {
|
|||||||
#define FF_HUFFMAN_BITS 10
|
#define FF_HUFFMAN_BITS 10
|
||||||
|
|
||||||
typedef int (*HuffCmp)(const void *va, const void *vb);
|
typedef int (*HuffCmp)(const void *va, const void *vb);
|
||||||
int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bits,
|
int ff_huff_build_tree(void *logctx, VLC *vlc, int nb_codes, int nb_bits,
|
||||||
Node *nodes, HuffCmp cmp, int flags);
|
Node *nodes, HuffCmp cmp, int flags);
|
||||||
|
|
||||||
int ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats, int n, int skip0);
|
int ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats, int n, int skip0);
|
||||||
|
Loading…
Reference in New Issue
Block a user