Update to x264-20180908.

This update enables 10-bit depth support.

from Brad (maintainer)
This commit is contained in:
ajacoutot 2018-09-16 06:37:15 +00:00
parent 482ca16c44
commit be0bbc0221
15 changed files with 395 additions and 70 deletions

View File

@ -1,18 +1,17 @@
# $OpenBSD: Makefile,v 1.47 2018/07/01 21:10:10 sthen Exp $
# $OpenBSD: Makefile,v 1.48 2018/09/16 06:37:15 ajacoutot Exp $
COMMENT= free H.264/MPEG-4 AVC encoder
V= 20170717
V= 20180908
DISTNAME= x264-snapshot-${V}-2245
PKGNAME= x264-${V}
REVISION= 1
CATEGORIES= multimedia
MASTER_SITES= http://downloads.videolan.org/pub/videolan/x264/snapshots/
MASTER_SITES= https://downloads.videolan.org/pub/videolan/x264/snapshots/
EXTRACT_SUFX= .tar.bz2
SHARED_LIBS= x264 18.0
SHARED_LIBS= x264 19.0
HOMEPAGE= http://www.videolan.org/developers/x264.html
HOMEPAGE= https://www.videolan.org/developers/x264.html
MAINTAINER= Brad Smith <brad@comstyle.com>
@ -26,7 +25,7 @@ COMPILER= base-clang base-gcc
COMPILER_LANGS= c
.if ${MACHINE_ARCH} == "amd64"
BUILD_DEPENDS+= devel/nasm>=2.13.01
BUILD_DEPENDS+= devel/nasm
.endif
USE_GMAKE= Yes
@ -41,7 +40,7 @@ CONFIGURE_ARGS+=--enable-shared \
--enable-static \
--prefix=${PREFIX}
.if ${MACHINE_ARCH} != "amd64"
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc"
CONFIGURE_ARGS+=--disable-asm
.endif

View File

@ -1,2 +1,2 @@
SHA256 (x264-snapshot-20170717-2245.tar.bz2) = lSB7xxAUlKxPS99TJCERSS8ElSbDDUgDTXzAV1qTtMY=
SIZE (x264-snapshot-20170717-2245.tar.bz2) = 750487
SHA256 (x264-snapshot-20180908-2245.tar.bz2) = UyAH5SHwAfXLusB1Q7Cyt7K0FKTB5AuVJwcHE5pvTqU=
SIZE (x264-snapshot-20180908-2245.tar.bz2) = 769679

View File

@ -1,17 +1,17 @@
$OpenBSD: patch-Makefile,v 1.17 2017/08/10 12:01:20 sthen Exp $
$OpenBSD: patch-Makefile,v 1.18 2018/09/16 06:37:15 ajacoutot Exp $
Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -199,7 +199,7 @@ example: example$(EXE)
@@ -255,7 +255,7 @@ example: example$(EXE)
endif
x264$(EXE): $(GENERATED) .depend $(OBJCLI) $(CLI_LIBX264)
- $(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS)
+ $(LD)$@ $(OBJCLI) -L. -lx264 $(LDFLAGSCLI) $(LDFLAGS)
checkasm$(EXE): $(GENERATED) .depend $(OBJCHK) $(LIBX264)
$(LD)$@ $(OBJCHK) $(LIBX264) $(LDFLAGS)
@@ -303,7 +303,6 @@ ifneq ($(IMPLIBNAME),)
checkasm8$(EXE): $(GENERATED) .depend $(OBJCHK) $(OBJCHK_8) $(LIBX264)
$(LD)$@ $(OBJCHK) $(OBJCHK_8) $(LIBX264) $(LDFLAGS)
@@ -398,7 +398,6 @@ ifneq ($(IMPLIBNAME),)
$(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(bindir)
$(INSTALL) -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir)
else ifneq ($(SONAME),)

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-common_arm_asm_S,v 1.1 2018/09/16 06:37:15 ajacoutot Exp $
Index: common/arm/asm.S
--- common/arm/asm.S.orig
+++ common/arm/asm.S
@@ -74,7 +74,7 @@
# define FUNC @
#endif
-#if SYS_LINUX
+#if SYS_LINUX || SYS_OPENBSD
#define HAVE_SECTION_DATA_REL_RO 1
#else
#define HAVE_SECTION_DATA_REL_RO 0

View File

@ -1,18 +0,0 @@
$OpenBSD: patch-common_osdep_c,v 1.1 2018/07/01 21:10:10 sthen Exp $
Prefer a monotonic clock source if available
Index: common/osdep.c
--- common/osdep.c.orig
+++ common/osdep.c
@@ -51,6 +51,10 @@ int64_t x264_mdate( void )
struct timeb tb;
ftime( &tb );
return ((int64_t)tb.time * 1000 + (int64_t)tb.millitm) * 1000;
+#elif HAVE_CLOCK_GETTIME
+ struct timespec ts;
+ clock_gettime( CLOCK_MONOTONIC, &ts );
+ return (int64_t)ts.tv_sec * 1000000 + (int64_t)ts.tv_nsec / 1000;
#else
struct timeval tv_date;
gettimeofday( &tv_date, NULL );

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-common_osdep_h,v 1.10 2018/01/20 11:42:59 ajacoutot Exp $
$OpenBSD: patch-common_osdep_h,v 1.11 2018/09/16 06:37:15 ajacoutot Exp $
Enable the use of __sync_fetch_and_add() on aarch64, alpha, arm, mips64,
powerpc and sparc64.
@ -6,7 +6,7 @@ powerpc and sparc64.
Index: common/osdep.h
--- common/osdep.h.orig
+++ common/osdep.h
@@ -252,7 +252,8 @@ int x264_threading_init( void );
@@ -255,7 +255,8 @@ int x264_threading_init( void );
static ALWAYS_INLINE int x264_pthread_fetch_and_add( int *val, int add, x264_pthread_mutex_t *mutex )
{
#if HAVE_THREAD

View File

@ -0,0 +1,110 @@
$OpenBSD: patch-common_x86_cabac-a_asm,v 1.1 2018/09/16 06:37:15 ajacoutot Exp $
x86: Always use PIC in x86-64 asm
Index: common/x86/cabac-a.asm
--- common/x86/cabac-a.asm.orig
+++ common/x86/cabac-a.asm
@@ -36,11 +36,7 @@ SECTION_RODATA 64
%xdefine %%funccpu2 %3 ; last64
%xdefine %%funccpu3 %4 ; last15/last16
coeff_last_%1:
- %ifdef PIC
- %xdefine %%base coeff_last_%1 ; offset relative to the start of the table
- %else
- %xdefine %%base 0 ; absolute address
- %endif
+ %xdefine %%base coeff_last_%1
%rep 14
%ifidn %5, 4
dd mangle(private_prefix %+ _coeff_last%5_ %+ %%funccpu1) - %%base
@@ -121,15 +117,13 @@ struc cb
endstruc
%macro LOAD_GLOBAL 3-5 0 ; dst, base, off1, off2, tmp
-%ifdef PIC
- %ifidn %4, 0
- movzx %1, byte [%2+%3+r7-$$]
- %else
- lea %5, [r7+%4]
- movzx %1, byte [%2+%3+%5-$$]
- %endif
-%else
+%if ARCH_X86_64 == 0
movzx %1, byte [%2+%3+%4]
+%elifidn %4, 0
+ movzx %1, byte [%2+%3+r7-$$]
+%else
+ lea %5, [r7+%4]
+ movzx %1, byte [%2+%3+%5-$$]
%endif
%endmacro
@@ -154,9 +148,9 @@ cglobal cabac_encode_decision_%1, 1,7
shr t5d, 6
movifnidn t2d, r2m
%if WIN64
- PUSH r7
+ PUSH r7
%endif
-%ifdef PIC
+%if ARCH_X86_64
lea r7, [$$]
%endif
LOAD_GLOBAL t5d, cabac_range_lps-4, t5, t4*2, t4
@@ -183,7 +177,7 @@ cglobal cabac_encode_decision_%1, 1,7
shl t6d, t3b
%endif
%if WIN64
- POP r7
+ POP r7
%endif
mov [t0+cb.range], t4d
add t3d, [t0+cb.queue]
@@ -409,13 +403,9 @@ CABAC bmi2
%endmacro
%macro COEFF_LAST 2 ; table, ctx_block_cat
-%ifdef PIC
lea r1, [%1 GLOBAL]
movsxd r6, [r1+4*%2]
add r6, r1
-%else
- movsxd r6, [%1+4*%2]
-%endif
call r6
%endmacro
@@ -436,15 +426,9 @@ CABAC bmi2
%define dct r4
%endif
-%ifdef PIC
- cglobal func, 4,13,6,-maxcoeffs*SIZEOF_DCTCOEF
+cglobal func, 4,13,6,-maxcoeffs*SIZEOF_DCTCOEF
lea r12, [$$]
%define GLOBAL +r12-$$
-%else
- cglobal func, 4,12,6,-maxcoeffs*SIZEOF_DCTCOEF
- %define GLOBAL
-%endif
-
shl r1d, 4 ; MB_INTERLACED*16
%if %1
lea r4, [significant_coeff_flag_offset_8x8+r1*4 GLOBAL] ; r12 = sig offset 8x8
@@ -653,15 +637,10 @@ CABAC_RESIDUAL_RD 1, coeff_last_avx512
%macro CABAC_RESIDUAL 1
cglobal cabac_block_residual_internal, 4,15,0,-4*64
-%ifdef PIC
; if we use the same r7 as in cabac_encode_decision, we can cheat and save a register.
lea r7, [$$]
%define lastm [rsp+4*1]
%define GLOBAL +r7-$$
-%else
- %define lastm r7d
- %define GLOBAL
-%endif
shl r1d, 4
%define sigoffq r8

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-common_x86_cpu-a_asm,v 1.1 2018/09/16 06:37:15 ajacoutot Exp $
cli: Fix linking with --system-libx264 on x86
Index: common/x86/cpu-a.asm
--- common/x86/cpu-a.asm.orig
+++ common/x86/cpu-a.asm
@@ -83,7 +83,7 @@ cglobal cpu_sfence
;-----------------------------------------------------------------------------
; intptr_t stack_align( void (*func)(void*), ... ); (up to 5 args)
;-----------------------------------------------------------------------------
-cglobal stack_align
+cvisible stack_align
mov rax, r0mp
mov r0, r1mp
mov r1, r2mp
@@ -131,7 +131,7 @@ cglobal cpu_cpuid_test
popfd
ret
-cglobal stack_align
+cvisible stack_align
push ebp
mov ebp, esp
sub esp, 20

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-common_x86_mc-a_asm,v 1.3 2018/09/16 06:37:15 ajacoutot Exp $
x86: Always use PIC in x86-64 asm
Index: common/x86/mc-a.asm
--- common/x86/mc-a.asm.orig
+++ common/x86/mc-a.asm
@@ -1331,7 +1331,7 @@ cglobal pixel_avg2_w16_cache64_ssse3
sub r4, r2
shl r6, 4 ;jump = (offset + align*2)*48
%define avg_w16_addr avg_w16_align1_1_ssse3-(avg_w16_align2_2_ssse3-avg_w16_align1_1_ssse3)
-%ifdef PIC
+%if ARCH_X86_64
lea r7, [avg_w16_addr]
add r6, r7
%else
@@ -2020,7 +2020,7 @@ cglobal mc_chroma
%if cpuflag(cache64)
mov t0d, r3d
and t0d, 7
-%ifdef PIC
+%if ARCH_X86_64
lea t1, [ch_shuf_adj]
movddup xm5, [t1 + t0*4]
%else

View File

@ -0,0 +1,34 @@
$OpenBSD: patch-common_x86_pixel-a_asm,v 1.1 2018/09/16 06:37:15 ajacoutot Exp $
x86: Always use PIC in x86-64 asm
Index: common/x86/pixel-a.asm
--- common/x86/pixel-a.asm.orig
+++ common/x86/pixel-a.asm
@@ -2862,7 +2862,7 @@ cglobal intra_satd_x3_8x8c, 0,6
; output the predicted samples
mov r3d, eax
shr r3d, 16
-%ifdef PIC
+%if ARCH_X86_64
lea r2, [%2_lut]
movzx r2d, byte [r2+r3]
%else
@@ -5099,7 +5099,7 @@ cglobal pixel_ssim_end4, 2,3
je .skip ; faster only if this is the common case; remove branch if we use ssim on a macroblock level
neg r2
-%ifdef PIC
+%if ARCH_X86_64
lea r3, [mask_ff + 16]
%xdefine %%mask r3
%else
@@ -5549,7 +5549,7 @@ ads_mvs_ssse3:
add r5, r6
xor r0d, r0d ; nmv
mov [r5], r0d
-%ifdef PIC
+%if ARCH_X86_64
lea r1, [$$]
%define GLOBAL +r1-$$
%else

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-common_x86_predict-a_asm,v 1.1 2018/09/16 06:37:15 ajacoutot Exp $
x86: Always use PIC in x86-64 asm
Index: common/x86/predict-a.asm
--- common/x86/predict-a.asm.orig
+++ common/x86/predict-a.asm
@@ -688,7 +688,7 @@ INIT_XMM cpuname
je .fix_lt_2
.do_top:
and r2d, 4
-%ifdef PIC
+%if ARCH_X86_64
lea r3, [shuf_fixtr]
pshufb m3, [r3+r2*4]
%else

View File

@ -0,0 +1,62 @@
$OpenBSD: patch-common_x86_quant-a_asm,v 1.1 2018/09/16 06:37:15 ajacoutot Exp $
x86: Always use PIC in x86-64 asm
Index: common/x86/quant-a.asm
--- common/x86/quant-a.asm.orig
+++ common/x86/quant-a.asm
@@ -673,7 +673,7 @@ cglobal dequant_%1x%1_flat16, 0,3
sub t2d, t0d
sub t2d, t1d ; i_mf = i_qp % 6
shl t2d, %2
-%ifdef PIC
+%if ARCH_X86_64
lea r1, [dequant%1_scale]
add r1, t2
%else
@@ -761,7 +761,7 @@ DEQUANT 8, 6, 4
sub t2d, t1d ; i_mf = i_qp % 6
shl t2d, %1
%if %2
-%ifdef PIC
+%if ARCH_X86_64
%define dmf r1+t2
lea r1, [dequant8_scale]
%else
@@ -1449,7 +1449,7 @@ cglobal decimate_score%1, 1,3
shr edx, 1
%endif
%endif
-%ifdef PIC
+%if ARCH_X86_64
lea r4, [decimate_mask_table4]
%define mask_table r4
%else
@@ -1580,16 +1580,11 @@ cglobal decimate_score64, 1,5
add eax, r3d
jnz .ret9
%endif
-%ifdef PIC
- lea r4, [decimate_table8]
- %define table r4
-%else
- %define table decimate_table8
-%endif
+ lea r4, [decimate_table8]
mov al, -6
.loop:
tzcnt rcx, r1
- add al, byte [table + rcx]
+ add al, byte [r4 + rcx]
jge .ret9
shr r1, 1
SHRX r1, rcx
@@ -2165,7 +2160,7 @@ COEFF_LEVELRUN 16
%macro COEFF_LEVELRUN_LUT 1
cglobal coeff_level_run%1,2,4+(%1/9)
-%ifdef PIC
+%if ARCH_X86_64
lea r5, [$$]
%define GLOBAL +r5-$$
%else

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-common_x86_sad-a_asm,v 1.1 2018/09/16 06:37:15 ajacoutot Exp $
x86: Always use PIC in x86-64 asm
Index: common/x86/sad-a.asm
--- common/x86/sad-a.asm.orig
+++ common/x86/sad-a.asm
@@ -1920,7 +1920,7 @@ cglobal pixel_sad_16x%2_cache64_%1
shl r4d, 4 ; code size = 80
%endif
%define sad_w16_addr (sad_w16_align1_%1 + (sad_w16_align1_%1 - sad_w16_align2_%1))
-%ifdef PIC
+%if ARCH_X86_64
lea r5, [sad_w16_addr]
add r5, r4
%else

View File

@ -0,0 +1,51 @@
$OpenBSD: patch-common_x86_trellis-64_asm,v 1.1 2018/09/16 06:37:15 ajacoutot Exp $
x86: Always use PIC in x86-64 asm
Index: common/x86/trellis-64.asm
--- common/x86/trellis-64.asm.orig
+++ common/x86/trellis-64.asm
@@ -202,7 +202,6 @@ cglobal %1, 4,15,9
paddd m6, m6
%define unquant_mf m6
%endif
-%ifdef PIC
%if dc == 0
mov unquant_mfm, unquant_mfq
%endif
@@ -212,9 +211,6 @@ cglobal %1, 4,15,9
; (Any address in .text would work, this one was just convenient.)
lea r0, [$$]
%define GLOBAL +r0-$$
-%else
- %define GLOBAL
-%endif
TRELLIS_LOOP 0 ; node_ctx 0..3
TRELLIS_LOOP 1 ; node_ctx 1..7
@@ -304,12 +300,8 @@ cglobal %1, 4,15,9
mov r10, cabac_state_sigm
%if num_coefs == 64
mov r6d, b_interlacedm
-%ifdef PIC
add r6d, iid
movzx r6d, byte [significant_coeff_flag_offset_8x8 + r6 GLOBAL]
-%else
- movzx r6d, byte [significant_coeff_flag_offset_8x8 + r6 + iiq]
-%endif
movzx r10, byte [r10 + r6]
%elif num_coefs == 8
movzx r13, byte [coeff_flag_offset_chroma_422_dc + iiq GLOBAL]
@@ -408,12 +400,8 @@ cglobal %1, 4,15,9
%if dc
pmuludq m0, unquant_mf
%else
-%ifdef PIC
mov r10, unquant_mfm
LOAD_DUP m3, [r10 + zigzagiq*4]
-%else
- LOAD_DUP m3, [unquant_mfq + zigzagiq*4]
-%endif
pmuludq m0, m3
%endif
paddd m0, [pq_128]

View File

@ -1,6 +1,4 @@
$OpenBSD: patch-configure,v 1.24 2018/07/01 21:10:10 sthen Exp $
Prefer a monotonic clock source if available
$OpenBSD: patch-configure,v 1.25 2018/09/16 06:37:15 ajacoutot Exp $
Index: configure
--- configure.orig
@ -11,30 +9,28 @@ Index: configure
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
cat <<EOF
@@ -377,7 +377,7 @@ NL="
# list of all preprocessor HAVE values we can define
CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER \
- MSA MMAP WINRT VSX ARM_INLINE_ASM"
+ MSA MMAP WINRT VSX ARM_INLINE_ASM CLOCK_GETTIME"
@@ -734,11 +734,11 @@ case $host_cpu in
ARCH="X86_64"
AS="${AS-nasm}"
AS_EXT=".asm"
- ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -I\$(SRCPATH)/common/x86/"
+ ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -DPIC -I\$(SRCPATH)/common/x86/"
stack_alignment=16
[ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
if [ "$SYS" = MACOSX ]; then
- ASFLAGS="$ASFLAGS -f macho64 -DPIC -DPREFIX"
+ ASFLAGS="$ASFLAGS -f macho64 -DPREFIX"
if cc_check '' "-arch x86_64"; then
CFLAGS="$CFLAGS -arch x86_64"
LDFLAGS="$LDFLAGS -arch x86_64"
@@ -1253,16 +1253,12 @@ cc_check "stdint.h" "" "uint32_t test_vec __attribute_
# parse options
@@ -1039,6 +1039,13 @@ if cc_check "math.h" "-Werror" "return log2f(2);" ; th
define HAVE_LOG2F
fi
+if cc_check 'time.h' '' 'clock_gettime(CLOCK_MONOTONIC, 0);' ; then
+ define HAVE_CLOCK_GETTIME
+elif cc_check 'time.h' '-lrt' 'clock_gettime(CLOCK_MONOTONIC, 0);' ; then
+ define HAVE_CLOCK_GETTIME
+ LDFLAGS="$LDFLAGS -lrt"
+fi
+
if [ "$SYS" != "WINDOWS" ] && cpp_check "sys/mman.h unistd.h" "" "defined(MAP_PRIVATE)"; then
define HAVE_MMAP
fi
@@ -1212,10 +1219,6 @@ if [ "$pic" = "yes" ] ; then
if [ "$pic" = "yes" ] ; then
[ "$SYS" != WINDOWS -a "$SYS" != CYGWIN ] && CFLAGS="$CFLAGS -fPIC"
- ASFLAGS="$ASFLAGS -DPIC"
+ [[ "$ASFLAGS" != *"-DPIC"* ]] && ASFLAGS="$ASFLAGS -DPIC"
# resolve textrels in the x86 asm
cc_check stdio.h "-shared -Wl,-Bsymbolic" && SOFLAGS="$SOFLAGS -Wl,-Bsymbolic"
[ $SYS = SunOS -a "$ARCH" = "X86" ] && SOFLAGS="$SOFLAGS -mimpure-text"
fi
@ -45,14 +41,9 @@ Index: configure
if [ "$strip" = "yes" ]; then
LDFLAGS="$LDFLAGS -s"
fi
@@ -1223,12 +1226,16 @@ fi
if [ "$debug" = "yes" ]; then
@@ -1271,11 +1267,11 @@ if [ "$debug" = "yes" ]; then
CFLAGS="-O1 -g $CFLAGS"
RCFLAGS="$RCFLAGS -DDEBUG"
+elif [ $ARCH = ARM ]; then
+ # arm-gcc-4.2 produces incorrect output with -ffast-math
+ # and it doesn't save any speed anyway on 4.4, so disable it
+ CFLAGS="-fno-fast-math $CFLAGS"
else
- CFLAGS="-O3 -ffast-math $CFLAGS"
+ CFLAGS="-ffast-math $CFLAGS"
@ -64,7 +55,7 @@ Index: configure
fi
fi
[ "$lto" = "auto" ] && lto="no"
@@ -1257,10 +1264,6 @@ if cc_check '' -Wshadow ; then
@@ -1304,10 +1300,6 @@ if cc_check '' -Wshadow ; then
CFLAGS="-Wshadow $CFLAGS"
fi
@ -75,7 +66,7 @@ Index: configure
if [ $compiler = ICC -o $compiler = ICL ] ; then
if cc_check 'extras/intel_dispatcher.h' '' 'x264_intel_dispatcher_override();' ; then
define HAVE_INTEL_DISPATCHER
@@ -1437,7 +1440,6 @@ if [ "$cli" = "yes" ]; then
@@ -1485,7 +1477,6 @@ if [ "$cli" = "yes" ]; then
fi
if [ "$shared" = "yes" ]; then
@ -83,7 +74,7 @@ Index: configure
if [ "$SYS" = "WINDOWS" -o "$SYS" = "CYGWIN" ]; then
echo "SONAME=libx264-$API.dll" >> config.mak
if [ $compiler_style = MS ]; then
@@ -1465,7 +1467,7 @@ if [ "$shared" = "yes" ]; then
@@ -1513,7 +1504,7 @@ if [ "$shared" = "yes" ]; then
else
echo "SOSUFFIX=so" >> config.mak
echo "SONAME=libx264.so.$API" >> config.mak