Skip to content

Commit

Permalink
Row-major storage for encode-file/decode-file
Browse files Browse the repository at this point in the history
  • Loading branch information
league committed Jun 14, 2015
1 parent 62f06fd commit 1b4db19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions decode-file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ int main(int argc, char** argv)
ofstream out(secretPath.c_str(), ios::binary);
bufstate bs = { 0, 0 };

for(unsigned x = 0; x < g.width(); x++) {
for(unsigned y = 0; y < g.height(); y++) {
for(unsigned y = 0; y < g.height(); y++) {
for(unsigned x = 0; x < g.width(); x++) {
Color c = im.pixelColor(x, y);
pushTwoBits(out, bs, c.redQuantum());
pushTwoBits(out, bs, c.greenQuantum());
Expand Down
6 changes: 3 additions & 3 deletions encode-file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ int main(int argc, char** argv)
ifstream in(secretPath.c_str(), ios::binary);
bufstate bs = { 0, 0 };

for(unsigned x = 0; x < g.width(); x++) {
for(unsigned y = 0; y < g.height(); y++) {
for(unsigned y = 0; y < g.height(); y++) {
for(unsigned x = 0; x < g.width(); x++) {
Color c = im.pixelColor(x, y);
c.redQuantum(mergeNextTwoBits(in, bs, c.redQuantum()));
c.greenQuantum(mergeNextTwoBits(in, bs, c.greenQuantum()));
c.blueQuantum(mergeNextTwoBits(in, bs, c.blueQuantum()));
im.pixelColor(x, y, c);
if(!in) goto done;
//if(!in) goto done;
}
}

Expand Down

0 comments on commit 1b4db19

Please sign in to comment.