Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

JPEG 2000 / XL viewer for DOS (Users)

posted by RayeR Homepage, CZ, 12.09.2023, 04:14
(edited by RayeR on 12.09.2023, 04:56)

Hm, the problem seems not be malloc() itself but memalign().
I followed opj_malloc.h and there's section:

#ifdef HAVE_MEMALIGN
        extern void* memalign(size_t, size_t);
        #undef opj_aligned_malloc
        #define opj_aligned_malloc(size) memalign(16, (size))
        #undef opj_aligned_free
        #define opj_aligned_free(m) free(m)
#endif

where HAVE_MEMALIGN is defined some lines above:

#else /* Not _WIN32 */
        #if defined(__sun)
                #define HAVE_MEMALIGN
        /* Linux x86_64 and OSX always align allocations to 16 bytes */
        #elif !defined(__amd64__) && !defined(__APPLE__)
//              #define HAVE_MEMALIGN
                #include <malloc.h>
        #endif

I commented HAVE_MEMALIGN out and viola, it works then!

also replacing malloc() with valloc() (page aligned) works.

UPDATE: _mm_malloc works fine too so I modified opj_malloc.h to use it (HAVE_MM_MALLOC). My build + sources are here:

https://sourceforge.net/projects/ffmpeg-x264-dos/files/libOpenJPEG-1.5.0-dos-12-09-2023.zip/download

---
DOS gives me freedom to unlimited HW access.

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 94 users online (0 registered, 94 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum