kopia lustrzana https://github.com/OpenDroneMap/WebODM
Merge pull request #1719 from pierotofy/rasterblock
Improve cache hits during raster exportpull/1723/head v2.9.0
commit
87a6becffb
|
@ -53,8 +53,8 @@ def compute_subwindows(window, max_window_size, overlap_pixels=0):
|
|||
|
||||
# Generate the list of windows
|
||||
windows = []
|
||||
for x_offset in x_offsets:
|
||||
for y_offset in y_offsets:
|
||||
for y_offset in y_offsets:
|
||||
for x_offset in x_offsets:
|
||||
w = Window(
|
||||
x_offset,
|
||||
y_offset,
|
||||
|
@ -71,6 +71,19 @@ def compute_subwindows(window, max_window_size, overlap_pixels=0):
|
|||
|
||||
return windows
|
||||
|
||||
def compute_block_aligned_subwindows(src, win):
|
||||
subwins = []
|
||||
for _, w in src.block_windows(1):
|
||||
dst_w = Window(
|
||||
w.col_off - win.col_off,
|
||||
w.row_off - win.row_off,
|
||||
w.width,
|
||||
w.height
|
||||
)
|
||||
subwins.append([w, dst_w])
|
||||
|
||||
return subwins
|
||||
|
||||
def padded_window(w, pad):
|
||||
return Window(w.col_off - pad, w.row_off - pad, w.width + pad * 2, w.height + pad * 2)
|
||||
|
||||
|
@ -78,11 +91,19 @@ def export_raster(input, output, progress_callback=None, **opts):
|
|||
now = time.time()
|
||||
|
||||
current_progress = 0
|
||||
last_update = 0
|
||||
|
||||
def p(text, perc=0):
|
||||
nonlocal current_progress
|
||||
nonlocal last_update
|
||||
|
||||
t = time.time()
|
||||
current_progress += perc
|
||||
if progress_callback is not None:
|
||||
progress_callback(text, current_progress)
|
||||
|
||||
if t - last_update >= 1:
|
||||
if progress_callback is not None:
|
||||
progress_callback(text, current_progress)
|
||||
last_update = t
|
||||
|
||||
epsg = opts.get('epsg')
|
||||
expression = opts.get('expression')
|
||||
|
@ -204,6 +225,7 @@ def export_raster(input, output, progress_callback=None, **opts):
|
|||
alpha_index = src.colorinterp.index(ColorInterp.alpha) + 1
|
||||
|
||||
subwins = compute_subwindows(win, window_size)
|
||||
# subwins = compute_block_aligned_subwindows(src, win)
|
||||
|
||||
if rgb and expression is None:
|
||||
# More than 4 bands?
|
||||
|
|
Ładowanie…
Reference in New Issue