]> granicus.if.org Git - libvpx/commitdiff
Merge "Revert "Restore vp8_sixtap_predict4x4_neon""
authorJames Zern <jzern@google.com>
Fri, 16 Sep 2016 06:13:41 +0000 (06:13 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Fri, 16 Sep 2016 06:13:42 +0000 (06:13 +0000)
31 files changed:
build/make/Android.mk
build/make/configure.sh
configure
examples/simple_encoder.c
examples/vp8cx_set_ref.c
examples/vp9_lossless_encoder.c
examples/vp9cx_set_ref.c
test/altref_test.cc
test/invalid_file_test.cc
test/vp9_frame_parallel_test.cc
vp8/common/arm/neon/bilinearpredict_neon.c
vp8/common/entropymode.c
vp8/common/generic/systemdependent.c
vp8/common/onyxc_int.h
vp8/common/postproc.c
vp8/common/rtcd_defs.pl
vp8/decoder/threading.c
vp8/encoder/encodeframe.c
vp8/encoder/ethreading.c
vp8/encoder/onyx_int.h
vp8/encoder/pickinter.c
vp8/vp8_cx_iface.c
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_ratectrl.c
vpx_dsp/vpx_dsp_rtcd_defs.pl
vpx_dsp/x86/inv_txfm_sse2.c
vpx_mem/vpx_mem.c
vpxdec.c
vpxenc.c
webmenc.cc
webmenc.h

index 9ccb5da26a243b7b75ee617a6c058e21abca17ca..36120170e81003f5f4875d35857d9c5ce4874066 100644 (file)
 # Running ndk-build will build libvpx and include it in your project.
 #
 
+# Alternatively, building the examples and unit tests can be accomplished in the
+# following way:
+#
+# Create a standalone toolchain from the NDK:
+# https://developer.android.com/ndk/guides/standalone_toolchain.html
+#
+# For example - to test on arm64 devices with clang:
+# $NDK/build/tools/make_standalone_toolchain.py \
+#   --arch arm64 --install-dir=/tmp/my-android-toolchain
+# export PATH=/tmp/my-android-toolchain/bin:$PATH
+# CROSS=aarch64-linux-android- CC=clang CXX=clang++ /path/to/libvpx/configure \
+#   --target=arm64-android-gcc
+#
+# Push the resulting binaries to a device and run them:
+# adb push test_libvpx /data/tmp/test_libvpx
+# adb shell /data/tmp/test_libvpx --gtest_filter=\*Sixtap\*
+#
+# Make sure to push the test data as well and set LIBVPX_TEST_DATA
+
 CONFIG_DIR := $(LOCAL_PATH)/
 LIBVPX_PATH := $(LOCAL_PATH)/libvpx
 ASM_CNV_PATH_LOCAL := $(TARGET_ARCH_ABI)/ads2gas
index 14fada09d4c69a67421e97015eedb8a9d67e782d..35609e89af451c14489cb4a0a6e0e3ebd9f77d16 100644 (file)
@@ -978,47 +978,50 @@ EOF
           ;;
 
         android*)
-          if [ -z "${sdk_path}" ]; then
-            die "Must specify --sdk-path for Android builds."
-          fi
-
-          SDK_PATH=${sdk_path}
-          COMPILER_LOCATION=`find "${SDK_PATH}" \
-                             -name "arm-linux-androideabi-gcc*" -print -quit`
-          TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi-
-          CC=${TOOLCHAIN_PATH}gcc
-          CXX=${TOOLCHAIN_PATH}g++
-          AR=${TOOLCHAIN_PATH}ar
-          LD=${TOOLCHAIN_PATH}gcc
-          AS=${TOOLCHAIN_PATH}as
-          STRIP=${TOOLCHAIN_PATH}strip
-          NM=${TOOLCHAIN_PATH}nm
-
-          if [ -z "${alt_libc}" ]; then
-            alt_libc=`find "${SDK_PATH}" -name arch-arm -print | \
-              awk '{n = split($0,a,"/"); \
+          if [ -n "${sdk_path}" ]; then
+            SDK_PATH=${sdk_path}
+            COMPILER_LOCATION=`find "${SDK_PATH}" \
+              -name "arm-linux-androideabi-gcc*" -print -quit`
+            TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi-
+            CC=${TOOLCHAIN_PATH}gcc
+            CXX=${TOOLCHAIN_PATH}g++
+            AR=${TOOLCHAIN_PATH}ar
+            LD=${TOOLCHAIN_PATH}gcc
+            AS=${TOOLCHAIN_PATH}as
+            STRIP=${TOOLCHAIN_PATH}strip
+            NM=${TOOLCHAIN_PATH}nm
+
+            if [ -z "${alt_libc}" ]; then
+              alt_libc=`find "${SDK_PATH}" -name arch-arm -print | \
+                awk '{n = split($0,a,"/"); \
                 split(a[n-1],b,"-"); \
                 print $0 " " b[2]}' | \
                 sort -g -k 2 | \
                 awk '{ print $1 }' | tail -1`
-          fi
+            fi
 
-          if [ -d "${alt_libc}" ]; then
-            add_cflags "--sysroot=${alt_libc}"
-            add_ldflags "--sysroot=${alt_libc}"
-          fi
+            if [ -d "${alt_libc}" ]; then
+              add_cflags "--sysroot=${alt_libc}"
+              add_ldflags "--sysroot=${alt_libc}"
+            fi
 
-          # linker flag that routes around a CPU bug in some
-          # Cortex-A8 implementations (NDK Dev Guide)
-          add_ldflags "-Wl,--fix-cortex-a8"
+            # linker flag that routes around a CPU bug in some
+            # Cortex-A8 implementations (NDK Dev Guide)
+            add_ldflags "-Wl,--fix-cortex-a8"
 
-          enable_feature pic
-          soft_enable realtime_only
-          if [ ${tgt_isa} = "armv7" ]; then
-            soft_enable runtime_cpu_detect
-          fi
-          if enabled runtime_cpu_detect; then
-            add_cflags "-I${SDK_PATH}/sources/android/cpufeatures"
+            enable_feature pic
+            soft_enable realtime_only
+            if [ ${tgt_isa} = "armv7" ]; then
+              soft_enable runtime_cpu_detect
+            fi
+            if enabled runtime_cpu_detect; then
+              add_cflags "-I${SDK_PATH}/sources/android/cpufeatures"
+            fi
+          else
+            echo "Assuming standalone build with NDK toolchain."
+            echo "See build/make/Android.mk for details."
+            check_add_ldflags -static
+            soft_enable unit_tests
           fi
           ;;
 
@@ -1392,6 +1395,7 @@ EOF
       *-win*-vs*)
         ;;
       *-android-gcc)
+        # bionic includes basic pthread functionality, obviating -lpthread.
         ;;
       *)
         check_header pthread.h && add_extralibs -lpthread
index 638e197509ff64bc8d02d8770674484c8016c784..3ca1c82f32093459e9c553a47172d53329d9473b 100755 (executable)
--- a/configure
+++ b/configure
@@ -97,6 +97,7 @@ EOF
 
 # all_platforms is a list of all supported target platforms. Maintain
 # alphabetically by architecture, generic-gnu last.
+all_platforms="${all_platforms} arm64-android-gcc"
 all_platforms="${all_platforms} arm64-darwin-gcc"
 all_platforms="${all_platforms} arm64-linux-gcc"
 all_platforms="${all_platforms} armv7-android-gcc"   #neon Cortex-A8
index 331a2a595dd980d3d51fab6daa9fbc57bcd387dc..8632f179be47e9e83a907aa4b77bf3655a30d572 100644 (file)
@@ -150,7 +150,7 @@ int main(int argc, char **argv) {
   int frame_count = 0;
   vpx_image_t raw;
   vpx_codec_err_t res;
-  VpxVideoInfo info = { 0 };
+  VpxVideoInfo info = { 0, 0, 0, { 0, 0 } };
   VpxVideoWriter *writer = NULL;
   const VpxInterface *encoder = NULL;
   const int fps = 30;
index 41295c9de3c58b1edad8bea05c3b6e89e92a8cab..fc7bdab3922865d490c803837389e1b9089c4047 100644 (file)
@@ -51,6 +51,7 @@
 
 #include "vpx/vp8cx.h"
 #include "vpx/vpx_encoder.h"
+#include "vp8/common/common.h"
 
 #include "../tools_common.h"
 #include "../video_writer.h"
@@ -93,18 +94,22 @@ static int encode_frame(vpx_codec_ctx_t *codec, vpx_image_t *img,
 
 int main(int argc, char **argv) {
   FILE *infile = NULL;
-  vpx_codec_ctx_t codec = { 0 };
-  vpx_codec_enc_cfg_t cfg = { 0 };
+  vpx_codec_ctx_t codec;
+  vpx_codec_enc_cfg_t cfg;
   int frame_count = 0;
   vpx_image_t raw;
   vpx_codec_err_t res;
-  VpxVideoInfo info = { 0 };
+  VpxVideoInfo info;
   VpxVideoWriter *writer = NULL;
   const VpxInterface *encoder = NULL;
   int update_frame_num = 0;
   const int fps = 30;       // TODO(dkovalev) add command line argument
   const int bitrate = 200;  // kbit/s TODO(dkovalev) add command line argument
 
+  vp8_zero(codec);
+  vp8_zero(cfg);
+  vp8_zero(info);
+
   exec_name = argv[0];
 
   if (argc != 6) die("Invalid number of arguments");
index 92fb60055045178b37c74c3b5aa165096287203f..5802186bff0f1c8077eeee8952729a4c0e84d034 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "vpx/vpx_encoder.h"
 #include "vpx/vp8cx.h"
+#include "vp9/common/vp9_common.h"
 
 #include "../tools_common.h"
 #include "../video_writer.h"
@@ -62,11 +63,13 @@ int main(int argc, char **argv) {
   int frame_count = 0;
   vpx_image_t raw;
   vpx_codec_err_t res;
-  VpxVideoInfo info = { 0 };
+  VpxVideoInfo info;
   VpxVideoWriter *writer = NULL;
   const VpxInterface *encoder = NULL;
   const int fps = 30;
 
+  vp9_zero(info);
+
   exec_name = argv[0];
 
   if (argc < 5) die("Invalid number of arguments");
index 8b8dcb48a5b4b834a688995000d3904fb59810df..e0bb795f7255487163c712f48f6f763701b57639 100644 (file)
@@ -53,6 +53,7 @@
 #include "vpx/vp8cx.h"
 #include "vpx/vpx_decoder.h"
 #include "vpx/vpx_encoder.h"
+#include "vp9/common/vp9_common.h"
 
 #include "./tools_common.h"
 #include "./video_writer.h"
@@ -190,8 +191,7 @@ static void find_mismatch(const vpx_image_t *const img1,
 }
 
 static void testing_decode(vpx_codec_ctx_t *encoder, vpx_codec_ctx_t *decoder,
-                           vpx_codec_enc_cfg_t *cfg, unsigned int frame_out,
-                           int *mismatch_seen) {
+                           unsigned int frame_out, int *mismatch_seen) {
   vpx_image_t enc_img, dec_img;
   struct vp9_ref_frame ref_enc, ref_dec;
 
@@ -225,11 +225,10 @@ static void testing_decode(vpx_codec_ctx_t *encoder, vpx_codec_ctx_t *decoder,
   vpx_img_free(&dec_img);
 }
 
-static int encode_frame(vpx_codec_ctx_t *ecodec, vpx_codec_enc_cfg_t *cfg,
-                        vpx_image_t *img, unsigned int frame_in,
-                        VpxVideoWriter *writer, int test_decode,
-                        vpx_codec_ctx_t *dcodec, unsigned int *frame_out,
-                        int *mismatch_seen) {
+static int encode_frame(vpx_codec_ctx_t *ecodec, vpx_image_t *img,
+                        unsigned int frame_in, VpxVideoWriter *writer,
+                        int test_decode, vpx_codec_ctx_t *dcodec,
+                        unsigned int *frame_out, int *mismatch_seen) {
   int got_pkts = 0;
   vpx_codec_iter_t iter = NULL;
   const vpx_codec_cx_pkt_t *pkt = NULL;
@@ -270,7 +269,7 @@ static int encode_frame(vpx_codec_ctx_t *ecodec, vpx_codec_enc_cfg_t *cfg,
 
   // Mismatch checking
   if (got_data && test_decode) {
-    testing_decode(ecodec, dcodec, cfg, *frame_out, mismatch_seen);
+    testing_decode(ecodec, dcodec, *frame_out, mismatch_seen);
   }
 
   return got_pkts;
@@ -279,12 +278,12 @@ static int encode_frame(vpx_codec_ctx_t *ecodec, vpx_codec_enc_cfg_t *cfg,
 int main(int argc, char **argv) {
   FILE *infile = NULL;
   // Encoder
-  vpx_codec_ctx_t ecodec = { 0 };
-  vpx_codec_enc_cfg_t cfg = { 0 };
+  vpx_codec_ctx_t ecodec;
+  vpx_codec_enc_cfg_t cfg;
   unsigned int frame_in = 0;
   vpx_image_t raw;
   vpx_codec_err_t res;
-  VpxVideoInfo info = { 0 };
+  VpxVideoInfo info;
   VpxVideoWriter *writer = NULL;
   const VpxInterface *encoder = NULL;
 
@@ -306,6 +305,11 @@ int main(int argc, char **argv) {
   const char *infile_arg = NULL;
   const char *outfile_arg = NULL;
   unsigned int limit = 0;
+
+  vp9_zero(ecodec);
+  vp9_zero(cfg);
+  vp9_zero(info);
+
   exec_name = argv[0];
 
   if (argc < 6) die("Invalid number of arguments");
@@ -397,7 +401,7 @@ int main(int argc, char **argv) {
       }
     }
 
-    encode_frame(&ecodec, &cfg, &raw, frame_in, writer, test_decode, &dcodec,
+    encode_frame(&ecodec, &raw, frame_in, writer, test_decode, &dcodec,
                  &frame_out, &mismatch_seen);
     frame_in++;
     if (mismatch_seen) break;
@@ -405,8 +409,8 @@ int main(int argc, char **argv) {
 
   // Flush encoder.
   if (!mismatch_seen)
-    while (encode_frame(&ecodec, &cfg, NULL, frame_in, writer, test_decode,
-                        &dcodec, &frame_out, &mismatch_seen)) {
+    while (encode_frame(&ecodec, NULL, frame_in, writer, test_decode, &dcodec,
+                        &frame_out, &mismatch_seen)) {
     }
 
   printf("\n");
index d4a2a6b5fe43326b14d3750298769f589f130752..f9308c2717a8800bf1f7142e45865a395cd3d09f 100644 (file)
@@ -31,7 +31,7 @@ class AltRefTest : public ::libvpx_test::EncoderTest,
     SetMode(libvpx_test::kTwoPassGood);
   }
 
-  virtual void BeginPassHook(unsigned int pass) { altref_count_ = 0; }
+  virtual void BeginPassHook(unsigned int /*pass*/) { altref_count_ = 0; }
 
   virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
                                   libvpx_test::Encoder *encoder) {
index 9c477fdbad56486468af6e5dbd449e66317d6b34..bebbb141d0b3a3366b25c930d7c75f3597b1b227 100644 (file)
@@ -158,13 +158,16 @@ class InvalidFileInvalidPeekTest : public InvalidFileTest {
 
 TEST_P(InvalidFileInvalidPeekTest, ReturnCode) { RunTest(); }
 
+#if CONFIG_VP8_DECODER
 const DecodeParam kVP8InvalidFileTests[] = {
   { 1, "invalid-vp80-00-comprehensive-018.ivf.2kf_0x6.ivf" },
 };
 
 VP8_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,
                           ::testing::ValuesIn(kVP8InvalidFileTests));
+#endif  // CONFIG_VP8_DECODER
 
+#if CONFIG_VP9_DECODER
 const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {
   { 1, "invalid-vp90-01-v3.webm" },
 };
@@ -172,7 +175,6 @@ const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {
 VP9_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,
                           ::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests));
 
-#if CONFIG_VP9_DECODER
 const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
   { 4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm" },
   { 4,
index b4db14e00a7a8143d66dc2c1896084248ca14ba0..670cd4d721f55d94aea5bcd0afa2e22bbd81d8f4 100644 (file)
@@ -46,7 +46,7 @@ string DecodeFileWithPause(const string &filename, int num_threads,
   int in_frames = 0;
   int out_frames = 0;
 
-  vpx_codec_dec_cfg_t cfg = { 0 };
+  vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
   cfg.threads = num_threads;
   vpx_codec_flags_t flags = 0;
   flags |= VPX_CODEC_USE_FRAME_THREADING;
index 7c1c63001b9a6229d397e7881116fe427619e277..af566c2c41a1639980c11461e5df794ff37eff31 100644 (file)
  */
 
 #include <arm_neon.h>
+#include <string.h>
+#include "./vpx_config.h"
 
 static const uint8_t bifilter4_coeff[8][2] = { { 128, 0 }, { 112, 16 },
                                                { 96, 32 }, { 80, 48 },
                                                { 64, 64 }, { 48, 80 },
                                                { 32, 96 }, { 16, 112 } };
 
+static INLINE uint8x8_t load_and_shift(const unsigned char *a) {
+  return vreinterpret_u8_u64(vshl_n_u64(vreinterpret_u64_u8(vld1_u8(a)), 32));
+}
+
+static INLINE void store4x4(unsigned char *dst, int dst_stride,
+                            const uint8x8_t a0, const uint8x8_t a1) {
+  if (!((uintptr_t)dst & 0x3) && !(dst_stride & 0x3)) {
+    vst1_lane_u32((uint32_t *)dst, vreinterpret_u32_u8(a0), 0);
+    dst += dst_stride;
+    vst1_lane_u32((uint32_t *)dst, vreinterpret_u32_u8(a0), 1);
+    dst += dst_stride;
+    vst1_lane_u32((uint32_t *)dst, vreinterpret_u32_u8(a1), 0);
+    dst += dst_stride;
+    vst1_lane_u32((uint32_t *)dst, vreinterpret_u32_u8(a1), 1);
+  } else {
+    // Store to the aligned local buffer and memcpy instead of vget_lane_u8
+    // which is really really slow.
+    uint32_t output_buffer[4];
+    vst1_lane_u32(output_buffer, vreinterpret_u32_u8(a0), 0);
+    vst1_lane_u32(output_buffer + 1, vreinterpret_u32_u8(a0), 1);
+    vst1_lane_u32(output_buffer + 2, vreinterpret_u32_u8(a1), 0);
+    vst1_lane_u32(output_buffer + 3, vreinterpret_u32_u8(a1), 1);
+
+    memcpy(dst, output_buffer, 4);
+    dst += dst_stride;
+    memcpy(dst, output_buffer + 1, 4);
+    dst += dst_stride;
+    memcpy(dst, output_buffer + 2, 4);
+    dst += dst_stride;
+    memcpy(dst, output_buffer + 3, 4);
+  }
+}
+
+void vp8_bilinear_predict4x4_neon(unsigned char *src_ptr,
+                                  int src_pixels_per_line, int xoffset,
+                                  int yoffset, unsigned char *dst_ptr,
+                                  int dst_pitch) {
+  uint8x8_t e0, e1, e2;
+
+  if (xoffset == 0) {  // skip_1stpass_filter
+    uint8x8_t a0, a1, a2, a3, a4;
+
+    a0 = load_and_shift(src_ptr);
+    src_ptr += src_pixels_per_line;
+    a1 = vld1_u8(src_ptr);
+    src_ptr += src_pixels_per_line;
+    a2 = load_and_shift(src_ptr);
+    src_ptr += src_pixels_per_line;
+    a3 = vld1_u8(src_ptr);
+    src_ptr += src_pixels_per_line;
+    a4 = vld1_u8(src_ptr);
+
+    e0 = vext_u8(a0, a1, 4);
+    e1 = vext_u8(a2, a3, 4);
+    e2 = a4;
+  } else {
+    uint8x8_t a0, a1, a2, a3, a4, b4;
+    uint8x16_t a01, a23;
+    uint8x16_t b01, b23;
+    uint32x2x2_t c0, c1, c2, c3;
+    uint16x8_t d0, d1, d2;
+    const uint8x8_t filter0 = vdup_n_u8(bifilter4_coeff[xoffset][0]);
+    const uint8x8_t filter1 = vdup_n_u8(bifilter4_coeff[xoffset][1]);
+
+    a0 = vld1_u8(src_ptr);
+    src_ptr += src_pixels_per_line;
+    a1 = vld1_u8(src_ptr);
+    src_ptr += src_pixels_per_line;
+    a2 = vld1_u8(src_ptr);
+    src_ptr += src_pixels_per_line;
+    a3 = vld1_u8(src_ptr);
+    src_ptr += src_pixels_per_line;
+    a4 = vld1_u8(src_ptr);
+
+    a01 = vcombine_u8(a0, a1);
+    a23 = vcombine_u8(a2, a3);
+
+    b01 = vreinterpretq_u8_u64(vshrq_n_u64(vreinterpretq_u64_u8(a01), 8));
+    b23 = vreinterpretq_u8_u64(vshrq_n_u64(vreinterpretq_u64_u8(a23), 8));
+    b4 = vreinterpret_u8_u64(vshr_n_u64(vreinterpret_u64_u8(a4), 8));
+
+    c0 = vzip_u32(vreinterpret_u32_u8(vget_low_u8(a01)),
+                  vreinterpret_u32_u8(vget_high_u8(a01)));
+    c1 = vzip_u32(vreinterpret_u32_u8(vget_low_u8(a23)),
+                  vreinterpret_u32_u8(vget_high_u8(a23)));
+    c2 = vzip_u32(vreinterpret_u32_u8(vget_low_u8(b01)),
+                  vreinterpret_u32_u8(vget_high_u8(b01)));
+    c3 = vzip_u32(vreinterpret_u32_u8(vget_low_u8(b23)),
+                  vreinterpret_u32_u8(vget_high_u8(b23)));
+
+    d0 = vmull_u8(vreinterpret_u8_u32(c0.val[0]), filter0);
+    d1 = vmull_u8(vreinterpret_u8_u32(c1.val[0]), filter0);
+    d2 = vmull_u8(a4, filter0);
+
+    d0 = vmlal_u8(d0, vreinterpret_u8_u32(c2.val[0]), filter1);
+    d1 = vmlal_u8(d1, vreinterpret_u8_u32(c3.val[0]), filter1);
+    d2 = vmlal_u8(d2, b4, filter1);
+
+    e0 = vqrshrn_n_u16(d0, 7);
+    e1 = vqrshrn_n_u16(d1, 7);
+    e2 = vqrshrn_n_u16(d2, 7);
+  }
+
+  // secondpass_filter
+  if (yoffset == 0) {  // skip_2ndpass_filter
+    store4x4(dst_ptr, dst_pitch, e0, e1);
+  } else {
+    uint8x8_t f0, f1;
+    const uint8x8_t filter0 = vdup_n_u8(bifilter4_coeff[yoffset][0]);
+    const uint8x8_t filter1 = vdup_n_u8(bifilter4_coeff[yoffset][1]);
+
+    uint16x8_t b0 = vmull_u8(e0, filter0);
+    uint16x8_t b1 = vmull_u8(e1, filter0);
+
+    const uint8x8_t a0 = vext_u8(e0, e1, 4);
+    const uint8x8_t a1 = vext_u8(e1, e2, 4);
+
+    b0 = vmlal_u8(b0, a0, filter1);
+    b1 = vmlal_u8(b1, a1, filter1);
+
+    f0 = vqrshrn_n_u16(b0, 7);
+    f1 = vqrshrn_n_u16(b1, 7);
+
+    store4x4(dst_ptr, dst_pitch, f0, f1);
+  }
+}
+
 void vp8_bilinear_predict8x4_neon(unsigned char *src_ptr,
                                   int src_pixels_per_line, int xoffset,
                                   int yoffset, unsigned char *dst_ptr,
index 8d2080eeb496f534ba10672ed1b2a2faa44a952b..239492a8cb801c39cdf88a8a9a16a84cd1fd1be1 100644 (file)
@@ -43,18 +43,10 @@ const vp8_prob vp8_sub_mv_ref_prob2[SUBMVREF_COUNT][VP8_SUBMVREFS - 1] = {
 };
 
 const vp8_mbsplit vp8_mbsplits[VP8_NUMMBSPLITS] = {
-  {
-      0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
-  },
-  {
-      0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
-  },
-  {
-      0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3,
-  },
-  {
-      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
-  }
+  { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 },
+  { 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 },
+  { 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3 },
+  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
 };
 
 const int vp8_mbsplit_count[VP8_NUMMBSPLITS] = { 2, 2, 4, 16 };
index 0f4bb06b45ed2e874f8d83b94a3c29eb849aec35..89abd41c0910b953cc953be8a0dc20d08cf875e4 100644 (file)
@@ -37,9 +37,9 @@ static int get_cpu_count() {
 
 #if HAVE_UNISTD_H && !defined(__OS2__)
 #if defined(_SC_NPROCESSORS_ONLN)
-  core_count = sysconf(_SC_NPROCESSORS_ONLN);
+  core_count = (int)sysconf(_SC_NPROCESSORS_ONLN);
 #elif defined(_SC_NPROC_ONLN)
-  core_count = sysconf(_SC_NPROC_ONLN);
+  core_count = (int)sysconf(_SC_NPROC_ONLN);
 #endif
 #elif defined(_WIN32)
   {
@@ -61,7 +61,7 @@ static int get_cpu_count() {
       GetSystemInfo(&sysinfo);
 #endif
 
-    core_count = sysinfo.dwNumberOfProcessors;
+    core_count = (int)sysinfo.dwNumberOfProcessors;
   }
 #elif defined(__OS2__)
   {
index defb5cb839aadcf2caefd56420f4a4bcbdfa513b..6d3de4f1a0c3910319bd6cf81e9e1be09426644e 100644 (file)
@@ -59,9 +59,7 @@ typedef enum {
   RECON_CLAMP_NOTREQUIRED = 1
 } CLAMP_TYPE;
 
-typedef struct VP8Common
-
-    {
+typedef struct VP8Common {
   struct vpx_internal_error_info error;
 
   DECLARE_ALIGNED(16, short, Y1dequant[QINDEX_RANGE][2]);
index c3d92652646b87dc0af89ca493fbe579deac335f..1c4e042c88f50d4fc671533b523935f55051135f 100644 (file)
@@ -83,6 +83,7 @@ extern void vp8_blit_line(int x0, int x1, int y0, int y1, unsigned char *image,
                           const int pitch);
 /***********************************************************************************************************
  */
+#if CONFIG_POSTPROC
 static int q2mbl(int x) {
   if (x < 20) x = 20;
 
@@ -90,7 +91,6 @@ static int q2mbl(int x) {
   return x * x / 3;
 }
 
-#if CONFIG_POSTPROC
 static void vp8_de_mblock(YV12_BUFFER_CONFIG *post, int q) {
   vpx_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height,
                             post->y_width, q2mbl(q));
@@ -154,7 +154,6 @@ void vp8_deblock(VP8_COMMON *cm, YV12_BUFFER_CONFIG *source,
     vp8_yv12_copy_frame(source, post);
   }
 }
-#endif
 
 void vp8_de_noise(VP8_COMMON *cm, YV12_BUFFER_CONFIG *source,
                   YV12_BUFFER_CONFIG *post, int q, int low_var_thresh, int flag,
@@ -189,6 +188,7 @@ void vp8_de_noise(VP8_COMMON *cm, YV12_BUFFER_CONFIG *source,
     }
   }
 }
+#endif  // CONFIG_POSTPROC
 
 /* Blend the macro block with a solid colored square.  Leave the
  * edges unblended to give distinction to macro blocks in areas
index b58f8e7afa0addfb13d75cbfafe34244d4e00e16..8dc36f7317808161ef47464bbf1fffe2380d45a2 100644 (file)
@@ -188,10 +188,8 @@ specialize qw/vp8_bilinear_predict8x8 mmx sse2 ssse3 neon msa/;
 add_proto qw/void vp8_bilinear_predict8x4/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
 specialize qw/vp8_bilinear_predict8x4 mmx neon msa/;
 
-# TODO(johannkoenig): Add neon implementation
-# https://bugs.chromium.org/p/webm/issues/detail?id=1273
 add_proto qw/void vp8_bilinear_predict4x4/, "unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch";
-specialize qw/vp8_bilinear_predict4x4 mmx msa/;
+specialize qw/vp8_bilinear_predict4x4 mmx neon msa/;
 
 #
 # Encoder functions below this point.
index 52f70107f39b80cc064d472373b85fc72600d777..44ca16bfdd4bdce9e6d9eb1eb0f3c6351c198931 100644 (file)
@@ -631,7 +631,8 @@ void vp8_decoder_create_threads(VP8D_COMP *pbi) {
     }
 
     pbi->allocated_decoding_thread_count = ithread;
-    if (pbi->allocated_decoding_thread_count != pbi->decoding_thread_count) {
+    if (pbi->allocated_decoding_thread_count !=
+        (int)pbi->decoding_thread_count) {
       /* the remainder of cleanup cases will be handled in
        * vp8_decoder_remove_threads(). */
       if (pbi->allocated_decoding_thread_count == 0) {
index 0d076893490d9648b77b3e209e9404668b93da27..e41d513c1b72eb1bc5e70153f4bec9eea2ee7d87 100644 (file)
@@ -788,14 +788,11 @@ void vp8_encode_frame(VP8_COMP *cpi) {
             xd->mode_info_stride * cpi->encoding_thread_count;
         x->partition_info += xd->mode_info_stride * cpi->encoding_thread_count;
         x->gf_active_ptr += cm->mb_cols * cpi->encoding_thread_count;
-
-        if (mb_row == cm->mb_rows - 1) {
-          sem_post(&cpi->h_event_end_encoding); /* signal frame encoding end */
-        }
       }
-
-      sem_wait(
-          &cpi->h_event_end_encoding); /* wait for other threads to finish */
+      /* Wait for all the threads to finish. */
+      for (i = 0; i < cpi->encoding_thread_count; ++i) {
+        sem_wait(&cpi->h_event_end_encoding[i]);
+      }
 
       for (mb_row = 0; mb_row < cm->mb_rows; ++mb_row) {
         cpi->tok_count += (unsigned int)(cpi->tplist[mb_row].stop -
index ba05776a33ae7b2a072f4ca3d1c933ec66e4ab47..708002b1e672436eb2f36649078d712ed9548210 100644 (file)
@@ -301,11 +301,9 @@ static THREAD_FUNCTION thread_encoding_proc(void *p_data) {
             xd->mode_info_stride * cpi->encoding_thread_count;
         x->partition_info += xd->mode_info_stride * cpi->encoding_thread_count;
         x->gf_active_ptr += cm->mb_cols * cpi->encoding_thread_count;
-
-        if (mb_row == cm->mb_rows - 1) {
-          sem_post(&cpi->h_event_end_encoding); /* signal frame encoding end */
-        }
       }
+      /* Signal that this thread has completed processing its rows. */
+      sem_post(&cpi->h_event_end_encoding[ithread]);
     }
   }
 
@@ -516,14 +514,14 @@ int vp8cx_create_encoder_threads(VP8_COMP *cpi) {
                     vpx_malloc(sizeof(pthread_t) * th_count));
     CHECK_MEM_ERROR(cpi->h_event_start_encoding,
                     vpx_malloc(sizeof(sem_t) * th_count));
+    CHECK_MEM_ERROR(cpi->h_event_end_encoding,
+                    vpx_malloc(sizeof(sem_t) * th_count));
     CHECK_MEM_ERROR(cpi->mb_row_ei,
                     vpx_memalign(32, sizeof(MB_ROW_COMP) * th_count));
     memset(cpi->mb_row_ei, 0, sizeof(MB_ROW_COMP) * th_count);
     CHECK_MEM_ERROR(cpi->en_thread_data,
                     vpx_malloc(sizeof(ENCODETHREAD_DATA) * th_count));
 
-    sem_init(&cpi->h_event_end_encoding, 0, 0);
-
     cpi->b_multi_threaded = 1;
     cpi->encoding_thread_count = th_count;
 
@@ -540,6 +538,7 @@ int vp8cx_create_encoder_threads(VP8_COMP *cpi) {
       vp8_setup_block_dptrs(&cpi->mb_row_ei[ithread].mb.e_mbd);
 
       sem_init(&cpi->h_event_start_encoding[ithread], 0, 0);
+      sem_init(&cpi->h_event_end_encoding[ithread], 0, 0);
 
       ethd->ithread = ithread;
       ethd->ptr1 = (void *)cpi;
@@ -556,11 +555,12 @@ int vp8cx_create_encoder_threads(VP8_COMP *cpi) {
       for (--ithread; ithread >= 0; ithread--) {
         pthread_join(cpi->h_encoding_thread[ithread], 0);
         sem_destroy(&cpi->h_event_start_encoding[ithread]);
+        sem_destroy(&cpi->h_event_end_encoding[ithread]);
       }
-      sem_destroy(&cpi->h_event_end_encoding);
 
       /* free thread related resources */
       vpx_free(cpi->h_event_start_encoding);
+      vpx_free(cpi->h_event_end_encoding);
       vpx_free(cpi->h_encoding_thread);
       vpx_free(cpi->mb_row_ei);
       vpx_free(cpi->en_thread_data);
@@ -582,15 +582,17 @@ int vp8cx_create_encoder_threads(VP8_COMP *cpi) {
         cpi->b_multi_threaded = 0;
         for (--ithread; ithread >= 0; ithread--) {
           sem_post(&cpi->h_event_start_encoding[ithread]);
+          sem_post(&cpi->h_event_end_encoding[ithread]);
           pthread_join(cpi->h_encoding_thread[ithread], 0);
           sem_destroy(&cpi->h_event_start_encoding[ithread]);
+          sem_destroy(&cpi->h_event_end_encoding[ithread]);
         }
-        sem_destroy(&cpi->h_event_end_encoding);
         sem_destroy(&cpi->h_event_end_lpf);
         sem_destroy(&cpi->h_event_start_lpf);
 
         /* free thread related resources */
         vpx_free(cpi->h_event_start_encoding);
+        vpx_free(cpi->h_event_end_encoding);
         vpx_free(cpi->h_encoding_thread);
         vpx_free(cpi->mb_row_ei);
         vpx_free(cpi->en_thread_data);
@@ -611,21 +613,24 @@ void vp8cx_remove_encoder_threads(VP8_COMP *cpi) {
 
       for (i = 0; i < cpi->encoding_thread_count; ++i) {
         sem_post(&cpi->h_event_start_encoding[i]);
+        sem_post(&cpi->h_event_end_encoding[i]);
+
         pthread_join(cpi->h_encoding_thread[i], 0);
 
         sem_destroy(&cpi->h_event_start_encoding[i]);
+        sem_destroy(&cpi->h_event_end_encoding[i]);
       }
 
       sem_post(&cpi->h_event_start_lpf);
       pthread_join(cpi->h_filter_thread, 0);
     }
 
-    sem_destroy(&cpi->h_event_end_encoding);
     sem_destroy(&cpi->h_event_end_lpf);
     sem_destroy(&cpi->h_event_start_lpf);
 
     /* free thread related resources */
     vpx_free(cpi->h_event_start_encoding);
+    vpx_free(cpi->h_event_end_encoding);
     vpx_free(cpi->h_encoding_thread);
     vpx_free(cpi->mb_row_ei);
     vpx_free(cpi->en_thread_data);
index 6df8f81c427a500283551195ef0ecc8689cdd045..32080eff72d4b380d270ab1d950a4e599aecdaae 100644 (file)
@@ -518,7 +518,7 @@ typedef struct VP8_COMP {
 
   /* events */
   sem_t *h_event_start_encoding;
-  sem_t h_event_end_encoding;
+  sem_t *h_event_end_encoding;
   sem_t h_event_start_lpf;
   sem_t h_event_end_lpf;
 #endif
index b6e8dbfa5b7cc4faedcb65e200be799136d18b8f..7948657fc7492e7e91e40296280ce26ba0cc2d4a 100644 (file)
@@ -35,7 +35,7 @@
 extern unsigned int cnt_pm;
 #endif
 
-#define MODEL_MODE 0
+#define MODEL_MODE 1
 
 extern const int vp8_ref_frame_order[MAX_MODES];
 extern const MB_PREDICTION_MODE vp8_mode_order[MAX_MODES];
index a0c4067c184c05b7fe07e902e384f3e32554d710..0ec6902e7047f66920ef55d0918c14c74db62a87 100644 (file)
@@ -743,7 +743,7 @@ static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
 }
 
 static vpx_codec_err_t set_reference_and_update(vpx_codec_alg_priv_t *ctx,
-                                                int flags) {
+                                                vpx_enc_frame_flags_t flags) {
   /* Handle Flags */
   if (((flags & VP8_EFLAG_NO_UPD_GF) && (flags & VP8_EFLAG_FORCE_GF)) ||
       ((flags & VP8_EFLAG_NO_UPD_ARF) && (flags & VP8_EFLAG_FORCE_ARF))) {
index 93726f0ee735e613e2dc34e9bd924868bd908cfb..55103627e8fab5fd55eae491762c33fda2982c04 100644 (file)
@@ -1985,10 +1985,9 @@ void vp9_remove_compressor(VP9_COMP *cpi) {
           SNPRINT2(results, "\t%7.3f", cpi->worst_consistency);
         }
 
-        SNPRINT(headings, "\tTime\tRcErr\tAbsErr");
-        SNPRINT2(results, "\t%7.3f", total_encode_time);
-        SNPRINT2(results, "\t%7.3f", rate_err);
-        SNPRINT2(results, "\t%7.3f", fabs(rate_err));
+        fprintf(f, "%s\t    Time\tRcErr\tAbsErr\n", headings);
+        fprintf(f, "%s\t%8.0f\t%7.2f\t%7.2f\n", results, total_encode_time,
+                rate_err, fabs(rate_err));
       }
 
       fclose(f);
index c14acd59a57dc4cdc79253423b6853bec34b23df..0728b77d71073de1224dc22c48623979b83f5fc0 100644 (file)
@@ -45,8 +45,6 @@
 
 #define FRAME_OVERHEAD_BITS 200
 
-#define LIMIT_QP_ONEPASS_VBR_LAG 0
-
 #if CONFIG_VP9_HIGHBITDEPTH
 #define ASSIGN_MINQ_TABLE(bit_depth, name)                   \
   do {                                                       \
@@ -945,14 +943,6 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi,
   active_worst_quality =
       clamp(active_worst_quality, active_best_quality, rc->worst_quality);
 
-#if LIMIT_QP_ONEPASS_VBR_LAG
-  if (oxcf->lag_in_frames > 0 && oxcf->rc_mode == VPX_VBR) {
-    if (rc->force_qpmin > 0 && active_best_quality < rc->force_qpmin)
-      active_best_quality =
-          clamp(active_best_quality, rc->force_qpmin, rc->worst_quality);
-  }
-#endif
-
   *top_index = active_worst_quality;
   *bottom_index = active_best_quality;
 
@@ -2145,13 +2135,6 @@ void adjust_gf_boost_lag_one_pass_vbr(VP9_COMP *cpi, uint64_t avg_sad_current) {
     }
     target = calc_pframe_target_size_one_pass_vbr(cpi);
     vp9_rc_set_frame_target(cpi, target);
-#if LIMIT_QP_ONEPASS_VBR_LAG
-    if (rc->avg_frame_low_motion > 85 &&
-        avg_source_sad_lag < (sad_thresh1 >> 1))
-      rc->force_qpmin = 48;
-    else
-      rc->force_qpmin = 0;
-#endif
   }
   rc->prev_avg_source_sad_lag = avg_source_sad_lag;
 }
index 350518323541cf099084241b73c66fb08572cfbb..9fea2d1cf29efbbbfd357b70e2a91a7552034802 100644 (file)
@@ -695,7 +695,7 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
   specialize qw/vpx_highbd_idct32x32_34_add/;
 
   add_proto qw/void vpx_highbd_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
-  specialize qw/vpx_highbd_idct32x32_1_add/;
+  specialize qw/vpx_highbd_idct32x32_1_add sse2/;
 
   add_proto qw/void vpx_highbd_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
   specialize qw/vpx_highbd_iwht4x4_1_add/;
index a6fc1161f120b99db58b6331ff2660bd9d5d02cb..330ae8d6a38933773d4d03ba3aef161990c64579 100644 (file)
@@ -4020,4 +4020,32 @@ void vpx_highbd_idct16x16_10_add_sse2(const tran_low_t *input, uint8_t *dest8,
     }
   }
 }
+
+void vpx_highbd_idct32x32_1_add_sse2(const tran_low_t *input, uint8_t *dest8,
+                                     int stride, int bd) {
+  __m128i dc_value, d;
+  const __m128i zero = _mm_setzero_si128();
+  const __m128i one = _mm_set1_epi16(1);
+  const __m128i max = _mm_subs_epi16(_mm_slli_epi16(one, bd), one);
+  int a, i, j;
+  uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
+  tran_low_t out;
+
+  out = highbd_dct_const_round_shift(input[0] * cospi_16_64);
+  out = highbd_dct_const_round_shift(out * cospi_16_64);
+  a = ROUND_POWER_OF_TWO(out, 6);
+
+  d = _mm_set1_epi32(a);
+  dc_value = _mm_packs_epi32(d, d);
+  for (i = 0; i < 32; ++i) {
+    for (j = 0; j < 4; ++j) {
+      d = _mm_loadu_si128((const __m128i *)(&dest[j * 8]));
+      d = _mm_adds_epi16(d, dc_value);
+      d = _mm_max_epi16(d, zero);
+      d = _mm_min_epi16(d, max);
+      _mm_storeu_si128((__m128i *)(&dest[j * 8]), d);
+    }
+    dest += stride;
+  }
+}
 #endif  // CONFIG_VP9_HIGHBITDEPTH
index 138a5402e94bb478b5268941744e87f44ed4ca47..c94ed52d16d11862d493fef5b18f3c2aa5320c07 100644 (file)
@@ -33,21 +33,21 @@ static int check_size_argument_overflow(uint64_t nmemb, uint64_t size) {
   return 1;
 }
 
-static INLINE size_t *get_malloc_address_location(void *const mem) {
+static size_t *get_malloc_address_location(void *const mem) {
   return ((size_t *)mem) - 1;
 }
 
-static INLINE uint64_t get_aligned_malloc_size(size_t size, size_t align) {
+static uint64_t get_aligned_malloc_size(size_t size, size_t align) {
   return (uint64_t)size + align - 1 + ADDRESS_STORAGE_SIZE;
 }
 
-static INLINE void set_actual_malloc_address(void *const mem,
-                                             const void *const malloc_addr) {
+static void set_actual_malloc_address(void *const mem,
+                                      const void *const malloc_addr) {
   size_t *const malloc_addr_location = get_malloc_address_location(mem);
   *malloc_addr_location = (size_t)malloc_addr;
 }
 
-static INLINE void *get_actual_malloc_address(void *const mem) {
+static void *get_actual_malloc_address(void *const mem) {
   size_t *const malloc_addr_location = get_malloc_address_location(mem);
   return (void *)(*malloc_addr_location);
 }
index 84a1bf3402ecae60136b3db79790b4dc533a3543..c1ff5a3f828f92c2036d980296d785b5deeb6270 100644 (file)
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -538,7 +538,7 @@ static int main_loop(int argc, const char **argv_) {
   unsigned int output_bit_depth = 0;
 #endif
 #if CONFIG_VP8_DECODER
-  vp8_postproc_cfg_t vp8_pp_cfg = { 0 };
+  vp8_postproc_cfg_t vp8_pp_cfg = { 0, 0, 0 };
   int vp8_dbg_color_ref_frame = 0;
   int vp8_dbg_color_mb_modes = 0;
   int vp8_dbg_color_b_modes = 0;
index baae872301826c94f7eed09f4a9c52f20d482ed6..c7b4f08ff4f80e25fc73c71ab888afb5cfada902 100644 (file)
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -1432,9 +1432,8 @@ static void open_output_file(struct stream_state *stream,
 #if CONFIG_WEBM_IO
   if (stream->config.write_webm) {
     stream->webm_ctx.stream = stream->file;
-    write_webm_file_header(&stream->webm_ctx, cfg, &global->framerate,
-                           stream->config.stereo_fmt, global->codec->fourcc,
-                           pixel_aspect_ratio);
+    write_webm_file_header(&stream->webm_ctx, cfg, stream->config.stereo_fmt,
+                           global->codec->fourcc, pixel_aspect_ratio);
   }
 #else
   (void)pixel_aspect_ratio;
index 52516a6aedca9af1e25957ee7a4ca00f561d3419..66606674b001d383a00aaad2b3687514e8557207 100644 (file)
@@ -22,7 +22,6 @@ const int kVideoTrackNumber = 1;
 
 void write_webm_file_header(struct WebmOutputContext *webm_ctx,
                             const vpx_codec_enc_cfg_t *cfg,
-                            const struct vpx_rational *fps,
                             stereo_format_t stereo_fmt, unsigned int fourcc,
                             const struct VpxRational *par) {
   mkvmuxer::MkvWriter *const writer = new mkvmuxer::MkvWriter(webm_ctx->stream);
index 1ae7786cd773ca9cce942fc1a69635e1fce85607..b4a9e357bb83f4c52f03b372daa9f0923e5c95b9 100644 (file)
--- a/webmenc.h
+++ b/webmenc.h
@@ -39,7 +39,6 @@ typedef enum stereo_format {
 
 void write_webm_file_header(struct WebmOutputContext *webm_ctx,
                             const vpx_codec_enc_cfg_t *cfg,
-                            const struct vpx_rational *fps,
                             stereo_format_t stereo_fmt, unsigned int fourcc,
                             const struct VpxRational *par);