Mercurial > libavcodec.hg
comparison bitstream.c @ 11233:2d49996fe7d1 libavcodec
indent
| author | mru |
|---|---|
| date | Sun, 21 Feb 2010 15:11:59 +0000 |
| parents | 7f75cd2bf32e |
| children | aba20ba60384 |
comparison
equal
deleted
inserted
replaced
| 11232:7f75cd2bf32e | 11233:2d49996fe7d1 |
|---|---|
| 157 av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code); | 157 av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code); |
| 158 #endif | 158 #endif |
| 159 /* if code matches the prefix, it is in the table */ | 159 /* if code matches the prefix, it is in the table */ |
| 160 n -= n_prefix; | 160 n -= n_prefix; |
| 161 if (n > 0) { | 161 if (n > 0) { |
| 162 if(flags & INIT_VLC_LE) | 162 if(flags & INIT_VLC_LE) |
| 163 code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (1 << n_prefix)-1); | 163 code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (1 << n_prefix)-1); |
| 164 else | 164 else |
| 165 code_prefix2= code >> n; | 165 code_prefix2= code >> n; |
| 166 if (code_prefix2 == code_prefix) { | 166 if (code_prefix2 == code_prefix) { |
| 167 if (n <= table_nb_bits) { | 167 if (n <= table_nb_bits) { |
| 168 /* no need to add another table */ | 168 /* no need to add another table */ |
| 169 j = (code << (table_nb_bits - n)) & (table_size - 1); | 169 j = (code << (table_nb_bits - n)) & (table_size - 1); |
| 170 nb = 1 << (table_nb_bits - n); | 170 nb = 1 << (table_nb_bits - n); |
| 171 for(k=0;k<nb;k++) { | 171 for(k=0;k<nb;k++) { |
| 172 if(flags & INIT_VLC_LE) | 172 if(flags & INIT_VLC_LE) |
| 173 j = (code >> n_prefix) + (k<<n); | 173 j = (code >> n_prefix) + (k<<n); |
| 174 #ifdef DEBUG_VLC | 174 #ifdef DEBUG_VLC |
| 175 av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n", | 175 av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n", |
| 176 j, i, n); | 176 j, i, n); |
| 177 #endif | 177 #endif |
| 178 if (table[j][1] /*bits*/ != 0) { | 178 if (table[j][1] /*bits*/ != 0) { |
| 179 av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); | 179 av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); |
| 180 return -1; | 180 return -1; |
| 181 } | |
| 182 table[j][1] = n; //bits | |
| 183 table[j][0] = symbol; | |
| 184 j++; | |
| 181 } | 185 } |
| 182 table[j][1] = n; //bits | 186 } else { |
| 183 table[j][0] = symbol; | 187 n -= table_nb_bits; |
| 184 j++; | 188 j = (code >> ((flags & INIT_VLC_LE) ? n_prefix : n)) & ((1 << table_nb_bits) - 1); |
| 189 #ifdef DEBUG_VLC | |
| 190 av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n", | |
| 191 j, n); | |
| 192 #endif | |
| 193 /* compute table size */ | |
| 194 n1 = -table[j][1]; //bits | |
| 195 if (n > n1) | |
| 196 n1 = n; | |
| 197 table[j][1] = -n1; //bits | |
| 185 } | 198 } |
| 186 } else { | |
| 187 n -= table_nb_bits; | |
| 188 j = (code >> ((flags & INIT_VLC_LE) ? n_prefix : n)) & ((1 << table_nb_bits) - 1); | |
| 189 #ifdef DEBUG_VLC | |
| 190 av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n", | |
| 191 j, n); | |
| 192 #endif | |
| 193 /* compute table size */ | |
| 194 n1 = -table[j][1]; //bits | |
| 195 if (n > n1) | |
| 196 n1 = n; | |
| 197 table[j][1] = -n1; //bits | |
| 198 } | 199 } |
| 199 } | |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 /* second pass : fill auxillary tables recursively */ | 203 /* second pass : fill auxillary tables recursively */ |
| 204 for(i=0;i<table_size;i++) { | 204 for(i=0;i<table_size;i++) { |
