platform/upstream/orc.git
18 months agoparser: extract function to handle .m
Francesco Romani [Sun, 6 Jul 2014 13:54:49 +0000 (15:54 +0200)]
parser: extract function to handle .m

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: extract function to handle .n
Francesco Romani [Sun, 6 Jul 2014 13:53:34 +0000 (15:53 +0200)]
parser: extract function to handle .n

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: extract function to handle .flags
Francesco Romani [Sun, 6 Jul 2014 13:48:59 +0000 (15:48 +0200)]
parser: extract function to handle .flags

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: extract function to handle .init
Francesco Romani [Sun, 6 Jul 2014 13:46:31 +0000 (15:46 +0200)]
parser: extract function to handle .init

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: extract function to handle .function
Francesco Romani [Mon, 7 Jul 2014 06:09:06 +0000 (08:09 +0200)]
parser: extract function to handle .function

Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: make directive handling extensible
Francesco Romani [Mon, 7 Jul 2014 06:08:26 +0000 (08:08 +0200)]
parser: make directive handling extensible

Reformat the code for easier future extensions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: extract a function to handle directives
Francesco Romani [Sun, 6 Jul 2014 13:28:54 +0000 (15:28 +0200)]
parser: extract a function to handle directives

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: extract a function to handle opcodes
Francesco Romani [Sun, 6 Jul 2014 13:19:55 +0000 (15:19 +0200)]
parser: extract a function to handle opcodes

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: add is_directive helper
Francesco Romani [Sun, 6 Jul 2014 13:13:57 +0000 (15:13 +0200)]
parser: add is_directive helper

To improve encapsulation

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: rewrite line tokenization code
Francesco Romani [Sun, 6 Jul 2014 13:08:39 +0000 (15:08 +0200)]
parser: rewrite line tokenization code

Make the tokenization a separate function, leveraging the OrcLine
struct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: introduce line handling utility: OrcLine
Francesco Romani [Mon, 7 Jul 2014 06:03:26 +0000 (08:03 +0200)]
parser: introduce line handling utility: OrcLine

to extract and simplify the line handling logic.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: simplify the line handling
Francesco Romani [Mon, 7 Jul 2014 06:02:21 +0000 (08:02 +0200)]
parser: simplify the line handling

Make the code more regular and do a little cleanup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: switch to orc_program_append_str_n
Francesco Romani [Mon, 7 Jul 2014 05:59:56 +0000 (07:59 +0200)]
parser: switch to orc_program_append_str_n

For better error reporting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: add has_data helper
Francesco Romani [Sun, 6 Jul 2014 12:10:12 +0000 (14:10 +0200)]
parser: add has_data helper

to check if a parser has still data to process

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: extract initialization function
Francesco Romani [Sun, 6 Jul 2014 12:07:11 +0000 (14:07 +0200)]
parser: extract initialization function

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: reformat orc_parse_sanity_check
Francesco Romani [Sun, 6 Jul 2014 12:05:19 +0000 (14:05 +0200)]
parser: reformat orc_parse_sanity_check

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: reorder and rename for consistency
Francesco Romani [Sun, 6 Jul 2014 11:59:59 +0000 (13:59 +0200)]
parser: reorder and rename for consistency

minor internal cleanup
* put public APIs on top.
* rename internally for consistency.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: new API with better error reporting
Francesco Romani [Sun, 6 Jul 2014 11:50:23 +0000 (13:50 +0200)]
parser: new API with better error reporting

Add orc_parse_code with more detailed error reporting
* more detailed error reporting, both machine and human friendlier.
* collect errors only if asked to.
* preserve backward compatibility with orc_parse_full.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: move init_function in the parser
Francesco Romani [Sun, 6 Jul 2014 11:36:02 +0000 (13:36 +0200)]
parser: move init_function in the parser

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoparser: cleanup: use OrcVector to store programs
Francesco Romani [Sat, 5 Jul 2014 16:13:02 +0000 (18:13 +0200)]
parser: cleanup: use OrcVector to store programs

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoutils: add utility dynamic array
Francesco Romani [Sat, 5 Jul 2014 16:04:33 +0000 (18:04 +0200)]
utils: add utility dynamic array

Add utility code to handle a dynamic array.
Supported operations:
* append an item
* grow the array
* get an item
* get the length of the array
* check if the array has any data on it.

There are clear use cases for this utility in the OrcParser,
but may be useful elsewhere as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

18 months agoprogram: add orc_program_append_str_n
Francesco Romani [Sat, 5 Jul 2014 16:02:13 +0000 (18:02 +0200)]
program: add orc_program_append_str_n

Add a new API which generalizes orc_program_append_str_2 which
* supports any number of operands for the given opcode
* reports the status of the operation

most notably, in case of unknown operand, the new API signals
the wrong operand.

Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>

19 months agoorcrules-neon: Fix 64-bit loadupdb of size 16
Sebastian Dröge [Mon, 10 Apr 2023 14:36:03 +0000 (17:36 +0300)]
orcrules-neon: Fix 64-bit loadupdb of size 16

It would otherwise be unhandled and result in an error although the code
for it exists.

CID 1523164

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/94>

19 months agoorcprogram-neon: Fix usage of negative array index on errors
Sebastian Dröge [Mon, 10 Apr 2023 14:32:54 +0000 (17:32 +0300)]
orcprogram-neon: Fix usage of negative array index on errors

CID 1522422
CID 1522354

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/94>

19 months agoorcparse: Check for correct number of function header directive arguments
Sebastian Dröge [Fri, 7 Apr 2023 16:08:39 +0000 (19:08 +0300)]
orcparse: Check for correct number of function header directive arguments

This was otherwise accessing random pointers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/94>

19 months agoorcarm: Fix undefined behaviour
Sebastian Dröge [Fri, 7 Apr 2023 15:57:41 +0000 (18:57 +0300)]
orcarm: Fix undefined behaviour

Left-shift of a negative signed integer is undefined behaviour. The
value becomes negative because bitwise-not on a positive, signed integer
results in a negative signed integer.

To solve this use unsigned integers. The code assumes that the sign bit
is not treated differently from any other bits.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/94>

19 months agoorcprogram-mips: Fix memory leak of optimized instruction order array
Sebastian Dröge [Fri, 7 Apr 2023 15:52:15 +0000 (18:52 +0300)]
orcprogram-mips: Fix memory leak of optimized instruction order array

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/94>

19 months agoorcprogram: Don't read random stack memory if an opcode with 5 parameters is used
Sebastian Dröge [Fri, 7 Apr 2023 15:35:21 +0000 (18:35 +0300)]
orcprogram: Don't read random stack memory if an opcode with 5 parameters is used

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/94>

19 months agoorcprogram: Don't output garbage when unknown opcodes are observed
Sebastian Dröge [Fri, 7 Apr 2023 15:35:01 +0000 (18:35 +0300)]
orcprogram: Don't output garbage when unknown opcodes are observed

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/94>

19 months agoDon't use volatile to mean atomic
Sebastian Dröge [Fri, 7 Apr 2023 09:15:43 +0000 (12:15 +0300)]
Don't use volatile to mean atomic

volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead. GCC 11 has started warning about using volatile
with atomic operations.

In case of orc, the volatile integers were always protected with a
mutex, which makes it completely unnecessary.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/91>

19 months agoci: Add default retry policy and mark jobs as interruptible by default
Jordan Petridis [Fri, 7 Apr 2023 11:34:15 +0000 (14:34 +0300)]
ci: Add default retry policy and mark jobs as interruptible by default

Copied from gst/gst repo.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/93>

19 months agoci: Move the windows image to Server 2022 base
Jordan Petridis [Fri, 7 Apr 2023 11:31:38 +0000 (14:31 +0300)]
ci: Move the windows image to Server 2022 base

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/93>

19 months agoci: Add workflow rules for Merge Requests
Jordan Petridis [Fri, 7 Apr 2023 11:23:49 +0000 (14:23 +0300)]
ci: Add workflow rules for Merge Requests

This will only trigger pipelines for merge requests, or branch
pipelines from scheduled pipelines, protected branched and tags
or when explicitly triggered from the web gui.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/93>

19 months agoREADME: Fix typo
lilinjie [Fri, 31 Mar 2023 07:04:35 +0000 (15:04 +0800)]
README: Fix typo

sucessor -> successor

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/90>

20 months agoFix guard around usage of pthread_jit_write_protect*
Nirbheek Chauhan [Wed, 22 Feb 2023 21:14:20 +0000 (02:44 +0530)]
Fix guard around usage of pthread_jit_write_protect*

The guard should be macOS 11.0, not 10.11. We got no compiler warning
for this because `-Wunguarded-availability-new` only checks that you
have a guard. It can't check whether the guard is correct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/89>

20 months agoorccodemem: silence gcc 12 compiler warning
Tim-Philipp Müller [Sun, 12 Feb 2023 14:32:45 +0000 (14:32 +0000)]
orccodemem: silence gcc 12 compiler warning

warning: null destination pointer [-Wformat-overflow=]
  223 |   sprintf(filename, "%s/orcexec.XXXXXX", dir);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/88>

21 months agoci: Add protect against future unguarded API usage
Nirbheek Chauhan [Fri, 3 Feb 2023 12:14:42 +0000 (17:44 +0530)]
ci: Add protect against future unguarded API usage

`-Werror=unguarded-availability-new` will protect us from using APIs
that are only available on new macOS / iOS versions without
`__builtin_available` guards.

21 months agoFix usage of pthread_jit_write_protect_np() on macOS and iOS
Nirbheek Chauhan [Fri, 3 Feb 2023 11:57:48 +0000 (17:27 +0530)]
Fix usage of pthread_jit_write_protect_np() on macOS and iOS

The API is not available on iOS at all, and is only available on macOS
starting from macOS 11, as can be seen in `pthread/pthread.h` in the
Xcode SDK:

```
__API_AVAILABLE(macos(11.0))
__API_UNAVAILABLE(ios, tvos, watchos, driverkit)
void pthread_jit_write_protect_np(int enabled);

__API_AVAILABLE(macos(11.0))
__API_UNAVAILABLE(ios, tvos, watchos, driverkit)
int pthread_jit_write_protect_supported_np(void);
```

The configuration check for this is actually wrong. We should detect
availability of the API at compile time and use it conditionally at
runtime. The code now checks the following cases:

1. Are we building for macOS?
2. Do we have a new-enough SDK that defines MAC_OS_VERSION_11_0 and
   hence has pthread_jit_write_* available?
3. Is the maximum macOS version allowed at least macOS 11.0, so we
   have a possibility of using this API at runtime?
4. Are we running on macOS 11.0 or newer?

Also: we need to ensure that pthread_jit_write_protect_supported_np()
actually returns true before using the API, because if you're shipping
an app, you need to set `com.apple.security.cs.allow-jit` in your app
otherwise the API won't work if you've opted in to Hardened Runtime.
See: https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon

Fixes https://gitlab.freedesktop.org/gstreamer/orc/-/issues/44

22 months agoMeson: Do not always generate static library for test library
Jeremy Bicha [Thu, 17 Nov 2022 20:42:05 +0000 (15:42 -0500)]
Meson: Do not always generate static library for test library

Follow-up from ae14127e7131e5d7e747abf3f5988f8057c8ad48

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/85>

23 months agotestsuite: fix memory leak in parse test
Tim-Philipp Müller [Fri, 11 Nov 2022 23:56:06 +0000 (23:56 +0000)]
testsuite: fix memory leak in parse test

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/84>

2 years agoAdd NetBSD/powerpc support.
Thomas Klausner [Wed, 9 Nov 2022 17:02:39 +0000 (18:02 +0100)]
Add NetBSD/powerpc support.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/83>

2 years agoAdd missing include.
Thomas Klausner [Wed, 9 Nov 2022 17:02:25 +0000 (18:02 +0100)]
Add missing include.

Fixes
../orc/orccodemem.c:227:71: error: 'errno' undeclared (first use in this function)

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/83>

2 years agotestsuite: fix compiler warning about unused variable
Tim-Philipp Müller [Tue, 8 Nov 2022 15:35:53 +0000 (15:35 +0000)]
testsuite: fix compiler warning about unused variable

Happens on gst-macos-12.3 with --werror with clang 13.1.6
"Apple clang version 13.1.6 (clang-1316.0.21.2)":
../testsuite/memcpy_speed.c:25:23: error: variable 'sum' set but not used

2 years agoci: bump macOS/iOS versions
Tim-Philipp Müller [Tue, 8 Nov 2022 15:16:16 +0000 (15:16 +0000)]
ci: bump macOS/iOS versions

2 years agoBack to development
Tim-Philipp Müller [Tue, 1 Nov 2022 13:13:14 +0000 (13:13 +0000)]
Back to development

2 years agoRelease 0.4.33 orc-0.4.33
Tim-Philipp Müller [Sat, 29 Oct 2022 22:34:59 +0000 (23:34 +0100)]
Release 0.4.33

Fixes #42

2 years agoFix build on iOS simulator
Tim-Philipp Müller [Mon, 31 Oct 2022 15:35:42 +0000 (15:35 +0000)]
Fix build on iOS simulator

pthread_jit_write_protect_np() is available but unusable on
iOS simulator:

../orc/orccompiler.c:460:3: error: 'pthread_jit_write_protect_np' is unavailable: not available on iOS

Fixes #43

2 years agomeson: Enable only SSE and MMX backends for Windows
Seungha Yang [Mon, 20 Jun 2022 18:14:39 +0000 (03:14 +0900)]
meson: Enable only SSE and MMX backends for Windows

Other backends would not work or do not make sense

2 years agoci: move deploy stage behind build stage
Tim-Philipp Müller [Mon, 31 Oct 2022 12:23:46 +0000 (12:23 +0000)]
ci: move deploy stage behind build stage

2 years agoorcarm.c: Implement orc_arm_flush_cache on Windows
Chun-wei Fan [Wed, 22 Sep 2021 07:40:38 +0000 (15:40 +0800)]
orcarm.c: Implement orc_arm_flush_cache on Windows

Use the Windows API FlushInstructionCache() to flush the CPU cache on ARM64
Windows.  As a consequence, include windows.h with WIN32_LEAN_AND_MEAN defined.

2 years agoorccpu-arm.c: Assume ARMv8 on Windows ARM64
Chun-wei Fan [Wed, 22 Sep 2021 07:37:46 +0000 (15:37 +0800)]
orccpu-arm.c: Assume ARMv8 on Windows ARM64

ARM64 Windows are supported on ARMv8 CPUs only, so just assume that we have
the NEON and EDSP ARM instructions.

2 years agoorccpu-arm.c: Include headers conditionally
Chun-wei Fan [Wed, 22 Sep 2021 07:33:17 +0000 (15:33 +0800)]
orccpu-arm.c: Include headers conditionally

unistd.h and sys/time.h may not be universally available, so only include them
if they were found at configure time.

2 years agomeson: don't depend on pthreads when compiling for windows
Steve Lhomme [Fri, 19 Aug 2022 09:04:08 +0000 (11:04 +0200)]
meson: don't depend on pthreads when compiling for windows

On UNIX toolchains cross compiling for Windows, winpthread will be detected and
added as a dependency even though it's not used.

2 years agomeson: export ORC_STATIC_COMPILATION in the pkgconfig file
Steve Lhomme [Fri, 19 Aug 2022 09:02:15 +0000 (11:02 +0200)]
meson: export ORC_STATIC_COMPILATION in the pkgconfig file

If the library is compiled statically the define also needs to be set in the
orc-0.4.pc file so that users of the library (in a UNIX toolchain cross
compiling to Windows) will not import the functions as DLL imports.

2 years agoorc: fix ORC_RESTRICT definition for MSVC
Tim-Philipp Müller [Sat, 29 Oct 2022 22:44:27 +0000 (23:44 +0100)]
orc: fix ORC_RESTRICT definition for MSVC

Fixes #40

2 years agomeson: bump req to >= 0.55 and use meson.can_run_host_binaries()
Tim-Philipp Müller [Sat, 29 Oct 2022 22:32:58 +0000 (23:32 +0100)]
meson: bump req to >= 0.55 and use meson.can_run_host_binaries()

.. instead of the deprecated meson.has_exe_wrapper()

2 years agoci: build docs and deploy to gitlab pages
Tim-Philipp Müller [Sat, 29 Oct 2022 15:13:08 +0000 (16:13 +0100)]
ci: build docs and deploy to gitlab pages

https://gitlab.freedesktop.org/gstreamer/orc/-/issues/27

2 years agoneon: Fix discrepancy when using loadupdb in 32-bit
Gaetan Bahl [Mon, 22 Aug 2022 17:32:29 +0000 (19:32 +0200)]
neon: Fix discrepancy when using loadupdb in 32-bit

Fix shifted outputs when output array is 8-byte aligned but not 16-byte aligned and loop shift is 1.

Fixes #32

Signed-off-by: Gaetan Bahl <gaetan.bahl@nxp.com>
2 years agoneon: Fix testsuite not passing on arm CPUs
Gaetan Bahl [Fri, 20 May 2022 13:41:27 +0000 (15:41 +0200)]
neon: Fix testsuite not passing on arm CPUs

Set the FPCR.FZ bit before running tests using ARM NEON,
in order to make tests pass for most opcodes.

Add a way to check for expected failures in the test suite,
since ARM NEON does not comply to IEEE754.

Errors are expected when using divf (resp. sqrtf) on large
(resp. small) numbers.

Fixes #33, #20

Signed-off-by: Gaetan Bahl <gaetan.bahl@nxp.com>
2 years agoneon: Fix sqrtf only processing two inputs out of four
Gaetan Bahl [Fri, 20 May 2022 13:47:53 +0000 (15:47 +0200)]
neon: Fix sqrtf only processing two inputs out of four

This solves an issue where two out of four inputs are not processed
by passing the correct value of vec shift.

Fixes #33, #20.

Signed-off-by: Gaetan Bahl <gaetan.bahl@nxp.com>
2 years agoneon: Fix divf only processing two inputs out of four
Gaetan Bahl [Fri, 20 May 2022 13:41:27 +0000 (15:41 +0200)]
neon: Fix divf only processing two inputs out of four

This solves an issue where two out of four input values are not processed
by passing the correct value of vec shift.

Fixes #33, #20.

Signed-off-by: Gaetan Bahl <gaetan.bahl@nxp.com>
2 years agoneon: Fix out-of-shift errors when compiling certain float/double opcodes using neon
Gaetan Bahl [Tue, 17 May 2022 16:15:51 +0000 (18:15 +0200)]
neon: Fix out-of-shift errors when compiling certain float/double opcodes using neon

Setting the correct shift values solve the "out-of-shift" errors
and allow the following operators to successfully compile:
addf, subf, mulf, maxf, minf, cmpeqf, convfl, convlf, addd, subd, muld, divd

Fixes #33, #20, #2.

Signed-off-by: Gaetan Bahl <gaetan.bahl@nxp.com>
2 years agoorccodemem: Fix use-after-free in error paths
Bastien Nocera [Fri, 6 May 2022 13:56:17 +0000 (15:56 +0200)]
orccodemem: Fix use-after-free in error paths

In file included from gstreamer/subprojects/orc/orc/orc.h:7,
                 from gstreamer/subprojects/orc/orc/orcprogram.h:5,
                 from gstreamer/subprojects/orc/orc/orccodemem.c:30:
gstreamer/subprojects/orc/orc/orccodemem.c: In function ‘orc_code_region_allocate_codemem_dual_map.constprop’:
gstreamer/subprojects/orc/orc/orcdebug.h:138:3: warning: pointer ‘filename’ may be used after ‘free’ [-Wuse-after-free]
  138 |   orc_debug_print((level), __FILE__, ORC_FUNCTION, __LINE__, __VA_ARGS__); \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orcdebug.h:92:26: note: in expansion of macro ‘ORC_DEBUG_PRINT’
   92 | #define ORC_WARNING(...) ORC_DEBUG_PRINT(ORC_DEBUG_WARNING, __VA_ARGS__)
      |                          ^~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orccodemem.c:252:5: note: in expansion of macro ‘ORC_WARNING’
  252 |     ORC_WARNING ("failed to create write map '%s'. err=%i", filename, errno);
      |     ^~~~~~~~~~~
gstreamer/subprojects/orc/orc/orccodemem.c:234:3: note: call to ‘free’ here
  234 |   free (filename);
      |   ^~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orcdebug.h:138:3: warning: pointer ‘filename’ may be used after ‘free’ [-Wuse-after-free]
  138 |   orc_debug_print((level), __FILE__, ORC_FUNCTION, __LINE__, __VA_ARGS__); \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orcdebug.h:92:26: note: in expansion of macro ‘ORC_DEBUG_PRINT’
   92 | #define ORC_WARNING(...) ORC_DEBUG_PRINT(ORC_DEBUG_WARNING, __VA_ARGS__)
      |                          ^~~~~~~~~~~~~~~
gstreamer/subprojects/orc/orc/orccodemem.c:245:5: note: in expansion of macro ‘ORC_WARNING’
  245 |     ORC_WARNING("failed to create exec map '%s'. err=%i", filename, errno);
      |     ^~~~~~~~~~~
gstreamer/subprojects/orc/orc/orccodemem.c:234:3: note: call to ‘free’ here
  234 |   free (filename);
      |   ^~~~~~~~~~~~~~~

Fixes: bb5fcb31 ("orccodemem: Report errno during failures to create mmap codemap.")

2 years agoci: Add ARM64 and ARM Windows UWP jobs
Nirbheek Chauhan [Fri, 28 Jan 2022 07:07:12 +0000 (12:37 +0530)]
ci: Add ARM64 and ARM Windows UWP jobs

Cross and native files are modified versions of the files used in the
gstreamer CI since we use the same Docker image.

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/64>

2 years agoci: Update Windows image and macos/ios tags
Nirbheek Chauhan [Thu, 27 Jan 2022 21:42:00 +0000 (03:12 +0530)]
ci: Update Windows image and macos/ios tags

The latest image contains VS 2019, and was built in
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1570

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/63>

2 years agoneon: Fix unsigned only implementation of loadoffb, loadoffw and loadoffl
Knobe, Daniel [Tue, 7 Dec 2021 09:22:15 +0000 (10:22 +0100)]
neon: Fix unsigned only implementation of loadoffb, loadoffw and loadoffl

This has direct impact on bayer2rgb performance. Tested on i.MX8mm aarch64 -> Speedboost of ~17%.
Reason:
The line loadoffw t, s, -1 results in orc silent compile error
Pipeline:
gst-launch-1.0 -v videotestsrc ! video/x-bayer,width=1920,height=1080 ! bayer2rgb ! fpsdisplaysink video-sink=fakesink sync=0
Average performance with fix: 25.21fps
Average performance without fix: 21.60fps

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/62>

3 years agomeson: Disable ARM64 support for Windows
Seungha Yang [Tue, 28 Sep 2021 14:04:29 +0000 (23:04 +0900)]
meson: Disable ARM64 support for Windows

Disable Windows ARM64 support/build for now, because it doesn't work.

Fixes: https://gitlab.freedesktop.org/gstreamer/orc/-/issues/36
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/61>

3 years agoexecutor: Fix orc_executor_set_program() to save OrcCode
Doug Nazar [Tue, 17 Aug 2021 23:49:08 +0000 (19:49 -0400)]
executor: Fix orc_executor_set_program() to save OrcCode

orc_executor_set_program() was missed when it was added to
orc_executor_new().

3 years agomeson: Set recursive for extract_all_objects()
Doug Nazar [Wed, 18 Aug 2021 00:15:05 +0000 (20:15 -0400)]
meson: Set recursive for extract_all_objects()

Fixes the following warning:

WARNING: extract_all_objects called without setting recursive
keyword argument. Meson currently defaults to
non-recursive to maintain backward compatibility but
the default will be changed in the future.
orc-test\meson.build:16:0: ERROR: Fatal warnings enabled, aborting

3 years agoorc: Add support for MacOS Hardened runtime.
Doug Nazar [Fri, 9 Apr 2021 08:59:53 +0000 (04:59 -0400)]
orc: Add support for MacOS Hardened runtime.

3 years agoorccodemem: Report errno during failures to create mmap codemap.
Doug Nazar [Fri, 9 Apr 2021 08:57:05 +0000 (04:57 -0400)]
orccodemem: Report errno during failures to create mmap codemap.

3 years agoorc/orccpu-powerpc.c: fix build with kernel < 4.11
Fabrice Fontaine [Mon, 15 Feb 2021 19:17:43 +0000 (20:17 +0100)]
orc/orccpu-powerpc.c: fix build with kernel < 4.11

Build with powerpc and kernel < 4.11 is broken since version 0.4.30 and
https://gitlab.freedesktop.org/gstreamer/orc/-/commit/a999325abea6a5549d60d99ddeb0271d2aa00235:

FAILED: orc/liborc-0.4.so.0.32.0.p/orccpu-powerpc.c.o
/home/giuliobenetti/autobuild/run/instance-3/output-1/host/bin/powerpc-linux-gcc -Iorc/liborc-0.4.so.0.32.0.p -Iorc -I../orc -I. -I.. -fdiagnostics-color=always -pipe -Wall -Winvalid-pch -std=gnu99 -O3 -DHAVE_CONFIG_H -fvisibility=hidden -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -fPIC -pthread -DORC_ENABLE_UNSTABLE_API -D_GNU_SOURCE -DBUILDING_ORC -MD -MQ orc/liborc-0.4.so.0.32.0.p/orccpu-powerpc.c.o -MF orc/liborc-0.4.so.0.32.0.p/orccpu-powerpc.c.o.d -o orc/liborc-0.4.so.0.32.0.p/orccpu-powerpc.c.o -c ../orc/orccpu-powerpc.c
../orc/orccpu-powerpc.c: In function 'orc_check_powerpc_proc_auxv':
../orc/orccpu-powerpc.c:164:21: error: 'AT_L1D_CACHESIZE' undeclared (first use in this function); did you mean 'AT_DCACHEBSIZE'?
  164 |       if (buf[i] == AT_L1D_CACHESIZE) {
      |                     ^~~~~~~~~~~~~~~~
      |                     AT_DCACHEBSIZE
../orc/orccpu-powerpc.c:164:21: note: each undeclared identifier is reported only once for each function it appears in
../orc/orccpu-powerpc.c:168:21: error: 'AT_L2_CACHESIZE' undeclared (first use in this function); did you mean 'AT_ICACHEBSIZE'?
  168 |       if (buf[i] == AT_L2_CACHESIZE) {
      |                     ^~~~~~~~~~~~~~~
      |                     AT_ICACHEBSIZE
../orc/orccpu-powerpc.c:172:21: error: 'AT_L3_CACHESIZE' undeclared (first use in this function); did you mean 'AT_ICACHEBSIZE'?
  172 |       if (buf[i] == AT_L3_CACHESIZE) {
      |                     ^~~~~~~~~~~~~~~
      |                     AT_ICACHEBSIZE

Indeed, AT_{L1D,L2,L3}_CACHESIZE is only defined since kernel 4.11 and
https://github.com/torvalds/linux/commit/98a5f361b8625c6f4841d6ba013bbf0e80d08147

Fixes:
 - http://autobuild.buildroot.org/results/0821e96cba3e455edd47b87485501d892fc7ac6a

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/56>

4 years agomeson: don't set gnu99 as default c_std
Tim-Philipp Müller [Sat, 7 Nov 2020 13:24:18 +0000 (13:24 +0000)]
meson: don't set gnu99 as default c_std

Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/55>

4 years agoaarch32: Implement loadupdb instruction
Marek Vasut [Mon, 31 Aug 2020 00:26:33 +0000 (02:26 +0200)]
aarch32: Implement loadupdb instruction

Fill in aarch32 opcodes for loadupdb instruction, which is used
by various color space conversion programs. There is likely still
some space for optimization.

4 years agoaarch64: Implement loadupdb instruction
Marek Vasut [Fri, 26 Jun 2020 14:31:02 +0000 (16:31 +0200)]
aarch64: Implement loadupdb instruction

Fill in aarch64 opcodes for loadupdb instruction, which is used
by various color space conversion programs. This is thus far only
available on aarch64, but arm32 port should be easy.

4 years agoaarch64: Implement sqrtf instruction
Marek Vasut [Sun, 30 Aug 2020 16:26:15 +0000 (18:26 +0200)]
aarch64: Implement sqrtf instruction

Fill in aarch64 opcodes for sqrtf instruction.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement divf instruction
Marek Vasut [Sun, 30 Aug 2020 16:18:38 +0000 (18:18 +0200)]
aarch64: Implement divf instruction

Fill in aarch64 opcodes for divf instruction.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement double-precision floating-point arithmetic instructions
Marek Vasut [Sun, 30 Aug 2020 16:18:31 +0000 (18:18 +0200)]
aarch64: Implement double-precision floating-point arithmetic instructions

Fill in aarch64 opcodes for double-precision floating point
arithmetic instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement flags2d
Marek Vasut [Sat, 29 Aug 2020 23:23:05 +0000 (01:23 +0200)]
aarch64: Implement flags2d

Implement support for .flags 2d by adding code for handling the loop
counter. The implementation is very similar to aarch32.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement const64 loadiq
Marek Vasut [Sat, 29 Aug 2020 22:33:07 +0000 (00:33 +0200)]
aarch64: Implement const64 loadiq

Add support for loading 64bit constants on aarch64 by emitting a
sequence of pc-relative load, branch past the literal pool and a
constant as a literal pool entry.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement accumulator store
Marek Vasut [Sat, 29 Aug 2020 15:27:20 +0000 (17:27 +0200)]
aarch64: Implement accumulator store

Add code to store the accumulator register.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement floating-point arithmetic instructions
Marek Vasut [Sat, 27 Jun 2020 21:26:30 +0000 (23:26 +0200)]
aarch64: Implement floating-point arithmetic instructions

Fill in aarch64 opcodes for floating point arithmetic instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement andn instruction
Marek Vasut [Sat, 27 Jun 2020 21:36:22 +0000 (23:36 +0200)]
aarch64: Implement andn instruction

Fill in aarch64 opcode for andn instruction.
This is bic instruction with reversed operands.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement splatw3q instruction
Marek Vasut [Sat, 27 Jun 2020 20:55:17 +0000 (22:55 +0200)]
aarch64: Implement splatw3q instruction

This uses TRN2 instruction twice on the same data, first to expand
top half-word of SRC register into TMP register and then to expand
top world of TMP register to DST register. The following scheme is
implemented: src[ABCDEFGH] -> tmp[ABABEFEF] -> dst[ABABABAB] .

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement swapX instructions
Marek Vasut [Sat, 27 Jun 2020 17:35:45 +0000 (19:35 +0200)]
aarch64: Implement swapX instructions

Fill in aarch64 opcodes for swapX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement div255w instruction
Marek Vasut [Fri, 26 Jun 2020 16:27:40 +0000 (18:27 +0200)]
aarch64: Implement div255w instruction

Fill in aarch64 opcodes for div255w instruction.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement mulX instructions
Marek Vasut [Fri, 26 Jun 2020 16:46:52 +0000 (18:46 +0200)]
aarch64: Implement mulX instructions

Fill in aarch64 opcodes for mulX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement cmpX instructions
Marek Vasut [Fri, 26 Jun 2020 16:44:15 +0000 (18:44 +0200)]
aarch64: Implement cmpX instructions

Fill in aarch64 opcodes for cmpX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement avgX instructions
Marek Vasut [Fri, 26 Jun 2020 16:39:29 +0000 (18:39 +0200)]
aarch64: Implement avgX instructions

Fill in aarch64 opcodes for avgX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement splitX/splatX instructions
Marek Vasut [Fri, 26 Jun 2020 11:38:52 +0000 (13:38 +0200)]
aarch64: Implement splitX/splatX instructions

Fill in aarch64 opcodes for splitX/splatX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement signX instructions
Marek Vasut [Fri, 26 Jun 2020 10:35:57 +0000 (12:35 +0200)]
aarch64: Implement signX instructions

Fill in aarch64 opcodes for signX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement vminX/vmaxX instructions
Marek Vasut [Fri, 26 Jun 2020 10:27:12 +0000 (12:27 +0200)]
aarch64: Implement vminX/vmaxX instructions

Fill in aarch64 opcodes for vminX/vmaxX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement accX instructions
Marek Vasut [Fri, 26 Jun 2020 03:08:14 +0000 (05:08 +0200)]
aarch64: Implement accX instructions

Fill in aarch64 opcodes for accX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement loadiX instructions
Marek Vasut [Fri, 26 Jun 2020 00:22:41 +0000 (02:22 +0200)]
aarch64: Implement loadiX instructions

Fill in aarch64 opcodes for loadiX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement subX instructions
Marek Vasut [Fri, 26 Jun 2020 01:43:41 +0000 (03:43 +0200)]
aarch64: Implement subX instructions

Fill in aarch64 opcodes for subX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement andX instructions
Marek Vasut [Fri, 26 Jun 2020 01:37:02 +0000 (03:37 +0200)]
aarch64: Implement andX instructions

Fill in aarch64 opcodes for andX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement absX instructions
Marek Vasut [Fri, 26 Jun 2020 01:35:22 +0000 (03:35 +0200)]
aarch64: Implement absX instructions

Fill in aarch64 opcodes for absX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement xorX instructions
Marek Vasut [Fri, 26 Jun 2020 01:32:34 +0000 (03:32 +0200)]
aarch64: Implement xorX instructions

Fill in aarch64 opcodes for xorX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement copyX/orX instructions
Marek Vasut [Thu, 25 Jun 2020 22:30:12 +0000 (00:30 +0200)]
aarch64: Implement copyX/orX instructions

Fill in aarch64 opcodes for copyX/orX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>
4 years agoaarch64: Implement mergeX instructions
Marek Vasut [Thu, 25 Jun 2020 19:43:03 +0000 (21:43 +0200)]
aarch64: Implement mergeX instructions

Fill in aarch64 opcodes for mergeX instructions.

Signed-off-by: Marek Vasut <marex@denx.de>