From d5fa1cc72f53d3ee5e1bb2b9c5be2a45959273c4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 24 Mar 2017 13:28:37 +0100 Subject: import --- .gitignore | 2 + Bug-fix-in-ssse3-quantize-function.patch | 32 ++++ libvpx.spec | 283 +++++++++++++++++++++++++++++++ libvpx.ver | 79 +++++++++ sectalign-nasm.patch | 24 +++ vp9-nasm.patch | 96 +++++++++++ x86inc-nasm.patch | 25 +++ 7 files changed, 541 insertions(+) create mode 100644 .gitignore create mode 100644 Bug-fix-in-ssse3-quantize-function.patch create mode 100644 libvpx.spec create mode 100644 libvpx.ver create mode 100644 sectalign-nasm.patch create mode 100644 vp9-nasm.patch create mode 100644 x86inc-nasm.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6ddfb76 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.tar.bz2 +*.src.rpm diff --git a/Bug-fix-in-ssse3-quantize-function.patch b/Bug-fix-in-ssse3-quantize-function.patch new file mode 100644 index 0000000..74138e8 --- /dev/null +++ b/Bug-fix-in-ssse3-quantize-function.patch @@ -0,0 +1,32 @@ +commit 0d43bd77e5f429467fbd280a7b8f7fbc0bfe1809 +Author: Yunqing Wang +Date: Fri Feb 7 14:27:07 2014 -0800 + + Bug fix in ssse3 quantize function + + A bug was reported in Issue 702: "SIGILL (Illegal instruction) when + transcoding with vp9 - using FFmpeg". It was reproduced and fixed. + + Change-Id: Ie32c149a89af02856084aeaf289e848a905c7700 + +diff --git a/vp9/encoder/x86/vp9_quantize_ssse3.asm b/vp9/encoder/x86/vp9_quantize_ssse3.asm +index db30660..48ccef8 100644 +--- a/vp9/encoder/x86/vp9_quantize_ssse3.asm ++++ b/vp9/encoder/x86/vp9_quantize_ssse3.asm +@@ -188,7 +188,8 @@ cglobal quantize_%1, 0, %2, 15, coeff, ncoeff, skip, zbin, round, quant, \ + pmaxsw m8, m7 + pshuflw m7, m8, 0x1 + pmaxsw m8, m7 +- pextrw [r2], m8, 0 ++ pextrw r6, m8, 0 ++ mov [r2], r6 + RET + + ; skip-block, i.e. just write all zeroes +@@ -214,5 +215,5 @@ cglobal quantize_%1, 0, %2, 15, coeff, ncoeff, skip, zbin, round, quant, \ + %endmacro + + INIT_XMM ssse3 +-QUANTIZE_FN b, 6 ++QUANTIZE_FN b, 7 + QUANTIZE_FN b_32x32, 7 diff --git a/libvpx.spec b/libvpx.spec new file mode 100644 index 0000000..96d27c5 --- /dev/null +++ b/libvpx.spec @@ -0,0 +1,283 @@ +%global majorver 1 +%global minorver 3 +%global tinyver 0 + +Name: libvpx +Summary: VP8 Video Codec SDK +Version: %{majorver}.%{minorver}.%{tinyver} +%global soversion %{version} +Release: 0%{?dist} +License: BSD +Group: System Environment/Libraries +Source0: http://webm.googlecode.com/files/%{name}-v%{version}.tar.bz2 +# Thanks to debian. +Source2: libvpx.ver +Patch0: Bug-fix-in-ssse3-quantize-function.patch +Patch1: x86inc-nasm.patch +Patch2: vp9-nasm.patch +Patch3: sectalign-nasm.patch +URL: http://www.webmproject.org/tools/vp8-sdk/ +%ifarch %{ix86} x86_64 +BuildRequires: nasm +%endif +BuildRequires: doxygen, php-cli + +%description +libvpx provides the VP8 SDK, which allows you to integrate your applications +with the VP8 video codec, a high quality, royalty free, open source codec +deployed on millions of computers and devices worldwide. + +%package devel +Summary: Development files for libvpx +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +Development libraries and headers for developing software against +libvpx. + +%package utils +Summary: VP8 utilities and tools +Group: Development/Tools +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description utils +A selection of utilities and tools for VP8, including a sample encoder +and decoder. + +%prep +%setup -q -n %{name}-v%{version} +%patch0 -p1 -b .patch0 +%patch1 -p1 -b .x86inc-nasm +%patch2 -p1 -b .vp9-nasm +%patch3 -p1 -b .sectalign-nasm +sed -i -e 's/^\(global .*\) PRIVATE$/\1/' $(find -name "*.asm") + +%build +%ifarch %{ix86} +%global vpxtarget x86-linux-gcc +%else +%ifarch x86_64 +%global vpxtarget x86_64-linux-gcc +%else +%ifarch armv7hl +%global vpxtarget armv7-linux-gcc +%else +%global vpxtarget generic-gnu +%endif +%endif +%endif + +# The configure script will reject the shared flag on the generic target +# This means we need to fall back to the manual creation we did before. :P +%if "%{vpxtarget}" == "generic-gnu" +%global generic_target 1 +%else +%global generic_target 0 +%endif + +%ifarch armv7hl +CROSS=armv7hl-redhat-linux-gnueabi- CHOST=armv7hl-redhat-linux-gnueabi-hardfloat ./configure \ +%else +./configure --target=%{vpxtarget} \ +%endif +--enable-pic --disable-install-srcs --as=nasm \ +%if ! %{generic_target} +--enable-shared \ +%endif +--prefix=%{_prefix} --libdir=%{_libdir} + +# Hack our optflags in. +sed -i "s|-O3|%{optflags}|g" libs-%{vpxtarget}.mk +sed -i "s|-O3|%{optflags}|g" examples-%{vpxtarget}.mk +sed -i "s|-O3|%{optflags}|g" docs-%{vpxtarget}.mk + +%ifarch armv7hl +#hackety hack hack +sed -i "s|AR=armv7hl-redhat-linux-gnueabi-ar|AR=ar|g" libs-%{vpxtarget}.mk +sed -i "s|AR=armv7hl-redhat-linux-gnueabi-ar|AR=ar|g" examples-%{vpxtarget}.mk +sed -i "s|AR=armv7hl-redhat-linux-gnueabi-ar|AR=ar|g" docs-%{vpxtarget}.mk + +sed -i "s|AS=armv7hl-redhat-linux-gnueabi-as|AS=as|g" libs-%{vpxtarget}.mk +sed -i "s|AS=armv7hl-redhat-linux-gnueabi-as|AS=as|g" examples-%{vpxtarget}.mk +sed -i "s|AS=armv7hl-redhat-linux-gnueabi-as|AS=as|g" docs-%{vpxtarget}.mk + +sed -i "s|NM=armv7hl-redhat-linux-gnueabi-nm|NM=nm|g" libs-%{vpxtarget}.mk +sed -i "s|NM=armv7hl-redhat-linux-gnueabi-nm|NM=nm|g" examples-%{vpxtarget}.mk +sed -i "s|NM=armv7hl-redhat-linux-gnueabi-nm|NM=nm|g" docs-%{vpxtarget}.mk +%endif + +make %{?_smp_mflags} verbose=true target=libs + +%if %{generic_target} +# Manual shared library creation +mkdir tmp +cd tmp +ar x ../libvpx_g.a +cd .. +gcc -fPIC -shared -pthread -lm -Wl,--no-undefined -Wl,-soname,libvpx.so.%{majorver} -Wl,--version-script,%{SOURCE2} -Wl,-z,noexecstack -o libvpx.so.%{soversion} tmp/*.o +rm -rf tmp +%endif + +# Temporarily dance the static libs out of the way +mv libvpx.a libNOTvpx.a +mv libvpx_g.a libNOTvpx_g.a + +# We need to do this so the examples can link against it. +ln -sf libvpx.so.%{soversion} libvpx.so + +make %{?_smp_mflags} verbose=true target=examples CONFIG_SHARED=1 +make %{?_smp_mflags} verbose=true target=docs + +# Put them back so the install doesn't fail +mv libNOTvpx.a libvpx.a +mv libNOTvpx_g.a libvpx_g.a + +%install +make DIST_DIR=%{buildroot}%{_prefix} dist + +# Simpler to label the dir as %doc. +mv %{buildroot}/usr/docs doc/ + +%if %{generic_target} +install -p libvpx.so.%{soversion} %{buildroot}%{_libdir} +pushd %{buildroot}%{_libdir} +ln -sf libvpx.so.%{soversion} libvpx.so +ln -sf libvpx.so.%{soversion} libvpx.so.%{majorver} +ln -sf libvpx.so.%{soversion} libvpx.so.%{majorver}.%{minorver} +popd +%endif + +pushd %{buildroot} +# Stuff we don't need. +rm -rf usr/build/ usr/md5sums.txt usr/lib*/*.a usr/CHANGELOG usr/README +# Rename a few examples +mv usr/bin/postproc usr/bin/vp8_postproc +mv usr/bin/simple_decoder usr/bin/vp8_simple_decoder +mv usr/bin/simple_encoder usr/bin/vp8_simple_encoder +mv usr/bin/twopass_encoder usr/bin/vp8_twopass_encoder +# Fix the binary permissions +chmod 755 usr/bin/* +popd + +# Keep the old file for compatibility +cp %{buildroot}/%{_libdir}/pkgconfig/vpx.pc %{buildroot}/%{_libdir}/pkgconfig/libvpx.pc + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%doc AUTHORS CHANGELOG LICENSE README +%{_libdir}/libvpx.so.* + +%files devel +# These are SDK docs, not really useful to an end-user. +%doc docs/html/ +%{_includedir}/vpx/ +%{_libdir}/pkgconfig/vpx.pc +%{_libdir}/pkgconfig/libvpx.pc +%{_libdir}/libvpx.so + +%files utils +%{_bindir}/* + +%changelog +* Sat Aug 30 2014 Remi Collet - 1.3.0-0 +- temporary build for remi repo, waiting for all + RHEL clone to provide this version +- set release to 0 to ensure distro package is used + +* Mon Aug 4 2014 Martin Stransky - 1.3.0-5 +- Compatibility fix + +* Thu Mar 20 2014 Wim Taymans - 1.3.0-4 +- fix Illegal Instruction abort + +* Thu Feb 13 2014 Dan Horák - 1.3.0-3 +- update library symbol list for 1.3.0 from Debian + +* Tue Feb 11 2014 Tom Callaway - 1.3.0-2 +- armv7hl specific target + +* Tue Feb 11 2014 Tom Callaway - 1.3.0-1 +- update to 1.3.0 + +* Thu Feb 28 2013 Tom Callaway - 1.2.0-1 +- update to 1.2.0 + +* Tue May 29 2012 Tom Callaway - 1.1.0-1 +- update to 1.1.0 + +* Tue May 29 2012 Tom Callaway - 1.0.0-3 +- fix vpx.pc file to include -lm (bz825754) + +* Fri May 11 2012 Tom Callaway - 1.0.0-2 +- use included vpx.pc file (drop local libvpx.pc) +- apply upstream fix to vpx.pc file (bz 814177) + +* Mon Jan 30 2012 Tom Callaway - 1.0.0-1 +- update to 1.0.0 + +* Mon Oct 10 2011 Dan Horák - 0.9.7.1-3 +- use macro instead of hard-coded version + +* Mon Sep 12 2011 Dan Horák - 0.9.7.1-2 +- fix build on generic targets + +* Tue Aug 16 2011 Adam Jackson 0.9.7.1-1 +- libvpx 0.9.7-p1 + +* Tue Aug 09 2011 Adam Jackson 0.9.7-1 +- libvpx 0.9.7 + +* Mon Mar 21 2011 Dan Horák - 0.9.6-2 +- add 2 symbols to the shared library for generic targets + +* Thu Mar 10 2011 Tom Callaway - 0.9.6-1 +- update to 0.9.6 + +* Tue Feb 08 2011 Fedora Release Engineering - 0.9.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Nov 17 2010 Tom "spot" Callaway 0.9.5-2 +- apply patch from upstream git (Change I6266aba7), should resolve CVE-2010-4203 + +* Mon Nov 1 2010 Tom "spot" Callaway 0.9.5-1 +- update to 0.9.5 + +* Wed Sep 1 2010 Tom "spot" Callaway 0.9.1-3 +- only package html docs to avoid multilib conflict (bz 613185) + +* Thu Jun 24 2010 Tom "spot" Callaway 0.9.1-2 +- build shared library the old way for generic arches + +* Thu Jun 24 2010 Tom "spot" Callaway 0.9.1-1 +- update to 0.9.1 + +* Fri Jun 11 2010 Tom "spot" Callaway 0.9.0-7 +- update to git revision 8389f1967c5f8b3819cca80705b1b4ba04132b93 +- upstream fix for bz 599147 +- proper shared library support + +* Wed Jun 2 2010 Tom "spot" Callaway 0.9.0-6 +- add hackish fix for bz 599147 + (upstream will hopefully fix properly in future release) + +* Fri May 21 2010 Tom "spot" Callaway 0.9.0-5 +- fix noexecstack flag + +* Thu May 20 2010 Tom "spot" Callaway 0.9.0-4 +- BuildRequires: yasm (we're optimized again) + +* Thu May 20 2010 Tom "spot" Callaway 0.9.0-3 +- add pkg-config file +- move headers into include/vpx/ +- enable optimization + +* Thu May 20 2010 Tom "spot" Callaway 0.9.0-2 +- fix permissions on binaries +- rename generic binaries to v8_* +- link shared library to -lm, -lpthread to resolve missing weak symbols + +* Wed May 19 2010 Tom "spot" Callaway 0.9.0-1 +- Initial package for Fedora diff --git a/libvpx.ver b/libvpx.ver new file mode 100644 index 0000000..aa147ab --- /dev/null +++ b/libvpx.ver @@ -0,0 +1,79 @@ +{ global: +vpx_codec_build_config; +vpx_codec_control_; +vpx_codec_dec_init_ver; +vpx_codec_decode; +vpx_codec_destroy; +vpx_codec_enc_config_default; +vpx_codec_enc_config_set; +vpx_codec_enc_init_ver; +vpx_codec_encode; +vpx_codec_error; +vpx_codec_error_detail; +vpx_codec_err_to_string; +vpx_codec_get_caps; +vpx_codec_get_cx_data; +vpx_codec_get_frame; +vpx_codec_get_global_headers; +vpx_codec_get_mem_map; +vpx_codec_get_preview_frame; +vpx_codec_get_stream_info; +vpx_codec_iface_name; +vpx_codec_peek_stream_info; +vpx_codec_register_put_frame_cb; +vpx_codec_register_put_slice_cb; +vpx_codec_set_cx_data_buf; +vpx_codec_set_frame_buffer_functions; +vpx_codec_set_mem_map; +vpx_codec_version; +vpx_codec_version_extra_str; +vpx_codec_version_str; +vpx_codec_vp8_algo; +vpx_codec_vp8_cx; +vpx_codec_vp8_cx_algo; +vpx_codec_vp8_dx; +vpx_codec_vp8_dx_algo; +vpx_codec_vp9_cx; +vpx_codec_vp9_cx_algo; +vpx_codec_vp9_dx; +vpx_codec_vp9_dx_algo; +vpx_dec_control; +vpx_dec_decode; +vpx_dec_destroy; +vpx_dec_error; +vpx_dec_error_detail; +vpx_dec_err_to_string; +vpx_dec_get_caps; +vpx_dec_get_frame; +vpx_dec_get_mem_map; +vpx_dec_get_stream_info; +vpx_dec_iface_name; +vpx_dec_init_ver; +vpx_dec_peek_stream_info; +vpx_dec_register_put_frame_cb; +vpx_dec_register_put_slice_cb; +vpx_dec_set_mem_map; +vpx_dec_xma_init_ver; +vpx_enc_vp8_algo; +vpx_img_alloc; +vpx_img_flip; +vpx_img_free; +vpx_img_set_rect; +vpx_img_wrap; +vpx_svc_dump_statistics; +vpx_svc_encode; +vpx_svc_get_buffer; +vpx_svc_get_encode_frame_count; +vpx_svc_get_frame_size; +vpx_svc_get_layer_resolution; +vpx_svc_get_message; +vpx_svc_get_rc_stats_buffer; +vpx_svc_get_rc_stats_buffer_size; +vpx_svc_init; +vpx_svc_is_keyframe; +vpx_svc_release; +vpx_svc_set_keyframe; +vpx_svc_set_options; +vpx_svc_set_quantizers; +vpx_svc_set_scale_factors; +local: *; }; diff --git a/sectalign-nasm.patch b/sectalign-nasm.patch new file mode 100644 index 0000000..c74a236 --- /dev/null +++ b/sectalign-nasm.patch @@ -0,0 +1,24 @@ +https://bugzilla.redhat.com/show_bug.cgi?id=603113#c11 + +--- libvpx-v1.3.0/build/make/configure.sh-orig 2014-01-10 21:12:40.000000000 +0100 ++++ libvpx-v1.3.0/build/make/configure.sh 2014-07-29 13:30:14.509553770 +0200 +@@ -374,7 +374,7 @@ EOF + readelf -WS ${TMP_O} >${TMP_X} + log_file ${TMP_X} + if ! grep -q '\.rodata .* 16$' ${TMP_X}; then +- die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" ++ echo >&2 "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)" + fi + } + +--- libvpx-v1.3.0/vpx_ports/x86_abi_support.asm-orig 2014-07-29 14:06:26.856461360 +0200 ++++ libvpx-v1.3.0/vpx_ports/x86_abi_support.asm 2014-07-29 15:00:51.772040384 +0200 +@@ -377,7 +377,7 @@ section .text + %elifidn __OUTPUT_FORMAT__,aout + %define SECTION_RODATA section .data + %else +-%define SECTION_RODATA section .rodata ++%define SECTION_RODATA section .rodata align=16 + %endif + + diff --git a/vp9-nasm.patch b/vp9-nasm.patch new file mode 100644 index 0000000..5e80cb7 --- /dev/null +++ b/vp9-nasm.patch @@ -0,0 +1,96 @@ +https://gerrit.chromium.org/gerrit/#/c/71007/ + +[modified] + +commit 2695f18211e9b1017647af608a64d72a688ffbe7 +Author: Jan Kratochvil +Date: Mon Jul 28 20:07:38 2014 +0200 + + Fix --as=nasm compatibility for new asm code. + + s/movd/movq/ + s/pmovmskb rX,/pmovmskb rXd,/ + Add end-of-line ':' label markers. + + Change-Id: Icc2c8b66af3cf72598361021699e099739f813d7 + +diff --git a/vp9/common/x86/vp9_subpixel_8t_ssse3.asm b/vp9/common/x86/vp9_subpixel_8t_ssse3.asm +index fd781d4..57eee70 100644 +--- a/vp9/common/x86/vp9_subpixel_8t_ssse3.asm ++++ b/vp9/common/x86/vp9_subpixel_8t_ssse3.asm +@@ -18,7 +18,7 @@ + mov rcx, 0x0400040 + + movdqa xmm4, [rdx] ;load filters +- movd xmm5, rcx ++ movq xmm5, rcx + packsswb xmm4, xmm4 + pshuflw xmm0, xmm4, 0b ;k0_k1 + pshuflw xmm1, xmm4, 01010101b ;k2_k3 +@@ -624,7 +624,7 @@ sym(vp9_filter_block1d16_v8_avg_ssse3): + pavgb xmm0, xmm1 + %endif + movd [rdi], xmm0 +-.done ++.done: + %endm + + %macro HORIZx8_ROW 4 +@@ -661,7 +661,7 @@ sym(vp9_filter_block1d16_v8_avg_ssse3): + mov rcx, 0x0400040 + + movdqa xmm4, [rdx] ;load filters +- movd xmm5, rcx ++ movq xmm5, rcx + packsswb xmm4, xmm4 + pshuflw xmm0, xmm4, 0b ;k0_k1 + pshuflw xmm1, xmm4, 01010101b ;k2_k3 +@@ -727,7 +727,7 @@ sym(vp9_filter_block1d16_v8_avg_ssse3): + pavgb xmm0, xmm1 + %endif + movq [rdi], xmm0 +-.done ++.done: + %endm + + %macro HORIZx16 1 +diff --git a/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm b/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm +index 508e1d4..1c97342 100644 +--- a/vp9/encoder/x86/vp9_quantize_ssse3.asm ++++ b/vp9/encoder/x86/vp9_quantize_ssse3.asm +@@ -122,8 +122,8 @@ cglobal quantize_%1, 0, %2, 15, coeff, ncoeff, skip, zbin, round, quant, \ + pcmpgtw m7, m6, m0 ; m7 = c[i] >= zbin + pcmpgtw m12, m11, m0 ; m12 = c[i] >= zbin + %ifidn %1, b_32x32 +- pmovmskb r6, m7 +- pmovmskb r2, m12 ++ pmovmskb r6d, m7 ++ pmovmskb r2d, m12 + or r6, r2 + jz .skip_iter + %endif +diff --git a/vp9/encoder/x86/vp9_subpel_variance.asm b/vp9/encoder/x86/vp9_subpel_variance.asm +index 1a9e4e8..e06e220 100644 +--- a/vp9/encoder/x86/vp9_subpel_variance.asm ++++ b/vp9/encoder/x86/vp9_subpel_variance.asm +@@ -101,7 +101,6 @@ SECTION .text + pshufd m4, m6, 0x1 + movd [r1], m7 ; store sse + paddd m6, m4 +- movd rax, m6 ; store sum as return value + %else ; mmsize == 8 + pshufw m4, m6, 0xe + pshufw m3, m7, 0xe +@@ -113,7 +112,11 @@ SECTION .text + movd [r1], m7 ; store sse + pshufw m4, m6, 0xe + paddd m6, m4 +- movd rax, m6 ; store sum as return value ++%endif ++%if ARCH_X86_64 ++ movq rax, m6 ; store sum as return value ++%else ++ movd eax, m6 ; store sum as return value + %endif + RET + %endmacro diff --git a/x86inc-nasm.patch b/x86inc-nasm.patch new file mode 100644 index 0000000..079ac08 --- /dev/null +++ b/x86inc-nasm.patch @@ -0,0 +1,25 @@ +commit 7ddb5f599286ab4ce7de4061ab94828cdfee36c6 +Author: KO Myung-Hun +Date: Tue Jul 22 10:47:20 2014 +0900 + + x86inc: fix compilation with NASM + + Change-Id: I5978921ab1ccad6648a5bde6ad023c3e3430f5f4 + +diff --git a/third_party/x86inc/x86inc.asm b/third_party/x86inc/x86inc.asm +index 2134676..99453a9 100644 +--- a/third_party/x86inc/x86inc.asm ++++ b/third_party/x86inc/x86inc.asm +@@ -234,10 +234,10 @@ ALIGNMODE k7 + %define r%1mp %2 + %elif ARCH_X86_64 ; memory + %define r%1m [rsp + stack_offset + %6] +- %define r%1mp qword r %+ %1m ++ %define r%1mp qword r %+ %1 %+ m + %else + %define r%1m [esp + stack_offset + %6] +- %define r%1mp dword r %+ %1m ++ %define r%1mp dword r %+ %1 %+ m + %endif + %define r%1 %2 + %endmacro -- cgit