Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jpeg fix #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/openslide-vendor-aperio.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,32 @@ static bool decode_tile(struct level *l,
break;
default:
// not for us? fallback
return _openslide_tiff_read_tile(tiffl, tiff, dest,

if (!_openslide_tiff_read_tile(tiffl, tiff, dest,
tile_col, tile_row,
err);
err)) {

// In some Aperio images, one tile (typically 0, 0), in one or more levels,
// is partly overwritten with some unknown data. This seems to happen
// from byte 0 or byte 1 of the tile data. Such garbled tiles are
// impossible to read, so just return false!
// The other half of this fix/hack consists of calling render_missing_tile
// if _openslide_tiff_read_tile_data returns false.
void *buf;
int32_t buflen;
if (_openslide_tiff_read_tile_data(tiffl, tiff,
&buf, &buflen,
tile_col, tile_row,
err)) {
const unsigned char *bytes = buf;
if (bytes[0] == 0x11 || (bytes[0] == 0xff && bytes[1] == 0x11)) {
return render_missing_tile(l, tiff, dest, tile_col, tile_row, err);
} else {
return false;
}
}
}
return true;
}

// read raw tile
Expand Down
4 changes: 2 additions & 2 deletions src/openslide.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ openslide_t *openslide_open(const char *filename) {
osr->property_names = strv_from_hashtable_keys(osr->properties);

// start cache
osr->cache = _openslide_cache_create(_OPENSLIDE_USEFUL_CACHE_SIZE);
//osr->cache = _openslide_cache_create(0);
//osr->cache = _openslide_cache_create(_OPENSLIDE_USEFUL_CACHE_SIZE);
osr->cache = _openslide_cache_create(0);

return osr;
}
Expand Down