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

[pull] master from OSGeo:master #134

Merged
merged 9 commits into from
Jan 7, 2025
Merged
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
3 changes: 2 additions & 1 deletion apps/gdalalg_abstract_pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ GDALAbstractPipelineAlgorithm<StepAlgorithm>::GetAutoComplete(
std::vector<std::string> ret;
if (args.size() <= 1)
{
ret.push_back("read");
if (args.empty() || args.front() != "read")
ret.push_back("read");
}
else if (args.back() == "!" || args[args.size() - 2] == "!")
{
Expand Down
5 changes: 5 additions & 0 deletions autotest/utilities/test_gdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ def test_gdal_completion_pipeline(gdal_path, subcommand):
).split(" ")
assert out == ["read"]

out = gdaltest.runexternal(
f"{gdal_path} completion gdal {subcommand} pipeline read"
).split(" ")
assert out == [""]

out = gdaltest.runexternal(
f"{gdal_path} completion gdal {subcommand} pipeline read -"
).split(" ")
Expand Down
4 changes: 4 additions & 0 deletions docker/alpine-normal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ RUN date

RUN apk add --no-cache \
armadillo \
bash-completion \
basisu \
blosc \
brotli-libs \
Expand Down Expand Up @@ -413,7 +414,10 @@ COPY --from=builder /build_proj/usr/include/ /usr/include/
COPY --from=builder /build_proj/usr/bin/ /usr/bin/
COPY --from=builder /build_proj/usr/lib/ /usr/lib/

COPY --from=builder /build/usr/share/bash-completion/ /usr/share/bash-completion/
COPY --from=builder /build/usr/share/gdal/ /usr/share/gdal/
COPY --from=builder /build/usr/include/ /usr/include/
COPY --from=builder /build_gdal_python/usr/ /usr/
COPY --from=builder /build_gdal_version_changing/usr/ /usr/

CMD ["/bin/bash", "-l"]
4 changes: 4 additions & 0 deletions docker/alpine-small/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ RUN date

RUN apk add --no-cache \
libstdc++ \
bash-completion \
sqlite-libs \
libcurl tiff \
zlib zstd-libs lz4-libs libdeflate libarchive \
Expand All @@ -191,6 +192,9 @@ COPY --from=builder /build_proj/usr/include/ /usr/include/
COPY --from=builder /build_proj/usr/bin/ /usr/bin/
COPY --from=builder /build_proj/usr/lib/ /usr/lib/

COPY --from=builder /build/usr/share/bash-completion/ /usr/share/bash-completion/
COPY --from=builder /build/usr/share/gdal/ /usr/share/gdal/
COPY --from=builder /build/usr/include/ /usr/include/
COPY --from=builder /build_gdal_version_changing/usr/ /usr/

CMD ["/bin/bash", "-l"]
7 changes: 6 additions & 1 deletion docker/ubuntu-full/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
wget curl unzip ca-certificates \
# GDAL dependencies
&& apt-get install -y \
libopenjp2-7 libcairo2 python3-numpy \
bash-completion libopenjp2-7 libcairo2 python3-numpy \
libpng16-16 libjpeg-turbo8 libgif7 liblzma5 libgeos3.12.1 libgeos-c1v5 \
libxml2 libexpat1 \
libxerces-c3.2 libnetcdf-c++4-1 netcdf-bin libpoppler134 libspatialite8 librasterlite2-1 gpsbabel \
Expand Down Expand Up @@ -606,6 +606,7 @@ COPY --from=builder /build${PROJ_INSTALL_PREFIX}/include/ ${PROJ_INSTALL_PREFIX
COPY --from=builder /build${PROJ_INSTALL_PREFIX}/bin/ ${PROJ_INSTALL_PREFIX}/bin/
COPY --from=builder /build${PROJ_INSTALL_PREFIX}/lib/ ${PROJ_INSTALL_PREFIX}/lib/

COPY --from=builder /build/usr/share/bash-completion/ /usr/share/bash-completion/
COPY --from=builder /build/usr/share/java /usr/share/java
COPY --from=builder /build/usr/share/gdal/ /usr/share/gdal/
COPY --from=builder /build/usr/include/ /usr/include/
Expand All @@ -618,3 +619,7 @@ RUN ldconfig
RUN if test "$(uname -p)" = "x86_64"; then \
ogrinfo ADBC::memory: -oo ADBC_DRIVER=duckdb -oo PRELUDE_STATEMENTS="INSTALL spatial"; \
fi

RUN echo "source /usr/share/bash-completion/bash_completion" >> /root/.bashrc

CMD ["/bin/bash", "-l"]
7 changes: 6 additions & 1 deletion docker/ubuntu-small/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
curl unzip ca-certificates \
# GDAL dependencies
&& apt-get install -y --no-install-recommends \
python3-numpy libpython3.12 \
bash-completion python3-numpy libpython3.12 \
libjpeg-turbo8 libgeos3.12.1 libgeos-c1v5 \
libexpat1 \
libxerces-c3.2 \
Expand All @@ -258,9 +258,14 @@ COPY --from=builder /build${PROJ_INSTALL_PREFIX}/include/ ${PROJ_INSTALL_PREFIX
COPY --from=builder /build${PROJ_INSTALL_PREFIX}/bin/ ${PROJ_INSTALL_PREFIX}/bin/
COPY --from=builder /build${PROJ_INSTALL_PREFIX}/lib/ ${PROJ_INSTALL_PREFIX}/lib/

COPY --from=builder /build/usr/share/bash-completion/ /usr/share/bash-completion/
COPY --from=builder /build/usr/share/gdal/ /usr/share/gdal/
COPY --from=builder /build/usr/include/ /usr/include/
COPY --from=builder /build_gdal_python/usr/ /usr/
COPY --from=builder /build_gdal_version_changing/usr/ /usr/

RUN ldconfig

RUN echo "source /usr/share/bash-completion/bash_completion" >> /root/.bashrc

CMD ["/bin/bash", "-l"]
2 changes: 1 addition & 1 deletion frmts/libertiff/libertiffdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "gdal_thread_pool.h"
#include "memdataset.h"

#define LIBERTIFF_NS GDALLibertiffDataset
#define LIBERTIFF_NS GDAL_libertiff
#include "libertiff.hpp"

#include "libtiff_codecs.h"
Expand Down
10 changes: 10 additions & 0 deletions fuzzers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ build_gdal_specialized_fuzzer(gdal_sdts GDALRegister_SDTS "/vsimem/test.tar" "/v
build_gdal_specialized_fuzzer(gdal_vrt GDALAllRegister "/vsimem/test.tar" "/vsitar//vsimem/test.tar/test.vrt")
build_gdal_specialized_fuzzer(ers GDALRegister_ERS "/vsimem/test.tar" "/vsitar//vsimem/test.tar/test.ers")

build_fuzzer(
NAME
libertiff_fuzzer
SOURCES
gdal_fuzzer.cpp
DEFINITIONS
-DREGISTER_FUNC=GDALRegister_LIBERTIFF
-DDRIVER_NAME="LIBERTIFF"
)

build_fuzzer(
NAME
gdal_filesystem_fuzzer
Expand Down
2 changes: 2 additions & 0 deletions fuzzers/build_google_oss_fuzzers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ build_gdal_specialized_fuzzer()

build_fuzzer gtiff_mmap $(dirname $0)/gdal_fuzzer.cpp -DREGISTER_FUNC=GDALRegister_GTiff -DGTIFF_USE_MMAP

build_fuzzer libertiff $(dirname $0)/gdal_fuzzer.cpp -DREGISTER_FUNC=GDALRegister_LIBERTIFF -DDRIVER_NAME="\"LIBERTIFF\""

fuzzerFiles="$(dirname $0)/*.cpp"
for F in $fuzzerFiles; do
if test $F != "$(dirname $0)/fuzzingengine.cpp"; then
Expand Down
10 changes: 9 additions & 1 deletion fuzzers/gdal_fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,15 @@ int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
#else
const char *pszGDALFilename = GDAL_FILENAME;
#endif
GDALDatasetH hDS = GDALOpen(pszGDALFilename, GA_ReadOnly);

#ifdef DRIVER_NAME
const char *const apszAllowedDrivers[] = {DRIVER_NAME, nullptr};
#else
const char *const *apszAllowedDrivers = nullptr;
#endif

GDALDatasetH hDS = GDALOpenEx(pszGDALFilename, GDAL_OF_RASTER,
apszAllowedDrivers, nullptr, nullptr);
if (hDS)
{
const int nTotalBands = GDALGetRasterCount(hDS);
Expand Down
151 changes: 0 additions & 151 deletions gcore/gdal_priv_templates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,155 +778,4 @@ inline void GDALCopy4Words(const double *pValueIn, float *const pValueOut)

#endif // defined(__x86_64) || defined(_M_X64)

/************************************************************************/
/* GDALTranspose2DSingleToSingle() */
/************************************************************************/
/**
* Transpose a 2D array of non-complex values, in a efficient (cache-oblivious) way.
*
* @param pSrc Source array of height = nSrcHeight and width = nSrcWidth.
* @param pDst Destination transposed array of height = nSrcWidth and width = nSrcHeight.
* @param nSrcWidth Width of pSrc array.
* @param nSrcHeight Height of pSrc array.
*/

template <class DST, class SRC>
void GDALTranspose2DSingleToSingle(const SRC *CPL_RESTRICT pSrc,
DST *CPL_RESTRICT pDst, size_t nSrcWidth,
size_t nSrcHeight)
{
constexpr size_t blocksize = 32;
for (size_t i = 0; i < nSrcHeight; i += blocksize)
{
const size_t max_k = std::min(i + blocksize, nSrcHeight);
for (size_t j = 0; j < nSrcWidth; j += blocksize)
{
// transpose the block beginning at [i,j]
const size_t max_l = std::min(j + blocksize, nSrcWidth);
for (size_t k = i; k < max_k; ++k)
{
for (size_t l = j; l < max_l; ++l)
{
GDALCopyWord(pSrc[l + k * nSrcWidth],
pDst[k + l * nSrcHeight]);
}
}
}
}
}

/************************************************************************/
/* GDALTranspose2DComplexToComplex() */
/************************************************************************/
/**
* Transpose a 2D array of complex values into an array of complex values,
* in a efficient (cache-oblivious) way.
*
* @param pSrc Source array of height = nSrcHeight and width = nSrcWidth.
* @param pDst Destination transposed array of height = nSrcWidth and width = nSrcHeight.
* @param nSrcWidth Width of pSrc array.
* @param nSrcHeight Height of pSrc array.
*/
template <class DST, class SRC>
void GDALTranspose2DComplexToComplex(const SRC *CPL_RESTRICT pSrc,
DST *CPL_RESTRICT pDst, size_t nSrcWidth,
size_t nSrcHeight)
{
constexpr size_t blocksize = 32;
for (size_t i = 0; i < nSrcHeight; i += blocksize)
{
const size_t max_k = std::min(i + blocksize, nSrcHeight);
for (size_t j = 0; j < nSrcWidth; j += blocksize)
{
// transpose the block beginning at [i,j]
const size_t max_l = std::min(j + blocksize, nSrcWidth);
for (size_t k = i; k < max_k; ++k)
{
for (size_t l = j; l < max_l; ++l)
{
GDALCopyWord(pSrc[2 * (l + k * nSrcWidth) + 0],
pDst[2 * (k + l * nSrcHeight) + 0]);
GDALCopyWord(pSrc[2 * (l + k * nSrcWidth) + 1],
pDst[2 * (k + l * nSrcHeight) + 1]);
}
}
}
}
}

/************************************************************************/
/* GDALTranspose2DComplexToSingle() */
/************************************************************************/
/**
* Transpose a 2D array of complex values into an array of non-complex values,
* in a efficient (cache-oblivious) way.
*
* @param pSrc Source array of height = nSrcHeight and width = nSrcWidth.
* @param pDst Destination transposed array of height = nSrcWidth and width = nSrcHeight.
* @param nSrcWidth Width of pSrc array.
* @param nSrcHeight Height of pSrc array.
*/
template <class DST, class SRC>
void GDALTranspose2DComplexToSingle(const SRC *CPL_RESTRICT pSrc,
DST *CPL_RESTRICT pDst, size_t nSrcWidth,
size_t nSrcHeight)
{
constexpr size_t blocksize = 32;
for (size_t i = 0; i < nSrcHeight; i += blocksize)
{
const size_t max_k = std::min(i + blocksize, nSrcHeight);
for (size_t j = 0; j < nSrcWidth; j += blocksize)
{
// transpose the block beginning at [i,j]
const size_t max_l = std::min(j + blocksize, nSrcWidth);
for (size_t k = i; k < max_k; ++k)
{
for (size_t l = j; l < max_l; ++l)
{
GDALCopyWord(pSrc[2 * (l + k * nSrcWidth) + 0],
pDst[k + l * nSrcHeight]);
}
}
}
}
}

/************************************************************************/
/* GDALTranspose2DSingleToComplex() */
/************************************************************************/
/**
* Transpose a 2D array of non-complex values into an array of complex values,
* in a efficient (cache-oblivious) way.
*
* @param pSrc Source array of height = nSrcHeight and width = nSrcWidth.
* @param pDst Destination transposed array of height = nSrcWidth and width = nSrcHeight.
* @param nSrcWidth Width of pSrc array.
* @param nSrcHeight Height of pSrc array.
*/
template <class DST, class SRC>
void GDALTranspose2DSingleToComplex(const SRC *CPL_RESTRICT pSrc,
DST *CPL_RESTRICT pDst, size_t nSrcWidth,
size_t nSrcHeight)
{
constexpr size_t blocksize = 32;
for (size_t i = 0; i < nSrcHeight; i += blocksize)
{
const size_t max_k = std::min(i + blocksize, nSrcHeight);
for (size_t j = 0; j < nSrcWidth; j += blocksize)
{
// transpose the block beginning at [i,j]
const size_t max_l = std::min(j + blocksize, nSrcWidth);
for (size_t k = i; k < max_k; ++k)
{
for (size_t l = j; l < max_l; ++l)
{
GDALCopyWord(pSrc[l + k * nSrcWidth],
pDst[2 * (k + l * nSrcHeight) + 0]);
pDst[2 * (k + l * nSrcHeight) + 1] = 0;
}
}
}
}
}

#endif // GDAL_PRIV_TEMPLATES_HPP_INCLUDED
Loading
Loading