From 37c17c78f6d5e03e8281490e69e0055d5a293501 Mon Sep 17 00:00:00 2001 From: Samuel Gomes Date: Tue, 19 Sep 2023 02:07:57 +0530 Subject: [PATCH] Remove GPL xbr.hpp and update all license info --- Makefile | 2 +- internal/c/parts/video/image/image.cpp | 23 +- .../c/parts/video/image/pixelscalers/xbr.hpp | 384 ------------------ licenses/README.md | 12 +- licenses/license_dr_pcx.txt | 2 +- licenses/license_hqx.txt | 204 ++++++++++ licenses/license_mmpx.txt | 22 + licenses/license_nanosvg.txt | 20 + licenses/license_qoi.txt | 24 ++ licenses/license_stb_image_write.txt | 40 ++ licenses/license_sxbr.txt | 22 + 11 files changed, 346 insertions(+), 409 deletions(-) delete mode 100644 internal/c/parts/video/image/pixelscalers/xbr.hpp create mode 100644 licenses/license_hqx.txt create mode 100644 licenses/license_mmpx.txt create mode 100644 licenses/license_nanosvg.txt create mode 100644 licenses/license_qoi.txt create mode 100644 licenses/license_stb_image_write.txt create mode 100644 licenses/license_sxbr.txt diff --git a/Makefile b/Makefile index fc9bfc2cd..316dd07db 100644 --- a/Makefile +++ b/Makefile @@ -214,7 +214,7 @@ ifneq ($(filter y,$(DEP_SCREENIMAGE) $(DEP_IMAGE_CODEC)),) CXXFLAGS += -DDEPENDENCY_IMAGE_CODEC QBLIB_NAME := $(addsuffix 1,$(QBLIB_NAME)) - LICENSE_IN_USE += dr_pcx stb_image + LICENSE_IN_USE += stb_image nanosvg dr_pcx qoi stb_image_write hqx mmpx sxbr else QBLIB_NAME := $(addsuffix 0,$(QBLIB_NAME)) endif diff --git a/internal/c/parts/video/image/image.cpp b/internal/c/parts/video/image/image.cpp index e863dabb9..87c0a92c5 100644 --- a/internal/c/parts/video/image/image.cpp +++ b/internal/c/parts/video/image/image.cpp @@ -39,8 +39,6 @@ #include "pixelscalers/sxbr.hpp" #define MMPX_IMPLEMENTATION #include "pixelscalers/mmpx.hpp" -#define XBR_IMPLEMENTATION -#include "pixelscalers/xbr.hpp" #define HQX_IMPLEMENTATION #include "pixelscalers/hqx.hpp" #define STB_IMAGE_WRITE_IMPLEMENTATION @@ -73,11 +71,11 @@ extern const uint8_t charset8x8[256][8][8]; // used by func__saveimage extern const uint8_t charset8x16[256][16][8]; // used by func__saveimage /// @brief Pixel scaler algorithms -enum class ImageScaler { NONE = 0, SXBR2, MMPX2, XBR2X, XBR3X, XBR4X, HQ2XA, HQ2XB, HQ3XA, HQ3XB }; +enum class ImageScaler { NONE = 0, SXBR2, MMPX2, HQ2XA, HQ2XB, HQ3XA, HQ3XB }; /// @brief This is the scaling factors for ImageScaler enum -static const int g_ImageScaleFactor[] = {1, 2, 2, 2, 3, 4, 2, 2, 3, 3}; +static const int g_ImageScaleFactor[] = {1, 2, 2, 2, 2, 3, 3}; /// @brief Pixel scaler names for ImageScaler enum -static const char *g_ImageScalerName[] = {"NONE", "SXBR2", "MMPX2", "XBR2X", "XBR3X", "XBR4X", "HQ2XA", "HQ2XB", "HQ3XA", "HQ3XB"}; +static const char *g_ImageScalerName[] = {"NONE", "SXBR2", "MMPX2", "HQ2XA", "HQ2XB", "HQ3XA", "HQ3XB"}; /// @brief Runs a pixel scaler algorithm on raw image pixels. It will free 'data' if scaling occurs! /// @param data In + Out: The source raw image data in RGBA format @@ -103,21 +101,6 @@ static uint32_t *image_scale(uint32_t *data, int32_t *xOut, int32_t *yOut, Image mmpx_scale2x(data, pixels, *xOut, *yOut); break; - case ImageScaler::XBR2X: - xbr2x_32(reinterpret_cast(data), *xOut * sizeof(uint32_t), reinterpret_cast(pixels), newX * sizeof(uint32_t), - *xOut, *yOut); - break; - - case ImageScaler::XBR3X: - xbr3x_32(reinterpret_cast(data), *xOut * sizeof(uint32_t), reinterpret_cast(pixels), newX * sizeof(uint32_t), - *xOut, *yOut); - break; - - case ImageScaler::XBR4X: - xbr4x_32(reinterpret_cast(data), *xOut * sizeof(uint32_t), reinterpret_cast(pixels), newX * sizeof(uint32_t), - *xOut, *yOut); - break; - case ImageScaler::HQ2XA: hq2xA(data, *xOut, *yOut, pixels); break; diff --git a/internal/c/parts/video/image/pixelscalers/xbr.hpp b/internal/c/parts/video/image/pixelscalers/xbr.hpp deleted file mode 100644 index 32161189a..000000000 --- a/internal/c/parts/video/image/pixelscalers/xbr.hpp +++ /dev/null @@ -1,384 +0,0 @@ -/* - Hyllian's 2xBR v3.3b - - Copyright (C) 2011, 2012 Hyllian/Jararaca - sergiogdb@gmail.com - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -#ifndef _XBR_H -#define _XBR_H - -// 32bit -void xbr2x_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres); -void xbr3x_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres); -void xbr4x_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres); - -#endif - -#ifdef XBR_IMPLEMENTATION - -#include -#include - -#define LB_MASK 0x00FEFEFE -#define RED_BLUE_MASK 0x00FF00FF -#define GREEN_MASK 0x0000FF00 -#define PART_MASK 0x00FF00FF - -#define ALPHA_BLEND_BASE(a, b, m, s) \ - ((PART_MASK & (((a)&PART_MASK) + (((((b)&PART_MASK) - ((a)&PART_MASK)) * (m)) >> (s)))) | \ - ((PART_MASK & ((((a) >> 8) & PART_MASK) + ((((((b) >> 8) & PART_MASK) - (((a) >> 8) & PART_MASK)) * (m)) >> (s)))) << 8)) - -#define ALPHA_BLEND_32_W(a, b) ALPHA_BLEND_BASE(a, b, 1, 3) -#define ALPHA_BLEND_64_W(a, b) ALPHA_BLEND_BASE(a, b, 1, 2) -#define ALPHA_BLEND_128_W(a, b) ALPHA_BLEND_BASE(a, b, 1, 1) -#define ALPHA_BLEND_192_W(a, b) ALPHA_BLEND_BASE(a, b, 3, 2) -#define ALPHA_BLEND_224_W(a, b) ALPHA_BLEND_BASE(a, b, 7, 3) - -static uint32_t pixel_diff(uint32_t x, uint32_t y, const uint32_t *r2y) { -#define XBR_YMASK 0xff0000 -#define XBR_UMASK 0x00ff00 -#define XBR_VMASK 0x0000ff - - int32_t yuv1 = r2y[x & 0xffffff]; - int32_t yuv2 = r2y[y & 0xffffff]; - - return (abs((int)(x >> 24) - (int)(y >> 24))) + (abs((int)(yuv1 & XBR_YMASK) - (int)(yuv2 & XBR_YMASK)) >> 16) + - (abs((int)(yuv1 & XBR_UMASK) - (int)(yuv2 & XBR_UMASK)) >> 8) + abs((int)(yuv1 & XBR_VMASK) - (int)(yuv2 & XBR_VMASK)); -} - -#define xbr32_df(A, B) pixel_diff(A, B, r2y) -#define xbr32_eq(A, B) (xbr32_df(A, B) < 155) - -#define FILT2(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, N0, N1, N2, N3) \ - do { \ - if (PE != PH && PE != PF) { \ - const unsigned e = xbr32_df(PE, PC) + xbr32_df(PE, PG) + xbr32_df(PI, H5) + xbr32_df(PI, F4) + (xbr32_df(PH, PF) << 2); \ - const unsigned i = xbr32_df(PH, PD) + xbr32_df(PH, I5) + xbr32_df(PF, I4) + xbr32_df(PF, PB) + (xbr32_df(PE, PI) << 2); \ - if (e <= i) { \ - const unsigned px = xbr32_df(PE, PF) <= xbr32_df(PE, PH) ? PF : PH; \ - if (e < i && ((!xbr32_eq(PF, PB) && !xbr32_eq(PH, PD)) || (xbr32_eq(PE, PI) && (!xbr32_eq(PF, I4) && !xbr32_eq(PH, I5))) || \ - xbr32_eq(PE, PG) || xbr32_eq(PE, PC))) { \ - const unsigned ke = xbr32_df(PF, PG); \ - const unsigned ki = xbr32_df(PH, PC); \ - const int left = ke << 1 <= ki && PE != PG && PD != PG; \ - const int up = ke >= ki << 1 && PE != PC && PB != PC; \ - if (left && up) { \ - E[N3] = ALPHA_BLEND_224_W(E[N3], px); \ - E[N2] = ALPHA_BLEND_64_W(E[N2], px); \ - E[N1] = E[N2]; \ - } else if (left) { \ - E[N3] = ALPHA_BLEND_192_W(E[N3], px); \ - E[N2] = ALPHA_BLEND_64_W(E[N2], px); \ - } else if (up) { \ - E[N3] = ALPHA_BLEND_192_W(E[N3], px); \ - E[N1] = ALPHA_BLEND_64_W(E[N1], px); \ - } else { /* diagonal */ \ - E[N3] = ALPHA_BLEND_128_W(E[N3], px); \ - } \ - } else { \ - E[N3] = ALPHA_BLEND_128_W(E[N3], px); \ - } \ - } \ - } \ - } while (0) - -#define FILT3(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, N0, N1, N2, N3, N4, N5, N6, N7, N8) \ - do { \ - if (PE != PH && PE != PF) { \ - const unsigned e = xbr32_df(PE, PC) + xbr32_df(PE, PG) + xbr32_df(PI, H5) + xbr32_df(PI, F4) + (xbr32_df(PH, PF) << 2); \ - const unsigned i = xbr32_df(PH, PD) + xbr32_df(PH, I5) + xbr32_df(PF, I4) + xbr32_df(PF, PB) + (xbr32_df(PE, PI) << 2); \ - if (e <= i) { \ - const unsigned px = xbr32_df(PE, PF) <= xbr32_df(PE, PH) ? PF : PH; \ - if (e < i && ((!xbr32_eq(PF, PB) && !xbr32_eq(PF, PC)) || (!xbr32_eq(PH, PD) && !xbr32_eq(PH, PG)) || \ - ((xbr32_eq(PE, PI) && (!xbr32_eq(PF, F4) && !xbr32_eq(PF, I4))) || (!xbr32_eq(PH, H5) && !xbr32_eq(PH, I5))) || \ - xbr32_eq(PE, PG) || xbr32_eq(PE, PC))) { \ - const unsigned ke = xbr32_df(PF, PG); \ - const unsigned ki = xbr32_df(PH, PC); \ - const int left = ke << 1 <= ki && PE != PG && PD != PG; \ - const int up = ke >= ki << 1 && PE != PC && PB != PC; \ - if (left && up) { \ - E[N7] = ALPHA_BLEND_192_W(E[N7], px); \ - E[N6] = ALPHA_BLEND_64_W(E[N6], px); \ - E[N5] = E[N7]; \ - E[N2] = E[N6]; \ - E[N8] = px; \ - } else if (left) { \ - E[N7] = ALPHA_BLEND_192_W(E[N7], px); \ - E[N5] = ALPHA_BLEND_64_W(E[N5], px); \ - E[N6] = ALPHA_BLEND_64_W(E[N6], px); \ - E[N8] = px; \ - } else if (up) { \ - E[N5] = ALPHA_BLEND_192_W(E[N5], px); \ - E[N7] = ALPHA_BLEND_64_W(E[N7], px); \ - E[N2] = ALPHA_BLEND_64_W(E[N2], px); \ - E[N8] = px; \ - } else { /* diagonal */ \ - E[N8] = ALPHA_BLEND_224_W(E[N8], px); \ - E[N5] = ALPHA_BLEND_32_W(E[N5], px); \ - E[N7] = ALPHA_BLEND_32_W(E[N7], px); \ - } \ - } else { \ - E[N8] = ALPHA_BLEND_128_W(E[N8], px); \ - } \ - } \ - } \ - } while (0) - -#define FILT4(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, N15, N14, N11, N3, N7, N10, N13, N12, N9, N6, N2, N1, N5, \ - N8, N4, N0) \ - do { \ - if (PE != PH && PE != PF) { \ - const unsigned e = xbr32_df(PE, PC) + xbr32_df(PE, PG) + xbr32_df(PI, H5) + xbr32_df(PI, F4) + (xbr32_df(PH, PF) << 2); \ - const unsigned i = xbr32_df(PH, PD) + xbr32_df(PH, I5) + xbr32_df(PF, I4) + xbr32_df(PF, PB) + (xbr32_df(PE, PI) << 2); \ - if (e <= i) { \ - const unsigned px = xbr32_df(PE, PF) <= xbr32_df(PE, PH) ? PF : PH; \ - if (e < i && ((!xbr32_eq(PF, PB) && !xbr32_eq(PH, PD)) || (xbr32_eq(PE, PI) && (!xbr32_eq(PF, I4) && !xbr32_eq(PH, I5))) || \ - xbr32_eq(PE, PG) || xbr32_eq(PE, PC))) { \ - const unsigned ke = xbr32_df(PF, PG); \ - const unsigned ki = xbr32_df(PH, PC); \ - const int left = ke << 1 <= ki && PE != PG && PD != PG; \ - const int up = ke >= ki << 1 && PE != PC && PB != PC; \ - if (left && up) { \ - E[N13] = ALPHA_BLEND_192_W(E[N13], px); \ - E[N12] = ALPHA_BLEND_64_W(E[N12], px); \ - E[N15] = E[N14] = E[N11] = px; \ - E[N10] = E[N3] = E[N12]; \ - E[N7] = E[N13]; \ - } else if (left) { \ - E[N11] = ALPHA_BLEND_192_W(E[N11], px); \ - E[N13] = ALPHA_BLEND_192_W(E[N13], px); \ - E[N10] = ALPHA_BLEND_64_W(E[N10], px); \ - E[N12] = ALPHA_BLEND_64_W(E[N12], px); \ - E[N14] = px; \ - E[N15] = px; \ - } else if (up) { \ - E[N14] = ALPHA_BLEND_192_W(E[N14], px); \ - E[N7] = ALPHA_BLEND_192_W(E[N7], px); \ - E[N10] = ALPHA_BLEND_64_W(E[N10], px); \ - E[N3] = ALPHA_BLEND_64_W(E[N3], px); \ - E[N11] = px; \ - E[N15] = px; \ - } else { /* diagonal */ \ - E[N11] = ALPHA_BLEND_128_W(E[N11], px); \ - E[N14] = ALPHA_BLEND_128_W(E[N14], px); \ - E[N15] = px; \ - } \ - } else { \ - E[N15] = ALPHA_BLEND_128_W(E[N15], px); \ - } \ - } \ - } \ - } while (0) - -typedef struct { - const uint8_t *input; - uint8_t *output; - int inWidth, inHeight; - int inPitch, outPitch; - uint32_t rgbtoyuv[1 << 24]; -} xbr_params; - -static inline void xbr_filter(const xbr_params *params, int n) { - int x, y; - const uint32_t *r2y = params->rgbtoyuv; - const int nl = params->outPitch >> 2; - const int nl1 = nl + nl; - const int nl2 = nl1 + nl; - - for (y = 0; y < params->inHeight; y++) { - - uint32_t *E = (uint32_t *)(params->output + y * params->outPitch * n); - const uint32_t *sa2 = (uint32_t *)(params->input + y * params->inPitch - 8); /* center */ - const uint32_t *sa1 = sa2 - (params->inPitch >> 2); /* up x1 */ - const uint32_t *sa0 = sa1 - (params->inPitch >> 2); /* up x2 */ - const uint32_t *sa3 = sa2 + (params->inPitch >> 2); /* down x1 */ - const uint32_t *sa4 = sa3 + (params->inPitch >> 2); /* down x2 */ - - if (y <= 1) { - sa0 = sa1; - if (y == 0) { - sa0 = sa1 = sa2; - } - } - - if (y >= params->inHeight - 2) { - sa4 = sa3; - if (y == params->inHeight - 1) { - sa4 = sa3 = sa2; - } - } - - for (x = 0; x < params->inWidth; x++) { - const uint32_t B1 = sa0[2]; - const uint32_t PB = sa1[2]; - const uint32_t PE = sa2[2]; - const uint32_t PH = sa3[2]; - const uint32_t H5 = sa4[2]; - - const int pprev = 2 - (x > 0); - const uint32_t A1 = sa0[pprev]; - const uint32_t PA = sa1[pprev]; - const uint32_t PD = sa2[pprev]; - const uint32_t PG = sa3[pprev]; - const uint32_t G5 = sa4[pprev]; - - const int pprev2 = pprev - (x > 1); - const uint32_t A0 = sa1[pprev2]; - const uint32_t D0 = sa2[pprev2]; - const uint32_t G0 = sa3[pprev2]; - - const int pnext = 3 - (x == params->inWidth - 1); - const uint32_t C1 = sa0[pnext]; - const uint32_t PC = sa1[pnext]; - const uint32_t PF = sa2[pnext]; - const uint32_t PI = sa3[pnext]; - const uint32_t I5 = sa4[pnext]; - - const int pnext2 = pnext + 1 - (x >= params->inWidth - 2); - const uint32_t C4 = sa1[pnext2]; - const uint32_t F4 = sa2[pnext2]; - const uint32_t I4 = sa3[pnext2]; - - if (n == 2) { - E[0] = E[1] = // 0, 1 - E[nl] = E[nl + 1] = PE; // 2, 3 - - FILT2(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, 0, 1, nl, nl + 1); - FILT2(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, nl, 0, nl + 1, 1); - FILT2(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, nl + 1, nl, 1, 0); - FILT2(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, 1, nl + 1, 0, nl); - } else if (n == 3) { - E[0] = E[1] = E[2] = // 0, 1, 2 - E[nl] = E[nl + 1] = E[nl + 2] = // 3, 4, 5 - E[nl1] = E[nl1 + 1] = E[nl1 + 2] = PE; // 6, 7, 8 - - FILT3(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, 0, 1, 2, nl, nl + 1, nl + 2, nl1, nl1 + 1, nl1 + 2); - FILT3(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, nl1, nl, 0, nl1 + 1, nl + 1, 1, nl1 + 2, nl + 2, 2); - FILT3(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, nl1 + 2, nl1 + 1, nl1, nl + 2, nl + 1, nl, 2, 1, 0); - FILT3(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, 2, nl + 2, nl1 + 2, 1, nl + 1, nl1 + 1, 0, nl, nl1); - } else if (n == 4) { - E[0] = E[1] = E[2] = E[3] = // 0, 1, 2, 3 - E[nl] = E[nl + 1] = E[nl + 2] = E[nl + 3] = // 4, 5, 6, 7 - E[nl1] = E[nl1 + 1] = E[nl1 + 2] = E[nl1 + 3] = // 8, 9, 10, 11 - E[nl2] = E[nl2 + 1] = E[nl2 + 2] = E[nl2 + 3] = PE; // 12, 13, 14, 15 - - FILT4(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, nl2 + 3, nl2 + 2, nl1 + 3, 3, nl + 3, nl1 + 2, - nl2 + 1, nl2, nl1 + 1, nl + 2, 2, 1, nl + 1, nl1, nl, 0); - FILT4(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, 3, nl + 3, 2, 0, 1, nl + 2, nl1 + 3, nl2 + 3, nl1 + 2, - nl + 1, nl, nl1, nl1 + 1, nl2 + 2, nl2 + 1, nl2); - FILT4(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, 0, 1, nl, nl2, nl1, nl + 1, 2, 3, nl + 2, nl1 + 1, - nl2 + 1, nl2 + 2, nl1 + 2, nl + 3, nl1 + 3, nl2 + 3); - FILT4(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, nl2, nl1, nl2 + 1, nl2 + 3, nl2 + 2, nl1 + 1, nl, 0, - nl + 1, nl1 + 2, nl1 + 3, nl + 3, nl + 2, 1, 2, 3); - } - - sa0 += 1; - sa1 += 1; - sa2 += 1; - sa3 += 1; - sa4 += 1; - - E += n; - } - } -} - -static inline int _max(int a, int b) { return (a > b) ? a : b; } - -static inline int _min(int a, int b) { return (a < b) ? a : b; } - -static void xbr_init_data(xbr_params *params) { - uint32_t c; - int bg, rg, g; - - for (bg = -255; bg < 256; bg++) { - for (rg = -255; rg < 256; rg++) { - const uint32_t u = (uint32_t)((-169 * rg + 500 * bg) / 1000) + 128; - const uint32_t v = (uint32_t)((500 * rg - 81 * bg) / 1000) + 128; - int startg = _max(-bg, _max(-rg, 0)); - int endg = _min(255 - bg, _min(255 - rg, 255)); - uint32_t y = (uint32_t)((299 * rg + 1000 * startg + 114 * bg) / 1000); - c = bg + (rg << 16) + 0x010101 * startg; - for (g = startg; g <= endg; g++) { - params->rgbtoyuv[c] = ((y++) << 16) + (u << 8) + v; - c += 0x010101; - } - } - } -} - -void xbr_filter_xbr2x(const xbr_params *params) { xbr_filter(params, 2); } - -void xbr_filter_xbr3x(const xbr_params *params) { xbr_filter(params, 3); } - -void xbr_filter_xbr4x(const xbr_params *params) { xbr_filter(params, 4); } - -static xbr_params xbrparams; - -static void xbr32_init() { - static int initialized = 0; - if (initialized) { - return; - } - initialized = 1; - - memset(&xbrparams, 0, sizeof(xbrparams)); - - xbr_init_data(&xbrparams); -} - -void xbr2x_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres) { - xbr32_init(); - - xbrparams.input = pIn; - xbrparams.output = pOut; - xbrparams.inPitch = srcPitch; - xbrparams.outPitch = dstPitch; - xbrparams.inWidth = Xres; - xbrparams.inHeight = Yres; - - xbr_filter_xbr2x(&xbrparams); -} - -void xbr3x_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres) { - xbr32_init(); - - xbrparams.input = pIn; - xbrparams.output = pOut; - xbrparams.inPitch = srcPitch; - xbrparams.outPitch = dstPitch; - xbrparams.inWidth = Xres; - xbrparams.inHeight = Yres; - - xbr_filter_xbr3x(&xbrparams); -} - -void xbr4x_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres) { - xbr32_init(); - - xbrparams.input = pIn; - xbrparams.output = pOut; - xbrparams.inPitch = srcPitch; - xbrparams.outPitch = dstPitch; - xbrparams.inWidth = Xres; - xbrparams.inHeight = Yres; - - xbr_filter_xbr4x(&xbrparams); -} - -#endif \ No newline at end of file diff --git a/licenses/README.md b/licenses/README.md index de370b2c3..00bd566b0 100644 --- a/licenses/README.md +++ b/licenses/README.md @@ -48,12 +48,18 @@ This is always used unless you use `$CONSOLE:ONLY`. On Mac OS the system's own G ## Image Support -These libraries are pulled in if `_LOADIMAGE()` functionality is used. +These libraries are pulled in if `_LOADIMAGE()` or `_SAVEIMAGE()` functionality is used. | Library | License | License file | Location | | :------ | :-----: | :----------- | :------- | -| PCX image loader | Unlicense/Public Domain | license_dr_pcx.txt | internal/c/parts/video/image/dr_pcx.h | -| stb_image | MIT | license_stb_image.txt | internal/c/parts/video/image/stb_image.h | +| stb_image | MIT/Public Domain | license_stb_image.txt | internal/c/parts/video/image/stb/stb_image.h | +| nanosvg | zlib | license_nanosvg.txt | internal/c/parts/video/image/nanosvg | +| dr_pcx | Unlicense/Public Domain | license_dr_pcx.txt | internal/c/parts/video/image/dr_pcx.h | +| qoi | MIT | license_qoi.txt | internal/c/parts/video/image/qoi.h | +| stb_image_write | MIT/Public Domain | license_stb_image_write.txt | internal/c/parts/video/image/stb/stb_image_write.h | +| HQx | Apache License v2 | license_hqx.txt | internal/c/parts/video/image/pixelscalers/hqx.hpp | +| MMPX | MIT | license_mmpx.txt | internal/c/parts/video/image/pixelscalers/mmpx.hpp | +| Super-xBR | MIT | license_hqx.txt | internal/c/parts/video/image/pixelscalers/sxbr.hpp | ## Font Support diff --git a/licenses/license_dr_pcx.txt b/licenses/license_dr_pcx.txt index 4ec7f56eb..ffd0829f0 100644 --- a/licenses/license_dr_pcx.txt +++ b/licenses/license_dr_pcx.txt @@ -1,5 +1,5 @@ -------------------------------------------------------------------------------- -License of PCX Image Loader: +License of dr_pcx: This is free and unencumbered software released into the public domain. diff --git a/licenses/license_hqx.txt b/licenses/license_hqx.txt new file mode 100644 index 000000000..d8d55cc2f --- /dev/null +++ b/licenses/license_hqx.txt @@ -0,0 +1,204 @@ +-------------------------------------------------------------------------------- +License of HQx: + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/licenses/license_mmpx.txt b/licenses/license_mmpx.txt new file mode 100644 index 000000000..9755e71fc --- /dev/null +++ b/licenses/license_mmpx.txt @@ -0,0 +1,22 @@ +-------------------------------------------------------------------------------- +License of MMPX: + +Copyright 2020 Morgan McGuire & Mara Gagiu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/licenses/license_nanosvg.txt b/licenses/license_nanosvg.txt new file mode 100644 index 000000000..7b3a99277 --- /dev/null +++ b/licenses/license_nanosvg.txt @@ -0,0 +1,20 @@ +-------------------------------------------------------------------------------- +License of nanosvg: + +Copyright (c) 2013-14 Mikko Mononen memon@inside.org + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not +claim that you wrote the original software. If you use this software +in a product, an acknowledgment in the product documentation would be +appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. diff --git a/licenses/license_qoi.txt b/licenses/license_qoi.txt new file mode 100644 index 000000000..3c789c77f --- /dev/null +++ b/licenses/license_qoi.txt @@ -0,0 +1,24 @@ +-------------------------------------------------------------------------------- +License of qoi: + +MIT License + +Copyright (c) 2022 Dominic Szablewski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/licenses/license_stb_image_write.txt b/licenses/license_stb_image_write.txt new file mode 100644 index 000000000..5c66fc471 --- /dev/null +++ b/licenses/license_stb_image_write.txt @@ -0,0 +1,40 @@ +-------------------------------------------------------------------------------- +License of stb_image_write: + +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/licenses/license_sxbr.txt b/licenses/license_sxbr.txt new file mode 100644 index 000000000..ab5e0fe5c --- /dev/null +++ b/licenses/license_sxbr.txt @@ -0,0 +1,22 @@ +-------------------------------------------------------------------------------- +License of Super-xBR: + +Copyright (c) 2016 Hyllian - sergiogdb@gmail.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.