Skip to content

Commit

Permalink
updated libframeutil and libzedmd to fix scaling issues (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner authored Apr 13, 2024
1 parent 638654f commit 1d17694
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 29 deletions.
2 changes: 1 addition & 1 deletion include/DMDUtil/DMDUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#define DMDUTIL_VERSION_MAJOR 0 // X Digits
#define DMDUTIL_VERSION_MINOR 6 // Max 2 Digits
#define DMDUTIL_VERSION_PATCH 0 // Max 2 Digits
#define DMDUTIL_VERSION_PATCH 1 // Max 2 Digits

#define _DMDUTIL_STR(x) #x
#define DMDUTIL_STR(x) _DMDUTIL_STR(x)
Expand Down
4 changes: 2 additions & 2 deletions platforms/android/arm64-v8a/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=d7e79b09f82144ee6a017bbea074efc23316201e
LIBZEDMD_SHA=6395357ce400036432587b4f696a2fac14ddd21a
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=c640ea2cec94097e8baefee9dab39266970e4405
LIBFRAMEUTIL_SHA=d9bde3069786f1a33d2021afe19566d812e873f5
LIBFRAMEUTIL_SHA=30048ca23d41ca0a8f7d5ab75d3f646a19a90182

if [[ $(uname) == "Linux" ]]; then
NUM_PROCS=$(nproc)
Expand Down
4 changes: 2 additions & 2 deletions platforms/ios/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=d7e79b09f82144ee6a017bbea074efc23316201e
LIBZEDMD_SHA=6395357ce400036432587b4f696a2fac14ddd21a
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=c640ea2cec94097e8baefee9dab39266970e4405
LIBFRAMEUTIL_SHA=d9bde3069786f1a33d2021afe19566d812e873f5
LIBFRAMEUTIL_SHA=30048ca23d41ca0a8f7d5ab75d3f646a19a90182

NUM_PROCS=$(sysctl -n hw.ncpu)

Expand Down
4 changes: 2 additions & 2 deletions platforms/linux/aarch64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=d7e79b09f82144ee6a017bbea074efc23316201e
LIBZEDMD_SHA=6395357ce400036432587b4f696a2fac14ddd21a
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=c640ea2cec94097e8baefee9dab39266970e4405
LIBFRAMEUTIL_SHA=d9bde3069786f1a33d2021afe19566d812e873f5
LIBFRAMEUTIL_SHA=30048ca23d41ca0a8f7d5ab75d3f646a19a90182

NUM_PROCS=$(nproc)

Expand Down
4 changes: 2 additions & 2 deletions platforms/linux/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=d7e79b09f82144ee6a017bbea074efc23316201e
LIBZEDMD_SHA=6395357ce400036432587b4f696a2fac14ddd21a
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=c640ea2cec94097e8baefee9dab39266970e4405
LIBFRAMEUTIL_SHA=d9bde3069786f1a33d2021afe19566d812e873f5
LIBFRAMEUTIL_SHA=30048ca23d41ca0a8f7d5ab75d3f646a19a90182

NUM_PROCS=$(nproc)

Expand Down
4 changes: 2 additions & 2 deletions platforms/macos/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=d7e79b09f82144ee6a017bbea074efc23316201e
LIBZEDMD_SHA=6395357ce400036432587b4f696a2fac14ddd21a
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=c640ea2cec94097e8baefee9dab39266970e4405
LIBFRAMEUTIL_SHA=d9bde3069786f1a33d2021afe19566d812e873f5
LIBFRAMEUTIL_SHA=30048ca23d41ca0a8f7d5ab75d3f646a19a90182

NUM_PROCS=$(sysctl -n hw.ncpu)

Expand Down
4 changes: 2 additions & 2 deletions platforms/macos/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=d7e79b09f82144ee6a017bbea074efc23316201e
LIBZEDMD_SHA=6395357ce400036432587b4f696a2fac14ddd21a
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=c640ea2cec94097e8baefee9dab39266970e4405
LIBFRAMEUTIL_SHA=d9bde3069786f1a33d2021afe19566d812e873f5
LIBFRAMEUTIL_SHA=30048ca23d41ca0a8f7d5ab75d3f646a19a90182

NUM_PROCS=$(sysctl -n hw.ncpu)

Expand Down
4 changes: 2 additions & 2 deletions platforms/tvos/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=d7e79b09f82144ee6a017bbea074efc23316201e
LIBZEDMD_SHA=6395357ce400036432587b4f696a2fac14ddd21a
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=c640ea2cec94097e8baefee9dab39266970e4405
LIBFRAMEUTIL_SHA=d9bde3069786f1a33d2021afe19566d812e873f5
LIBFRAMEUTIL_SHA=30048ca23d41ca0a8f7d5ab75d3f646a19a90182

NUM_PROCS=$(sysctl -n hw.ncpu)

Expand Down
4 changes: 2 additions & 2 deletions platforms/win/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=d7e79b09f82144ee6a017bbea074efc23316201e
LIBZEDMD_SHA=6395357ce400036432587b4f696a2fac14ddd21a
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=c640ea2cec94097e8baefee9dab39266970e4405
LIBFRAMEUTIL_SHA=d9bde3069786f1a33d2021afe19566d812e873f5
LIBFRAMEUTIL_SHA=30048ca23d41ca0a8f7d5ab75d3f646a19a90182

echo "Building libraries..."
echo " CARGS_SHA: ${CARGS_SHA}"
Expand Down
4 changes: 2 additions & 2 deletions platforms/win/x86/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=d7e79b09f82144ee6a017bbea074efc23316201e
LIBZEDMD_SHA=6395357ce400036432587b4f696a2fac14ddd21a
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f
LIBPUPDMD_SHA=c640ea2cec94097e8baefee9dab39266970e4405
LIBFRAMEUTIL_SHA=d9bde3069786f1a33d2021afe19566d812e873f5
LIBFRAMEUTIL_SHA=30048ca23d41ca0a8f7d5ab75d3f646a19a90182

echo "Building libraries..."
echo " CARGS_SHA: ${CARGS_SHA}"
Expand Down
26 changes: 16 additions & 10 deletions third-party/include/FrameUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,21 +298,21 @@ inline void Helper::ScaleDownPUP(uint8_t* pDestFrame, const uint16_t destWidth,
inline void Helper::ScaleDown(uint8_t* pDestFrame, const uint16_t destWidth, const uint8_t destHeight,
const uint8_t* pSrcFrame, const uint16_t srcWidth, const uint8_t srcHeight, uint8_t bits)
{
memset(pDestFrame, 0, destWidth * destHeight);
uint8_t xOffset = (destWidth - (srcWidth / 2)) / 2;
uint8_t yOffset = (destHeight - (srcHeight / 2)) / 2;
uint8_t bytes = bits / 8; // RGB24 (3 byte) or RGB16 (2 byte)
uint8_t bytes = bits / 8; // RGB24 (3 byte) or RGB16 (2 byte) or indexed (1 byte)
memset(pDestFrame, 0, destWidth * destHeight * bytes);

for (uint8_t y = 0; y < srcHeight; y += 2)
{
uint16_t upper_left = (y * srcWidth) * bytes;
uint16_t upper_right = upper_left + bytes;
uint16_t lower_left = upper_left + (srcWidth * bytes);
uint16_t lower_right = lower_left + bytes;
uint16_t target = ((((y / 2) + yOffset) * destWidth) + xOffset) * bytes;

for (uint16_t x = 0; x < srcWidth; x += 2)
{
uint16_t upper_left = y * srcWidth * bytes + x * bytes;
uint16_t upper_right = upper_left + bytes;
uint16_t lower_left = upper_left + srcWidth * bytes;
uint16_t lower_right = lower_left + bytes;
uint16_t target = (xOffset + (x / 2) + (y / 2) * destHeight) * bytes;

if (x < srcWidth / 2)
{
if (y < srcHeight / 2)
Expand Down Expand Up @@ -375,6 +375,12 @@ inline void Helper::ScaleDown(uint8_t* pDestFrame, const uint16_t destWidth, con
memcpy(&pDestFrame[target], &pSrcFrame[lower_right], bytes);
}
}

upper_left += 2 * bytes;
upper_right += 2 * bytes;
lower_left += 2 * bytes;
lower_right += 2 * bytes;
target += bytes;
}
}
}
Expand Down Expand Up @@ -519,11 +525,11 @@ inline void Helper::ScaleUpIndexed(uint8_t* pDestFrame, const uint8_t* pSrcFrame
inline void Helper::Center(uint8_t* pDestFrame, const uint16_t destWidth, const uint8_t destHeight,
const uint8_t* pSrcFrame, const uint16_t srcWidth, const uint8_t srcHeight, uint8_t bits)
{
uint8_t xOffset = (destWidth - srcWidth) / 2;
uint8_t yOffset = (destHeight - srcHeight) / 2;
uint8_t bytes = bits / 8; // RGB24 (3 byte) or RGB16 (2 byte) or indexed (1 byte)

memset(pDestFrame, 0, destWidth * destHeight * bytes);
uint8_t xOffset = (destWidth - srcWidth) / 2;
uint8_t yOffset = (destHeight - srcHeight) / 2;

for (uint8_t y = 0; y < srcHeight; y++)
{
Expand Down

0 comments on commit 1d17694

Please sign in to comment.