diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..406da98 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,68 @@ +cmake_minimum_required(VERSION 2.8) +project(jxrlib C) + +set(JXRLIB_MAJOR 0) +set(JXRLIB_MINOR 0) + +set(JXRLIB_LIB_VERSION ${JXRLIB_MAJOR}.${JXRLIB_MINOR}.0) +set(JXRLIB_SO_VERSION ${JXRLIB_MAJOR}) + +include(TestBigEndian) +test_big_endian(ISBIGENDIAN) +if(ISBIGENDIAN) + set(DEF_ENDIAN -D_BIG__ENDIAN_) +endif() + +add_definitions(-D__ANSI__ -DDISABLE_PERF_MEASUREMENT ${DEF_ENDIAN}) + +include_directories( + common/include + image/sys + jxrgluelib + jxrtestlib +) + +# JXR Library +file(GLOB jpegxr_SRC image/sys/*.c image/decode/*.c image/encode/*.c) +file(GLOB jpegxr_HDR image/sys/*.h image/decode/*.h image/encode/*.h) + +add_library(jpegxr ${jpegxr_SRC} ${jpegxr_HDR}) +set_target_properties(jpegxr PROPERTIES VERSION ${JXRLIB_LIB_VERSION} SOVERSION ${JXRLIB_SO_VERSION}) + +install(TARGETS jpegxr + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} +) + +# JXR-GLUE Library +file(GLOB jxrglue_SRC jxrgluelib/*.c jxrtestlib/*.c) +file(GLOB jxrglue_HDR jxrgluelib/*.h jxrtestlib/*.h) + +add_library(jxrglue ${jxrglue_SRC} ${jxrglue_HDR}) +set_target_properties(jxrglue PROPERTIES VERSION ${JXRLIB_LIB_VERSION} SOVERSION ${JXRLIB_SO_VERSION}) +target_link_libraries(jxrglue jpegxr m) + +install(TARGETS jxrglue + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} +) + +# JxrEncApp Executable +add_executable(JxrEncApp jxrencoderdecoder/JxrEncApp.c) +target_link_libraries(JxrEncApp jxrglue) +install(TARGETS JxrEncApp RUNTIME DESTINATION bin) + +# JxrDecApp Executable +add_executable(JxrDecApp jxrencoderdecoder/JxrDecApp.c) +target_link_libraries(JxrDecApp jxrglue) +install(TARGETS JxrDecApp RUNTIME DESTINATION bin) + +# Headers +install(FILES jxrgluelib/JXRGlue.h jxrgluelib/JXRMeta.h jxrtestlib/JXRTest.h image/sys/windowsmediaphoto.h + DESTINATION include/jxrlib +) +install(DIRECTORY common/include/ DESTINATION include/jxrlib + FILES_MATCHING PATTERN "*.h" +) diff --git a/JPEGXR_DPK_Spec_1.0.pdf b/JPEGXR_DPK_Spec_1.0.pdf new file mode 100644 index 0000000..117dd8e Binary files /dev/null and b/JPEGXR_DPK_Spec_1.0.pdf differ diff --git a/jxrlib.spec b/jxrlib.spec new file mode 100644 index 0000000..834056f --- /dev/null +++ b/jxrlib.spec @@ -0,0 +1,87 @@ +Name: jxrlib +Version: 1.1 +Release: 1 +Summary: Open source implementation of jpegxr + +# See JPEGXR_DPK_Spec_1.0.doc. Upstream request for plain text license file at +# https://jxrlib.codeplex.com/workitem/13 +License: BSD +URL: https://jxrlib.codeplex.com/ +Source0: http://jxrlib.codeplex.com/downloads/get/685249#/jxrlib_%(echo %{version} | tr . _).tar.gz +# Use CMake to build to facilitate creation of shared libraries +# See https://jxrlib.codeplex.com/workitem/13 +Source1: CMakeLists.txt +# Converted from shipped doc/JPEGXR_DPK_Spec_1.doc +# libreoffice --headless --convert-to pdf doc/JPEGXR_DPK_Spec_1.0.doc +Source2: JPEGXR_DPK_Spec_1.0.pdf + +# Fix various warnings, upstreamable +# See https://jxrlib.codeplex.com/workitem/13 +Patch0: jxrlib_warnings.patch + +BuildRequires: cmake +BuildRequires: gcc +BuildRequires: make + + +%description +This is an open source implementation of the jpegxr image format standard. + + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + + + +%prep +%setup -q -n %{name} + +# Sanitize charset and line endings +for file in `find . -type f -name '*.c' -or -name '*.h' -or -name '*.txt'`; do + iconv --from=ISO-8859-15 --to=UTF-8 $file > $file.new && \ + sed -i 's|\r||g' $file.new && \ + touch -r $file $file.new && mv $file.new $file +done + +%patch0 -p1 + +# Remove shipped binaries +rm -rf bin + +cp -a %{SOURCE1} . +cp -a %{SOURCE2} doc + + +%build +%cmake . +%make_build + + +%install +%make_install + + +%ldconfig_scriptlets + + +%files +%doc doc/readme.txt doc/JPEGXR_DPK_Spec_1.0.pdf +%{_bindir}/JxrEncApp +%{_bindir}/JxrDecApp +%{_libdir}/libjpegxr.so.* +%{_libdir}/libjxrglue.so.* + +%files devel +%{_includedir}/jxrlib/ +%{_libdir}/libjpegxr.so +%{_libdir}/libjxrglue.so + + +%changelog +* Fri Aug 7 2020 weidong - 1.1-1 +- Initial release for OpenEuler diff --git a/jxrlib_1_1.tar.gz b/jxrlib_1_1.tar.gz new file mode 100644 index 0000000..fa3d6b3 Binary files /dev/null and b/jxrlib_1_1.tar.gz differ diff --git a/jxrlib_warnings.patch b/jxrlib_warnings.patch new file mode 100644 index 0000000..f7b8175 --- /dev/null +++ b/jxrlib_warnings.patch @@ -0,0 +1,193 @@ +diff -rupN jxrlib/image/sys/common.h jxrlib-new/image/sys/common.h +--- jxrlib/image/sys/common.h 2013-03-21 17:30:54.000000000 +0100 ++++ jxrlib-new/image/sys/common.h 2015-09-03 10:31:06.528657911 +0200 +@@ -124,8 +124,8 @@ Void Adapt (CAdaptiveHuffman *pAdHuff, B + Void AdaptFixed (CAdaptiveHuffman *pAdHuff); + Void AdaptDiscriminant (CAdaptiveHuffman *pAdHuff); + +-#ifndef _PREFAST_ +-#pragma warning(disable:4068) +-#endif ++// #ifndef _PREFAST_ ++// #pragma warning(disable:4068) ++// #endif + + #endif // WMI_COMMON_H +diff -rupN jxrlib/image/sys/strcodec.c jxrlib-new/image/sys/strcodec.c +--- jxrlib/image/sys/strcodec.c 2013-03-20 19:16:21.000000000 +0100 ++++ jxrlib-new/image/sys/strcodec.c 2015-09-03 10:30:31.018971760 +0200 +@@ -668,9 +668,7 @@ ERR detach_SB(SimpleBitIO* pSB) + // WinCE ARM and Desktop x86 + #else + // other platform +-#ifdef _BIG__ENDIAN_ +-#define _byteswap_ulong(x) (x) +-#else // _BIG__ENDIAN_ ++#ifndef _BIG__ENDIAN_ + U32 _byteswap_ulong(U32 bits) + { + U32 r = (bits & 0xffu) << 24; +diff -rupN jxrlib/image/sys/strcodec.h jxrlib-new/image/sys/strcodec.h +--- jxrlib/image/sys/strcodec.h 2013-03-21 19:22:34.000000000 +0100 ++++ jxrlib-new/image/sys/strcodec.h 2015-09-03 10:30:31.019971779 +0200 +@@ -64,7 +64,7 @@ + + #ifndef UNREFERENCED_PARAMETER + #define UNREFERENCED_PARAMETER(P) { (P) = (P); } +-#endif UNREFERENCED_PARAMETER ++#endif // UNREFERENCED_PARAMETER + + #ifdef UNDER_CE + #define PLATFORM_WCE +@@ -673,6 +673,16 @@ void flushToByte(BitIOInfo* pIO); + pIO->cBitsUsed &= 16 - 1;\ + pIO->uiAccumulator = LOAD16(pIO->pbCurrent) << pIO->cBitsUsed;\ + return 0; +-// pIO->uiAccumulator = LOAD16(pIO->pbCurrent) & ((U32)(-1) >> pIO->cBitsUsed);\ + + void OutputPerfTimerReport(CWMImageStrCodec *pState); ++ ++#if (defined(WIN32) && !defined(UNDER_CE)) || (defined(UNDER_CE) && defined(_ARM_)) ++// WinCE ARM and Desktop x86 ++#else ++// other platform ++#ifdef _BIG__ENDIAN_ ++#define _byteswap_ulong(x) (x) ++#else // _BIG__ENDIAN_ ++U32 _byteswap_ulong(U32 bits); ++#endif // _BIG__ENDIAN_ ++#endif +\ No newline at end of file +diff -rupN jxrlib/jxrencoderdecoder/JxrDecApp.c jxrlib-new/jxrencoderdecoder/JxrDecApp.c +--- jxrlib/jxrencoderdecoder/JxrDecApp.c 2013-05-08 18:45:08.000000000 +0200 ++++ jxrlib-new/jxrencoderdecoder/JxrDecApp.c 2015-09-03 10:30:31.019971779 +0200 +@@ -423,7 +423,7 @@ ERR WmpDecAppCreateEncoderFromExt( + Call(GetTestEncodeIID(szExt, &pIID)); + + // Create encoder +- Call(PKTestFactory_CreateCodec(pIID, ppIE)); ++ Call(PKTestFactory_CreateCodec(pIID, (void**)ppIE)); + + Cleanup: + return err; +diff -rupN jxrlib/jxrencoderdecoder/JxrEncApp.c jxrlib-new/jxrencoderdecoder/JxrEncApp.c +--- jxrlib/jxrencoderdecoder/JxrEncApp.c 2013-05-28 20:58:22.000000000 +0200 ++++ jxrlib-new/jxrencoderdecoder/JxrEncApp.c 2015-09-03 10:30:31.020971798 +0200 +@@ -578,7 +578,7 @@ main(int argc, char* argv[]) + + //================================ + Call(PKCreateCodecFactory(&pCodecFactory, WMP_SDK_VERSION)); +- Call(pCodecFactory->CreateCodec(&IID_PKImageWmpEncode, &pEncoder)); ++ Call(pCodecFactory->CreateCodec(&IID_PKImageWmpEncode, (void**)&pEncoder)); + + //---------------------------------------------------------------- + Call(PKCreateTestFactory(&pTestFactory, WMP_SDK_VERSION)); +diff -rupN jxrlib/jxrgluelib/JXRGlueJxr.c jxrlib-new/jxrgluelib/JXRGlueJxr.c +--- jxrlib/jxrgluelib/JXRGlueJxr.c 2013-03-20 20:01:13.000000000 +0100 ++++ jxrlib-new/jxrgluelib/JXRGlueJxr.c 2015-09-03 10:30:31.021971818 +0200 +@@ -28,6 +28,7 @@ + //*@@@---@@@@****************************************************************** + #include + #include ++#include + + + static const char szHDPhotoFormat[] = "image/vnd.ms-photo"; +diff -rupN jxrlib/jxrgluelib/JXRMeta.h jxrlib-new/jxrgluelib/JXRMeta.h +--- jxrlib/jxrgluelib/JXRMeta.h 2013-03-20 19:06:24.000000000 +0100 ++++ jxrlib-new/jxrgluelib/JXRMeta.h 2015-09-03 10:30:31.021971818 +0200 +@@ -34,7 +34,7 @@ + + #ifndef UNREFERENCED_PARAMETER + #define UNREFERENCED_PARAMETER(P) { (P) = (P); } +-#endif UNREFERENCED_PARAMETER ++#endif // UNREFERENCED_PARAMETER + + //================================================================ + // Container +diff -rupN jxrlib/jxrtestlib/JXRTest.c jxrlib-new/jxrtestlib/JXRTest.c +--- jxrlib/jxrtestlib/JXRTest.c 2013-03-19 20:06:18.000000000 +0100 ++++ jxrlib-new/jxrtestlib/JXRTest.c 2015-09-03 10:30:31.022971837 +0200 +@@ -198,7 +198,7 @@ ERR PKTestFactory_CreateDecoderFromFile( + ERR err = WMP_errSuccess; + + char *pExt = NULL; +- PKIID* pIID = NULL; ++ const PKIID* pIID = NULL; + + struct WMPStream* pStream = NULL; + PKImageDecode* pDecoder = NULL; +@@ -214,7 +214,7 @@ ERR PKTestFactory_CreateDecoderFromFile( + Call(CreateWS_File(&pStream, szFilename, "rb")); + + // Create decoder +- Call(PKTestFactory_CreateCodec(pIID, ppDecoder)); ++ Call(PKTestFactory_CreateCodec(pIID, (void**)ppDecoder)); + pDecoder = *ppDecoder; + + // attach stream to decoder +@@ -232,7 +232,7 @@ ERR PKCreateTestFactory(PKCodecFactory** + + UNREFERENCED_PARAMETER( uVersion ); + +- Call(PKAlloc(ppCFactory, sizeof(**ppCFactory))); ++ Call(PKAlloc((void**)ppCFactory, sizeof(**ppCFactory))); + pCFactory = *ppCFactory; + + pCFactory->CreateCodec = PKTestFactory_CreateCodec; +@@ -287,7 +287,7 @@ ERR PKTestDecode_Release( + + pID->fStreamOwner && pID->pStream->Close(&pID->pStream); + +- return PKFree(ppID); ++ return PKFree((void**)ppID); + } + + ERR PKTestDecode_Create( +@@ -296,7 +296,7 @@ ERR PKTestDecode_Create( + ERR err = WMP_errSuccess; + PKTestDecode* pID = NULL; + +- Call(PKAlloc(ppID, sizeof(**ppID))); ++ Call(PKAlloc((void**)ppID, sizeof(**ppID))); + + pID = *ppID; + pID->Initialize = PKTestDecode_Initialize; +diff -rupN jxrlib/jxrtestlib/JXRTestHdr.c jxrlib-new/jxrtestlib/JXRTestHdr.c +--- jxrlib/jxrtestlib/JXRTestHdr.c 2013-03-20 17:40:08.000000000 +0100 ++++ jxrlib-new/jxrtestlib/JXRTestHdr.c 2015-09-03 10:30:31.022971837 +0200 +@@ -27,7 +27,7 @@ + //*@@@---@@@@****************************************************************** + #ifndef ANSI + #define _CRT_SECURE_NO_WARNINGS +-#endif ANSI ++#endif // ANSI + + #include + #include +diff -rupN jxrlib/jxrtestlib/JXRTestPnm.c jxrlib-new/jxrtestlib/JXRTestPnm.c +--- jxrlib/jxrtestlib/JXRTestPnm.c 2013-03-19 22:43:44.000000000 +0100 ++++ jxrlib-new/jxrtestlib/JXRTestPnm.c 2015-09-03 10:30:31.023971856 +0200 +@@ -27,7 +27,7 @@ + //*@@@---@@@@****************************************************************** + #ifndef ANSI + #define _CRT_SECURE_NO_WARNINGS +-#endif ANSI ++#endif // ANSI + + #include + +diff -rupN jxrlib/jxrtestlib/JXRTestTif.c jxrlib-new/jxrtestlib/JXRTestTif.c +--- jxrlib/jxrtestlib/JXRTestTif.c 2013-03-19 20:17:12.000000000 +0100 ++++ jxrlib-new/jxrtestlib/JXRTestTif.c 2015-09-03 10:30:31.023971856 +0200 +@@ -909,8 +909,8 @@ ERR PKImageDecode_Release_TIF(PKTestDeco + + PKTestDecode *pID = *ppID; + +- Call(WMPFree(&pID->EXT.TIF.uStripOffsets)); +- Call(WMPFree(&pID->EXT.TIF.uStripByteCounts)); ++ Call(WMPFree((void**)&pID->EXT.TIF.uStripOffsets)); ++ Call(WMPFree((void**)&pID->EXT.TIF.uStripByteCounts)); + + Call(PKTestDecode_Release(ppID)); +