Skip to content

Commit

Permalink
remove printouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Benes committed Jan 29, 2024
1 parent 29e58b9 commit 7ade408
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/jpeglib/cjpeglib/cjpeglib_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ FILE * f_unquantized = NULL; // tmp file for collecting unquantized coefficients
void start_unquantized_loading(const char *dstfile_uq) {
if(f_unquantized != NULL)
throw "unquantized loading started already!";
fprintf(stderr, "Trying to open %s!\n", dstfile_uq);
f_unquantized = fopen(dstfile_uq, "wb");
if(f_unquantized == NULL)
throw "failed to open unquantized tmp file!";
Expand Down
2 changes: 1 addition & 1 deletion src/jpeglib/cjpeglib/cjpeglib_spatial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ int write_jpeg_spatial(

// setup tmp file for unquantized coefficients
if(dstfile_uq != NULL) {
fprintf(stderr, "start %s\n", dstfile_uq);
// fprintf(stderr, "start %s\n", dstfile_uq);
start_unquantized_loading(dstfile_uq);
}

Expand Down
4 changes: 0 additions & 4 deletions src/jpeglib/spatial_jpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ def unquantized_coefficients(
assert self.samp_factor == '4:4:4' or (self.samp_factor == 1).all()
assert version.get() in version.LIBJPEG_VERSIONS
# write to temporary files
# tmp_dir = pathlib.Path(tempfile.mkdtemp())
# dst = str(tmp_dir / 'dst.jpeg')
# dst_uq = str(tmp_dir / 'uq.bin')
dst = tempfile.NamedTemporaryFile('w', suffix='.jpeg', delete=False)
pathlib.Path(dst.name).parent.mkdir(parents=True, exist_ok=True)
dst_uq = tempfile.NamedTemporaryFile('w', suffix='.bin', delete=False)
Expand All @@ -239,7 +236,6 @@ def unquantized_coefficients(
)

# extract unquantized coefficients
print('opening', dst_uq.name)
with open(dst_uq.name, 'rb') as fp:
content = fp.read()
dst.close()
Expand Down
5 changes: 2 additions & 3 deletions tests/test_spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,8 @@ def test_unquantized(self, dct_method, colorspace):
)
im = jpeglib.from_spatial(x)
im.samp_factor = '4:4:4'
print('writing to', self.tmp.name)
with open(self.tmp.name, 'wb') as fp:
fp.write(x.tobytes())
# with open(self.tmp.name, 'wb') as fp:
# fp.write(x.tobytes())
im.write_spatial(self.tmp.name, dct_method=dct_method)
Y = jpeglib.read_dct(self.tmp.name).Y

Expand Down

0 comments on commit 7ade408

Please sign in to comment.