Opened 8 years ago
Closed 8 years ago
#6146 closed defect (fixed)
ComputeMedianCutPCT issues an empty color table
Reported by: | ccjklppp | Owned by: | warmerdam |
---|---|---|---|
Priority: | highest | Milestone: | 2.1.0 |
Component: | Algorithms | Version: | 2.0.1 |
Severity: | critical | Keywords: | ComputeMedianCutPCT |
Cc: |
Description
I'm using the ComputeMedianCutPCT method to calculate a color table for 60 tiffs (less than 17GB in total). First we created a VRT mosaic of all the tiffs, then we used it as the input for the ComputeMedianCutPCT method. The result was a color table that contains only 1 color. When the set was reduced to only 40 tiffs, the color tables was ok (contained 240 colors as requested). We tried with 2 different sets and the outcome was the same - when the size is bigger than ~15GB, the result color tables contains only 1 value =(124,124,124). It seems that the size of the input creates this problem. Please help!
Attachments (3)
Change History (12)
comment:1 by , 8 years ago
comment:4 by , 8 years ago
by , 8 years ago
Attachment: | gdal_alg_priv.h added |
---|
by , 8 years ago
Attachment: | gdalgeopackagerasterband.cpp added |
---|
by , 8 years ago
Attachment: | gdalmediancut.cpp added |
---|
comment:5 by , 8 years ago
Hi,
I fixed the problem by changing all the counters from int to GIntBig type. The 3 files that was changes are attached. Can you please insert the changes to the source control?
thanks.
follow-up: 8 comment:6 by , 8 years ago
ccjklppp, I'd appreciate if you could test the below fix and confirm it works. It is a variant of your fix but that uses GUInt32 or GUIntBig depending on the raster dimensions, so as to limit the amount of memory to the strict necessary.
trunk r31065 "GDALComputeMedianCutPCT(): fix to make it work with rasters with more than 2 billion pixels (more precisely when a color bucket has more than > 2 billion pixel occurence, #6146)"
comment:9 by , 8 years ago
Milestone: | 2.0.2 → 2.1.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
It seems that the current algorithm hasn't been designed to work if a color bucket is hit more than 2 billion times. 64 bit counts might be needed in that case. I can be contacted at contact@… .