walterDurin / dct-watermark

Automatically exported from code.google.com/p/dct-watermark
Apache License 2.0
0 stars 0 forks source link

Possibly unnecessary calculations in the tool #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I ported the code to C# to use it within an Open Source Cryptology learning 
tool CrypTool2. Doing so I stumbled over one calculation in the embedding 
method of the Watermark class, line 175 and 176:
        for (int y = 0; y < 128 / this.bitBoxSize * this.bitBoxSize; y++) {
            for (int x = 0; x < 128 / this.bitBoxSize * this.bitBoxSize; x++) {

From my mathematical knowledge, a/b*b is the same as (a/b)*b = a so I tested 
the same in my code, modifying it to
        for (int y = 0; y < 128; y++) {
            for (int x = 0; x < 128; x++) {
and it still works. As I'm not too familiar with the whole code and didn't 
understand every computation, I assume this is either a mistake and should be
128 / ( this.bitBoxSize * this.bitBoxSize )
or can be improved by removing the unnecessary calculation.
As it works fine for me without the calculation, I assume #2 is the case, but 
would be great if you (Or someone) could confirm.
Thanks

Original issue reported on code.google.com by nilsrehw...@googlemail.com on 21 Nov 2014 at 3:22