Skip to content

Commit 9dcf332

Browse files
committed
Minor Updates
1 parent 2dac3de commit 9dcf332

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

arithmetic_decode_image.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ const ll MAX = 4294967295;
1010
ll lower[257];
1111
vector <ll> _low, _high;
1212

13-
string write_bits(bool bit, int bit_to_fall){
14-
string tmp;
15-
tmp += to_string(bit);
16-
while(bit_to_fall){
17-
tmp += to_string(!bit);
18-
bit_to_fall -= 1;
19-
}
20-
return tmp;
21-
}
22-
2313
int to_int(int _pos, string &encode){
2414
int n = 0;
2515
for (int i = _pos; i < 32 + _pos; i++)

arithmetic_encode_image.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,6 @@ string write_bits(bool bit, int bit_to_fall){
2020
return tmp;
2121
}
2222

23-
int to_int(int _pos, string &encode){
24-
int n = 0;
25-
for (int i = _pos; i < sizeof(short) * 8 + _pos; i++)
26-
{
27-
n <<= 1;
28-
n |= encode[i] - '0';
29-
}
30-
return n;
31-
}
32-
33-
ll add_bit(ll value, int count_taken, bool &flag, string &encode){
34-
bitset<16> a(value);
35-
36-
if(flag == 1){
37-
a.reset(0);
38-
}
39-
else if(count_taken > encode.length()){
40-
a.set(0);
41-
flag = 1;
42-
}
43-
else if(encode[count_taken] == '1'){
44-
a.set(0);
45-
}
46-
else if(encode[count_taken] == '0'){
47-
a.reset(0);
48-
}
49-
50-
value = (ll)(a.to_ulong());
51-
return value;
52-
}
53-
5423
ofstream out("arithmetic_encoded.txt");
5524

5625
string image_pixels = "";

0 commit comments

Comments
 (0)