summaryrefslogtreecommitdiffstats
path: root/ml/dlib/dlib/entropy_decoder
diff options
context:
space:
mode:
Diffstat (limited to 'ml/dlib/dlib/entropy_decoder')
-rw-r--r--ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_1.cpp220
-rw-r--r--ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_1.h132
-rw-r--r--ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.cpp224
-rw-r--r--ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.h127
-rw-r--r--ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_abstract.h207
-rw-r--r--ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_c.h123
6 files changed, 0 insertions, 1033 deletions
diff --git a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_1.cpp b/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_1.cpp
deleted file mode 100644
index 82c583634..000000000
--- a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_1.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-// Copyright (C) 2003 Davis E. King (davis@dlib.net)
-// License: Boost Software License See LICENSE.txt for the full license.
-#ifndef DLIB_ENTROPY_DECODER_KERNEL_1_CPp_
-#define DLIB_ENTROPY_DECODER_KERNEL_1_CPp_
-#include "entropy_decoder_kernel_1.h"
-#include <iostream>
-#include <streambuf>
-#include <sstream>
-
-#include "../assert.h"
-
-namespace dlib
-{
-
-// ----------------------------------------------------------------------------------------
-
- entropy_decoder_kernel_1::
- entropy_decoder_kernel_1(
- ) :
- initial_low(0x00000001),
- initial_high(0xffffffff),
- in(0),
- low(initial_low),
- high(initial_high),
- buf(0),
- buf_used(0),
- target(0x00000000),
- r(0)
- {
- }
-
-// ----------------------------------------------------------------------------------------
-
- entropy_decoder_kernel_1::
- ~entropy_decoder_kernel_1 (
- )
- {
- }
-
-// ----------------------------------------------------------------------------------------
-
- void entropy_decoder_kernel_1::
- clear(
- )
- {
- in = 0;
- buf_used = 0;
- buf = 0;
- r = 0;
- low = initial_low;
- high = initial_high;
- target = 0x00000000;
- }
-
-// ----------------------------------------------------------------------------------------
-
- void entropy_decoder_kernel_1::
- set_stream (
- std::istream& in_
- )
- {
- buf_used = 0;
- buf = 0;
- r = 0;
- low = initial_low;
- high = initial_high;
- target = 0x00000000;
-
- in = &in_;
- streambuf = in_.rdbuf();
-
-
-
- unsigned char ch;
-
-
- streambuf->sgetn((char*)&ch,1);
- target = ch;
-
- target <<= 8;
- if (streambuf->sgetn((char*)&ch,1))
- target += ch;
-
-
- target <<= 8;
- if (streambuf->sgetn((char*)&ch,1))
- target += ch;
-
-
- target <<= 8;
- if (streambuf->sgetn((char*)&ch,1))
- target += ch;
-
- }
-
-// ----------------------------------------------------------------------------------------
-
- bool entropy_decoder_kernel_1::
- stream_is_set (
- ) const
- {
- if (in != 0)
- return true;
- else
- return false;
- }
-
-// ----------------------------------------------------------------------------------------
-
- std::istream& entropy_decoder_kernel_1::
- get_stream (
- ) const
- {
- return *in;
- }
-
-// ----------------------------------------------------------------------------------------
-
- void entropy_decoder_kernel_1::
- decode (
- uint32 low_count,
- uint32 high_count
- )
- {
- // note that we must subtract 1 to preserve the convention that
- // high == the real upper range - 1
- high = low + r*high_count - 1;
- low = low + r*low_count;
- r = 0;
-
-
-
- while (true)
- {
-
- // if the highest order bit in high and low is the same
- if ( low >= 0x80000000 || high < 0x80000000)
- {
- // make sure buf isn't empty
- if (buf_used == 0)
- {
- buf_used = 8;
- if (streambuf->sgetn(reinterpret_cast<char*>(&buf),1)==0)
- {
- // if there isn't anything else in the streambuffer then just
- // make buf zero.
- buf = 0;
- }
- }
-
- // we will be taking one bit from buf to replace the one we threw away
- --buf_used;
-
- // roll off the bit in target
- target <<= 1;
-
- // roll off the bit
- high <<= 1;
- low <<= 1;
- high |= 1; // note that it is ok to add one to high here because
- // of the convention that high == real upper range - 1.
- // so that means that if we want to shift the upper range
- // left by one then we must shift a one into high also
- // since real upper range == high + 0.999999999...
-
- // make sure low is never zero
- if (low == 0)
- low = 1;
-
- // take a bit from buf to fill in the one we threw away
- target += (buf>>buf_used)&0x01;
- }
- // if the distance between high and low is small and there aren't
- // any bits we can roll off then round low up or high down.
- else if (high-low < 0x10000)
- {
- if (high == 0x80000000)
- high = 0x7fffffff;
- else
- low = 0x80000000;
- }
- else
- {
- break;
- }
- } // while (true)
-
- }
-
-// ----------------------------------------------------------------------------------------
-
- bool entropy_decoder_kernel_1::
- get_target_called (
- ) const
- {
- return (r != 0);
- }
-
-// ----------------------------------------------------------------------------------------
-
- uint32 entropy_decoder_kernel_1::
- get_target (
- uint32 total
- )
- {
- // note that we must add one because of the convention that
- // high == the real upper range minus 1
- r = (high-low+1)/total;
- uint32 temp = (target-low)/r;
- if (temp < total)
- return temp;
- else
- return total-1;
- }
-
-// ----------------------------------------------------------------------------------------
-
-}
-#endif // DLIB_ENTROPY_DECODER_KERNEL_1_CPp_
-
diff --git a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_1.h b/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_1.h
deleted file mode 100644
index daf6d11ec..000000000
--- a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_1.h
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (C) 2003 Davis E. King (davis@dlib.net)
-// License: Boost Software License See LICENSE.txt for the full license.
-#ifndef DLIB_ENTROPY_DECODER_KERNEl_1_
-#define DLIB_ENTROPY_DECODER_KERNEl_1_
-
-#include "../algs.h"
-#include "entropy_decoder_kernel_abstract.h"
-#include <iosfwd>
-#include "../uintn.h"
-
-namespace dlib
-{
-
- class entropy_decoder_kernel_1
- {
- /*!
- GENERAL NOTES
- this decoder is implemented using arithmetic coding
-
- INITIAL VALUE
- in == 0
- buf_used == 0
- buf == 0
- initial_low == 0x00000001 (slightly more than zero)
- initial_high == 0xffffffff (slightly less than one, 0.99999999976717)
- target == 0x00000000 (zero)
- low == initial_low
- high == initial_high
- r == 0
-
- CONVENTION
- if (in != 0)
- *in == get_stream()
- true == stream_is_set()
- streambuf == in->rdbuf()
- else
- false == stream_is_set()
-
- buf == used to hold fractional byte values which are fed to target.
- buf_used == the number of low order bits in buf that are currently
- in use
- low == the low end of the range used for arithmetic encoding.
- this number is used as a 32bit fixed point real number.
- the point is fixed just before the first bit, so it is
- always in the range [0,1)
-
- low is also never allowed to be zero to avoid overflow
- in the calculation (high-low+1)/total.
-
- high == the high end of the range - 1 used for arithmetic encoding.
- this number is used as a 32bit fixed point real number.
- the point is fixed just before the first bit, so when we
- interpret high as a real number then it is always in the
- range [0,1)
-
- the range for arithmetic encoding is always
- [low,high + 0.9999999...) the 0.9999999... is why
- high == real upper range - 1
-
- target == 32 bits of the fraction produced from an arithmetic encoder.
- this number is used as a 32bit fixed point real number.
- the point is fixed just before the first bit, so it is
- always in the range [0,1)
-
- r == the value (high-low+1)/total from the last call to
- get_target() or 0 if get_target_called() should be false
-
- get_target_called() == (r != 0)
-
- !*/
-
- public:
-
- entropy_decoder_kernel_1 (
- );
-
- virtual ~entropy_decoder_kernel_1 (
- );
-
- void clear(
- );
-
- void set_stream (
- std::istream& in
- );
-
- bool stream_is_set (
- ) const;
-
- std::istream& get_stream (
- ) const;
-
- void decode (
- uint32 low_count,
- uint32 high_count
- );
-
- bool get_target_called (
- ) const;
-
- uint32 get_target (
- uint32 total
- );
-
- private:
-
- // restricted functions
- entropy_decoder_kernel_1(entropy_decoder_kernel_1&); // copy constructor
- entropy_decoder_kernel_1& operator=(entropy_decoder_kernel_1&); // assignment operator
-
- // data members
- const uint32 initial_low;
- const uint32 initial_high;
- std::istream* in;
- uint32 low;
- uint32 high;
- unsigned char buf;
- uint32 buf_used;
- uint32 target;
- uint32 r;
- std::streambuf* streambuf;
-
- };
-
-}
-
-#ifdef NO_MAKEFILE
-#include "entropy_decoder_kernel_1.cpp"
-#endif
-
-#endif // DLIB_ENTROPY_DECODER_KERNEl_1_
-
diff --git a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.cpp b/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.cpp
deleted file mode 100644
index 5b986273e..000000000
--- a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright (C) 2004 Davis E. King (davis@dlib.net)
-// License: Boost Software License See LICENSE.txt for the full license.
-#ifndef DLIB_ENTROPY_DECODER_KERNEL_2_CPp_
-#define DLIB_ENTROPY_DECODER_KERNEL_2_CPp_
-#include "entropy_decoder_kernel_2.h"
-#include <iostream>
-#include <streambuf>
-#include <sstream>
-
-#include "../assert.h"
-
-namespace dlib
-{
-
-// ----------------------------------------------------------------------------------------
-
- entropy_decoder_kernel_2::
- entropy_decoder_kernel_2(
- ) :
- initial_low(0x00000001),
- initial_high(0xffffffff),
- in(0),
- low(initial_low),
- high(initial_high),
- target(0x00000000),
- r(0)
- {
- }
-
-// ----------------------------------------------------------------------------------------
-
- entropy_decoder_kernel_2::
- ~entropy_decoder_kernel_2 (
- )
- {
- }
-
-// ----------------------------------------------------------------------------------------
-
- void entropy_decoder_kernel_2::
- clear(
- )
- {
- in = 0;
- r = 0;
- low = initial_low;
- high = initial_high;
- target = 0x00000000;
- }
-
-// ----------------------------------------------------------------------------------------
-
- void entropy_decoder_kernel_2::
- set_stream (
- std::istream& in_
- )
- {
- r = 0;
- low = initial_low;
- high = initial_high;
- target = 0x00000000;
-
- in = &in_;
- streambuf = in_.rdbuf();
-
-
-
- unsigned char ch;
-
-
- streambuf->sgetn((char*)&ch,1);
- target = ch;
-
- target <<= 8;
- if (streambuf->sgetn((char*)&ch,1))
- target += ch;
-
-
- target <<= 8;
- if (streambuf->sgetn((char*)&ch,1))
- target += ch;
-
-
- target <<= 8;
- if (streambuf->sgetn((char*)&ch,1))
- target += ch;
- }
-
-// ----------------------------------------------------------------------------------------
-
- bool entropy_decoder_kernel_2::
- stream_is_set (
- ) const
- {
- if (in != 0)
- return true;
- else
- return false;
- }
-
-// ----------------------------------------------------------------------------------------
-
- std::istream& entropy_decoder_kernel_2::
- get_stream (
- ) const
- {
- return *in;
- }
-
-// ----------------------------------------------------------------------------------------
-
- void entropy_decoder_kernel_2::
- decode (
- uint32 low_count,
- uint32 high_count
- )
- {
- // note that we must subtract 1 to preserve the convention that
- // high == the real upper range - 1
- high = low + r*high_count - 1;
- low = low + r*low_count;
- r = 0;
-
-
- while (true )
- {
-
- // if high and low don't have the same 8 high order bits
- if ((high&0xFF000000) != (low&0xFF000000))
- {
- // if the distance between high and low is small and there aren't
- // any bits we can roll off then force high and low to have common high
- // order bits.
- if ((high-low < 0x10000))
- {
- if (high-low > 0x1000)
- {
- high>>=1;
- low>>=1;
- high = low = high+low;
- high += 0xFF;
- low -= 0xFF;
- }
- else /**/
- {
- high>>=1;
- low>>=1;
- high = low = high+low;
- }
- }
- else
- {
- // there are no bits to roll off and high and low are not
- // too close so just quit the loop
- break;
- }
-
- }
- // else if there are 8 bits we can roll off
- else
- {
- unsigned char buf;
- if (streambuf->sgetn(reinterpret_cast<char*>(&buf),1)==0)
- {
- // if there isn't anything else in the streambuffer then just
- // make buf zero.
- buf = 0;
- }
-
- // also roll off the bits in target
- target <<= 8;
-
- // roll off the bits
- high <<= 8;
- low <<= 8;
- high |= 0xFF; // note that it is ok to add 0xFF to high here because
- // of the convention that high == real upper range - 1.
- // so that means that if we want to shift the upper range
- // left by one then we must shift a one into high also
- // since real upper range == high + 0.999999999...
-
- // make sure low is never zero
- if (low == 0)
- low = 1;
-
-
- // put the new bits into target
- target |= static_cast<uint32>(buf);
- }
-
- } // while (true)
- }
-
-// ----------------------------------------------------------------------------------------
-
- bool entropy_decoder_kernel_2::
- get_target_called (
- ) const
- {
- return (r != 0);
- }
-
-// ----------------------------------------------------------------------------------------
-
- uint32 entropy_decoder_kernel_2::
- get_target (
- uint32 total
- )
- {
- // note that we must add one because of the convention that
- // high == the real upper range minus 1
- r = (high-low+1)/total;
- uint32 temp = (target-low)/r;
- if (temp < total)
- return temp;
- else
- return total-1;
- }
-
-// ----------------------------------------------------------------------------------------
-
-}
-#endif // DLIB_ENTROPY_DECODER_KERNEL_2_CPp_
-
diff --git a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.h b/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.h
deleted file mode 100644
index 7284cec3c..000000000
--- a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (C) 2004 Davis E. King (davis@dlib.net)
-// License: Boost Software License See LICENSE.txt for the full license.
-#ifndef DLIB_ENTROPY_DECODER_KERNEl_2_
-#define DLIB_ENTROPY_DECODER_KERNEl_2_
-
-#include "../algs.h"
-#include "entropy_decoder_kernel_abstract.h"
-#include <iosfwd>
-#include "../uintn.h"
-
-namespace dlib
-{
-
- class entropy_decoder_kernel_2
- {
- /*!
- GENERAL NOTES
- this decoder is implemented using "range" coding
-
- INITIAL VALUE
- in == 0
- initial_low == 0x00000001 (slightly more than zero)
- initial_high == 0xffffffff (slightly less than one, 0.99999999976717)
- target == 0x00000000 (zero)
- low == initial_low
- high == initial_high
- r == 0
-
- CONVENTION
- if (in != 0)
- *in == get_stream()
- true == stream_is_set()
- streambuf == in->rdbuf()
- else
- false == stream_is_set()
-
-
- low == the low end of the range used for arithmetic encoding.
- this number is used as a 32bit fixed point real number.
- the point is fixed just before the first bit, so it is
- always in the range [0,1)
-
- low is also never allowed to be zero to avoid overflow
- in the calculation (high-low+1)/total.
-
- high == the high end of the range - 1 used for arithmetic encoding.
- this number is used as a 32bit fixed point real number.
- the point is fixed just before the first bit, so when we
- interpret high as a real number then it is always in the
- range [0,1)
-
- the range for arithmetic encoding is always
- [low,high + 0.9999999...) the 0.9999999... is why
- high == real upper range - 1
-
- target == 32 bits of the fraction produced from an arithmetic encoder.
- this number is used as a 32bit fixed point real number.
- the point is fixed just before the first bit, so it is
- always in the range [0,1)
-
- r == the value (high-low+1)/total from the last call to
- get_target() or 0 if get_target_called() should be false
-
- get_target_called() == (r != 0)
-
- !*/
-
- public:
-
- entropy_decoder_kernel_2 (
- );
-
- virtual ~entropy_decoder_kernel_2 (
- );
-
- void clear(
- );
-
- void set_stream (
- std::istream& in
- );
-
- bool stream_is_set (
- ) const;
-
- std::istream& get_stream (
- ) const;
-
- void decode (
- uint32 low_count,
- uint32 high_count
- );
-
- bool get_target_called (
- ) const;
-
- uint32 get_target (
- uint32 total
- );
-
- private:
-
- // restricted functions
- entropy_decoder_kernel_2(entropy_decoder_kernel_2&); // copy constructor
- entropy_decoder_kernel_2& operator=(entropy_decoder_kernel_2&); // assignment operator
-
- // data members
- const uint32 initial_low;
- const uint32 initial_high;
- std::istream* in;
- uint32 low;
- uint32 high;
- uint32 target;
- uint32 r;
- std::streambuf* streambuf;
-
- };
-
-
-}
-
-#ifdef NO_MAKEFILE
-#include "entropy_decoder_kernel_2.cpp"
-#endif
-
-#endif // DLIB_ENTROPY_DECODER_KERNEl_2_
-
diff --git a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_abstract.h b/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_abstract.h
deleted file mode 100644
index 89906b9ae..000000000
--- a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_abstract.h
+++ /dev/null
@@ -1,207 +0,0 @@
-// Copyright (C) 2003 Davis E. King (davis@dlib.net)
-// License: Boost Software License See LICENSE.txt for the full license.
-#undef DLIB_ENTROPY_DECODER_KERNEl_ABSTRACT_
-#ifdef DLIB_ENTROPY_DECODER_KERNEl_ABSTRACT_
-
-#include "../algs.h"
-#include <iosfwd>
-#include "../uintn.h"
-
-namespace dlib
-{
-
- class entropy_decoder
- {
- /*!
- INITIAL VALUE
- stream_is_set() == false
- get_target_called() == false
-
-
- WHAT THIS OBJECT REPRESENTS
- This object represents an entropy decoder (could be implemented as an
- arithmetic decoder for example).
-
- Note that all implementations of entropy_encoder and entropy_decoder
- are paired. This means that if you use entropy_encoder_kernel_n to
- encode something then you must use the corresponding
- entropy_decoder_kernel_n to decode it.
-
-
- WHERE IS EOF?
- It is important to note that this object will not give any indication
- that is has hit the end of the input stream when it occurs. It is
- up to you to use some kind of coding scheme to detect this in the
- compressed data stream.
-
- Another important thing to know is that decode() must be called
- exactly the same number of times as encode() and with the same values
- supplied for TOTAL, high_count, and low_count. Doing this ensures
- that the decoder consumes exactly all the bytes from the input
- stream that were written by the entropy_encoder.
-
- NOTATION:
- At any moment each symbol has a certain probability of appearing in
- the input stream. These probabilities may change as each symbol is
- decoded and the probability model is updated accordingly.
-
-
- - Before considering current symbol:
-
- let P(i) be a function which gives the probability of seeing the ith
- symbol of an N symbol alphabet. Note that P(i) refers to the probability
- of seeing the ith symbol WITHOUT considering the symbol currently given
- by get_target(TOTAL). ( The domain of P(i) is from 0 to N-1. )
-
- for each i: P(i) == COUNT/TOTAL where COUNT and TOTAL are integers
- and TOTAL is the same number for all P(i) but COUNT may vary.
-
- let LOW_COUNT(i) be the sum of all P(x)*TOTAL from x == 0 to x == i-1
- (note that LOW_COUNT(0) == 0)
- let HIGH_COUNT(i) be the sum of all P(x)*TOTAL from x == 0 to x == i
-
-
- - After considering current symbol:
-
- let #P(i) be a function which gives the probability of seeing the ith
- symbol after we have updated our probability model to take the symbol
- given by get_target(TOTAL) into account.
-
- for each i: #P(i) == #COUNT/#TOTAL where #COUNT and #TOTAL are integers
- and #TOTAL is the same number for all #P(i) but #COUNT may vary.
- !*/
-
- public:
-
- entropy_decoder (
- );
- /*!
- ensures
- - #*this is properly initialized
- throws
- - std::bad_alloc
- !*/
-
- virtual ~entropy_decoder (
- );
- /*!
- ensures
- - all memory associated with *this has been released
- !*/
-
- void clear(
- );
- /*!
- ensures
- - #*this has its initial value
- - if (stream_is_set())
- - clears any state accumulated in *this from decoding data from
- the stream get_stream()
- throws
- - any exception
- if this exception is thrown then #*this is unusable
- until clear() is called and succeeds
- !*/
-
- void set_stream (
- std::istream& in
- );
- /*!
- ensures
- - #*this will read data from in and decode it
- - #stream_is_set() == true
- - #get_target() == a number representing the first symbol from in
- - #get_target_called() == false
- - if (stream_is_set())
- - clears any state accumulated in *this from decoding data from
- the stream get_stream()
- throws
- - any exception
- if this exception is thrown then #*this is unusable
- until clear() is called and succeeds
- !*/
-
- bool stream_is_set (
- ) const;
- /*!
- ensures
- - returns true if a stream has been associated with *this by calling
- set_stream()
- !*/
-
- std::istream& get_stream (
- ) const;
- /*!
- requires
- - stream_is_set() == true
- ensures
- - returns a reference to the istream object that *this is reading
- encoded data from
- !*/
-
-
- void decode (
- uint32 low_count,
- uint32 high_count
- );
- /*!
- requires
- - get_target_called() == true
- - stream_is_set() == true
- - low_count == LOW_COUNT(S) where S is the symbol represented
- by get_target(TOTAL)
- - high_count == HIGH_COUNT(S) where S is the symbol represented
- by get_target(TOTAL)
- - low_count <= get_target(TOTAL) < high_count <= TOTAL
- ensures
- - #get_target(#TOTAL) == a number which represents the next symbol
- - #get_target_called() == false
- throws
- - any exception
- if this exception is thrown then #*this is unusable
- until clear() is called and succeeds
- !*/
-
- bool get_target_called (
- ) const;
- /*!
- ensures
- - returns true if get_target() has been called and since then decode()
- and set_stream() have not been called
- - returns false otherwise
- !*/
-
- uint32 get_target (
- uint32 total
- );
- /*!
- requires
- - 0 < total < 65536 (2^16)
- - total == TOTAL
- - stream_is_set() == true
- ensures
- - in the next call to decode() the value of TOTAL will be
- considered to be total
- - #get_target_called() == true
- - returns a number N such that:
- - N is in the range 0 to total - 1
- - N represents a symbol S where
- LOW_COUNT(S) <= N < HIGH_COUNT(S)
- throws
- - any exception
- if this exception is thrown then #*this is unusable
- until clear() is called and succeeds
- !*/
-
- private:
-
- // restricted functions
- entropy_decoder(entropy_decoder&); // copy constructor
- entropy_decoder& operator=(entropy_decoder&); // assignment operator
-
- };
-
-}
-
-#endif // DLIB_ENTROPY_DECODER_KERNEl_ABSTRACT_
-
diff --git a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_c.h b/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_c.h
deleted file mode 100644
index 4b94791f3..000000000
--- a/ml/dlib/dlib/entropy_decoder/entropy_decoder_kernel_c.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (C) 2003 Davis E. King (davis@dlib.net)
-// License: Boost Software License See LICENSE.txt for the full license.
-#ifndef DLIB_ENTROPY_DECODER_KERNEl_C_
-#define DLIB_ENTROPY_DECODER_KERNEl_C_
-
-#include "entropy_decoder_kernel_abstract.h"
-#include "../algs.h"
-#include "../assert.h"
-#include <iostream>
-
-namespace dlib
-{
-
- template <
- typename decoder
- >
- class entropy_decoder_kernel_c : public decoder
- {
-
- public:
- std::istream& get_stream (
- ) const;
-
- void decode (
- uint32 low_count,
- uint32 high_count
- );
-
- uint32 get_target (
- uint32 total
- );
-
- private:
- uint32 _get_target;
- uint32 TOTAL;
- };
-
-// ----------------------------------------------------------------------------------------
-// ----------------------------------------------------------------------------------------
- // member function definitions
-// ----------------------------------------------------------------------------------------
-// ----------------------------------------------------------------------------------------
-
- template <
- typename decoder
- >
- std::istream& entropy_decoder_kernel_c<decoder>::
- get_stream (
- ) const
- {
- // make sure requires clause is not broken
- DLIB_CASSERT( this->stream_is_set() == true,
- "\tstd::istream& entropy_decoder::get_stream()"
- << "\n\tyou must set a stream for this object before you can get it"
- << "\n\tthis: " << this
- );
-
- // call the real function
- return decoder::get_stream();
- }
-
-// ----------------------------------------------------------------------------------------
-
- template <
- typename decoder
- >
- void entropy_decoder_kernel_c<decoder>::
- decode (
- uint32 low_count,
- uint32 high_count
- )
- {
- // make sure requires clause is not broken
- DLIB_CASSERT( (low_count <= _get_target) && (_get_target < high_count) &&
- (high_count <= TOTAL) &&
- (this->stream_is_set() == true) && (this->get_target_called() == true),
- "\tvoid entropy_decoder::decode()"
- << "\n\tRefer to the ensures clause for this function for further information."
- << "\n\tNote that _get_target refers to get_target(TOTAL)"
- << "\n\tthis: " << this
- << "\n\tlow_count: " << low_count
- << "\n\thigh_count: " << high_count
- << "\n\tTOTAL: " << TOTAL
- << "\n\tget_target(TOTAL): " << _get_target
- << "\n\tis_stream_set(): " << (this->stream_is_set() ? "true" : "false" )
- << "\n\tget_target_called(): " << (this->get_target_called() ? "true" : "false" )
- );
-
- // call the real function
- decoder::decode(low_count,high_count);
- }
-
-// ----------------------------------------------------------------------------------------
-
- template <
- typename decoder
- >
- uint32 entropy_decoder_kernel_c<decoder>::
- get_target (
- uint32 total
- )
- {
- // make sure requires clause is not broken
- DLIB_CASSERT( (total > 0) && (total < 65536) && (this->stream_is_set() == true),
- "\tvoid entropy_decoder::get_target()"
- << "\n\tyou must set a stream for this object before you can get the "
- << "\n\rnext target."
- << "\n\tthis: " << this
- << "\n\ttotal: " << total
- );
-
- // call the real function
- _get_target = decoder::get_target(total);
- TOTAL = total;
- return _get_target;
- }
-
-// ----------------------------------------------------------------------------------------
-
-}
-
-#endif // DLIB_ENTROPY_ENCODER_KERNEl_C_
-