MCPcopy Create free account
hub / github.com/davisking/dlib / decode

Method decode

dlib/entropy_decoder_model/entropy_decoder_model_kernel_5.h:366–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364 unsigned long order
365 >
366 void entropy_decoder_model_kernel_5<alphabet_size,entropy_decoder,total_nodes,order>::
367 decode (
368 unsigned long& symbol
369 )
370 {
371 node* temp = cur;
372 cur = 0;
373 unsigned long low_count, high_count, total_count;
374 unsigned long target;
375 node* new_node = 0;
376
377 // local_order will track the level of temp in the tree
378 unsigned long local_order = cur_order;
379
380
381 unsigned short c; // c == t(a|sk)
382 unsigned short t; // t == T(sk)
383
384
385 if (something_is_excluded())
386 clear_exclusions();
387
388 while (true)
389 {
390 high_count = 0;
391 if (space_left())
392 {
393 total_count = temp->total;
394
395 if (total_count > 0)
396 {
397 // check if we need to scale the counts
398 if (total_count > 10000)
399 {
400 scale_counts(temp);
401 total_count = temp->total;
402 }
403
404 if (something_is_excluded())
405 {
406 node* n = temp->child_context;
407 total_count = temp->escapes;
408 while (true)
409 {
410 if (is_excluded(n->symbol) == false)
411 {
412 total_count += n->count;
413 }
414 if (n->next == 0)
415 break;
416 n = n->next;
417 }
418 }
419
420
421
422 target = coder.get_target(total_count);
423

Callers

nothing calls this directly

Calls 2

clearFunction · 0.50
decodeMethod · 0.45

Tested by

no test coverage detected