-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x264: preliminary compilation script
Adding files that allow for compilation of x264 codec with CLI tool. Succesfull compialtion, unsuccesful in runtime, does not compress. JIRA: PP-213
- Loading branch information
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
PREFIX_X264="${PREFIX_PROJECT}/phoenix-rtos-ports/x264" | ||
PREFIX_X264_BUILD="${PREFIX_BUILD}/x264" | ||
PREFIX_X264_CONFIG="${PREFIX_X264}/patches" | ||
PREFIX_X264_MARKERS="$PREFIX_X264_BUILD/markers" | ||
|
||
b_log "Building x264" | ||
|
||
# | ||
# Download and unpack | ||
# | ||
if [ ! -d "$PREFIX_X264_BUILD" ]; then | ||
if ! git clone https://code.videolan.org/videolan/x264.git "$PREFIX_X264_BUILD"; then | ||
echo "No mirror available" | ||
exit 1 | ||
fi | ||
(cd "$PREFIX_X264_BUILD" && git checkout master && git reset --hard 4613ac3c15fd75cebc4b9f65b7fb95e70a3acce1) | ||
mkdir -p "$PREFIX_X264_MARKERS" | ||
fi | ||
|
||
# | ||
# Apply patches | ||
# | ||
for patchfile in "$PREFIX_X264_CONFIG"/*.patch; do | ||
if [ ! -f "$PREFIX_X264_MARKERS/$(basename "$patchfile").applied" ]; then | ||
echo "applying patch: $patchfile" | ||
patch -d "$PREFIX_X264_BUILD" -p1 < "$patchfile" | ||
touch "$PREFIX_X264_MARKERS/$(basename "$patchfile").applied" | ||
fi | ||
done | ||
|
||
# | ||
# Prepare CFLAGS and LDFLAGS for x264 configure & Makefile | ||
# | ||
export LDFLAGS_EXTRA="${CFLAGS} ${LDFLAGS}" | ||
export CFLAGS_EXTRA="${CFLAGS}" | ||
export LDFLAGS="" | ||
export CFLAGS="" | ||
|
||
# | ||
# Build and install x264 binary | ||
# | ||
(cd "$PREFIX_X264_BUILD" && ./configure --extra-cflags="$CFLAGS_EXTRA" --extra-ldflags="$LDFLAGS_EXTRA" --cross-prefix="$CROSS" --sysroot="$PREFIX_BUILD/sysroot/" --host=arm-linux --disable-asm --disable-avs --disable-lavf --enable-pic --enable-static --disable-opencl) | ||
(cd "$PREFIX_X264_BUILD" && make) | ||
|
||
cp -a "${PREFIX_X264_BUILD}/x264" "$PREFIX_PROG_STRIPPED" | ||
b_install "$PREFIX_PORTS_INSTALL/x264" /bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- x264_org/common/base.c 2024-08-30 14:07:49.183495538 +0200 | ||
+++ x264/common/base.c 2024-08-30 14:14:26.584633533 +0200 | ||
@@ -37,6 +37,12 @@ | ||
|
||
#define X264_ISDIGIT(x) isdigit((unsigned char)(x)) | ||
|
||
+/* PHOENIX-RTOS patch: memalign is not supported by Phoenix-RTOS, use malloc as placeholder */ | ||
+void *memalign(size_t alignment, size_t size) | ||
+{ | ||
+ return malloc(size); | ||
+} | ||
+ | ||
/**************************************************************************** | ||
* x264_reduce_fraction: | ||
****************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- x264_org/common/cpu.c 2024-08-30 14:07:49.184495508 +0200 | ||
+++ x264/common/cpu.c 2024-08-30 14:12:25.631746608 +0200 | ||
@@ -516,17 +516,22 @@ | ||
// Android NDK does not expose sched_getaffinity | ||
return sysconf( _SC_NPROCESSORS_CONF ); | ||
#else | ||
- cpu_set_t p_aff; | ||
- memset( &p_aff, 0, sizeof(p_aff) ); | ||
- if( sched_getaffinity( 0, sizeof(p_aff), &p_aff ) ) | ||
- return 1; | ||
-#if HAVE_CPU_COUNT | ||
- return CPU_COUNT(&p_aff); | ||
-#else | ||
- int np = 0; | ||
- for( size_t bit = 0; bit < 8 * sizeof(p_aff); bit++ ) | ||
- np += (((uint8_t *)&p_aff)[bit / 8] >> (bit % 8)) & 1; | ||
- return np; | ||
+ /* Phoenix-RTOS patch - no support for 'cpu_set_t' which is part of GNU extension */ | ||
+ /* Return 1 as available processor count */ | ||
+ return 1; | ||
+#if 0 | ||
+ cpu_set_t p_aff; | ||
+ memset( &p_aff, 0, sizeof(p_aff) ); | ||
+ if( sched_getaffinity( 0, sizeof(p_aff), &p_aff ) ) | ||
+ return 1; | ||
+ #if HAVE_CPU_COUNT | ||
+ return CPU_COUNT(&p_aff); | ||
+ #else | ||
+ int np = 0; | ||
+ for( size_t bit = 0; bit < 8 * sizeof(p_aff); bit++ ) | ||
+ np += (((uint8_t *)&p_aff)[bit / 8] >> (bit % 8)) & 1; | ||
+ return np; | ||
+#endif | ||
#endif | ||
#endif | ||
|