Skip to content

Linux support #10

@marukuru

Description

@marukuru

Hi @jpsdr,

thank you for your good work. I'm wondering, if there are any plans on porting NNEDI3 to AVS+ & Linux. I got it compiling with cmake/make for some parts, but got:

nnedi3/PlanarFrame.cpp: In function ‘int CPUCheckForExtensions()’:
nnedi3/PlanarFrame.cpp:57:3: error: ‘__cpuid’ was not declared in this scope
   57 |   __cpuid(cpuinfo, 1);
      |   ^~~~~~~
nnedi3/PlanarFrame.cpp:87:42: error: ‘_XCR_XFEATURE_ENABLED_MASK’ was not declared in this scope
   87 |     unsigned long long xgetbv0 = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
nnedi3/PlanarFrame.cpp:87:34: error: ‘_xgetbv’ was not declared in this scope; did you mean ‘xgetbv0’?
   87 |     unsigned long long xgetbv0 = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
      |                                  ^~~~~~~
      |                                  xgetbv0

After adding #include <x86gprintrin.h> to PlanarFrame.cpp I was left with:

nnedi3/PlanarFrame.cpp: In function ‘int CPUCheckForExtensions()’:
nnedi3/PlanarFrame.cpp:57:3: error: ‘__cpuid’ was not declared in this scope
   57 |   __cpuid(cpuinfo, 1);
      |   ^~~~~~~
nnedi3/PlanarFrame.cpp:87:42: error: ‘_XCR_XFEATURE_ENABLED_MASK’ was not declared in this scope
   87 |     unsigned long long xgetbv0 = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~

Now finally with

#ifdef __linux__
#include <x86gprintrin.h>
#define _aligned_malloc(size, alignment) aligned_alloc(alignment, size)
#define _aligned_free(ptr) free(ptr)
#define _XCR_XFEATURE_ENABLED_MASK  0
#define __cpuid(out, infoType)\
	asm("cpuid": "=a" (out[0]), "=b" (out[1]), "=c" (out[2]), "=d" (out[3]): "a" (infoType));
#endif

I'm "only" left with:

In file included from /usr/lib/gcc/x86_64-linux-gnu/11/include/x86gprintrin.h:93,
                 from nnedi3/PlanarFrame.cpp:32:
/usr/lib/gcc/x86_64-linux-gnu/11/include/xsaveintrin.h: In function ‘int CPUCheckForExtensions()’:
/usr/lib/gcc/x86_64-linux-gnu/11/include/xsaveintrin.h:60:1: error: inlining failed in call to ‘always_inline’ ‘long long int _xgetbv(unsigned int)’: target specific option mismatch
   60 | _xgetbv (unsigned int __A)
      | ^~~~~~~
nnedi3/PlanarFrame.cpp:93:41: note: called from here
   93 |     unsigned long long xgetbv0 = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
      |                                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions