Said AVCodecContext is only used for logging; it furthermore avoids an avcodec.h inclusion.
Unified · Split
| @@ -29,7 +29,6 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "libavutil/qsort.h" |
| 30 | 30 | #include "libavutil/common.h" |
| 31 | 31 | |
| 32 | −#include "avcodec.h" | |
| 33 | 32 | #include "huffman.h" |
| 34 | 33 | #include "vlc.h" |
| 35 | 34 | |
| @@ -154,7 +153,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags, int nb_bi · 118 unmodified lines | ||
| 154 | 153 | * nodes size must be 2*nb_codes |
| 155 | 154 | * first nb_codes nodes.count must be set |
| 156 | 155 | */ |
| 157 | −int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bits, | |
| 156 | +int ff_huff_build_tree(void *logctx, VLC *vlc, int nb_codes, int nb_bits, | |
| 158 | 157 | Node *nodes, HuffCmp cmp, int flags) |
| 159 | 158 | { |
| 160 | 159 | int i, j; |
| @@ -168,7 +167,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bit · 7 unmodified lines | ||
| 168 | 167 | } |
| 169 | 168 | |
| 170 | 169 | if (sum >> 31) { |
| 171 | − av_log(avctx, AV_LOG_ERROR, | |
| 170 | + av_log(logctx, AV_LOG_ERROR, | |
| 172 | 171 | "Too high symbol frequencies. " |
| 173 | 172 | "Tree construction is not possible\n"); |
| 174 | 173 | return -1; |
| @@ -193,7 +192,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bit · 18 unmodified lines | ||
| 193 | 192 | cur_node++; |
| 194 | 193 | } |
| 195 | 194 | if (build_huff_tree(vlc, nodes, nb_codes * 2 - 2, flags, nb_bits) < 0) { |
| 196 | − av_log(avctx, AV_LOG_ERROR, "Error building tree\n"); | |
| 195 | + av_log(logctx, AV_LOG_ERROR, "Error building tree\n"); | |
| 197 | 196 | return -1; |
| 198 | 197 | } |
| 199 | 198 | return 0; |
| @@ -26,7 +26,8 @@ · 25 unmodified lines | ||
| 26 | 26 | #ifndef AVCODEC_HUFFMAN_H |
| 27 | 27 | #define AVCODEC_HUFFMAN_H |
| 28 | 28 | |
| 29 | −#include "avcodec.h" | |
| 29 | +#include <stdint.h> | |
| 30 | + | |
| 30 | 31 | #include "vlc.h" |
| 31 | 32 | |
| 32 | 33 | typedef struct Node { |
| @@ -40,7 +41,7 @@ typedef struct Node { · 7 unmodified lines | ||
| 40 | 41 | #define FF_HUFFMAN_BITS 10 |
| 41 | 42 | |
| 42 | 43 | typedef int (*HuffCmp)(const void *va, const void *vb); |
| 43 | −int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bits, | |
| 44 | +int ff_huff_build_tree(void *logctx, VLC *vlc, int nb_codes, int nb_bits, | |
| 44 | 45 | Node *nodes, HuffCmp cmp, int flags); |
| 45 | 46 | |
| 46 | 47 | int ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats, int n, int skip0); |