~ubuntu-branches/ubuntu/trusty/advancecomp/trusty

« back to all changes in this revision

Viewing changes to 7z/AriBitCoder.cc

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ozarowski
  • Date: 2006-05-13 21:15:49 UTC
  • Revision ID: james.westby@ubuntu.com-20060513211549-2vu7peis643ojcm5
Tags: upstream-1.15
ImportĀ upstreamĀ versionĀ 1.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "AriBitCoder.h"
 
2
#include "AriPrice.h"
 
3
 
 
4
#include <cmath>
 
5
 
 
6
namespace NCompression {
 
7
namespace NArithmetic {
 
8
 
 
9
static const double kDummyMultMid = (1.0 / kBitPrice) / 2;
 
10
 
 
11
CPriceTables::CPriceTables()
 
12
{
 
13
  double aLn2 = log(2);
 
14
  double aLnAll = log(kBitModelTotal >> kNumMoveReducingBits);
 
15
  for(UINT32 i = 1; i < (kBitModelTotal >> kNumMoveReducingBits) - 1; i++)
 
16
    m_StatePrices[i] = UINT32((fabs(aLnAll - log(i)) / aLn2 + kDummyMultMid) * kBitPrice);
 
17
}
 
18
 
 
19
CPriceTables g_PriceTables;
 
20
 
 
21
}}