History

avcodec/huffman: Use logcontext instead of AVCodecContext

Said AVCodecContext is only used for logging; it furthermore avoids an avcodec.h inclusion.

Andreas Rheinhardt committed 5 years ago

Commit b75dc8b1 parent a449fb32 files · +6 −6Browse files

Unified · Split

2 files
  1. libavcodec/huffman.c +3 −4
  2. libavcodec/huffman.h +3 −2
libavcodec/huffman.c+3−4
@@ -29,7 +29,6 @@ · 28 unmodified lines
2929 #include "libavutil/qsort.h"
3030 #include "libavutil/common.h"
3131
32−#include "avcodec.h"
3332 #include "huffman.h"
3433 #include "vlc.h"
3534
@@ -154,7 +153,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags, int nb_bi · 118 unmodified lines
154153 * nodes size must be 2*nb_codes
155154 * first nb_codes nodes.count must be set
156155 */
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,
158157 Node *nodes, HuffCmp cmp, int flags)
159158 {
160159 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
168167 }
169168
170169 if (sum >> 31) {
171− av_log(avctx, AV_LOG_ERROR,
170+ av_log(logctx, AV_LOG_ERROR,
172171 "Too high symbol frequencies. "
173172 "Tree construction is not possible\n");
174173 return -1;
@@ -193,7 +192,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bit · 18 unmodified lines
193192 cur_node++;
194193 }
195194 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");
197196 return -1;
198197 }
199198 return 0;
libavcodec/huffman.h+3−2
@@ -26,7 +26,8 @@ · 25 unmodified lines
2626 #ifndef AVCODEC_HUFFMAN_H
2727 #define AVCODEC_HUFFMAN_H
2828
29−#include "avcodec.h"
29+#include <stdint.h>
30+
3031 #include "vlc.h"
3132
3233 typedef struct Node {
@@ -40,7 +41,7 @@ typedef struct Node { · 7 unmodified lines
4041 #define FF_HUFFMAN_BITS 10
4142
4243 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,
4445 Node *nodes, HuffCmp cmp, int flags);
4546
4647 int ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats, int n, int skip0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t