]> granicus.if.org Git - libvpx/commitdiff
Merge "VP9: pass TileWorkerData instead of MACROBLOCKD and vpx_reader."
authorScott LaVarnway <slavarnway@google.com>
Fri, 23 Sep 2016 11:59:15 +0000 (11:59 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Fri, 23 Sep 2016 11:59:16 +0000 (11:59 +0000)
41 files changed:
configure
examples/decode_with_drops.c
examples/set_maps.c
examples/simple_encoder.c
examples/twopass_encoder.c
examples/vp8cx_set_ref.c
examples/vp9_lossless_encoder.c
examples/vp9cx_set_ref.c
examples/vpx_temporal_svc_encoder.c
test/predict_test.cc [new file with mode: 0644]
test/sixtap_predict_test.cc [deleted file]
test/test.mk
vp8/common/filter.c
vp8/common/onyx.h
vp8/common/onyxc_int.h
vp8/common/postproc.c
vp8/common/textblit.c [deleted file]
vp8/common/x86/subpixel_sse2.asm
vp8/common/x86/subpixel_ssse3.asm
vp8/encoder/bitstream.c
vp8/encoder/onyx_if.c
vp8/encoder/onyx_int.h
vp8/encoder/pickinter.c
vp8/vp8_common.mk
vp8/vp8_cx_iface.c
vp8/vp8_dx_iface.c
vp9/common/vp9_idct.c
vp9/common/vp9_postproc.c
vp9/common/vp9_rtcd_defs.pl
vp9/common/vp9_textblit.c [deleted file]
vp9/common/vp9_textblit.h [deleted file]
vp9/decoder/vp9_decodemv.c
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_encodemv.c
vp9/vp9_common.mk
vp9/vp9_dx_iface.c
vpx/vp8.h
vpx_dsp/arm/variance_neon.c
vpx_dsp/x86/inv_txfm_sse2.c
vpx_dsp/x86/variance_avx2.c
vpxdec.c

index 3ca1c82f32093459e9c553a47172d53329d9473b..95af2e395e37c7d2a890e965087e0d052f391ea1 100755 (executable)
--- a/configure
+++ b/configure
@@ -578,14 +578,6 @@ process_toolchain() {
         # check_add_cflags also adds to cxxflags. gtest does not do well with
         # -Wundef so add it explicitly to CFLAGS only.
         check_cflags -Wundef && add_cflags_only -Wundef
-        case ${CC} in
-          *clang*)
-              # libvpx and/or clang have issues with aliasing:
-              # https://code.google.com/p/webm/issues/detail?id=603
-              # work around them until they are fixed
-              check_add_cflags -fno-strict-aliasing
-          ;;
-        esac
         if enabled mips || [ -z "${INLINE}" ]; then
           enabled extra_warnings || check_add_cflags -Wno-unused-function
         fi
index 29b8be94131cd59fb8ab9729e9d9f5d6154ead8c..e69e2a9f9b3a119d75489285d5a2f0b937e36536 100644 (file)
@@ -92,8 +92,8 @@ int main(int argc, char **argv) {
   if (!(outfile = fopen(argv[2], "wb")))
     die("Failed to open %s for writing.", argv[2]);
 
-  n = strtol(argv[3], &nptr, 0);
-  m = strtol(nptr + 1, NULL, 0);
+  n = (int)strtol(argv[3], &nptr, 0);
+  m = (int)strtol(nptr + 1, NULL, 0);
   is_range = (*nptr == '-');
   if (!n || !m || (*nptr != '-' && *nptr != '/'))
     die("Couldn't parse pattern %s.\n", argv[3]);
index d128e7d9a0d7822ef25be53510e8856a476db177..c0c7d10e72a72cf632191bf87ef02d7077dbaf15 100644 (file)
@@ -174,8 +174,8 @@ int main(int argc, char **argv) {
   }
   assert(encoder != NULL);
   info.codec_fourcc = encoder->fourcc;
-  info.frame_width = strtol(argv[2], NULL, 0);
-  info.frame_height = strtol(argv[3], NULL, 0);
+  info.frame_width = (int)strtol(argv[2], NULL, 0);
+  info.frame_height = (int)strtol(argv[3], NULL, 0);
   info.time_base.numerator = 1;
   info.time_base.denominator = fps;
 
index 8632f179be47e9e83a907aa4b77bf3655a30d572..dde6344f8d632487b1212f23e44f98d460b0f956 100644 (file)
@@ -175,14 +175,14 @@ int main(int argc, char **argv) {
   infile_arg = argv[4];
   outfile_arg = argv[5];
   keyframe_interval_arg = argv[6];
-  max_frames = strtol(argv[8], NULL, 0);
+  max_frames = (int)strtol(argv[8], NULL, 0);
 
   encoder = get_vpx_encoder_by_name(codec_arg);
   if (!encoder) die("Unsupported codec.");
 
   info.codec_fourcc = encoder->fourcc;
-  info.frame_width = strtol(width_arg, NULL, 0);
-  info.frame_height = strtol(height_arg, NULL, 0);
+  info.frame_width = (int)strtol(width_arg, NULL, 0);
+  info.frame_height = (int)strtol(height_arg, NULL, 0);
   info.time_base.numerator = 1;
   info.time_base.denominator = fps;
 
@@ -196,7 +196,7 @@ int main(int argc, char **argv) {
     die("Failed to allocate image.");
   }
 
-  keyframe_interval = strtol(keyframe_interval_arg, NULL, 0);
+  keyframe_interval = (int)strtol(keyframe_interval_arg, NULL, 0);
   if (keyframe_interval < 0) die("Invalid keyframe interval value.");
 
   printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
@@ -209,7 +209,7 @@ int main(int argc, char **argv) {
   cfg.g_timebase.num = info.time_base.numerator;
   cfg.g_timebase.den = info.time_base.denominator;
   cfg.rc_target_bitrate = bitrate;
-  cfg.g_error_resilient = strtol(argv[7], NULL, 0);
+  cfg.g_error_resilient = (vpx_codec_er_flags_t)strtoul(argv[7], NULL, 0);
 
   writer = vpx_video_writer_open(outfile_arg, kContainerIVF, &info);
   if (!writer) die("Failed to open %s for writing.", outfile_arg);
index 4c130ec18c3aef24d51ec5c6442338a8fa2fc8eb..4e63a7a6c9742913d6e519a96e3c05227e515fe8 100644 (file)
@@ -209,13 +209,13 @@ int main(int argc, char **argv) {
 
   if (argc != 7) die("Invalid number of arguments.");
 
-  max_frames = strtol(argv[6], NULL, 0);
+  max_frames = (int)strtol(argv[6], NULL, 0);
 
   encoder = get_vpx_encoder_by_name(codec_arg);
   if (!encoder) die("Unsupported codec.");
 
-  w = strtol(width_arg, NULL, 0);
-  h = strtol(height_arg, NULL, 0);
+  w = (int)strtol(width_arg, NULL, 0);
+  h = (int)strtol(height_arg, NULL, 0);
 
   if (w <= 0 || h <= 0 || (w % 2) != 0 || (h % 2) != 0)
     die("Invalid frame size: %dx%d", w, h);
index fc7bdab3922865d490c803837389e1b9089c4047..846477c61ef2a3c9dcac523fc71b17f7e37257f7 100644 (file)
@@ -122,8 +122,8 @@ int main(int argc, char **argv) {
   if (!update_frame_num) die("Couldn't parse frame number '%s'\n", argv[5]);
 
   info.codec_fourcc = encoder->fourcc;
-  info.frame_width = strtol(argv[1], NULL, 0);
-  info.frame_height = strtol(argv[2], NULL, 0);
+  info.frame_width = (int)strtol(argv[1], NULL, 0);
+  info.frame_height = (int)strtol(argv[2], NULL, 0);
   info.time_base.numerator = 1;
   info.time_base.denominator = fps;
 
index 5802186bff0f1c8077eeee8952729a4c0e84d034..cb5ca6bfe0b76343726ed119a9bfc01102227829 100644 (file)
@@ -78,8 +78,8 @@ int main(int argc, char **argv) {
   if (!encoder) die("Unsupported codec.");
 
   info.codec_fourcc = encoder->fourcc;
-  info.frame_width = strtol(argv[1], NULL, 0);
-  info.frame_height = strtol(argv[2], NULL, 0);
+  info.frame_width = (int)strtol(argv[1], NULL, 0);
+  info.frame_height = (int)strtol(argv[2], NULL, 0);
   info.time_base.numerator = 1;
   info.time_base.denominator = fps;
 
index e0bb795f7255487163c712f48f6f763701b57639..798d7e3f2b9dff2a66af734fde4939aeac0cad23 100644 (file)
@@ -335,8 +335,8 @@ int main(int argc, char **argv) {
   }
 
   info.codec_fourcc = encoder->fourcc;
-  info.frame_width = strtol(width_arg, NULL, 0);
-  info.frame_height = strtol(height_arg, NULL, 0);
+  info.frame_width = (int)strtol(width_arg, NULL, 0);
+  info.frame_height = (int)strtol(height_arg, NULL, 0);
   info.time_base.numerator = 1;
   info.time_base.denominator = fps;
 
index 4a33877874a4634f193df87b1e3d17669c3b555f..309a2fe2e2b23b9b3fa406f1ec0207f853bec6ea 100644 (file)
@@ -547,13 +547,13 @@ int main(int argc, char **argv) {
 
   printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
 
-  width = strtol(argv[4], NULL, 0);
-  height = strtol(argv[5], NULL, 0);
+  width = (unsigned int)strtoul(argv[4], NULL, 0);
+  height = (unsigned int)strtoul(argv[5], NULL, 0);
   if (width < 16 || width % 2 || height < 16 || height % 2) {
     die("Invalid resolution: %d x %d", width, height);
   }
 
-  layering_mode = strtol(argv[10], NULL, 0);
+  layering_mode = (int)strtol(argv[10], NULL, 0);
   if (layering_mode < 0 || layering_mode > 13) {
     die("Invalid layering mode (0..12) %s", argv[10]);
   }
@@ -609,17 +609,17 @@ int main(int argc, char **argv) {
 #endif  // CONFIG_VP9_HIGHBITDEPTH
 
   // Timebase format e.g. 30fps: numerator=1, demoninator = 30.
-  cfg.g_timebase.num = strtol(argv[6], NULL, 0);
-  cfg.g_timebase.den = strtol(argv[7], NULL, 0);
+  cfg.g_timebase.num = (int)strtol(argv[6], NULL, 0);
+  cfg.g_timebase.den = (int)strtol(argv[7], NULL, 0);
 
-  speed = strtol(argv[8], NULL, 0);
+  speed = (int)strtol(argv[8], NULL, 0);
   if (speed < 0) {
     die("Invalid speed setting: must be positive");
   }
 
   for (i = min_args_base;
        (int)i < min_args_base + mode_to_num_layers[layering_mode]; ++i) {
-    rc.layer_target_bitrate[i - 11] = strtol(argv[i], NULL, 0);
+    rc.layer_target_bitrate[i - 11] = (int)strtol(argv[i], NULL, 0);
     if (strncmp(encoder->name, "vp8", 3) == 0)
       cfg.ts_target_bitrate[i - 11] = rc.layer_target_bitrate[i - 11];
     else if (strncmp(encoder->name, "vp9", 3) == 0)
@@ -627,7 +627,7 @@ int main(int argc, char **argv) {
   }
 
   // Real time parameters.
-  cfg.rc_dropframe_thresh = strtol(argv[9], NULL, 0);
+  cfg.rc_dropframe_thresh = (unsigned int)strtoul(argv[9], NULL, 0);
   cfg.rc_end_usage = VPX_CBR;
   cfg.rc_min_quantizer = 2;
   cfg.rc_max_quantizer = 56;
diff --git a/test/predict_test.cc b/test/predict_test.cc
new file mode 100644 (file)
index 0000000..07841a1
--- /dev/null
@@ -0,0 +1,380 @@
+/*
+ *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "third_party/googletest/src/include/gtest/gtest.h"
+
+#include "./vp8_rtcd.h"
+#include "./vpx_config.h"
+#include "test/acm_random.h"
+#include "test/clear_system_state.h"
+#include "test/register_state_check.h"
+#include "test/util.h"
+#include "vpx/vpx_integer.h"
+#include "vpx_mem/vpx_mem.h"
+
+namespace {
+
+using libvpx_test::ACMRandom;
+using std::tr1::make_tuple;
+
+typedef void (*PredictFunc)(uint8_t *src_ptr, int src_pixels_per_line,
+                            int xoffset, int yoffset, uint8_t *dst_ptr,
+                            int dst_pitch);
+
+typedef std::tr1::tuple<int, int, PredictFunc> PredictParam;
+
+class PredictTestBase : public ::testing::TestWithParam<PredictParam> {
+ public:
+  PredictTestBase()
+      : width_(GET_PARAM(0)), height_(GET_PARAM(1)), predict_(GET_PARAM(2)),
+        src_(NULL), padded_dst_(NULL), dst_(NULL), dst_c_(NULL) {}
+
+  virtual void SetUp() {
+    src_ = new uint8_t[kSrcSize];
+    ASSERT_TRUE(src_ != NULL);
+
+    // padded_dst_ provides a buffer of kBorderSize around the destination
+    // memory to facilitate detecting out of bounds writes.
+    dst_stride_ = kBorderSize + width_ + kBorderSize;
+    padded_dst_size_ = dst_stride_ * (kBorderSize + height_ + kBorderSize);
+    padded_dst_ =
+        reinterpret_cast<uint8_t *>(vpx_memalign(16, padded_dst_size_));
+    ASSERT_TRUE(padded_dst_ != NULL);
+    dst_ = padded_dst_ + (kBorderSize * dst_stride_) + kBorderSize;
+
+    dst_c_ = new uint8_t[16 * 16];
+    ASSERT_TRUE(dst_c_ != NULL);
+
+    memset(src_, 0, kSrcSize);
+    memset(padded_dst_, 128, padded_dst_size_);
+    memset(dst_c_, 0, 16 * 16);
+  }
+
+  virtual void TearDown() {
+    delete[] src_;
+    src_ = NULL;
+    vpx_free(padded_dst_);
+    padded_dst_ = NULL;
+    dst_ = NULL;
+    delete[] dst_c_;
+    dst_c_ = NULL;
+    libvpx_test::ClearSystemState();
+  }
+
+ protected:
+  // Make reference arrays big enough for 16x16 functions. Six-tap filters need
+  // 5 extra pixels outside of the macroblock.
+  static const int kSrcStride = 21;
+  static const int kSrcSize = kSrcStride * kSrcStride;
+  static const int kBorderSize = 16;
+
+  int width_;
+  int height_;
+  PredictFunc predict_;
+  uint8_t *src_;
+  uint8_t *padded_dst_;
+  uint8_t *dst_;
+  int padded_dst_size_;
+  uint8_t *dst_c_;
+  int dst_stride_;
+
+  bool CompareBuffers(const uint8_t *a, int a_stride, const uint8_t *b,
+                      int b_stride) const {
+    for (int height = 0; height < height_; ++height) {
+      EXPECT_EQ(0, memcmp(a + height * a_stride, b + height * b_stride,
+                          sizeof(*a) * width_))
+          << "Row " << height << " does not match.";
+    }
+
+    return !HasFailure();
+  }
+
+  // Given a block of memory 'a' with size 'a_size', determine if all regions
+  // excepting block 'b' described by 'b_stride', 'b_height', and 'b_width'
+  // match pixel value 'c'.
+  bool CheckBorder(const uint8_t *a, int a_size, const uint8_t *b, int b_width,
+                   int b_height, int b_stride, uint8_t c) const {
+    const uint8_t *a_end = a + a_size;
+    const int b_size = (b_stride * b_height) + b_width;
+    const uint8_t *b_end = b + b_size;
+    const int left_border = (b_stride - b_width) / 2;
+    const int right_border = left_border + ((b_stride - b_width) % 2);
+
+    EXPECT_GE(b - left_border, a) << "'b' does not start within 'a'";
+    EXPECT_LE(b_end + right_border, a_end) << "'b' does not end within 'a'";
+
+    // Top border.
+    for (int pixel = 0; pixel < b - a - left_border; ++pixel) {
+      EXPECT_EQ(c, a[pixel]) << "Mismatch at " << pixel << " in top border.";
+    }
+
+    // Left border.
+    for (int height = 0; height < b_height; ++height) {
+      for (int width = left_border; width > 0; --width) {
+        EXPECT_EQ(c, b[height * b_stride - width])
+            << "Mismatch at row " << height << " column " << left_border - width
+            << " in left border.";
+      }
+    }
+
+    // Right border.
+    for (int height = 0; height < b_height; ++height) {
+      for (int width = b_width; width < b_width + right_border; ++width) {
+        EXPECT_EQ(c, b[height * b_stride + width])
+            << "Mismatch at row " << height << " column " << width - b_width
+            << " in right border.";
+      }
+    }
+
+    // Bottom border.
+    for (int pixel = static_cast<int>(b - a + b_size); pixel < a_size;
+         ++pixel) {
+      EXPECT_EQ(c, a[pixel]) << "Mismatch at " << pixel << " in bottom border.";
+    }
+
+    return !HasFailure();
+  }
+
+  void TestWithRandomData(PredictFunc reference) {
+    ACMRandom rnd(ACMRandom::DeterministicSeed());
+
+    // Run tests for almost all possible offsets.
+    for (int xoffset = 0; xoffset < 8; ++xoffset) {
+      for (int yoffset = 0; yoffset < 8; ++yoffset) {
+        if (xoffset == 0 && yoffset == 0) {
+          // This represents a copy which is not required to be handled by this
+          // module.
+          continue;
+        }
+
+        for (int i = 0; i < kSrcSize; ++i) {
+          src_[i] = rnd.Rand8();
+        }
+        reference(&src_[kSrcStride * 2 + 2], kSrcStride, xoffset, yoffset,
+                  dst_c_, 16);
+
+        ASM_REGISTER_STATE_CHECK(predict_(&src_[kSrcStride * 2 + 2], kSrcStride,
+                                          xoffset, yoffset, dst_, dst_stride_));
+
+        ASSERT_TRUE(CompareBuffers(dst_c_, 16, dst_, dst_stride_));
+        ASSERT_TRUE(CheckBorder(padded_dst_, padded_dst_size_, dst_, width_,
+                                height_, dst_stride_, 128));
+      }
+    }
+  }
+
+  void TestWithUnalignedDst(PredictFunc reference) {
+    ACMRandom rnd(ACMRandom::DeterministicSeed());
+
+    // Only the 4x4 need to be able to handle unaligned writes.
+    if (width_ == 4 && height_ == 4) {
+      for (int xoffset = 0; xoffset < 8; ++xoffset) {
+        for (int yoffset = 0; yoffset < 8; ++yoffset) {
+          if (xoffset == 0 && yoffset == 0) {
+            continue;
+          }
+          for (int i = 0; i < kSrcSize; ++i) {
+            src_[i] = rnd.Rand8();
+          }
+          reference(&src_[kSrcStride * 2 + 2], kSrcStride, xoffset, yoffset,
+                    dst_c_, 16);
+
+          for (int i = 1; i < 4; ++i) {
+            memset(padded_dst_, 128, padded_dst_size_);
+
+            ASM_REGISTER_STATE_CHECK(predict_(&src_[kSrcStride * 2 + 2],
+                                              kSrcStride, xoffset, yoffset,
+                                              dst_ + i, dst_stride_ + i));
+
+            ASSERT_TRUE(CompareBuffers(dst_c_, 16, dst_ + i, dst_stride_ + i));
+            ASSERT_TRUE(CheckBorder(padded_dst_, padded_dst_size_, dst_ + i,
+                                    width_, height_, dst_stride_ + i, 128));
+          }
+        }
+      }
+    }
+  }
+};
+
+class SixtapPredictTest : public PredictTestBase {};
+
+TEST_P(SixtapPredictTest, TestWithRandomData) {
+  TestWithRandomData(vp8_sixtap_predict16x16_c);
+}
+TEST_P(SixtapPredictTest, TestWithUnalignedDst) {
+  TestWithUnalignedDst(vp8_sixtap_predict16x16_c);
+}
+
+TEST_P(SixtapPredictTest, TestWithPresetData) {
+  // Test input
+  static const uint8_t kTestData[kSrcSize] = {
+    184, 4,   191, 82,  92,  41,  0,   1,   226, 236, 172, 20,  182, 42,  226,
+    177, 79,  94,  77,  179, 203, 206, 198, 22,  192, 19,  75,  17,  192, 44,
+    233, 120, 48,  168, 203, 141, 210, 203, 143, 180, 184, 59,  201, 110, 102,
+    171, 32,  182, 10,  109, 105, 213, 60,  47,  236, 253, 67,  55,  14,  3,
+    99,  247, 124, 148, 159, 71,  34,  114, 19,  177, 38,  203, 237, 239, 58,
+    83,  155, 91,  10,  166, 201, 115, 124, 5,   163, 104, 2,   231, 160, 16,
+    234, 4,   8,   103, 153, 167, 174, 187, 26,  193, 109, 64,  141, 90,  48,
+    200, 174, 204, 36,  184, 114, 237, 43,  238, 242, 207, 86,  245, 182, 247,
+    6,   161, 251, 14,  8,   148, 182, 182, 79,  208, 120, 188, 17,  6,   23,
+    65,  206, 197, 13,  242, 126, 128, 224, 170, 110, 211, 121, 197, 200, 47,
+    188, 207, 208, 184, 221, 216, 76,  148, 143, 156, 100, 8,   89,  117, 14,
+    112, 183, 221, 54,  197, 208, 180, 69,  176, 94,  180, 131, 215, 121, 76,
+    7,   54,  28,  216, 238, 249, 176, 58,  142, 64,  215, 242, 72,  49,  104,
+    87,  161, 32,  52,  216, 230, 4,   141, 44,  181, 235, 224, 57,  195, 89,
+    134, 203, 144, 162, 163, 126, 156, 84,  185, 42,  148, 145, 29,  221, 194,
+    134, 52,  100, 166, 105, 60,  140, 110, 201, 184, 35,  181, 153, 93,  121,
+    243, 227, 68,  131, 134, 232, 2,   35,  60,  187, 77,  209, 76,  106, 174,
+    15,  241, 227, 115, 151, 77,  175, 36,  187, 121, 221, 223, 47,  118, 61,
+    168, 105, 32,  237, 236, 167, 213, 238, 202, 17,  170, 24,  226, 247, 131,
+    145, 6,   116, 117, 121, 11,  194, 41,  48,  126, 162, 13,  93,  209, 131,
+    154, 122, 237, 187, 103, 217, 99,  60,  200, 45,  78,  115, 69,  49,  106,
+    200, 194, 112, 60,  56,  234, 72,  251, 19,  120, 121, 182, 134, 215, 135,
+    10,  114, 2,   247, 46,  105, 209, 145, 165, 153, 191, 243, 12,  5,   36,
+    119, 206, 231, 231, 11,  32,  209, 83,  27,  229, 204, 149, 155, 83,  109,
+    35,  93,  223, 37,  84,  14,  142, 37,  160, 52,  191, 96,  40,  204, 101,
+    77,  67,  52,  53,  43,  63,  85,  253, 147, 113, 226, 96,  6,   125, 179,
+    115, 161, 17,  83,  198, 101, 98,  85,  139, 3,   137, 75,  99,  178, 23,
+    201, 255, 91,  253, 52,  134, 60,  138, 131, 208, 251, 101, 48,  2,   227,
+    228, 118, 132, 245, 202, 75,  91,  44,  160, 231, 47,  41,  50,  147, 220,
+    74,  92,  219, 165, 89,  16
+  };
+
+  // Expected results for xoffset = 2 and yoffset = 2.
+  static const int kExpectedDstStride = 16;
+  static const uint8_t kExpectedDst[256] = {
+    117, 102, 74,  135, 42,  98,  175, 206, 70,  73,  222, 197, 50,  24,  39,
+    49,  38,  105, 90,  47,  169, 40,  171, 215, 200, 73,  109, 141, 53,  85,
+    177, 164, 79,  208, 124, 89,  212, 18,  81,  145, 151, 164, 217, 153, 91,
+    154, 102, 102, 159, 75,  164, 152, 136, 51,  213, 219, 186, 116, 193, 224,
+    186, 36,  231, 208, 84,  211, 155, 167, 35,  59,  42,  76,  216, 149, 73,
+    201, 78,  149, 184, 100, 96,  196, 189, 198, 188, 235, 195, 117, 129, 120,
+    129, 49,  25,  133, 113, 69,  221, 114, 70,  143, 99,  157, 108, 189, 140,
+    78,  6,   55,  65,  240, 255, 245, 184, 72,  90,  100, 116, 131, 39,  60,
+    234, 167, 33,  160, 88,  185, 200, 157, 159, 176, 127, 151, 138, 102, 168,
+    106, 170, 86,  82,  219, 189, 76,  33,  115, 197, 106, 96,  198, 136, 97,
+    141, 237, 151, 98,  137, 191, 185, 2,   57,  95,  142, 91,  255, 185, 97,
+    137, 76,  162, 94,  173, 131, 193, 161, 81,  106, 72,  135, 222, 234, 137,
+    66,  137, 106, 243, 210, 147, 95,  15,  137, 110, 85,  66,  16,  96,  167,
+    147, 150, 173, 203, 140, 118, 196, 84,  147, 160, 19,  95,  101, 123, 74,
+    132, 202, 82,  166, 12,  131, 166, 189, 170, 159, 85,  79,  66,  57,  152,
+    132, 203, 194, 0,   1,   56,  146, 180, 224, 156, 28,  83,  181, 79,  76,
+    80,  46,  160, 175, 59,  106, 43,  87,  75,  136, 85,  189, 46,  71,  200,
+    90
+  };
+
+  ASM_REGISTER_STATE_CHECK(
+      predict_(const_cast<uint8_t *>(kTestData) + kSrcStride * 2 + 2,
+               kSrcStride, 2, 2, dst_, dst_stride_));
+
+  ASSERT_TRUE(
+      CompareBuffers(kExpectedDst, kExpectedDstStride, dst_, dst_stride_));
+}
+
+INSTANTIATE_TEST_CASE_P(
+    C, SixtapPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_c),
+                      make_tuple(8, 8, &vp8_sixtap_predict8x8_c),
+                      make_tuple(8, 4, &vp8_sixtap_predict8x4_c),
+                      make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));
+#if HAVE_NEON
+INSTANTIATE_TEST_CASE_P(
+    NEON, SixtapPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),
+                      make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),
+                      make_tuple(8, 4, &vp8_sixtap_predict8x4_neon)));
+#endif
+#if HAVE_MMX
+INSTANTIATE_TEST_CASE_P(
+    MMX, SixtapPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx),
+                      make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx),
+                      make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx),
+                      make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
+#endif
+#if HAVE_SSE2
+INSTANTIATE_TEST_CASE_P(
+    SSE2, SixtapPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
+                      make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
+                      make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
+#endif
+#if HAVE_SSSE3
+INSTANTIATE_TEST_CASE_P(
+    SSSE3, SixtapPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
+                      make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),
+                      make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3),
+                      make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));
+#endif
+#if HAVE_MSA
+INSTANTIATE_TEST_CASE_P(
+    MSA, SixtapPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),
+                      make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),
+                      make_tuple(8, 4, &vp8_sixtap_predict8x4_msa),
+                      make_tuple(4, 4, &vp8_sixtap_predict4x4_msa)));
+#endif
+
+class BilinearPredictTest : public PredictTestBase {};
+
+TEST_P(BilinearPredictTest, TestWithRandomData) {
+  TestWithRandomData(vp8_bilinear_predict16x16_c);
+}
+TEST_P(BilinearPredictTest, TestWithUnalignedDst) {
+  TestWithUnalignedDst(vp8_bilinear_predict16x16_c);
+}
+
+INSTANTIATE_TEST_CASE_P(
+    C, BilinearPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_c),
+                      make_tuple(8, 8, &vp8_bilinear_predict8x8_c),
+                      make_tuple(8, 4, &vp8_bilinear_predict8x4_c),
+                      make_tuple(4, 4, &vp8_bilinear_predict4x4_c)));
+#if HAVE_NEON
+INSTANTIATE_TEST_CASE_P(
+    NEON, BilinearPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_neon),
+                      make_tuple(8, 8, &vp8_bilinear_predict8x8_neon),
+                      make_tuple(8, 4, &vp8_bilinear_predict8x4_neon),
+                      make_tuple(4, 4, &vp8_bilinear_predict4x4_neon)));
+#endif
+#if HAVE_MMX
+INSTANTIATE_TEST_CASE_P(
+    MMX, BilinearPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_mmx),
+                      make_tuple(8, 8, &vp8_bilinear_predict8x8_mmx),
+                      make_tuple(8, 4, &vp8_bilinear_predict8x4_mmx),
+                      make_tuple(4, 4, &vp8_bilinear_predict4x4_mmx)));
+#endif
+#if HAVE_SSE2
+INSTANTIATE_TEST_CASE_P(
+    SSE2, BilinearPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_sse2),
+                      make_tuple(8, 8, &vp8_bilinear_predict8x8_sse2)));
+#endif
+#if HAVE_SSSE3
+INSTANTIATE_TEST_CASE_P(
+    SSSE3, BilinearPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_ssse3),
+                      make_tuple(8, 8, &vp8_bilinear_predict8x8_ssse3)));
+#endif
+#if HAVE_MSA
+INSTANTIATE_TEST_CASE_P(
+    MSA, BilinearPredictTest,
+    ::testing::Values(make_tuple(16, 16, &vp8_bilinear_predict16x16_msa),
+                      make_tuple(8, 8, &vp8_bilinear_predict8x8_msa),
+                      make_tuple(8, 4, &vp8_bilinear_predict8x4_msa),
+                      make_tuple(4, 4, &vp8_bilinear_predict4x4_msa)));
+#endif
+}  // namespace
diff --git a/test/sixtap_predict_test.cc b/test/sixtap_predict_test.cc
deleted file mode 100644 (file)
index 31a6044..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "third_party/googletest/src/include/gtest/gtest.h"
-
-#include "./vpx_config.h"
-#include "./vp8_rtcd.h"
-#include "test/acm_random.h"
-#include "test/clear_system_state.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
-#include "vpx/vpx_integer.h"
-#include "vpx_mem/vpx_mem.h"
-
-namespace {
-
-typedef void (*SixtapPredictFunc)(uint8_t *src_ptr, int src_pixels_per_line,
-                                  int xoffset, int yoffset, uint8_t *dst_ptr,
-                                  int dst_pitch);
-
-typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam;
-
-class SixtapPredictTest : public ::testing::TestWithParam<SixtapPredictParam> {
- public:
-  static void SetUpTestCase() {
-    src_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kSrcSize));
-    dst_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kDstSize));
-    dst_c_ =
-        reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kDstSize));
-  }
-
-  static void TearDownTestCase() {
-    vpx_free(src_);
-    src_ = NULL;
-    vpx_free(dst_);
-    dst_ = NULL;
-    vpx_free(dst_c_);
-    dst_c_ = NULL;
-  }
-
-  virtual void TearDown() { libvpx_test::ClearSystemState(); }
-
- protected:
-  // Make test arrays big enough for 16x16 functions. Six-tap filters
-  // need 5 extra pixels outside of the macroblock.
-  static const int kSrcStride = 21;
-  static const int kDstStride = 16;
-  static const int kDataAlignment = 16;
-  static const int kSrcSize = kSrcStride * kSrcStride + 1;
-  static const int kDstSize = kDstStride * kDstStride;
-
-  virtual void SetUp() {
-    width_ = GET_PARAM(0);
-    height_ = GET_PARAM(1);
-    sixtap_predict_ = GET_PARAM(2);
-    memset(src_, 0, kSrcSize);
-    memset(dst_, 0, kDstSize);
-    memset(dst_c_, 0, kDstSize);
-  }
-
-  int width_;
-  int height_;
-  SixtapPredictFunc sixtap_predict_;
-  // The src stores the macroblock we will filter on, and makes it 1 byte larger
-  // in order to test unaligned access. The result is stored in dst and dst_c(c
-  // reference code result).
-  static uint8_t *src_;
-  static uint8_t *dst_;
-  static uint8_t *dst_c_;
-};
-
-uint8_t *SixtapPredictTest::src_ = NULL;
-uint8_t *SixtapPredictTest::dst_ = NULL;
-uint8_t *SixtapPredictTest::dst_c_ = NULL;
-
-TEST_P(SixtapPredictTest, TestWithPresetData) {
-  // Test input
-  static const uint8_t test_data[kSrcSize] = {
-    216, 184, 4,   191, 82,  92,  41,  0,   1,   226, 236, 172, 20,  182, 42,
-    226, 177, 79,  94,  77,  179, 203, 206, 198, 22,  192, 19,  75,  17,  192,
-    44,  233, 120, 48,  168, 203, 141, 210, 203, 143, 180, 184, 59,  201, 110,
-    102, 171, 32,  182, 10,  109, 105, 213, 60,  47,  236, 253, 67,  55,  14,
-    3,   99,  247, 124, 148, 159, 71,  34,  114, 19,  177, 38,  203, 237, 239,
-    58,  83,  155, 91,  10,  166, 201, 115, 124, 5,   163, 104, 2,   231, 160,
-    16,  234, 4,   8,   103, 153, 167, 174, 187, 26,  193, 109, 64,  141, 90,
-    48,  200, 174, 204, 36,  184, 114, 237, 43,  238, 242, 207, 86,  245, 182,
-    247, 6,   161, 251, 14,  8,   148, 182, 182, 79,  208, 120, 188, 17,  6,
-    23,  65,  206, 197, 13,  242, 126, 128, 224, 170, 110, 211, 121, 197, 200,
-    47,  188, 207, 208, 184, 221, 216, 76,  148, 143, 156, 100, 8,   89,  117,
-    14,  112, 183, 221, 54,  197, 208, 180, 69,  176, 94,  180, 131, 215, 121,
-    76,  7,   54,  28,  216, 238, 249, 176, 58,  142, 64,  215, 242, 72,  49,
-    104, 87,  161, 32,  52,  216, 230, 4,   141, 44,  181, 235, 224, 57,  195,
-    89,  134, 203, 144, 162, 163, 126, 156, 84,  185, 42,  148, 145, 29,  221,
-    194, 134, 52,  100, 166, 105, 60,  140, 110, 201, 184, 35,  181, 153, 93,
-    121, 243, 227, 68,  131, 134, 232, 2,   35,  60,  187, 77,  209, 76,  106,
-    174, 15,  241, 227, 115, 151, 77,  175, 36,  187, 121, 221, 223, 47,  118,
-    61,  168, 105, 32,  237, 236, 167, 213, 238, 202, 17,  170, 24,  226, 247,
-    131, 145, 6,   116, 117, 121, 11,  194, 41,  48,  126, 162, 13,  93,  209,
-    131, 154, 122, 237, 187, 103, 217, 99,  60,  200, 45,  78,  115, 69,  49,
-    106, 200, 194, 112, 60,  56,  234, 72,  251, 19,  120, 121, 182, 134, 215,
-    135, 10,  114, 2,   247, 46,  105, 209, 145, 165, 153, 191, 243, 12,  5,
-    36,  119, 206, 231, 231, 11,  32,  209, 83,  27,  229, 204, 149, 155, 83,
-    109, 35,  93,  223, 37,  84,  14,  142, 37,  160, 52,  191, 96,  40,  204,
-    101, 77,  67,  52,  53,  43,  63,  85,  253, 147, 113, 226, 96,  6,   125,
-    179, 115, 161, 17,  83,  198, 101, 98,  85,  139, 3,   137, 75,  99,  178,
-    23,  201, 255, 91,  253, 52,  134, 60,  138, 131, 208, 251, 101, 48,  2,
-    227, 228, 118, 132, 245, 202, 75,  91,  44,  160, 231, 47,  41,  50,  147,
-    220, 74,  92,  219, 165, 89,  16
-  };
-
-  // Expected result
-  static const uint8_t expected_dst[kDstSize] = {
-    117, 102, 74,  135, 42,  98,  175, 206, 70,  73,  222, 197, 50,  24,  39,
-    49,  38,  105, 90,  47,  169, 40,  171, 215, 200, 73,  109, 141, 53,  85,
-    177, 164, 79,  208, 124, 89,  212, 18,  81,  145, 151, 164, 217, 153, 91,
-    154, 102, 102, 159, 75,  164, 152, 136, 51,  213, 219, 186, 116, 193, 224,
-    186, 36,  231, 208, 84,  211, 155, 167, 35,  59,  42,  76,  216, 149, 73,
-    201, 78,  149, 184, 100, 96,  196, 189, 198, 188, 235, 195, 117, 129, 120,
-    129, 49,  25,  133, 113, 69,  221, 114, 70,  143, 99,  157, 108, 189, 140,
-    78,  6,   55,  65,  240, 255, 245, 184, 72,  90,  100, 116, 131, 39,  60,
-    234, 167, 33,  160, 88,  185, 200, 157, 159, 176, 127, 151, 138, 102, 168,
-    106, 170, 86,  82,  219, 189, 76,  33,  115, 197, 106, 96,  198, 136, 97,
-    141, 237, 151, 98,  137, 191, 185, 2,   57,  95,  142, 91,  255, 185, 97,
-    137, 76,  162, 94,  173, 131, 193, 161, 81,  106, 72,  135, 222, 234, 137,
-    66,  137, 106, 243, 210, 147, 95,  15,  137, 110, 85,  66,  16,  96,  167,
-    147, 150, 173, 203, 140, 118, 196, 84,  147, 160, 19,  95,  101, 123, 74,
-    132, 202, 82,  166, 12,  131, 166, 189, 170, 159, 85,  79,  66,  57,  152,
-    132, 203, 194, 0,   1,   56,  146, 180, 224, 156, 28,  83,  181, 79,  76,
-    80,  46,  160, 175, 59,  106, 43,  87,  75,  136, 85,  189, 46,  71,  200,
-    90
-  };
-
-  uint8_t *src = const_cast<uint8_t *>(test_data);
-
-  ASM_REGISTER_STATE_CHECK(sixtap_predict_(&src[kSrcStride * 2 + 2 + 1],
-                                           kSrcStride, 2, 2, dst_, kDstStride));
-
-  for (int i = 0; i < height_; ++i) {
-    for (int j = 0; j < width_; ++j)
-      ASSERT_EQ(expected_dst[i * kDstStride + j], dst_[i * kDstStride + j])
-          << "i==" << (i * width_ + j);
-  }
-}
-
-using libvpx_test::ACMRandom;
-
-TEST_P(SixtapPredictTest, TestWithRandomData) {
-  ACMRandom rnd(ACMRandom::DeterministicSeed());
-  for (int i = 0; i < kSrcSize; ++i) src_[i] = rnd.Rand8();
-
-  // Run tests for all possible offsets.
-  for (int xoffset = 0; xoffset < 8; ++xoffset) {
-    for (int yoffset = 0; yoffset < 8; ++yoffset) {
-      // Call c reference function.
-      // Move start point to next pixel to test if the function reads
-      // unaligned data correctly.
-      vp8_sixtap_predict16x16_c(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
-                                xoffset, yoffset, dst_c_, kDstStride);
-
-      // Run test.
-      ASM_REGISTER_STATE_CHECK(sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1],
-                                               kSrcStride, xoffset, yoffset,
-                                               dst_, kDstStride));
-
-      for (int i = 0; i < height_; ++i) {
-        for (int j = 0; j < width_; ++j)
-          ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j])
-              << "i==" << (i * width_ + j);
-      }
-    }
-  }
-}
-
-using std::tr1::make_tuple;
-
-INSTANTIATE_TEST_CASE_P(
-    C, SixtapPredictTest,
-    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_c),
-                      make_tuple(8, 8, &vp8_sixtap_predict8x8_c),
-                      make_tuple(8, 4, &vp8_sixtap_predict8x4_c),
-                      make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));
-#if HAVE_NEON
-INSTANTIATE_TEST_CASE_P(
-    NEON, SixtapPredictTest,
-    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),
-                      make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),
-                      make_tuple(8, 4, &vp8_sixtap_predict8x4_neon)));
-#endif
-#if HAVE_MMX
-INSTANTIATE_TEST_CASE_P(
-    MMX, SixtapPredictTest,
-    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx),
-                      make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx),
-                      make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx),
-                      make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
-#endif
-#if HAVE_SSE2
-INSTANTIATE_TEST_CASE_P(
-    SSE2, SixtapPredictTest,
-    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
-                      make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
-                      make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
-#endif
-#if HAVE_SSSE3
-INSTANTIATE_TEST_CASE_P(
-    SSSE3, SixtapPredictTest,
-    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
-                      make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),
-                      make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3),
-                      make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));
-#endif
-#if HAVE_MSA
-INSTANTIATE_TEST_CASE_P(
-    MSA, SixtapPredictTest,
-    ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),
-                      make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),
-                      make_tuple(8, 4, &vp8_sixtap_predict8x4_msa),
-                      make_tuple(4, 4, &vp8_sixtap_predict4x4_msa)));
-#endif
-}  // namespace
index aad264531ce2a1eec79a193faf683a843d1d22db..60218a780dd566bee0db690cbcd950e14bc0a5b4 100644 (file)
@@ -119,7 +119,7 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += variance_test.cc
 LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += vp8_fdct4x4_test.cc
 
 LIBVPX_TEST_SRCS-yes                   += idct_test.cc
-LIBVPX_TEST_SRCS-yes                   += sixtap_predict_test.cc
+LIBVPX_TEST_SRCS-yes                   += predict_test.cc
 LIBVPX_TEST_SRCS-yes                   += vpx_scale_test.cc
 
 ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_TEMPORAL_DENOISING),yesyes)
index a312efb6c680465a4b62738d5151427ac8b443f6..267498335ca9df40f2c89b97cf863e15da7359fa 100644 (file)
@@ -8,8 +8,9 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "filter.h"
+#include <assert.h>
 #include "./vp8_rtcd.h"
+#include "vp8/common/filter.h"
 
 DECLARE_ALIGNED(16, const short, vp8_bilinear_filters[8][2]) = {
   { 128, 0 }, { 112, 16 }, { 96, 32 }, { 80, 48 },
@@ -324,27 +325,11 @@ void vp8_bilinear_predict4x4_c(unsigned char *src_ptr, int src_pixels_per_line,
   const short *HFilter;
   const short *VFilter;
 
+  // This represents a copy and is not required to be handled by optimizations.
+  assert((xoffset | yoffset) != 0);
+
   HFilter = vp8_bilinear_filters[xoffset];
   VFilter = vp8_bilinear_filters[yoffset];
-#if 0
-    {
-        int i;
-        unsigned char temp1[16];
-        unsigned char temp2[16];
-
-        bilinear_predict4x4_mmx(src_ptr, src_pixels_per_line, xoffset, yoffset, temp1, 4);
-        filter_block2d_bil(src_ptr, temp2, src_pixels_per_line, 4, HFilter, VFilter, 4, 4);
-
-        for (i = 0; i < 16; ++i)
-        {
-            if (temp1[i] != temp2[i])
-            {
-                bilinear_predict4x4_mmx(src_ptr, src_pixels_per_line, xoffset, yoffset, temp1, 4);
-                filter_block2d_bil(src_ptr, temp2, src_pixels_per_line, 4, HFilter, VFilter, 4, 4);
-            }
-        }
-    }
-#endif
   filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter,
                      VFilter, 4, 4);
 }
@@ -355,6 +340,8 @@ void vp8_bilinear_predict8x8_c(unsigned char *src_ptr, int src_pixels_per_line,
   const short *HFilter;
   const short *VFilter;
 
+  assert((xoffset | yoffset) != 0);
+
   HFilter = vp8_bilinear_filters[xoffset];
   VFilter = vp8_bilinear_filters[yoffset];
 
@@ -368,6 +355,8 @@ void vp8_bilinear_predict8x4_c(unsigned char *src_ptr, int src_pixels_per_line,
   const short *HFilter;
   const short *VFilter;
 
+  assert((xoffset | yoffset) != 0);
+
   HFilter = vp8_bilinear_filters[xoffset];
   VFilter = vp8_bilinear_filters[yoffset];
 
@@ -382,6 +371,8 @@ void vp8_bilinear_predict16x16_c(unsigned char *src_ptr,
   const short *HFilter;
   const short *VFilter;
 
+  assert((xoffset | yoffset) != 0);
+
   HFilter = vp8_bilinear_filters[xoffset];
   VFilter = vp8_bilinear_filters[yoffset];
 
index eb68246b21f24c7aa466f9063e71044fbfb813d5..43e3c29b5099c4aafd0bd4d298dc3dee5dd77e7f 100644 (file)
@@ -251,7 +251,7 @@ int vp8_receive_raw_frame(struct VP8_COMP *comp, unsigned int frame_flags,
                           YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
                           int64_t end_time_stamp);
 int vp8_get_compressed_data(struct VP8_COMP *comp, unsigned int *frame_flags,
-                            unsigned long *size, unsigned char *dest,
+                            size_t *size, unsigned char *dest,
                             unsigned char *dest_end, int64_t *time_stamp,
                             int64_t *time_end, int flush);
 int vp8_get_preview_raw_frame(struct VP8_COMP *comp, YV12_BUFFER_CONFIG *dest,
index 732656f2f66b47249808ed0012cf1aeb194039fb..9a12c7fb67dc4d6d337bf4d4e3d7a366e71e6666 100644 (file)
@@ -160,10 +160,6 @@ typedef struct VP8Common {
 #ifdef PACKET_TESTING
   VP8_HEADER oh;
 #endif
-#if CONFIG_POSTPROC_VISUALIZER
-  double bitrate;
-  double framerate;
-#endif
 
 #if CONFIG_MULTITHREAD
   int processor_core_count;
index 1c4e042c88f50d4fc671533b523935f55051135f..8b8c1701a37ce428e629806093e102ea9dc15e91 100644 (file)
                   (0.071 * (float)(t & 0xff)) + 128)
 /* clang-format on */
 
-/* global constants */
-#if CONFIG_POSTPROC_VISUALIZER
-static const unsigned char MB_PREDICTION_MODE_colors[MB_MODE_COUNT][3] = {
-  { RGB_TO_YUV(0x98FB98) }, /* PaleGreen */
-  { RGB_TO_YUV(0x00FF00) }, /* Green */
-  { RGB_TO_YUV(0xADFF2F) }, /* GreenYellow */
-  { RGB_TO_YUV(0x228B22) }, /* ForestGreen */
-  { RGB_TO_YUV(0x006400) }, /* DarkGreen */
-  { RGB_TO_YUV(0x98F5FF) }, /* Cadet Blue */
-  { RGB_TO_YUV(0x6CA6CD) }, /* Sky Blue */
-  { RGB_TO_YUV(0x00008B) }, /* Dark blue */
-  { RGB_TO_YUV(0x551A8B) }, /* Purple */
-  { RGB_TO_YUV(0xFF0000) }  /* Red */
-};
-
-static const unsigned char B_PREDICTION_MODE_colors[B_MODE_COUNT][3] = {
-  { RGB_TO_YUV(0x6633ff) }, /* Purple */
-  { RGB_TO_YUV(0xcc33ff) }, /* Magenta */
-  { RGB_TO_YUV(0xff33cc) }, /* Pink */
-  { RGB_TO_YUV(0xff3366) }, /* Coral */
-  { RGB_TO_YUV(0x3366ff) }, /* Blue */
-  { RGB_TO_YUV(0xed00f5) }, /* Dark Blue */
-  { RGB_TO_YUV(0x2e00b8) }, /* Dark Purple */
-  { RGB_TO_YUV(0xff6633) }, /* Orange */
-  { RGB_TO_YUV(0x33ccff) }, /* Light Blue */
-  { RGB_TO_YUV(0x8ab800) }, /* Green */
-  { RGB_TO_YUV(0xffcc33) }, /* Light Orange */
-  { RGB_TO_YUV(0x33ffcc) }, /* Aqua */
-  { RGB_TO_YUV(0x66ff33) }, /* Light Green */
-  { RGB_TO_YUV(0xccff33) }, /* Yellow */
-};
-
-static const unsigned char MV_REFERENCE_FRAME_colors[MAX_REF_FRAMES][3] = {
-  { RGB_TO_YUV(0x00ff00) }, /* Blue */
-  { RGB_TO_YUV(0x0000ff) }, /* Green */
-  { RGB_TO_YUV(0xffff00) }, /* Yellow */
-  { RGB_TO_YUV(0xff0000) }, /* Red */
-};
-#endif
-
 extern void vp8_blit_text(const char *msg, unsigned char *address,
                           const int pitch);
 extern void vp8_blit_line(int x0, int x1, int y0, int y1, unsigned char *image,
@@ -308,43 +268,6 @@ void vp8_blend_b_c(unsigned char *y, unsigned char *u, unsigned char *v,
   }
 }
 
-#if CONFIG_POSTPROC_VISUALIZER
-static void constrain_line(int x_0, int *x_1, int y_0, int *y_1, int width,
-                           int height) {
-  int dx;
-  int dy;
-
-  if (*x_1 > width) {
-    dx = *x_1 - x_0;
-    dy = *y_1 - y_0;
-
-    *x_1 = width;
-    if (dx) *y_1 = ((width - x_0) * dy) / dx + y_0;
-  }
-  if (*x_1 < 0) {
-    dx = *x_1 - x_0;
-    dy = *y_1 - y_0;
-
-    *x_1 = 0;
-    if (dx) *y_1 = ((0 - x_0) * dy) / dx + y_0;
-  }
-  if (*y_1 > height) {
-    dx = *x_1 - x_0;
-    dy = *y_1 - y_0;
-
-    *y_1 = height;
-    if (dy) *x_1 = ((height - y_0) * dx) / dy + x_0;
-  }
-  if (*y_1 < 0) {
-    dx = *x_1 - x_0;
-    dy = *y_1 - y_0;
-
-    *y_1 = 0;
-    if (dy) *x_1 = ((0 - y_0) * dx) / dy + x_0;
-  }
-}
-#endif  // CONFIG_POSTPROC_VISUALIZER
-
 #if CONFIG_POSTPROC
 int vp8_post_proc_frame(VP8_COMMON *oci, YV12_BUFFER_CONFIG *dest,
                         vp8_ppflags_t *ppflags) {
@@ -455,331 +378,6 @@ int vp8_post_proc_frame(VP8_COMMON *oci, YV12_BUFFER_CONFIG *dest,
         oci->post_proc_buffer.y_stride);
   }
 
-#if CONFIG_POSTPROC_VISUALIZER
-  if (flags & VP8D_DEBUG_TXT_FRAME_INFO) {
-    char message[512];
-    sprintf(message, "F%1dG%1dQ%3dF%3dP%d_s%dx%d",
-            (oci->frame_type == KEY_FRAME), oci->refresh_golden_frame,
-            oci->base_qindex, oci->filter_level, flags, oci->mb_cols,
-            oci->mb_rows);
-    vp8_blit_text(message, oci->post_proc_buffer.y_buffer,
-                  oci->post_proc_buffer.y_stride);
-  }
-
-  if (flags & VP8D_DEBUG_TXT_MBLK_MODES) {
-    int i, j;
-    unsigned char *y_ptr;
-    YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
-    int mb_rows = post->y_height >> 4;
-    int mb_cols = post->y_width >> 4;
-    int mb_index = 0;
-    MODE_INFO *mi = oci->mi;
-
-    y_ptr = post->y_buffer + 4 * post->y_stride + 4;
-
-    /* vp8_filter each macro block */
-    for (i = 0; i < mb_rows; ++i) {
-      for (j = 0; j < mb_cols; ++j) {
-        char zz[4];
-
-        sprintf(zz, "%c", mi[mb_index].mbmi.mode + 'a');
-
-        vp8_blit_text(zz, y_ptr, post->y_stride);
-        mb_index++;
-        y_ptr += 16;
-      }
-
-      mb_index++; /* border */
-      y_ptr += post->y_stride * 16 - post->y_width;
-    }
-  }
-
-  if (flags & VP8D_DEBUG_TXT_DC_DIFF) {
-    int i, j;
-    unsigned char *y_ptr;
-    YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
-    int mb_rows = post->y_height >> 4;
-    int mb_cols = post->y_width >> 4;
-    int mb_index = 0;
-    MODE_INFO *mi = oci->mi;
-
-    y_ptr = post->y_buffer + 4 * post->y_stride + 4;
-
-    /* vp8_filter each macro block */
-    for (i = 0; i < mb_rows; ++i) {
-      for (j = 0; j < mb_cols; ++j) {
-        char zz[4];
-        int dc_diff = !(mi[mb_index].mbmi.mode != B_PRED &&
-                        mi[mb_index].mbmi.mode != SPLITMV &&
-                        mi[mb_index].mbmi.mb_skip_coeff);
-
-        if (oci->frame_type == KEY_FRAME)
-          sprintf(zz, "a");
-        else
-          sprintf(zz, "%c", dc_diff + '0');
-
-        vp8_blit_text(zz, y_ptr, post->y_stride);
-        mb_index++;
-        y_ptr += 16;
-      }
-
-      mb_index++; /* border */
-      y_ptr += post->y_stride * 16 - post->y_width;
-    }
-  }
-
-  if (flags & VP8D_DEBUG_TXT_RATE_INFO) {
-    char message[512];
-    sprintf(message, "Bitrate: %10.2f framerate: %10.2f ", oci->bitrate,
-            oci->framerate);
-    vp8_blit_text(message, oci->post_proc_buffer.y_buffer,
-                  oci->post_proc_buffer.y_stride);
-  }
-
-  /* Draw motion vectors */
-  if ((flags & VP8D_DEBUG_DRAW_MV) && ppflags->display_mv_flag) {
-    YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
-    int width = post->y_width;
-    int height = post->y_height;
-    unsigned char *y_buffer = oci->post_proc_buffer.y_buffer;
-    int y_stride = oci->post_proc_buffer.y_stride;
-    MODE_INFO *mi = oci->mi;
-    int x0, y0;
-
-    for (y0 = 0; y0 < height; y0 += 16) {
-      for (x0 = 0; x0 < width; x0 += 16) {
-        int x1, y1;
-
-        if (!(ppflags->display_mv_flag & (1 << mi->mbmi.mode))) {
-          mi++;
-          continue;
-        }
-
-        if (mi->mbmi.mode == SPLITMV) {
-          switch (mi->mbmi.partitioning) {
-            case 0: /* mv_top_bottom */
-            {
-              union b_mode_info *bmi = &mi->bmi[0];
-              MV *mv = &bmi->mv.as_mv;
-
-              x1 = x0 + 8 + (mv->col >> 3);
-              y1 = y0 + 4 + (mv->row >> 3);
-
-              constrain_line(x0 + 8, &x1, y0 + 4, &y1, width, height);
-              vp8_blit_line(x0 + 8, x1, y0 + 4, y1, y_buffer, y_stride);
-
-              bmi = &mi->bmi[8];
-
-              x1 = x0 + 8 + (mv->col >> 3);
-              y1 = y0 + 12 + (mv->row >> 3);
-
-              constrain_line(x0 + 8, &x1, y0 + 12, &y1, width, height);
-              vp8_blit_line(x0 + 8, x1, y0 + 12, y1, y_buffer, y_stride);
-
-              break;
-            }
-            case 1: /* mv_left_right */
-            {
-              union b_mode_info *bmi = &mi->bmi[0];
-              MV *mv = &bmi->mv.as_mv;
-
-              x1 = x0 + 4 + (mv->col >> 3);
-              y1 = y0 + 8 + (mv->row >> 3);
-
-              constrain_line(x0 + 4, &x1, y0 + 8, &y1, width, height);
-              vp8_blit_line(x0 + 4, x1, y0 + 8, y1, y_buffer, y_stride);
-
-              bmi = &mi->bmi[2];
-
-              x1 = x0 + 12 + (mv->col >> 3);
-              y1 = y0 + 8 + (mv->row >> 3);
-
-              constrain_line(x0 + 12, &x1, y0 + 8, &y1, width, height);
-              vp8_blit_line(x0 + 12, x1, y0 + 8, y1, y_buffer, y_stride);
-
-              break;
-            }
-            case 2: /* mv_quarters   */
-            {
-              union b_mode_info *bmi = &mi->bmi[0];
-              MV *mv = &bmi->mv.as_mv;
-
-              x1 = x0 + 4 + (mv->col >> 3);
-              y1 = y0 + 4 + (mv->row >> 3);
-
-              constrain_line(x0 + 4, &x1, y0 + 4, &y1, width, height);
-              vp8_blit_line(x0 + 4, x1, y0 + 4, y1, y_buffer, y_stride);
-
-              bmi = &mi->bmi[2];
-
-              x1 = x0 + 12 + (mv->col >> 3);
-              y1 = y0 + 4 + (mv->row >> 3);
-
-              constrain_line(x0 + 12, &x1, y0 + 4, &y1, width, height);
-              vp8_blit_line(x0 + 12, x1, y0 + 4, y1, y_buffer, y_stride);
-
-              bmi = &mi->bmi[8];
-
-              x1 = x0 + 4 + (mv->col >> 3);
-              y1 = y0 + 12 + (mv->row >> 3);
-
-              constrain_line(x0 + 4, &x1, y0 + 12, &y1, width, height);
-              vp8_blit_line(x0 + 4, x1, y0 + 12, y1, y_buffer, y_stride);
-
-              bmi = &mi->bmi[10];
-
-              x1 = x0 + 12 + (mv->col >> 3);
-              y1 = y0 + 12 + (mv->row >> 3);
-
-              constrain_line(x0 + 12, &x1, y0 + 12, &y1, width, height);
-              vp8_blit_line(x0 + 12, x1, y0 + 12, y1, y_buffer, y_stride);
-              break;
-            }
-            default: {
-              union b_mode_info *bmi = mi->bmi;
-              int bx0, by0;
-
-              for (by0 = y0; by0 < (y0 + 16); by0 += 4) {
-                for (bx0 = x0; bx0 < (x0 + 16); bx0 += 4) {
-                  MV *mv = &bmi->mv.as_mv;
-
-                  x1 = bx0 + 2 + (mv->col >> 3);
-                  y1 = by0 + 2 + (mv->row >> 3);
-
-                  constrain_line(bx0 + 2, &x1, by0 + 2, &y1, width, height);
-                  vp8_blit_line(bx0 + 2, x1, by0 + 2, y1, y_buffer, y_stride);
-
-                  bmi++;
-                }
-              }
-            }
-          }
-        } else if (mi->mbmi.mode >= NEARESTMV) {
-          MV *mv = &mi->mbmi.mv.as_mv;
-          const int lx0 = x0 + 8;
-          const int ly0 = y0 + 8;
-
-          x1 = lx0 + (mv->col >> 3);
-          y1 = ly0 + (mv->row >> 3);
-
-          if (x1 != lx0 && y1 != ly0) {
-            constrain_line(lx0, &x1, ly0 - 1, &y1, width, height);
-            vp8_blit_line(lx0, x1, ly0 - 1, y1, y_buffer, y_stride);
-
-            constrain_line(lx0, &x1, ly0 + 1, &y1, width, height);
-            vp8_blit_line(lx0, x1, ly0 + 1, y1, y_buffer, y_stride);
-          } else
-            vp8_blit_line(lx0, x1, ly0, y1, y_buffer, y_stride);
-        }
-
-        mi++;
-      }
-      mi++;
-    }
-  }
-
-  /* Color in block modes */
-  if ((flags & VP8D_DEBUG_CLR_BLK_MODES) &&
-      (ppflags->display_mb_modes_flag || ppflags->display_b_modes_flag)) {
-    int y, x;
-    YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
-    int width = post->y_width;
-    int height = post->y_height;
-    unsigned char *y_ptr = oci->post_proc_buffer.y_buffer;
-    unsigned char *u_ptr = oci->post_proc_buffer.u_buffer;
-    unsigned char *v_ptr = oci->post_proc_buffer.v_buffer;
-    int y_stride = oci->post_proc_buffer.y_stride;
-    MODE_INFO *mi = oci->mi;
-
-    for (y = 0; y < height; y += 16) {
-      for (x = 0; x < width; x += 16) {
-        int Y = 0, U = 0, V = 0;
-
-        if (mi->mbmi.mode == B_PRED &&
-            ((ppflags->display_mb_modes_flag & B_PRED) ||
-             ppflags->display_b_modes_flag)) {
-          int by, bx;
-          unsigned char *yl, *ul, *vl;
-          union b_mode_info *bmi = mi->bmi;
-
-          yl = y_ptr + x;
-          ul = u_ptr + (x >> 1);
-          vl = v_ptr + (x >> 1);
-
-          for (by = 0; by < 16; by += 4) {
-            for (bx = 0; bx < 16; bx += 4) {
-              if ((ppflags->display_b_modes_flag & (1 << mi->mbmi.mode)) ||
-                  (ppflags->display_mb_modes_flag & B_PRED)) {
-                Y = B_PREDICTION_MODE_colors[bmi->as_mode][0];
-                U = B_PREDICTION_MODE_colors[bmi->as_mode][1];
-                V = B_PREDICTION_MODE_colors[bmi->as_mode][2];
-
-                vp8_blend_b(yl + bx, ul + (bx >> 1), vl + (bx >> 1), Y, U, V,
-                            0xc000, y_stride);
-              }
-              bmi++;
-            }
-
-            yl += y_stride * 4;
-            ul += y_stride * 1;
-            vl += y_stride * 1;
-          }
-        } else if (ppflags->display_mb_modes_flag & (1 << mi->mbmi.mode)) {
-          Y = MB_PREDICTION_MODE_colors[mi->mbmi.mode][0];
-          U = MB_PREDICTION_MODE_colors[mi->mbmi.mode][1];
-          V = MB_PREDICTION_MODE_colors[mi->mbmi.mode][2];
-
-          vp8_blend_mb_inner(y_ptr + x, u_ptr + (x >> 1), v_ptr + (x >> 1), Y,
-                             U, V, 0xc000, y_stride);
-        }
-
-        mi++;
-      }
-      y_ptr += y_stride * 16;
-      u_ptr += y_stride * 4;
-      v_ptr += y_stride * 4;
-
-      mi++;
-    }
-  }
-
-  /* Color in frame reference blocks */
-  if ((flags & VP8D_DEBUG_CLR_FRM_REF_BLKS) &&
-      ppflags->display_ref_frame_flag) {
-    int y, x;
-    YV12_BUFFER_CONFIG *post = &oci->post_proc_buffer;
-    int width = post->y_width;
-    int height = post->y_height;
-    unsigned char *y_ptr = oci->post_proc_buffer.y_buffer;
-    unsigned char *u_ptr = oci->post_proc_buffer.u_buffer;
-    unsigned char *v_ptr = oci->post_proc_buffer.v_buffer;
-    int y_stride = oci->post_proc_buffer.y_stride;
-    MODE_INFO *mi = oci->mi;
-
-    for (y = 0; y < height; y += 16) {
-      for (x = 0; x < width; x += 16) {
-        int Y = 0, U = 0, V = 0;
-
-        if (ppflags->display_ref_frame_flag & (1 << mi->mbmi.ref_frame)) {
-          Y = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][0];
-          U = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][1];
-          V = MV_REFERENCE_FRAME_colors[mi->mbmi.ref_frame][2];
-
-          vp8_blend_mb_outer(y_ptr + x, u_ptr + (x >> 1), v_ptr + (x >> 1), Y,
-                             U, V, 0xc000, y_stride);
-        }
-
-        mi++;
-      }
-      y_ptr += y_stride * 16;
-      u_ptr += y_stride * 4;
-      v_ptr += y_stride * 4;
-
-      mi++;
-    }
-  }
-#endif
-
   *dest = oci->post_proc_buffer;
 
   /* handle problem with extending borders */
diff --git a/vp8/common/textblit.c b/vp8/common/textblit.c
deleted file mode 100644 (file)
index e7c15c4..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-void vp8_blit_text(const char *msg, unsigned char *address, const int pitch) {
-  int letter_bitmap;
-  unsigned char *output_pos = address;
-  int colpos;
-  const int font[] = {
-    0x0,       0x5C00,    0x8020,    0xAFABEA,  0xD7EC0,   0x1111111, 0x1855740,
-    0x18000,   0x45C0,    0x74400,   0x51140,   0x23880,   0xC4000,   0x21080,
-    0x80000,   0x111110,  0xE9D72E,  0x87E40,   0x12AD732, 0xAAD62A,  0x4F94C4,
-    0x4D6B7,   0x456AA,   0x3E8423,  0xAAD6AA,  0xAAD6A2,  0x2800,    0x2A00,
-    0x8A880,   0x52940,   0x22A20,   0x15422,   0x6AD62E,  0x1E4A53E, 0xAAD6BF,
-    0x8C62E,   0xE8C63F,  0x118D6BF, 0x1094BF,  0xCAC62E,  0x1F2109F, 0x118FE31,
-    0xF8C628,  0x8A89F,   0x108421F, 0x1F1105F, 0x1F4105F, 0xE8C62E,  0x2294BF,
-    0x164C62E, 0x12694BF, 0x8AD6A2,  0x10FC21,  0x1F8421F, 0x744107,  0xF8220F,
-    0x1151151, 0x117041,  0x119D731, 0x47E0,    0x1041041, 0xFC400,   0x10440,
-    0x1084210, 0x820
-  };
-  colpos = 0;
-
-  while (msg[colpos] != 0) {
-    char letter = msg[colpos];
-    int fontcol, fontrow;
-
-    if (letter <= 'Z' && letter >= ' ')
-      letter_bitmap = font[letter - ' '];
-    else if (letter <= 'z' && letter >= 'a')
-      letter_bitmap = font[letter - 'a' + 'A' - ' '];
-    else
-      letter_bitmap = font[0];
-
-    for (fontcol = 6; fontcol >= 0; fontcol--)
-      for (fontrow = 0; fontrow < 5; ++fontrow)
-        output_pos[fontrow * pitch + fontcol] =
-            ((letter_bitmap >> (fontcol * 5)) & (1 << fontrow) ? 255 : 0);
-
-    output_pos += 7;
-    colpos++;
-  }
-}
-
-static void plot(const int x, const int y, unsigned char *image,
-                 const int pitch) {
-  image[x + y * pitch] ^= 255;
-}
-
-/* Bresenham line algorithm */
-void vp8_blit_line(int x0, int x1, int y0, int y1, unsigned char *image,
-                   const int pitch) {
-  int steep = abs(y1 - y0) > abs(x1 - x0);
-  int deltax, deltay;
-  int error, ystep, y, x;
-
-  if (steep) {
-    int t;
-    t = x0;
-    x0 = y0;
-    y0 = t;
-
-    t = x1;
-    x1 = y1;
-    y1 = t;
-  }
-
-  if (x0 > x1) {
-    int t;
-    t = x0;
-    x0 = x1;
-    x1 = t;
-
-    t = y0;
-    y0 = y1;
-    y1 = t;
-  }
-
-  deltax = x1 - x0;
-  deltay = abs(y1 - y0);
-  error = deltax / 2;
-
-  y = y0;
-
-  if (y0 < y1)
-    ystep = 1;
-  else
-    ystep = -1;
-
-  if (steep) {
-    for (x = x0; x <= x1; ++x) {
-      plot(y, x, image, pitch);
-
-      error = error - deltay;
-      if (error < 0) {
-        y = y + ystep;
-        error = error + deltax;
-      }
-    }
-  } else {
-    for (x = x0; x <= x1; ++x) {
-      plot(x, y, image, pitch);
-
-      error = error - deltay;
-      if (error < 0) {
-        y = y + ystep;
-        error = error + deltax;
-      }
-    }
-  }
-}
index 69f8d103c141702d161c8f7387bc10bf78ec674c..ca00583ca2af3898107a5169fdf8102744df3964 100644 (file)
@@ -181,8 +181,12 @@ sym(vp8_filter_block1d16_h6_sse2):
         movq        xmm3,       MMWORD PTR [rsi - 2]
         movq        xmm1,       MMWORD PTR [rsi + 6]
 
-        movq        xmm2,       MMWORD PTR [rsi +14]
-        pslldq      xmm2,       8
+        ; Load from 11 to avoid reading out of bounds.
+        movq        xmm2,       MMWORD PTR [rsi +11]
+        ; The lower bits are not cleared before 'or'ing with xmm1,
+        ; but that is OK because the values in the overlapping positions
+        ; are already equal to the ones in xmm1.
+        pslldq      xmm2,       5
 
         por         xmm2,       xmm1
         prefetcht2  [rsi+rax-2]
index c06f24556e687c2f6653bdbb0dfb2840a4e377f5..1f6cbd1d1e593ab627e166f79b159a311f6ca626 100644 (file)
@@ -1291,6 +1291,8 @@ sym(vp8_bilinear_predict8x8_ssse3):
         movq        xmm7,       XMMWORD PTR [rsp+96]
         punpcklbw   xmm5,       xmm6
 
+        ; Because the source register (xmm0) is always treated as signed by
+        ; pmaddubsw, the constant '128' is treated as '-128'.
         pmaddubsw   xmm1,       xmm0
         pmaddubsw   xmm2,       xmm0
 
@@ -1319,6 +1321,10 @@ sym(vp8_bilinear_predict8x8_ssse3):
         psraw       xmm5,       VP8_FILTER_SHIFT
 
         psraw       xmm6,       VP8_FILTER_SHIFT
+
+        ; Having multiplied everything by '-128' and obtained negative
+        ; numbers, the unsigned saturation truncates those values to 0,
+        ; resulting in incorrect handling of xoffset == 0 && yoffset == 0
         packuswb    xmm1,       xmm1
 
         packuswb    xmm2,       xmm2
index 06c2f624f5fbdb8667c362ff75d99de84ebc2dc2..1b100cfe8b6a02fe71c0f644dbe077a080cb374d 100644 (file)
@@ -1056,7 +1056,7 @@ static void put_delta_q(vp8_writer *bc, int delta_q) {
 }
 
 void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest,
-                        unsigned char *dest_end, unsigned long *size) {
+                        unsigned char *dest_end, size_t *size) {
   int i, j;
   VP8_HEADER oh;
   VP8_COMMON *const pc = &cpi->common;
@@ -1347,7 +1347,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest,
 
   *size = VP8_HEADER_SIZE + extra_bytes_packed + cpi->bc->pos;
 
-  cpi->partition_sz[0] = *size;
+  cpi->partition_sz[0] = (unsigned int)*size;
 
 #if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING
   {
index f61cfbe903292c8887e7fe1a61e8cb69ed1858a5..6ebf233edf5872d7e7419ff66180522ec007e054 100644 (file)
@@ -2746,7 +2746,7 @@ static int decide_key_frame(VP8_COMP *cpi) {
   return code_key_frame;
 }
 
-static void Pass1Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest,
+static void Pass1Encode(VP8_COMP *cpi, size_t *size, unsigned char *dest,
                         unsigned int *frame_flags) {
   (void)size;
   (void)dest;
@@ -3185,7 +3185,7 @@ void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm) {
   vp8_yv12_extend_frame_borders(cm->frame_to_show);
 }
 
-static void encode_frame_to_data_rate(VP8_COMP *cpi, unsigned long *size,
+static void encode_frame_to_data_rate(VP8_COMP *cpi, size_t *size,
                                       unsigned char *dest,
                                       unsigned char *dest_end,
                                       unsigned int *frame_flags) {
@@ -4384,7 +4384,7 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, unsigned long *size,
 
   /* Update rate control heuristics */
   cpi->total_byte_count += (*size);
-  cpi->projected_frame_size = (*size) << 3;
+  cpi->projected_frame_size = (int)(*size) << 3;
 
   if (cpi->oxcf.number_of_layers > 1) {
     unsigned int i;
@@ -4711,7 +4711,7 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, unsigned long *size,
   /* vp8_write_yuv_frame("encoder_recon.yuv", cm->frame_to_show); */
 }
 #if !CONFIG_REALTIME_ONLY
-static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest,
+static void Pass2Encode(VP8_COMP *cpi, size_t *size, unsigned char *dest,
                         unsigned char *dest_end, unsigned int *frame_flags) {
   if (!cpi->common.refresh_alt_ref_frame) vp8_second_pass(cpi);
 
@@ -4764,7 +4764,7 @@ static int frame_is_reference(const VP8_COMP *cpi) {
 }
 
 int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags,
-                            unsigned long *size, unsigned char *dest,
+                            size_t *size, unsigned char *dest,
                             unsigned char *dest_end, int64_t *time_stamp,
                             int64_t *time_end, int flush) {
   VP8_COMMON *cm;
index 32080eff72d4b380d270ab1d950a4e599aecdaae..59ad5773a643fa9b45e8819ce9fff73450507279 100644 (file)
@@ -687,7 +687,7 @@ void vp8_new_framerate(VP8_COMP *cpi, double framerate);
 void vp8_loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm);
 
 void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest,
-                        unsigned char *dest_end, unsigned long *size);
+                        unsigned char *dest_end, size_t *size);
 
 void vp8_tokenize_mb(VP8_COMP *, MACROBLOCK *, TOKENEXTRA **);
 
index f0050d201f122c613a77e19dc2848e59d47944cb..7b68d35f50f33a515e8dfbaff121a06be9e462bd 100644 (file)
@@ -570,7 +570,7 @@ static int evaluate_inter_mode(unsigned int *sse, int rate2, int *distortion2,
     // No adjustment if block is considered to be skin area.
     if (x->is_skin) rd_adj = 100;
 
-    this_rd = ((int64_t)this_rd) * rd_adj / 100;
+    this_rd = (int)(((int64_t)this_rd) * rd_adj / 100);
   }
 
   check_for_encode_breakout(*sse, x);
index d863a0a26f1c0f3d3ea64dd8bbc73caf6da0b1ee..886b127d6aa40bbcf057ff78c8ecd5b960eac753 100644 (file)
@@ -68,7 +68,6 @@ VP8_COMMON_SRCS-yes += common/vp8_entropymodedata.h
 
 
 
-VP8_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER) += common/textblit.c
 VP8_COMMON_SRCS-yes += common/treecoder.c
 
 VP8_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64) += common/x86/filter_x86.c
index 0ec6902e7047f66920ef55d0918c14c74db62a87..fac237eec027e9556f94d570a8583ad589dd4e30 100644 (file)
@@ -824,7 +824,7 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx,
     unsigned int lib_flags;
     YV12_BUFFER_CONFIG sd;
     int64_t dst_time_stamp, dst_end_time_stamp;
-    unsigned long size, cx_data_sz;
+    size_t size, cx_data_sz;
     unsigned char *cx_data;
     unsigned char *cx_data_end;
     int comp_data_state = 0;
index cab0a99973a44a7a2aa003105fd44103b399e876..b1f8340d671cb0decc8f21f24e9f5fdf7861495b 100644 (file)
@@ -46,13 +46,6 @@ struct vpx_codec_alg_priv {
   int decoder_init;
   int postproc_cfg_set;
   vp8_postproc_cfg_t postproc_cfg;
-#if CONFIG_POSTPROC_VISUALIZER
-  unsigned int dbg_postproc_flag;
-  int dbg_color_ref_frame_flag;
-  int dbg_color_mb_modes_flag;
-  int dbg_color_b_modes_flag;
-  int dbg_display_mv_flag;
-#endif
   vpx_decrypt_cb decrypt_cb;
   void *decrypt_state;
   vpx_image_t img;
@@ -478,22 +471,8 @@ static vpx_image_t *vp8_get_frame(vpx_codec_alg_priv_t *ctx,
 
     if (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC) {
       flags.post_proc_flag = ctx->postproc_cfg.post_proc_flag;
-#if CONFIG_POSTPROC_VISUALIZER
-      flags.post_proc_flag |=
-          ((ctx->dbg_color_ref_frame_flag != 0) ? VP8D_DEBUG_CLR_FRM_REF_BLKS
-                                                : 0) |
-          ((ctx->dbg_color_mb_modes_flag != 0) ? VP8D_DEBUG_CLR_BLK_MODES : 0) |
-          ((ctx->dbg_color_b_modes_flag != 0) ? VP8D_DEBUG_CLR_BLK_MODES : 0) |
-          ((ctx->dbg_display_mv_flag != 0) ? VP8D_DEBUG_DRAW_MV : 0);
-#endif
       flags.deblocking_level = ctx->postproc_cfg.deblocking_level;
       flags.noise_level = ctx->postproc_cfg.noise_level;
-#if CONFIG_POSTPROC_VISUALIZER
-      flags.display_ref_frame_flag = ctx->dbg_color_ref_frame_flag;
-      flags.display_mb_modes_flag = ctx->dbg_color_mb_modes_flag;
-      flags.display_b_modes_flag = ctx->dbg_color_b_modes_flag;
-      flags.display_mv_flag = ctx->dbg_display_mv_flag;
-#endif
     }
 
     if (0 == vp8dx_get_raw_frame(ctx->yv12_frame_buffers.pbi[0], &sd,
@@ -589,54 +568,6 @@ static vpx_codec_err_t vp8_set_postproc(vpx_codec_alg_priv_t *ctx,
 #endif
 }
 
-static vpx_codec_err_t vp8_set_dbg_color_ref_frame(vpx_codec_alg_priv_t *ctx,
-                                                   va_list args) {
-#if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
-  ctx->dbg_color_ref_frame_flag = va_arg(args, int);
-  return VPX_CODEC_OK;
-#else
-  (void)ctx;
-  (void)args;
-  return VPX_CODEC_INCAPABLE;
-#endif
-}
-
-static vpx_codec_err_t vp8_set_dbg_color_mb_modes(vpx_codec_alg_priv_t *ctx,
-                                                  va_list args) {
-#if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
-  ctx->dbg_color_mb_modes_flag = va_arg(args, int);
-  return VPX_CODEC_OK;
-#else
-  (void)ctx;
-  (void)args;
-  return VPX_CODEC_INCAPABLE;
-#endif
-}
-
-static vpx_codec_err_t vp8_set_dbg_color_b_modes(vpx_codec_alg_priv_t *ctx,
-                                                 va_list args) {
-#if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
-  ctx->dbg_color_b_modes_flag = va_arg(args, int);
-  return VPX_CODEC_OK;
-#else
-  (void)ctx;
-  (void)args;
-  return VPX_CODEC_INCAPABLE;
-#endif
-}
-
-static vpx_codec_err_t vp8_set_dbg_display_mv(vpx_codec_alg_priv_t *ctx,
-                                              va_list args) {
-#if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
-  ctx->dbg_display_mv_flag = va_arg(args, int);
-  return VPX_CODEC_OK;
-#else
-  (void)ctx;
-  (void)args;
-  return VPX_CODEC_INCAPABLE;
-#endif
-}
-
 static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
                                                 va_list args) {
   int *update_info = va_arg(args, int *);
@@ -706,10 +637,6 @@ vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] = {
   { VP8_SET_REFERENCE, vp8_set_reference },
   { VP8_COPY_REFERENCE, vp8_get_reference },
   { VP8_SET_POSTPROC, vp8_set_postproc },
-  { VP8_SET_DBG_COLOR_REF_FRAME, vp8_set_dbg_color_ref_frame },
-  { VP8_SET_DBG_COLOR_MB_MODES, vp8_set_dbg_color_mb_modes },
-  { VP8_SET_DBG_COLOR_B_MODES, vp8_set_dbg_color_b_modes },
-  { VP8_SET_DBG_DISPLAY_MV, vp8_set_dbg_display_mv },
   { VP8D_GET_LAST_REF_UPDATES, vp8_get_last_ref_updates },
   { VP8D_GET_FRAME_CORRUPTED, vp8_get_frame_corrupted },
   { VP8D_GET_LAST_REF_USED, vp8_get_last_ref_frame },
index ff7c1dd3f86eecc576f0a2ca2b3fccbddf2ad679..ec5cd33ceaa1e11a21ec63d5f0fa148c928e9533 100644 (file)
@@ -204,6 +204,18 @@ void vp9_iht16x16_add(TX_TYPE tx_type, const tran_low_t *input, uint8_t *dest,
 }
 
 #if CONFIG_VP9_HIGHBITDEPTH
+
+// 12 signal input bits + 7 forward transform amplify bits + 1 bit
+// for contingency in rounding and quantizing
+#define VALID_IHT_MAGNITUDE_RANGE (1 << 20)
+
+static INLINE int detect_invalid_iht_input(const tran_low_t *input, int size) {
+  int i;
+  for (i = 0; i < size; ++i)
+    if (abs(input[i]) >= VALID_IHT_MAGNITUDE_RANGE) return 1;
+  return 0;
+}
+
 void vp9_highbd_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8,
                                 int stride, int tx_type, int bd) {
   const highbd_transform_2d IHT_4[] = {
@@ -219,6 +231,13 @@ void vp9_highbd_iht4x4_16_add_c(const tran_low_t *input, uint8_t *dest8,
   tran_low_t *outptr = out;
   tran_low_t temp_in[4], temp_out[4];
 
+  if (detect_invalid_iht_input(input, 16)) {
+#if CONFIG_COEFFICIENT_RANGE_CHECKING
+    assert(0 && "invalid highbd iht input");
+#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
+    return;
+  }
+
   // Inverse transform row vectors.
   for (i = 0; i < 4; ++i) {
     IHT_4[tx_type].rows(input, outptr, bd);
@@ -253,6 +272,13 @@ void vp9_highbd_iht8x8_64_add_c(const tran_low_t *input, uint8_t *dest8,
   const highbd_transform_2d ht = HIGH_IHT_8[tx_type];
   uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
 
+  if (detect_invalid_iht_input(input, 64)) {
+#if CONFIG_COEFFICIENT_RANGE_CHECKING
+    assert(0 && "invalid highbd iht input");
+#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
+    return;
+  }
+
   // Inverse transform row vectors.
   for (i = 0; i < 8; ++i) {
     ht.rows(input, outptr, bd);
@@ -287,6 +313,13 @@ void vp9_highbd_iht16x16_256_add_c(const tran_low_t *input, uint8_t *dest8,
   const highbd_transform_2d ht = HIGH_IHT_16[tx_type];
   uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
 
+  if (detect_invalid_iht_input(input, 256)) {
+#if CONFIG_COEFFICIENT_RANGE_CHECKING
+    assert(0 && "invalid highbd iht input");
+#endif  // CONFIG_COEFFICIENT_RANGE_CHECKING
+    return;
+  }
+
   // Rows
   for (i = 0; i < 16; ++i) {
     ht.rows(input, outptr, bd);
index b6ae10b1b532f8cb75e02bb14292d2added03d2a..b105e5d45a38556894249f50566dfc06120c9ab3 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "vp9/common/vp9_onyxc_int.h"
 #include "vp9/common/vp9_postproc.h"
-#include "vp9/common/vp9_textblit.h"
 
 #if CONFIG_VP9_POSTPROC
 
index f315a3b85965dee741ea3514aece4fc7bf9fb0a6..37a867323d6a1c130127926f8f8e144fed27d7ae 100644 (file)
@@ -91,33 +91,6 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
 
 # High bitdepth functions
 if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
-  #
-  # Sub Pixel Filters
-  #
-  add_proto qw/void vp9_highbd_convolve_copy/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
-  specialize qw/vp9_highbd_convolve_copy/;
-
-  add_proto qw/void vp9_highbd_convolve_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
-  specialize qw/vp9_highbd_convolve_avg/;
-
-  add_proto qw/void vp9_highbd_convolve8/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
-  specialize qw/vp9_highbd_convolve8/, "$sse2_x86_64";
-
-  add_proto qw/void vp9_highbd_convolve8_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
-  specialize qw/vp9_highbd_convolve8_horiz/, "$sse2_x86_64";
-
-  add_proto qw/void vp9_highbd_convolve8_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
-  specialize qw/vp9_highbd_convolve8_vert/, "$sse2_x86_64";
-
-  add_proto qw/void vp9_highbd_convolve8_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
-  specialize qw/vp9_highbd_convolve8_avg/, "$sse2_x86_64";
-
-  add_proto qw/void vp9_highbd_convolve8_avg_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
-  specialize qw/vp9_highbd_convolve8_avg_horiz/, "$sse2_x86_64";
-
-  add_proto qw/void vp9_highbd_convolve8_avg_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
-  specialize qw/vp9_highbd_convolve8_avg_vert/, "$sse2_x86_64";
-
   #
   # post proc
   #
diff --git a/vp9/common/vp9_textblit.c b/vp9/common/vp9_textblit.c
deleted file mode 100644 (file)
index 9940137..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdlib.h>
-
-#include "vp9/common/vp9_textblit.h"
-
-static const int font[] = {
-  0x0,       0x5C00,    0x8020,    0xAFABEA,  0xD7EC0,   0x1111111, 0x1855740,
-  0x18000,   0x45C0,    0x74400,   0x51140,   0x23880,   0xC4000,   0x21080,
-  0x80000,   0x111110,  0xE9D72E,  0x87E40,   0x12AD732, 0xAAD62A,  0x4F94C4,
-  0x4D6B7,   0x456AA,   0x3E8423,  0xAAD6AA,  0xAAD6A2,  0x2800,    0x2A00,
-  0x8A880,   0x52940,   0x22A20,   0x15422,   0x6AD62E,  0x1E4A53E, 0xAAD6BF,
-  0x8C62E,   0xE8C63F,  0x118D6BF, 0x1094BF,  0xCAC62E,  0x1F2109F, 0x118FE31,
-  0xF8C628,  0x8A89F,   0x108421F, 0x1F1105F, 0x1F4105F, 0xE8C62E,  0x2294BF,
-  0x164C62E, 0x12694BF, 0x8AD6A2,  0x10FC21,  0x1F8421F, 0x744107,  0xF8220F,
-  0x1151151, 0x117041,  0x119D731, 0x47E0,    0x1041041, 0xFC400,   0x10440,
-  0x1084210, 0x820
-};
-
-static void plot(int x, int y, unsigned char *image, int pitch) {
-  image[x + y * pitch] ^= 255;
-}
-
-void vp9_blit_text(const char *msg, unsigned char *address, const int pitch) {
-  int letter_bitmap;
-  unsigned char *output_pos = address;
-  int colpos = 0;
-
-  while (msg[colpos] != 0) {
-    char letter = msg[colpos];
-    int fontcol, fontrow;
-
-    if (letter <= 'Z' && letter >= ' ')
-      letter_bitmap = font[letter - ' '];
-    else if (letter <= 'z' && letter >= 'a')
-      letter_bitmap = font[letter - 'a' + 'A' - ' '];
-    else
-      letter_bitmap = font[0];
-
-    for (fontcol = 6; fontcol >= 0; fontcol--)
-      for (fontrow = 0; fontrow < 5; fontrow++)
-        output_pos[fontrow * pitch + fontcol] =
-            ((letter_bitmap >> (fontcol * 5)) & (1 << fontrow) ? 255 : 0);
-
-    output_pos += 7;
-    colpos++;
-  }
-}
-
-/* Bresenham line algorithm */
-void vp9_blit_line(int x0, int x1, int y0, int y1, unsigned char *image,
-                   int pitch) {
-  int steep = abs(y1 - y0) > abs(x1 - x0);
-  int deltax, deltay;
-  int error, ystep, y, x;
-
-  if (steep) {
-    int t;
-    t = x0;
-    x0 = y0;
-    y0 = t;
-
-    t = x1;
-    x1 = y1;
-    y1 = t;
-  }
-
-  if (x0 > x1) {
-    int t;
-    t = x0;
-    x0 = x1;
-    x1 = t;
-
-    t = y0;
-    y0 = y1;
-    y1 = t;
-  }
-
-  deltax = x1 - x0;
-  deltay = abs(y1 - y0);
-  error = deltax / 2;
-
-  y = y0;
-
-  if (y0 < y1)
-    ystep = 1;
-  else
-    ystep = -1;
-
-  if (steep) {
-    for (x = x0; x <= x1; x++) {
-      plot(y, x, image, pitch);
-
-      error = error - deltay;
-      if (error < 0) {
-        y = y + ystep;
-        error = error + deltax;
-      }
-    }
-  } else {
-    for (x = x0; x <= x1; x++) {
-      plot(x, y, image, pitch);
-
-      error = error - deltay;
-      if (error < 0) {
-        y = y + ystep;
-        error = error + deltax;
-      }
-    }
-  }
-}
diff --git a/vp9/common/vp9_textblit.h b/vp9/common/vp9_textblit.h
deleted file mode 100644 (file)
index 158ec1b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_TEXTBLIT_H_
-#define VP9_COMMON_VP9_TEXTBLIT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp9_blit_text(const char *msg, unsigned char *address, int pitch);
-
-void vp9_blit_line(int x0, int x1, int y0, int y1, unsigned char *image,
-                   int pitch);
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif
-
-#endif  // VP9_COMMON_VP9_TEXTBLIT_H_
index 91c43d109458fdcb41ae263b7b423900da385e7c..4372ba0371d5fcd0142956b6d9f860f309b3f857 100644 (file)
@@ -241,7 +241,7 @@ static int read_mv_component(vpx_reader *r, const nmv_component *mvcomp,
 
   // Integer part
   if (class0) {
-    d = vpx_read_tree(r, vp9_mv_class0_tree, mvcomp->class0);
+    d = vpx_read(r, mvcomp->class0[0]);
     mag = 0;
   } else {
     int i;
index 8d7c3576b2a81e754c245febc6bd0cf9feb4f262..335faca82b1c2841e74de728ba4e1824d98f9705 100644 (file)
@@ -3990,17 +3990,12 @@ static void encode_frame_internal(VP9_COMP *cpi) {
   MACROBLOCK *const x = &td->mb;
   VP9_COMMON *const cm = &cpi->common;
   MACROBLOCKD *const xd = &x->e_mbd;
-  RD_COUNTS *const rdc = &cpi->td.rd_counts;
 
   xd->mi = cm->mi_grid_visible;
   xd->mi[0] = cm->mi;
 
   vp9_zero(*td->counts);
-  vp9_zero(rdc->coef_counts);
-  vp9_zero(rdc->comp_pred_diff);
-  vp9_zero(rdc->filter_diff);
-  rdc->m_search_count = 0;   // Count of motion search hits.
-  rdc->ex_search_count = 0;  // Exhaustive mesh search hits.
+  vp9_zero(cpi->td.rd_counts);
 
   xd->lossless = cm->base_qindex == 0 && cm->y_dc_delta_q == 0 &&
                  cm->uv_dc_delta_q == 0 && cm->uv_ac_delta_q == 0;
index 8e76f72fe2e4048c1dfe0ffa6028e1962398951c..874a8e4b981546e831165bb7df2a4101a34c3f92 100644 (file)
 static struct vp9_token mv_joint_encodings[MV_JOINTS];
 static struct vp9_token mv_class_encodings[MV_CLASSES];
 static struct vp9_token mv_fp_encodings[MV_FP_SIZE];
-static struct vp9_token mv_class0_encodings[CLASS0_SIZE];
 
 void vp9_entropy_mv_init(void) {
   vp9_tokens_from_tree(mv_joint_encodings, vp9_mv_joint_tree);
   vp9_tokens_from_tree(mv_class_encodings, vp9_mv_class_tree);
-  vp9_tokens_from_tree(mv_class0_encodings, vp9_mv_class0_tree);
   vp9_tokens_from_tree(mv_fp_encodings, vp9_mv_fp_tree);
 }
 
@@ -51,8 +49,7 @@ static void encode_mv_component(vpx_writer *w, int comp,
 
   // Integer bits
   if (mv_class == MV_CLASS_0) {
-    vp9_write_token(w, vp9_mv_class0_tree, mvcomp->class0,
-                    &mv_class0_encodings[d]);
+    vpx_write(w, d, mvcomp->class0[0]);
   } else {
     int i;
     const int n = mv_class + CLASS0_BITS - 1;  // number of bits
index 2fd42960e042d8c897bacfc74ecc8a8bcc7a385c..5bfc0d3599fd49e1af353c3981a8614610358af4 100644 (file)
@@ -45,7 +45,6 @@ VP9_COMMON_SRCS-yes += common/vp9_scale.h
 VP9_COMMON_SRCS-yes += common/vp9_scale.c
 VP9_COMMON_SRCS-yes += common/vp9_seg_common.h
 VP9_COMMON_SRCS-yes += common/vp9_seg_common.c
-VP9_COMMON_SRCS-yes += common/vp9_textblit.h
 VP9_COMMON_SRCS-yes += common/vp9_tile_common.h
 VP9_COMMON_SRCS-yes += common/vp9_tile_common.c
 VP9_COMMON_SRCS-yes += common/vp9_loopfilter.c
@@ -55,7 +54,6 @@ VP9_COMMON_SRCS-yes += common/vp9_mvref_common.h
 VP9_COMMON_SRCS-yes += common/vp9_quant_common.c
 VP9_COMMON_SRCS-yes += common/vp9_reconinter.c
 VP9_COMMON_SRCS-yes += common/vp9_reconintra.c
-VP9_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER) += common/vp9_textblit.c
 VP9_COMMON_SRCS-yes += common/vp9_common_data.c
 VP9_COMMON_SRCS-yes += common/vp9_common_data.h
 VP9_COMMON_SRCS-yes += common/vp9_scan.c
index 04b1dca290da6c2148addb6acffd3a138ecee3b2..3b5dc3ddac0a7c3f02d542110473093f3270435f 100644 (file)
@@ -829,13 +829,6 @@ static vpx_codec_err_t ctrl_set_postproc(vpx_codec_alg_priv_t *ctx,
 #endif
 }
 
-static vpx_codec_err_t ctrl_set_dbg_options(vpx_codec_alg_priv_t *ctx,
-                                            va_list args) {
-  (void)ctx;
-  (void)args;
-  return VPX_CODEC_INCAPABLE;
-}
-
 static vpx_codec_err_t ctrl_get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
                                                  va_list args) {
   int *const update_info = va_arg(args, int *);
@@ -1014,10 +1007,6 @@ static vpx_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
   // Setters
   { VP8_SET_REFERENCE, ctrl_set_reference },
   { VP8_SET_POSTPROC, ctrl_set_postproc },
-  { VP8_SET_DBG_COLOR_REF_FRAME, ctrl_set_dbg_options },
-  { VP8_SET_DBG_COLOR_MB_MODES, ctrl_set_dbg_options },
-  { VP8_SET_DBG_COLOR_B_MODES, ctrl_set_dbg_options },
-  { VP8_SET_DBG_DISPLAY_MV, ctrl_set_dbg_options },
   { VP9_INVERT_TILE_DECODE_ORDER, ctrl_set_invert_tile_order },
   { VPXD_SET_DECRYPTOR, ctrl_set_decryptor },
   { VP9_SET_BYTE_ALIGNMENT, ctrl_set_byte_alignment },
index c3eb5265a8ebdbcd2beffb6d65cb3343ca191a00..059c9d0f656bbbbbf9a3153c30253ad1a6793a48 100644 (file)
--- a/vpx/vp8.h
+++ b/vpx/vp8.h
@@ -47,11 +47,10 @@ enum vp8_com_control_id {
   VP8_SET_REFERENCE = 1,
   VP8_COPY_REFERENCE = 2, /**< get a copy of reference frame from the decoder */
   VP8_SET_POSTPROC = 3,   /**< set the decoder's post processing settings  */
-  VP8_SET_DBG_COLOR_REF_FRAME =
-      4, /**< set the reference frames to color for each macroblock */
-  VP8_SET_DBG_COLOR_MB_MODES = 5, /**< set which macro block modes to color */
-  VP8_SET_DBG_COLOR_B_MODES = 6,  /**< set which blocks modes to color */
-  VP8_SET_DBG_DISPLAY_MV = 7,     /**< set which motion vector modes to draw */
+  VP8_SET_DBG_COLOR_REF_FRAME = 4, /**< \deprecated */
+  VP8_SET_DBG_COLOR_MB_MODES = 5,  /**< \deprecated */
+  VP8_SET_DBG_COLOR_B_MODES = 6,   /**< \deprecated */
+  VP8_SET_DBG_DISPLAY_MV = 7,      /**< \deprecated */
 
   /* TODO(jkoleszar): The encoder incorrectly reuses some of these values (5+)
    * for its control ids. These should be migrated to something like the
@@ -133,13 +132,13 @@ VPX_CTRL_USE_TYPE(VP8_COPY_REFERENCE, vpx_ref_frame_t *)
 #define VPX_CTRL_VP8_COPY_REFERENCE
 VPX_CTRL_USE_TYPE(VP8_SET_POSTPROC, vp8_postproc_cfg_t *)
 #define VPX_CTRL_VP8_SET_POSTPROC
-VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_REF_FRAME, int)
+VPX_CTRL_USE_TYPE_DEPRECATED(VP8_SET_DBG_COLOR_REF_FRAME, int)
 #define VPX_CTRL_VP8_SET_DBG_COLOR_REF_FRAME
-VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_MB_MODES, int)
+VPX_CTRL_USE_TYPE_DEPRECATED(VP8_SET_DBG_COLOR_MB_MODES, int)
 #define VPX_CTRL_VP8_SET_DBG_COLOR_MB_MODES
-VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_B_MODES, int)
+VPX_CTRL_USE_TYPE_DEPRECATED(VP8_SET_DBG_COLOR_B_MODES, int)
 #define VPX_CTRL_VP8_SET_DBG_COLOR_B_MODES
-VPX_CTRL_USE_TYPE(VP8_SET_DBG_DISPLAY_MV, int)
+VPX_CTRL_USE_TYPE_DEPRECATED(VP8_SET_DBG_DISPLAY_MV, int)
 #define VPX_CTRL_VP8_SET_DBG_DISPLAY_MV
 VPX_CTRL_USE_TYPE(VP9_GET_REFERENCE, vp9_ref_frame_t *)
 #define VPX_CTRL_VP9_GET_REFERENCE
index f469afc4e4b8db4a93c6607a72678e315e3d3b2d..b6d7f86a4b27f13232a67038d742298ab71c25bb 100644 (file)
@@ -75,7 +75,7 @@ unsigned int vpx_variance8x8_neon(const uint8_t *a, int a_stride,
                                   unsigned int *sse) {
   int sum;
   variance_neon_w8(a, a_stride, b, b_stride, 8, 8, sse, &sum);
-  return *sse - (((int64_t)sum * sum) >> 6);  //  >> 6 = / 8 * 8
+  return *sse - ((sum * sum) >> 6);
 }
 
 unsigned int vpx_variance16x16_neon(const uint8_t *a, int a_stride,
@@ -83,7 +83,7 @@ unsigned int vpx_variance16x16_neon(const uint8_t *a, int a_stride,
                                     unsigned int *sse) {
   int sum;
   variance_neon_w8(a, a_stride, b, b_stride, 16, 16, sse, &sum);
-  return *sse - (((int64_t)sum * sum) >> 8);  //  >> 8 = / 16 * 16
+  return *sse - (((uint32_t)((int64_t)sum * sum)) >> 8);
 }
 
 unsigned int vpx_variance32x32_neon(const uint8_t *a, int a_stride,
@@ -91,7 +91,7 @@ unsigned int vpx_variance32x32_neon(const uint8_t *a, int a_stride,
                                     unsigned int *sse) {
   int sum;
   variance_neon_w8(a, a_stride, b, b_stride, 32, 32, sse, &sum);
-  return *sse - (((int64_t)sum * sum) >> 10);  // >> 10 = / 32 * 32
+  return *sse - (unsigned int)(((int64_t)sum * sum) >> 10);
 }
 
 unsigned int vpx_variance32x64_neon(const uint8_t *a, int a_stride,
@@ -104,7 +104,7 @@ unsigned int vpx_variance32x64_neon(const uint8_t *a, int a_stride,
                    32, 32, &sse2, &sum2);
   *sse = sse1 + sse2;
   sum1 += sum2;
-  return *sse - (((int64_t)sum1 * sum1) >> 11);  // >> 11 = / 32 * 64
+  return *sse - (unsigned int)(((int64_t)sum1 * sum1) >> 11);
 }
 
 unsigned int vpx_variance64x32_neon(const uint8_t *a, int a_stride,
@@ -117,7 +117,7 @@ unsigned int vpx_variance64x32_neon(const uint8_t *a, int a_stride,
                    64, 16, &sse2, &sum2);
   *sse = sse1 + sse2;
   sum1 += sum2;
-  return *sse - (((int64_t)sum1 * sum1) >> 11);  // >> 11 = / 32 * 64
+  return *sse - (unsigned int)(((int64_t)sum1 * sum1) >> 11);
 }
 
 unsigned int vpx_variance64x64_neon(const uint8_t *a, int a_stride,
@@ -141,7 +141,7 @@ unsigned int vpx_variance64x64_neon(const uint8_t *a, int a_stride,
                    b_stride, 64, 16, &sse2, &sum2);
   *sse = sse1 + sse2;
   sum1 += sum2;
-  return *sse - (((int64_t)sum1 * sum1) >> 12);  // >> 12 = / 64 * 64
+  return *sse - (unsigned int)(((int64_t)sum1 * sum1) >> 12);
 }
 
 unsigned int vpx_variance16x8_neon(const unsigned char *src_ptr,
index 330ae8d6a38933773d4d03ba3aef161990c64579..cb56ad0789c83e3c873ef497b6de1a294f6b2a4a 100644 (file)
@@ -3066,17 +3066,7 @@ void vpx_idct32x32_34_add_sse2(const tran_low_t *input, uint8_t *dest,
   in[6] = load_input_data(input + 192);
   in[7] = load_input_data(input + 224);
 
-  for (i = 8; i < 32; ++i) {
-    in[i] = _mm_setzero_si128();
-  }
-
   array_transpose_8x8(in, in);
-  // TODO(hkuang): Following transposes are unnecessary. But remove them will
-  // lead to performance drop on some devices.
-  array_transpose_8x8(in + 8, in + 8);
-  array_transpose_8x8(in + 16, in + 16);
-  array_transpose_8x8(in + 24, in + 24);
-
   IDCT32_34
 
   // 1_D: Store 32 intermediate results for each 8x32 block.
index 7bc2693cfbbfd0f41915fa4953610e128a83655c..8428e0520d78d93a3ddd87a3e2f871ef4a650b91 100644 (file)
@@ -61,7 +61,7 @@ unsigned int vpx_variance32x16_avx2(const uint8_t *src, int src_stride,
   int sum;
   variance_avx2(src, src_stride, ref, ref_stride, 32, 16, sse, &sum,
                 vpx_get32x32var_avx2, 32);
-  return *sse - (((int64_t)sum * sum) >> 9);
+  return *sse - (uint32_t)(((int64_t)sum * sum) >> 9);
 }
 
 unsigned int vpx_variance32x32_avx2(const uint8_t *src, int src_stride,
@@ -70,7 +70,7 @@ unsigned int vpx_variance32x32_avx2(const uint8_t *src, int src_stride,
   int sum;
   variance_avx2(src, src_stride, ref, ref_stride, 32, 32, sse, &sum,
                 vpx_get32x32var_avx2, 32);
-  return *sse - (((int64_t)sum * sum) >> 10);
+  return *sse - (uint32_t)(((int64_t)sum * sum) >> 10);
 }
 
 unsigned int vpx_variance64x64_avx2(const uint8_t *src, int src_stride,
@@ -79,7 +79,7 @@ unsigned int vpx_variance64x64_avx2(const uint8_t *src, int src_stride,
   int sum;
   variance_avx2(src, src_stride, ref, ref_stride, 64, 64, sse, &sum,
                 vpx_get32x32var_avx2, 32);
-  return *sse - (((int64_t)sum * sum) >> 12);
+  return *sse - (uint32_t)(((int64_t)sum * sum) >> 12);
 }
 
 unsigned int vpx_variance64x32_avx2(const uint8_t *src, int src_stride,
@@ -88,7 +88,7 @@ unsigned int vpx_variance64x32_avx2(const uint8_t *src, int src_stride,
   int sum;
   variance_avx2(src, src_stride, ref, ref_stride, 64, 32, sse, &sum,
                 vpx_get32x32var_avx2, 32);
-  return *sse - (((int64_t)sum * sum) >> 11);
+  return *sse - (uint32_t)(((int64_t)sum * sum) >> 11);
 }
 
 unsigned int vpx_sub_pixel_variance32xh_avx2(const uint8_t *src, int src_stride,
@@ -115,7 +115,7 @@ unsigned int vpx_sub_pixel_variance64x64_avx2(const uint8_t *src,
                                       dst + 32, dst_stride, 64, &sse2);
   const int se = se1 + se2;
   *sse = sse1 + sse2;
-  return *sse - (((int64_t)se * se) >> 12);
+  return *sse - (uint32_t)(((int64_t)se * se) >> 12);
 }
 
 unsigned int vpx_sub_pixel_variance32x32_avx2(const uint8_t *src,
@@ -125,7 +125,7 @@ unsigned int vpx_sub_pixel_variance32x32_avx2(const uint8_t *src,
                                               unsigned int *sse) {
   const int se = vpx_sub_pixel_variance32xh_avx2(
       src, src_stride, x_offset, y_offset, dst, dst_stride, 32, sse);
-  return *sse - (((int64_t)se * se) >> 10);
+  return *sse - (uint32_t)(((int64_t)se * se) >> 10);
 }
 
 unsigned int vpx_sub_pixel_avg_variance64x64_avx2(
@@ -142,7 +142,7 @@ unsigned int vpx_sub_pixel_avg_variance64x64_avx2(
 
   *sse = sse1 + sse2;
 
-  return *sse - (((int64_t)se * se) >> 12);
+  return *sse - (uint32_t)(((int64_t)se * se) >> 12);
 }
 
 unsigned int vpx_sub_pixel_avg_variance32x32_avx2(
@@ -151,5 +151,5 @@ unsigned int vpx_sub_pixel_avg_variance32x32_avx2(
   // Process 32 elements in parallel.
   const int se = vpx_sub_pixel_avg_variance32xh_avx2(
       src, src_stride, x_offset, y_offset, dst, dst_stride, sec, 32, 32, sse);
-  return *sse - (((int64_t)se * se) >> 10);
+  return *sse - (uint32_t)(((int64_t)se * se) >> 10);
 }
index c1ff5a3f828f92c2036d980296d785b5deeb6270..ab638ec6b866e86be497923198caac33a0287030 100644 (file)
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -125,30 +125,11 @@ static const arg_def_t deblock =
     ARG_DEF(NULL, "deblock", 0, "Enable VP8 deblocking");
 static const arg_def_t demacroblock_level = ARG_DEF(
     NULL, "demacroblock-level", 1, "Enable VP8 demacroblocking, w/ level");
-static const arg_def_t pp_debug_info =
-    ARG_DEF(NULL, "pp-debug-info", 1, "Enable VP8 visible debug info");
-static const arg_def_t pp_disp_ref_frame =
-    ARG_DEF(NULL, "pp-dbg-ref-frame", 1,
-            "Display only selected reference frame per macro block");
-static const arg_def_t pp_disp_mb_modes = ARG_DEF(
-    NULL, "pp-dbg-mb-modes", 1, "Display only selected macro block modes");
-static const arg_def_t pp_disp_b_modes =
-    ARG_DEF(NULL, "pp-dbg-b-modes", 1, "Display only selected block modes");
-static const arg_def_t pp_disp_mvs =
-    ARG_DEF(NULL, "pp-dbg-mvs", 1, "Draw only selected motion vectors");
 static const arg_def_t mfqe =
     ARG_DEF(NULL, "mfqe", 0, "Enable multiframe quality enhancement");
 
-static const arg_def_t *vp8_pp_args[] = { &addnoise_level,
-                                          &deblock,
-                                          &demacroblock_level,
-                                          &pp_debug_info,
-                                          &pp_disp_ref_frame,
-                                          &pp_disp_mb_modes,
-                                          &pp_disp_b_modes,
-                                          &pp_disp_mvs,
-                                          &mfqe,
-                                          NULL };
+static const arg_def_t *vp8_pp_args[] = { &addnoise_level, &deblock,
+                                          &demacroblock_level, &mfqe, NULL };
 #endif
 
 #if CONFIG_LIBYUV
@@ -539,10 +520,6 @@ static int main_loop(int argc, const char **argv_) {
 #endif
 #if CONFIG_VP8_DECODER
   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;
-  int vp8_dbg_display_mv = 0;
 #endif
   int frames_corrupted = 0;
   int dec_flags = 0;
@@ -647,37 +624,6 @@ static int main_loop(int argc, const char **argv_) {
     } else if (arg_match(&arg, &mfqe, argi)) {
       postproc = 1;
       vp8_pp_cfg.post_proc_flag |= VP8_MFQE;
-    } else if (arg_match(&arg, &pp_debug_info, argi)) {
-      unsigned int level = arg_parse_uint(&arg);
-
-      postproc = 1;
-      vp8_pp_cfg.post_proc_flag &= ~0x7;
-
-      if (level) vp8_pp_cfg.post_proc_flag |= level;
-    } else if (arg_match(&arg, &pp_disp_ref_frame, argi)) {
-      unsigned int flags = arg_parse_int(&arg);
-      if (flags) {
-        postproc = 1;
-        vp8_dbg_color_ref_frame = flags;
-      }
-    } else if (arg_match(&arg, &pp_disp_mb_modes, argi)) {
-      unsigned int flags = arg_parse_int(&arg);
-      if (flags) {
-        postproc = 1;
-        vp8_dbg_color_mb_modes = flags;
-      }
-    } else if (arg_match(&arg, &pp_disp_b_modes, argi)) {
-      unsigned int flags = arg_parse_int(&arg);
-      if (flags) {
-        postproc = 1;
-        vp8_dbg_color_b_modes = flags;
-      }
-    } else if (arg_match(&arg, &pp_disp_mvs, argi)) {
-      unsigned int flags = arg_parse_int(&arg);
-      if (flags) {
-        postproc = 1;
-        vp8_dbg_display_mv = flags;
-      }
     } else if (arg_match(&arg, &error_concealment, argi)) {
       ec_enabled = 1;
     }
@@ -789,37 +735,6 @@ static int main_loop(int argc, const char **argv_) {
             vpx_codec_error(&decoder));
     return EXIT_FAILURE;
   }
-
-  if (vp8_dbg_color_ref_frame &&
-      vpx_codec_control(&decoder, VP8_SET_DBG_COLOR_REF_FRAME,
-                        vp8_dbg_color_ref_frame)) {
-    fprintf(stderr, "Failed to configure reference block visualizer: %s\n",
-            vpx_codec_error(&decoder));
-    return EXIT_FAILURE;
-  }
-
-  if (vp8_dbg_color_mb_modes &&
-      vpx_codec_control(&decoder, VP8_SET_DBG_COLOR_MB_MODES,
-                        vp8_dbg_color_mb_modes)) {
-    fprintf(stderr, "Failed to configure macro block visualizer: %s\n",
-            vpx_codec_error(&decoder));
-    return EXIT_FAILURE;
-  }
-
-  if (vp8_dbg_color_b_modes &&
-      vpx_codec_control(&decoder, VP8_SET_DBG_COLOR_B_MODES,
-                        vp8_dbg_color_b_modes)) {
-    fprintf(stderr, "Failed to configure block visualizer: %s\n",
-            vpx_codec_error(&decoder));
-    return EXIT_FAILURE;
-  }
-
-  if (vp8_dbg_display_mv &&
-      vpx_codec_control(&decoder, VP8_SET_DBG_DISPLAY_MV, vp8_dbg_display_mv)) {
-    fprintf(stderr, "Failed to configure motion vector visualizer: %s\n",
-            vpx_codec_error(&decoder));
-    return EXIT_FAILURE;
-  }
 #endif
 
   if (arg_skip) fprintf(stderr, "Skipping first %d frames.\n", arg_skip);