MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / smacker_decode_tree

Function smacker_decode_tree

libavcodec/smacker.c:95–122  ·  view source on GitHub ↗

* Decode local frame tree */

Source from the content-addressed store, hash-verified

93 * Decode local frame tree
94 */
95static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t prefix, int length)
96{
97 if(!get_bits1(gb)){ //Leaf
98 if(hc->current >= 256){
99 av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");
100 return -1;
101 }
102 if(length){
103 hc->bits[hc->current] = prefix;
104 hc->lengths[hc->current] = length;
105 } else {
106 hc->bits[hc->current] = 0;
107 hc->lengths[hc->current] = 0;
108 }
109 hc->values[hc->current] = get_bits(gb, 8);
110 hc->current++;
111 if(hc->maxlength < length)
112 hc->maxlength = length;
113 return 0;
114 } else { //Node
115 int r;
116 length++;
117 r = smacker_decode_tree(gb, hc, prefix, length);
118 if(r)
119 return r;
120 return smacker_decode_tree(gb, hc, prefix | (1 << (length - 1)), length);
121 }
122}
123
124/**
125 * Decode header tree

Callers 2

smka_decode_frameFunction · 0.85

Calls 3

get_bits1Function · 0.85
av_logFunction · 0.85
get_bitsFunction · 0.85

Tested by

no test coverage detected