| 125 | typename cc |
| 126 | > |
| 127 | void entropy_decoder_model_kernel_1<alphabet_size,entropy_decoder,cc>:: |
| 128 | decode ( |
| 129 | unsigned long& symbol |
| 130 | ) |
| 131 | { |
| 132 | unsigned long current_symbol, low_count, high_count, target; |
| 133 | |
| 134 | // look in the order-0 context |
| 135 | target = coder.get_target(order_0.get_total()); |
| 136 | order_0.get_symbol(target,current_symbol,low_count,high_count); |
| 137 | |
| 138 | |
| 139 | // have coder decode the next symbol |
| 140 | coder.decode(low_count,high_count); |
| 141 | |
| 142 | // if current_symbol is not an escape from the order-0 context |
| 143 | if (current_symbol != alphabet_size) |
| 144 | { |
| 145 | // update the count for this symbol |
| 146 | order_0.increment_count(current_symbol,2); |
| 147 | |
| 148 | symbol = current_symbol; |
| 149 | return; |
| 150 | } |
| 151 | |
| 152 | // update the count for the escape symbol |
| 153 | order_0.increment_count(alphabet_size); |
| 154 | |
| 155 | |
| 156 | // go into the order minus one context |
| 157 | target = coder.get_target(alphabet_size); |
| 158 | coder.decode(target,target+1); |
| 159 | |
| 160 | |
| 161 | // update the count for this symbol in the order-0 context |
| 162 | order_0.increment_count(target,2); |
| 163 | |
| 164 | symbol = target; |
| 165 | |
| 166 | } |
| 167 | |
| 168 | // ---------------------------------------------------------------------------------------- |
| 169 | |