ref: 03b412d0449146ecd7e3398448cfa91c2acca05e
parent: a43bdcd7b021d7aa091a516ac313930b3d28fe6e
parent: d0ed677a34d4778d96ee4c31d04e153b52f14394
author: John Koleszar <jkoleszar@google.com>
date: Tue Jun 11 14:19:14 EDT 2013
VP9 profile 0 release candidate Merge experimental branch into master Change-Id: Ie5f89fb977d28a4d98a8dcdf1c6eb97271a3c1db
--- a/build/make/Makefile
+++ b/build/make/Makefile
@@ -103,6 +103,18 @@
.PHONY: testdata
testdata::
+# Add compiler flags for intrinsic files
+$(BUILD_PFX)%_mmx.c.d: CFLAGS += -mmmx
+$(BUILD_PFX)%_mmx.c.o: CFLAGS += -mmmx
+$(BUILD_PFX)%_sse2.c.d: CFLAGS += -msse2
+$(BUILD_PFX)%_sse2.c.o: CFLAGS += -msse2
+$(BUILD_PFX)%_sse3.c.d: CFLAGS += -msse3
+$(BUILD_PFX)%_sse3.c.o: CFLAGS += -msse3
+$(BUILD_PFX)%_ssse3.c.d: CFLAGS += -mssse3
+$(BUILD_PFX)%_ssse3.c.o: CFLAGS += -mssse3
+$(BUILD_PFX)%_sse4.c.d: CFLAGS += -msse4.1
+$(BUILD_PFX)%_sse4.c.o: CFLAGS += -msse4.1
+
$(BUILD_PFX)%.c.d: %.c
$(if $(quiet),@echo " [DEP] $@")
$(qexec)mkdir -p $(dir $@)
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -266,12 +266,13 @@
fi
TMP_H="${TMPDIRx}/vpx-conf-$$-${RANDOM}.h"
TMP_C="${TMPDIRx}/vpx-conf-$$-${RANDOM}.c"
+TMP_CC="${TMPDIRx}/vpx-conf-$$-${RANDOM}.cc"
TMP_O="${TMPDIRx}/vpx-conf-$$-${RANDOM}.o"
TMP_X="${TMPDIRx}/vpx-conf-$$-${RANDOM}.x"
TMP_ASM="${TMPDIRx}/vpx-conf-$$-${RANDOM}.asm"
clean_temp_files() {
- rm -f ${TMP_C} ${TMP_H} ${TMP_O} ${TMP_X} ${TMP_ASM}
+ rm -f ${TMP_C} ${TMP_CC} ${TMP_H} ${TMP_O} ${TMP_X} ${TMP_ASM}
}
#
@@ -292,9 +293,9 @@
check_cxx() {
log check_cxx "$@"
- cat >${TMP_C}
- log_file ${TMP_C}
- check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_C}
+ cat >${TMP_CC}
+ log_file ${TMP_CC}
+ check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC}
}
check_cpp() {
@@ -1071,7 +1072,7 @@
tune_cflags="-march="
setup_gnu_toolchain
#for 32 bit x86 builds, -O3 did not turn on this flag
- enabled optimizations && check_add_cflags -fomit-frame-pointer
+ enabled optimizations && disabled gprof && check_add_cflags -fomit-frame-pointer
;;
vs*)
# When building with Microsoft Visual Studio the assembler is
--- a/configure
+++ b/configure
@@ -243,19 +243,11 @@
unistd_h
"
EXPERIMENT_LIST="
- csm
- new_mvref
- implicit_segmentation
- newbintramodes
- comp_interintra_pred
- enable_6tap
- abovesprefmv
- code_nonzerocount
- useselectrefmv
- modelcoefprob
- loop_dering
- implicit_compoundinter_weight
- scatterscan
+ oneshotq
+ multiple_arf
+ non420
+ alpha
+ balanced_coeftree
"
CONFIG_LIST="
external_build
@@ -608,7 +600,10 @@
check_add_cflags -Wimplicit-function-declaration
check_add_cflags -Wuninitialized
check_add_cflags -Wunused-variable
- check_add_cflags -Wunused-but-set-variable
+ case ${CC} in
+ *clang*) ;;
+ *) check_add_cflags -Wunused-but-set-variable ;;
+ esac
enabled extra_warnings || check_add_cflags -Wno-unused-function
fi
--- a/test/acm_random.h
+++ b/test/acm_random.h
@@ -34,6 +34,13 @@
return (value >> 24) & 0xff;
}
+ uint8_t Rand8Extremes(void) {
+ // Returns a random value near 0 or near 255, to better exercise
+ // saturation behavior.
+ const uint8_t r = Rand8();
+ return r < 128 ? r << 4 : r >> 4;
+ }
+
int PseudoUniform(int range) {
return random_.Generate(range);
}
--- /dev/null
+++ b/test/borders_test.cc
@@ -1,0 +1,86 @@
+/*
+ * Copyright (c) 2012 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 <climits>
+#include <vector>
+#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "test/codec_factory.h"
+#include "test/encode_test_driver.h"
+#include "test/i420_video_source.h"
+#include "test/util.h"
+
+namespace {
+
+class BordersTest : public ::libvpx_test::EncoderTest,
+ public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
+ protected:
+ BordersTest() : EncoderTest(GET_PARAM(0)) {}
+
+ virtual void SetUp() {
+ InitializeConfig();
+ SetMode(GET_PARAM(1));
+ }
+
+ virtual bool Continue() const {
+ return !HasFatalFailure() && !abort_;
+ }
+
+ virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) {
+ if ( video->frame() == 1) {
+ encoder->Control(VP8E_SET_CPUUSED, 0);
+ encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
+ encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7);
+ encoder->Control(VP8E_SET_ARNR_STRENGTH, 5);
+ encoder->Control(VP8E_SET_ARNR_TYPE, 3);
+ }
+ }
+
+ virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
+ }
+ }
+};
+
+TEST_P(BordersTest, TestEncodeHighBitrate) {
+ // Validate that this non multiple of 64 wide clip encodes and decodes
+ // without a mismatch when passing in a very low max q. This pushes
+ // the encoder to producing lots of big partitions which will likely
+ // extend into the border and test the border condition.
+ cfg_.g_lag_in_frames = 25;
+ cfg_.rc_2pass_vbr_minsection_pct = 5;
+ cfg_.rc_2pass_vbr_minsection_pct = 2000;
+ cfg_.rc_target_bitrate = 2000;
+ cfg_.rc_max_quantizer = 10;
+
+ ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
+ 40);
+
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+}
+TEST_P(BordersTest, TestLowBitrate) {
+ // Validate that this clip encodes and decodes without a mismatch
+ // when passing in a very high min q. This pushes the encoder to producing
+ // lots of small partitions which might will test the other condition.
+
+ cfg_.g_lag_in_frames = 25;
+ cfg_.rc_2pass_vbr_minsection_pct = 5;
+ cfg_.rc_2pass_vbr_minsection_pct = 2000;
+ cfg_.rc_target_bitrate = 200;
+ cfg_.rc_min_quantizer = 40;
+
+ ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0,
+ 40);
+
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+}
+
+VP9_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values(
+ ::libvpx_test::kTwoPassGood));
+} // namespace
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -8,6 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "test/acm_random.h"
+#include "test/register_state_check.h"
+#include "test/util.h"
+#include "third_party/googletest/src/include/gtest/gtest.h"
extern "C" {
#include "./vpx_config.h"
@@ -16,10 +20,6 @@
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h"
}
-#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
-#include "test/register_state_check.h"
-#include "test/util.h"
namespace {
typedef void (*convolve_fn_t)(const uint8_t *src, int src_stride,
@@ -46,20 +46,20 @@
// Reference 8-tap subpixel filter, slightly modified to fit into this test.
#define VP9_FILTER_WEIGHT 128
#define VP9_FILTER_SHIFT 7
-static uint8_t clip_pixel(int x) {
+uint8_t clip_pixel(int x) {
return x < 0 ? 0 :
x > 255 ? 255 :
x;
}
-static void filter_block2d_8_c(const uint8_t *src_ptr,
- const unsigned int src_stride,
- const int16_t *HFilter,
- const int16_t *VFilter,
- uint8_t *dst_ptr,
- unsigned int dst_stride,
- unsigned int output_width,
- unsigned int output_height) {
+void filter_block2d_8_c(const uint8_t *src_ptr,
+ const unsigned int src_stride,
+ const int16_t *HFilter,
+ const int16_t *VFilter,
+ uint8_t *dst_ptr,
+ unsigned int dst_stride,
+ unsigned int output_width,
+ unsigned int output_height) {
// Between passes, we use an intermediate buffer whose height is extended to
// have enough horizontally filtered values as input for the vertical pass.
// This buffer is allocated to be big enough for the largest block type we
@@ -66,7 +66,7 @@
// support.
const int kInterp_Extend = 4;
const unsigned int intermediate_height =
- (kInterp_Extend - 1) + output_height + kInterp_Extend;
+ (kInterp_Extend - 1) + output_height + kInterp_Extend;
/* Size of intermediate_buffer is max_intermediate_height * filter_max_width,
* where max_intermediate_height = (kInterp_Extend - 1) + filter_max_height
@@ -75,7 +75,7 @@
* = 23
* and filter_max_width = 16
*/
- uint8_t intermediate_buffer[23 * 16];
+ uint8_t intermediate_buffer[71 * 64];
const int intermediate_next_stride = 1 - intermediate_height * output_width;
// Horizontal pass (src -> transposed intermediate).
@@ -87,15 +87,15 @@
for (i = 0; i < intermediate_height; ++i) {
for (j = 0; j < output_width; ++j) {
// Apply filter...
- int temp = ((int)src_ptr[0] * HFilter[0]) +
- ((int)src_ptr[1] * HFilter[1]) +
- ((int)src_ptr[2] * HFilter[2]) +
- ((int)src_ptr[3] * HFilter[3]) +
- ((int)src_ptr[4] * HFilter[4]) +
- ((int)src_ptr[5] * HFilter[5]) +
- ((int)src_ptr[6] * HFilter[6]) +
- ((int)src_ptr[7] * HFilter[7]) +
- (VP9_FILTER_WEIGHT >> 1); // Rounding
+ const int temp = (src_ptr[0] * HFilter[0]) +
+ (src_ptr[1] * HFilter[1]) +
+ (src_ptr[2] * HFilter[2]) +
+ (src_ptr[3] * HFilter[3]) +
+ (src_ptr[4] * HFilter[4]) +
+ (src_ptr[5] * HFilter[5]) +
+ (src_ptr[6] * HFilter[6]) +
+ (src_ptr[7] * HFilter[7]) +
+ (VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255...
*output_ptr = clip_pixel(temp >> VP9_FILTER_SHIFT);
@@ -115,15 +115,15 @@
for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) {
// Apply filter...
- int temp = ((int)src_ptr[0] * VFilter[0]) +
- ((int)src_ptr[1] * VFilter[1]) +
- ((int)src_ptr[2] * VFilter[2]) +
- ((int)src_ptr[3] * VFilter[3]) +
- ((int)src_ptr[4] * VFilter[4]) +
- ((int)src_ptr[5] * VFilter[5]) +
- ((int)src_ptr[6] * VFilter[6]) +
- ((int)src_ptr[7] * VFilter[7]) +
- (VP9_FILTER_WEIGHT >> 1); // Rounding
+ const int temp = (src_ptr[0] * VFilter[0]) +
+ (src_ptr[1] * VFilter[1]) +
+ (src_ptr[2] * VFilter[2]) +
+ (src_ptr[3] * VFilter[3]) +
+ (src_ptr[4] * VFilter[4]) +
+ (src_ptr[5] * VFilter[5]) +
+ (src_ptr[6] * VFilter[6]) +
+ (src_ptr[7] * VFilter[7]) +
+ (VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255...
*dst_ptr++ = clip_pixel(temp >> VP9_FILTER_SHIFT);
@@ -135,12 +135,12 @@
}
}
-static void block2d_average_c(uint8_t *src,
- unsigned int src_stride,
- uint8_t *output_ptr,
- unsigned int output_stride,
- unsigned int output_width,
- unsigned int output_height) {
+void block2d_average_c(uint8_t *src,
+ unsigned int src_stride,
+ uint8_t *output_ptr,
+ unsigned int output_stride,
+ unsigned int output_width,
+ unsigned int output_height) {
unsigned int i, j;
for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) {
@@ -150,21 +150,21 @@
}
}
-static void filter_average_block2d_8_c(const uint8_t *src_ptr,
- const unsigned int src_stride,
- const int16_t *HFilter,
- const int16_t *VFilter,
- uint8_t *dst_ptr,
- unsigned int dst_stride,
- unsigned int output_width,
- unsigned int output_height) {
- uint8_t tmp[16*16];
+void filter_average_block2d_8_c(const uint8_t *src_ptr,
+ const unsigned int src_stride,
+ const int16_t *HFilter,
+ const int16_t *VFilter,
+ uint8_t *dst_ptr,
+ unsigned int dst_stride,
+ unsigned int output_width,
+ unsigned int output_height) {
+ uint8_t tmp[64 * 64];
- assert(output_width <= 16);
- assert(output_height <= 16);
- filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 16,
+ assert(output_width <= 64);
+ assert(output_height <= 64);
+ filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
output_width, output_height);
- block2d_average_c(tmp, 16, dst_ptr, dst_stride,
+ block2d_average_c(tmp, 64, dst_ptr, dst_stride,
output_width, output_height);
}
@@ -173,10 +173,9 @@
static void SetUpTestCase() {
// Force input_ to be unaligned, output to be 16 byte aligned.
input_ = reinterpret_cast<uint8_t*>(
- vpx_memalign(kDataAlignment, kOuterBlockSize * kOuterBlockSize + 1))
- + 1;
+ vpx_memalign(kDataAlignment, kInputBufferSize + 1)) + 1;
output_ = reinterpret_cast<uint8_t*>(
- vpx_memalign(kDataAlignment, kOuterBlockSize * kOuterBlockSize));
+ vpx_memalign(kDataAlignment, kOutputBufferSize));
}
static void TearDownTestCase() {
@@ -186,62 +185,63 @@
output_ = NULL;
}
- protected:
- static const int kDataAlignment = 16;
- static const int kOuterBlockSize = 32;
- static const int kInputStride = kOuterBlockSize;
- static const int kOutputStride = kOuterBlockSize;
- static const int kMaxDimension = 16;
+ protected:
+ static const int kDataAlignment = 16;
+ static const int kOuterBlockSize = 128;
+ static const int kInputStride = kOuterBlockSize;
+ static const int kOutputStride = kOuterBlockSize;
+ static const int kMaxDimension = 64;
+ static const int kInputBufferSize = kOuterBlockSize * kOuterBlockSize;
+ static const int kOutputBufferSize = kOuterBlockSize * kOuterBlockSize;
- int Width() const { return GET_PARAM(0); }
- int Height() const { return GET_PARAM(1); }
- int BorderLeft() const {
- const int center = (kOuterBlockSize - Width()) / 2;
- return (center + (kDataAlignment - 1)) & ~(kDataAlignment - 1);
- }
- int BorderTop() const { return (kOuterBlockSize - Height()) / 2; }
+ int Width() const { return GET_PARAM(0); }
+ int Height() const { return GET_PARAM(1); }
+ int BorderLeft() const {
+ const int center = (kOuterBlockSize - Width()) / 2;
+ return (center + (kDataAlignment - 1)) & ~(kDataAlignment - 1);
+ }
+ int BorderTop() const { return (kOuterBlockSize - Height()) / 2; }
- bool IsIndexInBorder(int i) {
- return (i < BorderTop() * kOuterBlockSize ||
- i >= (BorderTop() + Height()) * kOuterBlockSize ||
- i % kOuterBlockSize < BorderLeft() ||
- i % kOuterBlockSize >= (BorderLeft() + Width()));
- }
+ bool IsIndexInBorder(int i) {
+ return (i < BorderTop() * kOuterBlockSize ||
+ i >= (BorderTop() + Height()) * kOuterBlockSize ||
+ i % kOuterBlockSize < BorderLeft() ||
+ i % kOuterBlockSize >= (BorderLeft() + Width()));
+ }
- virtual void SetUp() {
- UUT_ = GET_PARAM(2);
- memset(input_, 0, sizeof(input_));
- /* Set up guard blocks for an inner block cetered in the outer block */
- for (int i = 0; i < kOuterBlockSize * kOuterBlockSize; ++i) {
- if (IsIndexInBorder(i))
- output_[i] = 255;
- else
- output_[i] = 0;
- }
-
- ::libvpx_test::ACMRandom prng;
- for (int i = 0; i < kOuterBlockSize * kOuterBlockSize; ++i)
- input_[i] = prng.Rand8();
+ virtual void SetUp() {
+ UUT_ = GET_PARAM(2);
+ /* Set up guard blocks for an inner block cetered in the outer block */
+ for (int i = 0; i < kOutputBufferSize; ++i) {
+ if (IsIndexInBorder(i))
+ output_[i] = 255;
+ else
+ output_[i] = 0;
}
- void CheckGuardBlocks() {
- for (int i = 0; i < kOuterBlockSize * kOuterBlockSize; ++i) {
- if (IsIndexInBorder(i))
- EXPECT_EQ(255, output_[i]);
- }
- }
+ ::libvpx_test::ACMRandom prng;
+ for (int i = 0; i < kInputBufferSize; ++i)
+ input_[i] = prng.Rand8Extremes();
+ }
- uint8_t* input() {
- return input_ + BorderTop() * kOuterBlockSize + BorderLeft();
+ void CheckGuardBlocks() {
+ for (int i = 0; i < kOutputBufferSize; ++i) {
+ if (IsIndexInBorder(i))
+ EXPECT_EQ(255, output_[i]);
}
+ }
- uint8_t* output() {
- return output_ + BorderTop() * kOuterBlockSize + BorderLeft();
- }
+ uint8_t* input() const {
+ return input_ + BorderTop() * kOuterBlockSize + BorderLeft();
+ }
- const ConvolveFunctions* UUT_;
- static uint8_t* input_;
- static uint8_t* output_;
+ uint8_t* output() const {
+ return output_ + BorderTop() * kOuterBlockSize + BorderLeft();
+ }
+
+ const ConvolveFunctions* UUT_;
+ static uint8_t* input_;
+ static uint8_t* output_;
};
uint8_t* ConvolveTest::input_ = NULL;
uint8_t* ConvolveTest::output_ = NULL;
@@ -303,12 +303,34 @@
const int16_t (*kTestFilterList[])[8] = {
vp9_bilinear_filters,
- vp9_sub_pel_filters_6,
vp9_sub_pel_filters_8,
vp9_sub_pel_filters_8s,
vp9_sub_pel_filters_8lp
};
+const int kNumFilterBanks = sizeof(kTestFilterList) /
+ sizeof(kTestFilterList[0]);
+const int kNumFilters = 16;
+TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
+ for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
+ const int16_t (*filters)[8] = kTestFilterList[filter_bank];
+ for (int i = 0; i < kNumFilters; i++) {
+ const int p0 = filters[i][0] + filters[i][1];
+ const int p1 = filters[i][2] + filters[i][3];
+ const int p2 = filters[i][4] + filters[i][5];
+ const int p3 = filters[i][6] + filters[i][7];
+ EXPECT_LE(p0, 128);
+ EXPECT_LE(p1, 128);
+ EXPECT_LE(p2, 128);
+ EXPECT_LE(p3, 128);
+ EXPECT_LE(p0 + p3, 128);
+ EXPECT_LE(p0 + p3 + p1, 128);
+ EXPECT_LE(p0 + p3 + p1 + p2, 128);
+ EXPECT_EQ(p0 + p1 + p2 + p3, 128);
+ }
+ }
+}
+
const int16_t kInvalidFilter[8] = { 0 };
TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
@@ -316,12 +338,9 @@
uint8_t* const out = output();
uint8_t ref[kOutputStride * kMaxDimension];
- const int kNumFilterBanks = sizeof(kTestFilterList) /
- sizeof(kTestFilterList[0]);
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
const int16_t (*filters)[8] = kTestFilterList[filter_bank];
- const int kNumFilters = 16;
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
@@ -368,7 +387,7 @@
::libvpx_test::ACMRandom prng;
for (int y = 0; y < Height(); ++y) {
for (int x = 0; x < Width(); ++x) {
- const uint8_t r = prng.Rand8();
+ const uint8_t r = prng.Rand8Extremes();
out[y * kOutputStride + x] = r;
ref[y * kOutputStride + x] = r;
@@ -440,6 +459,7 @@
TEST_P(ConvolveTest, ChangeFilterWorks) {
uint8_t* const in = input();
uint8_t* const out = output();
+ const int kPixelSelected = 4;
REGISTER_STATE_CHECK(UUT_->h8_(in, kInputStride, out, kOutputStride,
kChangeFilters[8], 17, kChangeFilters[4], 16,
@@ -446,10 +466,10 @@
Width(), Height()));
for (int x = 0; x < Width(); ++x) {
- if (x < 8)
- ASSERT_EQ(in[4], out[x]) << "x == " << x;
- else
- ASSERT_EQ(in[12], out[x]) << "x == " << x;
+ const int kQ4StepAdjust = x >> 4;
+ const int kFilterPeriodAdjust = (x >> 3) << 3;
+ const int ref_x = kQ4StepAdjust + kFilterPeriodAdjust + kPixelSelected;
+ ASSERT_EQ(in[ref_x], out[x]) << "x == " << x;
}
REGISTER_STATE_CHECK(UUT_->v8_(in, kInputStride, out, kOutputStride,
@@ -457,10 +477,10 @@
Width(), Height()));
for (int y = 0; y < Height(); ++y) {
- if (y < 8)
- ASSERT_EQ(in[4 * kInputStride], out[y * kOutputStride]) << "y == " << y;
- else
- ASSERT_EQ(in[12 * kInputStride], out[y * kOutputStride]) << "y == " << y;
+ const int kQ4StepAdjust = y >> 4;
+ const int kFilterPeriodAdjust = (y >> 3) << 3;
+ const int ref_y = kQ4StepAdjust + kFilterPeriodAdjust + kPixelSelected;
+ ASSERT_EQ(in[ref_y * kInputStride], out[y * kInputStride]) << "y == " << y;
}
REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride,
@@ -468,9 +488,13 @@
Width(), Height()));
for (int y = 0; y < Height(); ++y) {
+ const int kQ4StepAdjustY = y >> 4;
+ const int kFilterPeriodAdjustY = (y >> 3) << 3;
+ const int ref_y = kQ4StepAdjustY + kFilterPeriodAdjustY + kPixelSelected;
for (int x = 0; x < Width(); ++x) {
- const int ref_x = x < 8 ? 4 : 12;
- const int ref_y = y < 8 ? 4 : 12;
+ const int kQ4StepAdjustX = x >> 4;
+ const int kFilterPeriodAdjustX = (x >> 3) << 3;
+ const int ref_x = kQ4StepAdjustX + kFilterPeriodAdjustX + kPixelSelected;
ASSERT_EQ(in[ref_y * kInputStride + ref_x], out[y * kOutputStride + x])
<< "x == " << x << ", y == " << y;
@@ -489,10 +513,17 @@
INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::Values(
make_tuple(4, 4, &convolve8_c),
make_tuple(8, 4, &convolve8_c),
+ make_tuple(4, 8, &convolve8_c),
make_tuple(8, 8, &convolve8_c),
make_tuple(16, 8, &convolve8_c),
- make_tuple(16, 16, &convolve8_c)));
-}
+ make_tuple(8, 16, &convolve8_c),
+ make_tuple(16, 16, &convolve8_c),
+ make_tuple(32, 16, &convolve8_c),
+ make_tuple(16, 32, &convolve8_c),
+ make_tuple(32, 32, &convolve8_c),
+ make_tuple(64, 32, &convolve8_c),
+ make_tuple(32, 64, &convolve8_c),
+ make_tuple(64, 64, &convolve8_c)));
#if HAVE_SSSE3
const ConvolveFunctions convolve8_ssse3(
@@ -503,7 +534,16 @@
INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, ::testing::Values(
make_tuple(4, 4, &convolve8_ssse3),
make_tuple(8, 4, &convolve8_ssse3),
+ make_tuple(4, 8, &convolve8_ssse3),
make_tuple(8, 8, &convolve8_ssse3),
make_tuple(16, 8, &convolve8_ssse3),
- make_tuple(16, 16, &convolve8_ssse3)));
+ make_tuple(8, 16, &convolve8_ssse3),
+ make_tuple(16, 16, &convolve8_ssse3),
+ make_tuple(32, 16, &convolve8_ssse3),
+ make_tuple(16, 32, &convolve8_ssse3),
+ make_tuple(32, 32, &convolve8_ssse3),
+ make_tuple(64, 32, &convolve8_ssse3),
+ make_tuple(32, 64, &convolve8_ssse3),
+ make_tuple(64, 64, &convolve8_ssse3)));
#endif
+} // namespace
--- a/test/dct16x16_test.cc
+++ b/test/dct16x16_test.cc
@@ -17,6 +17,7 @@
extern "C" {
#include "vp9/common/vp9_entropy.h"
#include "vp9_rtcd.h"
+void vp9_short_idct16x16_add_c(short *input, uint8_t *output, int pitch);
}
#include "acm_random.h"
@@ -269,19 +270,23 @@
const int count_test_block = 1000;
for (int i = 0; i < count_test_block; ++i) {
int16_t in[256], coeff[256];
- int16_t out_c[256];
+ uint8_t dst[256], src[256];
double out_r[256];
+ for (int j = 0; j < 256; ++j) {
+ src[j] = rnd.Rand8();
+ dst[j] = rnd.Rand8();
+ }
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 256; ++j)
- in[j] = rnd.Rand8() - rnd.Rand8();
+ in[j] = src[j] - dst[j];
reference_16x16_dct_2d(in, out_r);
for (int j = 0; j < 256; j++)
coeff[j] = round(out_r[j]);
- vp9_short_idct16x16_c(coeff, out_c, 32);
+ vp9_short_idct16x16_add_c(coeff, dst, 16);
for (int j = 0; j < 256; ++j) {
- const int diff = out_c[j] - in[j];
+ const int diff = dst[j] - src[j];
const int error = diff * diff;
EXPECT_GE(1, error)
<< "Error: 16x16 IDCT has error " << error
@@ -289,7 +294,7 @@
}
}
}
-#if 1
+
// we need enable fdct test once we re-do the 16 point fdct.
TEST(VP9Fdct16x16Test, AccuracyCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
@@ -299,18 +304,22 @@
for (int i = 0; i < count_test_block; ++i) {
int16_t test_input_block[256];
int16_t test_temp_block[256];
- int16_t test_output_block[256];
+ uint8_t dst[256], src[256];
+ for (int j = 0; j < 256; ++j) {
+ src[j] = rnd.Rand8();
+ dst[j] = rnd.Rand8();
+ }
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 256; ++j)
- test_input_block[j] = rnd.Rand8() - rnd.Rand8();
+ test_input_block[j] = src[j] - dst[j];
const int pitch = 32;
vp9_short_fdct16x16_c(test_input_block, test_temp_block, pitch);
- vp9_short_idct16x16_c(test_temp_block, test_output_block, pitch);
+ vp9_short_idct16x16_add_c(test_temp_block, dst, 16);
for (int j = 0; j < 256; ++j) {
- const int diff = test_input_block[j] - test_output_block[j];
+ const int diff = dst[j] - src[j];
const int error = diff * diff;
if (max_error < error)
max_error = error;
@@ -354,6 +363,4 @@
}
}
}
-#endif
-
} // namespace
--- a/test/dct32x32_test.cc
+++ b/test/dct32x32_test.cc
@@ -18,7 +18,7 @@
#include "vp9/common/vp9_entropy.h"
#include "./vp9_rtcd.h"
void vp9_short_fdct32x32_c(int16_t *input, int16_t *out, int pitch);
- void vp9_short_idct32x32_c(short *input, short *output, int pitch);
+ void vp9_short_idct32x32_add_c(short *input, uint8_t *output, int pitch);
}
#include "test/acm_random.h"
@@ -91,28 +91,31 @@
}
}
-
TEST(VP9Idct32x32Test, AccuracyCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int count_test_block = 1000;
for (int i = 0; i < count_test_block; ++i) {
int16_t in[1024], coeff[1024];
- int16_t out_c[1024];
+ uint8_t dst[1024], src[1024];
double out_r[1024];
+ for (int j = 0; j < 1024; ++j) {
+ src[j] = rnd.Rand8();
+ dst[j] = rnd.Rand8();
+ }
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 1024; ++j)
- in[j] = rnd.Rand8() - rnd.Rand8();
+ in[j] = src[j] - dst[j];
reference_32x32_dct_2d(in, out_r);
for (int j = 0; j < 1024; j++)
coeff[j] = round(out_r[j]);
- vp9_short_idct32x32_c(coeff, out_c, 64);
+ vp9_short_idct32x32_add_c(coeff, dst, 32);
for (int j = 0; j < 1024; ++j) {
- const int diff = out_c[j] - in[j];
+ const int diff = dst[j] - src[j];
const int error = diff * diff;
EXPECT_GE(1, error)
- << "Error: 3x32 IDCT has error " << error
+ << "Error: 32x32 IDCT has error " << error
<< " at index " << j;
}
}
@@ -126,18 +129,22 @@
for (int i = 0; i < count_test_block; ++i) {
int16_t test_input_block[1024];
int16_t test_temp_block[1024];
- int16_t test_output_block[1024];
+ uint8_t dst[1024], src[1024];
+ for (int j = 0; j < 1024; ++j) {
+ src[j] = rnd.Rand8();
+ dst[j] = rnd.Rand8();
+ }
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 1024; ++j)
- test_input_block[j] = rnd.Rand8() - rnd.Rand8();
+ test_input_block[j] = src[j] - dst[j];
const int pitch = 64;
vp9_short_fdct32x32_c(test_input_block, test_temp_block, pitch);
- vp9_short_idct32x32_c(test_temp_block, test_output_block, pitch);
+ vp9_short_idct32x32_add_c(test_temp_block, dst, 32);
for (int j = 0; j < 1024; ++j) {
- const unsigned diff = test_input_block[j] - test_output_block[j];
+ const unsigned diff = dst[j] - src[j];
const unsigned error = diff * diff;
if (max_error < error)
max_error = error;
--- a/test/encode_test_driver.h
+++ b/test/encode_test_driver.h
@@ -10,9 +10,10 @@
#ifndef TEST_ENCODE_TEST_DRIVER_H_
#define TEST_ENCODE_TEST_DRIVER_H_
-#include "./vpx_config.h"
#include <string>
#include <vector>
+
+#include "./vpx_config.h"
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "vpx/vpx_encoder.h"
@@ -46,7 +47,7 @@
class CxDataIterator {
public:
explicit CxDataIterator(vpx_codec_ctx_t *encoder)
- : encoder_(encoder), iter_(NULL) {}
+ : encoder_(encoder), iter_(NULL) {}
const vpx_codec_cx_pkt_t *Next() {
return vpx_codec_get_cx_data(encoder_, &iter_);
@@ -92,7 +93,7 @@
memset(&encoder_, 0, sizeof(encoder_));
}
- ~Encoder() {
+ virtual ~Encoder() {
vpx_codec_destroy(&encoder_);
}
--- a/test/error_resilience_test.cc
+++ b/test/error_resilience_test.cc
@@ -206,11 +206,17 @@
// reset previously set error/droppable frames
Reset();
+#if 0
+ // TODO(jkoleszar): This test is disabled for the time being as too
+ // sensitive. It's not clear how to set a reasonable threshold for
+ // this behavior.
+
// Now set an arbitrary set of error frames that are non-droppable
unsigned int num_error_frames = 3;
unsigned int error_frame_list[] = {3, 10, 20};
SetErrorFrames(num_error_frames, error_frame_list);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+
// Test that dropping an arbitrary set of inter frames does not hurt too much
// Note the Average Mismatch PSNR is the average of the PSNR between
// decoded frame and encoder's version of the same frame for all frames
@@ -219,6 +225,7 @@
std::cout << " Mismatch PSNR: "
<< psnr_resilience_mismatch << "\n";
EXPECT_GT(psnr_resilience_mismatch, 20.0);
+#endif
}
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES);
--- a/test/fdct4x4_test.cc
+++ b/test/fdct4x4_test.cc
@@ -96,11 +96,15 @@
for (int i = 0; i < count_test_block; ++i) {
int16_t test_input_block[16];
int16_t test_temp_block[16];
- int16_t test_output_block[16];
+ uint8_t dst[16], src[16];
+ for (int j = 0; j < 16; ++j) {
+ src[j] = rnd.Rand8();
+ dst[j] = rnd.Rand8();
+ }
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 16; ++j)
- test_input_block[j] = rnd.Rand8() - rnd.Rand8();
+ test_input_block[j] = src[j] - dst[j];
// TODO(Yaowu): this should be converted to a parameterized test
// to test optimized versions of this function.
@@ -120,10 +124,10 @@
}
// Because the bitstream is not frozen yet, use the idct in the codebase.
- vp9_short_idct4x4_c(test_temp_block, test_output_block, pitch);
+ vp9_short_idct4x4_add_c(test_temp_block, dst, 4);
for (int j = 0; j < 16; ++j) {
- const int diff = test_input_block[j] - test_output_block[j];
+ const int diff = dst[j] - src[j];
const int error = diff * diff;
if (max_error < error)
max_error = error;
--- a/test/fdct8x8_test.cc
+++ b/test/fdct8x8_test.cc
@@ -16,6 +16,7 @@
extern "C" {
#include "vp9_rtcd.h"
+void vp9_short_idct8x8_add_c(short *input, uint8_t *output, int pitch);
}
#include "acm_random.h"
@@ -100,11 +101,15 @@
for (int i = 0; i < count_test_block; ++i) {
int16_t test_input_block[64];
int16_t test_temp_block[64];
- int16_t test_output_block[64];
+ uint8_t dst[64], src[64];
+ for (int j = 0; j < 64; ++j) {
+ src[j] = rnd.Rand8();
+ dst[j] = rnd.Rand8();
+ }
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 64; ++j)
- test_input_block[j] = rnd.Rand8() - rnd.Rand8();
+ test_input_block[j] = src[j] - dst[j];
const int pitch = 16;
vp9_short_fdct8x8_c(test_input_block, test_temp_block, pitch);
@@ -119,10 +124,10 @@
test_temp_block[j] *= 4;
}
}
- vp9_short_idct8x8_c(test_temp_block, test_output_block, pitch);
+ vp9_short_idct8x8_add_c(test_temp_block, dst, 8);
for (int j = 0; j < 64; ++j) {
- const int diff = test_input_block[j] - test_output_block[j];
+ const int diff = dst[j] - src[j];
const int error = diff * diff;
if (max_error < error)
max_error = error;
@@ -145,18 +150,22 @@
for (int i = 0; i < count_test_block; ++i) {
int16_t test_input_block[64];
int16_t test_temp_block[64];
- int16_t test_output_block[64];
+ uint8_t dst[64], src[64];
- // Initialize a test block with input range {-255, 255}.
+ for (int j = 0; j < 64; ++j) {
+ src[j] = rnd.Rand8() % 2 ? 255 : 0;
+ dst[j] = src[j] > 0 ? 0 : 255;
+ }
+ // Initialize a test block with input range [-255, 255].
for (int j = 0; j < 64; ++j)
- test_input_block[j] = rnd.Rand8() % 2 ? 255 : -256;
+ test_input_block[j] = src[j] - dst[j];
const int pitch = 16;
vp9_short_fdct8x8_c(test_input_block, test_temp_block, pitch);
- vp9_short_idct8x8_c(test_temp_block, test_output_block, pitch);
+ vp9_short_idct8x8_add_c(test_temp_block, dst, 8);
for (int j = 0; j < 64; ++j) {
- const int diff = test_input_block[j] - test_output_block[j];
+ const int diff = dst[j] - src[j];
const int error = diff * diff;
if (max_error < error)
max_error = error;
--- a/test/i420_video_source.h
+++ b/test/i420_video_source.h
@@ -83,7 +83,7 @@
void SetSize(unsigned int width, unsigned int height) {
if (width != width_ || height != height_) {
vpx_img_free(img_);
- img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_VPXI420, width, height, 1);
+ img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_I420, width, height, 1);
ASSERT_TRUE(img_ != NULL);
width_ = width;
height_ = height;
--- a/test/idct8x8_test.cc
+++ b/test/idct8x8_test.cc
@@ -112,20 +112,23 @@
const int count_test_block = 10000;
for (int i = 0; i < count_test_block; ++i) {
int16_t input[64], coeff[64];
- int16_t output_c[64];
double output_r[64];
+ uint8_t dst[64], src[64];
+ for (int j = 0; j < 64; ++j) {
+ src[j] = rnd.Rand8();
+ dst[j] = rnd.Rand8();
+ }
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 64; ++j)
- input[j] = rnd.Rand8() - rnd.Rand8();
+ input[j] = src[j] - dst[j];
- const int pitch = 16;
reference_dct_2d(input, output_r);
for (int j = 0; j < 64; ++j)
coeff[j] = round(output_r[j]);
- vp9_short_idct8x8_c(coeff, output_c, pitch);
+ vp9_short_idct8x8_add_c(coeff, dst, 8);
for (int j = 0; j < 64; ++j) {
- const int diff = output_c[j] -input[j];
+ const int diff = dst[j] - src[j];
const int error = diff * diff;
EXPECT_GE(1, error)
<< "Error: 8x8 FDCT/IDCT has error " << error
--- a/test/superframe_test.cc
+++ b/test/superframe_test.cc
@@ -30,7 +30,7 @@
}
virtual void TearDown() {
- delete modified_buf_;
+ delete[] modified_buf_;
}
virtual bool Continue() const {
@@ -59,7 +59,7 @@
buffer[pkt->data.frame.sz - index_sz] == marker) {
// frame is a superframe. strip off the index.
if (modified_buf_)
- delete modified_buf_;
+ delete[] modified_buf_;
modified_buf_ = new uint8_t[pkt->data.frame.sz - index_sz];
memcpy(modified_buf_, pkt->data.frame.buf,
pkt->data.frame.sz - index_sz);
--- a/test/test-data.sha1
+++ b/test/test-data.sha1
@@ -1,4 +1,5 @@
d5dfb0151c9051f8c85999255645d7a23916d3c0 hantro_collage_w352h288.yuv
+b87815bf86020c592ccc7a846ba2e28ec8043902 hantro_odd.yuv
5184c46ddca8b1fadd16742e8500115bc8f749da vp80-00-comprehensive-001.ivf
65bf1bbbced81b97bd030f376d1b7f61a224793f vp80-00-comprehensive-002.ivf
906b4c1e99eb734504c504b3f1ad8052137ce672 vp80-00-comprehensive-003.ivf
@@ -120,4 +121,4 @@
41d70bb5fa45bc88da1604a0af466930b8dd77b5 vp80-05-sharpness-1438.ivf.md5
086c56378df81b6cee264d7540a7b8f2b405c7a4 vp80-05-sharpness-1439.ivf.md5
d32dc2c4165eb266ea4c23c14a45459b363def32 vp80-05-sharpness-1440.ivf.md5
-8c69dc3d8e563f56ffab5ad1e400d9e689dd23df vp80-05-sharpness-1443.ivf.md5
\ No newline at end of file
+8c69dc3d8e563f56ffab5ad1e400d9e689dd23df vp80-05-sharpness-1443.ivf.md5
--- a/test/test.mk
+++ b/test/test.mk
@@ -22,6 +22,7 @@
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += error_resilience_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += i420_video_source.h
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += borders_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += resize_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../md5_utils.h ../md5_utils.c
@@ -92,6 +93,7 @@
## TEST DATA
##
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_collage_w352h288.yuv
+LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_odd.yuv
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf
--- a/test/tile_independence_test.cc
+++ b/test/tile_independence_test.cc
@@ -56,7 +56,13 @@
void UpdateMD5(::libvpx_test::Decoder *dec, const vpx_codec_cx_pkt_t *pkt,
::libvpx_test::MD5 *md5) {
- dec->DecodeFrame((uint8_t *) pkt->data.frame.buf, pkt->data.frame.sz);
+ const vpx_codec_err_t res =
+ dec->DecodeFrame(reinterpret_cast<uint8_t*>(pkt->data.frame.buf),
+ pkt->data.frame.sz);
+ if (res != VPX_CODEC_OK) {
+ abort_ = true;
+ ASSERT_EQ(VPX_CODEC_OK, res);
+ }
const vpx_image_t *img = dec->GetDxData().Next();
md5->Add(img);
}
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -188,11 +188,11 @@
#endif
#if HAVE_SSE2
-const vp9_variance_fn_t variance4x4_wmt = vp9_variance4x4_wmt;
-const vp9_variance_fn_t variance8x8_wmt = vp9_variance8x8_wmt;
-const vp9_variance_fn_t variance8x16_wmt = vp9_variance8x16_wmt;
-const vp9_variance_fn_t variance16x8_wmt = vp9_variance16x8_wmt;
-const vp9_variance_fn_t variance16x16_wmt = vp9_variance16x16_wmt;
+const vp9_variance_fn_t variance4x4_wmt = vp9_variance4x4_sse2;
+const vp9_variance_fn_t variance8x8_wmt = vp9_variance8x8_sse2;
+const vp9_variance_fn_t variance8x16_wmt = vp9_variance8x16_sse2;
+const vp9_variance_fn_t variance16x8_wmt = vp9_variance16x8_sse2;
+const vp9_variance_fn_t variance16x16_wmt = vp9_variance16x16_sse2;
INSTANTIATE_TEST_CASE_P(
SSE2, VP9VarianceTest,
::testing::Values(make_tuple(4, 4, variance4x4_wmt),
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -103,7 +103,7 @@
if (width != width_ || height != height_) {
vpx_img_free(img_);
raw_sz_ = ((width + 31)&~31) * height * 3 / 2;
- img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_VPXI420, width, height, 32);
+ img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_I420, width, height, 32);
width_ = width;
height_ = height;
}
--- a/test/vp9_boolcoder_test.cc
+++ b/test/vp9_boolcoder_test.cc
@@ -52,7 +52,7 @@
const int random_seed = 6432;
const int buffer_size = 10000;
ACMRandom bit_rnd(random_seed);
- BOOL_CODER bw;
+ vp9_writer bw;
uint8_t bw_buffer[buffer_size];
vp9_start_encode(&bw, bw_buffer);
@@ -63,13 +63,16 @@
} else if (bit_method == 3) {
bit = bit_rnd(2);
}
- encode_bool(&bw, bit, static_cast<int>(probas[i]));
+ vp9_write(&bw, bit, static_cast<int>(probas[i]));
}
vp9_stop_encode(&bw);
- BOOL_DECODER br;
- vp9_start_decode(&br, bw_buffer, buffer_size);
+ // First bit should be zero
+ GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0);
+
+ vp9_reader br;
+ vp9_reader_init(&br, bw_buffer, buffer_size);
bit_rnd.Reset(random_seed);
for (int i = 0; i < bits_to_test; ++i) {
if (bit_method == 2) {
@@ -77,7 +80,7 @@
} else if (bit_method == 3) {
bit = bit_rnd(2);
}
- GTEST_ASSERT_EQ(decode_bool(&br, probas[i]), bit)
+ GTEST_ASSERT_EQ(vp9_read(&br, probas[i]), bit)
<< "pos: " << i << " / " << bits_to_test
<< " bit_method: " << bit_method
<< " method: " << method;
--- a/third_party/libyuv/source/scale.c
+++ b/third_party/libyuv/source/scale.c
@@ -632,7 +632,7 @@
{ 65536 / 3, 65536 / 3, 65536 / 2, 65536 / 3, 65536 / 3, 65536 / 2, 0, 0 };
#endif
-#if defined(_M_IX86) && !defined(YUV_DISABLE_ASM)
+#if defined(_M_IX86) && !defined(YUV_DISABLE_ASM) && defined(_MSC_VER)
#define HAS_SCALEROWDOWN2_SSE2
// Reads 32 pixels, throws half away and writes 16 pixels.
--- a/tools/cpplint.py
+++ b/tools/cpplint.py
@@ -53,12 +53,8 @@
# - Check for 0 in char context (should be '\0')
# - Check for camel-case method name conventions for methods
# that are not simple inline getters and setters
-# - Check that base classes have virtual destructors
-# put " // namespace" after } that closes a namespace, with
-# namespace's name after 'namespace' if it is named.
# - Do not indent namespace contents
# - Avoid inlining non-trivial constructors in header files
-# include base/basictypes.h if DISALLOW_EVIL_CONSTRUCTORS is used
# - Check for old-school (void) cast for call-sites of functions
# ignored return value
# - Check gUnit usage of anonymous namespace
@@ -80,6 +76,7 @@
"""
import codecs
+import copy
import getopt
import math # for log
import os
@@ -139,6 +136,22 @@
the top-level categories like 'build' and 'whitespace' will
also be printed. If 'detailed' is provided, then a count
is provided for each category like 'build/class'.
+
+ root=subdir
+ The root directory used for deriving header guard CPP variable.
+ By default, the header guard CPP variable is calculated as the relative
+ path to the directory that contains .git, .hg, or .svn. When this flag
+ is specified, the relative path is calculated from the specified
+ directory. If the specified directory does not exist, this flag is
+ ignored.
+
+ Examples:
+ Assuing that src/.git exists, the header guard CPP variables for
+ src/chrome/browser/ui/browser.h are:
+
+ No flag => CHROME_BROWSER_UI_BROWSER_H_
+ --root=chrome => BROWSER_UI_BROWSER_H_
+ --root=chrome/browser => UI_BROWSER_H_
"""
# We categorize each error message we print. Here are the categories.
@@ -161,6 +174,7 @@
'build/printf_format',
'build/storage_class',
'legal/copyright',
+ 'readability/alt_tokens',
'readability/braces',
'readability/casting',
'readability/check',
@@ -169,6 +183,7 @@
'readability/function',
'readability/multiline_comment',
'readability/multiline_string',
+ 'readability/namespace',
'readability/nolint',
'readability/streams',
'readability/todo',
@@ -189,13 +204,14 @@
'runtime/sizeof',
'runtime/string',
'runtime/threadsafe_fn',
- 'runtime/virtual',
'whitespace/blank_line',
'whitespace/braces',
'whitespace/comma',
'whitespace/comments',
+ 'whitespace/empty_loop_body',
'whitespace/end_of_line',
'whitespace/ending_newline',
+ 'whitespace/forcolon',
'whitespace/indent',
'whitespace/labels',
'whitespace/line_length',
@@ -278,7 +294,35 @@
_CHECK_REPLACEMENT['EXPECT_FALSE_M'][op] = 'EXPECT_%s_M' % inv_replacement
_CHECK_REPLACEMENT['ASSERT_FALSE_M'][op] = 'ASSERT_%s_M' % inv_replacement
+# Alternative tokens and their replacements. For full list, see section 2.5
+# Alternative tokens [lex.digraph] in the C++ standard.
+#
+# Digraphs (such as '%:') are not included here since it's a mess to
+# match those on a word boundary.
+_ALT_TOKEN_REPLACEMENT = {
+ 'and': '&&',
+ 'bitor': '|',
+ 'or': '||',
+ 'xor': '^',
+ 'compl': '~',
+ 'bitand': '&',
+ 'and_eq': '&=',
+ 'or_eq': '|=',
+ 'xor_eq': '^=',
+ 'not': '!',
+ 'not_eq': '!='
+ }
+# Compile regular expression that matches all the above keywords. The "[ =()]"
+# bit is meant to avoid matching these keywords outside of boolean expressions.
+#
+# False positives include C-style multi-line comments (http://go/nsiut )
+# and multi-line strings (http://go/beujw ), but those have always been
+# troublesome for cpplint.
+_ALT_TOKEN_REPLACEMENT_PATTERN = re.compile(
+ r'[ =()](' + ('|'.join(_ALT_TOKEN_REPLACEMENT.keys())) + r')(?=[ (]|$)')
+
+
# These constants define types of headers for use with
# _IncludeState.CheckNextIncludeOrder().
_C_SYS_HEADER = 1
@@ -287,7 +331,18 @@
_POSSIBLE_MY_HEADER = 4
_OTHER_HEADER = 5
+# These constants define the current inline assembly state
+_NO_ASM = 0 # Outside of inline assembly block
+_INSIDE_ASM = 1 # Inside inline assembly block
+_END_ASM = 2 # Last line of inline assembly block
+_BLOCK_ASM = 3 # The whole block is an inline assembly block
+# Match start of assembly blocks
+_MATCH_ASM = re.compile(r'^\s*(?:asm|_asm|__asm|__asm__)'
+ r'(?:\s+(volatile|__volatile__))?'
+ r'\s*[{(]')
+
+
_regexp_compile_cache = {}
# Finds occurrences of NOLINT or NOLINT(...).
@@ -297,6 +352,10 @@
# on which those errors are expected and should be suppressed.
_error_suppressions = {}
+# The root directory used for deriving header guard CPP variable.
+# This is set by --root flag.
+_root = None
+
def ParseNolintSuppressions(filename, raw_line, linenum, error):
"""Updates the global list of error-suppressions.
@@ -925,7 +984,7 @@
1) elided member contains lines without strings and comments,
2) lines member contains lines without comments, and
- 3) raw member contains all the lines without processing.
+ 3) raw_lines member contains all the lines without processing.
All these three members are of <type 'list'>, and of the same length.
"""
@@ -965,6 +1024,29 @@
return elided
+def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
+ """Find the position just after the matching endchar.
+
+ Args:
+ line: a CleansedLines line.
+ startpos: start searching at this position.
+ depth: nesting level at startpos.
+ startchar: expression opening character.
+ endchar: expression closing character.
+
+ Returns:
+ Index just after endchar.
+ """
+ for i in xrange(startpos, len(line)):
+ if line[i] == startchar:
+ depth += 1
+ elif line[i] == endchar:
+ depth -= 1
+ if depth == 0:
+ return i + 1
+ return -1
+
+
def CloseExpression(clean_lines, linenum, pos):
"""If input points to ( or { or [, finds the position that closes it.
@@ -991,18 +1073,23 @@
if startchar == '[': endchar = ']'
if startchar == '{': endchar = '}'
- num_open = line.count(startchar) - line.count(endchar)
- while linenum < clean_lines.NumLines() and num_open > 0:
+ # Check first line
+ end_pos = FindEndOfExpressionInLine(line, pos, 0, startchar, endchar)
+ if end_pos > -1:
+ return (line, linenum, end_pos)
+ tail = line[pos:]
+ num_open = tail.count(startchar) - tail.count(endchar)
+ while linenum < clean_lines.NumLines() - 1:
linenum += 1
line = clean_lines.elided[linenum]
- num_open += line.count(startchar) - line.count(endchar)
- # OK, now find the endchar that actually got us back to even
- endpos = len(line)
- while num_open >= 0:
- endpos = line.rfind(')', 0, endpos)
- num_open -= 1 # chopped off another )
- return (line, linenum, endpos + 1)
+ delta = line.count(startchar) - line.count(endchar)
+ if num_open + delta <= 0:
+ return (line, linenum,
+ FindEndOfExpressionInLine(line, 0, num_open, startchar, endchar))
+ num_open += delta
+ # Did not find endchar before end of file, give up
+ return (line, clean_lines.NumLines(), -1)
def CheckForCopyright(filename, lines, error):
"""Logs an error if no Copyright message appears at the top of the file."""
@@ -1032,9 +1119,13 @@
# Restores original filename in case that cpplint is invoked from Emacs's
# flymake.
filename = re.sub(r'_flymake\.h$', '.h', filename)
+ filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename)
fileinfo = FileInfo(filename)
- return re.sub(r'[-./\s]', '_', fileinfo.RepositoryName()).upper() + '_'
+ file_path_from_root = fileinfo.RepositoryName()
+ if _root:
+ file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root)
+ return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_'
def CheckForHeaderGuard(filename, lines, error):
@@ -1259,17 +1350,55 @@
'Changing pointer instead of value (or unused value of operator*).')
-class _ClassInfo(object):
+class _BlockInfo(object):
+ """Stores information about a generic block of code."""
+
+ def __init__(self, seen_open_brace):
+ self.seen_open_brace = seen_open_brace
+ self.open_parentheses = 0
+ self.inline_asm = _NO_ASM
+
+ def CheckBegin(self, filename, clean_lines, linenum, error):
+ """Run checks that applies to text up to the opening brace.
+
+ This is mostly for checking the text after the class identifier
+ and the "{", usually where the base class is specified. For other
+ blocks, there isn't much to check, so we always pass.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ pass
+
+ def CheckEnd(self, filename, clean_lines, linenum, error):
+ """Run checks that applies to text after the closing brace.
+
+ This is mostly used for checking end of namespace comments.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ pass
+
+
+class _ClassInfo(_BlockInfo):
"""Stores information about a class."""
- def __init__(self, name, clean_lines, linenum):
+ def __init__(self, name, class_or_struct, clean_lines, linenum):
+ _BlockInfo.__init__(self, False)
self.name = name
- self.linenum = linenum
- self.seen_open_brace = False
+ self.starting_linenum = linenum
self.is_derived = False
- self.virtual_method_linenumber = None
- self.has_virtual_destructor = False
- self.brace_depth = 0
+ if class_or_struct == 'struct':
+ self.access = 'public'
+ else:
+ self.access = 'private'
# Try to find the end of the class. This will be confused by things like:
# class A {
@@ -1279,26 +1408,324 @@
self.last_line = 0
depth = 0
for i in range(linenum, clean_lines.NumLines()):
- line = clean_lines.lines[i]
+ line = clean_lines.elided[i]
depth += line.count('{') - line.count('}')
if not depth:
self.last_line = i
break
+ def CheckBegin(self, filename, clean_lines, linenum, error):
+ # Look for a bare ':'
+ if Search('(^|[^:]):($|[^:])', clean_lines.elided[linenum]):
+ self.is_derived = True
-class _ClassState(object):
- """Holds the current state of the parse relating to class declarations.
- It maintains a stack of _ClassInfos representing the parser's guess
- as to the current nesting of class declarations. The innermost class
- is at the top (back) of the stack. Typically, the stack will either
- be empty or have exactly one entry.
- """
+class _NamespaceInfo(_BlockInfo):
+ """Stores information about a namespace."""
+ def __init__(self, name, linenum):
+ _BlockInfo.__init__(self, False)
+ self.name = name or ''
+ self.starting_linenum = linenum
+
+ def CheckEnd(self, filename, clean_lines, linenum, error):
+ """Check end of namespace comments."""
+ line = clean_lines.raw_lines[linenum]
+
+ # Check how many lines is enclosed in this namespace. Don't issue
+ # warning for missing namespace comments if there aren't enough
+ # lines. However, do apply checks if there is already an end of
+ # namespace comment and it's incorrect.
+ #
+ # TODO(unknown): We always want to check end of namespace comments
+ # if a namespace is large, but sometimes we also want to apply the
+ # check if a short namespace contained nontrivial things (something
+ # other than forward declarations). There is currently no logic on
+ # deciding what these nontrivial things are, so this check is
+ # triggered by namespace size only, which works most of the time.
+ if (linenum - self.starting_linenum < 10
+ and not Match(r'};*\s*(//|/\*).*\bnamespace\b', line)):
+ return
+
+ # Look for matching comment at end of namespace.
+ #
+ # Note that we accept C style "/* */" comments for terminating
+ # namespaces, so that code that terminate namespaces inside
+ # preprocessor macros can be cpplint clean. Example: http://go/nxpiz
+ #
+ # We also accept stuff like "// end of namespace <name>." with the
+ # period at the end.
+ #
+ # Besides these, we don't accept anything else, otherwise we might
+ # get false negatives when existing comment is a substring of the
+ # expected namespace. Example: http://go/ldkdc, http://cl/23548205
+ if self.name:
+ # Named namespace
+ if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
+ r'[\*/\.\\\s]*$'),
+ line):
+ error(filename, linenum, 'readability/namespace', 5,
+ 'Namespace should be terminated with "// namespace %s"' %
+ self.name)
+ else:
+ # Anonymous namespace
+ if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
+ error(filename, linenum, 'readability/namespace', 5,
+ 'Namespace should be terminated with "// namespace"')
+
+
+class _PreprocessorInfo(object):
+ """Stores checkpoints of nesting stacks when #if/#else is seen."""
+
+ def __init__(self, stack_before_if):
+ # The entire nesting stack before #if
+ self.stack_before_if = stack_before_if
+
+ # The entire nesting stack up to #else
+ self.stack_before_else = []
+
+ # Whether we have already seen #else or #elif
+ self.seen_else = False
+
+
+class _NestingState(object):
+ """Holds states related to parsing braces."""
+
def __init__(self):
- self.classinfo_stack = []
+ # Stack for tracking all braces. An object is pushed whenever we
+ # see a "{", and popped when we see a "}". Only 3 types of
+ # objects are possible:
+ # - _ClassInfo: a class or struct.
+ # - _NamespaceInfo: a namespace.
+ # - _BlockInfo: some other type of block.
+ self.stack = []
- def CheckFinished(self, filename, error):
+ # Stack of _PreprocessorInfo objects.
+ self.pp_stack = []
+
+ def SeenOpenBrace(self):
+ """Check if we have seen the opening brace for the innermost block.
+
+ Returns:
+ True if we have seen the opening brace, False if the innermost
+ block is still expecting an opening brace.
+ """
+ return (not self.stack) or self.stack[-1].seen_open_brace
+
+ def InNamespaceBody(self):
+ """Check if we are currently one level inside a namespace body.
+
+ Returns:
+ True if top of the stack is a namespace block, False otherwise.
+ """
+ return self.stack and isinstance(self.stack[-1], _NamespaceInfo)
+
+ def UpdatePreprocessor(self, line):
+ """Update preprocessor stack.
+
+ We need to handle preprocessors due to classes like this:
+ #ifdef SWIG
+ struct ResultDetailsPageElementExtensionPoint {
+ #else
+ struct ResultDetailsPageElementExtensionPoint : public Extension {
+ #endif
+ (see http://go/qwddn for original example)
+
+ We make the following assumptions (good enough for most files):
+ - Preprocessor condition evaluates to true from #if up to first
+ #else/#elif/#endif.
+
+ - Preprocessor condition evaluates to false from #else/#elif up
+ to #endif. We still perform lint checks on these lines, but
+ these do not affect nesting stack.
+
+ Args:
+ line: current line to check.
+ """
+ if Match(r'^\s*#\s*(if|ifdef|ifndef)\b', line):
+ # Beginning of #if block, save the nesting stack here. The saved
+ # stack will allow us to restore the parsing state in the #else case.
+ self.pp_stack.append(_PreprocessorInfo(copy.deepcopy(self.stack)))
+ elif Match(r'^\s*#\s*(else|elif)\b', line):
+ # Beginning of #else block
+ if self.pp_stack:
+ if not self.pp_stack[-1].seen_else:
+ # This is the first #else or #elif block. Remember the
+ # whole nesting stack up to this point. This is what we
+ # keep after the #endif.
+ self.pp_stack[-1].seen_else = True
+ self.pp_stack[-1].stack_before_else = copy.deepcopy(self.stack)
+
+ # Restore the stack to how it was before the #if
+ self.stack = copy.deepcopy(self.pp_stack[-1].stack_before_if)
+ else:
+ # TODO(unknown): unexpected #else, issue warning?
+ pass
+ elif Match(r'^\s*#\s*endif\b', line):
+ # End of #if or #else blocks.
+ if self.pp_stack:
+ # If we saw an #else, we will need to restore the nesting
+ # stack to its former state before the #else, otherwise we
+ # will just continue from where we left off.
+ if self.pp_stack[-1].seen_else:
+ # Here we can just use a shallow copy since we are the last
+ # reference to it.
+ self.stack = self.pp_stack[-1].stack_before_else
+ # Drop the corresponding #if
+ self.pp_stack.pop()
+ else:
+ # TODO(unknown): unexpected #endif, issue warning?
+ pass
+
+ def Update(self, filename, clean_lines, linenum, error):
+ """Update nesting state with current line.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Update pp_stack first
+ self.UpdatePreprocessor(line)
+
+ # Count parentheses. This is to avoid adding struct arguments to
+ # the nesting stack.
+ if self.stack:
+ inner_block = self.stack[-1]
+ depth_change = line.count('(') - line.count(')')
+ inner_block.open_parentheses += depth_change
+
+ # Also check if we are starting or ending an inline assembly block.
+ if inner_block.inline_asm in (_NO_ASM, _END_ASM):
+ if (depth_change != 0 and
+ inner_block.open_parentheses == 1 and
+ _MATCH_ASM.match(line)):
+ # Enter assembly block
+ inner_block.inline_asm = _INSIDE_ASM
+ else:
+ # Not entering assembly block. If previous line was _END_ASM,
+ # we will now shift to _NO_ASM state.
+ inner_block.inline_asm = _NO_ASM
+ elif (inner_block.inline_asm == _INSIDE_ASM and
+ inner_block.open_parentheses == 0):
+ # Exit assembly block
+ inner_block.inline_asm = _END_ASM
+
+ # Consume namespace declaration at the beginning of the line. Do
+ # this in a loop so that we catch same line declarations like this:
+ # namespace proto2 { namespace bridge { class MessageSet; } }
+ while True:
+ # Match start of namespace. The "\b\s*" below catches namespace
+ # declarations even if it weren't followed by a whitespace, this
+ # is so that we don't confuse our namespace checker. The
+ # missing spaces will be flagged by CheckSpacing.
+ namespace_decl_match = Match(r'^\s*namespace\b\s*([:\w]+)?(.*)$', line)
+ if not namespace_decl_match:
+ break
+
+ new_namespace = _NamespaceInfo(namespace_decl_match.group(1), linenum)
+ self.stack.append(new_namespace)
+
+ line = namespace_decl_match.group(2)
+ if line.find('{') != -1:
+ new_namespace.seen_open_brace = True
+ line = line[line.find('{') + 1:]
+
+ # Look for a class declaration in whatever is left of the line
+ # after parsing namespaces. The regexp accounts for decorated classes
+ # such as in:
+ # class LOCKABLE API Object {
+ # };
+ #
+ # Templates with class arguments may confuse the parser, for example:
+ # template <class T
+ # class Comparator = less<T>,
+ # class Vector = vector<T> >
+ # class HeapQueue {
+ #
+ # Because this parser has no nesting state about templates, by the
+ # time it saw "class Comparator", it may think that it's a new class.
+ # Nested templates have a similar problem:
+ # template <
+ # typename ExportedType,
+ # typename TupleType,
+ # template <typename, typename> class ImplTemplate>
+ #
+ # To avoid these cases, we ignore classes that are followed by '=' or '>'
+ class_decl_match = Match(
+ r'\s*(template\s*<[\w\s<>,:]*>\s*)?'
+ '(class|struct)\s+([A-Z_]+\s+)*(\w+(?:::\w+)*)'
+ '(([^=>]|<[^<>]*>)*)$', line)
+ if (class_decl_match and
+ (not self.stack or self.stack[-1].open_parentheses == 0)):
+ self.stack.append(_ClassInfo(
+ class_decl_match.group(4), class_decl_match.group(2),
+ clean_lines, linenum))
+ line = class_decl_match.group(5)
+
+ # If we have not yet seen the opening brace for the innermost block,
+ # run checks here.
+ if not self.SeenOpenBrace():
+ self.stack[-1].CheckBegin(filename, clean_lines, linenum, error)
+
+ # Update access control if we are inside a class/struct
+ if self.stack and isinstance(self.stack[-1], _ClassInfo):
+ access_match = Match(r'\s*(public|private|protected)\s*:', line)
+ if access_match:
+ self.stack[-1].access = access_match.group(1)
+
+ # Consume braces or semicolons from what's left of the line
+ while True:
+ # Match first brace, semicolon, or closed parenthesis.
+ matched = Match(r'^[^{;)}]*([{;)}])(.*)$', line)
+ if not matched:
+ break
+
+ token = matched.group(1)
+ if token == '{':
+ # If namespace or class hasn't seen a opening brace yet, mark
+ # namespace/class head as complete. Push a new block onto the
+ # stack otherwise.
+ if not self.SeenOpenBrace():
+ self.stack[-1].seen_open_brace = True
+ else:
+ self.stack.append(_BlockInfo(True))
+ if _MATCH_ASM.match(line):
+ self.stack[-1].inline_asm = _BLOCK_ASM
+ elif token == ';' or token == ')':
+ # If we haven't seen an opening brace yet, but we already saw
+ # a semicolon, this is probably a forward declaration. Pop
+ # the stack for these.
+ #
+ # Similarly, if we haven't seen an opening brace yet, but we
+ # already saw a closing parenthesis, then these are probably
+ # function arguments with extra "class" or "struct" keywords.
+ # Also pop these stack for these.
+ if not self.SeenOpenBrace():
+ self.stack.pop()
+ else: # token == '}'
+ # Perform end of block checks and pop the stack.
+ if self.stack:
+ self.stack[-1].CheckEnd(filename, clean_lines, linenum, error)
+ self.stack.pop()
+ line = matched.group(2)
+
+ def InnermostClass(self):
+ """Get class info on the top of the stack.
+
+ Returns:
+ A _ClassInfo object if we are inside a class, or None otherwise.
+ """
+ for i in range(len(self.stack), 0, -1):
+ classinfo = self.stack[i - 1]
+ if isinstance(classinfo, _ClassInfo):
+ return classinfo
+ return None
+
+ def CheckClassFinished(self, filename, error):
"""Checks that all classes have been completely parsed.
Call this when all lines in a file have been processed.
@@ -1306,17 +1733,18 @@
filename: The name of the current file.
error: The function to call with any errors found.
"""
- if self.classinfo_stack:
- # Note: This test can result in false positives if #ifdef constructs
- # get in the way of brace matching. See the testBuildClass test in
- # cpplint_unittest.py for an example of this.
- error(filename, self.classinfo_stack[0].linenum, 'build/class', 5,
- 'Failed to find complete declaration of class %s' %
- self.classinfo_stack[0].name)
+ # Note: This test can result in false positives if #ifdef constructs
+ # get in the way of brace matching. See the testBuildClass test in
+ # cpplint_unittest.py for an example of this.
+ for obj in self.stack:
+ if isinstance(obj, _ClassInfo):
+ error(filename, obj.starting_linenum, 'build/class', 5,
+ 'Failed to find complete declaration of class %s' %
+ obj.name)
def CheckForNonStandardConstructs(filename, clean_lines, linenum,
- class_state, error):
+ nesting_state, error):
"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
Complain about several constructs which gcc-2 accepts, but which are
@@ -1329,8 +1757,6 @@
- text after #endif is not allowed.
- invalid inner-style forward declaration.
- >? and <? operators, and their >?= and <?= cousins.
- - classes with virtual methods need virtual destructors (compiler warning
- available, but not turned on yet.)
Additionally, check for constructor/destructor style violations and reference
members, as it is very convenient to do so while checking for
@@ -1340,8 +1766,8 @@
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
- class_state: A _ClassState instance which maintains information about
- the current stack of nested class declarations being parsed.
+ nesting_state: A _NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
error: A callable to which errors are reported, which takes 4 arguments:
filename, line number, error level, and message
"""
@@ -1370,7 +1796,7 @@
if Search(r'\b(const|volatile|void|char|short|int|long'
r'|float|double|signed|unsigned'
r'|schar|u?int8|u?int16|u?int32|u?int64)'
- r'\s+(auto|register|static|extern|typedef)\b',
+ r'\s+(register|static|extern|typedef)\b',
line):
error(filename, linenum, 'build/storage_class', 5,
'Storage class (static, extern, typedef, etc) should be first.')
@@ -1400,45 +1826,13 @@
'const string& members are dangerous. It is much better to use '
'alternatives, such as pointers or simple constants.')
- # Track class entry and exit, and attempt to find cases within the
- # class declaration that don't meet the C++ style
- # guidelines. Tracking is very dependent on the code matching Google
- # style guidelines, but it seems to perform well enough in testing
- # to be a worthwhile addition to the checks.
- classinfo_stack = class_state.classinfo_stack
- # Look for a class declaration. The regexp accounts for decorated classes
- # such as in:
- # class LOCKABLE API Object {
- # };
- class_decl_match = Match(
- r'\s*(template\s*<[\w\s<>,:]*>\s*)?'
- '(class|struct)\s+([A-Z_]+\s+)*(\w+(::\w+)*)', line)
- if class_decl_match:
- classinfo_stack.append(_ClassInfo(
- class_decl_match.group(4), clean_lines, linenum))
-
- # Everything else in this function uses the top of the stack if it's
- # not empty.
- if not classinfo_stack:
+ # Everything else in this function operates on class declarations.
+ # Return early if the top of the nesting stack is not a class, or if
+ # the class head is not completed yet.
+ classinfo = nesting_state.InnermostClass()
+ if not classinfo or not classinfo.seen_open_brace:
return
- classinfo = classinfo_stack[-1]
-
- # If the opening brace hasn't been seen look for it and also
- # parent class declarations.
- if not classinfo.seen_open_brace:
- # If the line has a ';' in it, assume it's a forward declaration or
- # a single-line class declaration, which we won't process.
- if line.find(';') != -1:
- classinfo_stack.pop()
- return
- classinfo.seen_open_brace = (line.find('{') != -1)
- # Look for a bare ':'
- if Search('(^|[^:]):($|[^:])', line):
- classinfo.is_derived = True
- if not classinfo.seen_open_brace:
- return # Everything else in this function is for after open brace
-
# The class may have been declared with namespace or classname qualifiers.
# The constructor and destructor will not have those qualifiers.
base_classname = classinfo.name.split('::')[-1]
@@ -1455,36 +1849,7 @@
error(filename, linenum, 'runtime/explicit', 5,
'Single-argument constructors should be marked explicit.')
- # Look for methods declared virtual.
- if Search(r'\bvirtual\b', line):
- classinfo.virtual_method_linenumber = linenum
- # Only look for a destructor declaration on the same line. It would
- # be extremely unlikely for the destructor declaration to occupy
- # more than one line.
- if Search(r'~%s\s*\(' % base_classname, line):
- classinfo.has_virtual_destructor = True
- # Look for class end.
- brace_depth = classinfo.brace_depth
- brace_depth = brace_depth + line.count('{') - line.count('}')
- if brace_depth <= 0:
- classinfo = classinfo_stack.pop()
- # Try to detect missing virtual destructor declarations.
- # For now, only warn if a non-derived class with virtual methods lacks
- # a virtual destructor. This is to make it less likely that people will
- # declare derived virtual destructors without declaring the base
- # destructor virtual.
- if ((classinfo.virtual_method_linenumber is not None) and
- (not classinfo.has_virtual_destructor) and
- (not classinfo.is_derived)): # Only warn for base classes
- error(filename, classinfo.linenum, 'runtime/virtual', 4,
- 'The class %s probably needs a virtual destructor due to '
- 'having virtual method(s), one declared at line %d.'
- % (classinfo.name, classinfo.virtual_method_linenumber))
- else:
- classinfo.brace_depth = brace_depth
-
-
def CheckSpacingForFunctionCall(filename, line, linenum, error):
"""Checks for the correctness of various spacing around function calls.
@@ -1535,7 +1900,8 @@
error(filename, linenum, 'whitespace/parens', 2,
'Extra space after (')
if (Search(r'\w\s+\(', fncall) and
- not Search(r'#\s*define|typedef', fncall)):
+ not Search(r'#\s*define|typedef', fncall) and
+ not Search(r'\w\s+\((\w+::)?\*\w+\)\(', fncall)):
error(filename, linenum, 'whitespace/parens', 4,
'Extra space before ( in function call')
# If the ) is followed only by a newline or a { + newline, assume it's
@@ -1668,8 +2034,165 @@
error(filename, linenum, 'whitespace/todo', 2,
'TODO(my_username) should be followed by a space')
+def CheckAccess(filename, clean_lines, linenum, nesting_state, error):
+ """Checks for improper use of DISALLOW* macros.
-def CheckSpacing(filename, clean_lines, linenum, error):
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ nesting_state: A _NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum] # get rid of comments and strings
+
+ matched = Match((r'\s*(DISALLOW_COPY_AND_ASSIGN|'
+ r'DISALLOW_EVIL_CONSTRUCTORS|'
+ r'DISALLOW_IMPLICIT_CONSTRUCTORS)'), line)
+ if not matched:
+ return
+ if nesting_state.stack and isinstance(nesting_state.stack[-1], _ClassInfo):
+ if nesting_state.stack[-1].access != 'private':
+ error(filename, linenum, 'readability/constructors', 3,
+ '%s must be in the private: section' % matched.group(1))
+
+ else:
+ # Found DISALLOW* macro outside a class declaration, or perhaps it
+ # was used inside a function when it should have been part of the
+ # class declaration. We could issue a warning here, but it
+ # probably resulted in a compiler error already.
+ pass
+
+
+def FindNextMatchingAngleBracket(clean_lines, linenum, init_suffix):
+ """Find the corresponding > to close a template.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: Current line number.
+ init_suffix: Remainder of the current line after the initial <.
+
+ Returns:
+ True if a matching bracket exists.
+ """
+ line = init_suffix
+ nesting_stack = ['<']
+ while True:
+ # Find the next operator that can tell us whether < is used as an
+ # opening bracket or as a less-than operator. We only want to
+ # warn on the latter case.
+ #
+ # We could also check all other operators and terminate the search
+ # early, e.g. if we got something like this "a<b+c", the "<" is
+ # most likely a less-than operator, but then we will get false
+ # positives for default arguments (e.g. http://go/prccd) and
+ # other template expressions (e.g. http://go/oxcjq).
+ match = Search(r'^[^<>(),;\[\]]*([<>(),;\[\]])(.*)$', line)
+ if match:
+ # Found an operator, update nesting stack
+ operator = match.group(1)
+ line = match.group(2)
+
+ if nesting_stack[-1] == '<':
+ # Expecting closing angle bracket
+ if operator in ('<', '(', '['):
+ nesting_stack.append(operator)
+ elif operator == '>':
+ nesting_stack.pop()
+ if not nesting_stack:
+ # Found matching angle bracket
+ return True
+ elif operator == ',':
+ # Got a comma after a bracket, this is most likely a template
+ # argument. We have not seen a closing angle bracket yet, but
+ # it's probably a few lines later if we look for it, so just
+ # return early here.
+ return True
+ else:
+ # Got some other operator.
+ return False
+
+ else:
+ # Expecting closing parenthesis or closing bracket
+ if operator in ('<', '(', '['):
+ nesting_stack.append(operator)
+ elif operator in (')', ']'):
+ # We don't bother checking for matching () or []. If we got
+ # something like (] or [), it would have been a syntax error.
+ nesting_stack.pop()
+
+ else:
+ # Scan the next line
+ linenum += 1
+ if linenum >= len(clean_lines.elided):
+ break
+ line = clean_lines.elided[linenum]
+
+ # Exhausted all remaining lines and still no matching angle bracket.
+ # Most likely the input was incomplete, otherwise we should have
+ # seen a semicolon and returned early.
+ return True
+
+
+def FindPreviousMatchingAngleBracket(clean_lines, linenum, init_prefix):
+ """Find the corresponding < that started a template.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: Current line number.
+ init_prefix: Part of the current line before the initial >.
+
+ Returns:
+ True if a matching bracket exists.
+ """
+ line = init_prefix
+ nesting_stack = ['>']
+ while True:
+ # Find the previous operator
+ match = Search(r'^(.*)([<>(),;\[\]])[^<>(),;\[\]]*$', line)
+ if match:
+ # Found an operator, update nesting stack
+ operator = match.group(2)
+ line = match.group(1)
+
+ if nesting_stack[-1] == '>':
+ # Expecting opening angle bracket
+ if operator in ('>', ')', ']'):
+ nesting_stack.append(operator)
+ elif operator == '<':
+ nesting_stack.pop()
+ if not nesting_stack:
+ # Found matching angle bracket
+ return True
+ elif operator == ',':
+ # Got a comma before a bracket, this is most likely a
+ # template argument. The opening angle bracket is probably
+ # there if we look for it, so just return early here.
+ return True
+ else:
+ # Got some other operator.
+ return False
+
+ else:
+ # Expecting opening parenthesis or opening bracket
+ if operator in ('>', ')', ']'):
+ nesting_stack.append(operator)
+ elif operator in ('(', '['):
+ nesting_stack.pop()
+
+ else:
+ # Scan the previous line
+ linenum -= 1
+ if linenum < 0:
+ break
+ line = clean_lines.elided[linenum]
+
+ # Exhausted all earlier lines and still no matching angle bracket.
+ return False
+
+
+def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
"""Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
@@ -1682,6 +2205,8 @@
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
+ nesting_state: A _NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
error: The function to call with any errors found.
"""
@@ -1691,7 +2216,16 @@
# Before nixing comments, check if the line is blank for no good
# reason. This includes the first line after a block is opened, and
# blank lines at the end of a function (ie, right before a line like '}'
- if IsBlankLine(line):
+ #
+ # Skip all the blank line checks if we are immediately inside a
+ # namespace body. In other words, don't issue blank line warnings
+ # for this block:
+ # namespace {
+ #
+ # }
+ #
+ # A warning about missing end of namespace comments will be issued instead.
+ if IsBlankLine(line) and not nesting_state.InNamespaceBody():
elided = clean_lines.elided
prev_line = elided[linenum - 1]
prevbrace = prev_line.rfind('{')
@@ -1699,8 +2233,7 @@
# both start with alnums and are indented the same amount.
# This ignores whitespace at the start of a namespace block
# because those are not usually indented.
- if (prevbrace != -1 and prev_line[prevbrace:].find('}') == -1
- and prev_line[:prevbrace].find('namespace') == -1):
+ if prevbrace != -1 and prev_line[prevbrace:].find('}') == -1:
# OK, we have a blank line at the start of a code block. Before we
# complain, we check if it is an exception to the rule: The previous
# non-empty line has the parameters of a function header that are indented
@@ -1732,12 +2265,7 @@
if not exception:
error(filename, linenum, 'whitespace/blank_line', 2,
'Blank line at the start of a code block. Is this needed?')
- # This doesn't ignore whitespace at the end of a namespace block
- # because that is too hard without pairing open/close braces;
- # however, a special exception is made for namespace closing
- # brackets which have a comment containing "namespace".
- #
- # Also, ignore blank lines at the end of a block in a long if-else
+ # Ignore blank lines at the end of a block in a long if-else
# chain, like this:
# if (condition1) {
# // Something followed by a blank line
@@ -1749,7 +2277,6 @@
next_line = raw[linenum + 1]
if (next_line
and Match(r'\s*}', next_line)
- and next_line.find('namespace') == -1
and next_line.find('} else ') == -1):
error(filename, linenum, 'whitespace/blank_line', 3,
'Blank line at the end of a code block. Is this needed?')
@@ -1810,26 +2337,59 @@
# though, so we punt on this one for now. TODO.
# You should always have whitespace around binary operators.
- # Alas, we can't test < or > because they're legitimately used sans spaces
- # (a->b, vector<int> a). The only time we can tell is a < with no >, and
- # only if it's not template params list spilling into the next line.
+ #
+ # Check <= and >= first to avoid false positives with < and >, then
+ # check non-include lines for spacing around < and >.
match = Search(r'[^<>=!\s](==|!=|<=|>=)[^<>=!\s]', line)
- if not match:
- # Note that while it seems that the '<[^<]*' term in the following
- # regexp could be simplified to '<.*', which would indeed match
- # the same class of strings, the [^<] means that searching for the
- # regexp takes linear rather than quadratic time.
- if not Search(r'<[^<]*,\s*$', line): # template params spill
- match = Search(r'[^<>=!\s](<)[^<>=!\s]([^>]|->)*$', line)
if match:
error(filename, linenum, 'whitespace/operators', 3,
'Missing spaces around %s' % match.group(1))
- # We allow no-spaces around << and >> when used like this: 10<<20, but
+ # We allow no-spaces around << when used like this: 10<<20, but
# not otherwise (particularly, not when used as streams)
- match = Search(r'[^0-9\s](<<|>>)[^0-9\s]', line)
+ match = Search(r'(\S)(?:L|UL|ULL|l|ul|ull)?<<(\S)', line)
+ if match and not (match.group(1).isdigit() and match.group(2).isdigit()):
+ error(filename, linenum, 'whitespace/operators', 3,
+ 'Missing spaces around <<')
+ elif not Match(r'#.*include', line):
+ # Avoid false positives on ->
+ reduced_line = line.replace('->', '')
+
+ # Look for < that is not surrounded by spaces. This is only
+ # triggered if both sides are missing spaces, even though
+ # technically should should flag if at least one side is missing a
+ # space. This is done to avoid some false positives with shifts.
+ match = Search(r'[^\s<]<([^\s=<].*)', reduced_line)
+ if (match and
+ not FindNextMatchingAngleBracket(clean_lines, linenum, match.group(1))):
+ error(filename, linenum, 'whitespace/operators', 3,
+ 'Missing spaces around <')
+
+ # Look for > that is not surrounded by spaces. Similar to the
+ # above, we only trigger if both sides are missing spaces to avoid
+ # false positives with shifts.
+ match = Search(r'^(.*[^\s>])>[^\s=>]', reduced_line)
+ if (match and
+ not FindPreviousMatchingAngleBracket(clean_lines, linenum,
+ match.group(1))):
+ error(filename, linenum, 'whitespace/operators', 3,
+ 'Missing spaces around >')
+
+ # We allow no-spaces around >> for almost anything. This is because
+ # C++11 allows ">>" to close nested templates, which accounts for
+ # most cases when ">>" is not followed by a space.
+ #
+ # We still warn on ">>" followed by alpha character, because that is
+ # likely due to ">>" being used for right shifts, e.g.:
+ # value >> alpha
+ #
+ # When ">>" is used to close templates, the alphanumeric letter that
+ # follows would be part of an identifier, and there should still be
+ # a space separating the template type and the identifier.
+ # type<type<type>> alpha
+ match = Search(r'>>[a-zA-Z_]', line)
if match:
error(filename, linenum, 'whitespace/operators', 3,
- 'Missing spaces around %s' % match.group(1))
+ 'Missing spaces around >>')
# There shouldn't be space around unary operators
match = Search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line)
@@ -1903,18 +2463,25 @@
# the semicolon there.
if Search(r':\s*;\s*$', line):
error(filename, linenum, 'whitespace/semicolon', 5,
- 'Semicolon defining empty statement. Use { } instead.')
+ 'Semicolon defining empty statement. Use {} instead.')
elif Search(r'^\s*;\s*$', line):
error(filename, linenum, 'whitespace/semicolon', 5,
'Line contains only semicolon. If this should be an empty statement, '
- 'use { } instead.')
+ 'use {} instead.')
elif (Search(r'\s+;\s*$', line) and
not Search(r'\bfor\b', line)):
error(filename, linenum, 'whitespace/semicolon', 5,
'Extra space before last semicolon. If this should be an empty '
- 'statement, use { } instead.')
+ 'statement, use {} instead.')
+ # In range-based for, we wanted spaces before and after the colon, but
+ # not around "::" tokens that might appear.
+ if (Search('for *\(.*[^:]:[^: ]', line) or
+ Search('for *\(.*[^: ]:[^:]', line)):
+ error(filename, linenum, 'whitespace/forcolon', 2,
+ 'Missing space around colon in range-based for loop')
+
def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error):
"""Checks for additional blank line issues related to sections.
@@ -1938,8 +2505,8 @@
#
# If we didn't find the end of the class, last_line would be zero,
# and the check will be skipped by the first condition.
- if (class_info.last_line - class_info.linenum <= 24 or
- linenum <= class_info.linenum):
+ if (class_info.last_line - class_info.starting_linenum <= 24 or
+ linenum <= class_info.starting_linenum):
return
matched = Match(r'\s*(public|protected|private):', clean_lines.lines[linenum])
@@ -1950,15 +2517,18 @@
# - We are at the beginning of the class.
# - We are forward-declaring an inner class that is semantically
# private, but needed to be public for implementation reasons.
+ # Also ignores cases where the previous line ends with a backslash as can be
+ # common when defining classes in C macros.
prev_line = clean_lines.lines[linenum - 1]
if (not IsBlankLine(prev_line) and
- not Search(r'\b(class|struct)\b', prev_line)):
+ not Search(r'\b(class|struct)\b', prev_line) and
+ not Search(r'\\$', prev_line)):
# Try a bit harder to find the beginning of the class. This is to
# account for multi-line base-specifier lists, e.g.:
# class Derived
# : public Base {
- end_class_head = class_info.linenum
- for i in range(class_info.linenum, linenum):
+ end_class_head = class_info.starting_linenum
+ for i in range(class_info.starting_linenum, linenum):
if Search(r'\{\s*$', clean_lines.lines[i]):
end_class_head = i
break
@@ -2008,9 +2578,11 @@
# which is commonly used to control the lifetime of
# stack-allocated variables. We don't detect this perfectly: we
# just don't complain if the last non-whitespace character on the
- # previous non-blank line is ';', ':', '{', or '}'.
+ # previous non-blank line is ';', ':', '{', or '}', or if the previous
+ # line starts a preprocessor block.
prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
- if not Search(r'[;:}{]\s*$', prevline):
+ if (not Search(r'[;:}{]\s*$', prevline) and
+ not Match(r'\s*#', prevline)):
error(filename, linenum, 'whitespace/braces', 4,
'{ should almost always be at the end of the previous line')
@@ -2064,6 +2636,33 @@
"You don't need a ; after a }")
+def CheckEmptyLoopBody(filename, clean_lines, linenum, error):
+ """Loop for empty loop body with only a single semicolon.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+
+ # Search for loop keywords at the beginning of the line. Because only
+ # whitespaces are allowed before the keywords, this will also ignore most
+ # do-while-loops, since those lines should start with closing brace.
+ line = clean_lines.elided[linenum]
+ if Match(r'\s*(for|while)\s*\(', line):
+ # Find the end of the conditional expression
+ (end_line, end_linenum, end_pos) = CloseExpression(
+ clean_lines, linenum, line.find('('))
+
+ # Output warning if what follows the condition expression is a semicolon.
+ # No warning for all other cases, including whitespace or newline, since we
+ # have a separate check for semicolons preceded by whitespace.
+ if end_pos >= 0 and Match(r';', end_line[end_pos:]):
+ error(filename, end_linenum, 'whitespace/empty_loop_body', 5,
+ 'Empty loop bodies should use {} or continue')
+
+
def ReplaceableCheck(operator, macro, line):
"""Determine whether a basic CHECK can be replaced with a more specific one.
@@ -2132,6 +2731,38 @@
break
+def CheckAltTokens(filename, clean_lines, linenum, error):
+ """Check alternative keywords being used in boolean expressions.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Avoid preprocessor lines
+ if Match(r'^\s*#', line):
+ return
+
+ # Last ditch effort to avoid multi-line comments. This will not help
+ # if the comment started before the current line or ended after the
+ # current line, but it catches most of the false positives. At least,
+ # it provides a way to workaround this warning for people who use
+ # multi-line comments in preprocessor macros.
+ #
+ # TODO(unknown): remove this once cpplint has better support for
+ # multi-line comments.
+ if line.find('/*') >= 0 or line.find('*/') >= 0:
+ return
+
+ for match in _ALT_TOKEN_REPLACEMENT_PATTERN.finditer(line):
+ error(filename, linenum, 'readability/alt_tokens', 2,
+ 'Use operator %s instead of %s' % (
+ _ALT_TOKEN_REPLACEMENT[match.group(1)], match.group(1)))
+
+
def GetLineWidth(line):
"""Determines the width of the line in column positions.
@@ -2154,7 +2785,7 @@
return len(line)
-def CheckStyle(filename, clean_lines, linenum, file_extension, class_state,
+def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
error):
"""Checks rules from the 'C++ style rules' section of cppguide.html.
@@ -2167,6 +2798,8 @@
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
file_extension: The extension (without the dot) of the filename.
+ nesting_state: A _NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
error: The function to call with any errors found.
"""
@@ -2248,16 +2881,19 @@
not ((cleansed_line.find('case ') != -1 or
cleansed_line.find('default:') != -1) and
cleansed_line.find('break;') != -1)):
- error(filename, linenum, 'whitespace/newline', 4,
+ error(filename, linenum, 'whitespace/newline', 0,
'More than one command on the same line')
# Some more style checks
CheckBraces(filename, clean_lines, linenum, error)
- CheckSpacing(filename, clean_lines, linenum, error)
+ CheckEmptyLoopBody(filename, clean_lines, linenum, error)
+ CheckAccess(filename, clean_lines, linenum, nesting_state, error)
+ CheckSpacing(filename, clean_lines, linenum, nesting_state, error)
CheckCheck(filename, clean_lines, linenum, error)
- if class_state and class_state.classinfo_stack:
- CheckSectionSpacing(filename, clean_lines,
- class_state.classinfo_stack[-1], linenum, error)
+ CheckAltTokens(filename, clean_lines, linenum, error)
+ classinfo = nesting_state.InnermostClass()
+ if classinfo:
+ CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)
_RE_PATTERN_INCLUDE_NEW_STYLE = re.compile(r'#include +"[^/]+\.h"')
@@ -2554,9 +3190,11 @@
fnline))):
# We allow non-const references in a few standard places, like functions
- # called "swap()" or iostream operators like "<<" or ">>".
+ # called "swap()" or iostream operators like "<<" or ">>". We also filter
+ # out for loops, which lint otherwise mistakenly thinks are functions.
if not Search(
- r'(swap|Swap|operator[<>][<>])\s*\(\s*(?:[\w:]|<.*>)+\s*&',
+ r'(for|swap|Swap|operator[<>][<>])\s*\(\s*'
+ r'(?:(?:typename\s*)?[\w:]|<.*>)+\s*&',
fnline):
error(filename, linenum, 'runtime/references', 2,
'Is this a non-const reference? '
@@ -2578,10 +3216,19 @@
if (match.group(1) is None and # If new operator, then this isn't a cast
not (Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or
Match(r'^\s*MockCallback<.*>', line))):
- error(filename, linenum, 'readability/casting', 4,
- 'Using deprecated casting style. '
- 'Use static_cast<%s>(...) instead' %
- match.group(2))
+ # Try a bit harder to catch gmock lines: the only place where
+ # something looks like an old-style cast is where we declare the
+ # return type of the mocked method, and the only time when we
+ # are missing context is if MOCK_METHOD was split across
+ # multiple lines (for example http://go/hrfhr ), so we only need
+ # to check the previous line for MOCK_METHOD.
+ if (linenum == 0 or
+ not Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(\S+,\s*$',
+ clean_lines.elided[linenum - 1])):
+ error(filename, linenum, 'readability/casting', 4,
+ 'Using deprecated casting style. '
+ 'Use static_cast<%s>(...) instead' %
+ match.group(2))
CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
'static_cast',
@@ -2703,7 +3350,7 @@
printf_args = _GetTextInside(line, r'(?i)\b(string)?printf\s*\(')
if printf_args:
match = Match(r'([\w.\->()]+)$', printf_args)
- if match:
+ if match and match.group(1) != '__VA_ARGS__':
function_name = re.search(r'\b((?:string)?printf)\s*\(',
line, re.I).group(1)
error(filename, linenum, 'runtime/printf', 4,
@@ -2824,6 +3471,11 @@
'Using sizeof(type). Use sizeof(varname) instead if possible')
return True
+ # operator++(int) and operator--(int)
+ if (line[0:match.start(1) - 1].endswith(' operator++') or
+ line[0:match.start(1) - 1].endswith(' operator--')):
+ return False
+
remainder = line[match.end(0):]
# The close paren is for function pointers as arguments to a function.
@@ -3112,13 +3764,13 @@
if match:
error(filename, linenum, 'build/explicit_make_pair',
4, # 4 = high confidence
- 'Omit template arguments from make_pair OR use pair directly OR'
- ' if appropriate, construct a pair directly')
+ 'For C++11-compatibility, omit template arguments from make_pair'
+ ' OR use pair directly OR if appropriate, construct a pair directly')
-def ProcessLine(filename, file_extension,
- clean_lines, line, include_state, function_state,
- class_state, error, extra_check_functions=[]):
+def ProcessLine(filename, file_extension, clean_lines, line,
+ include_state, function_state, nesting_state, error,
+ extra_check_functions=[]):
"""Processes a single line in the file.
Args:
@@ -3129,8 +3781,8 @@
line: Number of line being processed.
include_state: An _IncludeState instance in which the headers are inserted.
function_state: A _FunctionState instance which counts function lines, etc.
- class_state: A _ClassState instance which maintains information about
- the current stack of nested class declarations being parsed.
+ nesting_state: A _NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
error: A callable to which errors are reported, which takes 4 arguments:
filename, line number, error level, and message
extra_check_functions: An array of additional check functions that will be
@@ -3139,13 +3791,16 @@
"""
raw_lines = clean_lines.raw_lines
ParseNolintSuppressions(filename, raw_lines[line], line, error)
+ nesting_state.Update(filename, clean_lines, line, error)
+ if nesting_state.stack and nesting_state.stack[-1].inline_asm != _NO_ASM:
+ return
CheckForFunctionLengths(filename, clean_lines, line, function_state, error)
CheckForMultilineCommentsAndStrings(filename, clean_lines, line, error)
- CheckStyle(filename, clean_lines, line, file_extension, class_state, error)
+ CheckStyle(filename, clean_lines, line, file_extension, nesting_state, error)
CheckLanguage(filename, clean_lines, line, file_extension, include_state,
error)
CheckForNonStandardConstructs(filename, clean_lines, line,
- class_state, error)
+ nesting_state, error)
CheckPosixThreading(filename, clean_lines, line, error)
CheckInvalidIncrement(filename, clean_lines, line, error)
CheckMakePairUsesDeduction(filename, clean_lines, line, error)
@@ -3172,7 +3827,7 @@
include_state = _IncludeState()
function_state = _FunctionState()
- class_state = _ClassState()
+ nesting_state = _NestingState()
ResetNolintSuppressions()
@@ -3185,9 +3840,9 @@
clean_lines = CleansedLines(lines)
for line in xrange(clean_lines.NumLines()):
ProcessLine(filename, file_extension, clean_lines, line,
- include_state, function_state, class_state, error,
+ include_state, function_state, nesting_state, error,
extra_check_functions)
- class_state.CheckFinished(filename, error)
+ nesting_state.CheckClassFinished(filename, error)
CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
@@ -3301,7 +3956,8 @@
try:
(opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose=',
'counting=',
- 'filter='])
+ 'filter=',
+ 'root='])
except getopt.GetoptError:
PrintUsage('Invalid arguments.')
@@ -3327,6 +3983,9 @@
if val not in ('total', 'toplevel', 'detailed'):
PrintUsage('Valid counting options are total, toplevel, and detailed')
counting_style = val
+ elif opt == '--root':
+ global _root
+ _root = val
if not filenames:
PrintUsage('No files were specified.')
--- a/vp8/encoder/arm/neon/shortfdct_neon.asm
+++ b/vp8/encoder/arm/neon/shortfdct_neon.asm
@@ -97,7 +97,7 @@
vmlal.s16 q11, d6, d17 ; c1*2217 + d1*5352 + 12000
vmlsl.s16 q12, d6, d16 ; d1*2217 - c1*5352 + 51000
- vmvn.s16 d4, d4
+ vmvn d4, d4
vshrn.s32 d1, q11, #16 ; op[4] = (c1*2217 + d1*5352 + 12000)>>16
vsub.s16 d1, d1, d4 ; op[4] += (d1!=0)
vshrn.s32 d3, q12, #16 ; op[12]= (d1*2217 - c1*5352 + 51000)>>16
@@ -200,7 +200,7 @@
vmlal.s16 q11, d27, d17 ; B[4] = c1*2217 + d1*5352 + 12000
vmlsl.s16 q12, d27, d16 ; B[12] = d1*2217 - c1*5352 + 51000
- vmvn.s16 q14, q14
+ vmvn q14, q14
vshrn.s32 d1, q9, #16 ; A[4] = (c1*2217 + d1*5352 + 12000)>>16
vshrn.s32 d3, q10, #16 ; A[12]= (d1*2217 - c1*5352 + 51000)>>16
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -2755,7 +2755,7 @@
/* Clear the alternate reference update pending flag. */
cpi->source_alt_ref_pending = 0;
- /* Set the alternate refernce frame active flag */
+ /* Set the alternate reference frame active flag */
cpi->source_alt_ref_active = 1;
@@ -3402,7 +3402,7 @@
else
cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = 0;
- /* Check to see if a key frame is signalled
+ /* Check to see if a key frame is signaled
* For two pass with auto key frame enabled cm->frame_type may already
* be set, but not for one pass.
*/
--- a/vp8/vp8cx.mk
+++ b/vp8/vp8cx.mk
@@ -91,18 +91,8 @@
VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/fwalsh_sse2.asm
VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/quantize_sse2.c
-# TODO(johann) make this generic
-ifeq ($(HAVE_SSE2),yes)
-vp8/encoder/x86/quantize_sse2.c.o: CFLAGS += -msse2
-vp8/encoder/x86/quantize_sse2.c.d: CFLAGS += -msse2
-endif
-
ifeq ($(CONFIG_TEMPORAL_DENOISING),yes)
VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/denoising_sse2.c
-ifeq ($(HAVE_SSE2),yes)
-vp8/encoder/x86/denoising_sse2.c.o: CFLAGS += -msse2
-vp8/encoder/x86/denoising_sse2.c.d: CFLAGS += -msse2
-endif
endif
VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/subtract_sse2.asm
--- a/vp9/common/ppc/vp9_copy_altivec.asm
+++ /dev/null
@@ -1,47 +1,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.
-;
-
-
- .globl copy_mem16x16_ppc
-
-;# r3 unsigned char *src
-;# r4 int src_stride
-;# r5 unsigned char *dst
-;# r6 int dst_stride
-
-;# Make the assumption that input will not be aligned,
-;# but the output will be. So two reads and a perm
-;# for the input, but only one store for the output.
-copy_mem16x16_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xe000
- mtspr 256, r12 ;# set VRSAVE
-
- li r10, 16
- mtctr r10
-
-cp_16x16_loop:
- lvsl v0, 0, r3 ;# permutate value for alignment
-
- lvx v1, 0, r3
- lvx v2, r10, r3
-
- vperm v1, v1, v2, v0
-
- stvx v1, 0, r5
-
- add r3, r3, r4 ;# increment source pointer
- add r5, r5, r6 ;# increment destination pointer
-
- bdnz cp_16x16_loop
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
--- a/vp9/common/ppc/vp9_filter_altivec.asm
+++ /dev/null
@@ -1,1013 +1,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.
-;
-
-
- .globl sixtap_predict_ppc
- .globl sixtap_predict8x4_ppc
- .globl sixtap_predict8x8_ppc
- .globl sixtap_predict16x16_ppc
-
-.macro load_c V, LABEL, OFF, R0, R1
- lis \R0, \LABEL@ha
- la \R1, \LABEL@l(\R0)
- lvx \V, \OFF, \R1
-.endm
-
-.macro load_hfilter V0, V1
- load_c \V0, HFilter, r5, r9, r10
-
- addi r5, r5, 16
- lvx \V1, r5, r10
-.endm
-
-;# Vertical filtering
-.macro Vprolog
- load_c v0, VFilter, r6, r3, r10
-
- vspltish v5, 8
- vspltish v6, 3
- vslh v6, v5, v6 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- vspltb v1, v0, 1
- vspltb v2, v0, 2
- vspltb v3, v0, 3
- vspltb v4, v0, 4
- vspltb v5, v0, 5
- vspltb v0, v0, 0
-.endm
-
-.macro vpre_load
- Vprolog
- li r10, 16
- lvx v10, 0, r9 ;# v10..v14 = first 5 rows
- lvx v11, r10, r9
- addi r9, r9, 32
- lvx v12, 0, r9
- lvx v13, r10, r9
- addi r9, r9, 32
- lvx v14, 0, r9
-.endm
-
-.macro Msum Re, Ro, V, T, TMP
- ;# (Re,Ro) += (V*T)
- vmuleub \TMP, \V, \T ;# trashes v8
- vadduhm \Re, \Re, \TMP ;# Re = evens, saturation unnecessary
- vmuloub \TMP, \V, \T
- vadduhm \Ro, \Ro, \TMP ;# Ro = odds
-.endm
-
-.macro vinterp_no_store P0 P1 P2 P3 P4 P5
- vmuleub v8, \P0, v0 ;# 64 + 4 positive taps
- vadduhm v16, v6, v8
- vmuloub v8, \P0, v0
- vadduhm v17, v6, v8
- Msum v16, v17, \P2, v2, v8
- Msum v16, v17, \P3, v3, v8
- Msum v16, v17, \P5, v5, v8
-
- vmuleub v18, \P1, v1 ;# 2 negative taps
- vmuloub v19, \P1, v1
- Msum v18, v19, \P4, v4, v8
-
- vsubuhs v16, v16, v18 ;# subtract neg from pos
- vsubuhs v17, v17, v19
- vsrh v16, v16, v7 ;# divide by 128
- vsrh v17, v17, v7 ;# v16 v17 = evens, odds
- vmrghh v18, v16, v17 ;# v18 v19 = 16-bit result in order
- vmrglh v19, v16, v17
- vpkuhus \P0, v18, v19 ;# P0 = 8-bit result
-.endm
-
-.macro vinterp_no_store_8x8 P0 P1 P2 P3 P4 P5
- vmuleub v24, \P0, v13 ;# 64 + 4 positive taps
- vadduhm v21, v20, v24
- vmuloub v24, \P0, v13
- vadduhm v22, v20, v24
- Msum v21, v22, \P2, v15, v25
- Msum v21, v22, \P3, v16, v25
- Msum v21, v22, \P5, v18, v25
-
- vmuleub v23, \P1, v14 ;# 2 negative taps
- vmuloub v24, \P1, v14
- Msum v23, v24, \P4, v17, v25
-
- vsubuhs v21, v21, v23 ;# subtract neg from pos
- vsubuhs v22, v22, v24
- vsrh v21, v21, v19 ;# divide by 128
- vsrh v22, v22, v19 ;# v16 v17 = evens, odds
- vmrghh v23, v21, v22 ;# v18 v19 = 16-bit result in order
- vmrglh v24, v21, v22
- vpkuhus \P0, v23, v24 ;# P0 = 8-bit result
-.endm
-
-
-.macro Vinterp P0 P1 P2 P3 P4 P5
- vinterp_no_store \P0, \P1, \P2, \P3, \P4, \P5
- stvx \P0, 0, r7
- add r7, r7, r8 ;# 33 ops per 16 pels
-.endm
-
-
-.macro luma_v P0, P1, P2, P3, P4, P5
- addi r9, r9, 16 ;# P5 = newest input row
- lvx \P5, 0, r9
- Vinterp \P0, \P1, \P2, \P3, \P4, \P5
-.endm
-
-.macro luma_vtwo
- luma_v v10, v11, v12, v13, v14, v15
- luma_v v11, v12, v13, v14, v15, v10
-.endm
-
-.macro luma_vfour
- luma_vtwo
- luma_v v12, v13, v14, v15, v10, v11
- luma_v v13, v14, v15, v10, v11, v12
-.endm
-
-.macro luma_vsix
- luma_vfour
- luma_v v14, v15, v10, v11, v12, v13
- luma_v v15, v10, v11, v12, v13, v14
-.endm
-
-.macro Interp4 R I I4
- vmsummbm \R, v13, \I, v15
- vmsummbm \R, v14, \I4, \R
-.endm
-
-.macro Read8x8 VD, RS, RP, increment_counter
- lvsl v21, 0, \RS ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx \VD, 0, \RS
- lvx v20, r10, \RS
-
-.if \increment_counter
- add \RS, \RS, \RP
-.endif
-
- vperm \VD, \VD, v20, v21
-.endm
-
-.macro interp_8x8 R
- vperm v20, \R, \R, v16 ;# v20 = 0123 1234 2345 3456
- vperm v21, \R, \R, v17 ;# v21 = 4567 5678 6789 789A
- Interp4 v20, v20, v21 ;# v20 = result 0 1 2 3
- vperm \R, \R, \R, v18 ;# R = 89AB 9ABC ABCx BCxx
- Interp4 v21, v21, \R ;# v21 = result 4 5 6 7
-
- vpkswus \R, v20, v21 ;# R = 0 1 2 3 4 5 6 7
- vsrh \R, \R, v19
-
- vpkuhus \R, \R, \R ;# saturate and pack
-
-.endm
-
-.macro Read4x4 VD, RS, RP, increment_counter
- lvsl v21, 0, \RS ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v20, 0, \RS
-
-.if \increment_counter
- add \RS, \RS, \RP
-.endif
-
- vperm \VD, v20, v20, v21
-.endm
- .text
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-sixtap_predict_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xff87
- ori r12, r12, 0xffc0
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- slwi. r5, r5, 5 ;# index into horizontal filter array
-
- vspltish v19, 7
-
- ;# If there isn't any filtering to be done for the horizontal, then
- ;# just skip to the second pass.
- beq- vertical_only_4x4
-
- ;# load up horizontal filter
- load_hfilter v13, v14
-
- ;# rounding added in on the multiply
- vspltisw v16, 8
- vspltisw v15, 3
- vslw v15, v16, v15 ;# 0x00000040000000400000004000000040
-
- ;# Load up permutation constants
- load_c v16, B_0123, 0, r9, r10
- load_c v17, B_4567, 0, r9, r10
- load_c v18, B_89AB, 0, r9, r10
-
- ;# Back off input buffer by 2 bytes. Need 2 before and 3 after
- addi r3, r3, -2
-
- addi r9, r3, 0
- li r10, 16
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
-
- slwi. r6, r6, 4 ;# index into vertical filter array
-
- ;# filter a line
- interp_8x8 v2
- interp_8x8 v3
- interp_8x8 v4
- interp_8x8 v5
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional 5 lines that are needed
- ;# for the vertical filter.
- beq- store_4x4
-
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r9, r9, r4
- sub r9, r9, r4
-
- Read8x8 v0, r9, r4, 1
- Read8x8 v1, r9, r4, 0
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 0
-
- interp_8x8 v0
- interp_8x8 v1
- interp_8x8 v6
- interp_8x8 v7
- interp_8x8 v8
-
- b second_pass_4x4
-
-vertical_only_4x4:
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r3, r3, r4
- sub r3, r3, r4
- li r10, 16
-
- Read8x8 v0, r3, r4, 1
- Read8x8 v1, r3, r4, 1
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 0
-
- slwi r6, r6, 4 ;# index into vertical filter array
-
-second_pass_4x4:
- load_c v20, b_hilo_4x4, 0, r9, r10
- load_c v21, b_hilo, 0, r9, r10
-
- ;# reposition input so that it can go through the
- ;# filtering phase with one pass.
- vperm v0, v0, v1, v20 ;# 0 1 x x
- vperm v2, v2, v3, v20 ;# 2 3 x x
- vperm v4, v4, v5, v20 ;# 4 5 x x
- vperm v6, v6, v7, v20 ;# 6 7 x x
-
- vperm v0, v0, v2, v21 ;# 0 1 2 3
- vperm v4, v4, v6, v21 ;# 4 5 6 7
-
- vsldoi v1, v0, v4, 4
- vsldoi v2, v0, v4, 8
- vsldoi v3, v0, v4, 12
-
- vsldoi v5, v4, v8, 4
-
- load_c v13, VFilter, r6, r9, r10
-
- vspltish v15, 8
- vspltish v20, 3
- vslh v20, v15, v20 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- vspltb v14, v13, 1
- vspltb v15, v13, 2
- vspltb v16, v13, 3
- vspltb v17, v13, 4
- vspltb v18, v13, 5
- vspltb v13, v13, 0
-
- vinterp_no_store_8x8 v0, v1, v2, v3, v4, v5
-
- stvx v0, 0, r1
-
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- lwz r0, 4(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- lwz r0, 8(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- lwz r0, 12(r1)
- stw r0, 0(r7)
-
- b exit_4x4
-
-store_4x4:
-
- stvx v2, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v3, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v4, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v5, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
-
-exit_4x4:
-
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-.macro w_8x8 V, D, R, P
- stvx \V, 0, r1
- lwz \R, 0(r1)
- stw \R, 0(r7)
- lwz \R, 4(r1)
- stw \R, 4(r7)
- add \D, \D, \P
-.endm
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-
-sixtap_predict8x4_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffc0
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- slwi. r5, r5, 5 ;# index into horizontal filter array
-
- vspltish v19, 7
-
- ;# If there isn't any filtering to be done for the horizontal, then
- ;# just skip to the second pass.
- beq- second_pass_pre_copy_8x4
-
- load_hfilter v13, v14
-
- ;# rounding added in on the multiply
- vspltisw v16, 8
- vspltisw v15, 3
- vslw v15, v16, v15 ;# 0x00000040000000400000004000000040
-
- ;# Load up permutation constants
- load_c v16, B_0123, 0, r9, r10
- load_c v17, B_4567, 0, r9, r10
- load_c v18, B_89AB, 0, r9, r10
-
- ;# Back off input buffer by 2 bytes. Need 2 before and 3 after
- addi r3, r3, -2
-
- addi r9, r3, 0
- li r10, 16
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
-
- slwi. r6, r6, 4 ;# index into vertical filter array
-
- ;# filter a line
- interp_8x8 v2
- interp_8x8 v3
- interp_8x8 v4
- interp_8x8 v5
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional 5 lines that are needed
- ;# for the vertical filter.
- beq- store_8x4
-
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r9, r9, r4
- sub r9, r9, r4
-
- Read8x8 v0, r9, r4, 1
- Read8x8 v1, r9, r4, 0
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 0
-
- interp_8x8 v0
- interp_8x8 v1
- interp_8x8 v6
- interp_8x8 v7
- interp_8x8 v8
-
- b second_pass_8x4
-
-second_pass_pre_copy_8x4:
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r3, r3, r4
- sub r3, r3, r4
- li r10, 16
-
- Read8x8 v0, r3, r4, 1
- Read8x8 v1, r3, r4, 1
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 1
-
- slwi r6, r6, 4 ;# index into vertical filter array
-
-second_pass_8x4:
- load_c v13, VFilter, r6, r9, r10
-
- vspltish v15, 8
- vspltish v20, 3
- vslh v20, v15, v20 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- vspltb v14, v13, 1
- vspltb v15, v13, 2
- vspltb v16, v13, 3
- vspltb v17, v13, 4
- vspltb v18, v13, 5
- vspltb v13, v13, 0
-
- vinterp_no_store_8x8 v0, v1, v2, v3, v4, v5
- vinterp_no_store_8x8 v1, v2, v3, v4, v5, v6
- vinterp_no_store_8x8 v2, v3, v4, v5, v6, v7
- vinterp_no_store_8x8 v3, v4, v5, v6, v7, v8
-
- cmpi cr0, r8, 8
- beq cr0, store_aligned_8x4
-
- w_8x8 v0, r7, r0, r8
- w_8x8 v1, r7, r0, r8
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
-
- b exit_8x4
-
-store_aligned_8x4:
-
- load_c v10, b_hilo, 0, r9, r10
-
- vperm v0, v0, v1, v10
- vperm v2, v2, v3, v10
-
- stvx v0, 0, r7
- addi r7, r7, 16
- stvx v2, 0, r7
-
- b exit_8x4
-
-store_8x4:
- cmpi cr0, r8, 8
- beq cr0, store_aligned2_8x4
-
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
- w_8x8 v4, r7, r0, r8
- w_8x8 v5, r7, r0, r8
-
- b exit_8x4
-
-store_aligned2_8x4:
- load_c v10, b_hilo, 0, r9, r10
-
- vperm v2, v2, v3, v10
- vperm v4, v4, v5, v10
-
- stvx v2, 0, r7
- addi r7, r7, 16
- stvx v4, 0, r7
-
-exit_8x4:
-
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
-
- blr
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-
-;# Because the width that needs to be filtered will fit in a single altivec
-;# register there is no need to loop. Everything can stay in registers.
-sixtap_predict8x8_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffc0
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- slwi. r5, r5, 5 ;# index into horizontal filter array
-
- vspltish v19, 7
-
- ;# If there isn't any filtering to be done for the horizontal, then
- ;# just skip to the second pass.
- beq- second_pass_pre_copy_8x8
-
- load_hfilter v13, v14
-
- ;# rounding added in on the multiply
- vspltisw v16, 8
- vspltisw v15, 3
- vslw v15, v16, v15 ;# 0x00000040000000400000004000000040
-
- ;# Load up permutation constants
- load_c v16, B_0123, 0, r9, r10
- load_c v17, B_4567, 0, r9, r10
- load_c v18, B_89AB, 0, r9, r10
-
- ;# Back off input buffer by 2 bytes. Need 2 before and 3 after
- addi r3, r3, -2
-
- addi r9, r3, 0
- li r10, 16
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 1
- Read8x8 v9, r3, r4, 1
-
- slwi. r6, r6, 4 ;# index into vertical filter array
-
- ;# filter a line
- interp_8x8 v2
- interp_8x8 v3
- interp_8x8 v4
- interp_8x8 v5
- interp_8x8 v6
- interp_8x8 v7
- interp_8x8 v8
- interp_8x8 v9
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional 5 lines that are needed
- ;# for the vertical filter.
- beq- store_8x8
-
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r9, r9, r4
- sub r9, r9, r4
-
- Read8x8 v0, r9, r4, 1
- Read8x8 v1, r9, r4, 0
- Read8x8 v10, r3, r4, 1
- Read8x8 v11, r3, r4, 1
- Read8x8 v12, r3, r4, 0
-
- interp_8x8 v0
- interp_8x8 v1
- interp_8x8 v10
- interp_8x8 v11
- interp_8x8 v12
-
- b second_pass_8x8
-
-second_pass_pre_copy_8x8:
- ;# only needed if there is a vertical filter present
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r3, r3, r4
- sub r3, r3, r4
- li r10, 16
-
- Read8x8 v0, r3, r4, 1
- Read8x8 v1, r3, r4, 1
- Read8x8 v2, r3, r4, 1
- Read8x8 v3, r3, r4, 1
- Read8x8 v4, r3, r4, 1
- Read8x8 v5, r3, r4, 1
- Read8x8 v6, r3, r4, 1
- Read8x8 v7, r3, r4, 1
- Read8x8 v8, r3, r4, 1
- Read8x8 v9, r3, r4, 1
- Read8x8 v10, r3, r4, 1
- Read8x8 v11, r3, r4, 1
- Read8x8 v12, r3, r4, 0
-
- slwi r6, r6, 4 ;# index into vertical filter array
-
-second_pass_8x8:
- load_c v13, VFilter, r6, r9, r10
-
- vspltish v15, 8
- vspltish v20, 3
- vslh v20, v15, v20 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- vspltb v14, v13, 1
- vspltb v15, v13, 2
- vspltb v16, v13, 3
- vspltb v17, v13, 4
- vspltb v18, v13, 5
- vspltb v13, v13, 0
-
- vinterp_no_store_8x8 v0, v1, v2, v3, v4, v5
- vinterp_no_store_8x8 v1, v2, v3, v4, v5, v6
- vinterp_no_store_8x8 v2, v3, v4, v5, v6, v7
- vinterp_no_store_8x8 v3, v4, v5, v6, v7, v8
- vinterp_no_store_8x8 v4, v5, v6, v7, v8, v9
- vinterp_no_store_8x8 v5, v6, v7, v8, v9, v10
- vinterp_no_store_8x8 v6, v7, v8, v9, v10, v11
- vinterp_no_store_8x8 v7, v8, v9, v10, v11, v12
-
- cmpi cr0, r8, 8
- beq cr0, store_aligned_8x8
-
- w_8x8 v0, r7, r0, r8
- w_8x8 v1, r7, r0, r8
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
- w_8x8 v4, r7, r0, r8
- w_8x8 v5, r7, r0, r8
- w_8x8 v6, r7, r0, r8
- w_8x8 v7, r7, r0, r8
-
- b exit_8x8
-
-store_aligned_8x8:
-
- load_c v10, b_hilo, 0, r9, r10
-
- vperm v0, v0, v1, v10
- vperm v2, v2, v3, v10
- vperm v4, v4, v5, v10
- vperm v6, v6, v7, v10
-
- stvx v0, 0, r7
- addi r7, r7, 16
- stvx v2, 0, r7
- addi r7, r7, 16
- stvx v4, 0, r7
- addi r7, r7, 16
- stvx v6, 0, r7
-
- b exit_8x8
-
-store_8x8:
- cmpi cr0, r8, 8
- beq cr0, store_aligned2_8x8
-
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
- w_8x8 v4, r7, r0, r8
- w_8x8 v5, r7, r0, r8
- w_8x8 v6, r7, r0, r8
- w_8x8 v7, r7, r0, r8
- w_8x8 v8, r7, r0, r8
- w_8x8 v9, r7, r0, r8
-
- b exit_8x8
-
-store_aligned2_8x8:
- load_c v10, b_hilo, 0, r9, r10
-
- vperm v2, v2, v3, v10
- vperm v4, v4, v5, v10
- vperm v6, v6, v7, v10
- vperm v8, v8, v9, v10
-
- stvx v2, 0, r7
- addi r7, r7, 16
- stvx v4, 0, r7
- addi r7, r7, 16
- stvx v6, 0, r7
- addi r7, r7, 16
- stvx v8, 0, r7
-
-exit_8x8:
-
- addi r1, r1, 32 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-
-;# Two pass filtering. First pass is Horizontal edges, second pass is vertical
-;# edges. One of the filters can be null, but both won't be. Needs to use a
-;# temporary buffer because the source buffer can't be modified and the buffer
-;# for the destination is not large enough to hold the temporary data.
-sixtap_predict16x16_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xf000
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-416(r1) ;# create space on the stack
-
- ;# Three possiblities
- ;# 1. First filter is null. Don't use a temp buffer.
- ;# 2. Second filter is null. Don't use a temp buffer.
- ;# 3. Neither are null, use temp buffer.
-
- ;# First Pass (horizontal edge)
- ;# setup pointers for src
- ;# if possiblity (1) then setup the src pointer to be the orginal and jump
- ;# to second pass. this is based on if x_offset is 0.
-
- ;# load up horizontal filter
- slwi. r5, r5, 5 ;# index into horizontal filter array
-
- load_hfilter v4, v5
-
- beq- copy_horizontal_16x21
-
- ;# Back off input buffer by 2 bytes. Need 2 before and 3 after
- addi r3, r3, -2
-
- slwi. r6, r6, 4 ;# index into vertical filter array
-
- ;# setup constants
- ;# v14 permutation value for alignment
- load_c v14, b_hperm, 0, r9, r10
-
- ;# These statements are guessing that there won't be a second pass,
- ;# but if there is then inside the bypass they need to be set
- li r0, 16 ;# prepare for no vertical filter
-
- ;# Change the output pointer and pitch to be the actual
- ;# desination instead of a temporary buffer.
- addi r9, r7, 0
- addi r5, r8, 0
-
- ;# no vertical filter, so write the output from the first pass
- ;# directly into the output buffer.
- beq- no_vertical_filter_bypass
-
- ;# if the second filter is not null then need to back off by 2*pitch
- sub r3, r3, r4
- sub r3, r3, r4
-
- ;# setup counter for the number of lines that are going to be filtered
- li r0, 21
-
- ;# use the stack as temporary storage
- la r9, 48(r1)
- li r5, 16
-
-no_vertical_filter_bypass:
-
- mtctr r0
-
- ;# rounding added in on the multiply
- vspltisw v10, 8
- vspltisw v12, 3
- vslw v12, v10, v12 ;# 0x00000040000000400000004000000040
-
- ;# downshift by 7 ( divide by 128 ) at the end
- vspltish v13, 7
-
- ;# index to the next set of vectors in the row.
- li r10, 16
- li r12, 32
-
-horizontal_loop_16x16:
-
- lvsl v15, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v1, 0, r3
- lvx v2, r10, r3
- lvx v3, r12, r3
-
- vperm v8, v1, v2, v15
- vperm v9, v2, v3, v15 ;# v8 v9 = 21 input pixels left-justified
-
- vsldoi v11, v8, v9, 4
-
- ;# set 0
- vmsummbm v6, v4, v8, v12 ;# taps times elements
- vmsummbm v0, v5, v11, v6
-
- ;# set 1
- vsldoi v10, v8, v9, 1
- vsldoi v11, v8, v9, 5
-
- vmsummbm v6, v4, v10, v12
- vmsummbm v1, v5, v11, v6
-
- ;# set 2
- vsldoi v10, v8, v9, 2
- vsldoi v11, v8, v9, 6
-
- vmsummbm v6, v4, v10, v12
- vmsummbm v2, v5, v11, v6
-
- ;# set 3
- vsldoi v10, v8, v9, 3
- vsldoi v11, v8, v9, 7
-
- vmsummbm v6, v4, v10, v12
- vmsummbm v3, v5, v11, v6
-
- vpkswus v0, v0, v1 ;# v0 = 0 4 8 C 1 5 9 D (16-bit)
- vpkswus v1, v2, v3 ;# v1 = 2 6 A E 3 7 B F
-
- vsrh v0, v0, v13 ;# divide v0, v1 by 128
- vsrh v1, v1, v13
-
- vpkuhus v0, v0, v1 ;# v0 = scrambled 8-bit result
- vperm v0, v0, v0, v14 ;# v0 = correctly-ordered result
-
- stvx v0, 0, r9
- add r9, r9, r5
-
- add r3, r3, r4
-
- bdnz horizontal_loop_16x16
-
- ;# check again to see if vertical filter needs to be done.
- cmpi cr0, r6, 0
- beq cr0, end_16x16
-
- ;# yes there is, so go to the second pass
- b second_pass_16x16
-
-copy_horizontal_16x21:
- li r10, 21
- mtctr r10
-
- li r10, 16
-
- sub r3, r3, r4
- sub r3, r3, r4
-
- ;# this is done above if there is a horizontal filter,
- ;# if not it needs to be done down here.
- slwi r6, r6, 4 ;# index into vertical filter array
-
- ;# always write to the stack when doing a horizontal copy
- la r9, 48(r1)
-
-copy_horizontal_loop_16x21:
- lvsl v15, 0, r3 ;# permutate value for alignment
-
- lvx v1, 0, r3
- lvx v2, r10, r3
-
- vperm v8, v1, v2, v15
-
- stvx v8, 0, r9
- addi r9, r9, 16
-
- add r3, r3, r4
-
- bdnz copy_horizontal_loop_16x21
-
-second_pass_16x16:
-
- ;# always read from the stack when doing a vertical filter
- la r9, 48(r1)
-
- ;# downshift by 7 ( divide by 128 ) at the end
- vspltish v7, 7
-
- vpre_load
-
- luma_vsix
- luma_vsix
- luma_vfour
-
-end_16x16:
-
- addi r1, r1, 416 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .data
-
- .align 4
-HFilter:
- .byte 0, 0,128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0,128, 0
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, -6,123, 12, 0, -6,123, 12, 0, -6,123, 12, 0, -6,123, 12
- .byte -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0
- .byte 2,-11,108, 36, 2,-11,108, 36, 2,-11,108, 36, 2,-11,108, 36
- .byte -8, 1, 0, 0, -8, 1, 0, 0, -8, 1, 0, 0, -8, 1, 0, 0
- .byte 0, -9, 93, 50, 0, -9, 93, 50, 0, -9, 93, 50, 0, -9, 93, 50
- .byte -6, 0, 0, 0, -6, 0, 0, 0, -6, 0, 0, 0, -6, 0, 0, 0
- .byte 3,-16, 77, 77, 3,-16, 77, 77, 3,-16, 77, 77, 3,-16, 77, 77
- .byte -16, 3, 0, 0,-16, 3, 0, 0,-16, 3, 0, 0,-16, 3, 0, 0
- .byte 0, -6, 50, 93, 0, -6, 50, 93, 0, -6, 50, 93, 0, -6, 50, 93
- .byte -9, 0, 0, 0, -9, 0, 0, 0, -9, 0, 0, 0, -9, 0, 0, 0
- .byte 1, -8, 36,108, 1, -8, 36,108, 1, -8, 36,108, 1, -8, 36,108
- .byte -11, 2, 0, 0,-11, 2, 0, 0,-11, 2, 0, 0,-11, 2, 0, 0
- .byte 0, -1, 12,123, 0, -1, 12,123, 0, -1, 12,123, 0, -1, 12,123
- .byte -6, 0, 0, 0, -6, 0, 0, 0, -6, 0, 0, 0, -6, 0, 0, 0
-
- .align 4
-VFilter:
- .byte 0, 0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 6,123, 12, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 2, 11,108, 36, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 9, 93, 50, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 3, 16, 77, 77, 16, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 6, 50, 93, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 1, 8, 36,108, 11, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 0, 1, 12,123, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-
- .align 4
-b_hperm:
- .byte 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
-
- .align 4
-B_0123:
- .byte 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6
-
- .align 4
-B_4567:
- .byte 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10
-
- .align 4
-B_89AB:
- .byte 8, 9, 10, 11, 9, 10, 11, 12, 10, 11, 12, 13, 11, 12, 13, 14
-
- .align 4
-b_hilo:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
-
- .align 4
-b_hilo_4x4:
- .byte 0, 1, 2, 3, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0
--- a/vp9/common/ppc/vp9_filter_bilinear_altivec.asm
+++ /dev/null
@@ -1,677 +1,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.
-;
-
-
- .globl bilinear_predict4x4_ppc
- .globl bilinear_predict8x4_ppc
- .globl bilinear_predict8x8_ppc
- .globl bilinear_predict16x16_ppc
-
-.macro load_c V, LABEL, OFF, R0, R1
- lis \R0, \LABEL@ha
- la \R1, \LABEL@l(\R0)
- lvx \V, \OFF, \R1
-.endm
-
-.macro load_vfilter V0, V1
- load_c \V0, vfilter_b, r6, r9, r10
-
- addi r6, r6, 16
- lvx \V1, r6, r10
-.endm
-
-.macro HProlog jump_label
- ;# load up horizontal filter
- slwi. r5, r5, 4 ;# index into horizontal filter array
-
- ;# index to the next set of vectors in the row.
- li r10, 16
- li r12, 32
-
- ;# downshift by 7 ( divide by 128 ) at the end
- vspltish v19, 7
-
- ;# If there isn't any filtering to be done for the horizontal, then
- ;# just skip to the second pass.
- beq \jump_label
-
- load_c v20, hfilter_b, r5, r9, r0
-
- ;# setup constants
- ;# v14 permutation value for alignment
- load_c v28, b_hperm_b, 0, r9, r0
-
- ;# rounding added in on the multiply
- vspltisw v21, 8
- vspltisw v18, 3
- vslw v18, v21, v18 ;# 0x00000040000000400000004000000040
-
- slwi. r6, r6, 5 ;# index into vertical filter array
-.endm
-
-;# Filters a horizontal line
-;# expects:
-;# r3 src_ptr
-;# r4 pitch
-;# r10 16
-;# r12 32
-;# v17 perm intput
-;# v18 rounding
-;# v19 shift
-;# v20 filter taps
-;# v21 tmp
-;# v22 tmp
-;# v23 tmp
-;# v24 tmp
-;# v25 tmp
-;# v26 tmp
-;# v27 tmp
-;# v28 perm output
-;#
-.macro HFilter V
- vperm v24, v21, v21, v10 ;# v20 = 0123 1234 2345 3456
- vperm v25, v21, v21, v11 ;# v21 = 4567 5678 6789 789A
-
- vmsummbm v24, v20, v24, v18
- vmsummbm v25, v20, v25, v18
-
- vpkswus v24, v24, v25 ;# v24 = 0 4 8 C 1 5 9 D (16-bit)
-
- vsrh v24, v24, v19 ;# divide v0, v1 by 128
-
- vpkuhus \V, v24, v24 ;# \V = scrambled 8-bit result
-.endm
-
-.macro hfilter_8 V, increment_counter
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 9 bytes wide, output is 8 bytes.
- lvx v21, 0, r3
- lvx v22, r10, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
- vperm v21, v21, v22, v17
-
- HFilter \V
-.endm
-
-
-.macro load_and_align_8 V, increment_counter
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v21, 0, r3
- lvx v22, r10, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
-
- vperm \V, v21, v22, v17
-.endm
-
-.macro write_aligned_8 V, increment_counter
- stvx \V, 0, r7
-
-.if \increment_counter
- add r7, r7, r8
-.endif
-.endm
-
-.macro vfilter_16 P0 P1
- vmuleub v22, \P0, v20 ;# 64 + 4 positive taps
- vadduhm v22, v18, v22
- vmuloub v23, \P0, v20
- vadduhm v23, v18, v23
-
- vmuleub v24, \P1, v21
- vadduhm v22, v22, v24 ;# Re = evens, saturation unnecessary
- vmuloub v25, \P1, v21
- vadduhm v23, v23, v25 ;# Ro = odds
-
- vsrh v22, v22, v19 ;# divide by 128
- vsrh v23, v23, v19 ;# v16 v17 = evens, odds
- vmrghh \P0, v22, v23 ;# v18 v19 = 16-bit result in order
- vmrglh v23, v22, v23
- vpkuhus \P0, \P0, v23 ;# P0 = 8-bit result
-.endm
-
-
-.macro w_8x8 V, D, R, P
- stvx \V, 0, r1
- lwz \R, 0(r1)
- stw \R, 0(r7)
- lwz \R, 4(r1)
- stw \R, 4(r7)
- add \D, \D, \P
-.endm
-
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-bilinear_predict4x4_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xf830
- ori r12, r12, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- HProlog second_pass_4x4_pre_copy_b
-
- ;# Load up permutation constants
- load_c v10, b_0123_b, 0, r9, r12
- load_c v11, b_4567_b, 0, r9, r12
-
- hfilter_8 v0, 1
- hfilter_8 v1, 1
- hfilter_8 v2, 1
- hfilter_8 v3, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq store_out_4x4_b
-
- hfilter_8 v4, 0
-
- b second_pass_4x4_b
-
-second_pass_4x4_pre_copy_b:
- slwi r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_8 v0, 1
- load_and_align_8 v1, 1
- load_and_align_8 v2, 1
- load_and_align_8 v3, 1
- load_and_align_8 v4, 1
-
-second_pass_4x4_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
-
-store_out_4x4_b:
-
- stvx v0, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v1, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v2, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
- add r7, r7, r8
-
- stvx v3, 0, r1
- lwz r0, 0(r1)
- stw r0, 0(r7)
-
-exit_4x4:
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-bilinear_predict8x4_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xf830
- ori r12, r12, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- HProlog second_pass_8x4_pre_copy_b
-
- ;# Load up permutation constants
- load_c v10, b_0123_b, 0, r9, r12
- load_c v11, b_4567_b, 0, r9, r12
-
- hfilter_8 v0, 1
- hfilter_8 v1, 1
- hfilter_8 v2, 1
- hfilter_8 v3, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq store_out_8x4_b
-
- hfilter_8 v4, 0
-
- b second_pass_8x4_b
-
-second_pass_8x4_pre_copy_b:
- slwi r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_8 v0, 1
- load_and_align_8 v1, 1
- load_and_align_8 v2, 1
- load_and_align_8 v3, 1
- load_and_align_8 v4, 1
-
-second_pass_8x4_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
-
-store_out_8x4_b:
-
- cmpi cr0, r8, 8
- beq cr0, store_aligned_8x4_b
-
- w_8x8 v0, r7, r0, r8
- w_8x8 v1, r7, r0, r8
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
-
- b exit_8x4
-
-store_aligned_8x4_b:
- load_c v10, b_hilo_b, 0, r9, r10
-
- vperm v0, v0, v1, v10
- vperm v2, v2, v3, v10
-
- stvx v0, 0, r7
- addi r7, r7, 16
- stvx v2, 0, r7
-
-exit_8x4:
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-bilinear_predict8x8_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xfff0
- ori r12, r12, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- stwu r1,-32(r1) ;# create space on the stack
-
- HProlog second_pass_8x8_pre_copy_b
-
- ;# Load up permutation constants
- load_c v10, b_0123_b, 0, r9, r12
- load_c v11, b_4567_b, 0, r9, r12
-
- hfilter_8 v0, 1
- hfilter_8 v1, 1
- hfilter_8 v2, 1
- hfilter_8 v3, 1
- hfilter_8 v4, 1
- hfilter_8 v5, 1
- hfilter_8 v6, 1
- hfilter_8 v7, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq store_out_8x8_b
-
- hfilter_8 v8, 0
-
- b second_pass_8x8_b
-
-second_pass_8x8_pre_copy_b:
- slwi r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_8 v0, 1
- load_and_align_8 v1, 1
- load_and_align_8 v2, 1
- load_and_align_8 v3, 1
- load_and_align_8 v4, 1
- load_and_align_8 v5, 1
- load_and_align_8 v6, 1
- load_and_align_8 v7, 1
- load_and_align_8 v8, 0
-
-second_pass_8x8_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
- vfilter_16 v4, v5
- vfilter_16 v5, v6
- vfilter_16 v6, v7
- vfilter_16 v7, v8
-
-store_out_8x8_b:
-
- cmpi cr0, r8, 8
- beq cr0, store_aligned_8x8_b
-
- w_8x8 v0, r7, r0, r8
- w_8x8 v1, r7, r0, r8
- w_8x8 v2, r7, r0, r8
- w_8x8 v3, r7, r0, r8
- w_8x8 v4, r7, r0, r8
- w_8x8 v5, r7, r0, r8
- w_8x8 v6, r7, r0, r8
- w_8x8 v7, r7, r0, r8
-
- b exit_8x8
-
-store_aligned_8x8_b:
- load_c v10, b_hilo_b, 0, r9, r10
-
- vperm v0, v0, v1, v10
- vperm v2, v2, v3, v10
- vperm v4, v4, v5, v10
- vperm v6, v6, v7, v10
-
- stvx v0, 0, r7
- addi r7, r7, 16
- stvx v2, 0, r7
- addi r7, r7, 16
- stvx v4, 0, r7
- addi r7, r7, 16
- stvx v6, 0, r7
-
-exit_8x8:
-
- addi r1, r1, 32 ;# recover stack
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-;# Filters a horizontal line
-;# expects:
-;# r3 src_ptr
-;# r4 pitch
-;# r10 16
-;# r12 32
-;# v17 perm intput
-;# v18 rounding
-;# v19 shift
-;# v20 filter taps
-;# v21 tmp
-;# v22 tmp
-;# v23 tmp
-;# v24 tmp
-;# v25 tmp
-;# v26 tmp
-;# v27 tmp
-;# v28 perm output
-;#
-.macro hfilter_16 V, increment_counter
-
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v21, 0, r3
- lvx v22, r10, r3
- lvx v23, r12, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
- vperm v21, v21, v22, v17
- vperm v22, v22, v23, v17 ;# v8 v9 = 21 input pixels left-justified
-
- ;# set 0
- vmsummbm v24, v20, v21, v18 ;# taps times elements
-
- ;# set 1
- vsldoi v23, v21, v22, 1
- vmsummbm v25, v20, v23, v18
-
- ;# set 2
- vsldoi v23, v21, v22, 2
- vmsummbm v26, v20, v23, v18
-
- ;# set 3
- vsldoi v23, v21, v22, 3
- vmsummbm v27, v20, v23, v18
-
- vpkswus v24, v24, v25 ;# v24 = 0 4 8 C 1 5 9 D (16-bit)
- vpkswus v25, v26, v27 ;# v25 = 2 6 A E 3 7 B F
-
- vsrh v24, v24, v19 ;# divide v0, v1 by 128
- vsrh v25, v25, v19
-
- vpkuhus \V, v24, v25 ;# \V = scrambled 8-bit result
- vperm \V, \V, v0, v28 ;# \V = correctly-ordered result
-.endm
-
-.macro load_and_align_16 V, increment_counter
- lvsl v17, 0, r3 ;# permutate value for alignment
-
- ;# input to filter is 21 bytes wide, output is 16 bytes.
- ;# input will can span three vectors if not aligned correctly.
- lvx v21, 0, r3
- lvx v22, r10, r3
-
-.if \increment_counter
- add r3, r3, r4
-.endif
-
- vperm \V, v21, v22, v17
-.endm
-
-.macro write_16 V, increment_counter
- stvx \V, 0, r7
-
-.if \increment_counter
- add r7, r7, r8
-.endif
-.endm
-
- .align 2
-;# r3 unsigned char * src
-;# r4 int src_pitch
-;# r5 int x_offset
-;# r6 int y_offset
-;# r7 unsigned char * dst
-;# r8 int dst_pitch
-bilinear_predict16x16_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- HProlog second_pass_16x16_pre_copy_b
-
- hfilter_16 v0, 1
- hfilter_16 v1, 1
- hfilter_16 v2, 1
- hfilter_16 v3, 1
- hfilter_16 v4, 1
- hfilter_16 v5, 1
- hfilter_16 v6, 1
- hfilter_16 v7, 1
- hfilter_16 v8, 1
- hfilter_16 v9, 1
- hfilter_16 v10, 1
- hfilter_16 v11, 1
- hfilter_16 v12, 1
- hfilter_16 v13, 1
- hfilter_16 v14, 1
- hfilter_16 v15, 1
-
- ;# Finished filtering main horizontal block. If there is no
- ;# vertical filtering, jump to storing the data. Otherwise
- ;# load up and filter the additional line that is needed
- ;# for the vertical filter.
- beq store_out_16x16_b
-
- hfilter_16 v16, 0
-
- b second_pass_16x16_b
-
-second_pass_16x16_pre_copy_b:
- slwi r6, r6, 5 ;# index into vertical filter array
-
- load_and_align_16 v0, 1
- load_and_align_16 v1, 1
- load_and_align_16 v2, 1
- load_and_align_16 v3, 1
- load_and_align_16 v4, 1
- load_and_align_16 v5, 1
- load_and_align_16 v6, 1
- load_and_align_16 v7, 1
- load_and_align_16 v8, 1
- load_and_align_16 v9, 1
- load_and_align_16 v10, 1
- load_and_align_16 v11, 1
- load_and_align_16 v12, 1
- load_and_align_16 v13, 1
- load_and_align_16 v14, 1
- load_and_align_16 v15, 1
- load_and_align_16 v16, 0
-
-second_pass_16x16_b:
- vspltish v20, 8
- vspltish v18, 3
- vslh v18, v20, v18 ;# 0x0040 0040 0040 0040 0040 0040 0040 0040
-
- load_vfilter v20, v21
-
- vfilter_16 v0, v1
- vfilter_16 v1, v2
- vfilter_16 v2, v3
- vfilter_16 v3, v4
- vfilter_16 v4, v5
- vfilter_16 v5, v6
- vfilter_16 v6, v7
- vfilter_16 v7, v8
- vfilter_16 v8, v9
- vfilter_16 v9, v10
- vfilter_16 v10, v11
- vfilter_16 v11, v12
- vfilter_16 v12, v13
- vfilter_16 v13, v14
- vfilter_16 v14, v15
- vfilter_16 v15, v16
-
-store_out_16x16_b:
-
- write_16 v0, 1
- write_16 v1, 1
- write_16 v2, 1
- write_16 v3, 1
- write_16 v4, 1
- write_16 v5, 1
- write_16 v6, 1
- write_16 v7, 1
- write_16 v8, 1
- write_16 v9, 1
- write_16 v10, 1
- write_16 v11, 1
- write_16 v12, 1
- write_16 v13, 1
- write_16 v14, 1
- write_16 v15, 0
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .data
-
- .align 4
-hfilter_b:
- .byte 128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0,128, 0, 0, 0
- .byte 112, 16, 0, 0,112, 16, 0, 0,112, 16, 0, 0,112, 16, 0, 0
- .byte 96, 32, 0, 0, 96, 32, 0, 0, 96, 32, 0, 0, 96, 32, 0, 0
- .byte 80, 48, 0, 0, 80, 48, 0, 0, 80, 48, 0, 0, 80, 48, 0, 0
- .byte 64, 64, 0, 0, 64, 64, 0, 0, 64, 64, 0, 0, 64, 64, 0, 0
- .byte 48, 80, 0, 0, 48, 80, 0, 0, 48, 80, 0, 0, 48, 80, 0, 0
- .byte 32, 96, 0, 0, 32, 96, 0, 0, 32, 96, 0, 0, 32, 96, 0, 0
- .byte 16,112, 0, 0, 16,112, 0, 0, 16,112, 0, 0, 16,112, 0, 0
-
- .align 4
-vfilter_b:
- .byte 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
- .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- .byte 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112
- .byte 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
- .byte 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96
- .byte 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
- .byte 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80
- .byte 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48
- .byte 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
- .byte 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
- .byte 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48
- .byte 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80
- .byte 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
- .byte 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96
- .byte 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
- .byte 112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112
-
- .align 4
-b_hperm_b:
- .byte 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
-
- .align 4
-b_0123_b:
- .byte 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6
-
- .align 4
-b_4567_b:
- .byte 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10
-
-b_hilo_b:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
--- a/vp9/common/ppc/vp9_idct_altivec.asm
+++ /dev/null
@@ -1,189 +1,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.
-;
-
-
- .globl short_idct4x4_ppc
-
-.macro load_c V, LABEL, OFF, R0, R1
- lis \R0, \LABEL@ha
- la \R1, \LABEL@l(\R0)
- lvx \V, \OFF, \R1
-.endm
-
-;# r3 short *input
-;# r4 short *output
-;# r5 int pitch
- .align 2
-short_idct4x4_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xfff8
- mtspr 256, r12 ;# set VRSAVE
-
- load_c v8, sinpi8sqrt2, 0, r9, r10
- load_c v9, cospi8sqrt2minus1, 0, r9, r10
- load_c v10, hi_hi, 0, r9, r10
- load_c v11, lo_lo, 0, r9, r10
- load_c v12, shift_16, 0, r9, r10
-
- li r10, 16
- lvx v0, 0, r3 ;# input ip[0], ip[ 4]
- lvx v1, r10, r3 ;# input ip[8], ip[12]
-
- ;# first pass
- vupkhsh v2, v0
- vupkhsh v3, v1
- vaddsws v6, v2, v3 ;# a1 = ip[0]+ip[8]
- vsubsws v7, v2, v3 ;# b1 = ip[0]-ip[8]
-
- vupklsh v0, v0
- vmulosh v4, v0, v8
- vsraw v4, v4, v12
- vaddsws v4, v4, v0 ;# ip[ 4] * sin(pi/8) * sqrt(2)
-
- vupklsh v1, v1
- vmulosh v5, v1, v9
- vsraw v5, v5, v12 ;# ip[12] * cos(pi/8) * sqrt(2)
- vaddsws v5, v5, v1
-
- vsubsws v4, v4, v5 ;# c1
-
- vmulosh v3, v1, v8
- vsraw v3, v3, v12
- vaddsws v3, v3, v1 ;# ip[12] * sin(pi/8) * sqrt(2)
-
- vmulosh v5, v0, v9
- vsraw v5, v5, v12 ;# ip[ 4] * cos(pi/8) * sqrt(2)
- vaddsws v5, v5, v0
-
- vaddsws v3, v3, v5 ;# d1
-
- vaddsws v0, v6, v3 ;# a1 + d1
- vsubsws v3, v6, v3 ;# a1 - d1
-
- vaddsws v1, v7, v4 ;# b1 + c1
- vsubsws v2, v7, v4 ;# b1 - c1
-
- ;# transpose input
- vmrghw v4, v0, v1 ;# a0 b0 a1 b1
- vmrghw v5, v2, v3 ;# c0 d0 c1 d1
-
- vmrglw v6, v0, v1 ;# a2 b2 a3 b3
- vmrglw v7, v2, v3 ;# c2 d2 c3 d3
-
- vperm v0, v4, v5, v10 ;# a0 b0 c0 d0
- vperm v1, v4, v5, v11 ;# a1 b1 c1 d1
-
- vperm v2, v6, v7, v10 ;# a2 b2 c2 d2
- vperm v3, v6, v7, v11 ;# a3 b3 c3 d3
-
- ;# second pass
- vaddsws v6, v0, v2 ;# a1 = ip[0]+ip[8]
- vsubsws v7, v0, v2 ;# b1 = ip[0]-ip[8]
-
- vmulosh v4, v1, v8
- vsraw v4, v4, v12
- vaddsws v4, v4, v1 ;# ip[ 4] * sin(pi/8) * sqrt(2)
-
- vmulosh v5, v3, v9
- vsraw v5, v5, v12 ;# ip[12] * cos(pi/8) * sqrt(2)
- vaddsws v5, v5, v3
-
- vsubsws v4, v4, v5 ;# c1
-
- vmulosh v2, v3, v8
- vsraw v2, v2, v12
- vaddsws v2, v2, v3 ;# ip[12] * sin(pi/8) * sqrt(2)
-
- vmulosh v5, v1, v9
- vsraw v5, v5, v12 ;# ip[ 4] * cos(pi/8) * sqrt(2)
- vaddsws v5, v5, v1
-
- vaddsws v3, v2, v5 ;# d1
-
- vaddsws v0, v6, v3 ;# a1 + d1
- vsubsws v3, v6, v3 ;# a1 - d1
-
- vaddsws v1, v7, v4 ;# b1 + c1
- vsubsws v2, v7, v4 ;# b1 - c1
-
- vspltish v6, 4
- vspltish v7, 3
-
- vpkswss v0, v0, v1
- vpkswss v1, v2, v3
-
- vaddshs v0, v0, v6
- vaddshs v1, v1, v6
-
- vsrah v0, v0, v7
- vsrah v1, v1, v7
-
- ;# transpose output
- vmrghh v2, v0, v1 ;# a0 c0 a1 c1 a2 c2 a3 c3
- vmrglh v3, v0, v1 ;# b0 d0 b1 d1 b2 d2 b3 d3
-
- vmrghh v0, v2, v3 ;# a0 b0 c0 d0 a1 b1 c1 d1
- vmrglh v1, v2, v3 ;# a2 b2 c2 d2 a3 b3 c3 d3
-
- stwu r1,-416(r1) ;# create space on the stack
-
- stvx v0, 0, r1
- lwz r6, 0(r1)
- stw r6, 0(r4)
- lwz r6, 4(r1)
- stw r6, 4(r4)
-
- add r4, r4, r5
-
- lwz r6, 8(r1)
- stw r6, 0(r4)
- lwz r6, 12(r1)
- stw r6, 4(r4)
-
- add r4, r4, r5
-
- stvx v1, 0, r1
- lwz r6, 0(r1)
- stw r6, 0(r4)
- lwz r6, 4(r1)
- stw r6, 4(r4)
-
- add r4, r4, r5
-
- lwz r6, 8(r1)
- stw r6, 0(r4)
- lwz r6, 12(r1)
- stw r6, 4(r4)
-
- addi r1, r1, 416 ;# recover stack
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 4
-sinpi8sqrt2:
- .short 35468, 35468, 35468, 35468, 35468, 35468, 35468, 35468
-
- .align 4
-cospi8sqrt2minus1:
- .short 20091, 20091, 20091, 20091, 20091, 20091, 20091, 20091
-
- .align 4
-shift_16:
- .long 16, 16, 16, 16
-
- .align 4
-hi_hi:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
-
- .align 4
-lo_lo:
- .byte 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
--- a/vp9/common/ppc/vp9_loopfilter_altivec.c
+++ /dev/null
@@ -1,127 +1,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 "vp9/common/vp9_loopfilter.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-typedef void loop_filter_function_y_ppc
-(
- unsigned char *s, // source pointer
- int p, // pitch
- const signed char *flimit,
- const signed char *limit,
- const signed char *thresh
-);
-
-typedef void loop_filter_function_uv_ppc
-(
- unsigned char *u, // source pointer
- unsigned char *v, // source pointer
- int p, // pitch
- const signed char *flimit,
- const signed char *limit,
- const signed char *thresh
-);
-
-typedef void loop_filter_function_s_ppc
-(
- unsigned char *s, // source pointer
- int p, // pitch
- const signed char *flimit
-);
-
-loop_filter_function_y_ppc mbloop_filter_horizontal_edge_y_ppc;
-loop_filter_function_y_ppc mbloop_filter_vertical_edge_y_ppc;
-loop_filter_function_y_ppc loop_filter_horizontal_edge_y_ppc;
-loop_filter_function_y_ppc loop_filter_vertical_edge_y_ppc;
-
-loop_filter_function_uv_ppc mbloop_filter_horizontal_edge_uv_ppc;
-loop_filter_function_uv_ppc mbloop_filter_vertical_edge_uv_ppc;
-loop_filter_function_uv_ppc loop_filter_horizontal_edge_uv_ppc;
-loop_filter_function_uv_ppc loop_filter_vertical_edge_uv_ppc;
-
-loop_filter_function_s_ppc loop_filter_simple_horizontal_edge_ppc;
-loop_filter_function_s_ppc loop_filter_simple_vertical_edge_ppc;
-
-// Horizontal MB filtering
-void loop_filter_mbh_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi) {
- mbloop_filter_horizontal_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr);
-
- if (u_ptr)
- mbloop_filter_horizontal_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr);
-}
-
-void loop_filter_mbhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi) {
- (void)u_ptr;
- (void)v_ptr;
- (void)uv_stride;
- loop_filter_simple_horizontal_edge_ppc(y_ptr, y_stride, lfi->mbflim);
-}
-
-// Vertical MB Filtering
-void loop_filter_mbv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi) {
- mbloop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr);
-
- if (u_ptr)
- mbloop_filter_vertical_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr);
-}
-
-void loop_filter_mbvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi) {
- (void)u_ptr;
- (void)v_ptr;
- (void)uv_stride;
- loop_filter_simple_vertical_edge_ppc(y_ptr, y_stride, lfi->mbflim);
-}
-
-// Horizontal B Filtering
-void loop_filter_bh_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi) {
- // These should all be done at once with one call, instead of 3
- loop_filter_horizontal_edge_y_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
- loop_filter_horizontal_edge_y_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
- loop_filter_horizontal_edge_y_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr);
-
- if (u_ptr)
- loop_filter_horizontal_edge_uv_ppc(u_ptr + 4 * uv_stride, v_ptr + 4 * uv_stride, uv_stride, lfi->flim, lfi->lim, lfi->thr);
-}
-
-void loop_filter_bhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi) {
- (void)u_ptr;
- (void)v_ptr;
- (void)uv_stride;
- loop_filter_simple_horizontal_edge_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim);
- loop_filter_simple_horizontal_edge_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim);
- loop_filter_simple_horizontal_edge_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim);
-}
-
-// Vertical B Filtering
-void loop_filter_bv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi) {
- loop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->flim, lfi->lim, lfi->thr);
-
- if (u_ptr)
- loop_filter_vertical_edge_uv_ppc(u_ptr + 4, v_ptr + 4, uv_stride, lfi->flim, lfi->lim, lfi->thr);
-}
-
-void loop_filter_bvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
- int y_stride, int uv_stride, loop_filter_info *lfi) {
- (void)u_ptr;
- (void)v_ptr;
- (void)uv_stride;
- loop_filter_simple_vertical_edge_ppc(y_ptr + 4, y_stride, lfi->flim);
- loop_filter_simple_vertical_edge_ppc(y_ptr + 8, y_stride, lfi->flim);
- loop_filter_simple_vertical_edge_ppc(y_ptr + 12, y_stride, lfi->flim);
-}
--- a/vp9/common/ppc/vp9_loopfilter_filters_altivec.asm
+++ /dev/null
@@ -1,1253 +1,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.
-;
-
-
- .globl mbloop_filter_horizontal_edge_y_ppc
- .globl loop_filter_horizontal_edge_y_ppc
- .globl mbloop_filter_vertical_edge_y_ppc
- .globl loop_filter_vertical_edge_y_ppc
-
- .globl mbloop_filter_horizontal_edge_uv_ppc
- .globl loop_filter_horizontal_edge_uv_ppc
- .globl mbloop_filter_vertical_edge_uv_ppc
- .globl loop_filter_vertical_edge_uv_ppc
-
- .globl loop_filter_simple_horizontal_edge_ppc
- .globl loop_filter_simple_vertical_edge_ppc
-
- .text
-;# We often need to perform transposes (and other transpose-like operations)
-;# on matrices of data. This is simplified by the fact that we usually
-;# operate on hunks of data whose dimensions are powers of 2, or at least
-;# divisible by highish powers of 2.
-;#
-;# These operations can be very confusing. They become more straightforward
-;# when we think of them as permutations of address bits: Concatenate a
-;# group of vector registers and think of it as occupying a block of
-;# memory beginning at address zero. The low four bits 0...3 of the
-;# address then correspond to position within a register, the higher-order
-;# address bits select the register.
-;#
-;# Although register selection, at the code level, is arbitrary, things
-;# are simpler if we use contiguous ranges of register numbers, simpler
-;# still if the low-order bits of the register number correspond to
-;# conceptual address bits. We do this whenever reasonable.
-;#
-;# A 16x16 transpose can then be thought of as an operation on
-;# a 256-element block of memory. It takes 8 bits 0...7 to address this
-;# memory and the effect of a transpose is to interchange address bit
-;# 0 with 4, 1 with 5, 2 with 6, and 3 with 7. Bits 0...3 index the
-;# column, which is interchanged with the row addressed by bits 4..7.
-;#
-;# The altivec merge instructions provide a rapid means of effecting
-;# many of these transforms. They operate at three widths (8,16,32).
-;# Writing V(x) for vector register #x, paired merges permute address
-;# indices as follows.
-;#
-;# 0->1 1->2 2->3 3->(4+d) (4+s)->0:
-;#
-;# vmrghb V( x), V( y), V( y + (1<<s))
-;# vmrglb V( x + (1<<d)), V( y), V( y + (1<<s))
-;#
-;#
-;# =0= 1->2 2->3 3->(4+d) (4+s)->1:
-;#
-;# vmrghh V( x), V( y), V( y + (1<<s))
-;# vmrglh V( x + (1<<d)), V( y), V( y + (1<<s))
-;#
-;#
-;# =0= =1= 2->3 3->(4+d) (4+s)->2:
-;#
-;# vmrghw V( x), V( y), V( y + (1<<s))
-;# vmrglw V( x + (1<<d)), V( y), V( y + (1<<s))
-;#
-;#
-;# Unfortunately, there is no doubleword merge instruction.
-;# The following sequence uses "vperm" is a substitute.
-;# Assuming that the selection masks b_hihi and b_lolo (defined in LFppc.c)
-;# are in registers Vhihi and Vlolo, we can also effect the permutation
-;#
-;# =0= =1= =2= 3->(4+d) (4+s)->3 by the sequence:
-;#
-;# vperm V( x), V( y), V( y + (1<<s)), Vhihi
-;# vperm V( x + (1<<d)), V( y), V( y + (1<<s)), Vlolo
-;#
-;#
-;# Except for bits s and d, the other relationships between register
-;# number (= high-order part of address) bits are at the disposal of
-;# the programmer.
-;#
-
-;# To avoid excess transposes, we filter all 3 vertical luma subblock
-;# edges together. This requires a single 16x16 transpose, which, in
-;# the above language, amounts to the following permutation of address
-;# indices: 0<->4 1<->5 2<->6 3<->7, which we accomplish by
-;# 4 iterations of the cyclic transform 0->1->2->3->4->5->6->7->0.
-;#
-;# Except for the fact that the destination registers get written
-;# before we are done referencing the old contents, the cyclic transform
-;# is effected by
-;#
-;# x = 0; do {
-;# vmrghb V(2x), V(x), V(x+8);
-;# vmrghb V(2x+1), V(x), V(x+8);
-;# } while( ++x < 8);
-;#
-;# For clarity, and because we can afford it, we do this transpose
-;# using all 32 registers, alternating the banks 0..15 and 16 .. 31,
-;# leaving the final result in 16 .. 31, as the lower registers are
-;# used in the filtering itself.
-;#
-.macro Tpair A, B, X, Y
- vmrghb \A, \X, \Y
- vmrglb \B, \X, \Y
-.endm
-
-;# Each step takes 8*2 = 16 instructions
-
-.macro t16_even
- Tpair v16,v17, v0,v8
- Tpair v18,v19, v1,v9
- Tpair v20,v21, v2,v10
- Tpair v22,v23, v3,v11
- Tpair v24,v25, v4,v12
- Tpair v26,v27, v5,v13
- Tpair v28,v29, v6,v14
- Tpair v30,v31, v7,v15
-.endm
-
-.macro t16_odd
- Tpair v0,v1, v16,v24
- Tpair v2,v3, v17,v25
- Tpair v4,v5, v18,v26
- Tpair v6,v7, v19,v27
- Tpair v8,v9, v20,v28
- Tpair v10,v11, v21,v29
- Tpair v12,v13, v22,v30
- Tpair v14,v15, v23,v31
-.endm
-
-;# Whole transpose takes 4*16 = 64 instructions
-
-.macro t16_full
- t16_odd
- t16_even
- t16_odd
- t16_even
-.endm
-
-;# Vertical edge filtering requires transposes. For the simple filter,
-;# we need to convert 16 rows of 4 pels each into 4 registers of 16 pels
-;# each. Writing 0 ... 63 for the pixel indices, the desired result is:
-;#
-;# v0 = 0 1 ... 14 15
-;# v1 = 16 17 ... 30 31
-;# v2 = 32 33 ... 47 48
-;# v3 = 49 50 ... 62 63
-;#
-;# In frame-buffer memory, the layout is:
-;#
-;# 0 16 32 48
-;# 1 17 33 49
-;# ...
-;# 15 31 47 63.
-;#
-;# We begin by reading the data 32 bits at a time (using scalar operations)
-;# into a temporary array, reading the rows of the array into vector registers,
-;# with the following layout:
-;#
-;# v0 = 0 16 32 48 4 20 36 52 8 24 40 56 12 28 44 60
-;# v1 = 1 17 33 49 5 21 ... 45 61
-;# v2 = 2 18 ... 46 62
-;# v3 = 3 19 ... 47 63
-;#
-;# From the "address-bit" perspective discussed above, we simply need to
-;# interchange bits 0 <-> 4 and 1 <-> 5, leaving bits 2 and 3 alone.
-;# In other words, we transpose each of the four 4x4 submatrices.
-;#
-;# This transformation is its own inverse, and we need to perform it
-;# again before writing the pixels back into the frame buffer.
-;#
-;# It acts in place on registers v0...v3, uses v4...v7 as temporaries,
-;# and assumes that v14/v15 contain the b_hihi/b_lolo selectors
-;# defined above. We think of both groups of 4 registers as having
-;# "addresses" {0,1,2,3} * 16.
-;#
-.macro Transpose4times4x4 Vlo, Vhi
-
- ;# d=s=0 0->1 1->2 2->3 3->4 4->0 =5=
-
- vmrghb v4, v0, v1
- vmrglb v5, v0, v1
- vmrghb v6, v2, v3
- vmrglb v7, v2, v3
-
- ;# d=0 s=1 =0= 1->2 2->3 3->4 4->5 5->1
-
- vmrghh v0, v4, v6
- vmrglh v1, v4, v6
- vmrghh v2, v5, v7
- vmrglh v3, v5, v7
-
- ;# d=s=0 =0= =1= 2->3 3->4 4->2 =5=
-
- vmrghw v4, v0, v1
- vmrglw v5, v0, v1
- vmrghw v6, v2, v3
- vmrglw v7, v2, v3
-
- ;# d=0 s=1 =0= =1= =2= 3->4 4->5 5->3
-
- vperm v0, v4, v6, \Vlo
- vperm v1, v4, v6, \Vhi
- vperm v2, v5, v7, \Vlo
- vperm v3, v5, v7, \Vhi
-.endm
-;# end Transpose4times4x4
-
-
-;# Normal mb vertical edge filter transpose.
-;#
-;# We read 8 columns of data, initially in the following pattern:
-;#
-;# (0,0) (1,0) ... (7,0) (0,1) (1,1) ... (7,1)
-;# (0,2) (1,2) ... (7,2) (0,3) (1,3) ... (7,3)
-;# ...
-;# (0,14) (1,14) .. (7,14) (0,15) (1,15) .. (7,15)
-;#
-;# and wish to convert to:
-;#
-;# (0,0) ... (0,15)
-;# (1,0) ... (1,15)
-;# ...
-;# (7,0) ... (7,15).
-;#
-;# In "address bit" language, we wish to map
-;#
-;# 0->4 1->5 2->6 3->0 4->1 5->2 6->3, i.e., I -> (I+4) mod 7.
-;#
-;# This can be accomplished by 4 iterations of the cyclic transform
-;#
-;# I -> (I+1) mod 7;
-;#
-;# each iteration can be realized by (d=0, s=2):
-;#
-;# x = 0; do Tpair( V(2x),V(2x+1), V(x),V(x+4)) while( ++x < 4);
-;#
-;# The input/output is in registers v0...v7. We use v10...v17 as mirrors;
-;# preserving v8 = sign converter.
-;#
-;# Inverse transpose is similar, except here I -> (I+3) mod 7 and the
-;# result lands in the "mirror" registers v10...v17
-;#
-.macro t8x16_odd
- Tpair v10, v11, v0, v4
- Tpair v12, v13, v1, v5
- Tpair v14, v15, v2, v6
- Tpair v16, v17, v3, v7
-.endm
-
-.macro t8x16_even
- Tpair v0, v1, v10, v14
- Tpair v2, v3, v11, v15
- Tpair v4, v5, v12, v16
- Tpair v6, v7, v13, v17
-.endm
-
-.macro transpose8x16_fwd
- t8x16_odd
- t8x16_even
- t8x16_odd
- t8x16_even
-.endm
-
-.macro transpose8x16_inv
- t8x16_odd
- t8x16_even
- t8x16_odd
-.endm
-
-.macro Transpose16x16
- vmrghb v0, v16, v24
- vmrglb v1, v16, v24
- vmrghb v2, v17, v25
- vmrglb v3, v17, v25
- vmrghb v4, v18, v26
- vmrglb v5, v18, v26
- vmrghb v6, v19, v27
- vmrglb v7, v19, v27
- vmrghb v8, v20, v28
- vmrglb v9, v20, v28
- vmrghb v10, v21, v29
- vmrglb v11, v21, v29
- vmrghb v12, v22, v30
- vmrglb v13, v22, v30
- vmrghb v14, v23, v31
- vmrglb v15, v23, v31
- vmrghb v16, v0, v8
- vmrglb v17, v0, v8
- vmrghb v18, v1, v9
- vmrglb v19, v1, v9
- vmrghb v20, v2, v10
- vmrglb v21, v2, v10
- vmrghb v22, v3, v11
- vmrglb v23, v3, v11
- vmrghb v24, v4, v12
- vmrglb v25, v4, v12
- vmrghb v26, v5, v13
- vmrglb v27, v5, v13
- vmrghb v28, v6, v14
- vmrglb v29, v6, v14
- vmrghb v30, v7, v15
- vmrglb v31, v7, v15
- vmrghb v0, v16, v24
- vmrglb v1, v16, v24
- vmrghb v2, v17, v25
- vmrglb v3, v17, v25
- vmrghb v4, v18, v26
- vmrglb v5, v18, v26
- vmrghb v6, v19, v27
- vmrglb v7, v19, v27
- vmrghb v8, v20, v28
- vmrglb v9, v20, v28
- vmrghb v10, v21, v29
- vmrglb v11, v21, v29
- vmrghb v12, v22, v30
- vmrglb v13, v22, v30
- vmrghb v14, v23, v31
- vmrglb v15, v23, v31
- vmrghb v16, v0, v8
- vmrglb v17, v0, v8
- vmrghb v18, v1, v9
- vmrglb v19, v1, v9
- vmrghb v20, v2, v10
- vmrglb v21, v2, v10
- vmrghb v22, v3, v11
- vmrglb v23, v3, v11
- vmrghb v24, v4, v12
- vmrglb v25, v4, v12
- vmrghb v26, v5, v13
- vmrglb v27, v5, v13
- vmrghb v28, v6, v14
- vmrglb v29, v6, v14
- vmrghb v30, v7, v15
- vmrglb v31, v7, v15
-.endm
-
-;# load_g loads a global vector (whose address is in the local variable Gptr)
-;# into vector register Vreg. Trashes r0
-.macro load_g Vreg, Gptr
- lwz r0, \Gptr
- lvx \Vreg, 0, r0
-.endm
-
-;# exploit the saturation here. if the answer is negative
-;# it will be clamped to 0. orring 0 with a positive
-;# number will be the positive number (abs)
-;# RES = abs( A-B), trashes TMP
-.macro Abs RES, TMP, A, B
- vsububs \RES, \A, \B
- vsububs \TMP, \B, \A
- vor \RES, \RES, \TMP
-.endm
-
-;# RES = Max( RES, abs( A-B)), trashes TMP
-.macro max_abs RES, TMP, A, B
- vsububs \TMP, \A, \B
- vmaxub \RES, \RES, \TMP
- vsububs \TMP, \B, \A
- vmaxub \RES, \RES, \TMP
-.endm
-
-.macro Masks
- ;# build masks
- ;# input is all 8 bit unsigned (0-255). need to
- ;# do abs(vala-valb) > limit. but no need to compare each
- ;# value to the limit. find the max of the absolute differences
- ;# and compare that to the limit.
- ;# First hev
- Abs v14, v13, v2, v3 ;# |P1 - P0|
- max_abs v14, v13, v5, v4 ;# |Q1 - Q0|
-
- vcmpgtub v10, v14, v10 ;# HEV = true if thresh exceeded
-
- ;# Next limit
- max_abs v14, v13, v0, v1 ;# |P3 - P2|
- max_abs v14, v13, v1, v2 ;# |P2 - P1|
- max_abs v14, v13, v6, v5 ;# |Q2 - Q1|
- max_abs v14, v13, v7, v6 ;# |Q3 - Q2|
-
- vcmpgtub v9, v14, v9 ;# R = true if limit exceeded
-
- ;# flimit
- Abs v14, v13, v3, v4 ;# |P0 - Q0|
-
- vcmpgtub v8, v14, v8 ;# X = true if flimit exceeded
-
- vor v8, v8, v9 ;# R = true if flimit or limit exceeded
- ;# done building masks
-.endm
-
-.macro build_constants RFL, RLI, RTH, FL, LI, TH
- ;# build constants
- lvx \FL, 0, \RFL ;# flimit
- lvx \LI, 0, \RLI ;# limit
- lvx \TH, 0, \RTH ;# thresh
-
- vspltisb v11, 8
- vspltisb v12, 4
- vslb v11, v11, v12 ;# 0x80808080808080808080808080808080
-.endm
-
-.macro load_data_y
- ;# setup strides/pointers to be able to access
- ;# all of the data
- add r5, r4, r4 ;# r5 = 2 * stride
- sub r6, r3, r5 ;# r6 -> 2 rows back
- neg r7, r4 ;# r7 = -stride
-
- ;# load 16 pixels worth of data to work on
- sub r0, r6, r5 ;# r0 -> 4 rows back (temp)
- lvx v0, 0, r0 ;# P3 (read only)
- lvx v1, r7, r6 ;# P2
- lvx v2, 0, r6 ;# P1
- lvx v3, r7, r3 ;# P0
- lvx v4, 0, r3 ;# Q0
- lvx v5, r4, r3 ;# Q1
- lvx v6, r5, r3 ;# Q2
- add r0, r3, r5 ;# r0 -> 2 rows fwd (temp)
- lvx v7, r4, r0 ;# Q3 (read only)
-.endm
-
-;# Expects
-;# v10 == HEV
-;# v13 == tmp
-;# v14 == tmp
-.macro common_adjust P0, Q0, P1, Q1, HEV_PRESENT
- vxor \P1, \P1, v11 ;# SP1
- vxor \P0, \P0, v11 ;# SP0
- vxor \Q0, \Q0, v11 ;# SQ0
- vxor \Q1, \Q1, v11 ;# SQ1
-
- vsubsbs v13, \P1, \Q1 ;# f = c (P1 - Q1)
-.if \HEV_PRESENT
- vand v13, v13, v10 ;# f &= hev
-.endif
- vsubsbs v14, \Q0, \P0 ;# -126 <= X = Q0-P0 <= +126
- vaddsbs v13, v13, v14
- vaddsbs v13, v13, v14
- vaddsbs v13, v13, v14 ;# A = c( c(P1-Q1) + 3*(Q0-P0))
-
- vandc v13, v13, v8 ;# f &= mask
-
- vspltisb v8, 3
- vspltisb v9, 4
-
- vaddsbs v14, v13, v9 ;# f1 = c (f+4)
- vaddsbs v15, v13, v8 ;# f2 = c (f+3)
-
- vsrab v13, v14, v8 ;# f1 >>= 3
- vsrab v15, v15, v8 ;# f2 >>= 3
-
- vsubsbs \Q0, \Q0, v13 ;# u1 = c (SQ0 - f1)
- vaddsbs \P0, \P0, v15 ;# u2 = c (SP0 + f2)
-.endm
-
-.macro vp8_mbfilter
- Masks
-
- ;# start the fitering here
- vxor v1, v1, v11 ;# SP2
- vxor v2, v2, v11 ;# SP1
- vxor v3, v3, v11 ;# SP0
- vxor v4, v4, v11 ;# SQ0
- vxor v5, v5, v11 ;# SQ1
- vxor v6, v6, v11 ;# SQ2
-
- ;# add outer taps if we have high edge variance
- vsubsbs v13, v2, v5 ;# f = c (SP1-SQ1)
-
- vsubsbs v14, v4, v3 ;# SQ0-SP0
- vaddsbs v13, v13, v14
- vaddsbs v13, v13, v14
- vaddsbs v13, v13, v14 ;# f = c( c(SP1-SQ1) + 3*(SQ0-SP0))
-
- vandc v13, v13, v8 ;# f &= mask
- vand v15, v13, v10 ;# f2 = f & hev
-
- ;# save bottom 3 bits so that we round one side +4 and the other +3
- vspltisb v8, 3
- vspltisb v9, 4
-
- vaddsbs v14, v15, v9 ;# f1 = c (f+4)
- vaddsbs v15, v15, v8 ;# f2 = c (f+3)
-
- vsrab v14, v14, v8 ;# f1 >>= 3
- vsrab v15, v15, v8 ;# f2 >>= 3
-
- vsubsbs v4, v4, v14 ;# u1 = c (SQ0 - f1)
- vaddsbs v3, v3, v15 ;# u2 = c (SP0 + f2)
-
- ;# only apply wider filter if not high edge variance
- vandc v13, v13, v10 ;# f &= ~hev
-
- vspltisb v9, 2
- vnor v8, v8, v8
- vsrb v9, v8, v9 ;# 0x3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f
- vupkhsb v9, v9 ;# 0x003f003f003f003f003f003f003f003f
- vspltisb v8, 9
-
- ;# roughly 1/7th difference across boundary
- vspltish v10, 7
- vmulosb v14, v8, v13 ;# A = c( c(P1-Q1) + 3*(Q0-P0))
- vmulesb v15, v8, v13
- vaddshs v14, v14, v9 ;# += 63
- vaddshs v15, v15, v9
- vsrah v14, v14, v10 ;# >>= 7
- vsrah v15, v15, v10
- vmrglh v10, v15, v14
- vmrghh v15, v15, v14
-
- vpkshss v10, v15, v10 ;# X = saturated down to bytes
-
- vsubsbs v6, v6, v10 ;# subtract from Q and add to P
- vaddsbs v1, v1, v10
-
- vxor v6, v6, v11
- vxor v1, v1, v11
-
- ;# roughly 2/7th difference across boundary
- vspltish v10, 7
- vaddubm v12, v8, v8
- vmulosb v14, v12, v13 ;# A = c( c(P1-Q1) + 3*(Q0-P0))
- vmulesb v15, v12, v13
- vaddshs v14, v14, v9
- vaddshs v15, v15, v9
- vsrah v14, v14, v10 ;# >>= 7
- vsrah v15, v15, v10
- vmrglh v10, v15, v14
- vmrghh v15, v15, v14
-
- vpkshss v10, v15, v10 ;# X = saturated down to bytes
-
- vsubsbs v5, v5, v10 ;# subtract from Q and add to P
- vaddsbs v2, v2, v10
-
- vxor v5, v5, v11
- vxor v2, v2, v11
-
- ;# roughly 3/7th difference across boundary
- vspltish v10, 7
- vaddubm v12, v12, v8
- vmulosb v14, v12, v13 ;# A = c( c(P1-Q1) + 3*(Q0-P0))
- vmulesb v15, v12, v13
- vaddshs v14, v14, v9
- vaddshs v15, v15, v9
- vsrah v14, v14, v10 ;# >>= 7
- vsrah v15, v15, v10
- vmrglh v10, v15, v14
- vmrghh v15, v15, v14
-
- vpkshss v10, v15, v10 ;# X = saturated down to bytes
-
- vsubsbs v4, v4, v10 ;# subtract from Q and add to P
- vaddsbs v3, v3, v10
-
- vxor v4, v4, v11
- vxor v3, v3, v11
-.endm
-
-.macro SBFilter
- Masks
-
- common_adjust v3, v4, v2, v5, 1
-
- ;# outer tap adjustments
- vspltisb v8, 1
-
- vaddubm v13, v13, v8 ;# f += 1
- vsrab v13, v13, v8 ;# f >>= 1
-
- vandc v13, v13, v10 ;# f &= ~hev
-
- vsubsbs v5, v5, v13 ;# u1 = c (SQ1 - f)
- vaddsbs v2, v2, v13 ;# u2 = c (SP1 + f)
-
- vxor v2, v2, v11
- vxor v3, v3, v11
- vxor v4, v4, v11
- vxor v5, v5, v11
-.endm
-
- .align 2
-mbloop_filter_horizontal_edge_y_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- build_constants r5, r6, r7, v8, v9, v10
-
- load_data_y
-
- vp8_mbfilter
-
- stvx v1, r7, r6 ;# P2
- stvx v2, 0, r6 ;# P1
- stvx v3, r7, r3 ;# P0
- stvx v4, 0, r3 ;# Q0
- stvx v5, r4, r3 ;# Q1
- stvx v6, r5, r3 ;# Q2
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-;# r6 const signed char *limit
-;# r7 const signed char *thresh
-loop_filter_horizontal_edge_y_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- build_constants r5, r6, r7, v8, v9, v10
-
- load_data_y
-
- SBFilter
-
- stvx v2, 0, r6 ;# P1
- stvx v3, r7, r3 ;# P0
- stvx v4, 0, r3 ;# Q0
- stvx v5, r4, r3 ;# Q1
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-;# Filtering a vertical mb. Each mb is aligned on a 16 byte boundary.
-;# So we can read in an entire mb aligned. However if we want to filter the mb
-;# edge we run into problems. For the loopfilter we require 4 bytes before the mb
-;# and 4 after for a total of 8 bytes. Reading 16 bytes inorder to get 4 is a bit
-;# of a waste. So this is an even uglier way to get around that.
-;# Using the regular register file words are read in and then saved back out to
-;# memory to align and order them up. Then they are read in using the
-;# vector register file.
-.macro RLVmb V, R
- lwzux r0, r3, r4
- stw r0, 4(\R)
- lwz r0,-4(r3)
- stw r0, 0(\R)
- lwzux r0, r3, r4
- stw r0,12(\R)
- lwz r0,-4(r3)
- stw r0, 8(\R)
- lvx \V, 0, \R
-.endm
-
-.macro WLVmb V, R
- stvx \V, 0, \R
- lwz r0,12(\R)
- stwux r0, r3, r4
- lwz r0, 8(\R)
- stw r0,-4(r3)
- lwz r0, 4(\R)
- stwux r0, r3, r4
- lwz r0, 0(\R)
- stw r0,-4(r3)
-.endm
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-;# r6 const signed char *limit
-;# r7 const signed char *thresh
-mbloop_filter_vertical_edge_y_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xc000
- mtspr 256, r12 ;# set VRSAVE
-
- la r9, -48(r1) ;# temporary space for reading in vectors
- sub r3, r3, r4
-
- RLVmb v0, r9
- RLVmb v1, r9
- RLVmb v2, r9
- RLVmb v3, r9
- RLVmb v4, r9
- RLVmb v5, r9
- RLVmb v6, r9
- RLVmb v7, r9
-
- transpose8x16_fwd
-
- build_constants r5, r6, r7, v8, v9, v10
-
- vp8_mbfilter
-
- transpose8x16_inv
-
- add r3, r3, r4
- neg r4, r4
-
- WLVmb v17, r9
- WLVmb v16, r9
- WLVmb v15, r9
- WLVmb v14, r9
- WLVmb v13, r9
- WLVmb v12, r9
- WLVmb v11, r9
- WLVmb v10, r9
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-.macro RL V, R, P
- lvx \V, 0, \R
- add \R, \R, \P
-.endm
-
-.macro WL V, R, P
- stvx \V, 0, \R
- add \R, \R, \P
-.endm
-
-.macro Fil P3, P2, P1, P0, Q0, Q1, Q2, Q3
- ;# K = |P0-P1| already
- Abs v14, v13, \Q0, \Q1 ;# M = |Q0-Q1|
- vmaxub v14, v14, v4 ;# M = max( |P0-P1|, |Q0-Q1|)
- vcmpgtub v10, v14, v0
-
- Abs v4, v5, \Q2, \Q3 ;# K = |Q2-Q3| = next |P0-P1]
-
- max_abs v14, v13, \Q1, \Q2 ;# M = max( M, |Q1-Q2|)
- max_abs v14, v13, \P1, \P2 ;# M = max( M, |P1-P2|)
- max_abs v14, v13, \P2, \P3 ;# M = max( M, |P2-P3|)
-
- vmaxub v14, v14, v4 ;# M = max interior abs diff
- vcmpgtub v9, v14, v2 ;# M = true if int_l exceeded
-
- Abs v14, v13, \P0, \Q0 ;# X = Abs( P0-Q0)
- vcmpgtub v8, v14, v3 ;# X = true if edge_l exceeded
- vor v8, v8, v9 ;# M = true if edge_l or int_l exceeded
-
- ;# replace P1,Q1 w/signed versions
- common_adjust \P0, \Q0, \P1, \Q1, 1
-
- vaddubm v13, v13, v1 ;# -16 <= M <= 15, saturation irrelevant
- vsrab v13, v13, v1
- vandc v13, v13, v10 ;# adjust P1,Q1 by (M+1)>>1 if ! hev
- vsubsbs \Q1, \Q1, v13
- vaddsbs \P1, \P1, v13
-
- vxor \P1, \P1, v11 ;# P1
- vxor \P0, \P0, v11 ;# P0
- vxor \Q0, \Q0, v11 ;# Q0
- vxor \Q1, \Q1, v11 ;# Q1
-.endm
-
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-;# r6 const signed char *limit
-;# r7 const signed char *thresh
-loop_filter_vertical_edge_y_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- addi r9, r3, 0
- RL v16, r9, r4
- RL v17, r9, r4
- RL v18, r9, r4
- RL v19, r9, r4
- RL v20, r9, r4
- RL v21, r9, r4
- RL v22, r9, r4
- RL v23, r9, r4
- RL v24, r9, r4
- RL v25, r9, r4
- RL v26, r9, r4
- RL v27, r9, r4
- RL v28, r9, r4
- RL v29, r9, r4
- RL v30, r9, r4
- lvx v31, 0, r9
-
- Transpose16x16
-
- vspltisb v1, 1
-
- build_constants r5, r6, r7, v3, v2, v0
-
- Abs v4, v5, v19, v18 ;# K(v14) = first |P0-P1|
-
- Fil v16, v17, v18, v19, v20, v21, v22, v23
- Fil v20, v21, v22, v23, v24, v25, v26, v27
- Fil v24, v25, v26, v27, v28, v29, v30, v31
-
- Transpose16x16
-
- addi r9, r3, 0
- WL v16, r9, r4
- WL v17, r9, r4
- WL v18, r9, r4
- WL v19, r9, r4
- WL v20, r9, r4
- WL v21, r9, r4
- WL v22, r9, r4
- WL v23, r9, r4
- WL v24, r9, r4
- WL v25, r9, r4
- WL v26, r9, r4
- WL v27, r9, r4
- WL v28, r9, r4
- WL v29, r9, r4
- WL v30, r9, r4
- stvx v31, 0, r9
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-;# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- UV FILTERING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-.macro active_chroma_sel V
- andi. r7, r3, 8 ;# row origin modulo 16
- add r7, r7, r7 ;# selects selectors
- lis r12, _chromaSelectors@ha
- la r0, _chromaSelectors@l(r12)
- lwzux r0, r7, r0 ;# leave selector addr in r7
-
- lvx \V, 0, r0 ;# mask to concatenate active U,V pels
-.endm
-
-.macro hread_uv Dest, U, V, Offs, VMask
- lvx \U, \Offs, r3
- lvx \V, \Offs, r4
- vperm \Dest, \U, \V, \VMask ;# Dest = active part of U then V
-.endm
-
-.macro hwrite_uv New, U, V, Offs, Umask, Vmask
- vperm \U, \New, \U, \Umask ;# Combine new pels with siblings
- vperm \V, \New, \V, \Vmask
- stvx \U, \Offs, r3 ;# Write to frame buffer
- stvx \V, \Offs, r4
-.endm
-
-;# Process U,V in parallel.
-.macro load_chroma_h
- neg r9, r5 ;# r9 = -1 * stride
- add r8, r9, r9 ;# r8 = -2 * stride
- add r10, r5, r5 ;# r10 = 2 * stride
-
- active_chroma_sel v12
-
- ;# P3, Q3 are read-only; need not save addresses or sibling pels
- add r6, r8, r8 ;# r6 = -4 * stride
- hread_uv v0, v14, v15, r6, v12
- add r6, r10, r5 ;# r6 = 3 * stride
- hread_uv v7, v14, v15, r6, v12
-
- ;# Others are read/write; save addresses and sibling pels
-
- add r6, r8, r9 ;# r6 = -3 * stride
- hread_uv v1, v16, v17, r6, v12
- hread_uv v2, v18, v19, r8, v12
- hread_uv v3, v20, v21, r9, v12
- hread_uv v4, v22, v23, 0, v12
- hread_uv v5, v24, v25, r5, v12
- hread_uv v6, v26, v27, r10, v12
-.endm
-
-.macro uresult_sel V
- load_g \V, 4(r7)
-.endm
-
-.macro vresult_sel V
- load_g \V, 8(r7)
-.endm
-
-;# always write P1,P0,Q0,Q1
-.macro store_chroma_h
- uresult_sel v11
- vresult_sel v12
- hwrite_uv v2, v18, v19, r8, v11, v12
- hwrite_uv v3, v20, v21, r9, v11, v12
- hwrite_uv v4, v22, v23, 0, v11, v12
- hwrite_uv v5, v24, v25, r5, v11, v12
-.endm
-
- .align 2
-;# r3 unsigned char *u
-;# r4 unsigned char *v
-;# r5 int p
-;# r6 const signed char *flimit
-;# r7 const signed char *limit
-;# r8 const signed char *thresh
-mbloop_filter_horizontal_edge_uv_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- build_constants r6, r7, r8, v8, v9, v10
-
- load_chroma_h
-
- vp8_mbfilter
-
- store_chroma_h
-
- hwrite_uv v1, v16, v17, r6, v11, v12 ;# v1 == P2
- hwrite_uv v6, v26, v27, r10, v11, v12 ;# v6 == Q2
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char *u
-;# r4 unsigned char *v
-;# r5 int p
-;# r6 const signed char *flimit
-;# r7 const signed char *limit
-;# r8 const signed char *thresh
-loop_filter_horizontal_edge_uv_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- build_constants r6, r7, r8, v8, v9, v10
-
- load_chroma_h
-
- SBFilter
-
- store_chroma_h
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-.macro R V, R
- lwzux r0, r3, r5
- stw r0, 4(\R)
- lwz r0,-4(r3)
- stw r0, 0(\R)
- lwzux r0, r4, r5
- stw r0,12(\R)
- lwz r0,-4(r4)
- stw r0, 8(\R)
- lvx \V, 0, \R
-.endm
-
-
-.macro W V, R
- stvx \V, 0, \R
- lwz r0,12(\R)
- stwux r0, r4, r5
- lwz r0, 8(\R)
- stw r0,-4(r4)
- lwz r0, 4(\R)
- stwux r0, r3, r5
- lwz r0, 0(\R)
- stw r0,-4(r3)
-.endm
-
-.macro chroma_vread R
- sub r3, r3, r5 ;# back up one line for simplicity
- sub r4, r4, r5
-
- R v0, \R
- R v1, \R
- R v2, \R
- R v3, \R
- R v4, \R
- R v5, \R
- R v6, \R
- R v7, \R
-
- transpose8x16_fwd
-.endm
-
-.macro chroma_vwrite R
-
- transpose8x16_inv
-
- add r3, r3, r5
- add r4, r4, r5
- neg r5, r5 ;# Write rows back in reverse order
-
- W v17, \R
- W v16, \R
- W v15, \R
- W v14, \R
- W v13, \R
- W v12, \R
- W v11, \R
- W v10, \R
-.endm
-
- .align 2
-;# r3 unsigned char *u
-;# r4 unsigned char *v
-;# r5 int p
-;# r6 const signed char *flimit
-;# r7 const signed char *limit
-;# r8 const signed char *thresh
-mbloop_filter_vertical_edge_uv_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xc000
- mtspr 256, r12 ;# set VRSAVE
-
- la r9, -48(r1) ;# temporary space for reading in vectors
-
- chroma_vread r9
-
- build_constants r6, r7, r8, v8, v9, v10
-
- vp8_mbfilter
-
- chroma_vwrite r9
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .align 2
-;# r3 unsigned char *u
-;# r4 unsigned char *v
-;# r5 int p
-;# r6 const signed char *flimit
-;# r7 const signed char *limit
-;# r8 const signed char *thresh
-loop_filter_vertical_edge_uv_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xc000
- mtspr 256, r12 ;# set VRSAVE
-
- la r9, -48(r1) ;# temporary space for reading in vectors
-
- chroma_vread r9
-
- build_constants r6, r7, r8, v8, v9, v10
-
- SBFilter
-
- chroma_vwrite r9
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-;# -=-=-=-=-=-=-=-=-=-=-=-=-=-= SIMPLE LOOP FILTER =-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
-.macro vp8_simple_filter
- Abs v14, v13, v1, v2 ;# M = abs( P0 - Q0)
- vcmpgtub v8, v14, v8 ;# v5 = true if _over_ limit
-
- ;# preserve unsigned v0 and v3
- common_adjust v1, v2, v0, v3, 0
-
- vxor v1, v1, v11
- vxor v2, v2, v11 ;# cvt Q0, P0 back to pels
-.endm
-
-.macro simple_vertical
- addi r8, 0, 16
- addi r7, r5, 32
-
- lvx v0, 0, r5
- lvx v1, r8, r5
- lvx v2, 0, r7
- lvx v3, r8, r7
-
- lis r12, _B_hihi@ha
- la r0, _B_hihi@l(r12)
- lvx v16, 0, r0
-
- lis r12, _B_lolo@ha
- la r0, _B_lolo@l(r12)
- lvx v17, 0, r0
-
- Transpose4times4x4 v16, v17
- vp8_simple_filter
-
- vxor v0, v0, v11
- vxor v3, v3, v11 ;# cvt Q0, P0 back to pels
-
- Transpose4times4x4 v16, v17
-
- stvx v0, 0, r5
- stvx v1, r8, r5
- stvx v2, 0, r7
- stvx v3, r8, r7
-.endm
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-loop_filter_simple_horizontal_edge_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- mtspr 256, r12 ;# set VRSAVE
-
- ;# build constants
- lvx v8, 0, r5 ;# flimit
-
- vspltisb v11, 8
- vspltisb v12, 4
- vslb v11, v11, v12 ;# 0x80808080808080808080808080808080
-
- neg r5, r4 ;# r5 = -1 * stride
- add r6, r5, r5 ;# r6 = -2 * stride
-
- lvx v0, r6, r3 ;# v0 = P1 = 16 pels two rows above edge
- lvx v1, r5, r3 ;# v1 = P0 = 16 pels one row above edge
- lvx v2, 0, r3 ;# v2 = Q0 = 16 pels one row below edge
- lvx v3, r4, r3 ;# v3 = Q1 = 16 pels two rows below edge
-
- vp8_simple_filter
-
- stvx v1, r5, r3 ;# store P0
- stvx v2, 0, r3 ;# store Q0
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
-.macro RLV Offs
- stw r0, (\Offs*4)(r5)
- lwzux r0, r7, r4
-.endm
-
-.macro WLV Offs
- lwz r0, (\Offs*4)(r5)
- stwux r0, r7, r4
-.endm
-
- .align 2
-;# r3 unsigned char *s
-;# r4 int p
-;# r5 const signed char *flimit
-loop_filter_simple_vertical_edge_ppc:
- mfspr r11, 256 ;# get old VRSAVE
- oris r12, r11, 0xffff
- ori r12, r12, 0xc000
- mtspr 256, r12 ;# set VRSAVE
-
- ;# build constants
- lvx v8, 0, r5 ;# flimit
-
- vspltisb v11, 8
- vspltisb v12, 4
- vslb v11, v11, v12 ;# 0x80808080808080808080808080808080
-
- la r5, -96(r1) ;# temporary space for reading in vectors
-
- ;# Store 4 pels at word "Offs" in temp array, then advance r7
- ;# to next row and read another 4 pels from the frame buffer.
-
- subi r7, r3, 2 ;# r7 -> 2 pels before start
- lwzx r0, 0, r7 ;# read first 4 pels
-
- ;# 16 unaligned word accesses
- RLV 0
- RLV 4
- RLV 8
- RLV 12
- RLV 1
- RLV 5
- RLV 9
- RLV 13
- RLV 2
- RLV 6
- RLV 10
- RLV 14
- RLV 3
- RLV 7
- RLV 11
-
- stw r0, (15*4)(r5) ;# write last 4 pels
-
- simple_vertical
-
- ;# Read temp array, write frame buffer.
- subi r7, r3, 2 ;# r7 -> 2 pels before start
- lwzx r0, 0, r5 ;# read/write first 4 pels
- stwx r0, 0, r7
-
- WLV 4
- WLV 8
- WLV 12
- WLV 1
- WLV 5
- WLV 9
- WLV 13
- WLV 2
- WLV 6
- WLV 10
- WLV 14
- WLV 3
- WLV 7
- WLV 11
- WLV 15
-
- mtspr 256, r11 ;# reset old VRSAVE
-
- blr
-
- .data
-
-_chromaSelectors:
- .long _B_hihi
- .long _B_Ures0
- .long _B_Vres0
- .long 0
- .long _B_lolo
- .long _B_Ures8
- .long _B_Vres8
- .long 0
-
- .align 4
-_B_Vres8:
- .byte 16, 17, 18, 19, 20, 21, 22, 23, 8, 9, 10, 11, 12, 13, 14, 15
-
- .align 4
-_B_Ures8:
- .byte 16, 17, 18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5, 6, 7
-
- .align 4
-_B_lolo:
- .byte 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
-
- .align 4
-_B_Vres0:
- .byte 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
- .align 4
-_B_Ures0:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31
-
- .align 4
-_B_hihi:
- .byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
--- a/vp9/common/ppc/vp9_platform_altivec.asm
+++ /dev/null
@@ -1,59 +1,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.
-;
-
-
- .globl save_platform_context
- .globl restore_platform_context
-
-.macro W V P
- stvx \V, 0, \P
- addi \P, \P, 16
-.endm
-
-.macro R V P
- lvx \V, 0, \P
- addi \P, \P, 16
-.endm
-
-;# r3 context_ptr
- .align 2
-save_platform_contex:
- W v20, r3
- W v21, r3
- W v22, r3
- W v23, r3
- W v24, r3
- W v25, r3
- W v26, r3
- W v27, r3
- W v28, r3
- W v29, r3
- W v30, r3
- W v31, r3
-
- blr
-
-;# r3 context_ptr
- .align 2
-restore_platform_context:
- R v20, r3
- R v21, r3
- R v22, r3
- R v23, r3
- R v24, r3
- R v25, r3
- R v26, r3
- R v27, r3
- R v28, r3
- R v29, r3
- R v30, r3
- R v31, r3
-
- blr
--- a/vp9/common/ppc/vp9_recon_altivec.asm
+++ /dev/null
@@ -1,175 +1,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.
-;
-
-
- .globl recon4b_ppc
- .globl recon2b_ppc
- .globl recon_b_ppc
-
-.macro row_of16 Diff Pred Dst Stride
- lvx v1, 0, \Pred ;# v1 = pred = p0..p15
- addi \Pred, \Pred, 16 ;# next pred
- vmrghb v2, v0, v1 ;# v2 = 16-bit p0..p7
- lvx v3, 0, \Diff ;# v3 = d0..d7
- vaddshs v2, v2, v3 ;# v2 = r0..r7
- vmrglb v1, v0, v1 ;# v1 = 16-bit p8..p15
- lvx v3, r8, \Diff ;# v3 = d8..d15
- addi \Diff, \Diff, 32 ;# next diff
- vaddshs v3, v3, v1 ;# v3 = r8..r15
- vpkshus v2, v2, v3 ;# v2 = 8-bit r0..r15
- stvx v2, 0, \Dst ;# to dst
- add \Dst, \Dst, \Stride ;# next dst
-.endm
-
- .text
- .align 2
-;# r3 = short *diff_ptr,
-;# r4 = unsigned char *pred_ptr,
-;# r5 = unsigned char *dst_ptr,
-;# r6 = int stride
-recon4b_ppc:
- mfspr r0, 256 ;# get old VRSAVE
- stw r0, -8(r1) ;# save old VRSAVE to stack
- oris r0, r0, 0xf000
- mtspr 256,r0 ;# set VRSAVE
-
- vxor v0, v0, v0
- li r8, 16
-
- row_of16 r3, r4, r5, r6
- row_of16 r3, r4, r5, r6
- row_of16 r3, r4, r5, r6
- row_of16 r3, r4, r5, r6
-
- lwz r12, -8(r1) ;# restore old VRSAVE from stack
- mtspr 256, r12 ;# reset old VRSAVE
-
- blr
-
-.macro two_rows_of8 Diff Pred Dst Stride write_first_four_pels
- lvx v1, 0, \Pred ;# v1 = pred = p0..p15
- vmrghb v2, v0, v1 ;# v2 = 16-bit p0..p7
- lvx v3, 0, \Diff ;# v3 = d0..d7
- vaddshs v2, v2, v3 ;# v2 = r0..r7
- vmrglb v1, v0, v1 ;# v1 = 16-bit p8..p15
- lvx v3, r8, \Diff ;# v2 = d8..d15
- vaddshs v3, v3, v1 ;# v3 = r8..r15
- vpkshus v2, v2, v3 ;# v3 = 8-bit r0..r15
- stvx v2, 0, r10 ;# 2 rows to dst from buf
- lwz r0, 0(r10)
-.if \write_first_four_pels
- stw r0, 0(\Dst)
- .else
- stwux r0, \Dst, \Stride
-.endif
- lwz r0, 4(r10)
- stw r0, 4(\Dst)
- lwz r0, 8(r10)
- stwux r0, \Dst, \Stride ;# advance dst to next row
- lwz r0, 12(r10)
- stw r0, 4(\Dst)
-.endm
-
- .align 2
-;# r3 = short *diff_ptr,
-;# r4 = unsigned char *pred_ptr,
-;# r5 = unsigned char *dst_ptr,
-;# r6 = int stride
-
-recon2b_ppc:
- mfspr r0, 256 ;# get old VRSAVE
- stw r0, -8(r1) ;# save old VRSAVE to stack
- oris r0, r0, 0xf000
- mtspr 256,r0 ;# set VRSAVE
-
- vxor v0, v0, v0
- li r8, 16
-
- la r10, -48(r1) ;# buf
-
- two_rows_of8 r3, r4, r5, r6, 1
-
- addi r4, r4, 16; ;# next pred
- addi r3, r3, 32; ;# next diff
-
- two_rows_of8 r3, r4, r5, r6, 0
-
- lwz r12, -8(r1) ;# restore old VRSAVE from stack
- mtspr 256, r12 ;# reset old VRSAVE
-
- blr
-
-.macro get_two_diff_rows
- stw r0, 0(r10)
- lwz r0, 4(r3)
- stw r0, 4(r10)
- lwzu r0, 32(r3)
- stw r0, 8(r10)
- lwz r0, 4(r3)
- stw r0, 12(r10)
- lvx v3, 0, r10
-.endm
-
- .align 2
-;# r3 = short *diff_ptr,
-;# r4 = unsigned char *pred_ptr,
-;# r5 = unsigned char *dst_ptr,
-;# r6 = int stride
-recon_b_ppc:
- mfspr r0, 256 ;# get old VRSAVE
- stw r0, -8(r1) ;# save old VRSAVE to stack
- oris r0, r0, 0xf000
- mtspr 256,r0 ;# set VRSAVE
-
- vxor v0, v0, v0
-
- la r10, -48(r1) ;# buf
-
- lwz r0, 0(r4)
- stw r0, 0(r10)
- lwz r0, 16(r4)
- stw r0, 4(r10)
- lwz r0, 32(r4)
- stw r0, 8(r10)
- lwz r0, 48(r4)
- stw r0, 12(r10)
-
- lvx v1, 0, r10; ;# v1 = pred = p0..p15
-
- lwz r0, 0(r3) ;# v3 = d0..d7
-
- get_two_diff_rows
-
- vmrghb v2, v0, v1; ;# v2 = 16-bit p0..p7
- vaddshs v2, v2, v3; ;# v2 = r0..r7
-
- lwzu r0, 32(r3) ;# v3 = d8..d15
-
- get_two_diff_rows
-
- vmrglb v1, v0, v1; ;# v1 = 16-bit p8..p15
- vaddshs v3, v3, v1; ;# v3 = r8..r15
-
- vpkshus v2, v2, v3; ;# v2 = 8-bit r0..r15
- stvx v2, 0, r10; ;# 16 pels to dst from buf
-
- lwz r0, 0(r10)
- stw r0, 0(r5)
- lwz r0, 4(r10)
- stwux r0, r5, r6
- lwz r0, 8(r10)
- stwux r0, r5, r6
- lwz r0, 12(r10)
- stwx r0, r5, r6
-
- lwz r12, -8(r1) ;# restore old VRSAVE from stack
- mtspr 256, r12 ;# reset old VRSAVE
-
- blr
--- a/vp9/common/ppc/vp9_systemdependent.c
+++ /dev/null
@@ -1,167 +1,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 "vp9/common/vp9_loopfilter.h"
-#include "recon.h"
-#include "vp9/common/vp9_onyxc_int.h"
-
-void (*vp8_short_idct4x4)(short *input, short *output, int pitch);
-void (*vp8_short_idct4x4_1)(short *input, short *output, int pitch);
-void (*vp8_dc_only_idct)(short input_dc, short *output, int pitch);
-
-extern void (*vp9_post_proc_down_and_across)(unsigned char *src_ptr,
- unsigned char *dst_ptr,
- int src_pixels_per_line,
- int dst_pixels_per_line,
- int rows, int cols, int flimit);
-
-extern void (*vp9_mbpost_proc_down)(unsigned char *dst, int pitch,
- int rows, int cols, int flimit);
-extern void vp9_mbpost_proc_down_c(unsigned char *dst, int pitch,
- int rows, int cols, int flimit);
-extern void (*vp9_mbpost_proc_across_ip)(unsigned char *src, int pitch,
- int rows, int cols, int flimit);
-extern void vp9_mbpost_proc_across_ip_c(unsigned char *src, int pitch,
- int rows, int cols, int flimit);
-extern void vp9_post_proc_down_and_across_c(unsigned char *src_ptr,
- unsigned char *dst_ptr,
- int src_pixels_per_line,
- int dst_pixels_per_line,
- int rows, int cols, int flimit);
-void vp9_plane_add_noise_c(unsigned char *start,
- unsigned int width, unsigned int height,
- int pitch, int q, int a);
-
-extern copy_mem_block_function *vp9_copy_mem16x16;
-extern copy_mem_block_function *vp9_copy_mem8x8;
-extern copy_mem_block_function *vp9_copy_mem8x4;
-
-// PPC
-extern subpixel_predict_function sixtap_predict_ppc;
-extern subpixel_predict_function sixtap_predict8x4_ppc;
-extern subpixel_predict_function sixtap_predict8x8_ppc;
-extern subpixel_predict_function sixtap_predict16x16_ppc;
-extern subpixel_predict_function bilinear_predict4x4_ppc;
-extern subpixel_predict_function bilinear_predict8x4_ppc;
-extern subpixel_predict_function bilinear_predict8x8_ppc;
-extern subpixel_predict_function bilinear_predict16x16_ppc;
-
-extern copy_mem_block_function copy_mem16x16_ppc;
-
-void recon_b_ppc(short *diff_ptr, unsigned char *pred_ptr,
- unsigned char *dst_ptr, int stride);
-void recon2b_ppc(short *diff_ptr, unsigned char *pred_ptr,
- unsigned char *dst_ptr, int stride);
-void recon4b_ppc(short *diff_ptr, unsigned char *pred_ptr,
- unsigned char *dst_ptr, int stride);
-
-extern void short_idct4x4_ppc(short *input, short *output, int pitch);
-
-// Generic C
-extern subpixel_predict_function vp9_sixtap_predict_c;
-extern subpixel_predict_function vp9_sixtap_predict8x4_c;
-extern subpixel_predict_function vp9_sixtap_predict8x8_c;
-extern subpixel_predict_function vp9_sixtap_predict16x16_c;
-extern subpixel_predict_function vp9_bilinear_predict4x4_c;
-extern subpixel_predict_function vp9_bilinear_predict8x4_c;
-extern subpixel_predict_function vp9_bilinear_predict8x8_c;
-extern subpixel_predict_function vp9_bilinear_predict16x16_c;
-
-extern copy_mem_block_function vp9_copy_mem16x16_c;
-extern copy_mem_block_function vp9_copy_mem8x8_c;
-extern copy_mem_block_function vp9_copy_mem8x4_c;
-
-void vp9_recon_b_c(short *diff_ptr, unsigned char *pred_ptr,
- unsigned char *dst_ptr, int stride);
-void vp9_recon2b_c(short *diff_ptr, unsigned char *pred_ptr,
- unsigned char *dst_ptr, int stride);
-void vp9_recon4b_c(short *diff_ptr, unsigned char *pred_ptr,
- unsigned char *dst_ptr, int stride);
-
-extern void vp9_short_idct4x4_1_c(short *input, short *output, int pitch);
-extern void vp9_short_idct4x4_c(short *input, short *output, int pitch);
-extern void vp8_dc_only_idct_c(short input_dc, short *output, int pitch);
-
-// PPC
-extern loop_filter_block_function loop_filter_mbv_ppc;
-extern loop_filter_block_function loop_filter_bv_ppc;
-extern loop_filter_block_function loop_filter_mbh_ppc;
-extern loop_filter_block_function loop_filter_bh_ppc;
-
-extern loop_filter_block_function loop_filter_mbvs_ppc;
-extern loop_filter_block_function loop_filter_bvs_ppc;
-extern loop_filter_block_function loop_filter_mbhs_ppc;
-extern loop_filter_block_function loop_filter_bhs_ppc;
-
-// Generic C
-extern loop_filter_block_function vp9_loop_filter_mbv_c;
-extern loop_filter_block_function vp9_loop_filter_bv_c;
-extern loop_filter_block_function vp9_loop_filter_mbh_c;
-extern loop_filter_block_function vp9_loop_filter_bh_c;
-
-extern loop_filter_block_function vp9_loop_filter_mbvs_c;
-extern loop_filter_block_function vp9_loop_filter_bvs_c;
-extern loop_filter_block_function vp9_loop_filter_mbhs_c;
-extern loop_filter_block_function vp9_loop_filter_bhs_c;
-
-extern loop_filter_block_function *vp8_lf_mbvfull;
-extern loop_filter_block_function *vp8_lf_mbhfull;
-extern loop_filter_block_function *vp8_lf_bvfull;
-extern loop_filter_block_function *vp8_lf_bhfull;
-
-extern loop_filter_block_function *vp8_lf_mbvsimple;
-extern loop_filter_block_function *vp8_lf_mbhsimple;
-extern loop_filter_block_function *vp8_lf_bvsimple;
-extern loop_filter_block_function *vp8_lf_bhsimple;
-
-void vp9_clear_c(void) {
-}
-
-void vp9_machine_specific_config(void) {
- // Pure C:
- vp9_clear_system_state = vp9_clear_c;
- vp9_recon_b = vp9_recon_b_c;
- vp9_recon4b = vp9_recon4b_c;
- vp9_recon2b = vp9_recon2b_c;
-
- vp9_bilinear_predict16x16 = bilinear_predict16x16_ppc;
- vp9_bilinear_predict8x8 = bilinear_predict8x8_ppc;
- vp9_bilinear_predict8x4 = bilinear_predict8x4_ppc;
- vp8_bilinear_predict = bilinear_predict4x4_ppc;
-
- vp9_sixtap_predict16x16 = sixtap_predict16x16_ppc;
- vp9_sixtap_predict8x8 = sixtap_predict8x8_ppc;
- vp9_sixtap_predict8x4 = sixtap_predict8x4_ppc;
- vp9_sixtap_predict = sixtap_predict_ppc;
-
- vp8_short_idct4x4_1 = vp9_short_idct4x4_1_c;
- vp8_short_idct4x4 = short_idct4x4_ppc;
- vp8_dc_only_idct = vp8_dc_only_idct_c;
-
- vp8_lf_mbvfull = loop_filter_mbv_ppc;
- vp8_lf_bvfull = loop_filter_bv_ppc;
- vp8_lf_mbhfull = loop_filter_mbh_ppc;
- vp8_lf_bhfull = loop_filter_bh_ppc;
-
- vp8_lf_mbvsimple = loop_filter_mbvs_ppc;
- vp8_lf_bvsimple = loop_filter_bvs_ppc;
- vp8_lf_mbhsimple = loop_filter_mbhs_ppc;
- vp8_lf_bhsimple = loop_filter_bhs_ppc;
-
- vp9_post_proc_down_and_across = vp9_post_proc_down_and_across_c;
- vp9_mbpost_proc_down = vp9_mbpost_proc_down_c;
- vp9_mbpost_proc_across_ip = vp9_mbpost_proc_across_ip_c;
- vp9_plane_add_noise = vp9_plane_add_noise_c;
-
- vp9_copy_mem16x16 = copy_mem16x16_ppc;
- vp9_copy_mem8x8 = vp9_copy_mem8x8_c;
- vp9_copy_mem8x4 = vp9_copy_mem8x4_c;
-
-}
--- a/vp9/common/vp9_alloccommon.c
+++ b/vp9/common/vp9_alloccommon.c
@@ -10,84 +10,109 @@
#include "./vpx_config.h"
-#include "vp9/common/vp9_blockd.h"
#include "vpx_mem/vpx_mem.h"
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_findnearmv.h"
+#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_entropymode.h"
#include "vp9/common/vp9_entropymv.h"
+#include "vp9/common/vp9_findnearmv.h"
+#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_systemdependent.h"
-
-void vp9_update_mode_info_border(VP9_COMMON *cpi, MODE_INFO *mi_base) {
- int stride = cpi->mode_info_stride;
+void vp9_update_mode_info_border(VP9_COMMON *cm, MODE_INFO *mi) {
+ const int stride = cm->mode_info_stride;
int i;
// Clear down top border row
- vpx_memset(mi_base, 0, sizeof(MODE_INFO) * cpi->mode_info_stride);
+ vpx_memset(mi, 0, sizeof(MODE_INFO) * stride);
// Clear left border column
- for (i = 1; i < cpi->mb_rows + 1; i++) {
- vpx_memset(&mi_base[i * stride], 0, sizeof(MODE_INFO));
- }
+ for (i = 1; i < cm->mi_rows + 1; i++)
+ vpx_memset(&mi[i * stride], 0, sizeof(MODE_INFO));
}
-void vp9_update_mode_info_in_image(VP9_COMMON *cpi, MODE_INFO *mi) {
+void vp9_update_mode_info_in_image(VP9_COMMON *cm, MODE_INFO *mi) {
int i, j;
// For each in image mode_info element set the in image flag to 1
- for (i = 0; i < cpi->mb_rows; i++) {
- for (j = 0; j < cpi->mb_cols; j++) {
- mi->mbmi.mb_in_image = 1;
- mi++; // Next element in the row
+ for (i = 0; i < cm->mi_rows; i++) {
+ MODE_INFO *ptr = mi;
+ for (j = 0; j < cm->mi_cols; j++) {
+ ptr->mbmi.mb_in_image = 1;
+ ptr++; // Next element in the row
}
- mi++; // Step over border element at start of next row
+ // Step over border element at start of next row
+ mi += cm->mode_info_stride;
}
}
-void vp9_de_alloc_frame_buffers(VP9_COMMON *oci) {
+void vp9_free_frame_buffers(VP9_COMMON *oci) {
int i;
for (i = 0; i < NUM_YV12_BUFFERS; i++)
- vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]);
+ vp9_free_frame_buffer(&oci->yv12_fb[i]);
- vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame);
- vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer);
+ vp9_free_frame_buffer(&oci->temp_scale_frame);
+ vp9_free_frame_buffer(&oci->post_proc_buffer);
- vpx_free(oci->above_context);
vpx_free(oci->mip);
vpx_free(oci->prev_mip);
+ vpx_free(oci->above_seg_context);
- oci->above_context = 0;
+ vpx_free(oci->above_context[0]);
+ for (i = 0; i < MAX_MB_PLANE; i++)
+ oci->above_context[i] = 0;
oci->mip = 0;
oci->prev_mip = 0;
+ oci->above_seg_context = 0;
+}
+static void set_mb_mi(VP9_COMMON *cm, int aligned_width, int aligned_height) {
+ cm->mb_cols = (aligned_width + 8) >> 4;
+ cm->mb_rows = (aligned_height + 8) >> 4;
+ cm->MBs = cm->mb_rows * cm->mb_cols;
+
+ cm->mi_cols = aligned_width >> LOG2_MI_SIZE;
+ cm->mi_rows = aligned_height >> LOG2_MI_SIZE;
+ cm->mode_info_stride = cm->mi_cols + 64 / MI_SIZE;
}
+static void setup_mi(VP9_COMMON *cm) {
+ cm->mi = cm->mip + cm->mode_info_stride + 1;
+ cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1;
+
+ vpx_memset(cm->mip, 0,
+ cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
+
+ vp9_update_mode_info_border(cm, cm->mip);
+ vp9_update_mode_info_in_image(cm, cm->mi);
+
+ vp9_update_mode_info_border(cm, cm->prev_mip);
+ vp9_update_mode_info_in_image(cm, cm->prev_mi);
+}
+
int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
- int i;
- int aligned_width, aligned_height;
+ int i, mi_cols;
- vp9_de_alloc_frame_buffers(oci);
+ // Our internal buffers are always multiples of 16
+ const int aligned_width = multiple8(width);
+ const int aligned_height = multiple8(height);
+ const int ss_x = oci->subsampling_x;
+ const int ss_y = oci->subsampling_y;
- /* our internal buffers are always multiples of 16 */
- aligned_width = (width + 15) & ~15;
- aligned_height = (height + 15) & ~15;
+ vp9_free_frame_buffers(oci);
for (i = 0; i < NUM_YV12_BUFFERS; i++) {
oci->fb_idx_ref_cnt[i] = 0;
- if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height,
- VP9BORDERINPIXELS) < 0) {
- vp9_de_alloc_frame_buffers(oci);
- return 1;
- }
+ if (vp9_alloc_frame_buffer(&oci->yv12_fb[i], width, height, ss_x, ss_y,
+ VP9BORDERINPIXELS) < 0)
+ goto fail;
}
oci->new_fb_idx = NUM_YV12_BUFFERS - 1;
oci->fb_idx_ref_cnt[oci->new_fb_idx] = 1;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < ALLOWED_REFS_PER_FRAME; i++)
oci->active_ref_idx[i] = i;
for (i = 0; i < NUM_REF_FRAMES; i++) {
@@ -95,125 +120,86 @@
oci->fb_idx_ref_cnt[i] = 1;
}
- if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16,
- VP9BORDERINPIXELS) < 0) {
- vp9_de_alloc_frame_buffers(oci);
- return 1;
- }
+ if (vp9_alloc_frame_buffer(&oci->temp_scale_frame, width, 16, ss_x, ss_y,
+ VP9BORDERINPIXELS) < 0)
+ goto fail;
- if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height,
- VP9BORDERINPIXELS) < 0) {
- vp9_de_alloc_frame_buffers(oci);
- return 1;
- }
+ if (vp9_alloc_frame_buffer(&oci->post_proc_buffer, width, height, ss_x, ss_y,
+ VP9BORDERINPIXELS) < 0)
+ goto fail;
- oci->mb_rows = aligned_height >> 4;
- oci->mb_cols = aligned_width >> 4;
- oci->MBs = oci->mb_rows * oci->mb_cols;
- oci->mode_info_stride = oci->mb_cols + 1;
- oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
+ set_mb_mi(oci, aligned_width, aligned_height);
- if (!oci->mip) {
- vp9_de_alloc_frame_buffers(oci);
- return 1;
- }
+ // Allocation
+ oci->mip = vpx_calloc(oci->mode_info_stride * (oci->mi_rows + 64 / MI_SIZE),
+ sizeof(MODE_INFO));
+ if (!oci->mip)
+ goto fail;
- oci->mi = oci->mip + oci->mode_info_stride + 1;
+ oci->prev_mip = vpx_calloc(oci->mode_info_stride *
+ (oci->mi_rows + 64 / MI_SIZE),
+ sizeof(MODE_INFO));
+ if (!oci->prev_mip)
+ goto fail;
- /* allocate memory for last frame MODE_INFO array */
+ setup_mi(oci);
- oci->prev_mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
+ // FIXME(jkoleszar): allocate subsampled arrays for U/V once subsampling
+ // information is exposed at this level
+ mi_cols = mi_cols_aligned_to_sb(oci);
- if (!oci->prev_mip) {
- vp9_de_alloc_frame_buffers(oci);
- return 1;
- }
+ // 2 contexts per 'mi unit', so that we have one context per 4x4 txfm
+ // block where mi unit size is 8x8.
+# if CONFIG_ALPHA
+ oci->above_context[0] = vpx_calloc(sizeof(ENTROPY_CONTEXT) * 8 * mi_cols, 1);
+#else
+ oci->above_context[0] = vpx_calloc(sizeof(ENTROPY_CONTEXT) * 6 * mi_cols, 1);
+#endif
+ if (!oci->above_context[0])
+ goto fail;
- oci->prev_mi = oci->prev_mip + oci->mode_info_stride + 1;
+ for (i = 1; i < MAX_MB_PLANE; i++)
+ oci->above_context[i] =
+ oci->above_context[0] + i * sizeof(ENTROPY_CONTEXT) * 2 * mi_cols;
- oci->above_context =
- vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * (3 + oci->mb_cols), 1);
+ oci->above_seg_context = vpx_calloc(sizeof(PARTITION_CONTEXT) * mi_cols, 1);
+ if (!oci->above_seg_context)
+ goto fail;
- if (!oci->above_context) {
- vp9_de_alloc_frame_buffers(oci);
- return 1;
- }
-
- vp9_update_mode_info_border(oci, oci->mip);
- vp9_update_mode_info_in_image(oci, oci->mi);
-
return 0;
-}
-void vp9_setup_version(VP9_COMMON *cm) {
- if (cm->version & 0x4) {
- if (!CONFIG_EXPERIMENTAL)
- vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
- "Bitstream was created by an experimental "
- "encoder");
- cm->experimental = 1;
- }
-
- switch (cm->version & 0x3) {
- case 0:
- cm->no_lpf = 0;
- cm->filter_type = NORMAL_LOOPFILTER;
- cm->use_bilinear_mc_filter = 0;
- cm->full_pixel = 0;
- break;
- case 1:
- cm->no_lpf = 0;
- cm->filter_type = SIMPLE_LOOPFILTER;
- cm->use_bilinear_mc_filter = 1;
- cm->full_pixel = 0;
- break;
- case 2:
- case 3:
- cm->no_lpf = 1;
- cm->filter_type = NORMAL_LOOPFILTER;
- cm->use_bilinear_mc_filter = 1;
- cm->full_pixel = 0;
- break;
- // Full pel only code deprecated in experimental code base
- // case 3:
- // cm->no_lpf = 1;
- // cm->filter_type = SIMPLE_LOOPFILTER;
- // cm->use_bilinear_mc_filter = 1;
- // cm->full_pixel = 1;
- // break;
- }
+ fail:
+ vp9_free_frame_buffers(oci);
+ return 1;
}
+
void vp9_create_common(VP9_COMMON *oci) {
vp9_machine_specific_config(oci);
vp9_init_mbmode_probs(oci);
- vp9_default_bmode_probs(oci->fc.bmode_prob);
-
oci->txfm_mode = ONLY_4X4;
- oci->mb_no_coeff_skip = 1;
oci->comp_pred_mode = HYBRID_PREDICTION;
- oci->no_lpf = 0;
- oci->filter_type = NORMAL_LOOPFILTER;
- oci->use_bilinear_mc_filter = 0;
- oci->full_pixel = 0;
oci->clr_type = REG_YUV;
- oci->clamp_type = RECON_CLAMP_REQUIRED;
- /* Initialise reference frame sign bias structure to defaults */
+ // Initialize reference frame sign bias structure to defaults
vpx_memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
-
- oci->kf_ymode_probs_update = 0;
}
void vp9_remove_common(VP9_COMMON *oci) {
- vp9_de_alloc_frame_buffers(oci);
+ vp9_free_frame_buffers(oci);
}
void vp9_initialize_common() {
vp9_coef_tree_initialize();
-
vp9_entropy_mode_init();
-
vp9_entropy_mv_init();
+}
+
+void vp9_update_frame_size(VP9_COMMON *cm) {
+ const int aligned_width = multiple8(cm->width);
+ const int aligned_height = multiple8(cm->height);
+
+ set_mb_mi(cm, aligned_width, aligned_height);
+ setup_mi(cm);
}
--- a/vp9/common/vp9_alloccommon.h
+++ b/vp9/common/vp9_alloccommon.h
@@ -14,13 +14,18 @@
#include "vp9/common/vp9_onyxc_int.h"
+void vp9_initialize_common();
+
+void vp9_update_mode_info_border(VP9_COMMON *cpi, MODE_INFO *mi);
+void vp9_update_mode_info_in_image(VP9_COMMON *cpi, MODE_INFO *mi);
+
void vp9_create_common(VP9_COMMON *oci);
void vp9_remove_common(VP9_COMMON *oci);
-void vp9_de_alloc_frame_buffers(VP9_COMMON *oci);
+
int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height);
-void vp9_setup_version(VP9_COMMON *oci);
+void vp9_free_frame_buffers(VP9_COMMON *oci);
-void vp9_update_mode_info_border(VP9_COMMON *cpi, MODE_INFO *mi_base);
-void vp9_update_mode_info_in_image(VP9_COMMON *cpi, MODE_INFO *mi);
+
+void vp9_update_frame_size(VP9_COMMON *cm);
#endif // VP9_COMMON_VP9_ALLOCCOMMON_H_
--- a/vp9/common/vp9_blockd.c
+++ /dev/null
@@ -1,442 +1,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 "vp9/common/vp9_blockd.h"
-#include "vpx_mem/vpx_mem.h"
-
-const uint8_t vp9_block2left[TX_SIZE_MAX_MB][24] = {
- { 0, 0, 0, 0,
- 1, 1, 1, 1,
- 2, 2, 2, 2,
- 3, 3, 3, 3,
- 4, 4,
- 5, 5,
- 6, 6,
- 7, 7 },
- { 0, 0, 0, 0,
- 0, 0, 0, 0,
- 2, 2, 2, 2,
- 2, 2, 2, 2,
- 4, 4,
- 4, 4,
- 6, 6,
- 6, 6 },
- { 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0 },
-};
-const uint8_t vp9_block2above[TX_SIZE_MAX_MB][24] = {
- { 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 0, 1, 2, 3,
- 4, 5,
- 4, 5,
- 6, 7,
- 6, 7 },
- { 0, 0, 0, 0,
- 2, 2, 2, 2,
- 0, 0, 0, 0,
- 2, 2, 2, 2,
- 4, 4,
- 4, 4,
- 6, 6,
- 6, 6 },
- { 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0 },
-};
-
-#define S(x) x + sizeof(ENTROPY_CONTEXT_PLANES) / sizeof(ENTROPY_CONTEXT)
-const uint8_t vp9_block2left_sb[TX_SIZE_MAX_SB][96] = {
- { 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1),
- S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2),
- S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3),
- 4, 4, 4, 4,
- 5, 5, 5, 5,
- S(4), S(4), S(4), S(4),
- S(5), S(5), S(5), S(5),
- 6, 6, 6, 6,
- 7, 7, 7, 7,
- S(6), S(6), S(6), S(6),
- S(7), S(7), S(7), S(7) },
- { 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2),
- S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2),
- 4, 4, 4, 4,
- 4, 4, 4, 4,
- S(4), S(4), S(4), S(4),
- S(4), S(4), S(4), S(4),
- 6, 6, 6, 6,
- 6, 6, 6, 6,
- S(6), S(6), S(6), S(6),
- S(6), S(6), S(6), S(6) },
- { 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- 4, 4, 4, 4,
- 4, 4, 4, 4,
- 4, 4, 4, 4,
- 4, 4, 4, 4,
- 6, 6, 6, 6,
- 6, 6, 6, 6,
- 6, 6, 6, 6,
- 6, 6, 6, 6 },
- { 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0 },
-};
-const uint8_t vp9_block2above_sb[TX_SIZE_MAX_SB][96] = {
- { 0, 1, 2, 3, S(0), S(1), S(2), S(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3),
- 4, 5, S(4), S(5),
- 4, 5, S(4), S(5),
- 4, 5, S(4), S(5),
- 4, 5, S(4), S(5),
- 6, 7, S(6), S(7),
- 6, 7, S(6), S(7),
- 6, 7, S(6), S(7),
- 6, 7, S(6), S(7) },
- { 0, 0, 0, 0, 2, 2, 2, 2,
- S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- 0, 0, 0, 0, 2, 2, 2, 2,
- S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- 0, 0, 0, 0, 2, 2, 2, 2,
- S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- 0, 0, 0, 0, 2, 2, 2, 2,
- S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- 4, 4, 4, 4,
- S(4), S(4), S(4), S(4),
- 4, 4, 4, 4,
- S(4), S(4), S(4), S(4),
- 6, 6, 6, 6,
- S(6), S(6), S(6), S(6),
- 6, 6, 6, 6,
- S(6), S(6), S(6), S(6) },
- { 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- 4, 4, 4, 4,
- 4, 4, 4, 4,
- 4, 4, 4, 4,
- 4, 4, 4, 4,
- 6, 6, 6, 6,
- 6, 6, 6, 6,
- 6, 6, 6, 6,
- 6, 6, 6, 6 },
- { 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0 },
-};
-
-#define T(x) x + 2 * (sizeof(ENTROPY_CONTEXT_PLANES) / sizeof(ENTROPY_CONTEXT))
-#define U(x) x + 3 * (sizeof(ENTROPY_CONTEXT_PLANES) / sizeof(ENTROPY_CONTEXT))
-const uint8_t vp9_block2left_sb64[TX_SIZE_MAX_SB][384] = {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1), S(1),
- S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2),
- S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3), S(3),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- T(1), T(1), T(1), T(1), T(1), T(1), T(1), T(1), T(1), T(1), T(1), T(1), T(1), T(1), T(1), T(1),
- T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2),
- T(3), T(3), T(3), T(3), T(3), T(3), T(3), T(3), T(3), T(3), T(3), T(3), T(3), T(3), T(3), T(3),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- U(1), U(1), U(1), U(1), U(1), U(1), U(1), U(1), U(1), U(1), U(1), U(1), U(1), U(1), U(1), U(1),
- U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2),
- U(3), U(3), U(3), U(3), U(3), U(3), U(3), U(3), U(3), U(3), U(3), U(3), U(3), U(3), U(3), U(3),
- 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 5, 5, 5, 5,
- S(4), S(4), S(4), S(4), S(4), S(4), S(4), S(4),
- S(5), S(5), S(5), S(5), S(5), S(5), S(5), S(5),
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- T(5), T(5), T(5), T(5), T(5), T(5), T(5), T(5),
- U(4), U(4), U(4), U(4), U(4), U(4), U(4), U(4),
- U(5), U(5), U(5), U(5), U(5), U(5), U(5), U(5),
- 6, 6, 6, 6, 6, 6, 6, 6,
- 7, 7, 7, 7, 7, 7, 7, 7,
- S(6), S(6), S(6), S(6), S(6), S(6), S(6), S(6),
- S(7), S(7), S(7), S(7), S(7), S(7), S(7), S(7),
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6),
- T(7), T(7), T(7), T(7), T(7), T(7), T(7), T(7),
- U(6), U(6), U(6), U(6), U(6), U(6), U(6), U(6),
- U(7), U(7), U(7), U(7), U(7), U(7), U(7), U(7) },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2),
- S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2), S(2),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2),
- T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2), T(2),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2),
- U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2), U(2),
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- S(4), S(4), S(4), S(4), S(4), S(4), S(4), S(4),
- S(4), S(4), S(4), S(4), S(4), S(4), S(4), S(4),
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- U(4), U(4), U(4), U(4), U(4), U(4), U(4), U(4),
- U(4), U(4), U(4), U(4), U(4), U(4), U(4), U(4),
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- S(6), S(6), S(6), S(6), S(6), S(6), S(6), S(6),
- S(6), S(6), S(6), S(6), S(6), S(6), S(6), S(6),
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6),
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6),
- U(6), U(6), U(6), U(6), U(6), U(6), U(6), U(6),
- U(6), U(6), U(6), U(6), U(6), U(6), U(6), U(6) },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6),
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6),
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6),
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6) },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6 },
-};
-const uint8_t vp9_block2above_sb64[TX_SIZE_MAX_SB][384] = {
- { 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 0, 1, 2, 3, S(0), S(1), S(2), S(3), T(0), T(1), T(2), T(3), U(0), U(1), U(2), U(3),
- 4, 5, S(4), S(5), T(4), T(5), U(4), U(5),
- 4, 5, S(4), S(5), T(4), T(5), U(4), U(5),
- 4, 5, S(4), S(5), T(4), T(5), U(4), U(5),
- 4, 5, S(4), S(5), T(4), T(5), U(4), U(5),
- 4, 5, S(4), S(5), T(4), T(5), U(4), U(5),
- 4, 5, S(4), S(5), T(4), T(5), U(4), U(5),
- 4, 5, S(4), S(5), T(4), T(5), U(4), U(5),
- 4, 5, S(4), S(5), T(4), T(5), U(4), U(5),
- 6, 7, S(6), S(7), T(6), T(7), U(6), U(7),
- 6, 7, S(6), S(7), T(6), T(7), U(6), U(7),
- 6, 7, S(6), S(7), T(6), T(7), U(6), U(7),
- 6, 7, S(6), S(7), T(6), T(7), U(6), U(7),
- 6, 7, S(6), S(7), T(6), T(7), U(6), U(7),
- 6, 7, S(6), S(7), T(6), T(7), U(6), U(7),
- 6, 7, S(6), S(7), T(6), T(7), U(6), U(7),
- 6, 7, S(6), S(7), T(6), T(7), U(6), U(7) },
- { 0, 0, 0, 0, 2, 2, 2, 2, S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- T(0), T(0), T(0), T(0), T(2), T(2), T(2), T(2), U(0), U(0), U(0), U(0), U(2), U(2), U(2), U(2),
- 0, 0, 0, 0, 2, 2, 2, 2, S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- T(0), T(0), T(0), T(0), T(2), T(2), T(2), T(2), U(0), U(0), U(0), U(0), U(2), U(2), U(2), U(2),
- 0, 0, 0, 0, 2, 2, 2, 2, S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- T(0), T(0), T(0), T(0), T(2), T(2), T(2), T(2), U(0), U(0), U(0), U(0), U(2), U(2), U(2), U(2),
- 0, 0, 0, 0, 2, 2, 2, 2, S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- T(0), T(0), T(0), T(0), T(2), T(2), T(2), T(2), U(0), U(0), U(0), U(0), U(2), U(2), U(2), U(2),
- 0, 0, 0, 0, 2, 2, 2, 2, S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- T(0), T(0), T(0), T(0), T(2), T(2), T(2), T(2), U(0), U(0), U(0), U(0), U(2), U(2), U(2), U(2),
- 0, 0, 0, 0, 2, 2, 2, 2, S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- T(0), T(0), T(0), T(0), T(2), T(2), T(2), T(2), U(0), U(0), U(0), U(0), U(2), U(2), U(2), U(2),
- 0, 0, 0, 0, 2, 2, 2, 2, S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- T(0), T(0), T(0), T(0), T(2), T(2), T(2), T(2), U(0), U(0), U(0), U(0), U(2), U(2), U(2), U(2),
- 0, 0, 0, 0, 2, 2, 2, 2, S(0), S(0), S(0), S(0), S(2), S(2), S(2), S(2),
- T(0), T(0), T(0), T(0), T(2), T(2), T(2), T(2), U(0), U(0), U(0), U(0), U(2), U(2), U(2), U(2),
- 4, 4, 4, 4, S(4), S(4), S(4), S(4),
- T(4), T(4), T(4), T(4), U(4), U(4), U(4), U(4),
- 4, 4, 4, 4, S(4), S(4), S(4), S(4),
- T(4), T(4), T(4), T(4), U(4), U(4), U(4), U(4),
- 4, 4, 4, 4, S(4), S(4), S(4), S(4),
- T(4), T(4), T(4), T(4), U(4), U(4), U(4), U(4),
- 4, 4, 4, 4, S(4), S(4), S(4), S(4),
- T(4), T(4), T(4), T(4), U(4), U(4), U(4), U(4),
- 6, 6, 6, 6, S(6), S(6), S(6), S(6),
- T(6), T(6), T(6), T(6), U(6), U(6), U(6), U(6),
- 6, 6, 6, 6, S(6), S(6), S(6), S(6),
- T(6), T(6), T(6), T(6), U(6), U(6), U(6), U(6),
- 6, 6, 6, 6, S(6), S(6), S(6), S(6),
- T(6), T(6), T(6), T(6), U(6), U(6), U(6), U(6),
- 6, 6, 6, 6, S(6), S(6), S(6), S(6),
- T(6), T(6), T(6), T(6), U(6), U(6), U(6), U(6) },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0), S(0),
- T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
- U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0), U(0),
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- T(4), T(4), T(4), T(4), T(4), T(4), T(4), T(4),
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6),
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6),
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6),
- T(6), T(6), T(6), T(6), T(6), T(6), T(6), T(6) },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6 },
-};
-#undef U
-#undef T
-#undef S
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -12,8 +12,6 @@
#ifndef VP9_COMMON_VP9_BLOCKD_H_
#define VP9_COMMON_VP9_BLOCKD_H_
-void vpx_log(const char *format, ...);
-
#include "./vpx_config.h"
#include "vpx_scale/yv12config.h"
#include "vp9/common/vp9_convolve.h"
@@ -21,35 +19,27 @@
#include "vp9/common/vp9_treecoder.h"
#include "vpx_ports/mem.h"
#include "vp9/common/vp9_common.h"
+#include "vp9/common/vp9_enums.h"
-#define TRUE 1
-#define FALSE 0
+#define BLOCK_SIZE_GROUPS 4
+#define MAX_MB_SEGMENTS 8
+#define MB_SEG_TREE_PROBS (MAX_MB_SEGMENTS-1)
-// #define MODE_STATS
-
-/*#define DCPRED 1*/
-#define DCPREDSIMTHRESH 0
-#define DCPREDCNTTHRESH 3
-
-#define MB_FEATURE_TREE_PROBS 3
#define PREDICTION_PROBS 3
#define MBSKIP_CONTEXTS 3
-#define MAX_MB_SEGMENTS 4
-
#define MAX_REF_LF_DELTAS 4
-#define MAX_MODE_LF_DELTAS 4
+#define MAX_MODE_LF_DELTAS 2
/* Segment Feature Masks */
#define SEGMENT_DELTADATA 0
#define SEGMENT_ABSDATA 1
-#define MAX_MV_REFS 9
-#define MAX_MV_REF_CANDIDATES 4
+#define MAX_MV_REF_CANDIDATES 2
-typedef struct {
- int r, c;
-} POS;
+#define INTRA_INTER_CONTEXTS 4
+#define COMP_INTER_CONTEXTS 5
+#define REF_CONTEXTS 5
typedef enum {
PLANE_TYPE_Y_WITH_DC,
@@ -57,24 +47,21 @@
} PLANE_TYPE;
typedef char ENTROPY_CONTEXT;
-typedef struct {
- ENTROPY_CONTEXT y1[4];
- ENTROPY_CONTEXT u[2];
- ENTROPY_CONTEXT v[2];
-} ENTROPY_CONTEXT_PLANES;
-#define VP9_COMBINEENTROPYCONTEXTS(Dest, A, B) \
- Dest = ((A)!=0) + ((B)!=0);
+typedef char PARTITION_CONTEXT;
+static INLINE int combine_entropy_contexts(ENTROPY_CONTEXT a,
+ ENTROPY_CONTEXT b) {
+ return (a != 0) + (b != 0);
+}
+
typedef enum {
KEY_FRAME = 0,
- INTER_FRAME = 1
+ INTER_FRAME = 1,
+ NUM_FRAME_TYPES,
} FRAME_TYPE;
typedef enum {
-#if CONFIG_ENABLE_6TAP
- SIXTAP,
-#endif
EIGHTTAP_SMOOTH,
EIGHTTAP,
EIGHTTAP_SHARP,
@@ -83,26 +70,27 @@
} INTERPOLATIONFILTERTYPE;
typedef enum {
- DC_PRED, /* average of above and left pixels */
- V_PRED, /* vertical prediction */
- H_PRED, /* horizontal prediction */
- D45_PRED, /* Directional 45 deg prediction [anti-clockwise from 0 deg hor] */
- D135_PRED, /* Directional 135 deg prediction [anti-clockwise from 0 deg hor] */
- D117_PRED, /* Directional 112 deg prediction [anti-clockwise from 0 deg hor] */
- D153_PRED, /* Directional 157 deg prediction [anti-clockwise from 0 deg hor] */
- D27_PRED, /* Directional 22 deg prediction [anti-clockwise from 0 deg hor] */
- D63_PRED, /* Directional 67 deg prediction [anti-clockwise from 0 deg hor] */
- TM_PRED, /* Truemotion prediction */
- I8X8_PRED, /* 8x8 based prediction, each 8x8 has its own prediction mode */
- B_PRED, /* block based prediction, each block has its own prediction mode */
+ DC_PRED, // Average of above and left pixels
+ V_PRED, // Vertical
+ H_PRED, // Horizontal
+ D45_PRED, // Directional 45 deg = round(arctan(1/1) * 180/pi)
+ D135_PRED, // Directional 135 deg = 180 - 45
+ D117_PRED, // Directional 117 deg = 180 - 63
+ D153_PRED, // Directional 153 deg = 180 - 27
+ D27_PRED, // Directional 27 deg = round(arctan(1/2) * 180/pi)
+ D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi)
+ TM_PRED, // True-motion
NEARESTMV,
NEARMV,
ZEROMV,
NEWMV,
- SPLITMV,
MB_MODE_COUNT
} MB_PREDICTION_MODE;
+static INLINE int is_inter_mode(MB_PREDICTION_MODE mode) {
+ return mode >= NEARESTMV && mode <= NEWMV;
+}
+
// Segment level features.
typedef enum {
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
@@ -117,8 +105,7 @@
TX_4X4 = 0, // 4x4 dct transform
TX_8X8 = 1, // 8x8 dct transform
TX_16X16 = 2, // 16x16 dct transform
- TX_SIZE_MAX_MB = 3, // Number of different transforms available
- TX_32X32 = TX_SIZE_MAX_MB, // 32x32 dct transform
+ TX_32X32 = 3, // 32x32 dct transform
TX_SIZE_MAX_SB, // Number of transforms available to SBs
} TX_SIZE;
@@ -129,62 +116,19 @@
ADST_ADST = 3 // ADST in both directions
} TX_TYPE;
-#define VP9_YMODES (B_PRED + 1)
-#define VP9_UV_MODES (TM_PRED + 1)
-#define VP9_I8X8_MODES (TM_PRED + 1)
-#define VP9_I32X32_MODES (TM_PRED + 1)
+#define VP9_INTRA_MODES (TM_PRED + 1)
-#define VP9_MVREFS (1 + SPLITMV - NEARESTMV)
+#define VP9_INTER_MODES (1 + NEWMV - NEARESTMV)
#define WHT_UPSCALE_FACTOR 2
-typedef enum {
- B_DC_PRED, /* average of above and left pixels */
- B_TM_PRED,
+#define TX_SIZE_PROBS 6 // (TX_SIZE_MAX_SB * (TX_SIZE_MAX_SB - 1) / 2)
- B_VE_PRED, /* vertical prediction */
- B_HE_PRED, /* horizontal prediction */
+#define get_tx_probs(c, b) ((b) < BLOCK_SIZE_MB16X16 ? \
+ (c)->fc.tx_probs_8x8p : \
+ (b) < BLOCK_SIZE_SB32X32 ? \
+ (c)->fc.tx_probs_16x16p : (c)->fc.tx_probs_32x32p)
- B_LD_PRED,
- B_RD_PRED,
-
- B_VR_PRED,
- B_VL_PRED,
- B_HD_PRED,
- B_HU_PRED,
-#if CONFIG_NEWBINTRAMODES
- B_CONTEXT_PRED,
-#endif
-
- LEFT4X4,
- ABOVE4X4,
- ZERO4X4,
- NEW4X4,
-
- B_MODE_COUNT
-} B_PREDICTION_MODE;
-
-#define VP9_BINTRAMODES (LEFT4X4)
-#define VP9_SUBMVREFS (1 + NEW4X4 - LEFT4X4)
-
-#if CONFIG_NEWBINTRAMODES
-/* The number of B_PRED intra modes that are replaced by B_CONTEXT_PRED */
-#define CONTEXT_PRED_REPLACEMENTS 0
-#define VP9_KF_BINTRAMODES (VP9_BINTRAMODES - 1)
-#define VP9_NKF_BINTRAMODES (VP9_BINTRAMODES - CONTEXT_PRED_REPLACEMENTS)
-#else
-#define VP9_KF_BINTRAMODES (VP9_BINTRAMODES) /* 10 */
-#define VP9_NKF_BINTRAMODES (VP9_BINTRAMODES) /* 10 */
-#endif
-
-typedef enum {
- PARTITIONING_16X8 = 0,
- PARTITIONING_8X16,
- PARTITIONING_8X8,
- PARTITIONING_4X4,
- NB_PARTITIONINGS,
-} SPLITMV_PARTITIONING_TYPE;
-
/* For keyframes, intra block modes are predicted by the (already decoded)
modes for the Y blocks to the left and above us; for interframes, there
is a single probability table. */
@@ -191,11 +135,7 @@
union b_mode_info {
struct {
- B_PREDICTION_MODE first;
- TX_TYPE tx_type;
-#if CONFIG_NEWBINTRAMODES
- B_PREDICTION_MODE context;
-#endif
+ MB_PREDICTION_MODE first;
} as_mode;
int_mv as_mv[2]; // first, second inter predictor motion vectors
};
@@ -209,37 +149,80 @@
MAX_REF_FRAMES = 4
} MV_REFERENCE_FRAME;
-typedef enum {
- BLOCK_SIZE_MB16X16 = 0,
- BLOCK_SIZE_SB32X32 = 1,
- BLOCK_SIZE_SB64X64 = 2,
-} BLOCK_SIZE_TYPE;
+static INLINE int b_width_log2(BLOCK_SIZE_TYPE sb_type) {
+ switch (sb_type) {
+ case BLOCK_SIZE_SB4X8:
+ case BLOCK_SIZE_AB4X4: return 0;
+ case BLOCK_SIZE_SB8X4:
+ case BLOCK_SIZE_SB8X8:
+ case BLOCK_SIZE_SB8X16: return 1;
+ case BLOCK_SIZE_SB16X8:
+ case BLOCK_SIZE_MB16X16:
+ case BLOCK_SIZE_SB16X32: return 2;
+ case BLOCK_SIZE_SB32X16:
+ case BLOCK_SIZE_SB32X32:
+ case BLOCK_SIZE_SB32X64: return 3;
+ case BLOCK_SIZE_SB64X32:
+ case BLOCK_SIZE_SB64X64: return 4;
+ default: assert(0);
+ return -1;
+ }
+}
+static INLINE int b_height_log2(BLOCK_SIZE_TYPE sb_type) {
+ switch (sb_type) {
+ case BLOCK_SIZE_SB8X4:
+ case BLOCK_SIZE_AB4X4: return 0;
+ case BLOCK_SIZE_SB4X8:
+ case BLOCK_SIZE_SB8X8:
+ case BLOCK_SIZE_SB16X8: return 1;
+ case BLOCK_SIZE_SB8X16:
+ case BLOCK_SIZE_MB16X16:
+ case BLOCK_SIZE_SB32X16: return 2;
+ case BLOCK_SIZE_SB16X32:
+ case BLOCK_SIZE_SB32X32:
+ case BLOCK_SIZE_SB64X32: return 3;
+ case BLOCK_SIZE_SB32X64:
+ case BLOCK_SIZE_SB64X64: return 4;
+ default: assert(0);
+ return -1;
+ }
+}
+
+static INLINE int mi_width_log2(BLOCK_SIZE_TYPE sb_type) {
+ int a = b_width_log2(sb_type) - 1;
+ // align 4x4 block to mode_info
+ if (a < 0)
+ a = 0;
+ assert(a >= 0);
+ return a;
+}
+
+static INLINE int mi_height_log2(BLOCK_SIZE_TYPE sb_type) {
+ int a = b_height_log2(sb_type) - 1;
+ if (a < 0)
+ a = 0;
+ assert(a >= 0);
+ return a;
+}
+
typedef struct {
MB_PREDICTION_MODE mode, uv_mode;
-#if CONFIG_COMP_INTERINTRA_PRED
- MB_PREDICTION_MODE interintra_mode, interintra_uv_mode;
-#endif
- MV_REFERENCE_FRAME ref_frame, second_ref_frame;
+ MV_REFERENCE_FRAME ref_frame[2];
TX_SIZE txfm_size;
int_mv mv[2]; // for each reference frame used
int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
int_mv best_mv, best_second_mv;
-#if CONFIG_NEW_MVREF
- int best_index, best_second_index;
-#endif
int mb_mode_context[MAX_REF_FRAMES];
- SPLITMV_PARTITIONING_TYPE partitioning;
unsigned char mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
unsigned char need_to_clamp_mvs;
unsigned char need_to_clamp_secondmv;
- unsigned char segment_id; /* Which set of segmentation parameters should be used for this MB */
+ unsigned char segment_id; // Segment id for current frame
// Flags used for prediction status of various bistream signals
unsigned char seg_id_predicted;
- unsigned char ref_predicted;
// Indicates if the mb is part of the image (1) vs border (0)
// This can be useful in determining whether the MB provides
@@ -249,69 +232,62 @@
INTERPOLATIONFILTERTYPE interp_filter;
BLOCK_SIZE_TYPE sb_type;
-#if CONFIG_CODE_NONZEROCOUNT
- uint16_t nzcs[256+64*2];
-#endif
} MB_MODE_INFO;
typedef struct {
MB_MODE_INFO mbmi;
- union b_mode_info bmi[16];
+ union b_mode_info bmi[4];
} MODE_INFO;
-typedef struct blockd {
- int16_t *qcoeff;
- int16_t *dqcoeff;
- uint8_t *predictor;
- int16_t *diff;
- int16_t *dequant;
-
- /* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
- uint8_t **base_pre;
- uint8_t **base_second_pre;
- int pre;
- int pre_stride;
-
- uint8_t **base_dst;
- int dst;
- int dst_stride;
-
- union b_mode_info bmi;
-} BLOCKD;
-
+#define VP9_REF_SCALE_SHIFT 14
struct scale_factors {
- int x_num;
- int x_den;
+ int x_scale_fp; // horizontal fixed point scale factor
+ int y_scale_fp; // vertical fixed point scale factor
int x_offset_q4;
int x_step_q4;
- int y_num;
- int y_den;
int y_offset_q4;
int y_step_q4;
-#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT
- convolve_fn_t predict[2][2][8]; // horiz, vert, weight (0 - 7)
-#else
+
+ int (*scale_value_x)(int val, const struct scale_factors *scale);
+ int (*scale_value_y)(int val, const struct scale_factors *scale);
+ void (*set_scaled_offsets)(struct scale_factors *scale, int row, int col);
+ int_mv32 (*scale_mv_q3_to_q4)(const int_mv *src_mv,
+ const struct scale_factors *scale);
+ int32_t (*scale_mv_component_q4)(int mv_q4, int scale_fp, int offset_q4);
+
convolve_fn_t predict[2][2][2]; // horiz, vert, avg
-#endif
};
-typedef struct macroblockd {
- DECLARE_ALIGNED(16, int16_t, diff[64*64+32*32*2]); /* from idct diff */
- DECLARE_ALIGNED(16, uint8_t, predictor[384]); // unused for superblocks
- DECLARE_ALIGNED(16, int16_t, qcoeff[64*64+32*32*2]);
- DECLARE_ALIGNED(16, int16_t, dqcoeff[64*64+32*32*2]);
- DECLARE_ALIGNED(16, uint16_t, eobs[256+64*2]);
-#if CONFIG_CODE_NONZEROCOUNT
- DECLARE_ALIGNED(16, uint16_t, nzcs[256+64*2]);
+#if CONFIG_ALPHA
+enum { MAX_MB_PLANE = 4 };
+#else
+enum { MAX_MB_PLANE = 3 };
#endif
- /* 16 Y blocks, 4 U, 4 V, each with 16 entries. */
- BLOCKD block[24];
- int fullpixel_mask;
+struct buf_2d {
+ uint8_t *buf;
+ int stride;
+};
- YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */
- YV12_BUFFER_CONFIG second_pre;
- YV12_BUFFER_CONFIG dst;
+struct macroblockd_plane {
+ DECLARE_ALIGNED(16, int16_t, qcoeff[64 * 64]);
+ DECLARE_ALIGNED(16, int16_t, dqcoeff[64 * 64]);
+ DECLARE_ALIGNED(16, uint16_t, eobs[256]);
+ PLANE_TYPE plane_type;
+ int subsampling_x;
+ int subsampling_y;
+ struct buf_2d dst;
+ struct buf_2d pre[2];
+ int16_t *dequant;
+ ENTROPY_CONTEXT *above_context;
+ ENTROPY_CONTEXT *left_context;
+};
+
+#define BLOCK_OFFSET(x, i, n) ((x) + (i) * (n))
+
+typedef struct macroblockd {
+ struct macroblockd_plane plane[MAX_MB_PLANE];
+
struct scale_factors scale_factor[2];
struct scale_factors scale_factor_uv[2];
@@ -325,11 +301,11 @@
int left_available;
int right_available;
- /* Y,U,V */
- ENTROPY_CONTEXT_PLANES *above_context;
- ENTROPY_CONTEXT_PLANES *left_context;
+ // partition contexts
+ PARTITION_CONTEXT *above_seg_context;
+ PARTITION_CONTEXT *left_seg_context;
- /* 0 indicates segmentation at MB level is not enabled. Otherwise the individual bits indicate which features are active. */
+ /* 0 (disable) 1 (enable) segmentation */
unsigned char segmentation_enabled;
/* 0 (do not update) 1 (update) the macroblock segmentation map. */
@@ -345,15 +321,10 @@
/* are enabled and when enabled the proabilities used to decode the per MB flags in MB_MODE_INFO */
// Probability Tree used to code Segment number
- vp9_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS];
- vp9_prob mb_segment_mispred_tree_probs[MAX_MB_SEGMENTS];
+ vp9_prob mb_segment_tree_probs[MB_SEG_TREE_PROBS];
-#if CONFIG_NEW_MVREF
- vp9_prob mb_mv_ref_probs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES-1];
-#endif
-
// Segment features
- signed char segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
+ int16_t segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
unsigned int segment_feature_mask[MAX_MB_SEGMENTS];
/* mode_based Loop filter adjustment */
@@ -361,10 +332,14 @@
unsigned char mode_ref_lf_delta_update;
/* Delta values have the range +/- MAX_LOOP_FILTER */
- signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra, Last, GF, ARF */
- signed char ref_lf_deltas[MAX_REF_LF_DELTAS]; /* 0 = Intra, Last, GF, ARF */
- signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED, ZERO_MV, MV, SPLIT */
- signed char mode_lf_deltas[MAX_MODE_LF_DELTAS]; /* 0 = BPRED, ZERO_MV, MV, SPLIT */
+ /* 0 = Intra, Last, GF, ARF */
+ signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS];
+ /* 0 = Intra, Last, GF, ARF */
+ signed char ref_lf_deltas[MAX_REF_LF_DELTAS];
+ /* 0 = ZERO_MV, MV */
+ signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS];
+ /* 0 = ZERO_MV, MV */
+ signed char mode_lf_deltas[MAX_MODE_LF_DELTAS];
/* Distance of MB away from frame edges */
int mb_to_left_edge;
@@ -377,15 +352,13 @@
int lossless;
/* Inverse transform function pointers. */
- void (*inv_txm4x4_1)(int16_t *input, int16_t *output, int pitch);
- void (*inv_txm4x4)(int16_t *input, int16_t *output, int pitch);
- void (*itxm_add)(int16_t *input, const int16_t *dq,
- uint8_t *pred, uint8_t *output, int pitch, int stride, int eob);
- void (*itxm_add_y_block)(int16_t *q, const int16_t *dq,
- uint8_t *pre, uint8_t *dst, int stride, struct macroblockd *xd);
- void (*itxm_add_uv_block)(int16_t *q, const int16_t *dq,
- uint8_t *pre, uint8_t *dst_u, uint8_t *dst_v, int stride,
+ void (*inv_txm4x4_1_add)(int16_t *input, uint8_t *dest, int stride);
+ void (*inv_txm4x4_add)(int16_t *input, uint8_t *dest, int stride);
+ void (*itxm_add)(int16_t *input, uint8_t *dest, int stride, int eob);
+ void (*itxm_add_y_block)(int16_t *q, uint8_t *dst, int stride,
struct macroblockd *xd);
+ void (*itxm_add_uv_block)(int16_t *q, uint8_t *dst, int stride,
+ uint16_t *eobs);
struct subpix_fn_table subpix;
@@ -393,212 +366,187 @@
int corrupted;
- int sb_index;
- int mb_index; // Index of the MB in the SB (0..3)
+ int sb_index; // index of 32x32 block inside the 64x64 block
+ int mb_index; // index of 16x16 block inside the 32x32 block
+ int b_index; // index of 8x8 block inside the 16x16 block
+ int ab_index; // index of 4x4 block inside the 8x8 block
int q_index;
} MACROBLOCKD;
-#define ACTIVE_HT 110 // quantization stepsize threshold
+static int *get_sb_index(MACROBLOCKD *xd, BLOCK_SIZE_TYPE subsize) {
+ switch (subsize) {
+ case BLOCK_SIZE_SB64X64:
+ case BLOCK_SIZE_SB64X32:
+ case BLOCK_SIZE_SB32X64:
+ case BLOCK_SIZE_SB32X32:
+ return &xd->sb_index;
+ case BLOCK_SIZE_SB32X16:
+ case BLOCK_SIZE_SB16X32:
+ case BLOCK_SIZE_MB16X16:
+ return &xd->mb_index;
+ case BLOCK_SIZE_SB16X8:
+ case BLOCK_SIZE_SB8X16:
+ case BLOCK_SIZE_SB8X8:
+ return &xd->b_index;
+ case BLOCK_SIZE_SB8X4:
+ case BLOCK_SIZE_SB4X8:
+ case BLOCK_SIZE_AB4X4:
+ return &xd->ab_index;
+ default:
+ assert(0);
+ return NULL;
+ }
+}
-#define ACTIVE_HT8 300
+static INLINE void update_partition_context(MACROBLOCKD *xd,
+ BLOCK_SIZE_TYPE sb_type,
+ BLOCK_SIZE_TYPE sb_size) {
+ int bsl = b_width_log2(sb_size), bs = (1 << bsl) / 2;
+ int bwl = b_width_log2(sb_type);
+ int bhl = b_height_log2(sb_type);
+ int boffset = b_width_log2(BLOCK_SIZE_SB64X64) - bsl;
+ int i;
-#define ACTIVE_HT16 300
+ // update the partition context at the end notes. set partition bits
+ // of block sizes larger than the current one to be one, and partition
+ // bits of smaller block sizes to be zero.
+ if ((bwl == bsl) && (bhl == bsl)) {
+ for (i = 0; i < bs; i++)
+ xd->left_seg_context[i] = ~(0xf << boffset);
+ for (i = 0; i < bs; i++)
+ xd->above_seg_context[i] = ~(0xf << boffset);
+ } else if ((bwl == bsl) && (bhl < bsl)) {
+ for (i = 0; i < bs; i++)
+ xd->left_seg_context[i] = ~(0xe << boffset);
+ for (i = 0; i < bs; i++)
+ xd->above_seg_context[i] = ~(0xf << boffset);
+ } else if ((bwl < bsl) && (bhl == bsl)) {
+ for (i = 0; i < bs; i++)
+ xd->left_seg_context[i] = ~(0xf << boffset);
+ for (i = 0; i < bs; i++)
+ xd->above_seg_context[i] = ~(0xe << boffset);
+ } else if ((bwl < bsl) && (bhl < bsl)) {
+ for (i = 0; i < bs; i++)
+ xd->left_seg_context[i] = ~(0xe << boffset);
+ for (i = 0; i < bs; i++)
+ xd->above_seg_context[i] = ~(0xe << boffset);
+ } else {
+ assert(0);
+ }
+}
-// convert MB_PREDICTION_MODE to B_PREDICTION_MODE
-static B_PREDICTION_MODE pred_mode_conv(MB_PREDICTION_MODE mode) {
- switch (mode) {
- case DC_PRED: return B_DC_PRED;
- case V_PRED: return B_VE_PRED;
- case H_PRED: return B_HE_PRED;
- case TM_PRED: return B_TM_PRED;
- case D45_PRED: return B_LD_PRED;
- case D135_PRED: return B_RD_PRED;
- case D117_PRED: return B_VR_PRED;
- case D153_PRED: return B_HD_PRED;
- case D27_PRED: return B_HU_PRED;
- case D63_PRED: return B_VL_PRED;
+static INLINE int partition_plane_context(MACROBLOCKD *xd,
+ BLOCK_SIZE_TYPE sb_type) {
+ int bsl = mi_width_log2(sb_type), bs = 1 << bsl;
+ int above = 0, left = 0, i;
+ int boffset = mi_width_log2(BLOCK_SIZE_SB64X64) - bsl;
+
+ assert(mi_width_log2(sb_type) == mi_height_log2(sb_type));
+ assert(bsl >= 0);
+ assert(boffset >= 0);
+
+ for (i = 0; i < bs; i++)
+ above |= (xd->above_seg_context[i] & (1 << boffset));
+ for (i = 0; i < bs; i++)
+ left |= (xd->left_seg_context[i] & (1 << boffset));
+
+ above = (above > 0);
+ left = (left > 0);
+
+ return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
+}
+
+static BLOCK_SIZE_TYPE get_subsize(BLOCK_SIZE_TYPE bsize,
+ PARTITION_TYPE partition) {
+ BLOCK_SIZE_TYPE subsize;
+ switch (partition) {
+ case PARTITION_NONE:
+ subsize = bsize;
+ break;
+ case PARTITION_HORZ:
+ if (bsize == BLOCK_SIZE_SB64X64)
+ subsize = BLOCK_SIZE_SB64X32;
+ else if (bsize == BLOCK_SIZE_SB32X32)
+ subsize = BLOCK_SIZE_SB32X16;
+ else if (bsize == BLOCK_SIZE_MB16X16)
+ subsize = BLOCK_SIZE_SB16X8;
+ else if (bsize == BLOCK_SIZE_SB8X8)
+ subsize = BLOCK_SIZE_SB8X4;
+ else
+ assert(0);
+ break;
+ case PARTITION_VERT:
+ if (bsize == BLOCK_SIZE_SB64X64)
+ subsize = BLOCK_SIZE_SB32X64;
+ else if (bsize == BLOCK_SIZE_SB32X32)
+ subsize = BLOCK_SIZE_SB16X32;
+ else if (bsize == BLOCK_SIZE_MB16X16)
+ subsize = BLOCK_SIZE_SB8X16;
+ else if (bsize == BLOCK_SIZE_SB8X8)
+ subsize = BLOCK_SIZE_SB4X8;
+ else
+ assert(0);
+ break;
+ case PARTITION_SPLIT:
+ if (bsize == BLOCK_SIZE_SB64X64)
+ subsize = BLOCK_SIZE_SB32X32;
+ else if (bsize == BLOCK_SIZE_SB32X32)
+ subsize = BLOCK_SIZE_MB16X16;
+ else if (bsize == BLOCK_SIZE_MB16X16)
+ subsize = BLOCK_SIZE_SB8X8;
+ else if (bsize == BLOCK_SIZE_SB8X8)
+ subsize = BLOCK_SIZE_AB4X4;
+ else
+ assert(0);
+ break;
default:
- assert(0);
- return B_MODE_COUNT; // Dummy value
+ assert(0);
}
+ return subsize;
}
// transform mapping
-static TX_TYPE txfm_map(B_PREDICTION_MODE bmode) {
+static TX_TYPE txfm_map(MB_PREDICTION_MODE bmode) {
switch (bmode) {
- case B_TM_PRED :
- case B_RD_PRED :
+ case TM_PRED :
+ case D135_PRED :
return ADST_ADST;
- case B_VE_PRED :
- case B_VR_PRED :
+ case V_PRED :
+ case D117_PRED :
+ case D63_PRED:
return ADST_DCT;
- case B_HE_PRED :
- case B_HD_PRED :
- case B_HU_PRED :
+ case H_PRED :
+ case D153_PRED :
+ case D27_PRED :
return DCT_ADST;
-#if CONFIG_NEWBINTRAMODES
- case B_CONTEXT_PRED:
- assert(0);
- break;
-#endif
-
default:
return DCT_DCT;
}
}
-extern const uint8_t vp9_block2left[TX_SIZE_MAX_MB][24];
-extern const uint8_t vp9_block2above[TX_SIZE_MAX_MB][24];
-extern const uint8_t vp9_block2left_sb[TX_SIZE_MAX_SB][96];
-extern const uint8_t vp9_block2above_sb[TX_SIZE_MAX_SB][96];
-extern const uint8_t vp9_block2left_sb64[TX_SIZE_MAX_SB][384];
-extern const uint8_t vp9_block2above_sb64[TX_SIZE_MAX_SB][384];
-
-#define USE_ADST_FOR_I16X16_8X8 1
-#define USE_ADST_FOR_I16X16_4X4 1
-#define USE_ADST_FOR_I8X8_4X4 1
-#define USE_ADST_PERIPHERY_ONLY 1
-#define USE_ADST_FOR_SB 1
-#define USE_ADST_FOR_REMOTE_EDGE 0
-
static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
- // TODO(debargha): explore different patterns for ADST usage when blocksize
- // is smaller than the prediction size
- TX_TYPE tx_type = DCT_DCT;
- const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
-#if !USE_ADST_FOR_SB
- if (sb_type)
- return tx_type;
-#endif
- if (ib >= (16 << (2 * sb_type))) // no chroma adst
- return tx_type;
- if (xd->lossless)
+ TX_TYPE tx_type;
+ MODE_INFO *mi = xd->mode_info_context;
+ MB_MODE_INFO *const mbmi = &mi->mbmi;
+ if (xd->lossless || mbmi->ref_frame[0] != INTRA_FRAME)
return DCT_DCT;
- if (xd->mode_info_context->mbmi.mode == B_PRED &&
- xd->q_index < ACTIVE_HT) {
- const BLOCKD *b = &xd->block[ib];
- tx_type = txfm_map(
-#if CONFIG_NEWBINTRAMODES
- b->bmi.as_mode.first == B_CONTEXT_PRED ? b->bmi.as_mode.context :
-#endif
- b->bmi.as_mode.first);
- } else if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
- xd->q_index < ACTIVE_HT) {
- const BLOCKD *b = &xd->block[ib];
- const int ic = (ib & 10);
-#if USE_ADST_FOR_I8X8_4X4
-#if USE_ADST_PERIPHERY_ONLY
- // Use ADST for periphery blocks only
- const int inner = ib & 5;
- b += ic - ib;
- tx_type = txfm_map(pred_mode_conv(
- (MB_PREDICTION_MODE)b->bmi.as_mode.first));
-#if USE_ADST_FOR_REMOTE_EDGE
- if (inner == 5)
- tx_type = DCT_DCT;
-#else
- if (inner == 1) {
- if (tx_type == ADST_ADST) tx_type = ADST_DCT;
- else if (tx_type == DCT_ADST) tx_type = DCT_DCT;
- } else if (inner == 4) {
- if (tx_type == ADST_ADST) tx_type = DCT_ADST;
- else if (tx_type == ADST_DCT) tx_type = DCT_DCT;
- } else if (inner == 5) {
- tx_type = DCT_DCT;
- }
-#endif
-#else
- // Use ADST
- b += ic - ib;
- tx_type = txfm_map(pred_mode_conv(
- (MB_PREDICTION_MODE)b->bmi.as_mode.first));
-#endif
-#else
- // Use 2D DCT
- tx_type = DCT_DCT;
-#endif
- } else if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
- xd->q_index < ACTIVE_HT) {
-#if USE_ADST_FOR_I16X16_4X4
-#if USE_ADST_PERIPHERY_ONLY
- const int hmax = 4 << sb_type;
- tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
-#if USE_ADST_FOR_REMOTE_EDGE
- if ((ib & (hmax - 1)) != 0 && ib >= hmax)
- tx_type = DCT_DCT;
-#else
- if (ib >= 1 && ib < hmax) {
- if (tx_type == ADST_ADST) tx_type = ADST_DCT;
- else if (tx_type == DCT_ADST) tx_type = DCT_DCT;
- } else if (ib >= 1 && (ib & (hmax - 1)) == 0) {
- if (tx_type == ADST_ADST) tx_type = DCT_ADST;
- else if (tx_type == ADST_DCT) tx_type = DCT_DCT;
- } else if (ib != 0) {
- tx_type = DCT_DCT;
- }
-#endif
-#else
- // Use ADST
- tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
-#endif
-#else
- // Use 2D DCT
- tx_type = DCT_DCT;
-#endif
+ if (mbmi->sb_type < BLOCK_SIZE_SB8X8) {
+ tx_type = txfm_map(mi->bmi[ib].as_mode.first);
+ } else {
+ assert(mbmi->mode <= TM_PRED);
+ tx_type = txfm_map(mbmi->mode);
}
return tx_type;
}
static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, int ib) {
- // TODO(debargha): explore different patterns for ADST usage when blocksize
- // is smaller than the prediction size
TX_TYPE tx_type = DCT_DCT;
- const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
-#if !USE_ADST_FOR_SB
- if (sb_type)
- return tx_type;
-#endif
- if (ib >= (16 << (2 * sb_type))) // no chroma adst
- return tx_type;
- if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
- xd->q_index < ACTIVE_HT8) {
- const BLOCKD *b = &xd->block[ib];
- // TODO(rbultje): MB_PREDICTION_MODE / B_PREDICTION_MODE should be merged
- // or the relationship otherwise modified to address this type conversion.
- tx_type = txfm_map(pred_mode_conv(
- (MB_PREDICTION_MODE)b->bmi.as_mode.first));
- } else if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
- xd->q_index < ACTIVE_HT8) {
-#if USE_ADST_FOR_I16X16_8X8
-#if USE_ADST_PERIPHERY_ONLY
- const int hmax = 4 << sb_type;
- tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
-#if USE_ADST_FOR_REMOTE_EDGE
- if ((ib & (hmax - 1)) != 0 && ib >= hmax)
- tx_type = DCT_DCT;
-#else
- if (ib >= 1 && ib < hmax) {
- if (tx_type == ADST_ADST) tx_type = ADST_DCT;
- else if (tx_type == DCT_ADST) tx_type = DCT_DCT;
- } else if (ib >= 1 && (ib & (hmax - 1)) == 0) {
- if (tx_type == ADST_ADST) tx_type = DCT_ADST;
- else if (tx_type == ADST_DCT) tx_type = DCT_DCT;
- } else if (ib != 0) {
- tx_type = DCT_DCT;
- }
-#endif
-#else
- // Use ADST
- tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
-#endif
-#else
- // Use 2D DCT
- tx_type = DCT_DCT;
-#endif
+ if (xd->mode_info_context->mbmi.mode <= TM_PRED) {
+ tx_type = txfm_map(xd->mode_info_context->mbmi.mode);
}
return tx_type;
}
@@ -605,71 +553,358 @@
static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, int ib) {
TX_TYPE tx_type = DCT_DCT;
- const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
-#if !USE_ADST_FOR_SB
- if (sb_type)
- return tx_type;
-#endif
- if (ib >= (16 << (2 * sb_type)))
- return tx_type;
- if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
- xd->q_index < ACTIVE_HT16) {
- tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
-#if USE_ADST_PERIPHERY_ONLY
- if (sb_type) {
- const int hmax = 4 << sb_type;
-#if USE_ADST_FOR_REMOTE_EDGE
- if ((ib & (hmax - 1)) != 0 && ib >= hmax)
- tx_type = DCT_DCT;
-#else
- if (ib >= 1 && ib < hmax) {
- if (tx_type == ADST_ADST) tx_type = ADST_DCT;
- else if (tx_type == DCT_ADST) tx_type = DCT_DCT;
- } else if (ib >= 1 && (ib & (hmax - 1)) == 0) {
- if (tx_type == ADST_ADST) tx_type = DCT_ADST;
- else if (tx_type == ADST_DCT) tx_type = DCT_DCT;
- } else if (ib != 0) {
- tx_type = DCT_DCT;
+ if (xd->mode_info_context->mbmi.mode <= TM_PRED) {
+ tx_type = txfm_map(xd->mode_info_context->mbmi.mode);
+ }
+ return tx_type;
+}
+
+void vp9_setup_block_dptrs(MACROBLOCKD *xd,
+ int subsampling_x, int subsampling_y);
+
+static TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi) {
+ const TX_SIZE size = mbmi->txfm_size;
+
+ switch (mbmi->sb_type) {
+ case BLOCK_SIZE_SB64X64:
+ return size;
+ case BLOCK_SIZE_SB64X32:
+ case BLOCK_SIZE_SB32X64:
+ case BLOCK_SIZE_SB32X32:
+ if (size == TX_32X32)
+ return TX_16X16;
+ else
+ return size;
+ case BLOCK_SIZE_SB32X16:
+ case BLOCK_SIZE_SB16X32:
+ case BLOCK_SIZE_MB16X16:
+ if (size == TX_16X16)
+ return TX_8X8;
+ else
+ return size;
+ default:
+ return TX_4X4;
+ }
+
+ return size;
+}
+
+struct plane_block_idx {
+ int plane;
+ int block;
+};
+
+// TODO(jkoleszar): returning a struct so it can be used in a const context,
+// expect to refactor this further later.
+static INLINE struct plane_block_idx plane_block_idx(int y_blocks,
+ int b_idx) {
+ const int v_offset = y_blocks * 5 / 4;
+ struct plane_block_idx res;
+
+ if (b_idx < y_blocks) {
+ res.plane = 0;
+ res.block = b_idx;
+ } else if (b_idx < v_offset) {
+ res.plane = 1;
+ res.block = b_idx - y_blocks;
+ } else {
+ assert(b_idx < y_blocks * 3 / 2);
+ res.plane = 2;
+ res.block = b_idx - v_offset;
+ }
+ return res;
+}
+
+static INLINE int plane_block_width(BLOCK_SIZE_TYPE bsize,
+ const struct macroblockd_plane* plane) {
+ return 4 << (b_width_log2(bsize) - plane->subsampling_x);
+}
+
+static INLINE int plane_block_height(BLOCK_SIZE_TYPE bsize,
+ const struct macroblockd_plane* plane) {
+ return 4 << (b_height_log2(bsize) - plane->subsampling_y);
+}
+
+typedef void (*foreach_transformed_block_visitor)(int plane, int block,
+ BLOCK_SIZE_TYPE bsize,
+ int ss_txfrm_size,
+ void *arg);
+
+static INLINE void foreach_transformed_block_in_plane(
+ const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize, int plane,
+ foreach_transformed_block_visitor visit, void *arg) {
+ const int bw = b_width_log2(bsize), bh = b_height_log2(bsize);
+
+ // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
+ // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
+ // transform size varies per plane, look it up in a common way.
+ const MB_MODE_INFO* mbmi = &xd->mode_info_context->mbmi;
+ const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi)
+ : mbmi->txfm_size;
+ const int block_size_b = bw + bh;
+ const int txfrm_size_b = tx_size * 2;
+
+ // subsampled size of the block
+ const int ss_sum = xd->plane[plane].subsampling_x
+ + xd->plane[plane].subsampling_y;
+ const int ss_block_size = block_size_b - ss_sum;
+
+ const int step = 1 << txfrm_size_b;
+
+ int i;
+
+ assert(txfrm_size_b <= block_size_b);
+ assert(txfrm_size_b <= ss_block_size);
+
+ // If mb_to_right_edge is < 0 we are in a situation in which
+ // the current block size extends into the UMV and we won't
+ // visit the sub blocks that are wholly within the UMV.
+ if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
+ int r, c;
+ const int sw = bw - xd->plane[plane].subsampling_x;
+ const int sh = bh - xd->plane[plane].subsampling_y;
+ int max_blocks_wide = 1 << sw;
+ int max_blocks_high = 1 << sh;
+
+ // xd->mb_to_right_edge is in units of pixels * 8. This converts
+ // it to 4x4 block sizes.
+ if (xd->mb_to_right_edge < 0)
+ max_blocks_wide +=
+ + (xd->mb_to_right_edge >> (5 + xd->plane[plane].subsampling_x));
+
+ if (xd->mb_to_bottom_edge < 0)
+ max_blocks_high +=
+ + (xd->mb_to_bottom_edge >> (5 + xd->plane[plane].subsampling_y));
+
+ i = 0;
+ // Unlike the normal case - in here we have to keep track of the
+ // row and column of the blocks we use so that we know if we are in
+ // the unrestricted motion border..
+ for (r = 0; r < (1 << sh); r += (1 << tx_size)) {
+ for (c = 0; c < (1 << sw); c += (1 << tx_size)) {
+ if (r < max_blocks_high && c < max_blocks_wide)
+ visit(plane, i, bsize, txfrm_size_b, arg);
+ i += step;
}
-#endif
}
-#endif
+ } else {
+ for (i = 0; i < (1 << ss_block_size); i += step) {
+ visit(plane, i, bsize, txfrm_size_b, arg);
+ }
}
- return tx_type;
}
-void vp9_build_block_doffsets(MACROBLOCKD *xd);
-void vp9_setup_block_dptrs(MACROBLOCKD *xd);
+static INLINE void foreach_transformed_block(
+ const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize,
+ foreach_transformed_block_visitor visit, void *arg) {
+ int plane;
-static void update_blockd_bmi(MACROBLOCKD *xd) {
- const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
+ for (plane = 0; plane < MAX_MB_PLANE; plane++) {
+ foreach_transformed_block_in_plane(xd, bsize, plane,
+ visit, arg);
+ }
+}
- if (mode == SPLITMV || mode == I8X8_PRED || mode == B_PRED) {
- int i;
- for (i = 0; i < 16; i++)
- xd->block[i].bmi = xd->mode_info_context->bmi[i];
+static INLINE void foreach_transformed_block_uv(
+ const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize,
+ foreach_transformed_block_visitor visit, void *arg) {
+ int plane;
+
+ for (plane = 1; plane < MAX_MB_PLANE; plane++) {
+ foreach_transformed_block_in_plane(xd, bsize, plane,
+ visit, arg);
}
}
-static TX_SIZE get_uv_tx_size(const MACROBLOCKD *xd) {
- TX_SIZE tx_size_uv;
- if (xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_SB64X64) {
- tx_size_uv = xd->mode_info_context->mbmi.txfm_size;
- } else if (xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_SB32X32) {
- if (xd->mode_info_context->mbmi.txfm_size == TX_32X32)
- tx_size_uv = TX_16X16;
- else
- tx_size_uv = xd->mode_info_context->mbmi.txfm_size;
+// TODO(jkoleszar): In principle, pred_w, pred_h are unnecessary, as we could
+// calculate the subsampled BLOCK_SIZE_TYPE, but that type isn't defined for
+// sizes smaller than 16x16 yet.
+typedef void (*foreach_predicted_block_visitor)(int plane, int block,
+ BLOCK_SIZE_TYPE bsize,
+ int pred_w, int pred_h,
+ void *arg);
+static INLINE void foreach_predicted_block_in_plane(
+ const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize, int plane,
+ foreach_predicted_block_visitor visit, void *arg) {
+ int i, x, y;
+
+ // block sizes in number of 4x4 blocks log 2 ("*_b")
+ // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
+ // subsampled size of the block
+ const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
+ const int bhl = b_height_log2(bsize) - xd->plane[plane].subsampling_y;
+
+ // size of the predictor to use.
+ int pred_w, pred_h;
+
+ if (xd->mode_info_context->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
+ assert(bsize == BLOCK_SIZE_SB8X8);
+ pred_w = 0;
+ pred_h = 0;
} else {
- if (xd->mode_info_context->mbmi.txfm_size == TX_16X16)
- tx_size_uv = TX_8X8;
- else if (xd->mode_info_context->mbmi.txfm_size == TX_8X8 &&
- (xd->mode_info_context->mbmi.mode == I8X8_PRED ||
- xd->mode_info_context->mbmi.mode == SPLITMV))
- tx_size_uv = TX_4X4;
- else
- tx_size_uv = xd->mode_info_context->mbmi.txfm_size;
+ pred_w = bwl;
+ pred_h = bhl;
}
- return tx_size_uv;
+ assert(pred_w <= bwl);
+ assert(pred_h <= bhl);
+
+ // visit each subblock in raster order
+ i = 0;
+ for (y = 0; y < 1 << bhl; y += 1 << pred_h) {
+ for (x = 0; x < 1 << bwl; x += 1 << pred_w) {
+ visit(plane, i, bsize, pred_w, pred_h, arg);
+ i += 1 << pred_w;
+ }
+ i += (1 << (bwl + pred_h)) - (1 << bwl);
+ }
}
+static INLINE void foreach_predicted_block(
+ const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize,
+ foreach_predicted_block_visitor visit, void *arg) {
+ int plane;
+
+ for (plane = 0; plane < MAX_MB_PLANE; plane++) {
+ foreach_predicted_block_in_plane(xd, bsize, plane, visit, arg);
+ }
+}
+static INLINE void foreach_predicted_block_uv(
+ const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize,
+ foreach_predicted_block_visitor visit, void *arg) {
+ int plane;
+
+ for (plane = 1; plane < MAX_MB_PLANE; plane++) {
+ foreach_predicted_block_in_plane(xd, bsize, plane, visit, arg);
+ }
+}
+static int raster_block_offset(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
+ int plane, int block, int stride) {
+ const int bw = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
+ const int y = 4 * (block >> bw), x = 4 * (block & ((1 << bw) - 1));
+ return y * stride + x;
+}
+static int16_t* raster_block_offset_int16(MACROBLOCKD *xd,
+ BLOCK_SIZE_TYPE bsize,
+ int plane, int block, int16_t *base) {
+ const int stride = plane_block_width(bsize, &xd->plane[plane]);
+ return base + raster_block_offset(xd, bsize, plane, block, stride);
+}
+static uint8_t* raster_block_offset_uint8(MACROBLOCKD *xd,
+ BLOCK_SIZE_TYPE bsize,
+ int plane, int block,
+ uint8_t *base, int stride) {
+ return base + raster_block_offset(xd, bsize, plane, block, stride);
+}
+
+static int txfrm_block_to_raster_block(MACROBLOCKD *xd,
+ BLOCK_SIZE_TYPE bsize,
+ int plane, int block,
+ int ss_txfrm_size) {
+ const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
+ const int txwl = ss_txfrm_size / 2;
+ const int tx_cols_lg2 = bwl - txwl;
+ const int tx_cols = 1 << tx_cols_lg2;
+ const int raster_mb = block >> ss_txfrm_size;
+ const int x = (raster_mb & (tx_cols - 1)) << (txwl);
+ const int y = raster_mb >> tx_cols_lg2 << (txwl);
+ return x + (y << bwl);
+}
+
+static void txfrm_block_to_raster_xy(MACROBLOCKD *xd,
+ BLOCK_SIZE_TYPE bsize,
+ int plane, int block,
+ int ss_txfrm_size,
+ int *x, int *y) {
+ const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
+ const int txwl = ss_txfrm_size / 2;
+ const int tx_cols_lg2 = bwl - txwl;
+ const int tx_cols = 1 << tx_cols_lg2;
+ const int raster_mb = block >> ss_txfrm_size;
+ *x = (raster_mb & (tx_cols - 1)) << (txwl);
+ *y = raster_mb >> tx_cols_lg2 << (txwl);
+}
+
+static void extend_for_intra(MACROBLOCKD* const xd, int plane, int block,
+ BLOCK_SIZE_TYPE bsize, int ss_txfrm_size) {
+ const int bw = plane_block_width(bsize, &xd->plane[plane]);
+ const int bh = plane_block_height(bsize, &xd->plane[plane]);
+ int x, y;
+ txfrm_block_to_raster_xy(xd, bsize, plane, block, ss_txfrm_size, &x, &y);
+ x = x * 4 - 1;
+ y = y * 4 - 1;
+ // Copy a pixel into the umv if we are in a situation where the block size
+ // extends into the UMV.
+ // TODO(JBB): Should be able to do the full extend in place so we don't have
+ // to do this multiple times.
+ if (xd->mb_to_right_edge < 0) {
+ int umv_border_start = bw
+ + (xd->mb_to_right_edge >> (3 + xd->plane[plane].subsampling_x));
+
+ if (x + bw > umv_border_start)
+ vpx_memset(
+ xd->plane[plane].dst.buf + y * xd->plane[plane].dst.stride
+ + umv_border_start,
+ *(xd->plane[plane].dst.buf + y * xd->plane[plane].dst.stride
+ + umv_border_start - 1),
+ bw);
+ }
+ if (xd->mb_to_bottom_edge < 0) {
+ int umv_border_start = bh
+ + (xd->mb_to_bottom_edge >> (3 + xd->plane[plane].subsampling_y));
+ int i;
+ uint8_t c = *(xd->plane[plane].dst.buf
+ + (umv_border_start - 1) * xd->plane[plane].dst.stride + x);
+
+ uint8_t *d = xd->plane[plane].dst.buf
+ + umv_border_start * xd->plane[plane].dst.stride + x;
+
+ if (y + bh > umv_border_start)
+ for (i = 0; i < bh; i++, d += xd->plane[plane].dst.stride)
+ *d = c;
+ }
+}
+static void set_contexts_on_border(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
+ int plane, int ss_tx_size, int eob, int aoff,
+ int loff, ENTROPY_CONTEXT *A,
+ ENTROPY_CONTEXT *L) {
+ const int bw = b_width_log2(bsize), bh = b_height_log2(bsize);
+ const int sw = bw - xd->plane[plane].subsampling_x;
+ const int sh = bh - xd->plane[plane].subsampling_y;
+ int mi_blocks_wide = 1 << sw;
+ int mi_blocks_high = 1 << sh;
+ int tx_size_in_blocks = (1 << ss_tx_size);
+ int above_contexts = tx_size_in_blocks;
+ int left_contexts = tx_size_in_blocks;
+ int pt;
+
+ // xd->mb_to_right_edge is in units of pixels * 8. This converts
+ // it to 4x4 block sizes.
+ if (xd->mb_to_right_edge < 0) {
+ mi_blocks_wide += (xd->mb_to_right_edge
+ >> (5 + xd->plane[plane].subsampling_x));
+ }
+
+ // this code attempts to avoid copying into contexts that are outside
+ // our border. Any blocks that do are set to 0...
+ if (above_contexts + aoff > mi_blocks_wide)
+ above_contexts = mi_blocks_wide - aoff;
+
+ if (xd->mb_to_bottom_edge < 0) {
+ mi_blocks_high += (xd->mb_to_bottom_edge
+ >> (5 + xd->plane[plane].subsampling_y));
+ }
+ if (left_contexts + loff > mi_blocks_high) {
+ left_contexts = mi_blocks_high - loff;
+ }
+
+ for (pt = 0; pt < above_contexts; pt++)
+ A[pt] = eob > 0;
+ for (pt = above_contexts; pt < (1 << ss_tx_size); pt++)
+ A[pt] = 0;
+ for (pt = 0; pt < left_contexts; pt++)
+ L[pt] = eob > 0;
+ for (pt = left_contexts; pt < (1 << ss_tx_size); pt++)
+ L[pt] = 0;
+}
+
+
#endif // VP9_COMMON_VP9_BLOCKD_H_
--- a/vp9/common/vp9_coefupdateprobs.h
+++ b/vp9/common/vp9_coefupdateprobs.h
@@ -14,20 +14,8 @@
/* Update probabilities for the nodes in the token entropy tree.
Generated file included by vp9_entropy.c */
-static const vp9_prob vp9_coef_update_prob[ENTROPY_NODES] = {
- 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252
+static const vp9_prob vp9_coef_update_prob[UNCONSTRAINED_NODES] = {
+ 252, 252, 252,
};
-
-#if CONFIG_CODE_NONZEROCOUNT
-#define NZC_UPDATE_PROB_4X4 252
-#define NZC_UPDATE_PROB_8X8 252
-#define NZC_UPDATE_PROB_16X16 252
-#define NZC_UPDATE_PROB_32X32 252
-#define NZC_UPDATE_PROB_PCAT 252
-#endif
-
-#if CONFIG_MODELCOEFPROB
-#define COEF_MODEL_UPDATE_PROB 16
-#endif
#endif // VP9_COMMON_VP9_COEFUPDATEPROBS_H__
--- a/vp9/common/vp9_common.h
+++ b/vp9/common/vp9_common.h
@@ -19,9 +19,6 @@
#include "vpx_mem/vpx_mem.h"
#include "vpx/vpx_integer.h"
-#define TRUE 1
-#define FALSE 0
-
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
@@ -54,5 +51,18 @@
static INLINE int clamp(int value, int low, int high) {
return value < low ? low : (value > high ? high : value);
}
+
+static INLINE double fclamp(double value, double low, double high) {
+ return value < low ? low : (value > high ? high : value);
+}
+
+static INLINE int multiple8(int value) {
+ return (value + 7) & ~7;
+}
+
+#define SYNC_CODE_0 0x49
+#define SYNC_CODE_1 0x83
+#define SYNC_CODE_2 0x42
+
#endif // VP9_COMMON_VP9_COMMON_H_
--- a/vp9/common/vp9_context.c
+++ /dev/null
@@ -1,397 +1,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 "vp9/common/vp9_entropy.h"
-
-/* *** GENERATED FILE: DO NOT EDIT *** */
-
-#if 0
-int Contexts[vp8_coef_counter_dimen];
-
-const int default_contexts[vp8_coef_counter_dimen] = {
- {
- // Block Type ( 0 )
- {
- // Coeff Band ( 0 )
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- },
- {
- // Coeff Band ( 1 )
- {30190, 26544, 225, 24, 4, 0, 0, 0, 0, 0, 0, 4171593},
- {26846, 25157, 1241, 130, 26, 6, 1, 0, 0, 0, 0, 149987},
- {10484, 9538, 1006, 160, 36, 18, 0, 0, 0, 0, 0, 15104},
- },
- {
- // Coeff Band ( 2 )
- {25842, 40456, 1126, 83, 11, 2, 0, 0, 0, 0, 0, 0},
- {9338, 8010, 512, 73, 7, 3, 2, 0, 0, 0, 0, 43294},
- {1047, 751, 149, 31, 13, 6, 1, 0, 0, 0, 0, 879},
- },
- {
- // Coeff Band ( 3 )
- {26136, 9826, 252, 13, 0, 0, 0, 0, 0, 0, 0, 0},
- {8134, 5574, 191, 14, 2, 0, 0, 0, 0, 0, 0, 35302},
- { 605, 677, 116, 9, 1, 0, 0, 0, 0, 0, 0, 611},
- },
- {
- // Coeff Band ( 4 )
- {10263, 15463, 283, 17, 0, 0, 0, 0, 0, 0, 0, 0},
- {2773, 2191, 128, 9, 2, 2, 0, 0, 0, 0, 0, 10073},
- { 134, 125, 32, 4, 0, 2, 0, 0, 0, 0, 0, 50},
- },
- {
- // Coeff Band ( 5 )
- {10483, 2663, 23, 1, 0, 0, 0, 0, 0, 0, 0, 0},
- {2137, 1251, 27, 1, 1, 0, 0, 0, 0, 0, 0, 14362},
- { 116, 156, 14, 2, 1, 0, 0, 0, 0, 0, 0, 190},
- },
- {
- // Coeff Band ( 6 )
- {40977, 27614, 412, 28, 0, 0, 0, 0, 0, 0, 0, 0},
- {6113, 5213, 261, 22, 3, 0, 0, 0, 0, 0, 0, 26164},
- { 382, 312, 50, 14, 2, 0, 0, 0, 0, 0, 0, 345},
- },
- {
- // Coeff Band ( 7 )
- { 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 319},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8},
- },
- },
- {
- // Block Type ( 1 )
- {
- // Coeff Band ( 0 )
- {3268, 19382, 1043, 250, 93, 82, 49, 26, 17, 8, 25, 82289},
- {8758, 32110, 5436, 1832, 827, 668, 420, 153, 24, 0, 3, 52914},
- {9337, 23725, 8487, 3954, 2107, 1836, 1069, 399, 59, 0, 0, 18620},
- },
- {
- // Coeff Band ( 1 )
- {12419, 8420, 452, 62, 9, 1, 0, 0, 0, 0, 0, 0},
- {11715, 8705, 693, 92, 15, 7, 2, 0, 0, 0, 0, 53988},
- {7603, 8585, 2306, 778, 270, 145, 39, 5, 0, 0, 0, 9136},
- },
- {
- // Coeff Band ( 2 )
- {15938, 14335, 1207, 184, 55, 13, 4, 1, 0, 0, 0, 0},
- {7415, 6829, 1138, 244, 71, 26, 7, 0, 0, 0, 0, 9980},
- {1580, 1824, 655, 241, 89, 46, 10, 2, 0, 0, 0, 429},
- },
- {
- // Coeff Band ( 3 )
- {19453, 5260, 201, 19, 0, 0, 0, 0, 0, 0, 0, 0},
- {9173, 3758, 213, 22, 1, 1, 0, 0, 0, 0, 0, 9820},
- {1689, 1277, 276, 51, 17, 4, 0, 0, 0, 0, 0, 679},
- },
- {
- // Coeff Band ( 4 )
- {12076, 10667, 620, 85, 19, 9, 5, 0, 0, 0, 0, 0},
- {4665, 3625, 423, 55, 19, 9, 0, 0, 0, 0, 0, 5127},
- { 415, 440, 143, 34, 20, 7, 2, 0, 0, 0, 0, 101},
- },
- {
- // Coeff Band ( 5 )
- {12183, 4846, 115, 11, 1, 0, 0, 0, 0, 0, 0, 0},
- {4226, 3149, 177, 21, 2, 0, 0, 0, 0, 0, 0, 7157},
- { 375, 621, 189, 51, 11, 4, 1, 0, 0, 0, 0, 198},
- },
- {
- // Coeff Band ( 6 )
- {61658, 37743, 1203, 94, 10, 3, 0, 0, 0, 0, 0, 0},
- {15514, 11563, 903, 111, 14, 5, 0, 0, 0, 0, 0, 25195},
- { 929, 1077, 291, 78, 14, 7, 1, 0, 0, 0, 0, 507},
- },
- {
- // Coeff Band ( 7 )
- { 0, 990, 15, 3, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 412, 13, 0, 0, 0, 0, 0, 0, 0, 0, 1641},
- { 0, 18, 7, 1, 0, 0, 0, 0, 0, 0, 0, 30},
- },
- },
- {
- // Block Type ( 2 )
- {
- // Coeff Band ( 0 )
- { 953, 24519, 628, 120, 28, 12, 4, 0, 0, 0, 0, 2248798},
- {1525, 25654, 2647, 617, 239, 143, 42, 5, 0, 0, 0, 66837},
- {1180, 11011, 3001, 1237, 532, 448, 239, 54, 5, 0, 0, 7122},
- },
- {
- // Coeff Band ( 1 )
- {1356, 2220, 67, 10, 4, 1, 0, 0, 0, 0, 0, 0},
- {1450, 2544, 102, 18, 4, 3, 0, 0, 0, 0, 0, 57063},
- {1182, 2110, 470, 130, 41, 21, 0, 0, 0, 0, 0, 6047},
- },
- {
- // Coeff Band ( 2 )
- { 370, 3378, 200, 30, 5, 4, 1, 0, 0, 0, 0, 0},
- { 293, 1006, 131, 29, 11, 0, 0, 0, 0, 0, 0, 5404},
- { 114, 387, 98, 23, 4, 8, 1, 0, 0, 0, 0, 236},
- },
- {
- // Coeff Band ( 3 )
- { 579, 194, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 395, 213, 5, 1, 0, 0, 0, 0, 0, 0, 0, 4157},
- { 119, 122, 4, 0, 0, 0, 0, 0, 0, 0, 0, 300},
- },
- {
- // Coeff Band ( 4 )
- { 38, 557, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 21, 114, 12, 1, 0, 0, 0, 0, 0, 0, 0, 427},
- { 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7},
- },
- {
- // Coeff Band ( 5 )
- { 52, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 18, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 652},
- { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30},
- },
- {
- // Coeff Band ( 6 )
- { 640, 569, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 25, 77, 2, 0, 0, 0, 0, 0, 0, 0, 0, 517},
- { 4, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3},
- },
- {
- // Coeff Band ( 7 )
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- },
- },
- {
- // Block Type ( 3 )
- {
- // Coeff Band ( 0 )
- {2506, 20161, 2707, 767, 261, 178, 107, 30, 14, 3, 0, 100694},
- {8806, 36478, 8817, 3268, 1280, 850, 401, 114, 42, 0, 0, 58572},
- {11003, 27214, 11798, 5716, 2482, 2072, 1048, 175, 32, 0, 0, 19284},
- },
- {
- // Coeff Band ( 1 )
- {9738, 11313, 959, 205, 70, 18, 11, 1, 0, 0, 0, 0},
- {12628, 15085, 1507, 273, 52, 19, 9, 0, 0, 0, 0, 54280},
- {10701, 15846, 5561, 1926, 813, 570, 249, 36, 0, 0, 0, 6460},
- },
- {
- // Coeff Band ( 2 )
- {6781, 22539, 2784, 634, 182, 123, 20, 4, 0, 0, 0, 0},
- {6263, 11544, 2649, 790, 259, 168, 27, 5, 0, 0, 0, 20539},
- {3109, 4075, 2031, 896, 457, 386, 158, 29, 0, 0, 0, 1138},
- },
- {
- // Coeff Band ( 3 )
- {11515, 4079, 465, 73, 5, 14, 2, 0, 0, 0, 0, 0},
- {9361, 5834, 650, 96, 24, 8, 4, 0, 0, 0, 0, 22181},
- {4343, 3974, 1360, 415, 132, 96, 14, 1, 0, 0, 0, 1267},
- },
- {
- // Coeff Band ( 4 )
- {4787, 9297, 823, 168, 44, 12, 4, 0, 0, 0, 0, 0},
- {3619, 4472, 719, 198, 60, 31, 3, 0, 0, 0, 0, 8401},
- {1157, 1175, 483, 182, 88, 31, 8, 0, 0, 0, 0, 268},
- },
- {
- // Coeff Band ( 5 )
- {8299, 1226, 32, 5, 1, 0, 0, 0, 0, 0, 0, 0},
- {3502, 1568, 57, 4, 1, 1, 0, 0, 0, 0, 0, 9811},
- {1055, 1070, 166, 29, 6, 1, 0, 0, 0, 0, 0, 527},
- },
- {
- // Coeff Band ( 6 )
- {27414, 27927, 1989, 347, 69, 26, 0, 0, 0, 0, 0, 0},
- {5876, 10074, 1574, 341, 91, 24, 4, 0, 0, 0, 0, 21954},
- {1571, 2171, 778, 324, 124, 65, 16, 0, 0, 0, 0, 979},
- },
- {
- // Coeff Band ( 7 )
- { 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 459},
- { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13},
- },
- },
-};
-
-// Update probabilities for the nodes in the token entropy tree.
-const vp9_prob tree_update_probs[vp9_coef_tree_dimen] = {
- {
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {176, 246, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {223, 241, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
- {249, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 244, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
- {234, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 246, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {239, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {251, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {251, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 253, 255, 254, 255, 255, 255, 255, 255, 255, },
- {250, 255, 254, 255, 254, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
- {
- {
- {217, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {225, 252, 241, 253, 255, 255, 254, 255, 255, 255, 255, },
- {234, 250, 241, 250, 253, 255, 253, 254, 255, 255, 255, },
- },
- {
- {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {223, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {238, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 248, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {249, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {247, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
- {
- {
- {186, 251, 250, 255, 255, 255, 255, 255, 255, 255, 255, },
- {234, 251, 244, 254, 255, 255, 255, 255, 255, 255, 255, },
- {251, 251, 243, 253, 254, 255, 254, 255, 255, 255, 255, },
- },
- {
- {255, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {236, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {251, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
- {
- {
- {248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {250, 254, 252, 254, 255, 255, 255, 255, 255, 255, 255, },
- {248, 254, 249, 253, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {246, 253, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {252, 254, 251, 254, 254, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 254, 252, 255, 255, 255, 255, 255, 255, 255, 255, },
- {248, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 255, 254, 254, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {245, 251, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {253, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 251, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {249, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 253, 255, 255, 255, 255, 255, 255, 255, 255, },
- {250, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- {
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, },
- },
- },
-};
-#endif
--- a/vp9/common/vp9_convolve.c
+++ b/vp9/common/vp9_convolve.c
@@ -122,78 +122,6 @@
}
}
-#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT
-
-static inline uint8_t combine_qtr(uint8_t a, uint8_t b) {
- return (((a) + (b) * 3 + 2) >> 2);
-}
-
-static inline uint8_t combine_3qtr(uint8_t a, uint8_t b) {
- return (((a) * 3 + (b) + 2) >> 2);
-}
-
-static inline uint8_t combine_1by8(uint8_t a, uint8_t b) {
- return (((a) * 1 + (b) * 7 + 4) >> 3);
-}
-
-static inline uint8_t combine_3by8(uint8_t a, uint8_t b) {
- return (((a) * 3 + (b) * 5 + 4) >> 3);
-}
-
-static inline uint8_t combine_5by8(uint8_t a, uint8_t b) {
- return (((a) * 5 + (b) * 3 + 4) >> 3);
-}
-
-static inline uint8_t combine_7by8(uint8_t a, uint8_t b) {
- return (((a) * 7 + (b) * 1 + 4) >> 3);
-}
-
-// TODO(debargha): Implment with a separate weight parameter
-static void convolve_wtd_horiz_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x0, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h, int taps,
- uint8_t (*combine)(uint8_t a, uint8_t b)) {
- int x, y, k, sum;
- const int16_t *filter_x_base = filter_x0;
-
-#if ALIGN_FILTERS_256
- filter_x_base = (const int16_t *)(((intptr_t)filter_x0) & ~(intptr_t)0xff);
-#endif
-
- /* Adjust base pointer address for this source line */
- src -= taps / 2 - 1;
-
- for (y = 0; y < h; ++y) {
- /* Pointer to filter to use */
- const int16_t *filter_x = filter_x0;
-
- /* Initial phase offset */
- int x0_q4 = (filter_x - filter_x_base) / taps;
- int x_q4 = x0_q4;
-
- for (x = 0; x < w; ++x) {
- /* Per-pixel src offset */
- int src_x = (x_q4 - x0_q4) >> 4;
-
- for (sum = 0, k = 0; k < taps; ++k) {
- sum += src[src_x + k] * filter_x[k];
- }
- sum += (VP9_FILTER_WEIGHT >> 1);
- dst[x] = combine(dst[x], clip_pixel(sum >> VP9_FILTER_SHIFT));
-
- /* Adjust source and filter to use for the next pixel */
- x_q4 += x_step_q4;
- filter_x = filter_x_base + (x_q4 & 0xf) * taps;
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-#endif
-
static void convolve_vert_c(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride,
const int16_t *filter_x, int x_step_q4,
@@ -279,52 +207,6 @@
}
}
-#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT
-static void convolve_wtd_vert_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y0, int y_step_q4,
- int w, int h, int taps,
- uint8_t (*combine)(uint8_t a, uint8_t b)) {
- int x, y, k, sum;
-
- const int16_t *filter_y_base = filter_y0;
-
-#if ALIGN_FILTERS_256
- filter_y_base = (const int16_t *)(((intptr_t)filter_y0) & ~(intptr_t)0xff);
-#endif
-
- /* Adjust base pointer address for this source column */
- src -= src_stride * (taps / 2 - 1);
- for (x = 0; x < w; ++x) {
- /* Pointer to filter to use */
- const int16_t *filter_y = filter_y0;
-
- /* Initial phase offset */
- int y0_q4 = (filter_y - filter_y_base) / taps;
- int y_q4 = y0_q4;
-
- for (y = 0; y < h; ++y) {
- /* Per-pixel src offset */
- int src_y = (y_q4 - y0_q4) >> 4;
-
- for (sum = 0, k = 0; k < taps; ++k) {
- sum += src[(src_y + k) * src_stride] * filter_y[k];
- }
- sum += (VP9_FILTER_WEIGHT >> 1);
- dst[y * dst_stride] = combine(dst[y * dst_stride],
- clip_pixel(sum >> VP9_FILTER_SHIFT));
-
- /* Adjust source and filter to use for the next pixel */
- y_q4 += y_step_q4;
- filter_y = filter_y_base + (y_q4 & 0xf) * taps;
- }
- ++src;
- ++dst;
- }
-}
-#endif
-
static void convolve_c(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride,
const int16_t *filter_x, int x_step_q4,
@@ -331,14 +213,14 @@
const int16_t *filter_y, int y_step_q4,
int w, int h, int taps) {
/* Fixed size intermediate buffer places limits on parameters.
- * Maximum intermediate_height is 39, for y_step_q4 == 32,
- * h == 16, taps == 8.
+ * Maximum intermediate_height is 135, for y_step_q4 == 32,
+ * h == 64, taps == 8.
*/
- uint8_t temp[16 * 39];
+ uint8_t temp[64 * 135];
int intermediate_height = ((h * y_step_q4) >> 4) + taps - 1;
- assert(w <= 16);
- assert(h <= 16);
+ assert(w <= 64);
+ assert(h <= 64);
assert(taps <= 8);
assert(y_step_q4 <= 32);
@@ -346,10 +228,10 @@
intermediate_height = h;
convolve_horiz_c(src - src_stride * (taps / 2 - 1), src_stride,
- temp, 16,
+ temp, 64,
filter_x, x_step_q4, filter_y, y_step_q4,
w, intermediate_height, taps);
- convolve_vert_c(temp + 16 * (taps / 2 - 1), 16, dst, dst_stride,
+ convolve_vert_c(temp + 64 * (taps / 2 - 1), 64, dst, dst_stride,
filter_x, x_step_q4, filter_y, y_step_q4,
w, h, taps);
}
@@ -360,14 +242,14 @@
const int16_t *filter_y, int y_step_q4,
int w, int h, int taps) {
/* Fixed size intermediate buffer places limits on parameters.
- * Maximum intermediate_height is 39, for y_step_q4 == 32,
- * h == 16, taps == 8.
+ * Maximum intermediate_height is 135, for y_step_q4 == 32,
+ * h == 64, taps == 8.
*/
- uint8_t temp[16 * 39];
+ uint8_t temp[64 * 135];
int intermediate_height = ((h * y_step_q4) >> 4) + taps - 1;
- assert(w <= 16);
- assert(h <= 16);
+ assert(w <= 64);
+ assert(h <= 64);
assert(taps <= 8);
assert(y_step_q4 <= 32);
@@ -375,10 +257,10 @@
intermediate_height = h;
convolve_horiz_c(src - src_stride * (taps / 2 - 1), src_stride,
- temp, 16,
+ temp, 64,
filter_x, x_step_q4, filter_y, y_step_q4,
w, intermediate_height, taps);
- convolve_avg_vert_c(temp + 16 * (taps / 2 - 1), 16, dst, dst_stride,
+ convolve_avg_vert_c(temp + 64 * (taps / 2 - 1), 64, dst, dst_stride,
filter_x, x_step_q4, filter_y, y_step_q4,
w, h, taps);
}
@@ -403,68 +285,6 @@
w, h, 8);
}
-#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT
-void vp9_convolve8_1by8_horiz_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_horiz_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_1by8);
-}
-
-void vp9_convolve8_qtr_horiz_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_horiz_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_qtr);
-}
-
-void vp9_convolve8_3by8_horiz_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_horiz_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_3by8);
-}
-
-void vp9_convolve8_5by8_horiz_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_horiz_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_5by8);
-}
-
-void vp9_convolve8_3qtr_horiz_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_horiz_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_3qtr);
-}
-
-void vp9_convolve8_7by8_horiz_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_horiz_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_7by8);
-}
-#endif
-
void vp9_convolve8_vert_c(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride,
const int16_t *filter_x, int x_step_q4,
@@ -485,68 +305,6 @@
w, h, 8);
}
-#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT
-void vp9_convolve8_1by8_vert_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_vert_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_1by8);
-}
-
-void vp9_convolve8_qtr_vert_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_vert_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_qtr);
-}
-
-void vp9_convolve8_3by8_vert_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_vert_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_3by8);
-}
-
-void vp9_convolve8_5by8_vert_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_vert_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_5by8);
-}
-
-void vp9_convolve8_3qtr_vert_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_vert_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_3qtr);
-}
-
-void vp9_convolve8_7by8_vert_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- convolve_wtd_vert_c(src, src_stride, dst, dst_stride,
- filter_x, x_step_q4, filter_y, y_step_q4,
- w, h, 8, combine_7by8);
-}
-#endif
-
void vp9_convolve8_c(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride,
const int16_t *filter_x, int x_step_q4,
@@ -563,16 +321,16 @@
const int16_t *filter_y, int y_step_q4,
int w, int h) {
/* Fixed size intermediate buffer places limits on parameters. */
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp, 16 * 16);
- assert(w <= 16);
- assert(h <= 16);
+ DECLARE_ALIGNED_ARRAY(16, uint8_t, temp, 64 * 64);
+ assert(w <= 64);
+ assert(h <= 64);
vp9_convolve8(src, src_stride,
- temp, 16,
+ temp, 64,
filter_x, x_step_q4,
filter_y, y_step_q4,
w, h);
- vp9_convolve_avg(temp, 16,
+ vp9_convolve_avg(temp, 64,
dst, dst_stride,
NULL, 0, /* These unused parameter should be removed! */
NULL, 0, /* These unused parameter should be removed! */
@@ -579,140 +337,6 @@
w, h);
}
-#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT
-void vp9_convolve8_1by8_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- /* Fixed size intermediate buffer places limits on parameters. */
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp, 16 * 16);
- assert(w <= 16);
- assert(h <= 16);
-
- vp9_convolve8(src, src_stride,
- temp, 16,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- vp9_convolve_1by8(temp, 16,
- dst, dst_stride,
- NULL, 0, /* These unused parameter should be removed! */
- NULL, 0, /* These unused parameter should be removed! */
- w, h);
-}
-
-void vp9_convolve8_qtr_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- /* Fixed size intermediate buffer places limits on parameters. */
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp, 16 * 16);
- assert(w <= 16);
- assert(h <= 16);
-
- vp9_convolve8(src, src_stride,
- temp, 16,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- vp9_convolve_qtr(temp, 16,
- dst, dst_stride,
- NULL, 0, /* These unused parameter should be removed! */
- NULL, 0, /* These unused parameter should be removed! */
- w, h);
-}
-
-void vp9_convolve8_3by8_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- /* Fixed size intermediate buffer places limits on parameters. */
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp, 16 * 16);
- assert(w <= 16);
- assert(h <= 16);
-
- vp9_convolve8(src, src_stride,
- temp, 16,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- vp9_convolve_3by8(temp, 16,
- dst, dst_stride,
- NULL, 0, /* These unused parameter should be removed! */
- NULL, 0, /* These unused parameter should be removed! */
- w, h);
-}
-
-void vp9_convolve8_5by8_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- /* Fixed size intermediate buffer places limits on parameters. */
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp, 16 * 16);
- assert(w <= 16);
- assert(h <= 16);
-
- vp9_convolve8(src, src_stride,
- temp, 16,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- vp9_convolve_5by8(temp, 16,
- dst, dst_stride,
- NULL, 0, /* These unused parameter should be removed! */
- NULL, 0, /* These unused parameter should be removed! */
- w, h);
-}
-
-void vp9_convolve8_3qtr_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- /* Fixed size intermediate buffer places limits on parameters. */
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp, 16 * 16);
- assert(w <= 16);
- assert(h <= 16);
-
- vp9_convolve8(src, src_stride,
- temp, 16,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- vp9_convolve_3qtr(temp, 16,
- dst, dst_stride,
- NULL, 0, /* These unused parameter should be removed! */
- NULL, 0, /* These unused parameter should be removed! */
- w, h);
-}
-
-void vp9_convolve8_7by8_c(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h) {
- /* Fixed size intermediate buffer places limits on parameters. */
- DECLARE_ALIGNED_ARRAY(16, uint8_t, temp, 16 * 16);
- assert(w <= 16);
- assert(h <= 16);
-
- vp9_convolve8(src, src_stride,
- temp, 16,
- filter_x, x_step_q4,
- filter_y, y_step_q4,
- w, h);
- vp9_convolve_7by8(temp, 16,
- dst, dst_stride,
- NULL, 0, /* These unused parameter should be removed! */
- NULL, 0, /* These unused parameter should be removed! */
- w, h);
-}
-#endif
-
void vp9_convolve_copy(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride,
const int16_t *filter_x, int filter_x_stride,
@@ -750,101 +374,3 @@
dst += dst_stride;
}
}
-
-#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT
-void vp9_convolve_1by8(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int x, y;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- dst[x] = combine_1by8(dst[x], src[x]);
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve_qtr(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int x, y;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- dst[x] = combine_qtr(dst[x], src[x]);
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve_3by8(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int x, y;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- dst[x] = combine_3by8(dst[x], src[x]);
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve_5by8(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int x, y;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- dst[x] = combine_5by8(dst[x], src[x]);
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve_3qtr(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int x, y;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- dst[x] = combine_3qtr(dst[x], src[x]);
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-
-void vp9_convolve_7by8(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int filter_x_stride,
- const int16_t *filter_y, int filter_y_stride,
- int w, int h) {
- int x, y;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- dst[x] = combine_7by8(dst[x], src[x]);
- }
- src += src_stride;
- dst += dst_stride;
- }
-}
-#endif
--- a/vp9/common/vp9_convolve.h
+++ b/vp9/common/vp9_convolve.h
@@ -33,50 +33,6 @@
const int16_t *filter_y, int y_step_q4,
int w, int h);
-#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT
-// Not a convolution, a block wtd (1/8, 7/8) average for (dst, src)
-void vp9_convolve_1by8(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h);
-
-// Not a convolution, a block wtd (1/4, 3/4) average for (dst, src)
-void vp9_convolve_qtr(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h);
-
-// Not a convolution, a block wtd (3/8, 5/8) average for (dst, src)
-void vp9_convolve_3by8(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h);
-
-// Not a convolution, a block wtd (5/8, 3/8) average for (dst, src)
-void vp9_convolve_5by8(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h);
-
-// Not a convolution, a block wtd (3/4, 1/4) average for (dst, src)
-void vp9_convolve_3qtr(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h);
-
-// Not a convolution, a block wtd (7/8, 1/8) average for (dst, src)
-void vp9_convolve_7by8(const uint8_t *src, int src_stride,
- uint8_t *dst, int dst_stride,
- const int16_t *filter_x, int x_step_q4,
- const int16_t *filter_y, int y_step_q4,
- int w, int h);
-#endif
-
struct subpix_fn_table {
const int16_t (*filter_x)[8];
const int16_t (*filter_y)[8];
--- a/vp9/common/vp9_debugmodes.c
+++ b/vp9/common/vp9_debugmodes.c
@@ -13,130 +13,124 @@
#include "vp9/common/vp9_blockd.h"
void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols,
- int frame) {
- int mb_row;
- int mb_col;
- int mb_index = 0;
- FILE *mvs = fopen("mvs.stt", "a");
+ int frame, char *file) {
+ int mi_row;
+ int mi_col;
+ int mi_index = 0;
+ FILE *mvs = fopen(file, "a");
// Print out the macroblock Y modes
- fprintf(mvs, "Mb Modes for Frame %d\n", frame);
+ fprintf(mvs, "SB Types for Frame %d\n", frame);
- for (mb_row = 0; mb_row < rows; mb_row++) {
- for (mb_col = 0; mb_col < cols; mb_col++) {
+ for (mi_row = 0; mi_row < rows; mi_row++) {
+ for (mi_col = 0; mi_col < cols; mi_col++) {
+ fprintf(mvs, "%2d ", mi[mi_index].mbmi.sb_type);
- fprintf(mvs, "%2d ", mi[mb_index].mbmi.mode);
+ mi_index++;
+ }
- mb_index++;
+ fprintf(mvs, "\n");
+ mi_index += 8;
+ }
+
+ // Print out the macroblock Y modes
+ fprintf(mvs, "Mb Modes for Frame %d\n", frame);
+ mi_index = 0;
+ for (mi_row = 0; mi_row < rows; mi_row++) {
+ for (mi_col = 0; mi_col < cols; mi_col++) {
+ fprintf(mvs, "%2d ", mi[mi_index].mbmi.mode);
+
+ mi_index++;
}
fprintf(mvs, "\n");
- mb_index++;
+ mi_index += 8;
}
fprintf(mvs, "\n");
- mb_index = 0;
+ mi_index = 0;
fprintf(mvs, "Mb mv ref for Frame %d\n", frame);
- for (mb_row = 0; mb_row < rows; mb_row++) {
- for (mb_col = 0; mb_col < cols; mb_col++) {
+ for (mi_row = 0; mi_row < rows; mi_row++) {
+ for (mi_col = 0; mi_col < cols; mi_col++) {
+ fprintf(mvs, "%2d ", mi[mi_index].mbmi.ref_frame[0]);
- fprintf(mvs, "%2d ", mi[mb_index].mbmi.ref_frame);
-
- mb_index++;
+ mi_index++;
}
fprintf(mvs, "\n");
- mb_index++;
+ mi_index += 8;
}
-
fprintf(mvs, "\n");
- /* print out the macroblock UV modes */
- mb_index = 0;
- fprintf(mvs, "UV Modes for Frame %d\n", frame);
+ mi_index = 0;
+ fprintf(mvs, "Mb mv ref for Frame %d\n", frame);
- for (mb_row = 0; mb_row < rows; mb_row++) {
- for (mb_col = 0; mb_col < cols; mb_col++) {
+ for (mi_row = 0; mi_row < rows; mi_row++) {
+ for (mi_col = 0; mi_col < cols; mi_col++) {
+ fprintf(mvs, "%4d:%4d ", mi[mi_index].mbmi.mv[0].as_mv.row,
+ mi[mi_index].mbmi.mv[0].as_mv.col);
- fprintf(mvs, "%2d ", mi[mb_index].mbmi.uv_mode);
-
- mb_index++;
+ mi_index++;
}
- mb_index++;
fprintf(mvs, "\n");
+ mi_index += 8;
}
fprintf(mvs, "\n");
- /* print out the block modes */
- mb_index = 0;
- fprintf(mvs, "Mbs for Frame %d\n", frame);
- {
- int b_row;
+ /* print out the macroblock txform sizes */
+ mi_index = 0;
+ fprintf(mvs, "TXFM size for Frame %d\n", frame);
- for (b_row = 0; b_row < 4 * rows; b_row++) {
- int b_col;
- int bindex;
+ for (mi_row = 0; mi_row < rows; mi_row++) {
+ for (mi_col = 0; mi_col < cols; mi_col++) {
+ fprintf(mvs, "%2d ", mi[mi_index].mbmi.txfm_size);
- for (b_col = 0; b_col < 4 * cols; b_col++) {
- mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
- bindex = (b_row & 3) * 4 + (b_col & 3);
-
- if (mi[mb_index].mbmi.mode == B_PRED) {
- fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].as_mode.first);
- } else
- fprintf(mvs, "xx ");
-
- }
-
- fprintf(mvs, "\n");
+ mi_index++;
}
+
+ mi_index += 8;
+ fprintf(mvs, "\n");
}
+
fprintf(mvs, "\n");
- /* print out the macroblock mvs */
- mb_index = 0;
- fprintf(mvs, "MVs for Frame %d\n", frame);
+ /* print out the macroblock UV modes */
+ mi_index = 0;
+ fprintf(mvs, "UV Modes for Frame %d\n", frame);
- for (mb_row = 0; mb_row < rows; mb_row++) {
- for (mb_col = 0; mb_col < cols; mb_col++) {
- fprintf(mvs, "%5d:%-5d", mi[mb_index].mbmi.mv[0].as_mv.row / 2,
- mi[mb_index].mbmi.mv[0].as_mv.col / 2);
+ for (mi_row = 0; mi_row < rows; mi_row++) {
+ for (mi_col = 0; mi_col < cols; mi_col++) {
+ fprintf(mvs, "%2d ", mi[mi_index].mbmi.uv_mode);
- mb_index++;
+ mi_index++;
}
- mb_index++;
+ mi_index += 8;
fprintf(mvs, "\n");
}
fprintf(mvs, "\n");
- /* print out the block modes */
- mb_index = 0;
+ /* print out the macroblock mvs */
+ mi_index = 0;
fprintf(mvs, "MVs for Frame %d\n", frame);
- {
- int b_row;
- for (b_row = 0; b_row < 4 * rows; b_row++) {
- int b_col;
- int bindex;
+ for (mi_row = 0; mi_row < rows; mi_row++) {
+ for (mi_col = 0; mi_col < cols; mi_col++) {
+ fprintf(mvs, "%5d:%-5d", mi[mi_index].mbmi.mv[0].as_mv.row / 2,
+ mi[mi_index].mbmi.mv[0].as_mv.col / 2);
- for (b_col = 0; b_col < 4 * cols; b_col++) {
- mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
- bindex = (b_row & 3) * 4 + (b_col & 3);
- fprintf(mvs, "%3d:%-3d ",
- mi[mb_index].bmi[bindex].as_mv[0].as_mv.row,
- mi[mb_index].bmi[bindex].as_mv[0].as_mv.col);
-
- }
-
- fprintf(mvs, "\n");
+ mi_index++;
}
+
+ mi_index += 8;
+ fprintf(mvs, "\n");
}
+
fprintf(mvs, "\n");
fclose(mvs);
--- a/vp9/common/vp9_default_coef_probs.h
+++ b/vp9/common/vp9_default_coef_probs.h
@@ -11,987 +11,1374 @@
/*Generated file, included by vp9_entropy.c*/
-// NOTE: When the CONFIG_MODELCOEFPROB experiment is on, only the first
-// 2 or 3 from each row is actually used depending on whether
-// UNCONSTRAINDED_NODES is 2 or 3. If this experiment is merged
-// the tables below should be shortened accordingly.
-static const vp9_coeff_probs default_coef_probs_4x4[BLOCK_TYPES] = {
+#if CONFIG_BALANCED_COEFTREE
+static const vp9_coeff_probs_model default_coef_probs_4x4[BLOCK_TYPES] = {
{ /* block Type 0 */
{ /* Intra */
{ /* Coeff Band 0 */
- { 208, 32, 178, 198, 161, 167, 196, 147, 244, 194, 210 },
- { 102, 43, 132, 185, 148, 162, 185, 141, 237, 181, 215 },
- { 15, 36, 68, 143, 119, 151, 169, 133, 230, 173, 214 }
+ { 6, 213, 178 },
+ { 26, 113, 132 },
+ { 34, 17, 68 }
}, { /* Coeff Band 1 */
- { 71, 91, 178, 226, 169, 176, 232, 170, 252, 219, 231 },
- { 72, 88, 174, 226, 168, 176, 232, 170, 252, 219, 234 },
- { 40, 79, 154, 222, 161, 174, 231, 169, 251, 219, 238 },
- { 21, 68, 126, 211, 144, 167, 230, 167, 252, 219, 236 },
- { 7, 49, 84, 175, 121, 152, 223, 151, 251, 218, 237 },
- { 1, 20, 32, 100, 97, 140, 163, 116, 237, 186, 222 }
+ { 66, 96, 178 },
+ { 63, 96, 174 },
+ { 67, 54, 154 },
+ { 62, 28, 126 },
+ { 48, 9, 84 },
+ { 20, 1, 32 }
}, { /* Coeff Band 2 */
- { 108, 110, 206, 237, 182, 183, 239, 181, 252, 221, 245 },
- { 72, 98, 191, 236, 180, 182, 240, 183, 252, 223, 239 },
- { 26, 77, 152, 230, 166, 179, 239, 181, 252, 222, 241 },
- { 7, 57, 106, 212, 141, 167, 236, 173, 252, 223, 243 },
- { 1, 35, 60, 171, 110, 149, 225, 155, 251, 218, 240 },
- { 1, 14, 22, 90, 86, 134, 163, 116, 238, 181, 233 }
+ { 64, 144, 206 },
+ { 70, 99, 191 },
+ { 69, 36, 152 },
+ { 55, 9, 106 },
+ { 35, 1, 60 },
+ { 14, 1, 22 }
}, { /* Coeff Band 3 */
- { 105, 139, 222, 245, 196, 192, 245, 195, 253, 229, 255 },
- { 76, 118, 205, 245, 192, 192, 247, 198, 254, 230, 255 },
- { 21, 88, 164, 240, 175, 186, 246, 197, 255, 232, 255 },
- { 5, 63, 118, 222, 149, 172, 242, 185, 255, 230, 254 },
- { 1, 42, 74, 186, 120, 157, 227, 161, 253, 220, 250 },
- { 1, 18, 30, 97, 92, 136, 163, 118, 244, 184, 244 }
+ { 82, 154, 222 },
+ { 83, 112, 205 },
+ { 81, 31, 164 },
+ { 62, 7, 118 },
+ { 42, 1, 74 },
+ { 18, 1, 30 }
}, { /* Coeff Band 4 */
- { 143, 117, 233, 251, 207, 201, 250, 210, 255, 239, 128 },
- { 99, 104, 214, 249, 200, 199, 251, 211, 255, 238, 255 },
- { 26, 81, 170, 245, 183, 192, 250, 206, 255, 242, 255 },
- { 6, 60, 116, 226, 151, 176, 242, 187, 255, 235, 255 },
- { 1, 38, 65, 178, 114, 153, 224, 157, 254, 224, 255 },
- { 1, 15, 26, 86, 88, 133, 163, 110, 251, 197, 252 }
+ { 52, 179, 233 },
+ { 64, 132, 214 },
+ { 73, 36, 170 },
+ { 59, 8, 116 },
+ { 38, 1, 65 },
+ { 15, 1, 26 }
}, { /* Coeff Band 5 */
- { 155, 74, 238, 252, 215, 206, 252, 223, 255, 255, 128 },
- { 152, 64, 223, 250, 205, 201, 254, 219, 255, 255, 128 },
- { 67, 55, 182, 246, 187, 192, 251, 210, 255, 240, 128 },
- { 27, 44, 127, 227, 155, 176, 244, 186, 255, 240, 255 },
- { 9, 27, 69, 176, 115, 152, 227, 154, 255, 229, 255 },
- { 2, 11, 28, 91, 84, 133, 177, 115, 254, 210, 255 }
+ { 29, 175, 238 },
+ { 26, 169, 223 },
+ { 41, 80, 182 },
+ { 39, 32, 127 },
+ { 26, 10, 69 },
+ { 11, 2, 28 }
}
}, { /* Inter */
{ /* Coeff Band 0 */
- { 207, 112, 234, 244, 192, 193, 246, 194, 255, 237, 255 },
- { 145, 120, 212, 233, 178, 183, 232, 177, 252, 216, 228 },
- { 77, 114, 177, 214, 164, 174, 210, 159, 245, 199, 230 }
+ { 21, 226, 234 },
+ { 52, 182, 212 },
+ { 80, 112, 177 }
}, { /* Coeff Band 1 */
- { 93, 174, 243, 248, 205, 200, 245, 195, 255, 232, 255 },
- { 100, 144, 231, 248, 204, 200, 244, 193, 255, 232, 255 },
- { 28, 101, 186, 247, 194, 199, 244, 194, 255, 232, 255 },
- { 9, 73, 132, 238, 155, 186, 245, 197, 255, 232, 250 },
- { 2, 44, 76, 187, 112, 151, 240, 172, 255, 235, 249 },
- { 1, 19, 33, 98, 92, 138, 176, 113, 252, 208, 249 }
+ { 111, 164, 243 },
+ { 88, 152, 231 },
+ { 90, 43, 186 },
+ { 70, 12, 132 },
+ { 44, 2, 76 },
+ { 19, 1, 33 }
}, { /* Coeff Band 2 */
- { 116, 175, 246, 250, 212, 202, 248, 198, 255, 238, 255 },
- { 78, 142, 231, 250, 208, 203, 249, 200, 255, 241, 255 },
- { 14, 93, 177, 245, 186, 196, 248, 198, 255, 241, 255 },
- { 4, 65, 122, 227, 148, 177, 244, 186, 255, 241, 243 },
- { 1, 38, 69, 180, 111, 152, 235, 162, 255, 237, 247 },
- { 1, 18, 30, 101, 89, 133, 190, 116, 255, 219, 246 }
+ { 96, 185, 246 },
+ { 99, 127, 231 },
+ { 88, 21, 177 },
+ { 64, 5, 122 },
+ { 38, 1, 69 },
+ { 18, 1, 30 }
}, { /* Coeff Band 3 */
- { 138, 183, 249, 253, 220, 209, 252, 210, 255, 251, 128 },
- { 93, 147, 237, 252, 213, 209, 253, 213, 255, 251, 128 },
- { 21, 104, 187, 247, 185, 196, 252, 210, 255, 249, 128 },
- { 6, 73, 131, 225, 147, 174, 248, 190, 255, 248, 128 },
- { 1, 47, 83, 189, 119, 155, 239, 167, 255, 246, 128 },
- { 1, 26, 44, 130, 96, 139, 209, 129, 255, 235, 255 }
+ { 84, 206, 249 },
+ { 94, 147, 237 },
+ { 95, 33, 187 },
+ { 71, 8, 131 },
+ { 47, 1, 83 },
+ { 26, 1, 44 }
}, { /* Coeff Band 4 */
- { 188, 143, 252, 255, 228, 218, 253, 218, 255, 209, 128 },
- { 137, 124, 241, 253, 215, 211, 254, 221, 255, 255, 128 },
- { 32, 89, 188, 248, 186, 198, 254, 216, 255, 253, 128 },
- { 7, 61, 122, 231, 146, 176, 252, 201, 255, 250, 128 },
- { 1, 34, 66, 186, 103, 149, 246, 176, 255, 249, 128 },
- { 1, 18, 34, 115, 91, 134, 217, 124, 255, 233, 255 }
+ { 38, 221, 252 },
+ { 58, 177, 241 },
+ { 78, 46, 188 },
+ { 59, 9, 122 },
+ { 34, 1, 66 },
+ { 18, 1, 34 }
}, { /* Coeff Band 5 */
- { 198, 92, 253, 255, 231, 222, 255, 230, 128, 128, 128 },
- { 189, 79, 244, 254, 220, 217, 255, 237, 255, 255, 128 },
- { 78, 61, 200, 252, 196, 207, 255, 231, 255, 255, 128 },
- { 34, 50, 146, 242, 161, 187, 255, 222, 255, 255, 128 },
- { 11, 38, 93, 215, 122, 159, 253, 202, 255, 255, 128 },
- { 1, 31, 55, 143, 102, 143, 227, 148, 255, 238, 128 }
+ { 21, 216, 253 },
+ { 21, 206, 244 },
+ { 42, 93, 200 },
+ { 43, 41, 146 },
+ { 36, 13, 93 },
+ { 31, 1, 55 }
}
}
}, { /* block Type 1 */
{ /* Intra */
{ /* Coeff Band 0 */
- { 207, 35, 219, 243, 195, 192, 243, 188, 251, 232, 238 },
- { 126, 46, 182, 230, 177, 182, 228, 171, 248, 214, 232 },
- { 51, 47, 125, 196, 147, 166, 206, 151, 245, 199, 229 }
+ { 7, 213, 219 },
+ { 23, 139, 182 },
+ { 38, 60, 125 }
}, { /* Coeff Band 1 */
- { 114, 124, 220, 244, 197, 192, 242, 189, 253, 226, 255 },
- { 142, 116, 213, 243, 194, 191, 241, 188, 252, 226, 255 },
- { 81, 101, 190, 242, 188, 190, 242, 190, 253, 229, 255 },
- { 42, 83, 155, 235, 166, 183, 241, 190, 253, 227, 246 },
- { 16, 62, 104, 205, 133, 161, 238, 176, 254, 227, 250 },
- { 6, 40, 60, 132, 109, 145, 190, 128, 248, 202, 239 }
+ { 69, 156, 220 },
+ { 52, 178, 213 },
+ { 69, 111, 190 },
+ { 69, 58, 155 },
+ { 58, 21, 104 },
+ { 39, 7, 60 }
}, { /* Coeff Band 2 */
- { 139, 149, 228, 248, 205, 198, 244, 196, 255, 223, 255 },
- { 115, 127, 221, 248, 202, 198, 245, 198, 255, 228, 255 },
- { 43, 100, 189, 246, 195, 195, 244, 196, 254, 234, 228 },
- { 13, 77, 141, 238, 168, 187, 243, 191, 255, 232, 255 },
- { 3, 49, 88, 203, 125, 160, 237, 178, 253, 227, 251 },
- { 1, 23, 41, 118, 97, 136, 191, 127, 250, 207, 247 }
+ { 68, 189, 228 },
+ { 70, 158, 221 },
+ { 83, 64, 189 },
+ { 73, 18, 141 },
+ { 48, 4, 88 },
+ { 23, 1, 41 }
}, { /* Coeff Band 3 */
- { 119, 185, 236, 251, 216, 205, 249, 202, 253, 237, 255 },
- { 89, 140, 224, 251, 211, 205, 250, 208, 255, 241, 255 },
- { 34, 105, 189, 248, 195, 197, 250, 208, 255, 245, 255 },
- { 14, 78, 142, 235, 166, 182, 246, 194, 255, 242, 255 },
- { 5, 49, 90, 196, 128, 160, 235, 165, 255, 237, 255 },
- { 1, 22, 41, 114, 97, 139, 180, 124, 252, 201, 249 }
+ { 99, 194, 236 },
+ { 91, 138, 224 },
+ { 91, 53, 189 },
+ { 74, 20, 142 },
+ { 48, 6, 90 },
+ { 22, 1, 41 }
}, { /* Coeff Band 4 */
- { 162, 142, 244, 254, 228, 215, 255, 230, 128, 128, 128 },
- { 129, 120, 231, 253, 216, 210, 255, 228, 255, 255, 128 },
- { 44, 90, 189, 249, 195, 199, 253, 217, 255, 240, 128 },
- { 14, 65, 132, 234, 158, 181, 249, 203, 255, 248, 128 },
- { 3, 38, 72, 188, 112, 154, 239, 171, 255, 243, 128 },
- { 1, 17, 39, 110, 86, 141, 201, 123, 255, 240, 128 }
+ { 52, 203, 244 },
+ { 60, 168, 231 },
+ { 75, 62, 189 },
+ { 61, 18, 132 },
+ { 38, 4, 72 },
+ { 17, 1, 39 }
}, { /* Coeff Band 5 */
- { 167, 96, 247, 255, 230, 218, 249, 231, 255, 255, 128 },
- { 163, 84, 234, 253, 214, 209, 255, 231, 255, 255, 128 },
- { 70, 63, 185, 249, 189, 197, 255, 230, 255, 255, 128 },
- { 30, 44, 132, 238, 157, 180, 251, 210, 255, 220, 128 },
- { 13, 30, 80, 195, 121, 153, 243, 179, 255, 224, 128 },
- { 5, 13, 38, 103, 109, 128, 196, 147, 255, 255, 128 }
+ { 33, 192, 247 },
+ { 31, 185, 234 },
+ { 46, 85, 185 },
+ { 39, 35, 132 },
+ { 28, 15, 80 },
+ { 13, 5, 38 }
}
}, { /* Inter */
{ /* Coeff Band 0 */
- { 242, 90, 246, 244, 200, 192, 242, 189, 255, 234, 255 },
- { 186, 102, 228, 233, 187, 182, 231, 172, 254, 225, 252 },
- { 102, 108, 203, 228, 181, 180, 218, 167, 243, 201, 223 }
+ { 5, 247, 246 },
+ { 28, 209, 228 },
+ { 65, 137, 203 }
}, { /* Coeff Band 1 */
- { 152, 169, 250, 253, 223, 209, 251, 208, 255, 250, 128 },
- { 164, 149, 242, 253, 222, 209, 249, 207, 253, 238, 255 },
- { 63, 108, 204, 252, 215, 211, 251, 211, 255, 242, 128 },
- { 39, 83, 153, 248, 175, 199, 250, 214, 255, 245, 128 },
- { 31, 66, 108, 214, 130, 161, 251, 196, 255, 237, 128 },
- { 27, 65, 71, 150, 112, 149, 213, 133, 255, 230, 255 }
+ { 69, 208, 250 },
+ { 54, 207, 242 },
+ { 81, 92, 204 },
+ { 70, 54, 153 },
+ { 58, 40, 108 },
+ { 58, 35, 71 }
}, { /* Coeff Band 2 */
- { 161, 174, 250, 254, 226, 215, 254, 226, 255, 230, 128 },
- { 133, 150, 239, 254, 222, 213, 254, 225, 255, 255, 128 },
- { 32, 105, 197, 252, 206, 207, 253, 220, 255, 255, 128 },
- { 10, 78, 147, 245, 173, 193, 253, 212, 255, 255, 128 },
- { 2, 49, 99, 221, 133, 164, 250, 198, 255, 252, 128 },
- { 1, 26, 53, 154, 96, 135, 234, 142, 255, 240, 128 }
+ { 65, 215, 250 },
+ { 72, 185, 239 },
+ { 92, 50, 197 },
+ { 75, 14, 147 },
+ { 49, 2, 99 },
+ { 26, 1, 53 }
}, { /* Coeff Band 3 */
- { 160, 187, 251, 255, 234, 223, 255, 233, 128, 128, 128 },
- { 131, 155, 241, 255, 228, 222, 255, 232, 255, 255, 128 },
- { 42, 108, 198, 253, 207, 212, 255, 234, 255, 255, 128 },
- { 18, 81, 151, 246, 176, 194, 254, 222, 255, 255, 128 },
- { 9, 60, 112, 225, 144, 167, 252, 199, 255, 255, 128 },
- { 5, 35, 49, 163, 113, 150, 237, 118, 255, 255, 128 }
+ { 70, 220, 251 },
+ { 76, 186, 241 },
+ { 90, 65, 198 },
+ { 75, 26, 151 },
+ { 58, 12, 112 },
+ { 34, 6, 49 }
}, { /* Coeff Band 4 */
- { 195, 141, 253, 255, 242, 232, 255, 255, 128, 128, 128 },
- { 169, 128, 245, 255, 235, 227, 255, 248, 128, 128, 128 },
- { 62, 91, 204, 255, 216, 220, 255, 233, 128, 128, 128 },
- { 23, 70, 150, 248, 178, 202, 255, 223, 128, 128, 128 },
- { 2, 44, 78, 220, 110, 164, 255, 209, 128, 128, 128 },
- { 1, 1, 128, 255, 255, 128, 128, 128, 128, 128, 128 }
+ { 34, 224, 253 },
+ { 44, 204, 245 },
+ { 69, 85, 204 },
+ { 64, 31, 150 },
+ { 44, 2, 78 },
+ { 1, 1, 128 }
}, { /* Coeff Band 5 */
- { 195, 104, 253, 255, 246, 246, 255, 171, 128, 128, 128 },
- { 197, 92, 248, 255, 239, 228, 255, 239, 128, 128, 128 },
- { 88, 71, 214, 255, 219, 220, 255, 244, 128, 128, 128 },
- { 39, 56, 160, 250, 187, 204, 255, 255, 128, 128, 128 },
- { 18, 28, 90, 217, 81, 137, 255, 128, 128, 128, 128 },
- { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
+ { 25, 216, 253 },
+ { 21, 215, 248 },
+ { 47, 108, 214 },
+ { 47, 48, 160 },
+ { 26, 20, 90 },
+ { 64, 171, 128 }
}
}
}
};
-static const vp9_coeff_probs default_coef_probs_8x8[BLOCK_TYPES] = {
+static const vp9_coeff_probs_model default_coef_probs_8x8[BLOCK_TYPES] = {
{ /* block Type 0 */
{ /* Intra */
{ /* Coeff Band 0 */
- { 196, 40, 199, 180, 158, 161, 172, 135, 226, 183, 140 },
- { 83, 38, 128, 153, 142, 157, 155, 128, 222, 164, 202 },
- { 10, 29, 55, 116, 113, 146, 150, 122, 223, 169, 200 }
+ { 9, 203, 199 },
+ { 26, 92, 128 },
+ { 28, 11, 55 }
}, { /* Coeff Band 1 */
- { 33, 114, 160, 211, 155, 169, 223, 162, 248, 212, 215 },
- { 69, 107, 155, 210, 154, 169, 224, 163, 248, 212, 216 },
- { 30, 91, 138, 207, 150, 168, 223, 162, 248, 212, 216 },
- { 12, 74, 115, 200, 140, 164, 222, 160, 249, 212, 219 },
- { 4, 52, 80, 172, 121, 153, 216, 149, 249, 212, 226 },
- { 1, 27, 40, 105, 101, 141, 157, 120, 231, 177, 210 }
+ { 99, 54, 160 },
+ { 78, 99, 155 },
+ { 80, 44, 138 },
+ { 71, 17, 115 },
+ { 51, 5, 80 },
+ { 27, 1, 40 }
}, { /* Coeff Band 2 */
- { 38, 159, 190, 227, 171, 177, 229, 172, 250, 214, 237 },
- { 34, 130, 182, 229, 173, 180, 231, 174, 249, 215, 234 },
- { 10, 97, 153, 226, 164, 178, 232, 175, 250, 215, 241 },
- { 3, 71, 115, 213, 145, 170, 230, 171, 251, 217, 235 },
- { 1, 41, 68, 172, 114, 152, 219, 154, 250, 212, 235 },
- { 1, 16, 27, 88, 90, 135, 155, 113, 235, 180, 216 }
+ { 135, 81, 190 },
+ { 113, 61, 182 },
+ { 93, 16, 153 },
+ { 70, 4, 115 },
+ { 41, 1, 68 },
+ { 16, 1, 27 }
}, { /* Coeff Band 3 */
- { 41, 184, 214, 238, 187, 186, 235, 180, 252, 217, 236 },
- { 24, 142, 199, 241, 188, 189, 237, 184, 252, 220, 235 },
- { 6, 97, 159, 235, 172, 184, 239, 185, 252, 221, 243 },
- { 1, 63, 110, 214, 144, 170, 234, 174, 253, 223, 243 },
- { 1, 32, 58, 166, 109, 149, 218, 152, 251, 215, 238 },
- { 1, 12, 21, 78, 85, 131, 152, 109, 236, 180, 224 }
+ { 155, 103, 214 },
+ { 129, 48, 199 },
+ { 95, 10, 159 },
+ { 63, 1, 110 },
+ { 32, 1, 58 },
+ { 12, 1, 21 }
}, { /* Coeff Band 4 */
- { 54, 207, 231, 245, 201, 193, 238, 186, 252, 221, 220 },
- { 32, 156, 213, 246, 198, 195, 242, 192, 252, 224, 245 },
- { 7, 98, 164, 240, 177, 187, 243, 193, 252, 227, 244 },
- { 2, 62, 108, 216, 143, 170, 237, 177, 254, 227, 248 },
- { 1, 32, 57, 165, 108, 148, 219, 152, 252, 217, 243 },
- { 1, 13, 22, 79, 87, 132, 153, 109, 240, 182, 232 }
+ { 163, 149, 231 },
+ { 137, 69, 213 },
+ { 95, 11, 164 },
+ { 62, 3, 108 },
+ { 32, 1, 57 },
+ { 13, 1, 22 }
}, { /* Coeff Band 5 */
- { 89, 208, 239, 250, 216, 200, 240, 190, 255, 222, 219 },
- { 53, 155, 223, 250, 209, 202, 245, 199, 253, 225, 246 },
- { 12, 102, 170, 243, 183, 192, 246, 198, 254, 230, 255 },
- { 3, 67, 111, 218, 144, 171, 239, 180, 254, 231, 248 },
- { 1, 38, 60, 164, 108, 148, 221, 152, 253, 220, 246 },
- { 1, 18, 26, 81, 88, 132, 157, 108, 245, 188, 241 }
+ { 136, 189, 239 },
+ { 123, 102, 223 },
+ { 97, 19, 170 },
+ { 66, 4, 111 },
+ { 38, 1, 60 },
+ { 18, 1, 26 }
}
}, { /* Inter */
{ /* Coeff Band 0 */
- { 205, 121, 244, 237, 187, 188, 229, 174, 248, 215, 228 },
- { 140, 120, 211, 219, 174, 177, 207, 158, 241, 195, 214 },
- { 51, 100, 152, 198, 155, 168, 199, 148, 240, 193, 207 }
+ { 24, 226, 244 },
+ { 54, 178, 211 },
+ { 80, 74, 152 }
}, { /* Coeff Band 1 */
- { 66, 196, 236, 247, 202, 197, 243, 193, 254, 228, 246 },
- { 99, 164, 223, 246, 199, 196, 243, 193, 254, 226, 255 },
- { 29, 122, 187, 244, 187, 194, 244, 193, 255, 227, 239 },
- { 14, 95, 145, 234, 156, 181, 244, 194, 254, 229, 246 },
- { 6, 68, 97, 190, 123, 155, 240, 168, 254, 232, 245 },
- { 3, 43, 50, 112, 105, 143, 170, 118, 245, 195, 230 }
+ { 145, 153, 236 },
+ { 101, 163, 223 },
+ { 108, 50, 187 },
+ { 90, 22, 145 },
+ { 66, 8, 97 },
+ { 42, 4, 50 }
}, { /* Coeff Band 2 */
- { 66, 202, 238, 248, 206, 199, 245, 196, 254, 233, 244 },
- { 45, 155, 218, 248, 200, 199, 245, 197, 254, 229, 208 },
- { 6, 96, 163, 242, 178, 191, 245, 196, 254, 233, 228 },
- { 2, 64, 110, 224, 142, 175, 242, 185, 254, 232, 247 },
- { 1, 34, 61, 172, 103, 147, 232, 164, 254, 226, 244 },
- { 1, 13, 24, 82, 85, 133, 165, 105, 248, 199, 242 }
+ { 150, 159, 238 },
+ { 128, 90, 218 },
+ { 94, 9, 163 },
+ { 64, 3, 110 },
+ { 34, 1, 61 },
+ { 13, 1, 24 }
}, { /* Coeff Band 3 */
- { 66, 204, 242, 251, 213, 204, 248, 204, 255, 236, 255 },
- { 38, 158, 222, 251, 206, 205, 249, 206, 255, 238, 255 },
- { 6, 95, 166, 244, 178, 194, 249, 205, 255, 236, 255 },
- { 2, 61, 111, 223, 141, 173, 244, 187, 255, 237, 255 },
- { 1, 31, 59, 171, 104, 149, 230, 158, 255, 230, 252 },
- { 1, 12, 22, 82, 79, 128, 171, 111, 251, 203, 249 }
+ { 151, 162, 242 },
+ { 135, 80, 222 },
+ { 93, 9, 166 },
+ { 61, 3, 111 },
+ { 31, 1, 59 },
+ { 12, 1, 22 }
}, { /* Coeff Band 4 */
- { 63, 214, 245, 252, 219, 208, 249, 206, 255, 241, 128 },
- { 38, 164, 228, 252, 210, 208, 251, 212, 255, 245, 255 },
- { 5, 101, 174, 246, 182, 196, 251, 207, 255, 244, 255 },
- { 1, 64, 116, 224, 142, 174, 246, 190, 255, 241, 228 },
- { 1, 34, 63, 172, 105, 148, 233, 160, 255, 235, 237 },
- { 1, 14, 26, 88, 85, 130, 177, 110, 252, 210, 250 }
+ { 161, 170, 245 },
+ { 140, 84, 228 },
+ { 99, 8, 174 },
+ { 64, 1, 116 },
+ { 34, 1, 63 },
+ { 14, 1, 26 }
}, { /* Coeff Band 5 */
- { 91, 214, 246, 254, 226, 213, 251, 210, 255, 239, 255 },
- { 55, 162, 233, 253, 215, 210, 253, 216, 255, 244, 128 },
- { 10, 104, 179, 247, 184, 196, 252, 212, 255, 247, 255 },
- { 2, 67, 119, 226, 143, 173, 249, 195, 255, 245, 255 },
- { 1, 37, 66, 175, 106, 149, 237, 164, 255, 240, 255 },
- { 1, 16, 30, 96, 87, 132, 188, 113, 255, 222, 255 }
+ { 138, 197, 246 },
+ { 127, 109, 233 },
+ { 100, 16, 179 },
+ { 66, 3, 119 },
+ { 37, 1, 66 },
+ { 16, 1, 30 }
}
}
}, { /* block Type 1 */
{ /* Intra */
{ /* Coeff Band 0 */
- { 211, 32, 212, 235, 185, 184, 223, 167, 239, 210, 182 },
- { 121, 47, 171, 224, 171, 180, 211, 162, 238, 195, 221 },
- { 40, 51, 118, 203, 145, 168, 211, 160, 246, 200, 236 }
+ { 6, 216, 212 },
+ { 25, 134, 171 },
+ { 43, 48, 118 }
}, { /* Coeff Band 1 */
- { 71, 129, 209, 244, 192, 194, 242, 188, 255, 230, 255 },
- { 118, 122, 206, 244, 192, 192, 241, 187, 254, 227, 255 },
- { 53, 104, 184, 241, 186, 190, 241, 184, 254, 232, 255 },
- { 20, 81, 148, 234, 168, 183, 240, 183, 254, 231, 240 },
- { 3, 47, 82, 197, 127, 160, 234, 166, 254, 228, 251 },
- { 1, 18, 28, 96, 88, 134, 174, 116, 247, 194, 247 }
+ { 93, 112, 209 },
+ { 66, 159, 206 },
+ { 82, 78, 184 },
+ { 75, 28, 148 },
+ { 46, 4, 82 },
+ { 18, 1, 28 }
}, { /* Coeff Band 2 */
- { 86, 162, 220, 247, 203, 198, 245, 193, 255, 237, 255 },
- { 84, 134, 216, 247, 201, 197, 244, 192, 255, 233, 255 },
- { 26, 102, 186, 243, 190, 192, 244, 192, 255, 232, 255 },
- { 7, 75, 135, 231, 163, 181, 240, 183, 255, 234, 255 },
- { 1, 46, 79, 193, 121, 157, 233, 168, 255, 225, 242 },
- { 1, 20, 35, 113, 94, 136, 191, 123, 252, 209, 250 }
+ { 108, 148, 220 },
+ { 90, 130, 216 },
+ { 92, 40, 186 },
+ { 73, 10, 135 },
+ { 46, 1, 79 },
+ { 20, 1, 35 }
}, { /* Coeff Band 3 */
- { 89, 191, 232, 250, 211, 203, 248, 202, 255, 230, 128 },
- { 67, 148, 223, 250, 207, 201, 250, 207, 255, 247, 255 },
- { 19, 105, 183, 245, 189, 193, 249, 202, 255, 244, 255 },
- { 5, 72, 127, 228, 156, 177, 245, 186, 255, 238, 255 },
- { 1, 44, 76, 190, 119, 156, 234, 167, 255, 231, 255 },
- { 1, 21, 36, 116, 92, 138, 195, 128, 250, 208, 241 }
+ { 125, 173, 232 },
+ { 109, 117, 223 },
+ { 97, 31, 183 },
+ { 71, 7, 127 },
+ { 44, 1, 76 },
+ { 21, 1, 36 }
}, { /* Coeff Band 4 */
- { 94, 210, 236, 252, 215, 206, 253, 209, 255, 247, 128 },
- { 68, 153, 224, 251, 209, 204, 251, 213, 255, 240, 128 },
- { 14, 103, 178, 246, 188, 195, 251, 209, 255, 239, 128 },
- { 2, 70, 122, 230, 154, 177, 247, 194, 255, 239, 128 },
- { 1, 42, 72, 189, 115, 153, 234, 166, 255, 229, 255 },
- { 1, 19, 34, 104, 98, 143, 180, 124, 252, 200, 255 }
+ { 133, 195, 236 },
+ { 112, 121, 224 },
+ { 97, 23, 178 },
+ { 69, 3, 122 },
+ { 42, 1, 72 },
+ { 19, 1, 34 }
}, { /* Coeff Band 5 */
- { 87, 200, 238, 254, 226, 214, 250, 212, 255, 226, 128 },
- { 55, 151, 225, 253, 217, 212, 253, 217, 255, 233, 128 },
- { 11, 106, 179, 249, 193, 200, 252, 213, 255, 247, 128 },
- { 2, 72, 124, 232, 155, 180, 246, 195, 255, 230, 128 },
- { 1, 42, 70, 182, 114, 153, 232, 163, 255, 236, 255 },
- { 1, 17, 28, 95, 92, 137, 170, 115, 252, 208, 228 }
+ { 132, 180, 238 },
+ { 119, 102, 225 },
+ { 101, 18, 179 },
+ { 71, 3, 124 },
+ { 42, 1, 70 },
+ { 17, 1, 28 }
}
}, { /* Inter */
{ /* Coeff Band 0 */
- { 238, 66, 250, 245, 205, 193, 232, 180, 254, 228, 255 },
- { 178, 84, 226, 237, 192, 185, 230, 176, 253, 217, 251 },
- { 76, 83, 168, 218, 166, 173, 225, 162, 252, 220, 243 }
+ { 5, 242, 250 },
+ { 26, 198, 226 },
+ { 58, 98, 168 }
}, { /* Coeff Band 1 */
- { 137, 176, 246, 252, 218, 207, 251, 208, 255, 238, 128 },
- { 176, 160, 237, 252, 217, 206, 249, 209, 255, 247, 128 },
- { 68, 128, 205, 251, 209, 207, 251, 207, 255, 248, 128 },
- { 40, 105, 167, 246, 172, 192, 252, 215, 255, 247, 128 },
- { 22, 84, 131, 214, 144, 164, 249, 185, 255, 250, 255 },
- { 11, 60, 91, 161, 130, 155, 194, 133, 253, 214, 255 }
+ { 82, 201, 246 },
+ { 50, 219, 237 },
+ { 94, 107, 205 },
+ { 89, 61, 167 },
+ { 77, 31, 131 },
+ { 57, 14, 91 }
}, { /* Coeff Band 2 */
- { 124, 192, 247, 253, 223, 210, 254, 215, 255, 255, 128 },
- { 103, 161, 234, 253, 218, 209, 253, 214, 255, 255, 128 },
- { 19, 108, 190, 250, 202, 202, 251, 213, 255, 241, 128 },
- { 6, 74, 131, 242, 165, 191, 251, 207, 255, 244, 128 },
- { 1, 41, 72, 198, 111, 151, 249, 185, 255, 248, 128 },
- { 1, 14, 24, 82, 90, 140, 185, 96, 254, 224, 255 }
+ { 99, 202, 247 },
+ { 96, 165, 234 },
+ { 100, 31, 190 },
+ { 72, 8, 131 },
+ { 41, 1, 72 },
+ { 14, 1, 24 }
}, { /* Coeff Band 3 */
- { 118, 200, 248, 254, 228, 216, 254, 222, 255, 213, 128 },
- { 91, 166, 235, 254, 220, 212, 254, 223, 255, 233, 128 },
- { 16, 110, 186, 251, 197, 201, 255, 225, 255, 255, 128 },
- { 3, 72, 124, 239, 160, 186, 253, 209, 255, 239, 128 },
- { 1, 39, 66, 198, 106, 151, 248, 191, 255, 247, 128 },
- { 1, 14, 19, 94, 74, 124, 209, 109, 255, 245, 128 }
+ { 108, 204, 248 },
+ { 107, 156, 235 },
+ { 103, 27, 186 },
+ { 71, 4, 124 },
+ { 39, 1, 66 },
+ { 14, 1, 19 }
}, { /* Coeff Band 4 */
- { 112, 213, 248, 255, 231, 218, 255, 234, 255, 255, 128 },
- { 80, 172, 234, 254, 220, 216, 255, 233, 255, 255, 128 },
- { 11, 112, 182, 251, 195, 204, 255, 231, 255, 224, 128 },
- { 2, 73, 126, 241, 159, 186, 254, 219, 255, 255, 128 },
- { 1, 40, 69, 207, 111, 159, 249, 191, 255, 255, 128 },
- { 1, 16, 24, 83, 78, 138, 230, 134, 255, 239, 128 }
+ { 120, 211, 248 },
+ { 118, 149, 234 },
+ { 107, 19, 182 },
+ { 72, 3, 126 },
+ { 40, 1, 69 },
+ { 16, 1, 24 }
}, { /* Coeff Band 5 */
- { 100, 209, 245, 255, 236, 225, 248, 231, 255, 192, 128 },
- { 65, 164, 232, 255, 226, 221, 255, 240, 255, 255, 128 },
- { 11, 117, 186, 253, 203, 209, 255, 240, 255, 255, 128 },
- { 2, 83, 136, 245, 167, 191, 253, 222, 255, 255, 128 },
- { 1, 55, 88, 213, 122, 157, 248, 182, 255, 255, 128 },
- { 1, 10, 38, 58, 85, 43, 198, 107, 255, 255, 128 }
+ { 127, 199, 245 },
+ { 122, 125, 232 },
+ { 112, 20, 186 },
+ { 82, 3, 136 },
+ { 55, 1, 88 },
+ { 10, 1, 38 }
}
}
}
};
-static const vp9_coeff_probs default_coef_probs_16x16[BLOCK_TYPES] = {
+static const vp9_coeff_probs_model default_coef_probs_16x16[BLOCK_TYPES] = {
{ /* block Type 0 */
{ /* Intra */
{ /* Coeff Band 0 */
- { 8, 26, 101, 170, 141, 159, 166, 138, 205, 164, 158 },
- { 2, 25, 67, 119, 124, 152, 121, 123, 189, 145, 175 },
- { 1, 15, 28, 67, 102, 139, 95, 107, 191, 136, 187 }
+ { 25, 9, 101 },
+ { 25, 2, 67 },
+ { 15, 1, 28 }
}, { /* Coeff Band 1 */
- { 22, 73, 118, 160, 137, 157, 175, 132, 242, 184, 229 },
- { 43, 73, 116, 160, 137, 157, 177, 132, 242, 185, 231 },
- { 24, 66, 105, 158, 134, 156, 175, 133, 242, 185, 232 },
- { 9, 54, 85, 150, 126, 153, 175, 132, 242, 185, 231 },
- { 2, 34, 54, 123, 109, 145, 168, 124, 242, 183, 231 },
- { 1, 14, 22, 63, 93, 134, 108, 103, 214, 149, 206 }
+ { 67, 30, 118 },
+ { 61, 56, 116 },
+ { 60, 31, 105 },
+ { 52, 11, 85 },
+ { 34, 2, 54 },
+ { 14, 1, 22 }
}, { /* Coeff Band 2 */
- { 34, 123, 149, 186, 148, 163, 195, 143, 245, 195, 233 },
- { 34, 106, 147, 189, 149, 164, 198, 146, 246, 197, 234 },
- { 10, 81, 123, 186, 143, 162, 200, 147, 246, 198, 235 },
- { 2, 56, 87, 170, 127, 156, 201, 143, 248, 202, 234 },
- { 1, 35, 56, 138, 109, 146, 187, 133, 246, 196, 233 },
- { 1, 17, 27, 80, 93, 135, 136, 109, 229, 168, 215 }
+ { 107, 58, 149 },
+ { 92, 53, 147 },
+ { 78, 14, 123 },
+ { 56, 3, 87 },
+ { 35, 1, 56 },
+ { 17, 1, 27 }
}, { /* Coeff Band 3 */
- { 27, 159, 171, 208, 161, 171, 211, 155, 249, 205, 239 },
- { 17, 119, 162, 213, 160, 172, 218, 160, 250, 210, 238 },
- { 3, 81, 128, 207, 149, 168, 220, 161, 250, 213, 238 },
- { 1, 53, 87, 183, 128, 158, 217, 153, 251, 214, 239 },
- { 1, 31, 52, 143, 106, 145, 199, 137, 249, 205, 235 },
- { 1, 14, 24, 77, 89, 133, 142, 109, 234, 174, 215 }
+ { 142, 61, 171 },
+ { 111, 30, 162 },
+ { 80, 4, 128 },
+ { 53, 1, 87 },
+ { 31, 1, 52 },
+ { 14, 1, 24 }
}, { /* Coeff Band 4 */
- { 24, 189, 200, 224, 177, 178, 221, 164, 250, 212, 234 },
- { 14, 136, 184, 230, 176, 181, 228, 172, 252, 215, 231 },
- { 2, 87, 140, 222, 159, 176, 230, 172, 252, 218, 238 },
- { 1, 54, 90, 193, 130, 161, 223, 160, 252, 217, 241 },
- { 1, 28, 49, 142, 103, 144, 202, 139, 250, 208, 233 },
- { 1, 12, 21, 73, 87, 132, 141, 106, 234, 176, 209 }
+ { 171, 73, 200 },
+ { 129, 28, 184 },
+ { 86, 3, 140 },
+ { 54, 1, 90 },
+ { 28, 1, 49 },
+ { 12, 1, 21 }
}, { /* Coeff Band 5 */
- { 32, 220, 227, 242, 199, 190, 234, 180, 251, 220, 232 },
- { 12, 155, 200, 242, 190, 191, 240, 187, 252, 225, 230 },
- { 1, 90, 144, 231, 164, 180, 240, 184, 253, 229, 239 },
- { 1, 53, 90, 198, 130, 162, 230, 165, 253, 226, 238 },
- { 1, 28, 50, 145, 103, 144, 207, 140, 251, 213, 236 },
- { 1, 13, 22, 74, 88, 132, 142, 107, 233, 176, 216 }
+ { 193, 129, 227 },
+ { 148, 28, 200 },
+ { 90, 2, 144 },
+ { 53, 1, 90 },
+ { 28, 1, 50 },
+ { 13, 1, 22 }
}
}, { /* Inter */
{ /* Coeff Band 0 */
- { 5, 61, 234, 230, 183, 183, 212, 164, 241, 199, 205 },
- { 3, 65, 184, 199, 164, 170, 182, 145, 232, 175, 223 },
- { 1, 56, 104, 154, 137, 158, 156, 131, 221, 165, 210 }
+ { 60, 7, 234 },
+ { 64, 4, 184 },
+ { 56, 1, 104 }
}, { /* Coeff Band 1 */
- { 46, 183, 210, 229, 181, 182, 222, 165, 252, 214, 251 },
- { 122, 166, 202, 228, 179, 181, 223, 164, 252, 217, 250 },
- { 49, 125, 177, 225, 172, 179, 223, 163, 252, 215, 253 },
- { 22, 99, 142, 216, 155, 173, 222, 164, 252, 215, 250 },
- { 8, 69, 95, 180, 127, 156, 220, 153, 252, 214, 250 },
- { 2, 38, 51, 112, 109, 144, 159, 118, 243, 184, 232 }
+ { 150, 111, 210 },
+ { 87, 185, 202 },
+ { 101, 81, 177 },
+ { 90, 34, 142 },
+ { 67, 11, 95 },
+ { 38, 2, 51 }
}, { /* Coeff Band 2 */
- { 56, 196, 218, 236, 187, 185, 231, 172, 254, 223, 239 },
- { 38, 141, 195, 235, 182, 185, 233, 174, 254, 225, 232 },
- { 7, 93, 147, 225, 164, 178, 233, 173, 255, 226, 248 },
- { 2, 63, 101, 201, 137, 165, 227, 162, 254, 225, 248 },
- { 1, 39, 61, 159, 110, 148, 213, 146, 254, 218, 247 },
- { 1, 20, 33, 98, 95, 136, 166, 115, 247, 192, 231 }
+ { 153, 139, 218 },
+ { 120, 72, 195 },
+ { 90, 11, 147 },
+ { 63, 3, 101 },
+ { 39, 1, 61 },
+ { 20, 1, 33 }
}, { /* Coeff Band 3 */
- { 44, 206, 223, 240, 193, 189, 235, 177, 255, 231, 224 },
- { 27, 147, 200, 240, 188, 189, 238, 181, 255, 229, 239 },
- { 4, 93, 147, 230, 165, 180, 238, 180, 255, 231, 237 },
- { 1, 58, 95, 201, 134, 164, 229, 164, 255, 228, 254 },
- { 1, 32, 52, 152, 105, 146, 212, 142, 254, 221, 255 },
- { 1, 14, 23, 81, 87, 133, 156, 109, 248, 191, 236 }
+ { 171, 132, 223 },
+ { 131, 56, 200 },
+ { 92, 6, 147 },
+ { 58, 1, 95 },
+ { 32, 1, 52 },
+ { 14, 1, 23 }
}, { /* Coeff Band 4 */
- { 39, 216, 227, 244, 200, 194, 237, 179, 255, 231, 255 },
- { 22, 152, 204, 243, 192, 193, 240, 186, 255, 231, 240 },
- { 2, 92, 148, 232, 167, 183, 239, 182, 255, 232, 255 },
- { 1, 55, 91, 200, 132, 164, 229, 164, 255, 230, 255 },
- { 1, 28, 47, 144, 99, 142, 211, 141, 255, 222, 251 },
- { 1, 13, 21, 75, 86, 131, 152, 103, 249, 193, 242 }
+ { 183, 137, 227 },
+ { 139, 48, 204 },
+ { 91, 3, 148 },
+ { 55, 1, 91 },
+ { 28, 1, 47 },
+ { 13, 1, 21 }
}, { /* Coeff Band 5 */
- { 34, 228, 234, 249, 213, 201, 246, 194, 255, 239, 255 },
- { 13, 161, 208, 247, 198, 197, 248, 197, 255, 243, 255 },
- { 1, 95, 148, 234, 166, 183, 246, 190, 255, 243, 236 },
- { 1, 55, 90, 199, 128, 161, 237, 168, 255, 239, 255 },
- { 1, 30, 51, 147, 102, 144, 218, 142, 255, 232, 254 },
- { 1, 16, 25, 86, 88, 131, 168, 109, 252, 207, 245 }
+ { 198, 149, 234 },
+ { 153, 32, 208 },
+ { 95, 2, 148 },
+ { 55, 1, 90 },
+ { 30, 1, 51 },
+ { 16, 1, 25 }
}
}
}, { /* block Type 1 */
{ /* Intra */
{ /* Coeff Band 0 */
- { 204, 33, 217, 233, 185, 184, 199, 165, 204, 163, 162 },
- { 93, 48, 151, 209, 157, 171, 193, 161, 203, 167, 189 },
- { 18, 43, 86, 173, 126, 156, 203, 149, 231, 193, 200 }
+ { 7, 209, 217 },
+ { 31, 106, 151 },
+ { 40, 21, 86 }
}, { /* Coeff Band 1 */
- { 43, 121, 184, 233, 173, 182, 235, 187, 248, 211, 237 },
- { 93, 117, 177, 232, 170, 180, 235, 182, 246, 204, 224 },
- { 33, 101, 158, 229, 165, 179, 235, 182, 245, 207, 236 },
- { 11, 81, 129, 221, 153, 173, 233, 179, 246, 203, 229 },
- { 2, 51, 82, 188, 124, 158, 224, 162, 248, 206, 228 },
- { 1, 18, 29, 88, 93, 137, 141, 116, 222, 161, 217 }
+ { 101, 71, 184 },
+ { 74, 131, 177 },
+ { 88, 50, 158 },
+ { 78, 16, 129 },
+ { 51, 2, 82 },
+ { 18, 1, 29 }
}, { /* Coeff Band 2 */
- { 63, 154, 199, 239, 184, 187, 236, 187, 248, 209, 221 },
- { 53, 128, 191, 239, 182, 188, 236, 188, 251, 209, 255 },
- { 14, 99, 160, 235, 172, 184, 235, 187, 249, 207, 240 },
- { 4, 75, 122, 219, 150, 173, 226, 177, 250, 204, 240 },
- { 1, 47, 77, 176, 121, 154, 207, 153, 245, 197, 237 },
- { 1, 18, 30, 84, 95, 136, 138, 112, 229, 167, 228 }
+ { 116, 115, 199 },
+ { 102, 88, 191 },
+ { 94, 22, 160 },
+ { 74, 6, 122 },
+ { 47, 1, 77 },
+ { 18, 1, 30 }
}, { /* Coeff Band 3 */
- { 48, 193, 210, 245, 194, 194, 241, 196, 252, 213, 255 },
- { 26, 145, 201, 245, 194, 196, 240, 195, 251, 215, 240 },
- { 6, 104, 165, 241, 179, 190, 239, 191, 253, 222, 255 },
- { 1, 73, 120, 218, 151, 174, 227, 172, 251, 219, 248 },
- { 1, 42, 69, 167, 118, 153, 205, 146, 251, 206, 245 },
- { 1, 16, 27, 84, 89, 133, 148, 112, 240, 179, 238 }
+ { 157, 124, 210 },
+ { 130, 53, 201 },
+ { 102, 10, 165 },
+ { 73, 1, 120 },
+ { 42, 1, 69 },
+ { 16, 1, 27 }
}, { /* Coeff Band 4 */
- { 47, 213, 225, 248, 203, 199, 240, 194, 254, 211, 255 },
- { 32, 153, 212, 248, 201, 199, 241, 196, 251, 226, 255 },
- { 6, 102, 168, 240, 181, 190, 240, 187, 251, 225, 238 },
- { 1, 66, 111, 211, 146, 169, 229, 167, 255, 224, 244 },
- { 1, 36, 60, 157, 110, 148, 209, 143, 252, 215, 255 },
- { 1, 16, 27, 83, 90, 133, 152, 111, 244, 184, 250 }
+ { 174, 147, 225 },
+ { 134, 67, 212 },
+ { 100, 10, 168 },
+ { 66, 1, 111 },
+ { 36, 1, 60 },
+ { 16, 1, 27 }
}, { /* Coeff Band 5 */
- { 46, 225, 232, 252, 219, 208, 247, 204, 254, 233, 255 },
- { 24, 162, 214, 250, 208, 204, 247, 201, 254, 236, 255 },
- { 3, 106, 165, 242, 182, 191, 245, 196, 255, 231, 255 },
- { 1, 66, 108, 213, 142, 169, 235, 175, 255, 226, 247 },
- { 1, 35, 59, 158, 108, 147, 216, 146, 254, 220, 255 },
- { 1, 16, 27, 85, 90, 131, 159, 110, 248, 191, 252 }
+ { 185, 165, 232 },
+ { 147, 56, 214 },
+ { 105, 5, 165 },
+ { 66, 1, 108 },
+ { 35, 1, 59 },
+ { 16, 1, 27 }
}
}, { /* Inter */
{ /* Coeff Band 0 */
- { 229, 28, 245, 227, 195, 182, 200, 145, 253, 186, 255 },
- { 151, 44, 210, 214, 180, 175, 193, 146, 247, 185, 254 },
- { 55, 48, 131, 183, 148, 163, 194, 138, 249, 201, 246 }
+ { 3, 232, 245 },
+ { 18, 162, 210 },
+ { 38, 64, 131 }
}, { /* Coeff Band 1 */
- { 126, 165, 239, 250, 206, 204, 248, 193, 255, 255, 128 },
- { 199, 158, 231, 248, 206, 198, 247, 200, 243, 255, 255 },
- { 102, 136, 209, 248, 203, 197, 247, 201, 255, 244, 128 },
- { 64, 116, 181, 245, 185, 196, 248, 201, 255, 233, 128 },
- { 44, 98, 151, 233, 162, 179, 248, 195, 255, 242, 128 },
- { 44, 81, 119, 204, 140, 165, 222, 163, 252, 217, 255 }
+ { 84, 187, 239 },
+ { 35, 231, 231 },
+ { 82, 150, 209 },
+ { 87, 97, 181 },
+ { 81, 64, 151 },
+ { 67, 60, 119 }
}, { /* Coeff Band 2 */
- { 108, 185, 239, 252, 216, 209, 248, 205, 255, 230, 128 },
- { 91, 155, 224, 252, 211, 205, 251, 211, 255, 230, 128 },
- { 20, 116, 185, 248, 194, 196, 252, 206, 255, 255, 128 },
- { 8, 86, 141, 239, 168, 185, 248, 196, 255, 247, 128 },
- { 3, 50, 92, 206, 125, 164, 242, 176, 255, 246, 128 },
- { 1, 21, 40, 131, 85, 141, 200, 131, 247, 236, 255 }
+ { 107, 185, 239 },
+ { 100, 149, 224 },
+ { 107, 34, 185 },
+ { 83, 12, 141 },
+ { 49, 4, 92 },
+ { 21, 1, 40 }
}, { /* Coeff Band 3 */
- { 94, 198, 243, 254, 226, 215, 254, 220, 255, 255, 128 },
- { 67, 164, 228, 253, 217, 208, 250, 216, 255, 213, 128 },
- { 14, 120, 185, 250, 196, 205, 248, 205, 255, 255, 128 },
- { 4, 83, 134, 238, 161, 181, 250, 202, 255, 233, 128 },
- { 1, 48, 82, 196, 119, 157, 248, 178, 255, 255, 128 },
- { 1, 26, 38, 96, 84, 132, 221, 110, 255, 209, 128 }
+ { 125, 184, 243 },
+ { 121, 127, 228 },
+ { 113, 25, 185 },
+ { 82, 6, 134 },
+ { 48, 1, 82 },
+ { 26, 1, 38 }
}, { /* Coeff Band 4 */
- { 82, 210, 245, 255, 230, 215, 246, 221, 255, 255, 128 },
- { 55, 170, 231, 254, 222, 213, 255, 220, 255, 255, 128 },
- { 8, 118, 184, 251, 200, 207, 255, 219, 255, 255, 128 },
- { 2, 78, 126, 239, 156, 185, 251, 216, 255, 255, 128 },
- { 1, 43, 68, 189, 108, 151, 247, 187, 255, 228, 128 },
- { 1, 34, 40, 121, 114, 102, 205, 96, 255, 255, 128 }
+ { 143, 185, 245 },
+ { 133, 115, 231 },
+ { 114, 14, 184 },
+ { 77, 3, 126 },
+ { 43, 1, 68 },
+ { 34, 1, 40 }
}, { /* Coeff Band 5 */
- { 65, 228, 241, 255, 231, 214, 253, 222, 255, 255, 128 },
- { 33, 173, 226, 254, 222, 216, 255, 231, 255, 255, 128 },
- { 5, 120, 180, 251, 197, 205, 251, 226, 255, 233, 128 },
- { 1, 81, 130, 240, 159, 187, 251, 206, 255, 205, 128 },
- { 1, 51, 78, 198, 119, 168, 238, 181, 255, 171, 128 },
- { 1, 18, 49, 183, 119, 160, 255, 171, 128, 128, 128 }
+ { 170, 194, 241 },
+ { 151, 80, 226 },
+ { 118, 9, 180 },
+ { 81, 1, 130 },
+ { 51, 1, 78 },
+ { 18, 1, 49 }
}
}
}
};
-static const vp9_coeff_probs default_coef_probs_32x32[BLOCK_TYPES] = {
+static const vp9_coeff_probs_model default_coef_probs_32x32[BLOCK_TYPES] = {
{ /* block Type 0 */
{ /* Intra */
{ /* Coeff Band 0 */
- { 37, 34, 137, 205, 154, 170, 151, 159, 109, 172, 44 },
- { 3, 26, 60, 113, 123, 154, 100, 124, 152, 131, 144 },
- { 1, 13, 23, 54, 102, 139, 71, 106, 146, 123, 148 }
+ { 29, 42, 137 },
+ { 26, 3, 60 },
+ { 13, 1, 23 }
}, { /* Coeff Band 1 */
- { 26, 77, 122, 152, 144, 160, 143, 129, 216, 158, 201 },
- { 43, 76, 123, 152, 142, 159, 145, 129, 218, 160, 204 },
- { 25, 67, 112, 150, 141, 159, 144, 128, 218, 159, 204 },
- { 9, 54, 90, 143, 134, 156, 144, 127, 218, 159, 204 },
- { 2, 32, 52, 116, 114, 148, 138, 123, 217, 158, 207 },
- { 1, 10, 15, 44, 91, 133, 75, 99, 172, 128, 169 }
+ { 69, 36, 122 },
+ { 63, 57, 123 },
+ { 60, 33, 112 },
+ { 52, 11, 90 },
+ { 32, 2, 52 },
+ { 10, 1, 15 }
}, { /* Coeff Band 2 */
- { 32, 122, 143, 163, 145, 161, 162, 131, 226, 171, 206 },
- { 46, 105, 143, 168, 148, 161, 165, 133, 228, 174, 204 },
- { 17, 79, 116, 164, 142, 161, 166, 134, 229, 174, 206 },
- { 4, 53, 78, 143, 125, 153, 163, 129, 232, 175, 213 },
- { 1, 29, 44, 105, 105, 142, 147, 120, 228, 168, 211 },
- { 1, 12, 18, 52, 91, 133, 92, 100, 193, 140, 183 }
+ { 107, 55, 143 },
+ { 86, 69, 143 },
+ { 74, 24, 116 },
+ { 52, 5, 78 },
+ { 29, 1, 44 },
+ { 12, 1, 18 }
}, { /* Coeff Band 3 */
- { 33, 157, 160, 182, 149, 163, 185, 141, 236, 185, 218 },
- { 20, 116, 152, 188, 152, 165, 191, 144, 238, 188, 217 },
- { 4, 74, 114, 180, 141, 162, 192, 143, 240, 191, 219 },
- { 1, 44, 69, 148, 119, 151, 183, 134, 243, 192, 227 },
- { 1, 25, 40, 110, 101, 141, 162, 121, 238, 181, 223 },
- { 1, 12, 18, 56, 89, 132, 103, 101, 206, 148, 196 }
+ { 137, 71, 160 },
+ { 107, 34, 152 },
+ { 73, 6, 114 },
+ { 44, 1, 69 },
+ { 25, 1, 40 },
+ { 12, 1, 18 }
}, { /* Coeff Band 4 */
- { 25, 183, 174, 207, 159, 171, 205, 156, 243, 194, 228 },
- { 13, 124, 159, 209, 157, 171, 213, 160, 243, 200, 228 },
- { 2, 75, 117, 199, 143, 166, 215, 158, 246, 205, 230 },
- { 1, 45, 73, 165, 119, 153, 204, 144, 248, 205, 231 },
- { 1, 26, 43, 120, 101, 141, 178, 127, 242, 192, 226 },
- { 1, 12, 19, 59, 89, 132, 112, 102, 215, 154, 201 }
+ { 165, 70, 174 },
+ { 118, 24, 159 },
+ { 74, 3, 117 },
+ { 45, 1, 73 },
+ { 26, 1, 43 },
+ { 12, 1, 19 }
}, { /* Coeff Band 5 */
- { 13, 232, 223, 239, 196, 188, 225, 172, 248, 209, 226 },
- { 4, 155, 187, 237, 184, 187, 233, 180, 250, 216, 232 },
- { 1, 86, 131, 222, 156, 175, 233, 176, 251, 218, 237 },
- { 1, 49, 79, 181, 123, 157, 218, 155, 251, 214, 237 },
- { 1, 26, 43, 125, 100, 141, 188, 130, 246, 199, 231 },
- { 1, 12, 20, 62, 88, 131, 119, 102, 222, 161, 209 }
+ { 220, 93, 223 },
+ { 153, 10, 187 },
+ { 86, 2, 131 },
+ { 49, 1, 79 },
+ { 26, 1, 43 },
+ { 12, 1, 20 }
}
}, { /* Inter */
{ /* Coeff Band 0 */
- { 51, 37, 227, 237, 205, 184, 200, 162, 231, 187, 207 },
- { 9, 36, 172, 204, 176, 173, 171, 145, 217, 167, 197 },
- { 21, 26, 112, 162, 145, 162, 155, 133, 215, 165, 191 }
+ { 30, 58, 227 },
+ { 35, 10, 172 },
+ { 24, 23, 112 }
}, { /* Coeff Band 1 */
- { 79, 169, 219, 223, 176, 177, 222, 161, 248, 213, 244 },
- { 177, 166, 216, 222, 175, 178, 222, 161, 246, 212, 226 },
- { 119, 141, 196, 222, 174, 176, 220, 163, 250, 212, 236 },
- { 63, 117, 165, 217, 163, 175, 218, 161, 248, 209, 231 },
- { 30, 87, 117, 192, 138, 162, 216, 157, 247, 211, 224 },
- { 14, 56, 60, 119, 111, 146, 156, 123, 227, 171, 220 }
+ { 117, 145, 219 },
+ { 51, 221, 216 },
+ { 75, 169, 196 },
+ { 88, 96, 165 },
+ { 77, 43, 117 },
+ { 53, 18, 60 }
}, { /* Coeff Band 2 */
- { 88, 195, 225, 229, 181, 181, 229, 171, 252, 212, 221 },
- { 66, 145, 202, 229, 177, 180, 230, 172, 253, 220, 255 },
- { 12, 97, 152, 221, 162, 174, 230, 169, 253, 218, 249 },
- { 3, 66, 103, 198, 138, 165, 223, 159, 253, 219, 251 },
- { 1, 38, 61, 158, 110, 148, 209, 146, 252, 212, 238 },
- { 1, 19, 30, 94, 94, 136, 160, 114, 244, 185, 236 }
+ { 128, 176, 225 },
+ { 108, 114, 202 },
+ { 92, 19, 152 },
+ { 65, 4, 103 },
+ { 38, 1, 61 },
+ { 19, 1, 30 }
}, { /* Coeff Band 3 */
- { 79, 211, 228, 235, 186, 184, 233, 176, 255, 225, 255 },
- { 50, 151, 205, 235, 182, 185, 237, 177, 254, 223, 255 },
- { 7, 95, 149, 225, 162, 176, 236, 177, 254, 229, 219 },
- { 1, 62, 98, 198, 134, 164, 228, 162, 254, 224, 238 },
- { 1, 35, 57, 156, 108, 148, 211, 143, 253, 215, 238 },
- { 1, 17, 26, 87, 89, 135, 161, 113, 246, 189, 237 }
+ { 146, 184, 228 },
+ { 122, 95, 205 },
+ { 92, 11, 149 },
+ { 62, 1, 98 },
+ { 35, 1, 57 },
+ { 17, 1, 26 }
}, { /* Coeff Band 4 */
- { 68, 225, 230, 239, 190, 187, 238, 180, 252, 234, 255 },
- { 39, 156, 206, 239, 185, 187, 241, 187, 254, 231, 255 },
- { 4, 94, 147, 229, 163, 178, 242, 183, 255, 236, 224 },
- { 1, 58, 94, 200, 132, 163, 232, 166, 254, 230, 255 },
- { 1, 32, 52, 153, 104, 146, 214, 144, 253, 222, 236 },
- { 1, 15, 24, 84, 89, 131, 159, 109, 247, 192, 240 }
+ { 165, 192, 230 },
+ { 132, 81, 206 },
+ { 93, 6, 147 },
+ { 58, 1, 94 },
+ { 32, 1, 52 },
+ { 15, 1, 24 }
}, { /* Coeff Band 5 */
- { 45, 248, 234, 248, 208, 198, 244, 193, 255, 233, 255 },
- { 19, 169, 204, 246, 195, 195, 246, 199, 255, 233, 255 },
- { 2, 98, 145, 235, 166, 183, 245, 192, 255, 235, 255 },
- { 1, 59, 92, 205, 131, 164, 236, 172, 254, 231, 250 },
- { 1, 33, 52, 152, 103, 145, 216, 144, 253, 221, 240 },
- { 1, 15, 24, 83, 87, 133, 156, 110, 246, 191, 242 }
+ { 204, 223, 234 },
+ { 156, 49, 204 },
+ { 97, 3, 145 },
+ { 59, 1, 92 },
+ { 33, 1, 52 },
+ { 15, 1, 24 }
}
}
}, { /* block Type 1 */
{ /* Intra */
{ /* Coeff Band 0 */
- { 179, 23, 200, 222, 180, 182, 150, 152, 148, 135, 125 },
- { 60, 33, 113, 185, 143, 166, 168, 144, 189, 168, 152 },
- { 8, 31, 59, 137, 114, 150, 163, 132, 206, 171, 169 }
+ { 7, 184, 200 },
+ { 25, 67, 113 },
+ { 30, 9, 59 }
}, { /* Coeff Band 1 */
- { 27, 103, 158, 215, 157, 174, 209, 165, 239, 191, 233 },
- { 90, 101, 159, 213, 156, 173, 212, 164, 230, 185, 237 },
- { 39, 91, 146, 212, 155, 169, 212, 165, 232, 186, 207 },
- { 16, 75, 120, 203, 144, 169, 210, 161, 233, 189, 227 },
- { 3, 48, 76, 167, 120, 154, 199, 146, 236, 190, 218 },
- { 1, 18, 26, 72, 95, 137, 113, 109, 197, 146, 186 }
+ { 92, 42, 158 },
+ { 65, 121, 159 },
+ { 77, 56, 146 },
+ { 70, 22, 120 },
+ { 47, 4, 76 },
+ { 18, 1, 26 }
}, { /* Coeff Band 2 */
- { 45, 137, 177, 218, 166, 174, 206, 163, 234, 184, 214 },
- { 47, 117, 167, 218, 166, 176, 206, 164, 234, 182, 229 },
- { 16, 90, 136, 211, 153, 172, 205, 162, 236, 192, 231 },
- { 6, 65, 100, 188, 136, 162, 193, 155, 237, 177, 228 },
- { 1, 37, 58, 137, 113, 150, 166, 134, 229, 167, 234 },
- { 1, 13, 19, 55, 90, 132, 93, 103, 196, 137, 202 }
+ { 113, 81, 177 },
+ { 96, 75, 167 },
+ { 84, 24, 136 },
+ { 63, 8, 100 },
+ { 37, 1, 58 },
+ { 13, 1, 19 }
}, { /* Coeff Band 3 */
- { 36, 171, 194, 227, 177, 179, 208, 165, 244, 196, 245 },
- { 19, 129, 178, 227, 175, 184, 214, 165, 246, 188, 255 },
- { 5, 90, 139, 217, 158, 174, 213, 166, 246, 198, 255 },
- { 1, 59, 93, 182, 134, 162, 193, 150, 242, 188, 241 },
- { 1, 31, 49, 122, 108, 145, 160, 127, 235, 172, 229 },
- { 1, 10, 18, 54, 89, 132, 101, 99, 213, 144, 217 }
+ { 147, 85, 194 },
+ { 119, 36, 178 },
+ { 88, 8, 139 },
+ { 59, 1, 93 },
+ { 31, 1, 49 },
+ { 10, 1, 18 }
}, { /* Coeff Band 4 */
- { 37, 197, 210, 233, 187, 186, 216, 172, 250, 202, 255 },
- { 20, 142, 191, 234, 183, 186, 219, 170, 249, 207, 246 },
- { 3, 93, 144, 222, 163, 176, 219, 170, 249, 204, 224 },
- { 1, 56, 88, 179, 130, 159, 199, 148, 246, 197, 243 },
- { 1, 29, 47, 123, 104, 144, 172, 127, 244, 185, 234 },
- { 1, 14, 22, 66, 91, 130, 120, 103, 225, 158, 221 }
+ { 169, 108, 210 },
+ { 131, 41, 191 },
+ { 92, 5, 144 },
+ { 56, 1, 88 },
+ { 29, 1, 47 },
+ { 14, 1, 22 }
}, { /* Coeff Band 5 */
- { 19, 227, 223, 245, 203, 194, 238, 187, 251, 225, 217 },
- { 6, 152, 192, 242, 189, 190, 241, 190, 253, 225, 255 },
- { 1, 89, 138, 228, 161, 177, 239, 181, 254, 224, 248 },
- { 1, 52, 84, 188, 127, 157, 224, 159, 253, 222, 247 },
- { 1, 29, 47, 132, 102, 140, 196, 132, 251, 208, 244 },
- { 1, 14, 23, 71, 90, 133, 134, 103, 239, 174, 233 }
+ { 210, 106, 223 },
+ { 148, 14, 192 },
+ { 89, 2, 138 },
+ { 52, 1, 84 },
+ { 29, 1, 47 },
+ { 14, 1, 23 }
}
}, { /* Inter */
{ /* Coeff Band 0 */
- { 205, 14, 245, 235, 216, 189, 190, 146, 249, 201, 255 },
- { 97, 19, 213, 210, 194, 174, 176, 139, 241, 183, 250 },
- { 31, 20, 144, 183, 160, 167, 171, 132, 240, 184, 253 }
+ { 3, 207, 245 },
+ { 12, 102, 213 },
+ { 18, 33, 144 }
}, { /* Coeff Band 1 */
- { 137, 182, 245, 254, 221, 216, 255, 160, 128, 128, 128 },
- { 231, 185, 242, 251, 218, 205, 255, 233, 128, 128, 128 },
- { 170, 175, 229, 252, 205, 209, 255, 211, 128, 128, 128 },
- { 107, 157, 213, 250, 199, 205, 251, 207, 255, 255, 128 },
- { 77, 126, 183, 243, 182, 183, 252, 206, 255, 255, 128 },
- { 69, 96, 149, 229, 157, 170, 247, 169, 255, 255, 128 }
+ { 85, 205, 245 },
+ { 18, 249, 242 },
+ { 59, 221, 229 },
+ { 91, 166, 213 },
+ { 88, 117, 183 },
+ { 70, 95, 149 }
}, { /* Coeff Band 2 */
- { 107, 196, 241, 252, 211, 208, 255, 210, 128, 128, 128 },
- { 92, 162, 221, 249, 203, 195, 255, 199, 128, 128, 128 },
- { 20, 108, 181, 244, 190, 191, 250, 200, 255, 255, 128 },
- { 7, 80, 132, 241, 172, 197, 253, 191, 255, 255, 128 },
- { 2, 43, 75, 219, 122, 150, 255, 203, 128, 128, 128 },
- { 1, 15, 48, 98, 51, 192, 255, 160, 128, 128, 128 }
+ { 114, 193, 241 },
+ { 104, 155, 221 },
+ { 100, 33, 181 },
+ { 78, 10, 132 },
+ { 43, 2, 75 },
+ { 15, 1, 48 }
}, { /* Coeff Band 3 */
- { 107, 202, 244, 254, 226, 215, 255, 192, 128, 128, 128 },
- { 77, 167, 224, 252, 215, 212, 255, 235, 128, 128, 128 },
- { 14, 117, 179, 249, 191, 196, 255, 212, 128, 128, 128 },
- { 3, 84, 134, 237, 160, 194, 248, 216, 255, 255, 128 },
- { 1, 57, 84, 216, 145, 136, 255, 161, 128, 128, 128 },
- { 1, 1, 1, 255, 128, 255, 128, 128, 128, 128, 128 }
+ { 118, 198, 244 },
+ { 117, 142, 224 },
+ { 111, 25, 179 },
+ { 83, 4, 134 },
+ { 57, 1, 84 },
+ { 1, 1, 1 }
}, { /* Coeff Band 4 */
- { 88, 219, 248, 255, 239, 225, 255, 255, 128, 128, 128 },
- { 61, 178, 234, 255, 227, 227, 255, 217, 128, 128, 128 },
- { 6, 127, 188, 252, 201, 211, 255, 244, 128, 128, 128 },
- { 1, 83, 130, 248, 173, 197, 255, 175, 128, 128, 128 },
- { 1, 61, 66, 211, 121, 188, 255, 213, 128, 128, 128 },
- { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }
+ { 144, 201, 248 },
+ { 136, 130, 234 },
+ { 124, 12, 188 },
+ { 83, 1, 130 },
+ { 61, 1, 66 },
+ { 64, 171, 128 }
}, { /* Coeff Band 5 */
- { 73, 243, 250, 255, 244, 220, 255, 205, 128, 128, 128 },
- { 42, 197, 242, 255, 237, 227, 242, 166, 255, 255, 128 },
- { 10, 137, 197, 252, 214, 199, 255, 238, 128, 128, 128 },
- { 2, 85, 134, 242, 163, 185, 224, 238, 255, 255, 128 },
- { 1, 70, 69, 199, 110, 64, 255, 213, 128, 128, 128 },
- { 1, 1, 1, 1, 128, 128, 255, 1, 128, 128, 128 }
+ { 174, 227, 250 },
+ { 165, 118, 242 },
+ { 132, 21, 197 },
+ { 84, 3, 134 },
+ { 70, 1, 69 },
+ { 1, 1, 1 }
}
}
}
};
-
-#if CONFIG_CODE_NONZEROCOUNT
-
-// TODO(debargha): Remove the macro and count tables after experimentation
-#define NZC_DEFAULT_COUNTS /* Uncomment to use counts as defaults */
-
-#ifdef NZC_DEFAULT_COUNTS
-static const unsigned int default_nzc_counts_4x4[MAX_NZC_CONTEXTS]
- [REF_TYPES]
- [BLOCK_TYPES]
- [NZC4X4_TOKENS] = {
- {
- {
- { 967652, 29023, 15039, 6952, 1568, 116 },
- { 289116, 22938, 4522, 1935, 520, 47 }
- }, {
- { 967652, 29023, 15039, 6952, 1568, 116 },
- { 689116, 22938, 4522, 1935, 520, 47 }
- },
- }, {
- {
- { 124684, 37167, 15270, 8483, 1777, 102 },
- { 10405, 12395, 3401, 3574, 2461, 771 }
- }, {
- { 124684, 37167, 15270, 8483, 1777, 102 },
- { 20405, 12395, 3401, 3574, 2461, 771 }
+#else
+static const vp9_coeff_probs_model default_coef_probs_4x4[BLOCK_TYPES] = {
+ { /* block Type 0 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 195, 29, 183 },
+ { 84, 49, 136 },
+ { 8, 42, 71 }
+ }, { /* Coeff Band 1 */
+ { 31, 107, 169 },
+ { 35, 99, 159 },
+ { 17, 82, 140 },
+ { 8, 66, 114 },
+ { 2, 44, 76 },
+ { 1, 19, 32 }
+ }, { /* Coeff Band 2 */
+ { 40, 132, 201 },
+ { 29, 114, 187 },
+ { 13, 91, 157 },
+ { 7, 75, 127 },
+ { 3, 58, 95 },
+ { 1, 28, 47 }
+ }, { /* Coeff Band 3 */
+ { 69, 142, 221 },
+ { 42, 122, 201 },
+ { 15, 91, 159 },
+ { 6, 67, 121 },
+ { 1, 42, 77 },
+ { 1, 17, 31 }
+ }, { /* Coeff Band 4 */
+ { 102, 148, 228 },
+ { 67, 117, 204 },
+ { 17, 82, 154 },
+ { 6, 59, 114 },
+ { 2, 39, 75 },
+ { 1, 15, 29 }
+ }, { /* Coeff Band 5 */
+ { 156, 57, 233 },
+ { 119, 57, 212 },
+ { 58, 48, 163 },
+ { 29, 40, 124 },
+ { 12, 30, 81 },
+ { 3, 12, 31 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 191, 107, 226 },
+ { 124, 117, 204 },
+ { 25, 99, 155 }
+ }, { /* Coeff Band 1 */
+ { 29, 148, 210 },
+ { 37, 126, 194 },
+ { 8, 93, 157 },
+ { 2, 68, 118 },
+ { 1, 39, 69 },
+ { 1, 17, 33 }
+ }, { /* Coeff Band 2 */
+ { 41, 151, 213 },
+ { 27, 123, 193 },
+ { 3, 82, 144 },
+ { 1, 58, 105 },
+ { 1, 32, 60 },
+ { 1, 13, 26 }
+ }, { /* Coeff Band 3 */
+ { 59, 159, 220 },
+ { 23, 126, 198 },
+ { 4, 88, 151 },
+ { 1, 66, 114 },
+ { 1, 38, 71 },
+ { 1, 18, 34 }
+ }, { /* Coeff Band 4 */
+ { 114, 136, 232 },
+ { 51, 114, 207 },
+ { 11, 83, 155 },
+ { 3, 56, 105 },
+ { 1, 33, 65 },
+ { 1, 17, 34 }
+ }, { /* Coeff Band 5 */
+ { 149, 65, 234 },
+ { 121, 57, 215 },
+ { 61, 49, 166 },
+ { 28, 36, 114 },
+ { 12, 25, 76 },
+ { 3, 16, 42 }
+ }
}
- }, {
- {
- { 4100, 22976, 15627, 16137, 7982, 1793 },
- { 4249, 3084, 2131, 4081, 6439, 1653 }
- }, {
- { 21100, 22976, 15627, 16137, 7982, 1793 },
- { 4249, 3084, 2131, 4081, 2439, 1653 }
+ }, { /* block Type 1 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 214, 49, 220 },
+ { 132, 63, 188 },
+ { 42, 65, 137 }
+ }, { /* Coeff Band 1 */
+ { 85, 137, 221 },
+ { 104, 131, 216 },
+ { 49, 111, 192 },
+ { 21, 87, 155 },
+ { 2, 49, 87 },
+ { 1, 16, 28 }
+ }, { /* Coeff Band 2 */
+ { 89, 163, 230 },
+ { 90, 137, 220 },
+ { 29, 100, 183 },
+ { 10, 70, 135 },
+ { 2, 42, 81 },
+ { 1, 17, 33 }
+ }, { /* Coeff Band 3 */
+ { 108, 167, 237 },
+ { 55, 133, 222 },
+ { 15, 97, 179 },
+ { 4, 72, 135 },
+ { 1, 45, 85 },
+ { 1, 19, 38 }
+ }, { /* Coeff Band 4 */
+ { 124, 146, 240 },
+ { 66, 124, 224 },
+ { 17, 88, 175 },
+ { 4, 58, 122 },
+ { 1, 36, 75 },
+ { 1, 18, 37 }
+ }, { /* Coeff Band 5 */
+ { 141, 79, 241 },
+ { 126, 70, 227 },
+ { 66, 58, 182 },
+ { 30, 44, 136 },
+ { 12, 34, 96 },
+ { 2, 20, 47 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 229, 99, 249 },
+ { 143, 111, 235 },
+ { 46, 109, 192 }
+ }, { /* Coeff Band 1 */
+ { 82, 158, 236 },
+ { 94, 146, 224 },
+ { 25, 117, 191 },
+ { 9, 87, 149 },
+ { 3, 56, 99 },
+ { 1, 33, 57 }
+ }, { /* Coeff Band 2 */
+ { 83, 167, 237 },
+ { 68, 145, 222 },
+ { 10, 103, 177 },
+ { 2, 72, 131 },
+ { 1, 41, 79 },
+ { 1, 20, 39 }
+ }, { /* Coeff Band 3 */
+ { 99, 167, 239 },
+ { 47, 141, 224 },
+ { 10, 104, 178 },
+ { 2, 73, 133 },
+ { 1, 44, 85 },
+ { 1, 22, 47 }
+ }, { /* Coeff Band 4 */
+ { 127, 145, 243 },
+ { 71, 129, 228 },
+ { 17, 93, 177 },
+ { 3, 61, 124 },
+ { 1, 41, 84 },
+ { 1, 21, 52 }
+ }, { /* Coeff Band 5 */
+ { 157, 78, 244 },
+ { 140, 72, 231 },
+ { 69, 58, 184 },
+ { 31, 44, 137 },
+ { 14, 38, 105 },
+ { 8, 23, 61 }
+ }
}
}
};
-
-static const unsigned int default_nzc_counts_8x8[MAX_NZC_CONTEXTS]
- [REF_TYPES]
- [BLOCK_TYPES]
- [NZC8X8_TOKENS] = {
- {
- {
- { 372988, 62777, 19440, 11812, 5145, 1917, 439, 10 },
- { 72052, 30468, 6973, 3250, 1500, 750, 375, 5 },
- }, {
- { 372988, 62777, 19440, 11812, 5145, 1917, 439, 10 },
- { 192052, 30468, 6973, 3250, 1500, 750, 375, 5 },
+static const vp9_coeff_probs_model default_coef_probs_8x8[BLOCK_TYPES] = {
+ { /* block Type 0 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 125, 34, 187 },
+ { 52, 41, 133 },
+ { 6, 31, 56 }
+ }, { /* Coeff Band 1 */
+ { 37, 109, 153 },
+ { 51, 102, 147 },
+ { 23, 87, 128 },
+ { 8, 67, 101 },
+ { 1, 41, 63 },
+ { 1, 19, 29 }
+ }, { /* Coeff Band 2 */
+ { 31, 154, 185 },
+ { 17, 127, 175 },
+ { 6, 96, 145 },
+ { 2, 73, 114 },
+ { 1, 51, 82 },
+ { 1, 28, 45 }
+ }, { /* Coeff Band 3 */
+ { 23, 163, 200 },
+ { 10, 131, 185 },
+ { 2, 93, 148 },
+ { 1, 67, 111 },
+ { 1, 41, 69 },
+ { 1, 14, 24 }
+ }, { /* Coeff Band 4 */
+ { 29, 176, 217 },
+ { 12, 145, 201 },
+ { 3, 101, 156 },
+ { 1, 69, 111 },
+ { 1, 39, 63 },
+ { 1, 14, 23 }
+ }, { /* Coeff Band 5 */
+ { 57, 192, 233 },
+ { 25, 154, 215 },
+ { 6, 109, 167 },
+ { 3, 78, 118 },
+ { 1, 48, 69 },
+ { 1, 21, 29 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 202, 105, 245 },
+ { 108, 106, 216 },
+ { 18, 90, 144 }
+ }, { /* Coeff Band 1 */
+ { 33, 172, 219 },
+ { 64, 149, 206 },
+ { 14, 117, 177 },
+ { 5, 90, 141 },
+ { 2, 61, 95 },
+ { 1, 37, 57 }
+ }, { /* Coeff Band 2 */
+ { 33, 179, 220 },
+ { 11, 140, 198 },
+ { 1, 89, 148 },
+ { 1, 60, 104 },
+ { 1, 33, 57 },
+ { 1, 12, 21 }
+ }, { /* Coeff Band 3 */
+ { 30, 181, 221 },
+ { 8, 141, 198 },
+ { 1, 87, 145 },
+ { 1, 58, 100 },
+ { 1, 31, 55 },
+ { 1, 12, 20 }
+ }, { /* Coeff Band 4 */
+ { 32, 186, 224 },
+ { 7, 142, 198 },
+ { 1, 86, 143 },
+ { 1, 58, 100 },
+ { 1, 31, 55 },
+ { 1, 12, 22 }
+ }, { /* Coeff Band 5 */
+ { 57, 192, 227 },
+ { 20, 143, 204 },
+ { 3, 96, 154 },
+ { 1, 68, 112 },
+ { 1, 42, 69 },
+ { 1, 19, 32 }
+ }
}
- }, {
- {
- { 121533, 33527, 15655, 11920, 5723, 2009, 315, 7 },
- { 23772, 23120, 13127, 8115, 4000, 2000, 200, 6 },
- }, {
- { 121533, 33527, 15655, 11920, 5723, 2009, 315, 7 },
- { 23772, 23120, 13127, 8115, 4000, 2000, 200, 6 },
+ }, { /* block Type 1 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 212, 35, 215 },
+ { 113, 47, 169 },
+ { 29, 48, 105 }
+ }, { /* Coeff Band 1 */
+ { 74, 129, 203 },
+ { 106, 120, 203 },
+ { 49, 107, 178 },
+ { 19, 84, 144 },
+ { 4, 50, 84 },
+ { 1, 15, 25 }
+ }, { /* Coeff Band 2 */
+ { 71, 172, 217 },
+ { 44, 141, 209 },
+ { 15, 102, 173 },
+ { 6, 76, 133 },
+ { 2, 51, 89 },
+ { 1, 24, 42 }
+ }, { /* Coeff Band 3 */
+ { 64, 185, 231 },
+ { 31, 148, 216 },
+ { 8, 103, 175 },
+ { 3, 74, 131 },
+ { 1, 46, 81 },
+ { 1, 18, 30 }
+ }, { /* Coeff Band 4 */
+ { 65, 196, 235 },
+ { 25, 157, 221 },
+ { 5, 105, 174 },
+ { 1, 67, 120 },
+ { 1, 38, 69 },
+ { 1, 15, 30 }
+ }, { /* Coeff Band 5 */
+ { 65, 204, 238 },
+ { 30, 156, 224 },
+ { 7, 107, 177 },
+ { 2, 70, 124 },
+ { 1, 42, 73 },
+ { 1, 18, 34 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 225, 86, 251 },
+ { 144, 104, 235 },
+ { 42, 99, 181 }
+ }, { /* Coeff Band 1 */
+ { 85, 175, 239 },
+ { 112, 165, 229 },
+ { 29, 136, 200 },
+ { 12, 103, 162 },
+ { 6, 77, 123 },
+ { 2, 53, 84 }
+ }, { /* Coeff Band 2 */
+ { 75, 183, 239 },
+ { 30, 155, 221 },
+ { 3, 106, 171 },
+ { 1, 74, 128 },
+ { 1, 44, 76 },
+ { 1, 17, 28 }
+ }, { /* Coeff Band 3 */
+ { 73, 185, 240 },
+ { 27, 159, 222 },
+ { 2, 107, 172 },
+ { 1, 75, 127 },
+ { 1, 42, 73 },
+ { 1, 17, 29 }
+ }, { /* Coeff Band 4 */
+ { 62, 190, 238 },
+ { 21, 159, 222 },
+ { 2, 107, 172 },
+ { 1, 72, 122 },
+ { 1, 40, 71 },
+ { 1, 18, 32 }
+ }, { /* Coeff Band 5 */
+ { 61, 199, 240 },
+ { 27, 161, 226 },
+ { 4, 113, 180 },
+ { 1, 76, 129 },
+ { 1, 46, 80 },
+ { 1, 23, 41 }
+ }
}
- }, {
- {
- { 29408, 11758, 8023, 10123, 6705, 2468, 369, 17 },
- { 11612, 13874, 13329, 13022, 6500, 3250, 300, 12 },
- }, {
- { 29408, 11758, 8023, 10123, 6705, 2468, 369, 17 },
- { 11612, 13874, 13329, 13022, 6500, 3250, 300, 12 },
- }
}
};
-
-static const unsigned int default_nzc_counts_16x16[MAX_NZC_CONTEXTS]
- [REF_TYPES]
- [BLOCK_TYPES]
- [NZC16X16_TOKENS] = {
- {
- {
- { 372988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2 },
- { 72052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1 },
- }, {
- { 32988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2 },
- { 92052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1 },
+static const vp9_coeff_probs_model default_coef_probs_16x16[BLOCK_TYPES] = {
+ { /* block Type 0 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 7, 27, 153 },
+ { 5, 30, 95 },
+ { 1, 16, 30 }
+ }, { /* Coeff Band 1 */
+ { 50, 75, 127 },
+ { 57, 75, 124 },
+ { 27, 67, 108 },
+ { 10, 54, 86 },
+ { 1, 33, 52 },
+ { 1, 12, 18 }
+ }, { /* Coeff Band 2 */
+ { 43, 125, 151 },
+ { 26, 108, 148 },
+ { 7, 83, 122 },
+ { 2, 59, 89 },
+ { 1, 38, 60 },
+ { 1, 17, 27 }
+ }, { /* Coeff Band 3 */
+ { 23, 144, 163 },
+ { 13, 112, 154 },
+ { 2, 75, 117 },
+ { 1, 50, 81 },
+ { 1, 31, 51 },
+ { 1, 14, 23 }
+ }, { /* Coeff Band 4 */
+ { 18, 162, 185 },
+ { 6, 123, 171 },
+ { 1, 78, 125 },
+ { 1, 51, 86 },
+ { 1, 31, 54 },
+ { 1, 14, 23 }
+ }, { /* Coeff Band 5 */
+ { 15, 199, 227 },
+ { 3, 150, 204 },
+ { 1, 91, 146 },
+ { 1, 55, 95 },
+ { 1, 30, 53 },
+ { 1, 11, 20 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 19, 55, 240 },
+ { 19, 59, 196 },
+ { 3, 52, 105 }
+ }, { /* Coeff Band 1 */
+ { 41, 166, 207 },
+ { 104, 153, 199 },
+ { 31, 123, 181 },
+ { 14, 101, 152 },
+ { 5, 72, 106 },
+ { 1, 36, 52 }
+ }, { /* Coeff Band 2 */
+ { 35, 176, 211 },
+ { 12, 131, 190 },
+ { 2, 88, 144 },
+ { 1, 60, 101 },
+ { 1, 36, 60 },
+ { 1, 16, 28 }
+ }, { /* Coeff Band 3 */
+ { 28, 183, 213 },
+ { 8, 134, 191 },
+ { 1, 86, 142 },
+ { 1, 56, 96 },
+ { 1, 30, 53 },
+ { 1, 12, 20 }
+ }, { /* Coeff Band 4 */
+ { 20, 190, 215 },
+ { 4, 135, 192 },
+ { 1, 84, 139 },
+ { 1, 53, 91 },
+ { 1, 28, 49 },
+ { 1, 11, 20 }
+ }, { /* Coeff Band 5 */
+ { 13, 196, 216 },
+ { 2, 137, 192 },
+ { 1, 86, 143 },
+ { 1, 57, 99 },
+ { 1, 32, 56 },
+ { 1, 13, 24 }
+ }
}
- }, {
- {
- { 21533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2 },
- { 47772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2 },
- }, {
- { 21533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2 },
- { 27772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2 },
+ }, { /* block Type 1 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 211, 29, 217 },
+ { 96, 47, 156 },
+ { 22, 43, 87 }
+ }, { /* Coeff Band 1 */
+ { 78, 120, 193 },
+ { 111, 116, 186 },
+ { 46, 102, 164 },
+ { 15, 80, 128 },
+ { 2, 49, 76 },
+ { 1, 18, 28 }
+ }, { /* Coeff Band 2 */
+ { 71, 161, 203 },
+ { 42, 132, 192 },
+ { 10, 98, 150 },
+ { 3, 69, 109 },
+ { 1, 44, 70 },
+ { 1, 18, 29 }
+ }, { /* Coeff Band 3 */
+ { 57, 186, 211 },
+ { 30, 140, 196 },
+ { 4, 93, 146 },
+ { 1, 62, 102 },
+ { 1, 38, 65 },
+ { 1, 16, 27 }
+ }, { /* Coeff Band 4 */
+ { 47, 199, 217 },
+ { 14, 145, 196 },
+ { 1, 88, 142 },
+ { 1, 57, 98 },
+ { 1, 36, 62 },
+ { 1, 15, 26 }
+ }, { /* Coeff Band 5 */
+ { 26, 219, 229 },
+ { 5, 155, 207 },
+ { 1, 94, 151 },
+ { 1, 60, 104 },
+ { 1, 36, 62 },
+ { 1, 16, 28 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 233, 29, 248 },
+ { 146, 47, 220 },
+ { 43, 52, 140 }
+ }, { /* Coeff Band 1 */
+ { 100, 163, 232 },
+ { 179, 161, 222 },
+ { 63, 142, 204 },
+ { 37, 113, 174 },
+ { 26, 89, 137 },
+ { 18, 68, 97 }
+ }, { /* Coeff Band 2 */
+ { 85, 181, 230 },
+ { 32, 146, 209 },
+ { 7, 100, 164 },
+ { 3, 71, 121 },
+ { 1, 45, 77 },
+ { 1, 18, 30 }
+ }, { /* Coeff Band 3 */
+ { 65, 187, 230 },
+ { 20, 148, 207 },
+ { 2, 97, 159 },
+ { 1, 68, 116 },
+ { 1, 40, 70 },
+ { 1, 14, 29 }
+ }, { /* Coeff Band 4 */
+ { 40, 194, 227 },
+ { 8, 147, 204 },
+ { 1, 94, 155 },
+ { 1, 65, 112 },
+ { 1, 39, 66 },
+ { 1, 14, 26 }
+ }, { /* Coeff Band 5 */
+ { 16, 208, 228 },
+ { 3, 151, 207 },
+ { 1, 98, 160 },
+ { 1, 67, 117 },
+ { 1, 41, 74 },
+ { 1, 17, 31 }
+ }
}
- }, {
- {
- { 29408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5 },
- { 9612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3 },
- }, {
- { 29408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5 },
- { 9612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3 },
- }
}
};
-
-static const unsigned int default_nzc_counts_32x32[MAX_NZC_CONTEXTS]
- [REF_TYPES]
- [BLOCK_TYPES]
- [NZC32X32_TOKENS] = {
- {
- {
- { 72988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2, 1, 0 },
- { 52052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1, 0, 0 },
- }, {
- { 72988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2, 1, 0 },
- { 72052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1, 0, 0 },
+static const vp9_coeff_probs_model default_coef_probs_32x32[BLOCK_TYPES] = {
+ { /* block Type 0 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 17, 38, 140 },
+ { 7, 34, 80 },
+ { 1, 17, 29 }
+ }, { /* Coeff Band 1 */
+ { 37, 75, 128 },
+ { 41, 76, 128 },
+ { 26, 66, 116 },
+ { 12, 52, 94 },
+ { 2, 32, 55 },
+ { 1, 10, 16 }
+ }, { /* Coeff Band 2 */
+ { 50, 127, 154 },
+ { 37, 109, 152 },
+ { 16, 82, 121 },
+ { 5, 59, 85 },
+ { 1, 35, 54 },
+ { 1, 13, 20 }
+ }, { /* Coeff Band 3 */
+ { 40, 142, 167 },
+ { 17, 110, 157 },
+ { 2, 71, 112 },
+ { 1, 44, 72 },
+ { 1, 27, 45 },
+ { 1, 11, 17 }
+ }, { /* Coeff Band 4 */
+ { 30, 175, 188 },
+ { 9, 124, 169 },
+ { 1, 74, 116 },
+ { 1, 48, 78 },
+ { 1, 30, 49 },
+ { 1, 11, 18 }
+ }, { /* Coeff Band 5 */
+ { 10, 222, 223 },
+ { 2, 150, 194 },
+ { 1, 83, 128 },
+ { 1, 48, 79 },
+ { 1, 27, 45 },
+ { 1, 11, 17 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 36, 41, 235 },
+ { 29, 36, 193 },
+ { 10, 27, 111 }
+ }, { /* Coeff Band 1 */
+ { 85, 165, 222 },
+ { 177, 162, 215 },
+ { 110, 135, 195 },
+ { 57, 113, 168 },
+ { 23, 83, 120 },
+ { 10, 49, 61 }
+ }, { /* Coeff Band 2 */
+ { 85, 190, 223 },
+ { 36, 139, 200 },
+ { 5, 90, 146 },
+ { 1, 60, 103 },
+ { 1, 38, 65 },
+ { 1, 18, 30 }
+ }, { /* Coeff Band 3 */
+ { 72, 202, 223 },
+ { 23, 141, 199 },
+ { 2, 86, 140 },
+ { 1, 56, 97 },
+ { 1, 36, 61 },
+ { 1, 16, 27 }
+ }, { /* Coeff Band 4 */
+ { 55, 218, 225 },
+ { 13, 145, 200 },
+ { 1, 86, 141 },
+ { 1, 57, 99 },
+ { 1, 35, 61 },
+ { 1, 13, 22 }
+ }, { /* Coeff Band 5 */
+ { 15, 235, 212 },
+ { 1, 132, 184 },
+ { 1, 84, 139 },
+ { 1, 57, 97 },
+ { 1, 34, 56 },
+ { 1, 14, 23 }
+ }
}
- }, {
- {
- { 21533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2, 1, 0 },
- { 27772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2, 1, 0 },
- }, {
- { 21533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2, 1, 0 },
- { 27772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2, 1, 0 },
+ }, { /* block Type 1 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 181, 21, 201 },
+ { 61, 37, 123 },
+ { 10, 38, 71 }
+ }, { /* Coeff Band 1 */
+ { 47, 106, 172 },
+ { 95, 104, 173 },
+ { 42, 93, 159 },
+ { 18, 77, 131 },
+ { 4, 50, 81 },
+ { 1, 17, 23 }
+ }, { /* Coeff Band 2 */
+ { 62, 147, 199 },
+ { 44, 130, 189 },
+ { 28, 102, 154 },
+ { 18, 75, 115 },
+ { 2, 44, 65 },
+ { 1, 12, 19 }
+ }, { /* Coeff Band 3 */
+ { 55, 153, 210 },
+ { 24, 130, 194 },
+ { 3, 93, 146 },
+ { 1, 61, 97 },
+ { 1, 31, 50 },
+ { 1, 10, 16 }
+ }, { /* Coeff Band 4 */
+ { 49, 186, 223 },
+ { 17, 148, 204 },
+ { 1, 96, 142 },
+ { 1, 53, 83 },
+ { 1, 26, 44 },
+ { 1, 11, 17 }
+ }, { /* Coeff Band 5 */
+ { 13, 217, 212 },
+ { 2, 136, 180 },
+ { 1, 78, 124 },
+ { 1, 50, 83 },
+ { 1, 29, 49 },
+ { 1, 14, 23 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 197, 13, 247 },
+ { 82, 17, 222 },
+ { 25, 17, 162 }
+ }, { /* Coeff Band 1 */
+ { 126, 186, 247 },
+ { 234, 191, 243 },
+ { 176, 177, 234 },
+ { 104, 158, 220 },
+ { 66, 128, 186 },
+ { 55, 90, 137 }
+ }, { /* Coeff Band 2 */
+ { 111, 197, 242 },
+ { 46, 158, 219 },
+ { 9, 104, 171 },
+ { 2, 65, 125 },
+ { 1, 44, 80 },
+ { 1, 17, 91 }
+ }, { /* Coeff Band 3 */
+ { 104, 208, 245 },
+ { 39, 168, 224 },
+ { 3, 109, 162 },
+ { 1, 79, 124 },
+ { 1, 50, 102 },
+ { 1, 43, 102 }
+ }, { /* Coeff Band 4 */
+ { 84, 220, 246 },
+ { 31, 177, 231 },
+ { 2, 115, 180 },
+ { 1, 79, 134 },
+ { 1, 55, 77 },
+ { 1, 60, 79 }
+ }, { /* Coeff Band 5 */
+ { 43, 243, 240 },
+ { 8, 180, 217 },
+ { 1, 115, 166 },
+ { 1, 84, 121 },
+ { 1, 51, 67 },
+ { 1, 16, 6 }
+ }
}
- }, {
- {
- { 29408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5, 2, 1 },
- { 9612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3, 2, 1 },
- }, {
- { 29408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5, 2, 1 },
- { 9612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3, 2, 1 },
- }
}
};
-
-#else
-
-static const vp9_prob default_nzc_probs_4x4[MAX_NZC_CONTEXTS]
- [REF_TYPES]
- [BLOCK_TYPES]
- [NZC4X4_TOKENS] = {
- {
- {
- { 219, 162, 179, 142, 242, },
- { 214, 253, 228, 246, 255, },
- }, {
- { 225, 236, 190, 229, 253, },
- { 251, 253, 240, 248, 255, },
- },
- }, {
- {
- { 106, 126, 158, 126, 244, },
- { 118, 241, 201, 240, 255, },
- }, {
- { 165, 179, 143, 189, 242, },
- { 173, 239, 192, 255, 128, },
- },
- }, {
- {
- { 42 , 78 , 153, 92 , 223, },
- { 128, 128, 128, 128, 128, },
- }, {
- { 76 , 68 , 126, 110, 216, },
- { 128, 128, 128, 128, 128, },
- },
- },
-};
-
-static const vp9_prob default_nzc_probs_8x8[MAX_NZC_CONTEXTS]
- [REF_TYPES]
- [BLOCK_TYPES]
- [NZC8X8_TOKENS] = {
- {
- {
- { 134, 139, 170, 178, 142, 197, 255, },
- { 167, 224, 199, 252, 205, 255, 128, },
- }, {
- { 181, 210, 180, 241, 190, 235, 255, },
- { 234, 251, 235, 252, 219, 255, 128, },
- },
- }, {
- {
- { 33 , 64 , 155, 143, 86 , 216, 255, },
- { 73 , 160, 167, 251, 153, 255, 128, },
- }, {
- { 79 , 104, 153, 195, 119, 246, 255, },
- { 149, 183, 186, 249, 203, 255, 128, },
- },
- }, {
- {
- { 10 , 25 , 156, 61 , 69 , 156, 254, },
- { 32 , 1 , 128, 146, 64 , 255, 128, },
- }, {
- { 37 , 48 , 143, 113, 81 , 202, 255, },
- { 1 , 255, 128, 128, 128, 128, 128, },
- },
- },
-};
-
-static const vp9_prob default_nzc_probs_16x16[MAX_NZC_CONTEXTS]
- [REF_TYPES]
- [BLOCK_TYPES]
- [NZC16X16_TOKENS] = {
- {
- {
- { 11 , 188, 210, 167, 141, 143, 152, 255, 128, },
- { 171, 201, 203, 244, 207, 255, 255, 128, 128, },
- }, {
- { 23 , 217, 207, 251, 198, 255, 219, 128, 128, },
- { 235, 249, 229, 255, 199, 128, 128, 128, 128, },
- },
- }, {
- {
- { 9 , 45 , 168, 85 , 66 , 221, 139, 246, 255, },
- { 51 , 110, 163, 238, 94 , 255, 255, 128, 128, },
- }, {
- { 4 , 149, 175, 240, 149, 255, 205, 128, 128, },
- { 141, 217, 186, 255, 128, 128, 128, 128, 128, },
- },
- }, {
- {
- { 1 , 12 , 173, 6 , 68 , 145, 41 , 204, 255, },
- { 39 , 47 , 128, 199, 110, 255, 128, 128, 128, },
- }, {
- { 1 , 121, 171, 149, 115, 242, 159, 255, 128, },
- { 1 , 255, 255, 128, 128, 128, 128, 128, 128, },
- },
- },
-};
-
-static const vp9_prob default_nzc_probs_32x32[MAX_NZC_CONTEXTS]
- [REF_TYPES]
- [BLOCK_TYPES]
- [NZC32X32_TOKENS] = {
- {
- {
- { 11 , 216, 195, 201, 160, 247, 217, 255, 255, 128, 128, },
- { 177, 240, 239, 255, 192, 128, 128, 128, 128, 128, 128, },
- }, {
- { 48 , 235, 213, 235, 199, 255, 255, 128, 128, 128, 128, },
- { 205, 255, 248, 128, 128, 128, 128, 128, 128, 128, 128, },
- },
- }, {
- {
- { 6 , 96 , 138, 99 , 125, 248, 188, 255, 128, 128, 128, },
- { 17 , 53 , 43 , 189, 1 , 255, 171, 128, 128, 128, 128, },
- }, {
- { 5 , 187, 235, 232, 117, 255, 219, 128, 128, 128, 128, },
- { 146, 255, 255, 128, 128, 128, 128, 128, 128, 128, 128, },
- },
- }, {
- {
- { 1 , 7 , 93 , 14 , 100, 30 , 85 , 65 , 81 , 210, 255, },
- { 1 , 1 , 128, 26 , 1 , 218, 78 , 255, 255, 128, 128, },
- }, {
- { 4 , 148, 206, 137, 160, 255, 255, 128, 128, 128, 128, },
- { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, },
- },
- },
-};
#endif
-
-static const vp9_prob default_nzc_pcat_probs[MAX_NZC_CONTEXTS]
- [NZC_TOKENS_EXTRA]
- [NZC_BITS_EXTRA] = {
- // Bit probabilities are in least to most significance order
- {
- {176, 128, 128, 128, 128, 128, 128, 128, 128}, // 3 - 4
- {164, 192, 128, 128, 128, 128, 128, 128, 128}, // 5 - 8
- {154, 184, 208, 128, 128, 128, 128, 128, 128}, // 9 - 16
- {144, 176, 200, 216, 128, 128, 128, 128, 128}, // 17 - 32
- {140, 172, 192, 208, 224, 128, 128, 128, 128}, // 33 - 64
- {136, 168, 188, 200, 220, 232, 128, 128, 128}, // 65 - 128
- {132, 164, 184, 196, 216, 228, 240, 128, 128}, // 129 - 256
- {130, 162, 178, 194, 212, 226, 240, 248, 128}, // 257 - 512
- {128, 160, 176, 192, 208, 224, 240, 248, 254}, // 513 - 1024
- }, {
- {168, 128, 128, 128, 128, 128, 128, 128, 128}, // 3 - 4
- {152, 184, 128, 128, 128, 128, 128, 128, 128}, // 5 - 8
- {152, 184, 208, 128, 128, 128, 128, 128, 128}, // 9 - 16
- {144, 176, 200, 216, 128, 128, 128, 128, 128}, // 17 - 32
- {140, 172, 192, 208, 224, 128, 128, 128, 128}, // 33 - 64
- {136, 168, 188, 200, 220, 232, 128, 128, 128}, // 65 - 128
- {132, 164, 184, 196, 216, 228, 240, 128, 128}, // 129 - 256
- {130, 162, 178, 194, 212, 226, 240, 248, 128}, // 257 - 512
- {128, 160, 176, 192, 208, 224, 240, 248, 254}, // 513 - 1024
- }, {
- {160, 128, 128, 128, 128, 128, 128, 128, 128}, // 3 - 4
- {152, 176, 128, 128, 128, 128, 128, 128, 128}, // 5 - 8
- {150, 184, 208, 128, 128, 128, 128, 128, 128}, // 9 - 16
- {144, 176, 200, 216, 128, 128, 128, 128, 128}, // 17 - 32
- {140, 172, 192, 208, 224, 128, 128, 128, 128}, // 33 - 64
- {136, 168, 188, 200, 220, 232, 128, 128, 128}, // 65 - 128
- {132, 164, 184, 196, 216, 228, 240, 128, 128}, // 129 - 256
- {130, 162, 178, 194, 212, 226, 240, 248, 128}, // 257 - 512
- {128, 160, 176, 192, 208, 224, 240, 248, 254}, // 513 - 1024
- },
-};
-
-#endif // CONFIG_CODE_NONZEROCOUNT
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -8,11 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
-#include <stdio.h>
-
#include "vp9/common/vp9_entropy.h"
-#include "string.h"
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_entropymode.h"
@@ -20,8 +16,6 @@
#include "vpx/vpx_integer.h"
#include "vp9/common/vp9_coefupdateprobs.h"
-const int vp9_i8x8_block[4] = {0, 2, 8, 10};
-
DECLARE_ALIGNED(16, const uint8_t, vp9_norm[256]) = {
0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
@@ -41,22 +35,16 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-// Unified coefficient band structure used by all block sizes
-DECLARE_ALIGNED(16, const int, vp9_coef_bands8x8[64]) = {
- 0, 1, 2, 3, 4, 4, 5, 5,
- 1, 2, 3, 4, 4, 5, 5, 5,
- 2, 3, 4, 4, 5, 5, 5, 5,
- 3, 4, 4, 5, 5, 5, 5, 5,
- 4, 4, 5, 5, 5, 5, 5, 5,
- 4, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5
+DECLARE_ALIGNED(16, const uint8_t,
+ vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1]) = {
+ 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 5
};
-DECLARE_ALIGNED(16, const int, vp9_coef_bands4x4[16]) = {
- 0, 1, 2, 3,
- 1, 2, 3, 4,
- 2, 3, 4, 5,
- 3, 4, 5, 5
+
+DECLARE_ALIGNED(16, const uint8_t,
+ vp9_coefband_trans_4x4[MAXBAND_INDEX + 1]) = {
+ 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5
};
DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[MAX_ENTROPY_TOKENS]) = {
@@ -63,8 +51,7 @@
0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5
};
-#if CONFIG_SCATTERSCAN
-DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_4x4[16]) = {
+DECLARE_ALIGNED(16, const int, vp9_default_scan_4x4[16]) = {
0, 4, 1, 5,
8, 2, 12, 9,
3, 6, 13, 10,
@@ -85,7 +72,7 @@
13, 11, 14, 15,
};
-DECLARE_ALIGNED(64, const int, vp9_default_zig_zag1d_8x8[64]) = {
+DECLARE_ALIGNED(64, const int, vp9_default_scan_8x8[64]) = {
0, 8, 1, 16, 9, 2, 17, 24,
10, 3, 18, 25, 32, 11, 4, 26,
33, 19, 40, 12, 34, 27, 5, 41,
@@ -118,7 +105,7 @@
60, 39, 61, 47, 54, 55, 62, 63,
};
-DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_16x16[256]) = {
+DECLARE_ALIGNED(16, const int, vp9_default_scan_16x16[256]) = {
0, 16, 1, 32, 17, 2, 48, 33, 18, 3, 64, 34, 49, 19, 65, 80,
50, 4, 35, 66, 20, 81, 96, 51, 5, 36, 82, 97, 67, 112, 21, 52,
98, 37, 83, 113, 6, 68, 128, 53, 22, 99, 114, 84, 7, 129, 38, 69,
@@ -175,218 +162,64 @@
190, 251, 221, 191, 206, 236, 207, 237, 252, 222, 253, 223, 238, 239, 254, 255,
};
-DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_32x32[1024]) = {
+DECLARE_ALIGNED(16, const int, vp9_default_scan_32x32[1024]) = {
0, 32, 1, 64, 33, 2, 96, 65, 34, 128, 3, 97, 66, 160, 129, 35, 98, 4, 67, 130, 161, 192, 36, 99, 224, 5, 162, 193, 68, 131, 37, 100,
225, 194, 256, 163, 69, 132, 6, 226, 257, 288, 195, 101, 164, 38, 258, 7, 227, 289, 133, 320, 70, 196, 165, 290, 259, 228, 39, 321, 102, 352, 8, 197,
71, 134, 322, 291, 260, 353, 384, 229, 166, 103, 40, 354, 323, 292, 135, 385, 198, 261, 72, 9, 416, 167, 386, 355, 230, 324, 104, 293, 41, 417, 199, 136,
262, 387, 448, 325, 356, 10, 73, 418, 231, 168, 449, 294, 388, 105, 419, 263, 42, 200, 357, 450, 137, 480, 74, 326, 232, 11, 389, 169, 295, 420, 106, 451,
481, 358, 264, 327, 201, 43, 138, 512, 482, 390, 296, 233, 170, 421, 75, 452, 359, 12, 513, 265, 483, 328, 107, 202, 514, 544, 422, 391, 453, 139, 44, 234,
- 484, 297, 360, 171, 76, 515, 545, 266, 329, 454, 13, 423, 392, 203, 108, 546, 485, 576, 298, 235, 140, 361, 516, 330, 172, 547, 45, 424, 455, 267, 393, 577,
- 486, 77, 204, 517, 362, 548, 608, 14, 456, 299, 578, 109, 236, 425, 394, 487, 609, 331, 141, 579, 518, 46, 268, 15, 173, 549, 610, 640, 363, 78, 519, 488,
- 300, 205, 16, 457, 580, 426, 550, 395, 110, 237, 611, 641, 332, 672, 142, 642, 269, 458, 47, 581, 427, 489, 174, 364, 520, 612, 551, 673, 79, 206, 301, 643,
- 704, 17, 111, 490, 674, 238, 582, 48, 521, 613, 333, 396, 459, 143, 270, 552, 644, 705, 736, 365, 80, 675, 583, 175, 428, 706, 112, 302, 207, 614, 553, 49,
- 645, 522, 737, 397, 768, 144, 334, 18, 676, 491, 239, 615, 707, 584, 81, 460, 176, 271, 738, 429, 113, 800, 366, 208, 523, 708, 646, 554, 677, 769, 19, 145,
- 585, 739, 240, 303, 50, 461, 616, 398, 647, 335, 492, 177, 82, 770, 832, 555, 272, 430, 678, 209, 709, 114, 740, 801, 617, 51, 304, 679, 524, 367, 586, 241,
- 20, 146, 771, 864, 83, 802, 648, 493, 399, 273, 336, 710, 178, 462, 833, 587, 741, 115, 305, 711, 368, 525, 618, 803, 210, 896, 680, 834, 772, 52, 649, 147,
- 431, 494, 556, 242, 400, 865, 337, 21, 928, 179, 742, 84, 463, 274, 369, 804, 650, 557, 743, 960, 835, 619, 773, 306, 211, 526, 432, 992, 588, 712, 116, 243,
- 866, 495, 681, 558, 805, 589, 401, 897, 53, 338, 148, 682, 867, 464, 275, 22, 370, 433, 307, 620, 527, 836, 774, 651, 713, 744, 85, 180, 621, 465, 929, 775,
- 496, 898, 212, 339, 244, 402, 590, 117, 559, 714, 434, 23, 868, 930, 806, 683, 528, 652, 371, 961, 149, 837, 54, 899, 745, 276, 993, 497, 403, 622, 181, 776,
- 746, 529, 560, 435, 86, 684, 466, 308, 591, 653, 715, 807, 340, 869, 213, 962, 245, 838, 561, 931, 808, 592, 118, 498, 372, 623, 685, 994, 467, 654, 747, 900,
- 716, 277, 150, 55, 24, 404, 530, 839, 777, 655, 182, 963, 840, 686, 778, 309, 870, 341, 87, 499, 809, 624, 593, 436, 717, 932, 214, 246, 995, 718, 625, 373,
- 562, 25, 119, 901, 531, 468, 964, 748, 810, 278, 779, 500, 563, 656, 405, 687, 871, 872, 594, 151, 933, 749, 841, 310, 657, 626, 595, 437, 688, 183, 996, 965,
- 902, 811, 342, 750, 689, 719, 532, 56, 215, 469, 934, 374, 247, 720, 780, 564, 781, 842, 406, 26, 751, 903, 873, 57, 279, 627, 501, 658, 843, 997, 812, 904,
- 88, 813, 438, 752, 935, 936, 311, 596, 533, 690, 343, 966, 874, 89, 120, 470, 721, 875, 659, 782, 565, 998, 375, 844, 845, 27, 628, 967, 121, 905, 968, 152,
- 937, 814, 753, 502, 691, 783, 184, 153, 722, 407, 58, 815, 999, 660, 597, 723, 534, 906, 216, 439, 907, 248, 185, 876, 846, 692, 784, 629, 90, 969, 280, 754,
- 938, 939, 217, 847, 566, 471, 785, 816, 877, 1000, 249, 878, 661, 503, 312, 970, 755, 122, 817, 281, 344, 786, 598, 724, 28, 59, 29, 154, 535, 630, 376, 1001,
- 313, 908, 186, 91, 848, 849, 345, 909, 940, 879, 408, 818, 693, 1002, 971, 941, 567, 377, 218, 756, 910, 787, 440, 123, 880, 725, 662, 250, 819, 1003, 282, 972,
- 850, 599, 472, 409, 155, 441, 942, 757, 788, 694, 911, 881, 314, 631, 973, 504, 187, 1004, 346, 473, 851, 943, 820, 726, 60, 505, 219, 378, 912, 974, 30, 31,
- 536, 882, 1005, 92, 251, 663, 944, 913, 283, 695, 883, 568, 1006, 975, 410, 442, 945, 789, 852, 537, 1007, 124, 315, 61, 758, 821, 600, 914, 976, 569, 474, 347,
- 156, 1008, 915, 93, 977, 506, 946, 727, 379, 884, 188, 632, 601, 1009, 790, 853, 978, 947, 220, 411, 125, 633, 664, 759, 252, 443, 916, 538, 157, 822, 62, 570,
- 979, 284, 1010, 885, 948, 189, 475, 94, 316, 665, 696, 1011, 854, 791, 980, 221, 348, 63, 917, 602, 380, 507, 253, 126, 697, 823, 634, 285, 728, 949, 886, 95,
- 158, 539, 1012, 317, 412, 444, 760, 571, 190, 981, 729, 918, 127, 666, 349, 381, 476, 855, 761, 1013, 603, 222, 159, 698, 950, 508, 254, 792, 286, 635, 887, 793,
- 413, 191, 982, 445, 540, 318, 730, 667, 223, 824, 919, 1014, 350, 477, 572, 255, 825, 951, 762, 509, 604, 856, 382, 699, 287, 319, 636, 983, 794, 414, 541, 731,
- 857, 888, 351, 446, 573, 1015, 668, 889, 478, 826, 383, 763, 605, 920, 510, 637, 415, 700, 921, 858, 447, 952, 542, 795, 479, 953, 732, 890, 669, 574, 511, 984,
- 827, 985, 922, 1016, 764, 606, 543, 701, 859, 638, 1017, 575, 796, 954, 733, 891, 670, 607, 828, 986, 765, 923, 639, 1018, 702, 860, 955, 671, 892, 734, 797, 703,
- 987, 829, 1019, 766, 924, 735, 861, 956, 988, 893, 767, 798, 830, 1020, 925, 957, 799, 862, 831, 989, 894, 1021, 863, 926, 895, 958, 990, 1022, 927, 959, 991, 1023,
+ 484, 297, 360, 171, 76, 515, 545, 266, 329, 454, 13, 423, 203, 108, 546, 485, 576, 298, 235, 140, 361, 330, 172, 547, 45, 455, 267, 577, 486, 77, 204, 362,
+ 608, 14, 299, 578, 109, 236, 487, 609, 331, 141, 579, 46, 15, 173, 610, 363, 78, 205, 16, 110, 237, 611, 142, 47, 174, 79, 206, 17, 111, 238, 48, 143,
+ 80, 175, 112, 207, 49, 18, 239, 81, 113, 19, 50, 82, 114, 51, 83, 115, 640, 516, 392, 268, 144, 20, 672, 641, 548, 517, 424, 393, 300, 269, 176, 145,
+ 52, 21, 704, 673, 642, 580, 549, 518, 456, 425, 394, 332, 301, 270, 208, 177, 146, 84, 53, 22, 736, 705, 674, 643, 612, 581, 550, 519, 488, 457, 426, 395,
+ 364, 333, 302, 271, 240, 209, 178, 147, 116, 85, 54, 23, 737, 706, 675, 613, 582, 551, 489, 458, 427, 365, 334, 303, 241, 210, 179, 117, 86, 55, 738, 707,
+ 614, 583, 490, 459, 366, 335, 242, 211, 118, 87, 739, 615, 491, 367, 243, 119, 768, 644, 520, 396, 272, 148, 24, 800, 769, 676, 645, 552, 521, 428, 397, 304,
+ 273, 180, 149, 56, 25, 832, 801, 770, 708, 677, 646, 584, 553, 522, 460, 429, 398, 336, 305, 274, 212, 181, 150, 88, 57, 26, 864, 833, 802, 771, 740, 709,
+ 678, 647, 616, 585, 554, 523, 492, 461, 430, 399, 368, 337, 306, 275, 244, 213, 182, 151, 120, 89, 58, 27, 865, 834, 803, 741, 710, 679, 617, 586, 555, 493,
+ 462, 431, 369, 338, 307, 245, 214, 183, 121, 90, 59, 866, 835, 742, 711, 618, 587, 494, 463, 370, 339, 246, 215, 122, 91, 867, 743, 619, 495, 371, 247, 123,
+ 896, 772, 648, 524, 400, 276, 152, 28, 928, 897, 804, 773, 680, 649, 556, 525, 432, 401, 308, 277, 184, 153, 60, 29, 960, 929, 898, 836, 805, 774, 712, 681,
+ 650, 588, 557, 526, 464, 433, 402, 340, 309, 278, 216, 185, 154, 92, 61, 30, 992, 961, 930, 899, 868, 837, 806, 775, 744, 713, 682, 651, 620, 589, 558, 527,
+ 496, 465, 434, 403, 372, 341, 310, 279, 248, 217, 186, 155, 124, 93, 62, 31, 993, 962, 931, 869, 838, 807, 745, 714, 683, 621, 590, 559, 497, 466, 435, 373,
+ 342, 311, 249, 218, 187, 125, 94, 63, 994, 963, 870, 839, 746, 715, 622, 591, 498, 467, 374, 343, 250, 219, 126, 95, 995, 871, 747, 623, 499, 375, 251, 127,
+ 900, 776, 652, 528, 404, 280, 156, 932, 901, 808, 777, 684, 653, 560, 529, 436, 405, 312, 281, 188, 157, 964, 933, 902, 840, 809, 778, 716, 685, 654, 592, 561,
+ 530, 468, 437, 406, 344, 313, 282, 220, 189, 158, 996, 965, 934, 903, 872, 841, 810, 779, 748, 717, 686, 655, 624, 593, 562, 531, 500, 469, 438, 407, 376, 345,
+ 314, 283, 252, 221, 190, 159, 997, 966, 935, 873, 842, 811, 749, 718, 687, 625, 594, 563, 501, 470, 439, 377, 346, 315, 253, 222, 191, 998, 967, 874, 843, 750,
+ 719, 626, 595, 502, 471, 378, 347, 254, 223, 999, 875, 751, 627, 503, 379, 255, 904, 780, 656, 532, 408, 284, 936, 905, 812, 781, 688, 657, 564, 533, 440, 409,
+ 316, 285, 968, 937, 906, 844, 813, 782, 720, 689, 658, 596, 565, 534, 472, 441, 410, 348, 317, 286, 1000, 969, 938, 907, 876, 845, 814, 783, 752, 721, 690, 659,
+ 628, 597, 566, 535, 504, 473, 442, 411, 380, 349, 318, 287, 1001, 970, 939, 877, 846, 815, 753, 722, 691, 629, 598, 567, 505, 474, 443, 381, 350, 319, 1002, 971,
+ 878, 847, 754, 723, 630, 599, 506, 475, 382, 351, 1003, 879, 755, 631, 507, 383, 908, 784, 660, 536, 412, 940, 909, 816, 785, 692, 661, 568, 537, 444, 413, 972,
+ 941, 910, 848, 817, 786, 724, 693, 662, 600, 569, 538, 476, 445, 414, 1004, 973, 942, 911, 880, 849, 818, 787, 756, 725, 694, 663, 632, 601, 570, 539, 508, 477,
+ 446, 415, 1005, 974, 943, 881, 850, 819, 757, 726, 695, 633, 602, 571, 509, 478, 447, 1006, 975, 882, 851, 758, 727, 634, 603, 510, 479, 1007, 883, 759, 635, 511,
+ 912, 788, 664, 540, 944, 913, 820, 789, 696, 665, 572, 541, 976, 945, 914, 852, 821, 790, 728, 697, 666, 604, 573, 542, 1008, 977, 946, 915, 884, 853, 822, 791,
+ 760, 729, 698, 667, 636, 605, 574, 543, 1009, 978, 947, 885, 854, 823, 761, 730, 699, 637, 606, 575, 1010, 979, 886, 855, 762, 731, 638, 607, 1011, 887, 763, 639,
+ 916, 792, 668, 948, 917, 824, 793, 700, 669, 980, 949, 918, 856, 825, 794, 732, 701, 670, 1012, 981, 950, 919, 888, 857, 826, 795, 764, 733, 702, 671, 1013, 982,
+ 951, 889, 858, 827, 765, 734, 703, 1014, 983, 890, 859, 766, 735, 1015, 891, 767, 920, 796, 952, 921, 828, 797, 984, 953, 922, 860, 829, 798, 1016, 985, 954, 923,
+ 892, 861, 830, 799, 1017, 986, 955, 893, 862, 831, 1018, 987, 894, 863, 1019, 895, 924, 956, 925, 988, 957, 926, 1020, 989, 958, 927, 1021, 990, 959, 1022, 991, 1023,
};
-#else // CONFIG_SCATTERSCAN
-DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_4x4[16]) = {
- 0, 1, 4, 8,
- 5, 2, 3, 6,
- 9, 12, 13, 10,
- 7, 11, 14, 15,
-};
-DECLARE_ALIGNED(16, const int, vp9_col_scan_4x4[16]) = {
- 0, 4, 8, 12,
- 1, 5, 9, 13,
- 2, 6, 10, 14,
- 3, 7, 11, 15
-};
-
-DECLARE_ALIGNED(16, const int, vp9_row_scan_4x4[16]) = {
- 0, 1, 2, 3,
- 4, 5, 6, 7,
- 8, 9, 10, 11,
- 12, 13, 14, 15
-};
-
-DECLARE_ALIGNED(64, const int, vp9_default_zig_zag1d_8x8[64]) = {
- 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63,
-};
-
-DECLARE_ALIGNED(16, const int, vp9_col_scan_8x8[64]) = {
- 0, 8, 16, 24, 32, 40, 48, 56,
- 1, 9, 17, 25, 33, 41, 49, 57,
- 2, 10, 18, 26, 34, 42, 50, 58,
- 3, 11, 19, 27, 35, 43, 51, 59,
- 4, 12, 20, 28, 36, 44, 52, 60,
- 5, 13, 21, 29, 37, 45, 53, 61,
- 6, 14, 22, 30, 38, 46, 54, 62,
- 7, 15, 23, 31, 39, 47, 55, 63,
-};
-
-DECLARE_ALIGNED(16, const int, vp9_row_scan_8x8[64]) = {
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63,
-};
-
-DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_16x16[256]) = {
- 0, 1, 16, 32, 17, 2, 3, 18,
- 33, 48, 64, 49, 34, 19, 4, 5,
- 20, 35, 50, 65, 80, 96, 81, 66,
- 51, 36, 21, 6, 7, 22, 37, 52,
- 67, 82, 97, 112, 128, 113, 98, 83,
- 68, 53, 38, 23, 8, 9, 24, 39,
- 54, 69, 84, 99, 114, 129, 144, 160,
- 145, 130, 115, 100, 85, 70, 55, 40,
- 25, 10, 11, 26, 41, 56, 71, 86,
- 101, 116, 131, 146, 161, 176, 192, 177,
- 162, 147, 132, 117, 102, 87, 72, 57,
- 42, 27, 12, 13, 28, 43, 58, 73,
- 88, 103, 118, 133, 148, 163, 178, 193,
- 208, 224, 209, 194, 179, 164, 149, 134,
- 119, 104, 89, 74, 59, 44, 29, 14,
- 15, 30, 45, 60, 75, 90, 105, 120,
- 135, 150, 165, 180, 195, 210, 225, 240,
- 241, 226, 211, 196, 181, 166, 151, 136,
- 121, 106, 91, 76, 61, 46, 31, 47,
- 62, 77, 92, 107, 122, 137, 152, 167,
- 182, 197, 212, 227, 242, 243, 228, 213,
- 198, 183, 168, 153, 138, 123, 108, 93,
- 78, 63, 79, 94, 109, 124, 139, 154,
- 169, 184, 199, 214, 229, 244, 245, 230,
- 215, 200, 185, 170, 155, 140, 125, 110,
- 95, 111, 126, 141, 156, 171, 186, 201,
- 216, 231, 246, 247, 232, 217, 202, 187,
- 172, 157, 142, 127, 143, 158, 173, 188,
- 203, 218, 233, 248, 249, 234, 219, 204,
- 189, 174, 159, 175, 190, 205, 220, 235,
- 250, 251, 236, 221, 206, 191, 207, 222,
- 237, 252, 253, 238, 223, 239, 254, 255,
-};
-
-DECLARE_ALIGNED(16, const int, vp9_col_scan_16x16[256]) = {
- 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240,
- 1, 17, 33, 49, 65, 81, 97, 113, 129, 145, 161, 177, 193, 209, 225, 241,
- 2, 18, 34, 50, 66, 82, 98, 114, 130, 146, 162, 178, 194, 210, 226, 242,
- 3, 19, 35, 51, 67, 83, 99, 115, 131, 147, 163, 179, 195, 211, 227, 243,
- 4, 20, 36, 52, 68, 84, 100, 116, 132, 148, 164, 180, 196, 212, 228, 244,
- 5, 21, 37, 53, 69, 85, 101, 117, 133, 149, 165, 181, 197, 213, 229, 245,
- 6, 22, 38, 54, 70, 86, 102, 118, 134, 150, 166, 182, 198, 214, 230, 246,
- 7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 215, 231, 247,
- 8, 24, 40, 56, 72, 88, 104, 120, 136, 152, 168, 184, 200, 216, 232, 248,
- 9, 25, 41, 57, 73, 89, 105, 121, 137, 153, 169, 185, 201, 217, 233, 249,
- 10, 26, 42, 58, 74, 90, 106, 122, 138, 154, 170, 186, 202, 218, 234, 250,
- 11, 27, 43, 59, 75, 91, 107, 123, 139, 155, 171, 187, 203, 219, 235, 251,
- 12, 28, 44, 60, 76, 92, 108, 124, 140, 156, 172, 188, 204, 220, 236, 252,
- 13, 29, 45, 61, 77, 93, 109, 125, 141, 157, 173, 189, 205, 221, 237, 253,
- 14, 30, 46, 62, 78, 94, 110, 126, 142, 158, 174, 190, 206, 222, 238, 254,
- 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255,
-};
-
-DECLARE_ALIGNED(16, const int, vp9_row_scan_16x16[256]) = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
-};
-
-DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_32x32[1024]) = {
- 0, 1, 32, 64, 33, 2, 3, 34, 65, 96, 128, 97, 66, 35, 4, 5, 36, 67, 98, 129, 160, 192, 161, 130, 99, 68, 37, 6, 7, 38, 69, 100,
- 131, 162, 193, 224, 256, 225, 194, 163, 132, 101, 70, 39, 8, 9, 40, 71, 102, 133, 164, 195, 226, 257, 288, 320, 289, 258, 227, 196, 165, 134, 103, 72,
- 41, 10, 11, 42, 73, 104, 135, 166, 197, 228, 259, 290, 321, 352, 384, 353, 322, 291, 260, 229, 198, 167, 136, 105, 74, 43, 12, 13, 44, 75, 106, 137,
- 168, 199, 230, 261, 292, 323, 354, 385, 416, 448, 417, 386, 355, 324, 293, 262, 231, 200, 169, 138, 107, 76, 45, 14, 15, 46, 77, 108, 139, 170, 201, 232,
- 263, 294, 325, 356, 387, 418, 449, 480, 512, 481, 450, 419, 388, 357, 326, 295, 264, 233, 202, 171, 140, 109, 78, 47, 16, 17, 48, 79, 110, 141, 172, 203,
- 234, 265, 296, 327, 358, 389, 420, 451, 482, 513, 544, 576, 545, 514, 483, 452, 421, 390, 359, 328, 297, 266, 235, 204, 173, 142, 111, 80, 49, 18, 19, 50,
- 81, 112, 143, 174, 205, 236, 267, 298, 329, 360, 391, 422, 453, 484, 515, 546, 577, 608, 640, 609, 578, 547, 516, 485, 454, 423, 392, 361, 330, 299, 268, 237,
- 206, 175, 144, 113, 82, 51, 20, 21, 52, 83, 114, 145, 176, 207, 238, 269, 300, 331, 362, 393, 424, 455, 486, 517, 548, 579, 610, 641, 672, 704, 673, 642,
- 611, 580, 549, 518, 487, 456, 425, 394, 363, 332, 301, 270, 239, 208, 177, 146, 115, 84, 53, 22, 23, 54, 85, 116, 147, 178, 209, 240, 271, 302, 333, 364,
- 395, 426, 457, 488, 519, 550, 581, 612, 643, 674, 705, 736, 768, 737, 706, 675, 644, 613, 582, 551, 520, 489, 458, 427, 396, 365, 334, 303, 272, 241, 210, 179,
- 148, 117, 86, 55, 24, 25, 56, 87, 118, 149, 180, 211, 242, 273, 304, 335, 366, 397, 428, 459, 490, 521, 552, 583, 614, 645, 676, 707, 738, 769, 800, 832,
- 801, 770, 739, 708, 677, 646, 615, 584, 553, 522, 491, 460, 429, 398, 367, 336, 305, 274, 243, 212, 181, 150, 119, 88, 57, 26, 27, 58, 89, 120, 151, 182,
- 213, 244, 275, 306, 337, 368, 399, 430, 461, 492, 523, 554, 585, 616, 647, 678, 709, 740, 771, 802, 833, 864, 896, 865, 834, 803, 772, 741, 710, 679, 648, 617,
- 586, 555, 524, 493, 462, 431, 400, 369, 338, 307, 276, 245, 214, 183, 152, 121, 90, 59, 28, 29, 60, 91, 122, 153, 184, 215, 246, 277, 308, 339, 370, 401,
- 432, 463, 494, 525, 556, 587, 618, 649, 680, 711, 742, 773, 804, 835, 866, 897, 928, 960, 929, 898, 867, 836, 805, 774, 743, 712, 681, 650, 619, 588, 557, 526,
- 495, 464, 433, 402, 371, 340, 309, 278, 247, 216, 185, 154, 123, 92, 61, 30, 31, 62, 93, 124, 155, 186, 217, 248, 279, 310, 341, 372, 403, 434, 465, 496,
- 527, 558, 589, 620, 651, 682, 713, 744, 775, 806, 837, 868, 899, 930, 961, 992, 993, 962, 931, 900, 869, 838, 807, 776, 745, 714, 683, 652, 621, 590, 559, 528,
- 497, 466, 435, 404, 373, 342, 311, 280, 249, 218, 187, 156, 125, 94, 63, 95, 126, 157, 188, 219, 250, 281, 312, 343, 374, 405, 436, 467, 498, 529, 560, 591,
- 622, 653, 684, 715, 746, 777, 808, 839, 870, 901, 932, 963, 994, 995, 964, 933, 902, 871, 840, 809, 778, 747, 716, 685, 654, 623, 592, 561, 530, 499, 468, 437,
- 406, 375, 344, 313, 282, 251, 220, 189, 158, 127, 159, 190, 221, 252, 283, 314, 345, 376, 407, 438, 469, 500, 531, 562, 593, 624, 655, 686, 717, 748, 779, 810,
- 841, 872, 903, 934, 965, 996, 997, 966, 935, 904, 873, 842, 811, 780, 749, 718, 687, 656, 625, 594, 563, 532, 501, 470, 439, 408, 377, 346, 315, 284, 253, 222,
- 191, 223, 254, 285, 316, 347, 378, 409, 440, 471, 502, 533, 564, 595, 626, 657, 688, 719, 750, 781, 812, 843, 874, 905, 936, 967, 998, 999, 968, 937, 906, 875,
- 844, 813, 782, 751, 720, 689, 658, 627, 596, 565, 534, 503, 472, 441, 410, 379, 348, 317, 286, 255, 287, 318, 349, 380, 411, 442, 473, 504, 535, 566, 597, 628,
- 659, 690, 721, 752, 783, 814, 845, 876, 907, 938, 969, 1000, 1001, 970, 939, 908, 877, 846, 815, 784, 753, 722, 691, 660, 629, 598, 567, 536, 505, 474, 443, 412,
- 381, 350, 319, 351, 382, 413, 444, 475, 506, 537, 568, 599, 630, 661, 692, 723, 754, 785, 816, 847, 878, 909, 940, 971, 1002, 1003, 972, 941, 910, 879, 848, 817,
- 786, 755, 724, 693, 662, 631, 600, 569, 538, 507, 476, 445, 414, 383, 415, 446, 477, 508, 539, 570, 601, 632, 663, 694, 725, 756, 787, 818, 849, 880, 911, 942,
- 973, 1004, 1005, 974, 943, 912, 881, 850, 819, 788, 757, 726, 695, 664, 633, 602, 571, 540, 509, 478, 447, 479, 510, 541, 572, 603, 634, 665, 696, 727, 758, 789,
- 820, 851, 882, 913, 944, 975, 1006, 1007, 976, 945, 914, 883, 852, 821, 790, 759, 728, 697, 666, 635, 604, 573, 542, 511, 543, 574, 605, 636, 667, 698, 729, 760,
- 791, 822, 853, 884, 915, 946, 977, 1008, 1009, 978, 947, 916, 885, 854, 823, 792, 761, 730, 699, 668, 637, 606, 575, 607, 638, 669, 700, 731, 762, 793, 824, 855,
- 886, 917, 948, 979, 1010, 1011, 980, 949, 918, 887, 856, 825, 794, 763, 732, 701, 670, 639, 671, 702, 733, 764, 795, 826, 857, 888, 919, 950, 981, 1012, 1013, 982,
- 951, 920, 889, 858, 827, 796, 765, 734, 703, 735, 766, 797, 828, 859, 890, 921, 952, 983, 1014, 1015, 984, 953, 922, 891, 860, 829, 798, 767, 799, 830, 861, 892,
- 923, 954, 985, 1016, 1017, 986, 955, 924, 893, 862, 831, 863, 894, 925, 956, 987, 1018, 1019, 988, 957, 926, 895, 927, 958, 989, 1020, 1021, 990, 959, 991, 1022, 1023,
-};
-#endif // CONFIG_SCATTERSCAN
-
/* Array indices are identical to previously-existing CONTEXT_NODE indices */
const vp9_tree_index vp9_coef_tree[ 22] = /* corresponding _CONTEXT_NODEs */
{
- -DCT_EOB_TOKEN, 2, /* 0 = EOB */
- -ZERO_TOKEN, 4, /* 1 = ZERO */
- -ONE_TOKEN, 6, /* 2 = ONE */
+#if CONFIG_BALANCED_COEFTREE
+ -ZERO_TOKEN, 2, /* 0 = ZERO */
+ -DCT_EOB_TOKEN, 4, /* 1 = EOB */
+#else
+ -DCT_EOB_TOKEN, 2, /* 0 = EOB */
+ -ZERO_TOKEN, 4, /* 1 = ZERO */
+#endif
+ -ONE_TOKEN, 6, /* 2 = ONE */
8, 12, /* 3 = LOW_VAL */
-TWO_TOKEN, 10, /* 4 = TWO */
-THREE_TOKEN, -FOUR_TOKEN, /* 5 = THREE */
- 14, 16, /* 6 = HIGH_LOW */
+ 14, 16, /* 6 = HIGH_LOW */
-DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2, /* 7 = CAT_ONE */
18, 20, /* 8 = CAT_THREEFOUR */
- -DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 9 = CAT_THREE */
- -DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */
+ -DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 9 = CAT_THREE */
+ -DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */
};
-struct vp9_token_struct vp9_coef_encodings[MAX_ENTROPY_TOKENS];
+struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS];
/* Trees for extra bits. Probabilities are constant and
do not depend on previously encoded bits */
@@ -400,1660 +233,189 @@
254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129
};
-#if CONFIG_CODE_NONZEROCOUNT
-const vp9_tree_index vp9_nzc4x4_tree[2 * NZC4X4_NODES] = {
- -NZC_0, 2,
- 4, 6,
- -NZC_1, -NZC_2,
- -NZC_3TO4, 8,
- -NZC_5TO8, -NZC_9TO16,
+const vp9_tree_index vp9_coefmodel_tree[6] = {
+#if CONFIG_BALANCED_COEFTREE
+ -ZERO_TOKEN, 2,
+ -DCT_EOB_MODEL_TOKEN, 4,
+#else
+ -DCT_EOB_MODEL_TOKEN, 2, /* 0 = EOB */
+ -ZERO_TOKEN, 4, /* 1 = ZERO */
+#endif
+ -ONE_TOKEN, -TWO_TOKEN,
};
-struct vp9_token_struct vp9_nzc4x4_encodings[NZC4X4_TOKENS];
-const vp9_tree_index vp9_nzc8x8_tree[2 * NZC8X8_NODES] = {
- -NZC_0, 2,
- 4, 6,
- -NZC_1, -NZC_2,
- 8, 10,
- -NZC_3TO4, -NZC_5TO8,
- -NZC_9TO16, 12,
- -NZC_17TO32, -NZC_33TO64,
-};
-struct vp9_token_struct vp9_nzc8x8_encodings[NZC8X8_TOKENS];
+// Model obtained from a 2-sided zero-centerd distribuition derived
+// from a Pareto distribution. The cdf of the distribution is:
+// cdf(x) = 0.5 + 0.5 * sgn(x) * [1 - {alpha/(alpha + |x|)} ^ beta]
+//
+// For a given beta and a given probablity of the 1-node, the alpha
+// is first solved, and then the {alpha, beta} pair is used to generate
+// the probabilities for the rest of the nodes.
-const vp9_tree_index vp9_nzc16x16_tree[2 * NZC16X16_NODES] = {
- -NZC_0, 2,
- 4, 6,
- -NZC_1, -NZC_2,
- 8, 10,
- -NZC_3TO4, -NZC_5TO8,
- 12, 14,
- -NZC_9TO16, -NZC_17TO32,
- -NZC_33TO64, 16,
- -NZC_65TO128, -NZC_129TO256,
-};
-struct vp9_token_struct vp9_nzc16x16_encodings[NZC16X16_TOKENS];
-
-const vp9_tree_index vp9_nzc32x32_tree[2 * NZC32X32_NODES] = {
- -NZC_0, 2,
- 4, 6,
- -NZC_1, -NZC_2,
- 8, 10,
- -NZC_3TO4, -NZC_5TO8,
- 12, 14,
- -NZC_9TO16, -NZC_17TO32,
- 16, 18,
- -NZC_33TO64, -NZC_65TO128,
- -NZC_129TO256, 20,
- -NZC_257TO512, -NZC_513TO1024,
-};
-struct vp9_token_struct vp9_nzc32x32_encodings[NZC32X32_TOKENS];
-
-const int vp9_extranzcbits[NZC32X32_TOKENS] = {
- 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
-};
-
-const int vp9_basenzcvalue[NZC32X32_TOKENS] = {
- 0, 1, 2, 3, 5, 9, 17, 33, 65, 129, 257, 513
-};
-
-#endif // CONFIG_CODE_NONZEROCOUNT
-
-#if CONFIG_MODELCOEFPROB
-
-const vp9_prob vp9_modelcoefprobs_gg875[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
- // Probs generated with a Generalized Gaussian (with shape parameter 0.875)
- // source model with varying quantizer step size for a uniform quantizer
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, // do not use
- {1, 2, 6, 86, 129, 11, 87, 42, 92, 52,},
- {2, 4, 12, 87, 129, 22, 89, 75, 97, 91,},
- {3, 6, 17, 88, 130, 32, 90, 102, 102, 121,},
- {4, 8, 22, 89, 131, 41, 91, 125, 107, 145,},
- {5, 10, 28, 90, 131, 50, 93, 144, 112, 164,},
- {6, 12, 33, 90, 132, 59, 94, 160, 117, 180,},
- {7, 14, 38, 91, 132, 67, 95, 173, 122, 193,},
- {8, 15, 42, 92, 133, 75, 97, 185, 126, 204,},
- {9, 17, 47, 92, 133, 82, 98, 195, 131, 212,},
- {10, 19, 52, 93, 134, 89, 99, 203, 135, 220,},
- {11, 21, 56, 94, 134, 96, 101, 211, 140, 226,},
- {12, 23, 60, 95, 135, 102, 102, 217, 144, 231,},
- {13, 25, 65, 95, 135, 109, 103, 222, 148, 235,},
- {14, 26, 69, 96, 136, 115, 105, 227, 153, 238,},
- {15, 28, 73, 97, 136, 120, 106, 231, 157, 241,},
- {16, 30, 77, 97, 137, 126, 107, 234, 161, 244,},
- {17, 32, 81, 98, 138, 131, 108, 237, 164, 246,},
- {18, 34, 85, 99, 138, 136, 110, 240, 168, 247,},
- {19, 35, 89, 100, 139, 141, 111, 242, 172, 249,},
- {20, 37, 92, 100, 139, 145, 112, 244, 175, 250,},
- {21, 39, 96, 101, 140, 150, 113, 246, 179, 251,},
- {22, 41, 99, 102, 140, 154, 115, 247, 182, 252,},
- {23, 42, 103, 102, 141, 158, 116, 248, 185, 252,},
- {24, 44, 106, 103, 141, 162, 117, 249, 188, 253,},
- {25, 46, 110, 104, 142, 166, 118, 250, 191, 253,},
- {26, 48, 113, 104, 142, 170, 120, 251, 194, 254,},
- {27, 49, 116, 105, 143, 173, 121, 252, 197, 254,},
- {28, 51, 119, 106, 143, 176, 122, 252, 200, 254,},
- {29, 53, 122, 107, 144, 180, 123, 253, 202, 255,},
- {30, 54, 125, 107, 144, 183, 125, 253, 205, 255,},
- {31, 56, 128, 108, 145, 186, 126, 254, 207, 255,},
- {32, 58, 131, 109, 145, 189, 127, 254, 209, 255,},
- {33, 59, 134, 109, 146, 191, 128, 254, 212, 255,},
- {34, 61, 137, 110, 146, 194, 130, 254, 214, 255,},
- {35, 62, 139, 111, 147, 196, 131, 255, 216, 255,},
- {36, 64, 142, 112, 147, 199, 132, 255, 218, 255,},
- {37, 66, 145, 112, 148, 201, 134, 255, 220, 255,},
- {38, 67, 147, 113, 148, 203, 135, 255, 221, 255,},
- {39, 69, 150, 114, 149, 206, 136, 255, 223, 255,},
- {40, 70, 152, 114, 149, 208, 137, 255, 225, 255,},
- {41, 72, 155, 115, 150, 210, 138, 255, 226, 255,},
- {42, 74, 157, 116, 150, 212, 140, 255, 228, 255,},
- {43, 75, 159, 117, 151, 213, 141, 255, 229, 255,},
- {44, 77, 161, 117, 151, 215, 142, 255, 230, 255,},
- {45, 78, 164, 118, 152, 217, 143, 255, 232, 255,},
- {46, 80, 166, 119, 152, 219, 145, 255, 233, 255,},
- {47, 81, 168, 120, 153, 220, 146, 255, 234, 255,},
- {48, 83, 170, 120, 153, 222, 147, 255, 235, 255,},
- {49, 84, 172, 121, 154, 223, 148, 255, 236, 255,},
- {50, 86, 174, 122, 154, 225, 150, 255, 237, 255,},
- {51, 87, 176, 123, 155, 226, 151, 255, 238, 255,},
- {52, 89, 178, 123, 155, 227, 152, 255, 239, 255,},
- {53, 90, 180, 124, 156, 228, 153, 255, 240, 255,},
- {54, 92, 182, 125, 156, 230, 154, 255, 241, 255,},
- {55, 93, 183, 126, 157, 231, 156, 255, 242, 255,},
- {56, 95, 185, 126, 157, 232, 157, 255, 242, 255,},
- {57, 96, 187, 127, 158, 233, 158, 255, 243, 255,},
- {58, 98, 189, 128, 158, 234, 159, 255, 244, 255,},
- {59, 99, 190, 129, 159, 235, 160, 255, 244, 255,},
- {60, 101, 192, 129, 159, 236, 162, 255, 245, 255,},
- {61, 102, 193, 130, 160, 237, 163, 255, 246, 255,},
- {62, 104, 195, 131, 160, 238, 164, 255, 246, 255,},
- {63, 105, 197, 132, 161, 238, 165, 255, 247, 255,},
- {64, 106, 198, 132, 162, 239, 166, 255, 247, 255,},
- {65, 108, 199, 133, 162, 240, 167, 255, 248, 255,},
- {66, 109, 201, 134, 163, 241, 169, 255, 248, 255,},
- {67, 111, 202, 135, 163, 241, 170, 255, 249, 255,},
- {68, 112, 204, 135, 164, 242, 171, 255, 249, 255,},
- {69, 113, 205, 136, 164, 243, 172, 255, 249, 255,},
- {70, 115, 206, 137, 165, 243, 173, 255, 250, 255,},
- {71, 116, 208, 138, 165, 244, 174, 255, 250, 255,},
- {72, 117, 209, 138, 166, 244, 175, 255, 250, 255,},
- {73, 119, 210, 139, 166, 245, 177, 255, 251, 255,},
- {74, 120, 211, 140, 167, 245, 178, 255, 251, 255,},
- {75, 121, 212, 141, 167, 246, 179, 255, 251, 255,},
- {76, 123, 214, 142, 168, 246, 180, 255, 252, 255,},
- {77, 124, 215, 142, 168, 247, 181, 255, 252, 255,},
- {78, 125, 216, 143, 169, 247, 182, 255, 252, 255,},
- {79, 127, 217, 144, 170, 248, 183, 255, 252, 255,},
- {80, 128, 218, 145, 170, 248, 184, 255, 253, 255,},
- {81, 129, 219, 146, 171, 248, 185, 255, 253, 255,},
- {82, 131, 220, 146, 171, 249, 186, 255, 253, 255,},
- {83, 132, 221, 147, 172, 249, 187, 255, 253, 255,},
- {84, 133, 222, 148, 172, 249, 188, 255, 253, 255,},
- {85, 134, 223, 149, 173, 250, 189, 255, 253, 255,},
- {86, 136, 224, 149, 173, 250, 190, 255, 254, 255,},
- {87, 137, 225, 150, 174, 250, 191, 255, 254, 255,},
- {88, 138, 226, 151, 174, 251, 192, 255, 254, 255,},
- {89, 139, 226, 152, 175, 251, 193, 255, 254, 255,},
- {90, 141, 227, 153, 175, 251, 194, 255, 254, 255,},
- {91, 142, 228, 153, 176, 251, 195, 255, 254, 255,},
- {92, 143, 229, 154, 177, 252, 196, 255, 254, 255,},
- {93, 144, 230, 155, 177, 252, 197, 255, 254, 255,},
- {94, 146, 230, 156, 178, 252, 198, 255, 255, 255,},
- {95, 147, 231, 157, 178, 252, 199, 255, 255, 255,},
- {96, 148, 232, 157, 179, 252, 200, 255, 255, 255,},
- {97, 149, 233, 158, 179, 253, 201, 255, 255, 255,},
- {98, 150, 233, 159, 180, 253, 202, 255, 255, 255,},
- {99, 152, 234, 160, 180, 253, 203, 255, 255, 255,},
- {100, 153, 235, 161, 181, 253, 204, 255, 255, 255,},
- {101, 154, 235, 161, 182, 253, 205, 255, 255, 255,},
- {102, 155, 236, 162, 182, 253, 206, 255, 255, 255,},
- {103, 156, 236, 163, 183, 254, 207, 255, 255, 255,},
- {104, 157, 237, 164, 183, 254, 207, 255, 255, 255,},
- {105, 159, 238, 165, 184, 254, 208, 255, 255, 255,},
- {106, 160, 238, 166, 184, 254, 209, 255, 255, 255,},
- {107, 161, 239, 166, 185, 254, 210, 255, 255, 255,},
- {108, 162, 239, 167, 185, 254, 211, 255, 255, 255,},
- {109, 163, 240, 168, 186, 254, 212, 255, 255, 255,},
- {110, 164, 240, 169, 187, 254, 212, 255, 255, 255,},
- {111, 165, 241, 170, 187, 254, 213, 255, 255, 255,},
- {112, 166, 241, 170, 188, 255, 214, 255, 255, 255,},
- {113, 167, 242, 171, 188, 255, 215, 255, 255, 255,},
- {114, 169, 242, 172, 189, 255, 216, 255, 255, 255,},
- {115, 170, 243, 173, 189, 255, 216, 255, 255, 255,},
- {116, 171, 243, 174, 190, 255, 217, 255, 255, 255,},
- {117, 172, 244, 174, 190, 255, 218, 255, 255, 255,},
- {118, 173, 244, 175, 191, 255, 219, 255, 255, 255,},
- {119, 174, 244, 176, 192, 255, 219, 255, 255, 255,},
- {120, 175, 245, 177, 192, 255, 220, 255, 255, 255,},
- {121, 176, 245, 178, 193, 255, 221, 255, 255, 255,},
- {122, 177, 245, 178, 193, 255, 222, 255, 255, 255,},
- {123, 178, 246, 179, 194, 255, 222, 255, 255, 255,},
- {124, 179, 246, 180, 194, 255, 223, 255, 255, 255,},
- {125, 180, 247, 181, 195, 255, 224, 255, 255, 255,},
- {126, 181, 247, 182, 196, 255, 224, 255, 255, 255,},
- {127, 182, 247, 182, 196, 255, 225, 255, 255, 255,},
- {128, 183, 247, 183, 197, 255, 226, 255, 255, 255,},
- {129, 184, 248, 184, 197, 255, 226, 255, 255, 255,},
- {130, 185, 248, 185, 198, 255, 227, 255, 255, 255,},
- {131, 186, 248, 186, 198, 255, 228, 255, 255, 255,},
- {132, 187, 249, 186, 199, 255, 228, 255, 255, 255,},
- {133, 188, 249, 187, 200, 255, 229, 255, 255, 255,},
- {134, 189, 249, 188, 200, 255, 230, 255, 255, 255,},
- {135, 190, 249, 189, 201, 255, 230, 255, 255, 255,},
- {136, 191, 250, 190, 201, 255, 231, 255, 255, 255,},
- {137, 192, 250, 190, 202, 255, 231, 255, 255, 255,},
- {138, 193, 250, 191, 202, 255, 232, 255, 255, 255,},
- {139, 194, 250, 192, 203, 255, 232, 255, 255, 255,},
- {140, 195, 251, 193, 204, 255, 233, 255, 255, 255,},
- {141, 195, 251, 194, 204, 255, 234, 255, 255, 255,},
- {142, 196, 251, 194, 205, 255, 234, 255, 255, 255,},
- {143, 197, 251, 195, 205, 255, 235, 255, 255, 255,},
- {144, 198, 251, 196, 206, 255, 235, 255, 255, 255,},
- {145, 199, 252, 197, 206, 255, 236, 255, 255, 255,},
- {146, 200, 252, 197, 207, 255, 236, 255, 255, 255,},
- {147, 201, 252, 198, 208, 255, 237, 255, 255, 255,},
- {148, 202, 252, 199, 208, 255, 237, 255, 255, 255,},
- {149, 203, 252, 200, 209, 255, 238, 255, 255, 255,},
- {150, 203, 252, 201, 209, 255, 238, 255, 255, 255,},
- {151, 204, 253, 201, 210, 255, 239, 255, 255, 255,},
- {152, 205, 253, 202, 210, 255, 239, 255, 255, 255,},
- {153, 206, 253, 203, 211, 255, 239, 255, 255, 255,},
- {154, 207, 253, 204, 212, 255, 240, 255, 255, 255,},
- {155, 208, 253, 204, 212, 255, 240, 255, 255, 255,},
- {156, 209, 253, 205, 213, 255, 241, 255, 255, 255,},
- {157, 209, 253, 206, 213, 255, 241, 255, 255, 255,},
- {158, 210, 254, 207, 214, 255, 242, 255, 255, 255,},
- {159, 211, 254, 207, 214, 255, 242, 255, 255, 255,},
- {160, 212, 254, 208, 215, 255, 242, 255, 255, 255,},
- {161, 213, 254, 209, 215, 255, 243, 255, 255, 255,},
- {162, 213, 254, 210, 216, 255, 243, 255, 255, 255,},
- {163, 214, 254, 210, 217, 255, 244, 255, 255, 255,},
- {164, 215, 254, 211, 217, 255, 244, 255, 255, 255,},
- {165, 216, 254, 212, 218, 255, 244, 255, 255, 255,},
- {166, 216, 254, 212, 218, 255, 245, 255, 255, 255,},
- {167, 217, 254, 213, 219, 255, 245, 255, 255, 255,},
- {168, 218, 254, 214, 219, 255, 245, 255, 255, 255,},
- {169, 219, 255, 215, 220, 255, 246, 255, 255, 255,},
- {170, 219, 255, 215, 221, 255, 246, 255, 255, 255,},
- {171, 220, 255, 216, 221, 255, 246, 255, 255, 255,},
- {172, 221, 255, 217, 222, 255, 247, 255, 255, 255,},
- {173, 222, 255, 217, 222, 255, 247, 255, 255, 255,},
- {174, 222, 255, 218, 223, 255, 247, 255, 255, 255,},
- {175, 223, 255, 219, 223, 255, 248, 255, 255, 255,},
- {176, 224, 255, 220, 224, 255, 248, 255, 255, 255,},
- {177, 224, 255, 220, 224, 255, 248, 255, 255, 255,},
- {178, 225, 255, 221, 225, 255, 248, 255, 255, 255,},
- {179, 226, 255, 222, 225, 255, 249, 255, 255, 255,},
- {180, 226, 255, 222, 226, 255, 249, 255, 255, 255,},
- {181, 227, 255, 223, 227, 255, 249, 255, 255, 255,},
- {182, 228, 255, 224, 227, 255, 249, 255, 255, 255,},
- {183, 228, 255, 224, 228, 255, 250, 255, 255, 255,},
- {184, 229, 255, 225, 228, 255, 250, 255, 255, 255,},
- {185, 230, 255, 226, 229, 255, 250, 255, 255, 255,},
- {186, 230, 255, 226, 229, 255, 250, 255, 255, 255,},
- {187, 231, 255, 227, 230, 255, 251, 255, 255, 255,},
- {188, 232, 255, 228, 230, 255, 251, 255, 255, 255,},
- {189, 232, 255, 228, 231, 255, 251, 255, 255, 255,},
- {190, 233, 255, 229, 231, 255, 251, 255, 255, 255,},
- {191, 233, 255, 229, 232, 255, 251, 255, 255, 255,},
- {192, 234, 255, 230, 232, 255, 252, 255, 255, 255,},
- {193, 234, 255, 231, 233, 255, 252, 255, 255, 255,},
- {194, 235, 255, 231, 233, 255, 252, 255, 255, 255,},
- {195, 236, 255, 232, 234, 255, 252, 255, 255, 255,},
- {196, 236, 255, 232, 234, 255, 252, 255, 255, 255,},
- {197, 237, 255, 233, 235, 255, 252, 255, 255, 255,},
- {198, 237, 255, 234, 235, 255, 253, 255, 255, 255,},
- {199, 238, 255, 234, 236, 255, 253, 255, 255, 255,},
- {200, 238, 255, 235, 236, 255, 253, 255, 255, 255,},
- {201, 239, 255, 235, 237, 255, 253, 255, 255, 255,},
- {202, 239, 255, 236, 237, 255, 253, 255, 255, 255,},
- {203, 240, 255, 237, 238, 255, 253, 255, 255, 255,},
- {204, 240, 255, 237, 238, 255, 254, 255, 255, 255,},
- {205, 241, 255, 238, 239, 255, 254, 255, 255, 255,},
- {206, 241, 255, 238, 239, 255, 254, 255, 255, 255,},
- {207, 242, 255, 239, 240, 255, 254, 255, 255, 255,},
- {208, 242, 255, 239, 240, 255, 254, 255, 255, 255,},
- {209, 243, 255, 240, 241, 255, 254, 255, 255, 255,},
- {210, 243, 255, 240, 241, 255, 254, 255, 255, 255,},
- {211, 244, 255, 241, 242, 255, 254, 255, 255, 255,},
- {212, 244, 255, 241, 242, 255, 254, 255, 255, 255,},
- {213, 245, 255, 242, 243, 255, 255, 255, 255, 255,},
- {214, 245, 255, 242, 243, 255, 255, 255, 255, 255,},
- {215, 246, 255, 243, 244, 255, 255, 255, 255, 255,},
- {216, 246, 255, 243, 244, 255, 255, 255, 255, 255,},
- {217, 246, 255, 244, 244, 255, 255, 255, 255, 255,},
- {218, 247, 255, 244, 245, 255, 255, 255, 255, 255,},
- {219, 247, 255, 245, 245, 255, 255, 255, 255, 255,},
- {220, 248, 255, 245, 246, 255, 255, 255, 255, 255,},
- {221, 248, 255, 246, 246, 255, 255, 255, 255, 255,},
- {222, 248, 255, 246, 247, 255, 255, 255, 255, 255,},
- {223, 249, 255, 247, 247, 255, 255, 255, 255, 255,},
- {224, 249, 255, 247, 247, 255, 255, 255, 255, 255,},
- {225, 250, 255, 247, 248, 255, 255, 255, 255, 255,},
- {226, 250, 255, 248, 248, 255, 255, 255, 255, 255,},
- {227, 250, 255, 248, 249, 255, 255, 255, 255, 255,},
- {228, 251, 255, 249, 249, 255, 255, 255, 255, 255,},
- {229, 251, 255, 249, 249, 255, 255, 255, 255, 255,},
- {230, 251, 255, 249, 250, 255, 255, 255, 255, 255,},
- {231, 251, 255, 250, 250, 255, 255, 255, 255, 255,},
- {232, 252, 255, 250, 250, 255, 255, 255, 255, 255,},
- {233, 252, 255, 251, 251, 255, 255, 255, 255, 255,},
- {234, 252, 255, 251, 251, 255, 255, 255, 255, 255,},
- {235, 253, 255, 251, 251, 255, 255, 255, 255, 255,},
- {236, 253, 255, 252, 252, 255, 255, 255, 255, 255,},
- {237, 253, 255, 252, 252, 255, 255, 255, 255, 255,},
- {238, 253, 255, 252, 252, 255, 255, 255, 255, 255,},
- {239, 254, 255, 253, 253, 255, 255, 255, 255, 255,},
- {240, 254, 255, 253, 253, 255, 255, 255, 255, 255,},
- {241, 254, 255, 253, 253, 255, 255, 255, 255, 255,},
- {242, 254, 255, 253, 254, 255, 255, 255, 255, 255,},
- {243, 254, 255, 254, 254, 255, 255, 255, 255, 255,},
- {244, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
- {245, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
- {246, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
- {247, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {248, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {249, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {250, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {251, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {252, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {253, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
-};
-
-const vp9_prob vp9_modelcoefprobs_gg75[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
- // Probs generated with a Generalized Gaussian (with shape parameter 0.75)
- // source model with varying quantizer step size for a uniform quantizer
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, // do not use
- {1, 2, 6, 87, 129, 11, 88, 39, 93, 47,},
- {2, 4, 11, 88, 130, 21, 89, 68, 98, 79,},
- {3, 6, 16, 89, 131, 30, 91, 92, 103, 105,},
- {4, 8, 21, 90, 131, 38, 92, 112, 107, 126,},
- {5, 10, 26, 90, 132, 46, 94, 129, 111, 143,},
- {6, 11, 31, 91, 133, 54, 95, 143, 115, 157,},
- {7, 13, 35, 92, 133, 61, 96, 156, 119, 170,},
- {8, 15, 40, 93, 134, 68, 97, 167, 123, 180,},
- {9, 17, 44, 94, 134, 74, 98, 177, 126, 189,},
- {10, 19, 48, 94, 135, 80, 100, 185, 130, 197,},
- {11, 20, 52, 95, 135, 86, 101, 192, 133, 204,},
- {12, 22, 56, 96, 136, 92, 102, 199, 137, 210,},
- {13, 24, 60, 96, 136, 97, 103, 205, 140, 215,},
- {14, 26, 64, 97, 137, 103, 104, 210, 143, 219,},
- {15, 27, 68, 98, 137, 108, 105, 215, 146, 223,},
- {16, 29, 71, 98, 138, 112, 106, 219, 149, 227,},
- {17, 31, 75, 99, 138, 117, 107, 223, 152, 230,},
- {18, 32, 78, 100, 139, 121, 108, 226, 155, 233,},
- {19, 34, 82, 100, 139, 126, 109, 229, 158, 235,},
- {20, 36, 85, 101, 140, 130, 110, 231, 161, 238,},
- {21, 37, 88, 102, 140, 134, 111, 234, 164, 239,},
- {22, 39, 91, 102, 141, 138, 112, 236, 167, 241,},
- {23, 40, 94, 103, 141, 141, 113, 238, 169, 243,},
- {24, 42, 97, 104, 142, 145, 114, 240, 172, 244,},
- {25, 44, 100, 104, 142, 149, 115, 241, 174, 245,},
- {26, 45, 103, 105, 143, 152, 116, 243, 177, 246,},
- {27, 47, 106, 105, 143, 155, 117, 244, 179, 247,},
- {28, 48, 109, 106, 143, 158, 118, 245, 182, 248,},
- {29, 50, 112, 107, 144, 161, 119, 246, 184, 249,},
- {30, 52, 115, 107, 144, 164, 120, 247, 186, 250,},
- {31, 53, 117, 108, 145, 167, 121, 248, 188, 250,},
- {32, 55, 120, 109, 145, 170, 122, 249, 190, 251,},
- {33, 56, 122, 109, 146, 173, 123, 249, 192, 252,},
- {34, 58, 125, 110, 146, 175, 124, 250, 194, 252,},
- {35, 59, 127, 110, 147, 178, 125, 251, 196, 252,},
- {36, 61, 130, 111, 147, 180, 126, 251, 198, 253,},
- {37, 62, 132, 112, 147, 183, 127, 251, 200, 253,},
- {38, 64, 135, 112, 148, 185, 128, 252, 202, 253,},
- {39, 65, 137, 113, 148, 187, 129, 252, 204, 254,},
- {40, 67, 139, 114, 149, 189, 130, 253, 205, 254,},
- {41, 68, 141, 114, 149, 191, 131, 253, 207, 254,},
- {42, 70, 144, 115, 150, 193, 132, 253, 209, 254,},
- {43, 71, 146, 115, 150, 195, 133, 254, 210, 254,},
- {44, 72, 148, 116, 151, 197, 134, 254, 212, 255,},
- {45, 74, 150, 117, 151, 199, 135, 254, 213, 255,},
- {46, 75, 152, 117, 151, 201, 136, 254, 215, 255,},
- {47, 77, 154, 118, 152, 202, 137, 254, 216, 255,},
- {48, 78, 156, 119, 152, 204, 138, 254, 217, 255,},
- {49, 80, 158, 119, 153, 206, 139, 255, 219, 255,},
- {50, 81, 160, 120, 153, 207, 140, 255, 220, 255,},
- {51, 82, 162, 120, 154, 209, 141, 255, 221, 255,},
- {52, 84, 164, 121, 154, 210, 142, 255, 222, 255,},
- {53, 85, 165, 122, 155, 212, 143, 255, 224, 255,},
- {54, 87, 167, 122, 155, 213, 144, 255, 225, 255,},
- {55, 88, 169, 123, 155, 215, 145, 255, 226, 255,},
- {56, 89, 171, 124, 156, 216, 146, 255, 227, 255,},
- {57, 91, 172, 124, 156, 217, 146, 255, 228, 255,},
- {58, 92, 174, 125, 157, 218, 147, 255, 229, 255,},
- {59, 93, 176, 126, 157, 220, 148, 255, 230, 255,},
- {60, 95, 177, 126, 158, 221, 149, 255, 231, 255,},
- {61, 96, 179, 127, 158, 222, 150, 255, 232, 255,},
- {62, 97, 180, 127, 159, 223, 151, 255, 232, 255,},
- {63, 99, 182, 128, 159, 224, 152, 255, 233, 255,},
- {64, 100, 183, 129, 159, 225, 153, 255, 234, 255,},
- {65, 101, 185, 129, 160, 226, 154, 255, 235, 255,},
- {66, 103, 186, 130, 160, 227, 155, 255, 236, 255,},
- {67, 104, 188, 131, 161, 228, 156, 255, 236, 255,},
- {68, 105, 189, 131, 161, 229, 157, 255, 237, 255,},
- {69, 106, 190, 132, 162, 230, 158, 255, 238, 255,},
- {70, 108, 192, 133, 162, 231, 159, 255, 238, 255,},
- {71, 109, 193, 133, 162, 231, 159, 255, 239, 255,},
- {72, 110, 194, 134, 163, 232, 160, 255, 240, 255,},
- {73, 111, 196, 134, 163, 233, 161, 255, 240, 255,},
- {74, 113, 197, 135, 164, 234, 162, 255, 241, 255,},
- {75, 114, 198, 136, 164, 235, 163, 255, 241, 255,},
- {76, 115, 199, 136, 165, 235, 164, 255, 242, 255,},
- {77, 116, 200, 137, 165, 236, 165, 255, 243, 255,},
- {78, 118, 202, 138, 166, 237, 166, 255, 243, 255,},
- {79, 119, 203, 138, 166, 237, 167, 255, 244, 255,},
- {80, 120, 204, 139, 167, 238, 168, 255, 244, 255,},
- {81, 121, 205, 140, 167, 239, 168, 255, 244, 255,},
- {82, 123, 206, 140, 167, 239, 169, 255, 245, 255,},
- {83, 124, 207, 141, 168, 240, 170, 255, 245, 255,},
- {84, 125, 208, 142, 168, 240, 171, 255, 246, 255,},
- {85, 126, 209, 142, 169, 241, 172, 255, 246, 255,},
- {86, 127, 210, 143, 169, 241, 173, 255, 247, 255,},
- {87, 129, 211, 144, 170, 242, 174, 255, 247, 255,},
- {88, 130, 212, 144, 170, 242, 175, 255, 247, 255,},
- {89, 131, 213, 145, 171, 243, 175, 255, 248, 255,},
- {90, 132, 214, 146, 171, 243, 176, 255, 248, 255,},
- {91, 133, 215, 146, 171, 244, 177, 255, 248, 255,},
- {92, 134, 216, 147, 172, 244, 178, 255, 249, 255,},
- {93, 136, 217, 148, 172, 245, 179, 255, 249, 255,},
- {94, 137, 218, 148, 173, 245, 180, 255, 249, 255,},
- {95, 138, 219, 149, 173, 245, 181, 255, 249, 255,},
- {96, 139, 220, 150, 174, 246, 181, 255, 250, 255,},
- {97, 140, 220, 150, 174, 246, 182, 255, 250, 255,},
- {98, 141, 221, 151, 175, 247, 183, 255, 250, 255,},
- {99, 142, 222, 152, 175, 247, 184, 255, 250, 255,},
- {100, 144, 223, 152, 176, 247, 185, 255, 251, 255,},
- {101, 145, 224, 153, 176, 248, 186, 255, 251, 255,},
- {102, 146, 224, 154, 177, 248, 186, 255, 251, 255,},
- {103, 147, 225, 154, 177, 248, 187, 255, 251, 255,},
- {104, 148, 226, 155, 177, 248, 188, 255, 252, 255,},
- {105, 149, 226, 156, 178, 249, 189, 255, 252, 255,},
- {106, 150, 227, 156, 178, 249, 190, 255, 252, 255,},
- {107, 151, 228, 157, 179, 249, 191, 255, 252, 255,},
- {108, 152, 229, 158, 179, 250, 191, 255, 252, 255,},
- {109, 153, 229, 158, 180, 250, 192, 255, 252, 255,},
- {110, 154, 230, 159, 180, 250, 193, 255, 253, 255,},
- {111, 155, 231, 160, 181, 250, 194, 255, 253, 255,},
- {112, 157, 231, 160, 181, 251, 195, 255, 253, 255,},
- {113, 158, 232, 161, 182, 251, 195, 255, 253, 255,},
- {114, 159, 232, 162, 182, 251, 196, 255, 253, 255,},
- {115, 160, 233, 162, 183, 251, 197, 255, 253, 255,},
- {116, 161, 234, 163, 183, 251, 198, 255, 253, 255,},
- {117, 162, 234, 164, 184, 252, 198, 255, 254, 255,},
- {118, 163, 235, 165, 184, 252, 199, 255, 254, 255,},
- {119, 164, 235, 165, 185, 252, 200, 255, 254, 255,},
- {120, 165, 236, 166, 185, 252, 201, 255, 254, 255,},
- {121, 166, 236, 167, 186, 252, 201, 255, 254, 255,},
- {122, 167, 237, 167, 186, 252, 202, 255, 254, 255,},
- {123, 168, 237, 168, 186, 253, 203, 255, 254, 255,},
- {124, 169, 238, 169, 187, 253, 204, 255, 254, 255,},
- {125, 170, 238, 169, 187, 253, 204, 255, 254, 255,},
- {126, 171, 239, 170, 188, 253, 205, 255, 254, 255,},
- {127, 172, 239, 171, 188, 253, 206, 255, 254, 255,},
- {128, 173, 240, 171, 189, 253, 207, 255, 255, 255,},
- {129, 174, 240, 172, 189, 253, 207, 255, 255, 255,},
- {130, 175, 241, 173, 190, 253, 208, 255, 255, 255,},
- {131, 176, 241, 174, 190, 254, 209, 255, 255, 255,},
- {132, 177, 241, 174, 191, 254, 209, 255, 255, 255,},
- {133, 178, 242, 175, 191, 254, 210, 255, 255, 255,},
- {134, 179, 242, 176, 192, 254, 211, 255, 255, 255,},
- {135, 180, 243, 176, 192, 254, 212, 255, 255, 255,},
- {136, 180, 243, 177, 193, 254, 212, 255, 255, 255,},
- {137, 181, 243, 178, 193, 254, 213, 255, 255, 255,},
- {138, 182, 244, 179, 194, 254, 214, 255, 255, 255,},
- {139, 183, 244, 179, 194, 254, 214, 255, 255, 255,},
- {140, 184, 244, 180, 195, 254, 215, 255, 255, 255,},
- {141, 185, 245, 181, 195, 254, 216, 255, 255, 255,},
- {142, 186, 245, 181, 196, 255, 216, 255, 255, 255,},
- {143, 187, 245, 182, 196, 255, 217, 255, 255, 255,},
- {144, 188, 246, 183, 197, 255, 218, 255, 255, 255,},
- {145, 189, 246, 183, 197, 255, 218, 255, 255, 255,},
- {146, 190, 246, 184, 198, 255, 219, 255, 255, 255,},
- {147, 191, 247, 185, 198, 255, 220, 255, 255, 255,},
- {148, 191, 247, 186, 199, 255, 220, 255, 255, 255,},
- {149, 192, 247, 186, 199, 255, 221, 255, 255, 255,},
- {150, 193, 248, 187, 200, 255, 221, 255, 255, 255,},
- {151, 194, 248, 188, 200, 255, 222, 255, 255, 255,},
- {152, 195, 248, 188, 201, 255, 223, 255, 255, 255,},
- {153, 196, 248, 189, 201, 255, 223, 255, 255, 255,},
- {154, 197, 249, 190, 202, 255, 224, 255, 255, 255,},
- {155, 198, 249, 191, 202, 255, 224, 255, 255, 255,},
- {156, 198, 249, 191, 203, 255, 225, 255, 255, 255,},
- {157, 199, 249, 192, 203, 255, 226, 255, 255, 255,},
- {158, 200, 250, 193, 204, 255, 226, 255, 255, 255,},
- {159, 201, 250, 193, 204, 255, 227, 255, 255, 255,},
- {160, 202, 250, 194, 205, 255, 227, 255, 255, 255,},
- {161, 203, 250, 195, 206, 255, 228, 255, 255, 255,},
- {162, 203, 250, 196, 206, 255, 228, 255, 255, 255,},
- {163, 204, 251, 196, 207, 255, 229, 255, 255, 255,},
- {164, 205, 251, 197, 207, 255, 229, 255, 255, 255,},
- {165, 206, 251, 198, 208, 255, 230, 255, 255, 255,},
- {166, 207, 251, 198, 208, 255, 231, 255, 255, 255,},
- {167, 207, 251, 199, 209, 255, 231, 255, 255, 255,},
- {168, 208, 252, 200, 209, 255, 232, 255, 255, 255,},
- {169, 209, 252, 201, 210, 255, 232, 255, 255, 255,},
- {170, 210, 252, 201, 210, 255, 233, 255, 255, 255,},
- {171, 211, 252, 202, 211, 255, 233, 255, 255, 255,},
- {172, 211, 252, 203, 211, 255, 234, 255, 255, 255,},
- {173, 212, 252, 203, 212, 255, 234, 255, 255, 255,},
- {174, 213, 252, 204, 212, 255, 235, 255, 255, 255,},
- {175, 214, 253, 205, 213, 255, 235, 255, 255, 255,},
- {176, 214, 253, 206, 213, 255, 236, 255, 255, 255,},
- {177, 215, 253, 206, 214, 255, 236, 255, 255, 255,},
- {178, 216, 253, 207, 214, 255, 237, 255, 255, 255,},
- {179, 217, 253, 208, 215, 255, 237, 255, 255, 255,},
- {180, 217, 253, 208, 216, 255, 237, 255, 255, 255,},
- {181, 218, 253, 209, 216, 255, 238, 255, 255, 255,},
- {182, 219, 254, 210, 217, 255, 238, 255, 255, 255,},
- {183, 220, 254, 211, 217, 255, 239, 255, 255, 255,},
- {184, 220, 254, 211, 218, 255, 239, 255, 255, 255,},
- {185, 221, 254, 212, 218, 255, 240, 255, 255, 255,},
- {186, 222, 254, 213, 219, 255, 240, 255, 255, 255,},
- {187, 222, 254, 213, 219, 255, 241, 255, 255, 255,},
- {188, 223, 254, 214, 220, 255, 241, 255, 255, 255,},
- {189, 224, 254, 215, 220, 255, 241, 255, 255, 255,},
- {190, 225, 254, 215, 221, 255, 242, 255, 255, 255,},
- {191, 225, 254, 216, 221, 255, 242, 255, 255, 255,},
- {192, 226, 254, 217, 222, 255, 243, 255, 255, 255,},
- {193, 227, 255, 218, 223, 255, 243, 255, 255, 255,},
- {194, 227, 255, 218, 223, 255, 243, 255, 255, 255,},
- {195, 228, 255, 219, 224, 255, 244, 255, 255, 255,},
- {196, 229, 255, 220, 224, 255, 244, 255, 255, 255,},
- {197, 229, 255, 220, 225, 255, 244, 255, 255, 255,},
- {198, 230, 255, 221, 225, 255, 245, 255, 255, 255,},
- {199, 230, 255, 222, 226, 255, 245, 255, 255, 255,},
- {200, 231, 255, 222, 226, 255, 246, 255, 255, 255,},
- {201, 232, 255, 223, 227, 255, 246, 255, 255, 255,},
- {202, 232, 255, 224, 228, 255, 246, 255, 255, 255,},
- {203, 233, 255, 224, 228, 255, 247, 255, 255, 255,},
- {204, 234, 255, 225, 229, 255, 247, 255, 255, 255,},
- {205, 234, 255, 226, 229, 255, 247, 255, 255, 255,},
- {206, 235, 255, 227, 230, 255, 248, 255, 255, 255,},
- {207, 235, 255, 227, 230, 255, 248, 255, 255, 255,},
- {208, 236, 255, 228, 231, 255, 248, 255, 255, 255,},
- {209, 237, 255, 229, 231, 255, 248, 255, 255, 255,},
- {210, 237, 255, 229, 232, 255, 249, 255, 255, 255,},
- {211, 238, 255, 230, 233, 255, 249, 255, 255, 255,},
- {212, 238, 255, 231, 233, 255, 249, 255, 255, 255,},
- {213, 239, 255, 231, 234, 255, 250, 255, 255, 255,},
- {214, 239, 255, 232, 234, 255, 250, 255, 255, 255,},
- {215, 240, 255, 233, 235, 255, 250, 255, 255, 255,},
- {216, 241, 255, 233, 235, 255, 250, 255, 255, 255,},
- {217, 241, 255, 234, 236, 255, 251, 255, 255, 255,},
- {218, 242, 255, 235, 236, 255, 251, 255, 255, 255,},
- {219, 242, 255, 235, 237, 255, 251, 255, 255, 255,},
- {220, 243, 255, 236, 237, 255, 251, 255, 255, 255,},
- {221, 243, 255, 236, 238, 255, 252, 255, 255, 255,},
- {222, 244, 255, 237, 239, 255, 252, 255, 255, 255,},
- {223, 244, 255, 238, 239, 255, 252, 255, 255, 255,},
- {224, 245, 255, 238, 240, 255, 252, 255, 255, 255,},
- {225, 245, 255, 239, 240, 255, 252, 255, 255, 255,},
- {226, 246, 255, 240, 241, 255, 253, 255, 255, 255,},
- {227, 246, 255, 240, 241, 255, 253, 255, 255, 255,},
- {228, 247, 255, 241, 242, 255, 253, 255, 255, 255,},
- {229, 247, 255, 242, 242, 255, 253, 255, 255, 255,},
- {230, 248, 255, 242, 243, 255, 253, 255, 255, 255,},
- {231, 248, 255, 243, 244, 255, 254, 255, 255, 255,},
- {232, 248, 255, 243, 244, 255, 254, 255, 255, 255,},
- {233, 249, 255, 244, 245, 255, 254, 255, 255, 255,},
- {234, 249, 255, 245, 245, 255, 254, 255, 255, 255,},
- {235, 250, 255, 245, 246, 255, 254, 255, 255, 255,},
- {236, 250, 255, 246, 246, 255, 254, 255, 255, 255,},
- {237, 251, 255, 246, 247, 255, 255, 255, 255, 255,},
- {238, 251, 255, 247, 247, 255, 255, 255, 255, 255,},
- {239, 251, 255, 248, 248, 255, 255, 255, 255, 255,},
- {240, 252, 255, 248, 248, 255, 255, 255, 255, 255,},
- {241, 252, 255, 249, 249, 255, 255, 255, 255, 255,},
- {242, 252, 255, 249, 249, 255, 255, 255, 255, 255,},
- {243, 253, 255, 250, 250, 255, 255, 255, 255, 255,},
- {244, 253, 255, 250, 250, 255, 255, 255, 255, 255,},
- {245, 253, 255, 251, 251, 255, 255, 255, 255, 255,},
- {246, 254, 255, 251, 251, 255, 255, 255, 255, 255,},
- {247, 254, 255, 252, 252, 255, 255, 255, 255, 255,},
- {248, 254, 255, 252, 252, 255, 255, 255, 255, 255,},
- {249, 255, 255, 253, 253, 255, 255, 255, 255, 255,},
- {250, 255, 255, 253, 253, 255, 255, 255, 255, 255,},
- {251, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
- {252, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
- {253, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {254, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
- {255, 255, 255, 255, 255, 255, 255, 255, 255, 255,}
-};
-
-const vp9_prob vp9_modelcoefprobs_gg625[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
- // Probs generated with a Generalized Gaussian (with shape parameter 0.625)
- // source model with varying quantizer step size for a uniform quantizer
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, // do not use
- {1, 2, 6, 88, 130, 10, 88, 35, 94, 40,},
- {2, 4, 11, 89, 131, 19, 90, 60, 99, 67,},
- {3, 6, 15, 90, 132, 27, 92, 80, 103, 88,},
- {4, 7, 20, 91, 132, 34, 93, 97, 107, 105,},
- {5, 9, 24, 92, 133, 41, 94, 112, 110, 120,},
- {6, 11, 28, 93, 134, 48, 95, 125, 113, 132,},
- {7, 13, 33, 93, 134, 54, 97, 136, 116, 143,},
- {8, 14, 36, 94, 135, 60, 98, 146, 119, 152,},
- {9, 16, 40, 95, 135, 65, 99, 155, 122, 161,},
- {10, 18, 44, 95, 136, 70, 100, 163, 125, 168,},
- {11, 19, 48, 96, 136, 75, 101, 170, 127, 175,},
- {12, 21, 51, 97, 137, 80, 102, 176, 130, 181,},
- {13, 23, 55, 97, 137, 85, 102, 182, 132, 187,},
- {14, 24, 58, 98, 138, 89, 103, 188, 135, 192,},
- {15, 26, 61, 99, 138, 94, 104, 193, 137, 196,},
- {16, 27, 64, 99, 139, 98, 105, 197, 140, 201,},
- {17, 29, 67, 100, 139, 102, 106, 201, 142, 205,},
- {18, 30, 70, 101, 140, 106, 107, 205, 144, 208,},
- {19, 32, 73, 101, 140, 109, 108, 209, 146, 211,},
- {20, 34, 76, 102, 140, 113, 109, 212, 148, 214,},
- {21, 35, 79, 102, 141, 116, 109, 215, 151, 217,},
- {22, 37, 82, 103, 141, 120, 110, 218, 153, 220,},
- {23, 38, 85, 103, 142, 123, 111, 220, 155, 222,},
- {24, 40, 87, 104, 142, 126, 112, 223, 157, 224,},
- {25, 41, 90, 105, 143, 129, 113, 225, 159, 226,},
- {26, 42, 93, 105, 143, 132, 113, 227, 161, 228,},
- {27, 44, 95, 106, 143, 135, 114, 229, 162, 230,},
- {28, 45, 98, 106, 144, 138, 115, 230, 164, 232,},
- {29, 47, 100, 107, 144, 141, 116, 232, 166, 233,},
- {30, 48, 103, 107, 145, 144, 117, 234, 168, 235,},
- {31, 50, 105, 108, 145, 146, 117, 235, 170, 236,},
- {32, 51, 107, 108, 145, 149, 118, 236, 171, 237,},
- {33, 52, 110, 109, 146, 151, 119, 238, 173, 238,},
- {34, 54, 112, 110, 146, 154, 120, 239, 175, 239,},
- {35, 55, 114, 110, 147, 156, 120, 240, 176, 240,},
- {36, 57, 116, 111, 147, 158, 121, 241, 178, 241,},
- {37, 58, 119, 111, 147, 161, 122, 242, 180, 242,},
- {38, 59, 121, 112, 148, 163, 123, 243, 181, 243,},
- {39, 61, 123, 112, 148, 165, 123, 244, 183, 244,},
- {40, 62, 125, 113, 148, 167, 124, 244, 184, 245,},
- {41, 63, 127, 113, 149, 169, 125, 245, 186, 245,},
- {42, 65, 129, 114, 149, 171, 126, 246, 187, 246,},
- {43, 66, 131, 114, 150, 173, 126, 246, 188, 247,},
- {44, 67, 133, 115, 150, 175, 127, 247, 190, 247,},
- {45, 69, 135, 115, 150, 177, 128, 247, 191, 248,},
- {46, 70, 136, 116, 151, 178, 129, 248, 193, 248,},
- {47, 71, 138, 116, 151, 180, 129, 248, 194, 249,},
- {48, 73, 140, 117, 151, 182, 130, 249, 195, 249,},
- {49, 74, 142, 118, 152, 184, 131, 249, 197, 250,},
- {50, 75, 144, 118, 152, 185, 131, 250, 198, 250,},
- {51, 76, 145, 119, 153, 187, 132, 250, 199, 250,},
- {52, 78, 147, 119, 153, 188, 133, 251, 200, 251,},
- {53, 79, 149, 120, 153, 190, 134, 251, 201, 251,},
- {54, 80, 151, 120, 154, 192, 134, 251, 203, 251,},
- {55, 82, 152, 121, 154, 193, 135, 251, 204, 252,},
- {56, 83, 154, 121, 154, 194, 136, 252, 205, 252,},
- {57, 84, 155, 122, 155, 196, 136, 252, 206, 252,},
- {58, 85, 157, 122, 155, 197, 137, 252, 207, 252,},
- {59, 86, 158, 123, 156, 199, 138, 252, 208, 252,},
- {60, 88, 160, 123, 156, 200, 139, 253, 209, 253,},
- {61, 89, 162, 124, 156, 201, 139, 253, 210, 253,},
- {62, 90, 163, 124, 157, 202, 140, 253, 211, 253,},
- {63, 91, 164, 125, 157, 204, 141, 253, 212, 253,},
- {64, 93, 166, 125, 157, 205, 141, 253, 213, 253,},
- {65, 94, 167, 126, 158, 206, 142, 254, 214, 254,},
- {66, 95, 169, 126, 158, 207, 143, 254, 215, 254,},
- {67, 96, 170, 127, 158, 208, 143, 254, 216, 254,},
- {68, 97, 172, 127, 159, 209, 144, 254, 217, 254,},
- {69, 98, 173, 128, 159, 210, 145, 254, 218, 254,},
- {70, 100, 174, 128, 160, 212, 146, 254, 219, 254,},
- {71, 101, 176, 129, 160, 213, 146, 254, 220, 254,},
- {72, 102, 177, 130, 160, 214, 147, 254, 220, 254,},
- {73, 103, 178, 130, 161, 215, 148, 255, 221, 255,},
- {74, 104, 179, 131, 161, 216, 148, 255, 222, 255,},
- {75, 105, 181, 131, 161, 217, 149, 255, 223, 255,},
- {76, 107, 182, 132, 162, 217, 150, 255, 224, 255,},
- {77, 108, 183, 132, 162, 218, 150, 255, 224, 255,},
- {78, 109, 184, 133, 163, 219, 151, 255, 225, 255,},
- {79, 110, 185, 133, 163, 220, 152, 255, 226, 255,},
- {80, 111, 187, 134, 163, 221, 153, 255, 227, 255,},
- {81, 112, 188, 134, 164, 222, 153, 255, 227, 255,},
- {82, 113, 189, 135, 164, 223, 154, 255, 228, 255,},
- {83, 115, 190, 135, 164, 223, 155, 255, 229, 255,},
- {84, 116, 191, 136, 165, 224, 155, 255, 229, 255,},
- {85, 117, 192, 136, 165, 225, 156, 255, 230, 255,},
- {86, 118, 193, 137, 165, 226, 157, 255, 231, 255,},
- {87, 119, 194, 137, 166, 226, 157, 255, 231, 255,},
- {88, 120, 195, 138, 166, 227, 158, 255, 232, 255,},
- {89, 121, 196, 139, 167, 228, 159, 255, 232, 255,},
- {90, 122, 197, 139, 167, 229, 159, 255, 233, 255,},
- {91, 123, 198, 140, 167, 229, 160, 255, 234, 255,},
- {92, 124, 199, 140, 168, 230, 161, 255, 234, 255,},
- {93, 125, 200, 141, 168, 231, 162, 255, 235, 255,},
- {94, 127, 201, 141, 168, 231, 162, 255, 235, 255,},
- {95, 128, 202, 142, 169, 232, 163, 255, 236, 255,},
- {96, 129, 203, 142, 169, 232, 164, 255, 236, 255,},
- {97, 130, 204, 143, 170, 233, 164, 255, 237, 255,},
- {98, 131, 205, 143, 170, 234, 165, 255, 237, 255,},
- {99, 132, 206, 144, 170, 234, 166, 255, 238, 255,},
- {100, 133, 207, 144, 171, 235, 166, 255, 238, 255,},
- {101, 134, 208, 145, 171, 235, 167, 255, 239, 255,},
- {102, 135, 209, 146, 171, 236, 168, 255, 239, 255,},
- {103, 136, 209, 146, 172, 236, 168, 255, 240, 255,},
- {104, 137, 210, 147, 172, 237, 169, 255, 240, 255,},
- {105, 138, 211, 147, 173, 237, 170, 255, 240, 255,},
- {106, 139, 212, 148, 173, 238, 170, 255, 241, 255,},
- {107, 140, 213, 148, 173, 238, 171, 255, 241, 255,},
- {108, 141, 213, 149, 174, 239, 172, 255, 242, 255,},
- {109, 142, 214, 149, 174, 239, 172, 255, 242, 255,},
- {110, 143, 215, 150, 175, 240, 173, 255, 242, 255,},
- {111, 144, 216, 151, 175, 240, 174, 255, 243, 255,},
- {112, 145, 217, 151, 175, 240, 174, 255, 243, 255,},
- {113, 146, 217, 152, 176, 241, 175, 255, 244, 255,},
- {114, 147, 218, 152, 176, 241, 176, 255, 244, 255,},
- {115, 148, 219, 153, 176, 242, 177, 255, 244, 255,},
- {116, 149, 219, 153, 177, 242, 177, 255, 245, 255,},
- {117, 150, 220, 154, 177, 242, 178, 255, 245, 255,},
- {118, 151, 221, 155, 178, 243, 179, 255, 245, 255,},
- {119, 152, 222, 155, 178, 243, 179, 255, 245, 255,},
- {120, 153, 222, 156, 178, 244, 180, 255, 246, 255,},
- {121, 154, 223, 156, 179, 244, 181, 255, 246, 255,},
- {122, 155, 224, 157, 179, 244, 181, 255, 246, 255,},
- {123, 156, 224, 157, 180, 245, 182, 255, 247, 255,},
- {124, 157, 225, 158, 180, 245, 183, 255, 247, 255,},
- {125, 158, 225, 159, 180, 245, 183, 255, 247, 255,},
- {126, 159, 226, 159, 181, 246, 184, 255, 247, 255,},
- {127, 160, 227, 160, 181, 246, 185, 255, 248, 255,},
- {128, 161, 227, 160, 182, 246, 185, 255, 248, 255,},
- {129, 162, 228, 161, 182, 246, 186, 255, 248, 255,},
- {130, 163, 228, 161, 182, 247, 187, 255, 248, 255,},
- {131, 164, 229, 162, 183, 247, 187, 255, 249, 255,},
- {132, 165, 230, 163, 183, 247, 188, 255, 249, 255,},
- {133, 166, 230, 163, 184, 248, 189, 255, 249, 255,},
- {134, 166, 231, 164, 184, 248, 189, 255, 249, 255,},
- {135, 167, 231, 164, 184, 248, 190, 255, 250, 255,},
- {136, 168, 232, 165, 185, 248, 191, 255, 250, 255,},
- {137, 169, 232, 166, 185, 248, 191, 255, 250, 255,},
- {138, 170, 233, 166, 186, 249, 192, 255, 250, 255,},
- {139, 171, 233, 167, 186, 249, 192, 255, 250, 255,},
- {140, 172, 234, 167, 187, 249, 193, 255, 251, 255,},
- {141, 173, 234, 168, 187, 249, 194, 255, 251, 255,},
- {142, 174, 235, 169, 187, 250, 194, 255, 251, 255,},
- {143, 175, 235, 169, 188, 250, 195, 255, 251, 255,},
- {144, 176, 236, 170, 188, 250, 196, 255, 251, 255,},
- {145, 177, 236, 170, 189, 250, 196, 255, 251, 255,},
- {146, 177, 237, 171, 189, 250, 197, 255, 252, 255,},
- {147, 178, 237, 172, 189, 251, 198, 255, 252, 255,},
- {148, 179, 238, 172, 190, 251, 198, 255, 252, 255,},
- {149, 180, 238, 173, 190, 251, 199, 255, 252, 255,},
- {150, 181, 238, 173, 191, 251, 200, 255, 252, 255,},
- {151, 182, 239, 174, 191, 251, 200, 255, 252, 255,},
- {152, 183, 239, 175, 192, 251, 201, 255, 252, 255,},
- {153, 184, 240, 175, 192, 252, 202, 255, 252, 255,},
- {154, 184, 240, 176, 193, 252, 202, 255, 253, 255,},
- {155, 185, 240, 177, 193, 252, 203, 255, 253, 255,},
- {156, 186, 241, 177, 193, 252, 203, 255, 253, 255,},
- {157, 187, 241, 178, 194, 252, 204, 255, 253, 255,},
- {158, 188, 242, 178, 194, 252, 205, 255, 253, 255,},
- {159, 189, 242, 179, 195, 252, 205, 255, 253, 255,},
- {160, 190, 242, 180, 195, 253, 206, 255, 253, 255,},
- {161, 190, 243, 180, 196, 253, 207, 255, 253, 255,},
- {162, 191, 243, 181, 196, 253, 207, 255, 254, 255,},
- {163, 192, 243, 182, 197, 253, 208, 255, 254, 255,},
- {164, 193, 244, 182, 197, 253, 209, 255, 254, 255,},
- {165, 194, 244, 183, 197, 253, 209, 255, 254, 255,},
- {166, 195, 244, 184, 198, 253, 210, 255, 254, 255,},
- {167, 196, 245, 184, 198, 253, 210, 255, 254, 255,},
- {168, 196, 245, 185, 199, 253, 211, 255, 254, 255,},
- {169, 197, 245, 186, 199, 254, 212, 255, 254, 255,},
- {170, 198, 246, 186, 200, 254, 212, 255, 254, 255,},
- {171, 199, 246, 187, 200, 254, 213, 255, 254, 255,},
- {172, 200, 246, 188, 201, 254, 214, 255, 254, 255,},
- {173, 200, 246, 188, 201, 254, 214, 255, 254, 255,},
- {174, 201, 247, 189, 202, 254, 215, 255, 254, 255,},
- {175, 202, 247, 189, 202, 254, 215, 255, 255, 255,},
- {176, 203, 247, 190, 203, 254, 216, 255, 255, 255,},
- {177, 204, 248, 191, 203, 254, 217, 255, 255, 255,},
- {178, 204, 248, 191, 204, 254, 217, 255, 255, 255,},
- {179, 205, 248, 192, 204, 254, 218, 255, 255, 255,},
- {180, 206, 248, 193, 204, 254, 218, 255, 255, 255,},
- {181, 207, 249, 194, 205, 255, 219, 255, 255, 255,},
- {182, 208, 249, 194, 205, 255, 220, 255, 255, 255,},
- {183, 208, 249, 195, 206, 255, 220, 255, 255, 255,},
- {184, 209, 249, 196, 206, 255, 221, 255, 255, 255,},
- {185, 210, 250, 196, 207, 255, 221, 255, 255, 255,},
- {186, 211, 250, 197, 207, 255, 222, 255, 255, 255,},
- {187, 211, 250, 198, 208, 255, 223, 255, 255, 255,},
- {188, 212, 250, 198, 208, 255, 223, 255, 255, 255,},
- {189, 213, 250, 199, 209, 255, 224, 255, 255, 255,},
- {190, 214, 251, 200, 209, 255, 224, 255, 255, 255,},
- {191, 215, 251, 200, 210, 255, 225, 255, 255, 255,},
- {192, 215, 251, 201, 211, 255, 225, 255, 255, 255,},
- {193, 216, 251, 202, 211, 255, 226, 255, 255, 255,},
- {194, 217, 251, 203, 212, 255, 227, 255, 255, 255,},
- {195, 218, 252, 203, 212, 255, 227, 255, 255, 255,},
- {196, 218, 252, 204, 213, 255, 228, 255, 255, 255,},
- {197, 219, 252, 205, 213, 255, 228, 255, 255, 255,},
- {198, 220, 252, 205, 214, 255, 229, 255, 255, 255,},
- {199, 221, 252, 206, 214, 255, 229, 255, 255, 255,},
- {200, 221, 252, 207, 215, 255, 230, 255, 255, 255,},
- {201, 222, 252, 208, 215, 255, 231, 255, 255, 255,},
- {202, 223, 253, 208, 216, 255, 231, 255, 255, 255,},
- {203, 223, 253, 209, 216, 255, 232, 255, 255, 255,},
- {204, 224, 253, 210, 217, 255, 232, 255, 255, 255,},
- {205, 225, 253, 211, 218, 255, 233, 255, 255, 255,},
- {206, 226, 253, 211, 218, 255, 233, 255, 255, 255,},
- {207, 226, 253, 212, 219, 255, 234, 255, 255, 255,},
- {208, 227, 253, 213, 219, 255, 234, 255, 255, 255,},
- {209, 228, 254, 214, 220, 255, 235, 255, 255, 255,},
- {210, 228, 254, 214, 220, 255, 236, 255, 255, 255,},
- {211, 229, 254, 215, 221, 255, 236, 255, 255, 255,},
- {212, 230, 254, 216, 222, 255, 237, 255, 255, 255,},
- {213, 230, 254, 217, 222, 255, 237, 255, 255, 255,},
- {214, 231, 254, 217, 223, 255, 238, 255, 255, 255,},
- {215, 232, 254, 218, 223, 255, 238, 255, 255, 255,},
- {216, 233, 254, 219, 224, 255, 239, 255, 255, 255,},
- {217, 233, 254, 220, 225, 255, 239, 255, 255, 255,},
- {218, 234, 255, 220, 225, 255, 240, 255, 255, 255,},
- {219, 235, 255, 221, 226, 255, 240, 255, 255, 255,},
- {220, 235, 255, 222, 226, 255, 241, 255, 255, 255,},
- {221, 236, 255, 223, 227, 255, 241, 255, 255, 255,},
- {222, 237, 255, 224, 228, 255, 242, 255, 255, 255,},
- {223, 237, 255, 224, 228, 255, 242, 255, 255, 255,},
- {224, 238, 255, 225, 229, 255, 243, 255, 255, 255,},
- {225, 238, 255, 226, 230, 255, 243, 255, 255, 255,},
- {226, 239, 255, 227, 230, 255, 244, 255, 255, 255,},
- {227, 240, 255, 228, 231, 255, 244, 255, 255, 255,},
- {228, 240, 255, 228, 232, 255, 245, 255, 255, 255,},
- {229, 241, 255, 229, 232, 255, 245, 255, 255, 255,},
- {230, 242, 255, 230, 233, 255, 246, 255, 255, 255,},
- {231, 242, 255, 231, 234, 255, 246, 255, 255, 255,},
- {232, 243, 255, 232, 234, 255, 247, 255, 255, 255,},
- {233, 243, 255, 233, 235, 255, 247, 255, 255, 255,},
- {234, 244, 255, 233, 236, 255, 247, 255, 255, 255,},
- {235, 245, 255, 234, 236, 255, 248, 255, 255, 255,},
- {236, 245, 255, 235, 237, 255, 248, 255, 255, 255,},
- {237, 246, 255, 236, 238, 255, 249, 255, 255, 255,},
- {238, 247, 255, 237, 239, 255, 249, 255, 255, 255,},
- {239, 247, 255, 238, 239, 255, 250, 255, 255, 255,},
- {240, 248, 255, 239, 240, 255, 250, 255, 255, 255,},
- {241, 248, 255, 240, 241, 255, 251, 255, 255, 255,},
- {242, 249, 255, 241, 242, 255, 251, 255, 255, 255,},
- {243, 249, 255, 241, 243, 255, 251, 255, 255, 255,},
- {244, 250, 255, 242, 243, 255, 252, 255, 255, 255,},
- {245, 251, 255, 243, 244, 255, 252, 255, 255, 255,},
- {246, 251, 255, 244, 245, 255, 253, 255, 255, 255,},
- {247, 252, 255, 245, 246, 255, 253, 255, 255, 255,},
- {248, 252, 255, 246, 247, 255, 253, 255, 255, 255,},
- {249, 253, 255, 247, 248, 255, 254, 255, 255, 255,},
- {250, 253, 255, 248, 249, 255, 254, 255, 255, 255,},
- {251, 254, 255, 249, 250, 255, 254, 255, 255, 255,},
- {252, 254, 255, 251, 251, 255, 255, 255, 255, 255,},
- {253, 255, 255, 252, 252, 255, 255, 255, 255, 255,},
- {254, 255, 255, 253, 253, 255, 255, 255, 255, 255,},
- {255, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
+// beta = 8
+const vp9_prob vp9_modelcoefprobs_pareto8[COEFPROB_MODELS][MODEL_NODES] = {
+ { 3, 86, 128, 6, 86, 23, 88, 29},
+ { 9, 86, 129, 17, 88, 61, 94, 76},
+ { 15, 87, 129, 28, 89, 93, 100, 110},
+ { 20, 88, 130, 38, 91, 118, 106, 136},
+ { 26, 89, 131, 48, 92, 139, 111, 156},
+ { 31, 90, 131, 58, 94, 156, 117, 171},
+ { 37, 90, 132, 66, 95, 171, 122, 184},
+ { 42, 91, 132, 75, 97, 183, 127, 194},
+ { 47, 92, 133, 83, 98, 193, 132, 202},
+ { 52, 93, 133, 90, 100, 201, 137, 208},
+ { 57, 94, 134, 98, 101, 208, 142, 214},
+ { 62, 94, 135, 105, 103, 214, 146, 218},
+ { 66, 95, 135, 111, 104, 219, 151, 222},
+ { 71, 96, 136, 117, 106, 224, 155, 225},
+ { 76, 97, 136, 123, 107, 227, 159, 228},
+ { 80, 98, 137, 129, 109, 231, 162, 231},
+ { 84, 98, 138, 134, 110, 234, 166, 233},
+ { 89, 99, 138, 140, 112, 236, 170, 235},
+ { 93, 100, 139, 145, 113, 238, 173, 236},
+ { 97, 101, 140, 149, 115, 240, 176, 238},
+ {101, 102, 140, 154, 116, 242, 179, 239},
+ {105, 103, 141, 158, 118, 243, 182, 240},
+ {109, 104, 141, 162, 119, 244, 185, 241},
+ {113, 104, 142, 166, 120, 245, 187, 242},
+ {116, 105, 143, 170, 122, 246, 190, 243},
+ {120, 106, 143, 173, 123, 247, 192, 244},
+ {123, 107, 144, 177, 125, 248, 195, 244},
+ {127, 108, 145, 180, 126, 249, 197, 245},
+ {130, 109, 145, 183, 128, 249, 199, 245},
+ {134, 110, 146, 186, 129, 250, 201, 246},
+ {137, 111, 147, 189, 131, 251, 203, 246},
+ {140, 112, 147, 192, 132, 251, 205, 247},
+ {143, 113, 148, 194, 133, 251, 207, 247},
+ {146, 114, 149, 197, 135, 252, 208, 248},
+ {149, 115, 149, 199, 136, 252, 210, 248},
+ {152, 115, 150, 201, 138, 252, 211, 248},
+ {155, 116, 151, 204, 139, 253, 213, 249},
+ {158, 117, 151, 206, 140, 253, 214, 249},
+ {161, 118, 152, 208, 142, 253, 216, 249},
+ {163, 119, 153, 210, 143, 253, 217, 249},
+ {166, 120, 153, 212, 144, 254, 218, 250},
+ {168, 121, 154, 213, 146, 254, 220, 250},
+ {171, 122, 155, 215, 147, 254, 221, 250},
+ {173, 123, 155, 217, 148, 254, 222, 250},
+ {176, 124, 156, 218, 150, 254, 223, 250},
+ {178, 125, 157, 220, 151, 254, 224, 251},
+ {180, 126, 157, 221, 152, 254, 225, 251},
+ {183, 127, 158, 222, 153, 254, 226, 251},
+ {185, 128, 159, 224, 155, 255, 227, 251},
+ {187, 129, 160, 225, 156, 255, 228, 251},
+ {189, 131, 160, 226, 157, 255, 228, 251},
+ {191, 132, 161, 227, 159, 255, 229, 251},
+ {193, 133, 162, 228, 160, 255, 230, 252},
+ {195, 134, 163, 230, 161, 255, 231, 252},
+ {197, 135, 163, 231, 162, 255, 231, 252},
+ {199, 136, 164, 232, 163, 255, 232, 252},
+ {201, 137, 165, 233, 165, 255, 233, 252},
+ {202, 138, 166, 233, 166, 255, 233, 252},
+ {204, 139, 166, 234, 167, 255, 234, 252},
+ {206, 140, 167, 235, 168, 255, 235, 252},
+ {207, 141, 168, 236, 169, 255, 235, 252},
+ {209, 142, 169, 237, 171, 255, 236, 252},
+ {210, 144, 169, 237, 172, 255, 236, 252},
+ {212, 145, 170, 238, 173, 255, 237, 252},
+ {214, 146, 171, 239, 174, 255, 237, 253},
+ {215, 147, 172, 240, 175, 255, 238, 253},
+ {216, 148, 173, 240, 176, 255, 238, 253},
+ {218, 149, 173, 241, 177, 255, 239, 253},
+ {219, 150, 174, 241, 179, 255, 239, 253},
+ {220, 152, 175, 242, 180, 255, 240, 253},
+ {222, 153, 176, 242, 181, 255, 240, 253},
+ {223, 154, 177, 243, 182, 255, 240, 253},
+ {224, 155, 178, 244, 183, 255, 241, 253},
+ {225, 156, 178, 244, 184, 255, 241, 253},
+ {226, 158, 179, 244, 185, 255, 242, 253},
+ {228, 159, 180, 245, 186, 255, 242, 253},
+ {229, 160, 181, 245, 187, 255, 242, 253},
+ {230, 161, 182, 246, 188, 255, 243, 253},
+ {231, 163, 183, 246, 189, 255, 243, 253},
+ {232, 164, 184, 247, 190, 255, 243, 253},
+ {233, 165, 185, 247, 191, 255, 244, 253},
+ {234, 166, 185, 247, 192, 255, 244, 253},
+ {235, 168, 186, 248, 193, 255, 244, 253},
+ {236, 169, 187, 248, 194, 255, 244, 253},
+ {236, 170, 188, 248, 195, 255, 245, 253},
+ {237, 171, 189, 249, 196, 255, 245, 254},
+ {238, 173, 190, 249, 197, 255, 245, 254},
+ {239, 174, 191, 249, 198, 255, 245, 254},
+ {240, 175, 192, 249, 199, 255, 246, 254},
+ {240, 177, 193, 250, 200, 255, 246, 254},
+ {241, 178, 194, 250, 201, 255, 246, 254},
+ {242, 179, 195, 250, 202, 255, 246, 254},
+ {242, 181, 196, 250, 203, 255, 247, 254},
+ {243, 182, 197, 251, 204, 255, 247, 254},
+ {244, 184, 198, 251, 205, 255, 247, 254},
+ {244, 185, 199, 251, 206, 255, 247, 254},
+ {245, 186, 200, 251, 207, 255, 247, 254},
+ {246, 188, 201, 252, 207, 255, 248, 254},
+ {246, 189, 202, 252, 208, 255, 248, 254},
+ {247, 191, 203, 252, 209, 255, 248, 254},
+ {247, 192, 204, 252, 210, 255, 248, 254},
+ {248, 194, 205, 252, 211, 255, 248, 254},
+ {248, 195, 206, 252, 212, 255, 249, 254},
+ {249, 197, 207, 253, 213, 255, 249, 254},
+ {249, 198, 208, 253, 214, 255, 249, 254},
+ {250, 200, 210, 253, 215, 255, 249, 254},
+ {250, 201, 211, 253, 215, 255, 249, 254},
+ {250, 203, 212, 253, 216, 255, 249, 254},
+ {251, 204, 213, 253, 217, 255, 250, 254},
+ {251, 206, 214, 254, 218, 255, 250, 254},
+ {252, 207, 216, 254, 219, 255, 250, 254},
+ {252, 209, 217, 254, 220, 255, 250, 254},
+ {252, 211, 218, 254, 221, 255, 250, 254},
+ {253, 213, 219, 254, 222, 255, 250, 254},
+ {253, 214, 221, 254, 223, 255, 250, 254},
+ {253, 216, 222, 254, 224, 255, 251, 254},
+ {253, 218, 224, 254, 225, 255, 251, 254},
+ {254, 220, 225, 254, 225, 255, 251, 254},
+ {254, 222, 227, 255, 226, 255, 251, 254},
+ {254, 224, 228, 255, 227, 255, 251, 254},
+ {254, 226, 230, 255, 228, 255, 251, 254},
+ {255, 228, 231, 255, 230, 255, 251, 254},
+ {255, 230, 233, 255, 231, 255, 252, 254},
+ {255, 232, 235, 255, 232, 255, 252, 254},
+ {255, 235, 237, 255, 233, 255, 252, 254},
+ {255, 238, 240, 255, 235, 255, 252, 255},
+ {255, 241, 243, 255, 236, 255, 252, 254},
+ {255, 246, 247, 255, 239, 255, 253, 255}
};
-const vp9_prob vp9_modelcoefprobs_gg875p1[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
- // Probs generated with a Generalized Gaussian (with shape parameter 0.625)
- // source model with varying quantizer step size for a uniform quantizer
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, // do not use
- {1, 1, 3, 86, 128, 6, 86, 22, 89, 28,},
- {1, 2, 6, 86, 129, 11, 87, 42, 92, 52,},
- {2, 3, 9, 87, 129, 17, 88, 59, 94, 73,},
- {2, 4, 12, 87, 129, 22, 89, 75, 97, 92,},
- {3, 5, 14, 88, 130, 27, 89, 90, 100, 108,},
- {3, 6, 17, 88, 130, 33, 90, 103, 102, 122,},
- {4, 7, 20, 88, 130, 37, 91, 115, 105, 135,},
- {4, 8, 23, 89, 131, 42, 92, 126, 108, 147,},
- {5, 9, 25, 89, 131, 47, 92, 137, 110, 157,},
- {5, 10, 28, 90, 131, 52, 93, 146, 113, 167,},
- {6, 11, 31, 90, 132, 56, 94, 154, 115, 175,},
- {6, 12, 33, 90, 132, 60, 94, 162, 118, 183,},
- {7, 13, 36, 91, 132, 65, 95, 170, 120, 190,},
- {7, 14, 39, 91, 132, 69, 96, 176, 123, 196,},
- {8, 15, 41, 92, 133, 73, 96, 182, 125, 201,},
- {8, 16, 44, 92, 133, 77, 97, 188, 128, 206,},
- {9, 17, 46, 92, 133, 81, 98, 193, 130, 211,},
- {9, 18, 49, 93, 134, 85, 99, 198, 133, 215,},
- {10, 19, 51, 93, 134, 89, 99, 203, 135, 219,},
- {10, 20, 54, 93, 134, 92, 100, 207, 137, 222,},
- {11, 21, 56, 94, 134, 96, 101, 211, 140, 226,},
- {12, 22, 58, 94, 135, 100, 101, 214, 142, 228,},
- {12, 23, 61, 95, 135, 103, 102, 217, 145, 231,},
- {13, 24, 63, 95, 135, 106, 103, 220, 147, 233,},
- {13, 25, 66, 95, 136, 110, 103, 223, 149, 235,},
- {14, 26, 68, 96, 136, 113, 104, 226, 151, 237,},
- {14, 27, 70, 96, 136, 116, 105, 228, 154, 239,},
- {15, 28, 72, 97, 136, 119, 106, 230, 156, 241,},
- {15, 29, 75, 97, 137, 122, 106, 232, 158, 242,},
- {16, 30, 77, 97, 137, 125, 107, 234, 160, 243,},
- {17, 31, 79, 98, 137, 128, 108, 236, 163, 245,},
- {17, 32, 81, 98, 138, 131, 108, 237, 165, 246,},
- {18, 33, 83, 99, 138, 134, 109, 239, 167, 247,},
- {18, 34, 86, 99, 138, 137, 110, 240, 169, 248,},
- {19, 35, 88, 99, 138, 140, 111, 242, 171, 248,},
- {19, 36, 90, 100, 139, 142, 111, 243, 173, 249,},
- {20, 37, 92, 100, 139, 145, 112, 244, 175, 250,},
- {20, 38, 94, 101, 139, 148, 113, 245, 177, 250,},
- {21, 39, 96, 101, 140, 150, 113, 246, 179, 251,},
- {22, 40, 98, 101, 140, 153, 114, 246, 181, 251,},
- {22, 41, 100, 102, 140, 155, 115, 247, 183, 252,},
- {23, 42, 102, 102, 140, 157, 116, 248, 185, 252,},
- {23, 43, 104, 103, 141, 160, 116, 249, 186, 253,},
- {24, 44, 106, 103, 141, 162, 117, 249, 188, 253,},
- {25, 45, 108, 103, 141, 164, 118, 250, 190, 253,},
- {25, 46, 110, 104, 142, 166, 119, 250, 192, 253,},
- {26, 47, 112, 104, 142, 168, 119, 251, 193, 254,},
- {26, 48, 114, 105, 142, 171, 120, 251, 195, 254,},
- {27, 49, 116, 105, 143, 173, 121, 252, 197, 254,},
- {27, 50, 118, 105, 143, 175, 122, 252, 198, 254,},
- {28, 51, 119, 106, 143, 177, 122, 252, 200, 254,},
- {29, 52, 121, 106, 143, 179, 123, 253, 201, 255,},
- {29, 53, 123, 107, 144, 180, 124, 253, 203, 255,},
- {30, 54, 125, 107, 144, 182, 125, 253, 204, 255,},
- {30, 55, 127, 108, 144, 184, 125, 253, 206, 255,},
- {31, 56, 128, 108, 145, 186, 126, 254, 207, 255,},
- {32, 57, 130, 108, 145, 188, 127, 254, 209, 255,},
- {32, 58, 132, 109, 145, 189, 128, 254, 210, 255,},
- {33, 59, 134, 109, 146, 191, 128, 254, 211, 255,},
- {33, 60, 135, 110, 146, 193, 129, 254, 213, 255,},
- {34, 61, 137, 110, 146, 194, 130, 254, 214, 255,},
- {35, 62, 139, 111, 146, 196, 131, 255, 215, 255,},
- {35, 63, 140, 111, 147, 197, 131, 255, 216, 255,},
- {36, 64, 142, 112, 147, 199, 132, 255, 218, 255,},
- {37, 65, 144, 112, 147, 200, 133, 255, 219, 255,},
- {37, 66, 145, 112, 148, 202, 134, 255, 220, 255,},
- {38, 67, 147, 113, 148, 203, 135, 255, 221, 255,},
- {38, 68, 148, 113, 148, 204, 135, 255, 222, 255,},
- {39, 69, 150, 114, 149, 206, 136, 255, 223, 255,},
- {40, 70, 151, 114, 149, 207, 137, 255, 224, 255,},
- {40, 71, 153, 115, 149, 208, 138, 255, 225, 255,},
- {41, 72, 154, 115, 150, 210, 138, 255, 226, 255,},
- {42, 73, 156, 116, 150, 211, 139, 255, 227, 255,},
- {42, 74, 157, 116, 150, 212, 140, 255, 228, 255,},
- {43, 75, 159, 117, 151, 213, 141, 255, 229, 255,},
- {44, 76, 160, 117, 151, 214, 142, 255, 230, 255,},
- {44, 77, 162, 117, 151, 216, 142, 255, 231, 255,},
- {45, 78, 163, 118, 152, 217, 143, 255, 231, 255,},
- {45, 79, 165, 118, 152, 218, 144, 255, 232, 255,},
- {46, 80, 166, 119, 152, 219, 145, 255, 233, 255,},
- {47, 81, 167, 119, 153, 220, 146, 255, 234, 255,},
- {47, 82, 169, 120, 153, 221, 146, 255, 235, 255,},
- {48, 83, 170, 120, 153, 222, 147, 255, 235, 255,},
- {49, 84, 171, 121, 154, 223, 148, 255, 236, 255,},
- {49, 85, 173, 121, 154, 224, 149, 255, 237, 255,},
- {50, 86, 174, 122, 154, 225, 150, 255, 237, 255,},
- {51, 87, 175, 122, 155, 225, 150, 255, 238, 255,},
- {51, 88, 177, 123, 155, 226, 151, 255, 239, 255,},
- {52, 89, 178, 123, 155, 227, 152, 255, 239, 255,},
- {53, 90, 179, 124, 156, 228, 153, 255, 240, 255,},
- {53, 91, 180, 124, 156, 229, 154, 255, 240, 255,},
- {54, 92, 182, 125, 156, 230, 154, 255, 241, 255,},
- {55, 93, 183, 125, 157, 230, 155, 255, 241, 255,},
- {55, 94, 184, 126, 157, 231, 156, 255, 242, 255,},
- {56, 95, 185, 126, 157, 232, 157, 255, 242, 255,},
- {57, 96, 187, 127, 158, 233, 158, 255, 243, 255,},
- {57, 97, 188, 127, 158, 233, 159, 255, 243, 255,},
- {58, 98, 189, 128, 158, 234, 159, 255, 244, 255,},
- {59, 99, 190, 128, 159, 235, 160, 255, 244, 255,},
- {60, 100, 191, 129, 159, 235, 161, 255, 245, 255,},
- {60, 101, 192, 129, 160, 236, 162, 255, 245, 255,},
- {61, 102, 193, 130, 160, 237, 163, 255, 246, 255,},
- {62, 103, 194, 131, 160, 237, 164, 255, 246, 255,},
- {62, 104, 196, 131, 161, 238, 164, 255, 246, 255,},
- {63, 105, 197, 132, 161, 238, 165, 255, 247, 255,},
- {64, 106, 198, 132, 161, 239, 166, 255, 247, 255,},
- {64, 107, 199, 133, 162, 239, 167, 255, 247, 255,},
- {65, 108, 200, 133, 162, 240, 168, 255, 248, 255,},
- {66, 109, 201, 134, 163, 241, 168, 255, 248, 255,},
- {67, 110, 202, 134, 163, 241, 169, 255, 248, 255,},
- {67, 111, 203, 135, 163, 242, 170, 255, 249, 255,},
- {68, 112, 204, 135, 164, 242, 171, 255, 249, 255,},
- {69, 113, 205, 136, 164, 242, 172, 255, 249, 255,},
- {69, 114, 206, 137, 164, 243, 173, 255, 250, 255,},
- {70, 115, 207, 137, 165, 243, 173, 255, 250, 255,},
- {71, 116, 208, 138, 165, 244, 174, 255, 250, 255,},
- {72, 117, 208, 138, 166, 244, 175, 255, 250, 255,},
- {72, 118, 209, 139, 166, 245, 176, 255, 251, 255,},
- {73, 119, 210, 139, 166, 245, 177, 255, 251, 255,},
- {74, 120, 211, 140, 167, 245, 178, 255, 251, 255,},
- {75, 121, 212, 141, 167, 246, 178, 255, 251, 255,},
- {75, 122, 213, 141, 168, 246, 179, 255, 251, 255,},
- {76, 123, 214, 142, 168, 246, 180, 255, 252, 255,},
- {77, 124, 215, 142, 168, 247, 181, 255, 252, 255,},
- {78, 125, 215, 143, 169, 247, 182, 255, 252, 255,},
- {78, 126, 216, 144, 169, 247, 182, 255, 252, 255,},
- {79, 127, 217, 144, 170, 248, 183, 255, 252, 255,},
- {80, 128, 218, 145, 170, 248, 184, 255, 253, 255,},
- {81, 129, 219, 145, 170, 248, 185, 255, 253, 255,},
- {82, 130, 219, 146, 171, 249, 186, 255, 253, 255,},
- {82, 131, 220, 147, 171, 249, 187, 255, 253, 255,},
- {83, 132, 221, 147, 172, 249, 187, 255, 253, 255,},
- {84, 133, 222, 148, 172, 249, 188, 255, 253, 255,},
- {85, 134, 222, 148, 173, 250, 189, 255, 253, 255,},
- {85, 135, 223, 149, 173, 250, 190, 255, 254, 255,},
- {86, 136, 224, 150, 173, 250, 191, 255, 254, 255,},
- {87, 137, 225, 150, 174, 250, 191, 255, 254, 255,},
- {88, 138, 225, 151, 174, 251, 192, 255, 254, 255,},
- {89, 139, 226, 152, 175, 251, 193, 255, 254, 255,},
- {89, 140, 227, 152, 175, 251, 194, 255, 254, 255,},
- {90, 141, 227, 153, 176, 251, 195, 255, 254, 255,},
- {91, 142, 228, 153, 176, 251, 195, 255, 254, 255,},
- {92, 143, 229, 154, 176, 252, 196, 255, 254, 255,},
- {93, 144, 229, 155, 177, 252, 197, 255, 254, 255,},
- {93, 145, 230, 155, 177, 252, 198, 255, 255, 255,},
- {94, 146, 231, 156, 178, 252, 199, 255, 255, 255,},
- {95, 147, 231, 157, 178, 252, 199, 255, 255, 255,},
- {96, 148, 232, 157, 179, 252, 200, 255, 255, 255,},
- {97, 149, 232, 158, 179, 253, 201, 255, 255, 255,},
- {98, 150, 233, 159, 180, 253, 202, 255, 255, 255,},
- {99, 151, 234, 159, 180, 253, 202, 255, 255, 255,},
- {99, 152, 234, 160, 181, 253, 203, 255, 255, 255,},
- {100, 153, 235, 161, 181, 253, 204, 255, 255, 255,},
- {101, 154, 235, 162, 182, 253, 205, 255, 255, 255,},
- {102, 155, 236, 162, 182, 253, 206, 255, 255, 255,},
- {103, 156, 236, 163, 183, 254, 206, 255, 255, 255,},
- {104, 157, 237, 164, 183, 254, 207, 255, 255, 255,},
- {105, 158, 237, 164, 183, 254, 208, 255, 255, 255,},
- {105, 159, 238, 165, 184, 254, 209, 255, 255, 255,},
- {106, 160, 238, 166, 184, 254, 209, 255, 255, 255,},
- {107, 161, 239, 166, 185, 254, 210, 255, 255, 255,},
- {108, 162, 239, 167, 185, 254, 211, 255, 255, 255,},
- {109, 163, 240, 168, 186, 254, 212, 255, 255, 255,},
- {110, 164, 240, 169, 186, 254, 212, 255, 255, 255,},
- {111, 165, 241, 169, 187, 254, 213, 255, 255, 255,},
- {112, 166, 241, 170, 187, 255, 214, 255, 255, 255,},
- {113, 167, 242, 171, 188, 255, 215, 255, 255, 255,},
- {114, 168, 242, 172, 189, 255, 215, 255, 255, 255,},
- {114, 169, 242, 172, 189, 255, 216, 255, 255, 255,},
- {115, 170, 243, 173, 190, 255, 217, 255, 255, 255,},
- {116, 171, 243, 174, 190, 255, 217, 255, 255, 255,},
- {117, 172, 244, 175, 191, 255, 218, 255, 255, 255,},
- {118, 173, 244, 175, 191, 255, 219, 255, 255, 255,},
- {119, 174, 244, 176, 192, 255, 220, 255, 255, 255,},
- {120, 175, 245, 177, 192, 255, 220, 255, 255, 255,},
- {121, 176, 245, 178, 193, 255, 221, 255, 255, 255,},
- {122, 177, 245, 178, 193, 255, 222, 255, 255, 255,},
- {123, 178, 246, 179, 194, 255, 222, 255, 255, 255,},
- {124, 179, 246, 180, 194, 255, 223, 255, 255, 255,},
- {125, 180, 247, 181, 195, 255, 224, 255, 255, 255,},
- {126, 181, 247, 182, 196, 255, 224, 255, 255, 255,},
- {127, 182, 247, 182, 196, 255, 225, 255, 255, 255,},
- {128, 183, 247, 183, 197, 255, 226, 255, 255, 255,},
- {129, 184, 248, 184, 197, 255, 226, 255, 255, 255,},
- {130, 185, 248, 185, 198, 255, 227, 255, 255, 255,},
- {131, 186, 248, 186, 198, 255, 228, 255, 255, 255,},
- {132, 187, 249, 186, 199, 255, 228, 255, 255, 255,},
- {133, 188, 249, 187, 200, 255, 229, 255, 255, 255,},
- {134, 189, 249, 188, 200, 255, 230, 255, 255, 255,},
- {135, 190, 249, 189, 201, 255, 230, 255, 255, 255,},
- {136, 191, 250, 190, 201, 255, 231, 255, 255, 255,},
- {137, 192, 250, 191, 202, 255, 231, 255, 255, 255,},
- {138, 193, 250, 191, 203, 255, 232, 255, 255, 255,},
- {139, 194, 250, 192, 203, 255, 233, 255, 255, 255,},
- {140, 195, 251, 193, 204, 255, 233, 255, 255, 255,},
- {142, 196, 251, 194, 204, 255, 234, 255, 255, 255,},
- {143, 197, 251, 195, 205, 255, 234, 255, 255, 255,},
- {144, 198, 251, 196, 206, 255, 235, 255, 255, 255,},
- {145, 199, 252, 197, 206, 255, 236, 255, 255, 255,},
- {146, 200, 252, 197, 207, 255, 236, 255, 255, 255,},
- {147, 201, 252, 198, 208, 255, 237, 255, 255, 255,},
- {148, 202, 252, 199, 208, 255, 237, 255, 255, 255,},
- {149, 203, 252, 200, 209, 255, 238, 255, 255, 255,},
- {151, 204, 253, 201, 210, 255, 238, 255, 255, 255,},
- {152, 205, 253, 202, 210, 255, 239, 255, 255, 255,},
- {153, 206, 253, 203, 211, 255, 239, 255, 255, 255,},
- {154, 207, 253, 204, 212, 255, 240, 255, 255, 255,},
- {155, 208, 253, 205, 212, 255, 241, 255, 255, 255,},
- {157, 209, 253, 206, 213, 255, 241, 255, 255, 255,},
- {158, 210, 253, 206, 214, 255, 242, 255, 255, 255,},
- {159, 211, 254, 207, 214, 255, 242, 255, 255, 255,},
- {160, 212, 254, 208, 215, 255, 243, 255, 255, 255,},
- {162, 213, 254, 209, 216, 255, 243, 255, 255, 255,},
- {163, 214, 254, 210, 217, 255, 244, 255, 255, 255,},
- {164, 215, 254, 211, 217, 255, 244, 255, 255, 255,},
- {165, 216, 254, 212, 218, 255, 244, 255, 255, 255,},
- {167, 217, 254, 213, 219, 255, 245, 255, 255, 255,},
- {168, 218, 254, 214, 219, 255, 245, 255, 255, 255,},
- {169, 219, 255, 215, 220, 255, 246, 255, 255, 255,},
- {171, 220, 255, 216, 221, 255, 246, 255, 255, 255,},
- {172, 221, 255, 217, 222, 255, 247, 255, 255, 255,},
- {174, 222, 255, 218, 223, 255, 247, 255, 255, 255,},
- {175, 223, 255, 219, 223, 255, 248, 255, 255, 255,},
- {177, 224, 255, 220, 224, 255, 248, 255, 255, 255,},
- {178, 225, 255, 221, 225, 255, 248, 255, 255, 255,},
- {179, 226, 255, 222, 226, 255, 249, 255, 255, 255,},
- {181, 227, 255, 223, 227, 255, 249, 255, 255, 255,},
- {182, 228, 255, 224, 227, 255, 250, 255, 255, 255,},
- {184, 229, 255, 225, 228, 255, 250, 255, 255, 255,},
- {186, 230, 255, 226, 229, 255, 250, 255, 255, 255,},
- {187, 231, 255, 227, 230, 255, 251, 255, 255, 255,},
- {189, 232, 255, 228, 231, 255, 251, 255, 255, 255,},
- {190, 233, 255, 229, 232, 255, 251, 255, 255, 255,},
- {192, 234, 255, 230, 232, 255, 252, 255, 255, 255,},
- {194, 235, 255, 231, 233, 255, 252, 255, 255, 255,},
- {196, 236, 255, 232, 234, 255, 252, 255, 255, 255,},
- {197, 237, 255, 233, 235, 255, 253, 255, 255, 255,},
- {199, 238, 255, 234, 236, 255, 253, 255, 255, 255,},
- {201, 239, 255, 235, 237, 255, 253, 255, 255, 255,},
- {203, 240, 255, 237, 238, 255, 253, 255, 255, 255,},
- {205, 241, 255, 238, 239, 255, 254, 255, 255, 255,},
- {207, 242, 255, 239, 240, 255, 254, 255, 255, 255,},
- {209, 243, 255, 240, 241, 255, 254, 255, 255, 255,},
- {211, 244, 255, 241, 242, 255, 254, 255, 255, 255,},
- {214, 245, 255, 242, 243, 255, 255, 255, 255, 255,},
- {216, 246, 255, 243, 244, 255, 255, 255, 255, 255,},
- {218, 247, 255, 244, 245, 255, 255, 255, 255, 255,},
- {221, 248, 255, 246, 246, 255, 255, 255, 255, 255,},
- {224, 249, 255, 247, 247, 255, 255, 255, 255, 255,},
- {226, 250, 255, 248, 248, 255, 255, 255, 255, 255,},
- {229, 251, 255, 249, 249, 255, 255, 255, 255, 255,},
- {233, 252, 255, 251, 251, 255, 255, 255, 255, 255,},
- {236, 253, 255, 252, 252, 255, 255, 255, 255, 255,},
- {241, 254, 255, 253, 253, 255, 255, 255, 255, 255,},
- {246, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
-};
+static void extend_model_to_full_distribution(vp9_prob p,
+ vp9_prob *tree_probs) {
+ const int l = ((p - 1) / 2);
+ const vp9_prob (*model)[MODEL_NODES];
+ model = vp9_modelcoefprobs_pareto8;
+ if (p & 1) {
+ vpx_memcpy(tree_probs + UNCONSTRAINED_NODES,
+ model[l], MODEL_NODES * sizeof(vp9_prob));
+ } else {
+ // interpolate
+ int i;
+ for (i = UNCONSTRAINED_NODES; i < ENTROPY_NODES; ++i)
+ tree_probs[i] = (model[l][i - UNCONSTRAINED_NODES] +
+ model[l + 1][i - UNCONSTRAINED_NODES]) >> 1;
+ }
+}
-const vp9_prob vp9_modelcoefprobs_gg75p1[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
- // Probs generated with a Generalized Gaussian (with shape parameter 0.625)
- // source model with varying quantizer step size for a uniform quantizer
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, // do not use
- {1, 1, 3, 86, 129, 6, 87, 21, 90, 26,},
- {1, 2, 6, 87, 129, 11, 88, 39, 93, 47,},
- {2, 3, 9, 87, 130, 16, 89, 55, 96, 65,},
- {2, 4, 11, 88, 130, 21, 89, 69, 98, 81,},
- {3, 5, 14, 88, 130, 26, 90, 82, 101, 95,},
- {3, 6, 17, 89, 131, 31, 91, 94, 103, 107,},
- {4, 7, 20, 89, 131, 35, 92, 105, 105, 119,},
- {4, 8, 22, 90, 131, 40, 92, 115, 108, 129,},
- {5, 9, 25, 90, 132, 44, 93, 124, 110, 138,},
- {5, 10, 27, 91, 132, 48, 94, 133, 112, 147,},
- {6, 11, 30, 91, 132, 52, 95, 141, 114, 155,},
- {6, 12, 32, 92, 133, 56, 95, 148, 116, 162,},
- {7, 13, 35, 92, 133, 60, 96, 155, 118, 168,},
- {7, 14, 37, 92, 133, 64, 97, 161, 121, 174,},
- {8, 15, 40, 93, 134, 68, 97, 167, 123, 180,},
- {9, 16, 42, 93, 134, 71, 98, 173, 125, 185,},
- {9, 17, 44, 94, 134, 75, 99, 178, 127, 190,},
- {10, 18, 47, 94, 135, 78, 99, 182, 129, 195,},
- {10, 19, 49, 94, 135, 82, 100, 187, 131, 199,},
- {11, 20, 51, 95, 135, 85, 100, 191, 133, 202,},
- {11, 21, 54, 95, 135, 88, 101, 195, 135, 206,},
- {12, 22, 56, 96, 136, 92, 102, 199, 137, 209,},
- {13, 23, 58, 96, 136, 95, 102, 202, 138, 213,},
- {13, 24, 61, 96, 136, 98, 103, 206, 140, 215,},
- {14, 25, 63, 97, 137, 101, 104, 209, 142, 218,},
- {14, 26, 65, 97, 137, 104, 104, 211, 144, 221,},
- {15, 27, 67, 98, 137, 107, 105, 214, 146, 223,},
- {15, 28, 69, 98, 138, 110, 106, 217, 148, 225,},
- {16, 29, 71, 98, 138, 113, 106, 219, 150, 227,},
- {17, 30, 73, 99, 138, 115, 107, 221, 151, 229,},
- {17, 31, 76, 99, 138, 118, 107, 223, 153, 231,},
- {18, 32, 78, 100, 139, 121, 108, 225, 155, 232,},
- {18, 33, 80, 100, 139, 123, 109, 227, 157, 234,},
- {19, 34, 82, 100, 139, 126, 109, 229, 158, 235,},
- {20, 35, 84, 101, 140, 128, 110, 231, 160, 237,},
- {20, 36, 86, 101, 140, 131, 111, 232, 162, 238,},
- {21, 37, 88, 102, 140, 133, 111, 234, 164, 239,},
- {21, 38, 90, 102, 140, 136, 112, 235, 165, 240,},
- {22, 39, 92, 102, 141, 138, 112, 236, 167, 241,},
- {23, 40, 94, 103, 141, 140, 113, 237, 169, 242,},
- {23, 41, 95, 103, 141, 143, 114, 238, 170, 243,},
- {24, 42, 97, 103, 142, 145, 114, 240, 172, 244,},
- {25, 43, 99, 104, 142, 147, 115, 241, 173, 245,},
- {25, 44, 101, 104, 142, 149, 116, 242, 175, 246,},
- {26, 45, 103, 105, 142, 151, 116, 242, 176, 246,},
- {26, 46, 105, 105, 143, 153, 117, 243, 178, 247,},
- {27, 47, 107, 105, 143, 156, 117, 244, 180, 248,},
- {28, 48, 108, 106, 143, 158, 118, 245, 181, 248,},
- {28, 49, 110, 106, 144, 159, 119, 245, 182, 249,},
- {29, 50, 112, 107, 144, 161, 119, 246, 184, 249,},
- {30, 51, 114, 107, 144, 163, 120, 247, 185, 250,},
- {30, 52, 115, 108, 144, 165, 121, 247, 187, 250,},
- {31, 53, 117, 108, 145, 167, 121, 248, 188, 250,},
- {32, 54, 119, 108, 145, 169, 122, 248, 190, 251,},
- {32, 55, 121, 109, 145, 171, 123, 249, 191, 251,},
- {33, 56, 122, 109, 146, 172, 123, 249, 192, 251,},
- {34, 57, 124, 110, 146, 174, 124, 250, 194, 252,},
- {34, 58, 126, 110, 146, 176, 125, 250, 195, 252,},
- {35, 59, 127, 110, 147, 177, 125, 250, 196, 252,},
- {36, 60, 129, 111, 147, 179, 126, 251, 197, 253,},
- {36, 61, 130, 111, 147, 181, 127, 251, 199, 253,},
- {37, 62, 132, 112, 147, 182, 127, 251, 200, 253,},
- {38, 63, 134, 112, 148, 184, 128, 252, 201, 253,},
- {38, 64, 135, 112, 148, 185, 128, 252, 202, 253,},
- {39, 65, 137, 113, 148, 187, 129, 252, 204, 254,},
- {40, 66, 138, 113, 149, 188, 130, 253, 205, 254,},
- {40, 67, 140, 114, 149, 190, 130, 253, 206, 254,},
- {41, 68, 141, 114, 149, 191, 131, 253, 207, 254,},
- {42, 69, 143, 115, 150, 192, 132, 253, 208, 254,},
- {42, 70, 144, 115, 150, 194, 132, 253, 209, 254,},
- {43, 71, 146, 115, 150, 195, 133, 254, 210, 254,},
- {44, 72, 147, 116, 150, 197, 134, 254, 211, 255,},
- {44, 73, 149, 116, 151, 198, 134, 254, 212, 255,},
- {45, 74, 150, 117, 151, 199, 135, 254, 213, 255,},
- {46, 75, 152, 117, 151, 200, 136, 254, 214, 255,},
- {46, 76, 153, 118, 152, 202, 136, 254, 215, 255,},
- {47, 77, 154, 118, 152, 203, 137, 254, 216, 255,},
- {48, 78, 156, 119, 152, 204, 138, 254, 217, 255,},
- {49, 79, 157, 119, 153, 205, 139, 255, 218, 255,},
- {49, 80, 159, 119, 153, 206, 139, 255, 219, 255,},
- {50, 81, 160, 120, 153, 207, 140, 255, 220, 255,},
- {51, 82, 161, 120, 154, 208, 141, 255, 221, 255,},
- {51, 83, 163, 121, 154, 210, 141, 255, 222, 255,},
- {52, 84, 164, 121, 154, 211, 142, 255, 223, 255,},
- {53, 85, 165, 122, 154, 212, 143, 255, 223, 255,},
- {54, 86, 166, 122, 155, 213, 143, 255, 224, 255,},
- {54, 87, 168, 123, 155, 214, 144, 255, 225, 255,},
- {55, 88, 169, 123, 155, 215, 145, 255, 226, 255,},
- {56, 89, 170, 123, 156, 216, 145, 255, 227, 255,},
- {57, 90, 172, 124, 156, 217, 146, 255, 227, 255,},
- {57, 91, 173, 124, 156, 218, 147, 255, 228, 255,},
- {58, 92, 174, 125, 157, 218, 147, 255, 229, 255,},
- {59, 93, 175, 125, 157, 219, 148, 255, 230, 255,},
- {60, 94, 176, 126, 157, 220, 149, 255, 230, 255,},
- {60, 95, 178, 126, 158, 221, 150, 255, 231, 255,},
- {61, 96, 179, 127, 158, 222, 150, 255, 232, 255,},
- {62, 97, 180, 127, 158, 223, 151, 255, 232, 255,},
- {63, 98, 181, 128, 159, 224, 152, 255, 233, 255,},
- {63, 99, 182, 128, 159, 224, 152, 255, 234, 255,},
- {64, 100, 183, 129, 159, 225, 153, 255, 234, 255,},
- {65, 101, 184, 129, 160, 226, 154, 255, 235, 255,},
- {66, 102, 186, 130, 160, 227, 154, 255, 235, 255,},
- {66, 103, 187, 130, 160, 227, 155, 255, 236, 255,},
- {67, 104, 188, 131, 161, 228, 156, 255, 236, 255,},
- {68, 105, 189, 131, 161, 229, 157, 255, 237, 255,},
- {69, 106, 190, 132, 161, 230, 157, 255, 238, 255,},
- {69, 107, 191, 132, 162, 230, 158, 255, 238, 255,},
- {70, 108, 192, 133, 162, 231, 159, 255, 239, 255,},
- {71, 109, 193, 133, 163, 232, 159, 255, 239, 255,},
- {72, 110, 194, 134, 163, 232, 160, 255, 240, 255,},
- {73, 111, 195, 134, 163, 233, 161, 255, 240, 255,},
- {73, 112, 196, 135, 164, 233, 162, 255, 241, 255,},
- {74, 113, 197, 135, 164, 234, 162, 255, 241, 255,},
- {75, 114, 198, 136, 164, 235, 163, 255, 241, 255,},
- {76, 115, 199, 136, 165, 235, 164, 255, 242, 255,},
- {77, 116, 200, 137, 165, 236, 165, 255, 242, 255,},
- {77, 117, 201, 137, 165, 236, 165, 255, 243, 255,},
- {78, 118, 202, 138, 166, 237, 166, 255, 243, 255,},
- {79, 119, 203, 138, 166, 237, 167, 255, 244, 255,},
- {80, 120, 204, 139, 166, 238, 167, 255, 244, 255,},
- {81, 121, 205, 139, 167, 238, 168, 255, 244, 255,},
- {82, 122, 206, 140, 167, 239, 169, 255, 245, 255,},
- {82, 123, 206, 141, 168, 239, 170, 255, 245, 255,},
- {83, 124, 207, 141, 168, 240, 170, 255, 245, 255,},
- {84, 125, 208, 142, 168, 240, 171, 255, 246, 255,},
- {85, 126, 209, 142, 169, 241, 172, 255, 246, 255,},
- {86, 127, 210, 143, 169, 241, 173, 255, 246, 255,},
- {87, 128, 211, 143, 169, 242, 173, 255, 247, 255,},
- {87, 129, 212, 144, 170, 242, 174, 255, 247, 255,},
- {88, 130, 212, 144, 170, 242, 175, 255, 247, 255,},
- {89, 131, 213, 145, 171, 243, 176, 255, 248, 255,},
- {90, 132, 214, 146, 171, 243, 176, 255, 248, 255,},
- {91, 133, 215, 146, 171, 244, 177, 255, 248, 255,},
- {92, 134, 216, 147, 172, 244, 178, 255, 248, 255,},
- {93, 135, 216, 147, 172, 244, 179, 255, 249, 255,},
- {93, 136, 217, 148, 173, 245, 179, 255, 249, 255,},
- {94, 137, 218, 148, 173, 245, 180, 255, 249, 255,},
- {95, 138, 219, 149, 173, 245, 181, 255, 249, 255,},
- {96, 139, 220, 150, 174, 246, 181, 255, 250, 255,},
- {97, 140, 220, 150, 174, 246, 182, 255, 250, 255,},
- {98, 141, 221, 151, 175, 246, 183, 255, 250, 255,},
- {99, 142, 222, 151, 175, 247, 184, 255, 250, 255,},
- {100, 143, 222, 152, 175, 247, 184, 255, 251, 255,},
- {100, 144, 223, 153, 176, 247, 185, 255, 251, 255,},
- {101, 145, 224, 153, 176, 248, 186, 255, 251, 255,},
- {102, 146, 224, 154, 177, 248, 187, 255, 251, 255,},
- {103, 147, 225, 154, 177, 248, 187, 255, 251, 255,},
- {104, 148, 226, 155, 178, 248, 188, 255, 252, 255,},
- {105, 149, 226, 156, 178, 249, 189, 255, 252, 255,},
- {106, 150, 227, 156, 178, 249, 190, 255, 252, 255,},
- {107, 151, 228, 157, 179, 249, 190, 255, 252, 255,},
- {108, 152, 228, 158, 179, 249, 191, 255, 252, 255,},
- {109, 153, 229, 158, 180, 250, 192, 255, 252, 255,},
- {110, 154, 230, 159, 180, 250, 193, 255, 253, 255,},
- {111, 155, 230, 159, 181, 250, 193, 255, 253, 255,},
- {111, 156, 231, 160, 181, 250, 194, 255, 253, 255,},
- {112, 157, 231, 161, 181, 251, 195, 255, 253, 255,},
- {113, 158, 232, 161, 182, 251, 196, 255, 253, 255,},
- {114, 159, 233, 162, 182, 251, 196, 255, 253, 255,},
- {115, 160, 233, 163, 183, 251, 197, 255, 253, 255,},
- {116, 161, 234, 163, 183, 251, 198, 255, 253, 255,},
- {117, 162, 234, 164, 184, 252, 199, 255, 254, 255,},
- {118, 163, 235, 165, 184, 252, 199, 255, 254, 255,},
- {119, 164, 235, 165, 185, 252, 200, 255, 254, 255,},
- {120, 165, 236, 166, 185, 252, 201, 255, 254, 255,},
- {121, 166, 236, 167, 186, 252, 202, 255, 254, 255,},
- {122, 167, 237, 167, 186, 252, 202, 255, 254, 255,},
- {123, 168, 237, 168, 187, 253, 203, 255, 254, 255,},
- {124, 169, 238, 169, 187, 253, 204, 255, 254, 255,},
- {125, 170, 238, 169, 188, 253, 205, 255, 254, 255,},
- {126, 171, 239, 170, 188, 253, 205, 255, 254, 255,},
- {127, 172, 239, 171, 189, 253, 206, 255, 254, 255,},
- {128, 173, 240, 172, 189, 253, 207, 255, 255, 255,},
- {129, 174, 240, 172, 190, 253, 208, 255, 255, 255,},
- {130, 175, 241, 173, 190, 253, 208, 255, 255, 255,},
- {131, 176, 241, 174, 191, 254, 209, 255, 255, 255,},
- {132, 177, 242, 175, 191, 254, 210, 255, 255, 255,},
- {133, 178, 242, 175, 192, 254, 210, 255, 255, 255,},
- {134, 179, 242, 176, 192, 254, 211, 255, 255, 255,},
- {135, 180, 243, 177, 193, 254, 212, 255, 255, 255,},
- {137, 181, 243, 177, 193, 254, 213, 255, 255, 255,},
- {138, 182, 244, 178, 194, 254, 213, 255, 255, 255,},
- {139, 183, 244, 179, 194, 254, 214, 255, 255, 255,},
- {140, 184, 244, 180, 195, 254, 215, 255, 255, 255,},
- {141, 185, 245, 181, 195, 254, 216, 255, 255, 255,},
- {142, 186, 245, 181, 196, 255, 216, 255, 255, 255,},
- {143, 187, 245, 182, 196, 255, 217, 255, 255, 255,},
- {144, 188, 246, 183, 197, 255, 218, 255, 255, 255,},
- {145, 189, 246, 184, 197, 255, 218, 255, 255, 255,},
- {146, 190, 247, 184, 198, 255, 219, 255, 255, 255,},
- {147, 191, 247, 185, 199, 255, 220, 255, 255, 255,},
- {149, 192, 247, 186, 199, 255, 221, 255, 255, 255,},
- {150, 193, 247, 187, 200, 255, 221, 255, 255, 255,},
- {151, 194, 248, 188, 200, 255, 222, 255, 255, 255,},
- {152, 195, 248, 188, 201, 255, 223, 255, 255, 255,},
- {153, 196, 248, 189, 201, 255, 223, 255, 255, 255,},
- {154, 197, 249, 190, 202, 255, 224, 255, 255, 255,},
- {156, 198, 249, 191, 203, 255, 225, 255, 255, 255,},
- {157, 199, 249, 192, 203, 255, 225, 255, 255, 255,},
- {158, 200, 250, 193, 204, 255, 226, 255, 255, 255,},
- {159, 201, 250, 193, 205, 255, 227, 255, 255, 255,},
- {160, 202, 250, 194, 205, 255, 227, 255, 255, 255,},
- {162, 203, 250, 195, 206, 255, 228, 255, 255, 255,},
- {163, 204, 251, 196, 206, 255, 229, 255, 255, 255,},
- {164, 205, 251, 197, 207, 255, 229, 255, 255, 255,},
- {165, 206, 251, 198, 208, 255, 230, 255, 255, 255,},
- {166, 207, 251, 199, 208, 255, 231, 255, 255, 255,},
- {168, 208, 251, 200, 209, 255, 231, 255, 255, 255,},
- {169, 209, 252, 201, 210, 255, 232, 255, 255, 255,},
- {170, 210, 252, 201, 210, 255, 233, 255, 255, 255,},
- {172, 211, 252, 202, 211, 255, 233, 255, 255, 255,},
- {173, 212, 252, 203, 212, 255, 234, 255, 255, 255,},
- {174, 213, 252, 204, 212, 255, 235, 255, 255, 255,},
- {175, 214, 253, 205, 213, 255, 235, 255, 255, 255,},
- {177, 215, 253, 206, 214, 255, 236, 255, 255, 255,},
- {178, 216, 253, 207, 215, 255, 237, 255, 255, 255,},
- {179, 217, 253, 208, 215, 255, 237, 255, 255, 255,},
- {181, 218, 253, 209, 216, 255, 238, 255, 255, 255,},
- {182, 219, 254, 210, 217, 255, 238, 255, 255, 255,},
- {184, 220, 254, 211, 217, 255, 239, 255, 255, 255,},
- {185, 221, 254, 212, 218, 255, 240, 255, 255, 255,},
- {186, 222, 254, 213, 219, 255, 240, 255, 255, 255,},
- {188, 223, 254, 214, 220, 255, 241, 255, 255, 255,},
- {189, 224, 254, 215, 221, 255, 241, 255, 255, 255,},
- {191, 225, 254, 216, 221, 255, 242, 255, 255, 255,},
- {192, 226, 254, 217, 222, 255, 243, 255, 255, 255,},
- {194, 227, 255, 218, 223, 255, 243, 255, 255, 255,},
- {195, 228, 255, 219, 224, 255, 244, 255, 255, 255,},
- {197, 229, 255, 220, 225, 255, 244, 255, 255, 255,},
- {198, 230, 255, 221, 225, 255, 245, 255, 255, 255,},
- {200, 231, 255, 222, 226, 255, 245, 255, 255, 255,},
- {201, 232, 255, 223, 227, 255, 246, 255, 255, 255,},
- {203, 233, 255, 224, 228, 255, 247, 255, 255, 255,},
- {205, 234, 255, 226, 229, 255, 247, 255, 255, 255,},
- {206, 235, 255, 227, 230, 255, 248, 255, 255, 255,},
- {208, 236, 255, 228, 231, 255, 248, 255, 255, 255,},
- {210, 237, 255, 229, 232, 255, 249, 255, 255, 255,},
- {211, 238, 255, 230, 233, 255, 249, 255, 255, 255,},
- {213, 239, 255, 231, 234, 255, 250, 255, 255, 255,},
- {215, 240, 255, 233, 235, 255, 250, 255, 255, 255,},
- {217, 241, 255, 234, 236, 255, 251, 255, 255, 255,},
- {219, 242, 255, 235, 237, 255, 251, 255, 255, 255,},
- {221, 243, 255, 236, 238, 255, 252, 255, 255, 255,},
- {223, 244, 255, 237, 239, 255, 252, 255, 255, 255,},
- {225, 245, 255, 239, 240, 255, 252, 255, 255, 255,},
- {227, 246, 255, 240, 241, 255, 253, 255, 255, 255,},
- {229, 247, 255, 241, 242, 255, 253, 255, 255, 255,},
- {231, 248, 255, 243, 244, 255, 254, 255, 255, 255,},
- {233, 249, 255, 244, 245, 255, 254, 255, 255, 255,},
- {236, 250, 255, 246, 246, 255, 254, 255, 255, 255,},
- {238, 251, 255, 247, 247, 255, 255, 255, 255, 255,},
- {241, 252, 255, 249, 249, 255, 255, 255, 255, 255,},
- {244, 253, 255, 250, 250, 255, 255, 255, 255, 255,},
- {247, 254, 255, 252, 252, 255, 255, 255, 255, 255,},
- {251, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
-};
+void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full) {
+ if (full != model)
+ vpx_memcpy(full, model, sizeof(vp9_prob) * UNCONSTRAINED_NODES);
+ extend_model_to_full_distribution(model[PIVOT_NODE], full);
+}
-const vp9_prob vp9_modelcoefprobs_gg625p1[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
- // Probs generated with a Generalized Gaussian (with shape parameter 0.625)
- // source model with varying quantizer step size for a uniform quantizer
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, // do not use
- {1, 1, 3, 87, 129, 6, 87, 20, 91, 24,},
- {1, 2, 6, 88, 130, 11, 89, 36, 94, 41,},
- {2, 3, 8, 88, 130, 15, 90, 50, 97, 56,},
- {2, 4, 11, 89, 131, 20, 90, 62, 99, 70,},
- {3, 5, 14, 90, 131, 24, 91, 74, 102, 81,},
- {3, 6, 16, 90, 132, 29, 92, 84, 104, 92,},
- {4, 7, 19, 91, 132, 33, 93, 93, 106, 101,},
- {4, 8, 21, 91, 132, 37, 93, 102, 108, 110,},
- {5, 9, 24, 92, 133, 40, 94, 110, 110, 118,},
- {5, 10, 26, 92, 133, 44, 95, 118, 111, 125,},
- {6, 11, 29, 93, 134, 48, 96, 125, 113, 132,},
- {7, 12, 31, 93, 134, 51, 96, 132, 115, 139,},
- {7, 13, 33, 93, 134, 55, 97, 138, 117, 145,},
- {8, 14, 36, 94, 135, 58, 97, 144, 119, 150,},
- {8, 15, 38, 94, 135, 62, 98, 149, 120, 155,},
- {9, 16, 40, 95, 135, 65, 99, 154, 122, 160,},
- {10, 17, 42, 95, 136, 68, 99, 159, 124, 165,},
- {10, 18, 45, 96, 136, 71, 100, 164, 125, 169,},
- {11, 19, 47, 96, 136, 74, 100, 168, 127, 174,},
- {11, 20, 49, 96, 136, 77, 101, 173, 128, 177,},
- {12, 21, 51, 97, 137, 80, 102, 176, 130, 181,},
- {13, 22, 53, 97, 137, 83, 102, 180, 131, 185,},
- {13, 23, 55, 98, 137, 86, 103, 184, 133, 188,},
- {14, 24, 57, 98, 138, 89, 103, 187, 135, 191,},
- {14, 25, 59, 98, 138, 91, 104, 190, 136, 194,},
- {15, 26, 61, 99, 138, 94, 104, 193, 138, 197,},
- {16, 27, 64, 99, 139, 97, 105, 196, 139, 200,},
- {16, 28, 66, 100, 139, 99, 106, 199, 141, 202,},
- {17, 29, 68, 100, 139, 102, 106, 201, 142, 205,},
- {18, 30, 69, 100, 139, 104, 107, 204, 143, 207,},
- {18, 31, 71, 101, 140, 107, 107, 206, 145, 209,},
- {19, 32, 73, 101, 140, 109, 108, 209, 146, 211,},
- {20, 33, 75, 102, 140, 112, 108, 211, 148, 213,},
- {20, 34, 77, 102, 141, 114, 109, 213, 149, 215,},
- {21, 35, 79, 102, 141, 116, 109, 215, 150, 217,},
- {22, 36, 81, 103, 141, 119, 110, 217, 152, 219,},
- {22, 37, 83, 103, 141, 121, 110, 218, 153, 220,},
- {23, 38, 85, 103, 142, 123, 111, 220, 155, 222,},
- {24, 39, 87, 104, 142, 125, 112, 222, 156, 224,},
- {24, 40, 88, 104, 142, 127, 112, 223, 157, 225,},
- {25, 41, 90, 105, 143, 129, 113, 225, 159, 226,},
- {26, 42, 92, 105, 143, 131, 113, 226, 160, 228,},
- {26, 43, 94, 105, 143, 133, 114, 227, 161, 229,},
- {27, 44, 95, 106, 143, 135, 114, 229, 162, 230,},
- {28, 45, 97, 106, 144, 137, 115, 230, 164, 231,},
- {28, 46, 99, 107, 144, 139, 115, 231, 165, 232,},
- {29, 47, 101, 107, 144, 141, 116, 232, 166, 233,},
- {30, 48, 102, 107, 145, 143, 116, 233, 168, 234,},
- {31, 49, 104, 108, 145, 145, 117, 234, 169, 235,},
- {31, 50, 106, 108, 145, 147, 118, 235, 170, 236,},
- {32, 51, 107, 108, 145, 149, 118, 236, 171, 237,},
- {33, 52, 109, 109, 146, 150, 119, 237, 172, 238,},
- {33, 53, 111, 109, 146, 152, 119, 238, 174, 239,},
- {34, 54, 112, 110, 146, 154, 120, 239, 175, 240,},
- {35, 55, 114, 110, 146, 156, 120, 240, 176, 240,},
- {36, 56, 115, 110, 147, 157, 121, 240, 177, 241,},
- {36, 57, 117, 111, 147, 159, 121, 241, 178, 242,},
- {37, 58, 119, 111, 147, 161, 122, 242, 180, 242,},
- {38, 59, 120, 112, 148, 162, 122, 242, 181, 243,},
- {38, 60, 122, 112, 148, 164, 123, 243, 182, 244,},
- {39, 61, 123, 112, 148, 165, 124, 244, 183, 244,},
- {40, 62, 125, 113, 148, 167, 124, 244, 184, 245,},
- {41, 63, 126, 113, 149, 168, 125, 245, 185, 245,},
- {41, 64, 128, 114, 149, 170, 125, 245, 186, 246,},
- {42, 65, 129, 114, 149, 171, 126, 246, 187, 246,},
- {43, 66, 131, 114, 150, 173, 126, 246, 188, 247,},
- {44, 67, 132, 115, 150, 174, 127, 247, 189, 247,},
- {44, 68, 134, 115, 150, 176, 127, 247, 191, 247,},
- {45, 69, 135, 116, 150, 177, 128, 248, 192, 248,},
- {46, 70, 136, 116, 151, 178, 129, 248, 193, 248,},
- {47, 71, 138, 116, 151, 180, 129, 248, 194, 249,},
- {48, 72, 139, 117, 151, 181, 130, 249, 195, 249,},
- {48, 73, 141, 117, 152, 183, 130, 249, 196, 249,},
- {49, 74, 142, 118, 152, 184, 131, 249, 197, 250,},
- {50, 75, 143, 118, 152, 185, 131, 250, 198, 250,},
- {51, 76, 145, 118, 152, 186, 132, 250, 199, 250,},
- {51, 77, 146, 119, 153, 188, 132, 250, 200, 250,},
- {52, 78, 148, 119, 153, 189, 133, 251, 201, 251,},
- {53, 79, 149, 120, 153, 190, 134, 251, 201, 251,},
- {54, 80, 150, 120, 154, 191, 134, 251, 202, 251,},
- {55, 81, 151, 120, 154, 192, 135, 251, 203, 251,},
- {55, 82, 153, 121, 154, 194, 135, 252, 204, 252,},
- {56, 83, 154, 121, 155, 195, 136, 252, 205, 252,},
- {57, 84, 155, 122, 155, 196, 136, 252, 206, 252,},
- {58, 85, 157, 122, 155, 197, 137, 252, 207, 252,},
- {59, 86, 158, 123, 155, 198, 138, 252, 208, 252,},
- {59, 87, 159, 123, 156, 199, 138, 253, 209, 253,},
- {60, 88, 160, 123, 156, 200, 139, 253, 210, 253,},
- {61, 89, 162, 124, 156, 201, 139, 253, 210, 253,},
- {62, 90, 163, 124, 157, 202, 140, 253, 211, 253,},
- {63, 91, 164, 125, 157, 203, 140, 253, 212, 253,},
- {64, 92, 165, 125, 157, 204, 141, 253, 213, 253,},
- {64, 93, 166, 126, 158, 205, 142, 254, 214, 253,},
- {65, 94, 168, 126, 158, 206, 142, 254, 214, 254,},
- {66, 95, 169, 126, 158, 207, 143, 254, 215, 254,},
- {67, 96, 170, 127, 158, 208, 143, 254, 216, 254,},
- {68, 97, 171, 127, 159, 209, 144, 254, 217, 254,},
- {69, 98, 172, 128, 159, 210, 145, 254, 218, 254,},
- {69, 99, 173, 128, 159, 211, 145, 254, 218, 254,},
- {70, 100, 175, 129, 160, 212, 146, 254, 219, 254,},
- {71, 101, 176, 129, 160, 213, 146, 254, 220, 254,},
- {72, 102, 177, 130, 160, 214, 147, 254, 220, 254,},
- {73, 103, 178, 130, 161, 214, 148, 255, 221, 255,},
- {74, 104, 179, 130, 161, 215, 148, 255, 222, 255,},
- {75, 105, 180, 131, 161, 216, 149, 255, 223, 255,},
- {75, 106, 181, 131, 162, 217, 149, 255, 223, 255,},
- {76, 107, 182, 132, 162, 218, 150, 255, 224, 255,},
- {77, 108, 183, 132, 162, 219, 151, 255, 225, 255,},
- {78, 109, 184, 133, 163, 219, 151, 255, 225, 255,},
- {79, 110, 185, 133, 163, 220, 152, 255, 226, 255,},
- {80, 111, 186, 134, 163, 221, 152, 255, 226, 255,},
- {81, 112, 187, 134, 164, 222, 153, 255, 227, 255,},
- {82, 113, 188, 135, 164, 222, 154, 255, 228, 255,},
- {83, 114, 189, 135, 164, 223, 154, 255, 228, 255,},
- {83, 115, 190, 136, 165, 224, 155, 255, 229, 255,},
- {84, 116, 191, 136, 165, 224, 156, 255, 230, 255,},
- {85, 117, 192, 137, 165, 225, 156, 255, 230, 255,},
- {86, 118, 193, 137, 166, 226, 157, 255, 231, 255,},
- {87, 119, 194, 137, 166, 226, 157, 255, 231, 255,},
- {88, 120, 195, 138, 166, 227, 158, 255, 232, 255,},
- {89, 121, 196, 138, 167, 228, 159, 255, 232, 255,},
- {90, 122, 197, 139, 167, 228, 159, 255, 233, 255,},
- {91, 123, 198, 139, 167, 229, 160, 255, 233, 255,},
- {92, 124, 199, 140, 168, 230, 161, 255, 234, 255,},
- {93, 125, 200, 140, 168, 230, 161, 255, 234, 255,},
- {93, 126, 201, 141, 168, 231, 162, 255, 235, 255,},
- {94, 127, 202, 141, 169, 231, 163, 255, 235, 255,},
- {95, 128, 203, 142, 169, 232, 163, 255, 236, 255,},
- {96, 129, 203, 142, 169, 233, 164, 255, 236, 255,},
- {97, 130, 204, 143, 170, 233, 164, 255, 237, 255,},
- {98, 131, 205, 143, 170, 234, 165, 255, 237, 255,},
- {99, 132, 206, 144, 170, 234, 166, 255, 238, 255,},
- {100, 133, 207, 145, 171, 235, 166, 255, 238, 255,},
- {101, 134, 208, 145, 171, 235, 167, 255, 239, 255,},
- {102, 135, 209, 146, 171, 236, 168, 255, 239, 255,},
- {103, 136, 209, 146, 172, 236, 168, 255, 240, 255,},
- {104, 137, 210, 147, 172, 237, 169, 255, 240, 255,},
- {105, 138, 211, 147, 173, 237, 170, 255, 240, 255,},
- {106, 139, 212, 148, 173, 238, 170, 255, 241, 255,},
- {107, 140, 213, 148, 173, 238, 171, 255, 241, 255,},
- {108, 141, 213, 149, 174, 239, 172, 255, 242, 255,},
- {109, 142, 214, 149, 174, 239, 172, 255, 242, 255,},
- {110, 143, 215, 150, 174, 240, 173, 255, 242, 255,},
- {111, 144, 216, 150, 175, 240, 174, 255, 243, 255,},
- {112, 145, 216, 151, 175, 240, 174, 255, 243, 255,},
- {113, 146, 217, 152, 176, 241, 175, 255, 243, 255,},
- {114, 147, 218, 152, 176, 241, 176, 255, 244, 255,},
- {115, 148, 219, 153, 176, 242, 176, 255, 244, 255,},
- {116, 149, 219, 153, 177, 242, 177, 255, 244, 255,},
- {117, 150, 220, 154, 177, 242, 178, 255, 245, 255,},
- {118, 151, 221, 154, 178, 243, 178, 255, 245, 255,},
- {119, 152, 221, 155, 178, 243, 179, 255, 245, 255,},
- {120, 153, 222, 156, 178, 244, 180, 255, 246, 255,},
- {121, 154, 223, 156, 179, 244, 180, 255, 246, 255,},
- {122, 155, 223, 157, 179, 244, 181, 255, 246, 255,},
- {123, 156, 224, 157, 180, 245, 182, 255, 247, 255,},
- {124, 157, 225, 158, 180, 245, 183, 255, 247, 255,},
- {125, 158, 225, 159, 180, 245, 183, 255, 247, 255,},
- {126, 159, 226, 159, 181, 246, 184, 255, 247, 255,},
- {127, 160, 227, 160, 181, 246, 185, 255, 248, 255,},
- {128, 161, 227, 160, 182, 246, 185, 255, 248, 255,},
- {129, 162, 228, 161, 182, 246, 186, 255, 248, 255,},
- {130, 163, 229, 162, 183, 247, 187, 255, 248, 255,},
- {131, 164, 229, 162, 183, 247, 187, 255, 249, 255,},
- {132, 165, 230, 163, 183, 247, 188, 255, 249, 255,},
- {133, 166, 230, 163, 184, 248, 189, 255, 249, 255,},
- {135, 167, 231, 164, 184, 248, 190, 255, 249, 255,},
- {136, 168, 232, 165, 185, 248, 190, 255, 250, 255,},
- {137, 169, 232, 165, 185, 248, 191, 255, 250, 255,},
- {138, 170, 233, 166, 186, 249, 192, 255, 250, 255,},
- {139, 171, 233, 167, 186, 249, 192, 255, 250, 255,},
- {140, 172, 234, 167, 187, 249, 193, 255, 251, 255,},
- {141, 173, 234, 168, 187, 249, 194, 255, 251, 255,},
- {142, 174, 235, 169, 187, 250, 195, 255, 251, 255,},
- {143, 175, 235, 169, 188, 250, 195, 255, 251, 255,},
- {144, 176, 236, 170, 188, 250, 196, 255, 251, 255,},
- {146, 177, 236, 171, 189, 250, 197, 255, 251, 255,},
- {147, 178, 237, 171, 189, 251, 197, 255, 252, 255,},
- {148, 179, 237, 172, 190, 251, 198, 255, 252, 255,},
- {149, 180, 238, 173, 190, 251, 199, 255, 252, 255,},
- {150, 181, 238, 173, 191, 251, 200, 255, 252, 255,},
- {151, 182, 239, 174, 191, 251, 200, 255, 252, 255,},
- {152, 183, 239, 175, 192, 251, 201, 255, 252, 255,},
- {153, 184, 240, 176, 192, 252, 202, 255, 253, 255,},
- {155, 185, 240, 176, 193, 252, 203, 255, 253, 255,},
- {156, 186, 241, 177, 193, 252, 203, 255, 253, 255,},
- {157, 187, 241, 178, 194, 252, 204, 255, 253, 255,},
- {158, 188, 242, 179, 194, 252, 205, 255, 253, 255,},
- {159, 189, 242, 179, 195, 252, 206, 255, 253, 255,},
- {160, 190, 242, 180, 195, 253, 206, 255, 253, 255,},
- {162, 191, 243, 181, 196, 253, 207, 255, 253, 255,},
- {163, 192, 243, 182, 196, 253, 208, 255, 254, 255,},
- {164, 193, 244, 182, 197, 253, 209, 255, 254, 255,},
- {165, 194, 244, 183, 198, 253, 209, 255, 254, 255,},
- {166, 195, 244, 184, 198, 253, 210, 255, 254, 255,},
- {168, 196, 245, 185, 199, 253, 211, 255, 254, 255,},
- {169, 197, 245, 185, 199, 254, 212, 255, 254, 255,},
- {170, 198, 246, 186, 200, 254, 212, 255, 254, 255,},
- {171, 199, 246, 187, 200, 254, 213, 255, 254, 255,},
- {172, 200, 246, 188, 201, 254, 214, 255, 254, 255,},
- {174, 201, 247, 189, 201, 254, 215, 255, 254, 255,},
- {175, 202, 247, 189, 202, 254, 215, 255, 255, 255,},
- {176, 203, 247, 190, 203, 254, 216, 255, 255, 255,},
- {177, 204, 248, 191, 203, 254, 217, 255, 255, 255,},
- {179, 205, 248, 192, 204, 254, 218, 255, 255, 255,},
- {180, 206, 248, 193, 204, 254, 218, 255, 255, 255,},
- {181, 207, 249, 194, 205, 255, 219, 255, 255, 255,},
- {183, 208, 249, 195, 206, 255, 220, 255, 255, 255,},
- {184, 209, 249, 195, 206, 255, 221, 255, 255, 255,},
- {185, 210, 250, 196, 207, 255, 221, 255, 255, 255,},
- {186, 211, 250, 197, 208, 255, 222, 255, 255, 255,},
- {188, 212, 250, 198, 208, 255, 223, 255, 255, 255,},
- {189, 213, 250, 199, 209, 255, 224, 255, 255, 255,},
- {190, 214, 251, 200, 210, 255, 224, 255, 255, 255,},
- {192, 215, 251, 201, 210, 255, 225, 255, 255, 255,},
- {193, 216, 251, 202, 211, 255, 226, 255, 255, 255,},
- {194, 217, 251, 203, 212, 255, 227, 255, 255, 255,},
- {196, 218, 252, 204, 212, 255, 228, 255, 255, 255,},
- {197, 219, 252, 205, 213, 255, 228, 255, 255, 255,},
- {198, 220, 252, 206, 214, 255, 229, 255, 255, 255,},
- {200, 221, 252, 207, 215, 255, 230, 255, 255, 255,},
- {201, 222, 252, 208, 215, 255, 231, 255, 255, 255,},
- {202, 223, 253, 209, 216, 255, 231, 255, 255, 255,},
- {204, 224, 253, 210, 217, 255, 232, 255, 255, 255,},
- {205, 225, 253, 211, 218, 255, 233, 255, 255, 255,},
- {207, 226, 253, 212, 218, 255, 234, 255, 255, 255,},
- {208, 227, 253, 213, 219, 255, 234, 255, 255, 255,},
- {209, 228, 254, 214, 220, 255, 235, 255, 255, 255,},
- {211, 229, 254, 215, 221, 255, 236, 255, 255, 255,},
- {212, 230, 254, 216, 222, 255, 237, 255, 255, 255,},
- {214, 231, 254, 217, 223, 255, 238, 255, 255, 255,},
- {215, 232, 254, 218, 223, 255, 238, 255, 255, 255,},
- {217, 233, 254, 219, 224, 255, 239, 255, 255, 255,},
- {218, 234, 255, 221, 225, 255, 240, 255, 255, 255,},
- {220, 235, 255, 222, 226, 255, 241, 255, 255, 255,},
- {221, 236, 255, 223, 227, 255, 241, 255, 255, 255,},
- {223, 237, 255, 224, 228, 255, 242, 255, 255, 255,},
- {224, 238, 255, 225, 229, 255, 243, 255, 255, 255,},
- {226, 239, 255, 227, 230, 255, 244, 255, 255, 255,},
- {227, 240, 255, 228, 231, 255, 244, 255, 255, 255,},
- {229, 241, 255, 229, 232, 255, 245, 255, 255, 255,},
- {231, 242, 255, 231, 233, 255, 246, 255, 255, 255,},
- {232, 243, 255, 232, 234, 255, 247, 255, 255, 255,},
- {234, 244, 255, 233, 236, 255, 247, 255, 255, 255,},
- {235, 245, 255, 235, 237, 255, 248, 255, 255, 255,},
- {237, 246, 255, 236, 238, 255, 249, 255, 255, 255,},
- {239, 247, 255, 238, 239, 255, 250, 255, 255, 255,},
- {241, 248, 255, 239, 241, 255, 250, 255, 255, 255,},
- {242, 249, 255, 241, 242, 255, 251, 255, 255, 255,},
- {244, 250, 255, 243, 243, 255, 252, 255, 255, 255,},
- {246, 251, 255, 244, 245, 255, 253, 255, 255, 255,},
- {248, 252, 255, 246, 247, 255, 253, 255, 255, 255,},
- {250, 253, 255, 248, 248, 255, 254, 255, 255, 255,},
- {252, 254, 255, 250, 250, 255, 255, 255, 255, 255,},
- {254, 255, 255, 253, 253, 255, 255, 255, 255, 255,},
-};
-
-void vp9_get_model_distribution(vp9_prob p, vp9_prob *tree_probs,
- int b, int r) {
- const vp9_prob (*model)[ENTROPY_NODES - 1];
-#if UNCONSTRAINED_NODES == 2
- if (r != INTRA_FRAME && b == PLANE_TYPE_UV)
- model = vp9_modelcoefprobs_gg75;
- else if (r == INTRA_FRAME && b == PLANE_TYPE_UV)
- model = vp9_modelcoefprobs_gg75;
- else if (r != INTRA_FRAME && b == PLANE_TYPE_Y_WITH_DC)
- model = vp9_modelcoefprobs_gg75;
- else
- model = vp9_modelcoefprobs_gg75;
-#else
- if (r != INTRA_FRAME && b == PLANE_TYPE_UV)
- model = vp9_modelcoefprobs_gg75p1;
- else if (r == INTRA_FRAME && b == PLANE_TYPE_UV)
- model = vp9_modelcoefprobs_gg75p1;
- else if (r != INTRA_FRAME && b == PLANE_TYPE_Y_WITH_DC)
- model = vp9_modelcoefprobs_gg75p1;
- else
- model = vp9_modelcoefprobs_gg75p1;
-#endif
- vpx_memcpy(tree_probs + UNCONSTRAINED_NODES,
- model[p] + UNCONSTRAINED_NODES - 1,
- (ENTROPY_NODES - UNCONSTRAINED_NODES) * sizeof(vp9_prob));
+void vp9_model_to_full_probs_sb(
+ vp9_prob model[COEF_BANDS][PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES],
+ vp9_prob full[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]) {
+ int c, p;
+ for (c = 0; c < COEF_BANDS; ++c)
+ for (p = 0; p < PREV_COEF_CONTEXTS; ++p) {
+ vp9_model_to_full_probs(model[c][p], full[c][p]);
+ }
}
-#endif
static vp9_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[28];
@@ -2077,7 +439,7 @@
init_bit_tree(cat6, 14);
}
-vp9_extra_bit_struct vp9_extra_bits[12] = {
+vp9_extra_bit vp9_extra_bits[12] = {
{ 0, 0, 0, 0},
{ 0, 0, 0, 1},
{ 0, 0, 0, 2},
@@ -2111,177 +473,32 @@
int ctx;
assert(neighbors[MAX_NEIGHBORS * c + 0] >= 0);
if (neighbors[MAX_NEIGHBORS * c + 1] >= 0) {
- ctx = (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] +
- token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >> 1;
+ ctx = (1 + token_cache[scan[neighbors[MAX_NEIGHBORS * c + 0]]] +
+ token_cache[scan[neighbors[MAX_NEIGHBORS * c + 1]]]) >> 1;
} else {
- ctx = token_cache[neighbors[MAX_NEIGHBORS * c + 0]];
+ ctx = token_cache[scan[neighbors[MAX_NEIGHBORS * c + 0]]];
}
- return vp9_pt_energy_class[ctx];
+ return ctx;
}
};
void vp9_default_coef_probs(VP9_COMMON *pc) {
-#if CONFIG_MODELCOEFPROB
- int b, r, c, p;
-#endif
-#if CONFIG_CODE_NONZEROCOUNT
-#ifdef NZC_DEFAULT_COUNTS
- int h, g;
- for (h = 0; h < MAX_NZC_CONTEXTS; ++h) {
- for (g = 0; g < REF_TYPES; ++g) {
- int i;
- unsigned int branch_ct4x4[NZC4X4_NODES][2];
- unsigned int branch_ct8x8[NZC8X8_NODES][2];
- unsigned int branch_ct16x16[NZC16X16_NODES][2];
- unsigned int branch_ct32x32[NZC32X32_NODES][2];
- for (i = 0; i < BLOCK_TYPES; ++i) {
- vp9_tree_probs_from_distribution(
- vp9_nzc4x4_tree,
- pc->fc.nzc_probs_4x4[h][g][i], branch_ct4x4,
- default_nzc_counts_4x4[h][g][i], 0);
- }
- for (i = 0; i < BLOCK_TYPES; ++i) {
- vp9_tree_probs_from_distribution(
- vp9_nzc8x8_tree,
- pc->fc.nzc_probs_8x8[h][g][i], branch_ct8x8,
- default_nzc_counts_8x8[h][g][i], 0);
- }
- for (i = 0; i < BLOCK_TYPES; ++i) {
- vp9_tree_probs_from_distribution(
- vp9_nzc16x16_tree,
- pc->fc.nzc_probs_16x16[h][g][i], branch_ct16x16,
- default_nzc_counts_16x16[h][g][i], 0);
- }
- for (i = 0; i < BLOCK_TYPES; ++i) {
- vp9_tree_probs_from_distribution(
- vp9_nzc32x32_tree,
- pc->fc.nzc_probs_32x32[h][g][i], branch_ct32x32,
- default_nzc_counts_32x32[h][g][i], 0);
- }
- }
- }
-#else
- vpx_memcpy(pc->fc.nzc_probs_4x4, default_nzc_probs_4x4,
- sizeof(pc->fc.nzc_probs_4x4));
- vpx_memcpy(pc->fc.nzc_probs_8x8, default_nzc_probs_8x8,
- sizeof(pc->fc.nzc_probs_8x8));
- vpx_memcpy(pc->fc.nzc_probs_16x16, default_nzc_probs_16x16,
- sizeof(pc->fc.nzc_probs_16x16));
- vpx_memcpy(pc->fc.nzc_probs_32x32, default_nzc_probs_32x32,
- sizeof(pc->fc.nzc_probs_32x32));
-#endif
- vpx_memcpy(pc->fc.nzc_pcat_probs, default_nzc_pcat_probs,
- sizeof(pc->fc.nzc_pcat_probs));
-#endif // CONFIG_CODE_NONZEROCOUNT
-#if CONFIG_MODELCOEFPROB
- for (b = 0; b < BLOCK_TYPES; ++b)
- for (r = 0; r < REF_TYPES; ++r)
- for (c = 0; c < COEF_BANDS; ++c)
- for (p = 0; p < PREV_COEF_CONTEXTS; ++p) {
- int t;
- for (t = 0; t < UNCONSTRAINED_NODES; t++)
- pc->fc.coef_probs_4x4[b][r][c][p][t] =
- default_coef_probs_4x4[b][r][c][p][t];
- vp9_get_model_distribution(
- default_coef_probs_4x4[b][r][c][p][UNCONSTRAINED_NODES - 1],
- pc->fc.coef_probs_4x4[b][r][c][p], b, r);
- for (t = 0; t < UNCONSTRAINED_NODES; t++)
- pc->fc.coef_probs_8x8[b][r][c][p][t] =
- default_coef_probs_8x8[b][r][c][p][t];
- vp9_get_model_distribution(
- default_coef_probs_8x8[b][r][c][p][UNCONSTRAINED_NODES - 1],
- pc->fc.coef_probs_8x8[b][r][c][p], b, r);
- for (t = 0; t < UNCONSTRAINED_NODES; t++)
- pc->fc.coef_probs_16x16[b][r][c][p][t] =
- default_coef_probs_16x16[b][r][c][p][t];
- vp9_get_model_distribution(
- default_coef_probs_16x16[b][r][c][p][UNCONSTRAINED_NODES - 1],
- pc->fc.coef_probs_16x16[b][r][c][p], b, r);
- for (t = 0; t < UNCONSTRAINED_NODES; t++)
- pc->fc.coef_probs_32x32[b][r][c][p][t] =
- default_coef_probs_32x32[b][r][c][p][t];
- vp9_get_model_distribution(
- default_coef_probs_32x32[b][r][c][p][UNCONSTRAINED_NODES - 1],
- pc->fc.coef_probs_32x32[b][r][c][p], b, r);
- }
-#else
- vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4,
- sizeof(pc->fc.coef_probs_4x4));
- vpx_memcpy(pc->fc.coef_probs_8x8, default_coef_probs_8x8,
- sizeof(pc->fc.coef_probs_8x8));
- vpx_memcpy(pc->fc.coef_probs_16x16, default_coef_probs_16x16,
- sizeof(pc->fc.coef_probs_16x16));
- vpx_memcpy(pc->fc.coef_probs_32x32, default_coef_probs_32x32,
- sizeof(pc->fc.coef_probs_32x32));
-#endif
+ vpx_memcpy(pc->fc.coef_probs[TX_4X4], default_coef_probs_4x4,
+ sizeof(pc->fc.coef_probs[TX_4X4]));
+ vpx_memcpy(pc->fc.coef_probs[TX_8X8], default_coef_probs_8x8,
+ sizeof(pc->fc.coef_probs[TX_8X8]));
+ vpx_memcpy(pc->fc.coef_probs[TX_16X16], default_coef_probs_16x16,
+ sizeof(pc->fc.coef_probs[TX_16X16]));
+ vpx_memcpy(pc->fc.coef_probs[TX_32X32], default_coef_probs_32x32,
+ sizeof(pc->fc.coef_probs[TX_32X32]));
}
-#if CONFIG_MODELCOEFPROB
-// This is a placeholder function that will enable the default coef probs to
-// change for key frames based on the base_qindex. If base_qindex is large,
-// we can expect probabilities of zeros to be bigger, and vice versa. The rest
-// of the probabilities are derived from the nodel.
-void vp9_adjust_default_coef_probs(VP9_COMMON *cm) {
- static const int factor_bits = 4;
- static const int factor_rnd = 8; // (1 << (factor_bits - 1))
- int b, r, c, p;
- int factor = (1 << factor_bits);
- /*
- if (cm->base_qindex < 32)
- factor -= ((32 - cm->base_qindex) >> 4);
- */
- if (cm->base_qindex > 128)
- factor += ((cm->base_qindex - 128) >> 4);
- // printf(" Q %d factor %d\n", cm->base_qindex, factor);
-
- for (b = 0; b < BLOCK_TYPES; ++b)
- for (r = 0; r < REF_TYPES; ++r)
- for (c = 0; c < COEF_BANDS; ++c)
- for (p = 0; p < PREV_COEF_CONTEXTS; ++p) {
- int t, x;
- vp9_prob prob;
- for (t = 0; t < UNCONSTRAINED_NODES; t++) {
- x = (default_coef_probs_4x4[b][r][c][p][t] * factor + factor_rnd)
- >> factor_bits;
- prob = (x > 255 ? 255 : (x < 1 ? 1 : x));
- cm->fc.coef_probs_4x4[b][r][c][p][t] = prob;
- }
- vp9_get_model_distribution(
- prob, cm->fc.coef_probs_4x4[b][r][c][p], b, r);
- for (t = 0; t < UNCONSTRAINED_NODES; t++) {
- x = (default_coef_probs_8x8[b][r][c][p][t] * factor + factor_rnd)
- >> factor_bits;
- prob = (x > 255 ? 255 : (x < 1 ? 1 : x));
- cm->fc.coef_probs_8x8[b][r][c][p][t] = prob;
- }
- vp9_get_model_distribution(
- prob, cm->fc.coef_probs_8x8[b][r][c][p], b, r);
- for (t = 0; t < UNCONSTRAINED_NODES; t++) {
- x = (default_coef_probs_16x16[b][r][c][p][t] * factor + factor_rnd)
- >> factor_bits;
- prob = (x > 255 ? 255 : (x < 1 ? 1 : x));
- cm->fc.coef_probs_16x16[b][r][c][p][t] = prob;
- }
- vp9_get_model_distribution(
- prob, cm->fc.coef_probs_16x16[b][r][c][p], b, r);
- for (t = 0; t < UNCONSTRAINED_NODES; t++) {
- x = (default_coef_probs_32x32[b][r][c][p][t] * factor + factor_rnd)
- >> factor_bits;
- prob = (x > 255 ? 255 : (x < 1 ? 1 : x));
- cm->fc.coef_probs_32x32[b][r][c][p][t] = prob;
- }
- vp9_get_model_distribution(
- prob, cm->fc.coef_probs_32x32[b][r][c][p], b, r);
- }
-}
-#endif
-
// Neighborhood 5-tuples for various scans and blocksizes,
// in {top, left, topleft, topright, bottomleft} order
// for each position in raster scan order.
// -1 indicates the neighbor does not exist.
DECLARE_ALIGNED(16, int,
- vp9_default_zig_zag1d_4x4_neighbors[16 * MAX_NEIGHBORS]);
+ vp9_default_scan_4x4_neighbors[16 * MAX_NEIGHBORS]);
DECLARE_ALIGNED(16, int,
vp9_col_scan_4x4_neighbors[16 * MAX_NEIGHBORS]);
DECLARE_ALIGNED(16, int,
@@ -2291,15 +508,15 @@
DECLARE_ALIGNED(16, int,
vp9_row_scan_8x8_neighbors[64 * MAX_NEIGHBORS]);
DECLARE_ALIGNED(16, int,
- vp9_default_zig_zag1d_8x8_neighbors[64 * MAX_NEIGHBORS]);
+ vp9_default_scan_8x8_neighbors[64 * MAX_NEIGHBORS]);
DECLARE_ALIGNED(16, int,
vp9_col_scan_16x16_neighbors[256 * MAX_NEIGHBORS]);
DECLARE_ALIGNED(16, int,
vp9_row_scan_16x16_neighbors[256 * MAX_NEIGHBORS]);
DECLARE_ALIGNED(16, int,
- vp9_default_zig_zag1d_16x16_neighbors[256 * MAX_NEIGHBORS]);
+ vp9_default_scan_16x16_neighbors[256 * MAX_NEIGHBORS]);
DECLARE_ALIGNED(16, int,
- vp9_default_zig_zag1d_32x32_neighbors[1024 * MAX_NEIGHBORS]);
+ vp9_default_scan_32x32_neighbors[1024 * MAX_NEIGHBORS]);
static int find_in_scan(const int *scan, int l, int idx) {
int n, l2 = l * l;
@@ -2361,32 +578,32 @@
}
void vp9_init_neighbors() {
- init_scan_neighbors(vp9_default_zig_zag1d_4x4, 4,
- vp9_default_zig_zag1d_4x4_neighbors, MAX_NEIGHBORS);
+ init_scan_neighbors(vp9_default_scan_4x4, 4,
+ vp9_default_scan_4x4_neighbors, MAX_NEIGHBORS);
init_scan_neighbors(vp9_row_scan_4x4, 4,
vp9_row_scan_4x4_neighbors, MAX_NEIGHBORS);
init_scan_neighbors(vp9_col_scan_4x4, 4,
vp9_col_scan_4x4_neighbors, MAX_NEIGHBORS);
- init_scan_neighbors(vp9_default_zig_zag1d_8x8, 8,
- vp9_default_zig_zag1d_8x8_neighbors, MAX_NEIGHBORS);
+ init_scan_neighbors(vp9_default_scan_8x8, 8,
+ vp9_default_scan_8x8_neighbors, MAX_NEIGHBORS);
init_scan_neighbors(vp9_row_scan_8x8, 8,
vp9_row_scan_8x8_neighbors, MAX_NEIGHBORS);
init_scan_neighbors(vp9_col_scan_8x8, 8,
vp9_col_scan_8x8_neighbors, MAX_NEIGHBORS);
- init_scan_neighbors(vp9_default_zig_zag1d_16x16, 16,
- vp9_default_zig_zag1d_16x16_neighbors, MAX_NEIGHBORS);
+ init_scan_neighbors(vp9_default_scan_16x16, 16,
+ vp9_default_scan_16x16_neighbors, MAX_NEIGHBORS);
init_scan_neighbors(vp9_row_scan_16x16, 16,
vp9_row_scan_16x16_neighbors, MAX_NEIGHBORS);
init_scan_neighbors(vp9_col_scan_16x16, 16,
vp9_col_scan_16x16_neighbors, MAX_NEIGHBORS);
- init_scan_neighbors(vp9_default_zig_zag1d_32x32, 32,
- vp9_default_zig_zag1d_32x32_neighbors, MAX_NEIGHBORS);
+ init_scan_neighbors(vp9_default_scan_32x32, 32,
+ vp9_default_scan_32x32_neighbors, MAX_NEIGHBORS);
}
const int *vp9_get_coef_neighbors_handle(const int *scan, int *pad) {
- if (scan == vp9_default_zig_zag1d_4x4) {
+ if (scan == vp9_default_scan_4x4) {
*pad = MAX_NEIGHBORS;
- return vp9_default_zig_zag1d_4x4_neighbors;
+ return vp9_default_scan_4x4_neighbors;
} else if (scan == vp9_row_scan_4x4) {
*pad = MAX_NEIGHBORS;
return vp9_row_scan_4x4_neighbors;
@@ -2393,9 +610,9 @@
} else if (scan == vp9_col_scan_4x4) {
*pad = MAX_NEIGHBORS;
return vp9_col_scan_4x4_neighbors;
- } else if (scan == vp9_default_zig_zag1d_8x8) {
+ } else if (scan == vp9_default_scan_8x8) {
*pad = MAX_NEIGHBORS;
- return vp9_default_zig_zag1d_8x8_neighbors;
+ return vp9_default_scan_8x8_neighbors;
} else if (scan == vp9_row_scan_8x8) {
*pad = 2;
return vp9_row_scan_8x8_neighbors;
@@ -2402,9 +619,9 @@
} else if (scan == vp9_col_scan_8x8) {
*pad = 2;
return vp9_col_scan_8x8_neighbors;
- } else if (scan == vp9_default_zig_zag1d_16x16) {
+ } else if (scan == vp9_default_scan_16x16) {
*pad = MAX_NEIGHBORS;
- return vp9_default_zig_zag1d_16x16_neighbors;
+ return vp9_default_scan_16x16_neighbors;
} else if (scan == vp9_row_scan_16x16) {
*pad = 2;
return vp9_row_scan_16x16_neighbors;
@@ -2411,9 +628,9 @@
} else if (scan == vp9_col_scan_16x16) {
*pad = 2;
return vp9_col_scan_16x16_neighbors;
- } else if (scan == vp9_default_zig_zag1d_32x32) {
+ } else if (scan == vp9_default_scan_32x32) {
*pad = MAX_NEIGHBORS;
- return vp9_default_zig_zag1d_32x32_neighbors;
+ return vp9_default_scan_32x32_neighbors;
} else {
assert(0);
return NULL;
@@ -2424,1098 +641,8 @@
vp9_init_neighbors();
init_bit_trees();
vp9_tokens_from_tree(vp9_coef_encodings, vp9_coef_tree);
-#if CONFIG_CODE_NONZEROCOUNT
- vp9_tokens_from_tree(vp9_nzc4x4_encodings, vp9_nzc4x4_tree);
- vp9_tokens_from_tree(vp9_nzc8x8_encodings, vp9_nzc8x8_tree);
- vp9_tokens_from_tree(vp9_nzc16x16_encodings, vp9_nzc16x16_tree);
- vp9_tokens_from_tree(vp9_nzc32x32_encodings, vp9_nzc32x32_tree);
-#endif
}
-#if CONFIG_CODE_NONZEROCOUNT
-
-#define mb_in_cur_tile(cm, mb_row, mb_col) \
- ((mb_col) >= (cm)->cur_tile_mb_col_start && \
- (mb_col) <= (cm)->cur_tile_mb_col_end && \
- (mb_row) >= 0)
-
-#define choose_nzc_context(nzc_exp, t2, t1) \
- ((nzc_exp) >= (t2) ? 2 : (nzc_exp) >= (t1) ? 1 : 0)
-
-#define NZC_T2_32X32 (16 << 6)
-#define NZC_T1_32X32 (4 << 6)
-
-#define NZC_T2_16X16 (12 << 6)
-#define NZC_T1_16X16 (3 << 6)
-
-#define NZC_T2_8X8 (8 << 6)
-#define NZC_T1_8X8 (2 << 6)
-
-#define NZC_T2_4X4 (4 << 6)
-#define NZC_T1_4X4 (1 << 6)
-
-// Transforms a mb16 block index to a sb64 block index
-static inline int mb16_to_sb64_index(int mb_row, int mb_col, int block) {
- int r = (mb_row & 3);
- int c = (mb_col & 3);
- int b;
- if (block < 16) { // Y
- int ib = block >> 2;
- int jb = block & 3;
- ib += r * 4;
- jb += c * 4;
- b = ib * 16 + jb;
- assert(b < 256);
- return b;
- } else { // UV
- int base = block - (block & 3);
- int ib = (block - base) >> 1;
- int jb = (block - base) & 1;
- ib += r * 2;
- jb += c * 2;
- b = base * 16 + ib * 8 + jb;
- assert(b >= 256 && b < 384);
- return b;
- }
-}
-
-// Transforms a mb16 block index to a sb32 block index
-static inline int mb16_to_sb32_index(int mb_row, int mb_col, int block) {
- int r = (mb_row & 1);
- int c = (mb_col & 1);
- int b;
- if (block < 16) { // Y
- int ib = block >> 2;
- int jb = block & 3;
- ib += r * 4;
- jb += c * 4;
- b = ib * 8 + jb;
- assert(b < 64);
- return b;
- } else { // UV
- int base = block - (block & 3);
- int ib = (block - base) >> 1;
- int jb = (block - base) & 1;
- ib += r * 2;
- jb += c * 2;
- b = base * 4 + ib * 4 + jb;
- assert(b >= 64 && b < 96);
- return b;
- }
-}
-
-static inline int block_to_txfm_index(int block, TX_SIZE tx_size, int s) {
- // s is the log of the number of 4x4 blocks in each row/col of larger block
- int b, ib, jb, nb;
- ib = block >> s;
- jb = block - (ib << s);
- ib >>= tx_size;
- jb >>= tx_size;
- nb = 1 << (s - tx_size);
- b = (ib * nb + jb) << (2 * tx_size);
- return b;
-}
-
-/* BEGIN - Helper functions to get the y nzcs */
-static unsigned int get_nzc_4x4_y_sb64(MB_MODE_INFO *mi, int block) {
- int b;
- assert(block < 256);
- b = block_to_txfm_index(block, mi->txfm_size, 4);
- assert(b < 256);
- return mi->nzcs[b] << (6 - 2 * mi->txfm_size);
-}
-
-static unsigned int get_nzc_4x4_y_sb32(MB_MODE_INFO *mi, int block) {
- int b;
- assert(block < 64);
- b = block_to_txfm_index(block, mi->txfm_size, 3);
- assert(b < 64);
- return mi->nzcs[b] << (6 - 2 * mi->txfm_size);
-}
-
-static unsigned int get_nzc_4x4_y_mb16(MB_MODE_INFO *mi, int block) {
- int b;
- assert(block < 16);
- b = block_to_txfm_index(block, mi->txfm_size, 2);
- assert(b < 16);
- return mi->nzcs[b] << (6 - 2 * mi->txfm_size);
-}
-/* END - Helper functions to get the y nzcs */
-
-/* Function to get y nzc where block index is in mb16 terms */
-static unsigned int get_nzc_4x4_y(VP9_COMMON *cm, MODE_INFO *m,
- int mb_row, int mb_col, int block) {
- // NOTE: All values returned are at 64 times the true value at 4x4 scale
- MB_MODE_INFO *const mi = &m->mbmi;
- const int mis = cm->mode_info_stride;
- if (mi->mb_skip_coeff || !mb_in_cur_tile(cm, mb_row, mb_col))
- return 0;
- if (mi->sb_type == BLOCK_SIZE_SB64X64) {
- int r = mb_row & 3;
- int c = mb_col & 3;
- m -= c + r * mis;
- if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row - r, mb_col - c))
- return 0;
- else
- return get_nzc_4x4_y_sb64(
- &m->mbmi, mb16_to_sb64_index(mb_row, mb_col, block));
- } else if (mi->sb_type == BLOCK_SIZE_SB32X32) {
- int r = mb_row & 1;
- int c = mb_col & 1;
- m -= c + r * mis;
- if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row - r, mb_col - c))
- return 0;
- else
- return get_nzc_4x4_y_sb32(
- &m->mbmi, mb16_to_sb32_index(mb_row, mb_col, block));
- } else {
- if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row, mb_col))
- return 0;
- return get_nzc_4x4_y_mb16(mi, block);
- }
-}
-
-/* BEGIN - Helper functions to get the uv nzcs */
-static unsigned int get_nzc_4x4_uv_sb64(MB_MODE_INFO *mi, int block) {
- int b;
- int base, uvtxfm_size;
- assert(block >= 256 && block < 384);
- uvtxfm_size = mi->txfm_size;
- base = 256 + (block & 64);
- block -= base;
- b = base + block_to_txfm_index(block, uvtxfm_size, 3);
- assert(b >= 256 && b < 384);
- return mi->nzcs[b] << (6 - 2 * uvtxfm_size);
-}
-
-static unsigned int get_nzc_4x4_uv_sb32(MB_MODE_INFO *mi, int block) {
- int b;
- int base, uvtxfm_size;
- assert(block >= 64 && block < 96);
- if (mi->txfm_size == TX_32X32)
- uvtxfm_size = TX_16X16;
- else
- uvtxfm_size = mi->txfm_size;
- base = 64 + (block & 16);
- block -= base;
- b = base + block_to_txfm_index(block, uvtxfm_size, 2);
- assert(b >= 64 && b < 96);
- return mi->nzcs[b] << (6 - 2 * uvtxfm_size);
-}
-
-static unsigned int get_nzc_4x4_uv_mb16(MB_MODE_INFO *mi, int block) {
- int b;
- int base, uvtxfm_size;
- assert(block >= 16 && block < 24);
- if (mi->txfm_size == TX_8X8 &&
- (mi->mode == SPLITMV || mi->mode == I8X8_PRED))
- uvtxfm_size = TX_4X4;
- else if (mi->txfm_size == TX_16X16)
- uvtxfm_size = TX_8X8;
- else
- uvtxfm_size = mi->txfm_size;
- base = 16 + (block & 4);
- block -= base;
- b = base + block_to_txfm_index(block, uvtxfm_size, 1);
- assert(b >= 16 && b < 24);
- return mi->nzcs[b] << (6 - 2 * uvtxfm_size);
-}
-/* END - Helper functions to get the uv nzcs */
-
-/* Function to get uv nzc where block index is in mb16 terms */
-static unsigned int get_nzc_4x4_uv(VP9_COMMON *cm, MODE_INFO *m,
- int mb_row, int mb_col, int block) {
- // NOTE: All values returned are at 64 times the true value at 4x4 scale
- MB_MODE_INFO *const mi = &m->mbmi;
- const int mis = cm->mode_info_stride;
- if (mi->mb_skip_coeff || !mb_in_cur_tile(cm, mb_row, mb_col))
- return 0;
- if (mi->sb_type == BLOCK_SIZE_SB64X64) {
- int r = mb_row & 3;
- int c = mb_col & 3;
- m -= c + r * mis;
- if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row - r, mb_col - c))
- return 0;
- else
- return get_nzc_4x4_uv_sb64(
- &m->mbmi, mb16_to_sb64_index(mb_row, mb_col, block));
- } else if (mi->sb_type == BLOCK_SIZE_SB32X32) {
- int r = mb_row & 1;
- int c = mb_col & 1;
- m -= c + r * mis;
- if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row - r, mb_col - c))
- return 0;
- else
- return get_nzc_4x4_uv_sb32(
- &m->mbmi, mb16_to_sb32_index(mb_row, mb_col, block));
- } else {
- return get_nzc_4x4_uv_mb16(mi, block);
- }
-}
-
-int vp9_get_nzc_context_y_sb64(VP9_COMMON *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block) {
- // returns an index in [0, MAX_NZC_CONTEXTS - 1] to reflect how busy
- // neighboring blocks are
- int mis = cm->mode_info_stride;
- int nzc_exp = 0;
- TX_SIZE txfm_size = cur->mbmi.txfm_size;
- assert(block < 256);
- switch (txfm_size) {
- case TX_32X32:
- assert((block & 63) == 0);
- if (block < 128) {
- int o = (block >> 6) * 2;
- nzc_exp =
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 12) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 13) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 14) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 15) +
- get_nzc_4x4_y(cm, cur - mis + o + 1,
- mb_row - 1, mb_col + o + 1, 12) +
- get_nzc_4x4_y(cm, cur - mis + o + 1,
- mb_row - 1, mb_col + o + 1, 13) +
- get_nzc_4x4_y(cm, cur - mis + o + 1,
- mb_row - 1, mb_col + o + 1, 14) +
- get_nzc_4x4_y(cm, cur - mis + o + 1,
- mb_row - 1, mb_col + o + 1, 15);
- } else {
- nzc_exp = cur->mbmi.nzcs[block - 128] << 3;
- }
- if ((block & 127) == 0) {
- int o = (block >> 7) * 2;
- nzc_exp +=
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 3) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 7) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 11) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 15) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis + mis,
- mb_row + o + 1, mb_col - 1, 3) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis + mis,
- mb_row + o + 1, mb_col - 1, 7) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis + mis,
- mb_row + o + 1, mb_col - 1, 11) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis + mis,
- mb_row + o + 1, mb_col - 1, 15);
- } else {
- nzc_exp += cur->mbmi.nzcs[block - 64] << 3;
- }
- nzc_exp <<= 2;
- // Note nzc_exp is 64 times the average value expected at 32x32 scale
- return choose_nzc_context(nzc_exp, NZC_T2_32X32, NZC_T1_32X32);
- break;
-
- case TX_16X16:
- assert((block & 15) == 0);
- if (block < 64) {
- int o = block >> 4;
- nzc_exp =
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 12) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 13) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 14) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 15);
- } else {
- nzc_exp = cur->mbmi.nzcs[block - 64] << 4;
- }
- if ((block & 63) == 0) {
- int o = block >> 6;
- nzc_exp +=
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 3) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 7) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 11) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 15);
- } else {
- nzc_exp += cur->mbmi.nzcs[block - 16] << 4;
- }
- nzc_exp <<= 1;
- // Note nzc_exp is 64 times the average value expected at 16x16 scale
- return choose_nzc_context(nzc_exp, NZC_T2_16X16, NZC_T1_16X16);
- break;
-
- case TX_8X8:
- assert((block & 3) == 0);
- if (block < 32) {
- int o = block >> 3;
- int p = ((block >> 2) & 1) ? 14 : 12;
- nzc_exp =
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, p) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, p + 1);
- } else {
- nzc_exp = cur->mbmi.nzcs[block - 32] << 5;
- }
- if ((block & 31) == 0) {
- int o = block >> 6;
- int p = ((block >> 5) & 1) ? 11 : 3;
- nzc_exp +=
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, p) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, p + 4);
- } else {
- nzc_exp += cur->mbmi.nzcs[block - 4] << 5;
- }
- // Note nzc_exp is 64 times the average value expected at 8x8 scale
- return choose_nzc_context(nzc_exp, NZC_T2_8X8, NZC_T1_8X8);
- break;
-
- case TX_4X4:
- if (block < 16) {
- int o = block >> 2;
- int p = block & 3;
- nzc_exp = get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o,
- 12 + p);
- } else {
- nzc_exp = (cur->mbmi.nzcs[block - 16] << 6);
- }
- if ((block & 15) == 0) {
- int o = block >> 6;
- int p = (block >> 4) & 3;
- nzc_exp += get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1,
- 3 + 4 * p);
- } else {
- nzc_exp += (cur->mbmi.nzcs[block - 1] << 6);
- }
- nzc_exp >>= 1;
- // Note nzc_exp is 64 times the average value expected at 4x4 scale
- return choose_nzc_context(nzc_exp, NZC_T2_4X4, NZC_T1_4X4);
- break;
-
- default:
- return 0;
- }
-}
-
-int vp9_get_nzc_context_y_sb32(VP9_COMMON *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block) {
- // returns an index in [0, MAX_NZC_CONTEXTS - 1] to reflect how busy
- // neighboring blocks are
- int mis = cm->mode_info_stride;
- int nzc_exp = 0;
- TX_SIZE txfm_size = cur->mbmi.txfm_size;
- assert(block < 64);
- switch (txfm_size) {
- case TX_32X32:
- assert(block == 0);
- nzc_exp =
- (get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, 12) +
- get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, 13) +
- get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, 14) +
- get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, 15) +
- get_nzc_4x4_y(cm, cur - mis + 1, mb_row - 1, mb_col + 1, 12) +
- get_nzc_4x4_y(cm, cur - mis + 1, mb_row - 1, mb_col + 1, 13) +
- get_nzc_4x4_y(cm, cur - mis + 1, mb_row - 1, mb_col + 1, 14) +
- get_nzc_4x4_y(cm, cur - mis + 1, mb_row - 1, mb_col + 1, 15) +
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, 3) +
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, 7) +
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, 11) +
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, 15) +
- get_nzc_4x4_y(cm, cur - 1 + mis, mb_row + 1, mb_col - 1, 3) +
- get_nzc_4x4_y(cm, cur - 1 + mis, mb_row + 1, mb_col - 1, 7) +
- get_nzc_4x4_y(cm, cur - 1 + mis, mb_row + 1, mb_col - 1, 11) +
- get_nzc_4x4_y(cm, cur - 1 + mis, mb_row + 1, mb_col - 1, 15)) << 2;
- // Note nzc_exp is 64 times the average value expected at 32x32 scale
- return choose_nzc_context(nzc_exp, NZC_T2_32X32, NZC_T1_32X32);
- break;
-
- case TX_16X16:
- assert((block & 15) == 0);
- if (block < 32) {
- int o = (block >> 4) & 1;
- nzc_exp =
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 12) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 13) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 14) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, 15);
- } else {
- nzc_exp = cur->mbmi.nzcs[block - 32] << 4;
- }
- if ((block & 31) == 0) {
- int o = block >> 5;
- nzc_exp +=
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 3) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 7) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 11) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, 15);
- } else {
- nzc_exp += cur->mbmi.nzcs[block - 16] << 4;
- }
- nzc_exp <<= 1;
- // Note nzc_exp is 64 times the average value expected at 16x16 scale
- return choose_nzc_context(nzc_exp, NZC_T2_16X16, NZC_T1_16X16);
- break;
-
- case TX_8X8:
- assert((block & 3) == 0);
- if (block < 16) {
- int o = block >> 3;
- int p = ((block >> 2) & 1) ? 14 : 12;
- nzc_exp =
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, p) +
- get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o, p + 1);
- } else {
- nzc_exp = cur->mbmi.nzcs[block - 16] << 5;
- }
- if ((block & 15) == 0) {
- int o = block >> 5;
- int p = ((block >> 4) & 1) ? 11 : 3;
- nzc_exp +=
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, p) +
- get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1, p + 4);
- } else {
- nzc_exp += cur->mbmi.nzcs[block - 4] << 5;
- }
- // Note nzc_exp is 64 times the average value expected at 8x8 scale
- return choose_nzc_context(nzc_exp, NZC_T2_8X8, NZC_T1_8X8);
- break;
-
- case TX_4X4:
- if (block < 8) {
- int o = block >> 2;
- int p = block & 3;
- nzc_exp = get_nzc_4x4_y(cm, cur - mis + o, mb_row - 1, mb_col + o,
- 12 + p);
- } else {
- nzc_exp = (cur->mbmi.nzcs[block - 8] << 6);
- }
- if ((block & 7) == 0) {
- int o = block >> 5;
- int p = (block >> 3) & 3;
- nzc_exp += get_nzc_4x4_y(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1,
- 3 + 4 * p);
- } else {
- nzc_exp += (cur->mbmi.nzcs[block - 1] << 6);
- }
- nzc_exp >>= 1;
- // Note nzc_exp is 64 times the average value expected at 4x4 scale
- return choose_nzc_context(nzc_exp, NZC_T2_4X4, NZC_T1_4X4);
- break;
-
- default:
- return 0;
- break;
- }
-}
-
-int vp9_get_nzc_context_y_mb16(VP9_COMMON *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block) {
- // returns an index in [0, MAX_NZC_CONTEXTS - 1] to reflect how busy
- // neighboring blocks are
- int mis = cm->mode_info_stride;
- int nzc_exp = 0;
- TX_SIZE txfm_size = cur->mbmi.txfm_size;
- assert(block < 16);
- switch (txfm_size) {
- case TX_16X16:
- assert(block == 0);
- nzc_exp =
- get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, 12) +
- get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, 13) +
- get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, 14) +
- get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, 15) +
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, 3) +
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, 7) +
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, 11) +
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, 15);
- nzc_exp <<= 1;
- // Note nzc_exp is 64 times the average value expected at 16x16 scale
- return choose_nzc_context(nzc_exp, NZC_T2_16X16, NZC_T1_16X16);
-
- case TX_8X8:
- assert((block & 3) == 0);
- if (block < 8) {
- int p = ((block >> 2) & 1) ? 14 : 12;
- nzc_exp =
- get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, p) +
- get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col, p + 1);
- } else {
- nzc_exp = cur->mbmi.nzcs[block - 8] << 5;
- }
- if ((block & 7) == 0) {
- int p = ((block >> 3) & 1) ? 11 : 3;
- nzc_exp +=
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, p) +
- get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1, p + 4);
- } else {
- nzc_exp += cur->mbmi.nzcs[block - 4] << 5;
- }
- // Note nzc_exp is 64 times the average value expected at 8x8 scale
- return choose_nzc_context(nzc_exp, NZC_T2_8X8, NZC_T1_8X8);
-
- case TX_4X4:
- if (block < 4) {
- int p = block & 3;
- nzc_exp = get_nzc_4x4_y(cm, cur - mis, mb_row - 1, mb_col,
- 12 + p);
- } else {
- nzc_exp = (cur->mbmi.nzcs[block - 4] << 6);
- }
- if ((block & 3) == 0) {
- int p = (block >> 2) & 3;
- nzc_exp += get_nzc_4x4_y(cm, cur - 1, mb_row, mb_col - 1,
- 3 + 4 * p);
- } else {
- nzc_exp += (cur->mbmi.nzcs[block - 1] << 6);
- }
- nzc_exp >>= 1;
- // Note nzc_exp is 64 times the average value expected at 4x4 scale
- return choose_nzc_context(nzc_exp, NZC_T2_4X4, NZC_T1_4X4);
-
- default:
- return 0;
- break;
- }
-}
-
-int vp9_get_nzc_context_uv_sb64(VP9_COMMON *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block) {
- // returns an index in [0, MAX_NZC_CONTEXTS - 1] to reflect how busy
- // neighboring blocks are
- int mis = cm->mode_info_stride;
- int nzc_exp = 0;
- const int base = block - (block & 63);
- const int boff = (block & 63);
- const int base_mb16 = base >> 4;
- TX_SIZE txfm_size = cur->mbmi.txfm_size;
- TX_SIZE txfm_size_uv;
-
- assert(block >= 256 && block < 384);
- txfm_size_uv = txfm_size;
-
- switch (txfm_size_uv) {
- case TX_32X32:
- assert(block == 256 || block == 320);
- nzc_exp =
- get_nzc_4x4_uv(cm, cur - mis, mb_row - 1, mb_col,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis, mb_row - 1, mb_col,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - mis + 1, mb_row - 1, mb_col + 1,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis + 1, mb_row - 1, mb_col + 1,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - mis + 2, mb_row - 1, mb_col + 2,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis + 2, mb_row - 1, mb_col + 2,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - mis + 3, mb_row - 1, mb_col + 3,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis + 3, mb_row - 1, mb_col + 3,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - 1, mb_row, mb_col - 1,
- base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1, mb_row, mb_col - 1,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - 1 + mis, mb_row + 1, mb_col - 1,
- base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1 + mis, mb_row + 1, mb_col - 1,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - 1 + 2 * mis, mb_row + 2, mb_col - 1,
- base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1 + 2 * mis, mb_row + 2, mb_col - 1,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - 1 + 3 * mis, mb_row + 3, mb_col - 1,
- base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1 + 3 * mis, mb_row + 3, mb_col - 1,
- base_mb16 + 3);
- nzc_exp <<= 2;
- // Note nzc_exp is 64 times the average value expected at 32x32 scale
- return choose_nzc_context(nzc_exp, NZC_T2_32X32, NZC_T1_32X32);
-
- case TX_16X16:
- // uv txfm_size 16x16
- assert((block & 15) == 0);
- if (boff < 32) {
- int o = (boff >> 4) & 1;
- nzc_exp =
- get_nzc_4x4_uv(cm, cur - mis + o, mb_row - 1, mb_col + o,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis + o, mb_row - 1, mb_col + o,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - mis + o + 1, mb_row - 1, mb_col + o + 1,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis + o + 1, mb_row - 1, mb_col + o + 1,
- base_mb16 + 3);
- } else {
- nzc_exp = cur->mbmi.nzcs[block - 32] << 4;
- }
- if ((boff & 31) == 0) {
- int o = boff >> 5;
- nzc_exp +=
- get_nzc_4x4_uv(cm, cur - 1 + o * mis,
- mb_row + o, mb_col - 1, base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1 + o * mis,
- mb_row + o, mb_col - 1, base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - 1 + o * mis + mis,
- mb_row + o + 1, mb_col - 1, base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1 + o * mis + mis,
- mb_row + o + 1, mb_col - 1, base_mb16 + 3);
- } else {
- nzc_exp += cur->mbmi.nzcs[block - 16] << 4;
- }
- nzc_exp <<= 1;
- // Note nzc_exp is 64 times the average value expected at 16x16 scale
- return choose_nzc_context(nzc_exp, NZC_T2_16X16, NZC_T1_16X16);
-
- case TX_8X8:
- assert((block & 3) == 0);
- if (boff < 16) {
- int o = boff >> 2;
- nzc_exp =
- get_nzc_4x4_uv(cm, cur - mis + o, mb_row - 1, mb_col + o,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis + o, mb_row - 1, mb_col + o,
- base_mb16 + 3);
- } else {
- nzc_exp = cur->mbmi.nzcs[block - 16] << 5;
- }
- if ((boff & 15) == 0) {
- int o = boff >> 4;
- nzc_exp +=
- get_nzc_4x4_uv(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1,
- base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1,
- base_mb16 + 3);
- } else {
- nzc_exp += cur->mbmi.nzcs[block - 4] << 5;
- }
- // Note nzc_exp is 64 times the average value expected at 8x8 scale
- return choose_nzc_context(nzc_exp, NZC_T2_8X8, NZC_T1_8X8);
-
- case TX_4X4:
- if (boff < 8) {
- int o = boff >> 1;
- int p = boff & 1;
- nzc_exp = get_nzc_4x4_uv(cm, cur - mis + o, mb_row - 1, mb_col + o,
- base_mb16 + 2 + p);
- } else {
- nzc_exp = (cur->mbmi.nzcs[block - 8] << 6);
- }
- if ((boff & 7) == 0) {
- int o = boff >> 4;
- int p = (boff >> 3) & 1;
- nzc_exp += get_nzc_4x4_uv(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1,
- base_mb16 + 1 + 2 * p);
- } else {
- nzc_exp += (cur->mbmi.nzcs[block - 1] << 6);
- }
- nzc_exp >>= 1;
- // Note nzc_exp is 64 times the average value expected at 4x4 scale
- return choose_nzc_context(nzc_exp, NZC_T2_4X4, NZC_T1_4X4);
-
- default:
- return 0;
- }
-}
-
-int vp9_get_nzc_context_uv_sb32(VP9_COMMON *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block) {
- // returns an index in [0, MAX_NZC_CONTEXTS - 1] to reflect how busy
- // neighboring blocks are
- int mis = cm->mode_info_stride;
- int nzc_exp = 0;
- const int base = block - (block & 15);
- const int boff = (block & 15);
- const int base_mb16 = base >> 2;
- TX_SIZE txfm_size = cur->mbmi.txfm_size;
- TX_SIZE txfm_size_uv;
-
- assert(block >= 64 && block < 96);
- if (txfm_size == TX_32X32)
- txfm_size_uv = TX_16X16;
- else
- txfm_size_uv = txfm_size;
-
- switch (txfm_size_uv) {
- case TX_16X16:
- // uv txfm_size 16x16
- assert(block == 64 || block == 80);
- nzc_exp =
- get_nzc_4x4_uv(cm, cur - mis, mb_row - 1, mb_col,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis, mb_row - 1, mb_col,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - mis + 1, mb_row - 1, mb_col + 1,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis + 1, mb_row - 1, mb_col + 1,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - 1 + mis, mb_row, mb_col - 1,
- base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1 + mis, mb_row, mb_col - 1,
- base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - 1 + mis, mb_row + 1, mb_col - 1,
- base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1 + mis, mb_row + 1, mb_col - 1,
- base_mb16 + 3);
- nzc_exp <<= 1;
- // Note nzc_exp is 64 times the average value expected at 16x16 scale
- return choose_nzc_context(nzc_exp, NZC_T2_16X16, NZC_T1_16X16);
- break;
-
- case TX_8X8:
- assert((block & 3) == 0);
- if (boff < 8) {
- int o = boff >> 2;
- nzc_exp =
- get_nzc_4x4_uv(cm, cur - mis + o, mb_row - 1, mb_col + o,
- base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis + o, mb_row - 1, mb_col + o,
- base_mb16 + 3);
- } else {
- nzc_exp = cur->mbmi.nzcs[block - 8] << 5;
- }
- if ((boff & 7) == 0) {
- int o = boff >> 3;
- nzc_exp +=
- get_nzc_4x4_uv(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1,
- base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1,
- base_mb16 + 3);
- } else {
- nzc_exp += cur->mbmi.nzcs[block - 4] << 5;
- }
- // Note nzc_exp is 64 times the average value expected at 8x8 scale
- return choose_nzc_context(nzc_exp, NZC_T2_8X8, NZC_T1_8X8);
-
- case TX_4X4:
- if (boff < 4) {
- int o = boff >> 1;
- int p = boff & 1;
- nzc_exp = get_nzc_4x4_uv(cm, cur - mis + o, mb_row - 1, mb_col + o,
- base_mb16 + 2 + p);
- } else {
- nzc_exp = (cur->mbmi.nzcs[block - 4] << 6);
- }
- if ((boff & 3) == 0) {
- int o = boff >> 3;
- int p = (boff >> 2) & 1;
- nzc_exp += get_nzc_4x4_uv(cm, cur - 1 + o * mis, mb_row + o, mb_col - 1,
- base_mb16 + 1 + 2 * p);
- } else {
- nzc_exp += (cur->mbmi.nzcs[block - 1] << 6);
- }
- nzc_exp >>= 1;
- // Note nzc_exp is 64 times the average value expected at 4x4 scale
- return choose_nzc_context(nzc_exp, NZC_T2_4X4, NZC_T1_4X4);
-
- default:
- return 0;
- }
-}
-
-int vp9_get_nzc_context_uv_mb16(VP9_COMMON *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block) {
- // returns an index in [0, MAX_NZC_CONTEXTS - 1] to reflect how busy
- // neighboring blocks are
- int mis = cm->mode_info_stride;
- int nzc_exp = 0;
- const int base = block - (block & 3);
- const int boff = (block & 3);
- const int base_mb16 = base;
- TX_SIZE txfm_size = cur->mbmi.txfm_size;
- TX_SIZE txfm_size_uv;
-
- assert(block >= 16 && block < 24);
- if (txfm_size == TX_16X16)
- txfm_size_uv = TX_8X8;
- else if (txfm_size == TX_8X8 &&
- (cur->mbmi.mode == I8X8_PRED || cur->mbmi.mode == SPLITMV))
- txfm_size_uv = TX_4X4;
- else
- txfm_size_uv = txfm_size;
-
- switch (txfm_size_uv) {
- case TX_8X8:
- assert((block & 3) == 0);
- nzc_exp =
- get_nzc_4x4_uv(cm, cur - mis, mb_row - 1, mb_col, base_mb16 + 2) +
- get_nzc_4x4_uv(cm, cur - mis, mb_row - 1, mb_col, base_mb16 + 3) +
- get_nzc_4x4_uv(cm, cur - 1, mb_row, mb_col - 1, base_mb16 + 1) +
- get_nzc_4x4_uv(cm, cur - 1, mb_row, mb_col - 1, base_mb16 + 3);
- // Note nzc_exp is 64 times the average value expected at 8x8 scale
- return choose_nzc_context(nzc_exp, NZC_T2_8X8, NZC_T1_8X8);
-
- case TX_4X4:
- if (boff < 2) {
- int p = boff & 1;
- nzc_exp = get_nzc_4x4_uv(cm, cur - mis, mb_row - 1, mb_col,
- base_mb16 + 2 + p);
- } else {
- nzc_exp = (cur->mbmi.nzcs[block - 2] << 6);
- }
- if ((boff & 1) == 0) {
- int p = (boff >> 1) & 1;
- nzc_exp += get_nzc_4x4_uv(cm, cur - 1, mb_row, mb_col - 1,
- base_mb16 + 1 + 2 * p);
- } else {
- nzc_exp += (cur->mbmi.nzcs[block - 1] << 6);
- }
- nzc_exp >>= 1;
- // Note nzc_exp is 64 times the average value expected at 4x4 scale
- return choose_nzc_context(nzc_exp, NZC_T2_4X4, NZC_T1_4X4);
-
- default:
- return 0;
- }
-}
-
-int vp9_get_nzc_context(VP9_COMMON *cm, MACROBLOCKD *xd, int block) {
- if (xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_SB64X64) {
- assert(block < 384);
- if (block < 256)
- return vp9_get_nzc_context_y_sb64(cm, xd->mode_info_context,
- get_mb_row(xd), get_mb_col(xd), block);
- else
- return vp9_get_nzc_context_uv_sb64(cm, xd->mode_info_context,
- get_mb_row(xd), get_mb_col(xd), block);
- } else if (xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_SB32X32) {
- assert(block < 96);
- if (block < 64)
- return vp9_get_nzc_context_y_sb32(cm, xd->mode_info_context,
- get_mb_row(xd), get_mb_col(xd), block);
- else
- return vp9_get_nzc_context_uv_sb32(cm, xd->mode_info_context,
- get_mb_row(xd), get_mb_col(xd), block);
- } else {
- assert(block < 64);
- if (block < 16)
- return vp9_get_nzc_context_y_mb16(cm, xd->mode_info_context,
- get_mb_row(xd), get_mb_col(xd), block);
- else
- return vp9_get_nzc_context_uv_mb16(cm, xd->mode_info_context,
- get_mb_row(xd), get_mb_col(xd), block);
- }
-}
-
-static void update_nzc(VP9_COMMON *cm,
- uint16_t nzc,
- int nzc_context,
- TX_SIZE tx_size,
- int ref,
- int type) {
- int e, c;
- c = codenzc(nzc);
- if (tx_size == TX_32X32)
- cm->fc.nzc_counts_32x32[nzc_context][ref][type][c]++;
- else if (tx_size == TX_16X16)
- cm->fc.nzc_counts_16x16[nzc_context][ref][type][c]++;
- else if (tx_size == TX_8X8)
- cm->fc.nzc_counts_8x8[nzc_context][ref][type][c]++;
- else if (tx_size == TX_4X4)
- cm->fc.nzc_counts_4x4[nzc_context][ref][type][c]++;
- else
- assert(0);
-
- if ((e = vp9_extranzcbits[c])) {
- int x = nzc - vp9_basenzcvalue[c];
- while (e--) {
- int b = (x >> e) & 1;
- cm->fc.nzc_pcat_counts[nzc_context][c - NZC_TOKENS_NOEXTRA][e][b]++;
- }
- }
-}
-
-static void update_nzcs_sb64(VP9_COMMON *cm,
- MACROBLOCKD *xd,
- int mb_row,
- int mb_col) {
- MODE_INFO *m = xd->mode_info_context;
- MB_MODE_INFO *const mi = &m->mbmi;
- int j, nzc_context;
- const int ref = m->mbmi.ref_frame != INTRA_FRAME;
-
- assert(mb_col == get_mb_col(xd));
- assert(mb_row == get_mb_row(xd));
-
- if (mi->mb_skip_coeff)
- return;
-
- switch (mi->txfm_size) {
- case TX_32X32:
- for (j = 0; j < 256; j += 64) {
- nzc_context = vp9_get_nzc_context_y_sb64(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_32X32, ref, 0);
- }
- for (j = 256; j < 384; j += 64) {
- nzc_context = vp9_get_nzc_context_uv_sb64(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_32X32, ref, 1);
- }
- break;
-
- case TX_16X16:
- for (j = 0; j < 256; j += 16) {
- nzc_context = vp9_get_nzc_context_y_sb64(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_16X16, ref, 0);
- }
- for (j = 256; j < 384; j += 16) {
- nzc_context = vp9_get_nzc_context_uv_sb64(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_16X16, ref, 1);
- }
- break;
-
- case TX_8X8:
- for (j = 0; j < 256; j += 4) {
- nzc_context = vp9_get_nzc_context_y_sb64(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_8X8, ref, 0);
- }
- for (j = 256; j < 384; j += 4) {
- nzc_context = vp9_get_nzc_context_uv_sb64(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_8X8, ref, 1);
- }
- break;
-
- case TX_4X4:
- for (j = 0; j < 256; ++j) {
- nzc_context = vp9_get_nzc_context_y_sb64(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_4X4, ref, 0);
- }
- for (j = 256; j < 384; ++j) {
- nzc_context = vp9_get_nzc_context_uv_sb64(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_4X4, ref, 1);
- }
- break;
-
- default:
- break;
- }
-}
-
-static void update_nzcs_sb32(VP9_COMMON *cm,
- MACROBLOCKD *xd,
- int mb_row,
- int mb_col) {
- MODE_INFO *m = xd->mode_info_context;
- MB_MODE_INFO *const mi = &m->mbmi;
- int j, nzc_context;
- const int ref = m->mbmi.ref_frame != INTRA_FRAME;
-
- assert(mb_col == get_mb_col(xd));
- assert(mb_row == get_mb_row(xd));
-
- if (mi->mb_skip_coeff)
- return;
-
- switch (mi->txfm_size) {
- case TX_32X32:
- for (j = 0; j < 64; j += 64) {
- nzc_context = vp9_get_nzc_context_y_sb32(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_32X32, ref, 0);
- }
- for (j = 64; j < 96; j += 16) {
- nzc_context = vp9_get_nzc_context_uv_sb32(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_16X16, ref, 1);
- }
- break;
-
- case TX_16X16:
- for (j = 0; j < 64; j += 16) {
- nzc_context = vp9_get_nzc_context_y_sb32(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_16X16, ref, 0);
- }
- for (j = 64; j < 96; j += 16) {
- nzc_context = vp9_get_nzc_context_uv_sb32(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_16X16, ref, 1);
- }
- break;
-
- case TX_8X8:
- for (j = 0; j < 64; j += 4) {
- nzc_context = vp9_get_nzc_context_y_sb32(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_8X8, ref, 0);
- }
- for (j = 64; j < 96; j += 4) {
- nzc_context = vp9_get_nzc_context_uv_sb32(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_8X8, ref, 1);
- }
- break;
-
- case TX_4X4:
- for (j = 0; j < 64; ++j) {
- nzc_context = vp9_get_nzc_context_y_sb32(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_4X4, ref, 0);
- }
- for (j = 64; j < 96; ++j) {
- nzc_context = vp9_get_nzc_context_uv_sb32(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_4X4, ref, 1);
- }
- break;
-
- default:
- break;
- }
-}
-
-static void update_nzcs_mb16(VP9_COMMON *cm,
- MACROBLOCKD *xd,
- int mb_row,
- int mb_col) {
- MODE_INFO *m = xd->mode_info_context;
- MB_MODE_INFO *const mi = &m->mbmi;
- int j, nzc_context;
- const int ref = m->mbmi.ref_frame != INTRA_FRAME;
-
- assert(mb_col == get_mb_col(xd));
- assert(mb_row == get_mb_row(xd));
-
- if (mi->mb_skip_coeff)
- return;
-
- switch (mi->txfm_size) {
- case TX_16X16:
- for (j = 0; j < 16; j += 16) {
- nzc_context = vp9_get_nzc_context_y_mb16(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_16X16, ref, 0);
- }
- for (j = 16; j < 24; j += 4) {
- nzc_context = vp9_get_nzc_context_uv_mb16(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_8X8, ref, 1);
- }
- break;
-
- case TX_8X8:
- for (j = 0; j < 16; j += 4) {
- nzc_context = vp9_get_nzc_context_y_mb16(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_8X8, ref, 0);
- }
- if (mi->mode == I8X8_PRED || mi->mode == SPLITMV) {
- for (j = 16; j < 24; ++j) {
- nzc_context = vp9_get_nzc_context_uv_mb16(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_4X4, ref, 1);
- }
- } else {
- for (j = 16; j < 24; j += 4) {
- nzc_context = vp9_get_nzc_context_uv_mb16(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_8X8, ref, 1);
- }
- }
- break;
-
- case TX_4X4:
- for (j = 0; j < 16; ++j) {
- nzc_context = vp9_get_nzc_context_y_mb16(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_4X4, ref, 0);
- }
- for (j = 16; j < 24; ++j) {
- nzc_context = vp9_get_nzc_context_uv_mb16(cm, m, mb_row, mb_col, j);
- update_nzc(cm, m->mbmi.nzcs[j], nzc_context, TX_4X4, ref, 1);
- }
- break;
-
- default:
- break;
- }
-}
-
-void vp9_update_nzc_counts(VP9_COMMON *cm,
- MACROBLOCKD *xd,
- int mb_row,
- int mb_col) {
- if (xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_SB64X64)
- update_nzcs_sb64(cm, xd, mb_row, mb_col);
- else if (xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_SB32X32)
- update_nzcs_sb32(cm, xd, mb_row, mb_col);
- else
- update_nzcs_mb16(cm, xd, mb_row, mb_col);
-}
-#endif // CONFIG_CODE_NONZEROCOUNT
-
// #define COEF_COUNT_TESTING
#define COEF_COUNT_SAT 24
@@ -3525,34 +652,61 @@
#define COEF_COUNT_SAT_AFTER_KEY 24
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
-static void adapt_coef_probs(vp9_coeff_probs *dst_coef_probs,
- vp9_coeff_probs *pre_coef_probs,
- int block_types, vp9_coeff_count *coef_counts,
- unsigned int (*eob_branch_count)[REF_TYPES]
- [COEF_BANDS]
- [PREV_COEF_CONTEXTS],
+void vp9_full_to_model_count(unsigned int *model_count,
+ unsigned int *full_count) {
+ int n;
+ model_count[ZERO_TOKEN] = full_count[ZERO_TOKEN];
+ model_count[ONE_TOKEN] = full_count[ONE_TOKEN];
+ model_count[TWO_TOKEN] = full_count[TWO_TOKEN];
+ for (n = THREE_TOKEN; n < DCT_EOB_TOKEN; ++n)
+ model_count[TWO_TOKEN] += full_count[n];
+ model_count[DCT_EOB_MODEL_TOKEN] = full_count[DCT_EOB_TOKEN];
+}
+
+void vp9_full_to_model_counts(
+ vp9_coeff_count_model *model_count, vp9_coeff_count *full_count) {
+ int i, j, k, l;
+ for (i = 0; i < BLOCK_TYPES; ++i)
+ for (j = 0; j < REF_TYPES; ++j)
+ for (k = 0; k < COEF_BANDS; ++k)
+ for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
+ if (l >= 3 && k == 0)
+ continue;
+ vp9_full_to_model_count(model_count[i][j][k][l],
+ full_count[i][j][k][l]);
+ }
+}
+
+static void adapt_coef_probs(VP9_COMMON *cm, TX_SIZE txfm_size,
int count_sat, int update_factor) {
+ vp9_coeff_probs_model *dst_coef_probs = cm->fc.coef_probs[txfm_size];
+ vp9_coeff_probs_model *pre_coef_probs = cm->fc.pre_coef_probs[txfm_size];
+ vp9_coeff_count_model *coef_counts = cm->fc.coef_counts[txfm_size];
+ unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] =
+ cm->fc.eob_branch_counts[txfm_size];
int t, i, j, k, l, count;
- unsigned int branch_ct[ENTROPY_NODES][2];
- vp9_prob coef_probs[ENTROPY_NODES];
int factor;
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_ADAPT
- int entropy_nodes_adapt = UNCONSTRAINED_ADAPT_NODES;
-#else
- int entropy_nodes_adapt = ENTROPY_NODES;
-#endif
+ unsigned int branch_ct[UNCONSTRAINED_NODES][2];
+ vp9_prob coef_probs[UNCONSTRAINED_NODES];
+ int entropy_nodes_adapt = UNCONSTRAINED_NODES;
- for (i = 0; i < block_types; ++i)
+ for (i = 0; i < BLOCK_TYPES; ++i)
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
if (l >= 3 && k == 0)
continue;
- vp9_tree_probs_from_distribution(vp9_coef_tree,
- coef_probs, branch_ct,
- coef_counts[i][j][k][l], 0);
+ vp9_tree_probs_from_distribution(
+ vp9_coefmodel_tree,
+ coef_probs, branch_ct,
+ coef_counts[i][j][k][l], 0);
+#if CONFIG_BALANCED_COEFTREE
+ branch_ct[1][1] = eob_branch_count[i][j][k][l] - branch_ct[1][0];
+ coef_probs[1] = get_binary_prob(branch_ct[1][0], branch_ct[1][1]);
+#else
branch_ct[0][1] = eob_branch_count[i][j][k][l] - branch_ct[0][0];
coef_probs[0] = get_binary_prob(branch_ct[0][0], branch_ct[0][1]);
+#endif
for (t = 0; t < entropy_nodes_adapt; ++t) {
count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count;
@@ -3560,21 +714,16 @@
dst_coef_probs[i][j][k][l][t] =
weighted_prob(pre_coef_probs[i][j][k][l][t],
coef_probs[t], factor);
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_ADAPT
- if (t == UNCONSTRAINED_NODES - 1)
- vp9_get_model_distribution(
- dst_coef_probs[i][j][k][l][UNCONSTRAINED_NODES - 1],
- dst_coef_probs[i][j][k][l], i, j);
-#endif
}
}
}
void vp9_adapt_coef_probs(VP9_COMMON *cm) {
+ TX_SIZE t;
int count_sat;
int update_factor; /* denominator 256 */
- if (cm->frame_type == KEY_FRAME) {
+ if ((cm->frame_type == KEY_FRAME) || cm->intra_only) {
update_factor = COEF_MAX_UPDATE_FACTOR_KEY;
count_sat = COEF_COUNT_SAT_KEY;
} else if (cm->last_frame_type == KEY_FRAME) {
@@ -3584,142 +733,6 @@
update_factor = COEF_MAX_UPDATE_FACTOR;
count_sat = COEF_COUNT_SAT;
}
-
- adapt_coef_probs(cm->fc.coef_probs_4x4, cm->fc.pre_coef_probs_4x4,
- BLOCK_TYPES, cm->fc.coef_counts_4x4,
- cm->fc.eob_branch_counts[TX_4X4],
- count_sat, update_factor);
- adapt_coef_probs(cm->fc.coef_probs_8x8, cm->fc.pre_coef_probs_8x8,
- BLOCK_TYPES, cm->fc.coef_counts_8x8,
- cm->fc.eob_branch_counts[TX_8X8],
- count_sat, update_factor);
- adapt_coef_probs(cm->fc.coef_probs_16x16, cm->fc.pre_coef_probs_16x16,
- BLOCK_TYPES, cm->fc.coef_counts_16x16,
- cm->fc.eob_branch_counts[TX_16X16],
- count_sat, update_factor);
- adapt_coef_probs(cm->fc.coef_probs_32x32, cm->fc.pre_coef_probs_32x32,
- BLOCK_TYPES, cm->fc.coef_counts_32x32,
- cm->fc.eob_branch_counts[TX_32X32],
- count_sat, update_factor);
+ for (t = TX_4X4; t <= TX_32X32; t++)
+ adapt_coef_probs(cm, t, count_sat, update_factor);
}
-
-#if CONFIG_CODE_NONZEROCOUNT
-static void adapt_nzc_probs(VP9_COMMON *cm,
- int block_size,
- int count_sat,
- int update_factor) {
- int c, r, b, n;
- int count, factor;
- unsigned int nzc_branch_ct[NZC32X32_NODES][2];
- vp9_prob nzc_probs[NZC32X32_NODES];
- int tokens, nodes;
- const vp9_tree_index *nzc_tree;
- vp9_prob *dst_nzc_probs;
- vp9_prob *pre_nzc_probs;
- unsigned int *nzc_counts;
-
- if (block_size == 32) {
- tokens = NZC32X32_TOKENS;
- nzc_tree = vp9_nzc32x32_tree;
- dst_nzc_probs = cm->fc.nzc_probs_32x32[0][0][0];
- pre_nzc_probs = cm->fc.pre_nzc_probs_32x32[0][0][0];
- nzc_counts = cm->fc.nzc_counts_32x32[0][0][0];
- } else if (block_size == 16) {
- tokens = NZC16X16_TOKENS;
- nzc_tree = vp9_nzc16x16_tree;
- dst_nzc_probs = cm->fc.nzc_probs_16x16[0][0][0];
- pre_nzc_probs = cm->fc.pre_nzc_probs_16x16[0][0][0];
- nzc_counts = cm->fc.nzc_counts_16x16[0][0][0];
- } else if (block_size == 8) {
- tokens = NZC8X8_TOKENS;
- nzc_tree = vp9_nzc8x8_tree;
- dst_nzc_probs = cm->fc.nzc_probs_8x8[0][0][0];
- pre_nzc_probs = cm->fc.pre_nzc_probs_8x8[0][0][0];
- nzc_counts = cm->fc.nzc_counts_8x8[0][0][0];
- } else {
- nzc_tree = vp9_nzc4x4_tree;
- tokens = NZC4X4_TOKENS;
- dst_nzc_probs = cm->fc.nzc_probs_4x4[0][0][0];
- pre_nzc_probs = cm->fc.pre_nzc_probs_4x4[0][0][0];
- nzc_counts = cm->fc.nzc_counts_4x4[0][0][0];
- }
- nodes = tokens - 1;
- for (c = 0; c < MAX_NZC_CONTEXTS; ++c)
- for (r = 0; r < REF_TYPES; ++r)
- for (b = 0; b < BLOCK_TYPES; ++b) {
- int offset = c * REF_TYPES * BLOCK_TYPES + r * BLOCK_TYPES + b;
- int offset_nodes = offset * nodes;
- int offset_tokens = offset * tokens;
- vp9_tree_probs_from_distribution(nzc_tree,
- nzc_probs, nzc_branch_ct,
- nzc_counts + offset_tokens, 0);
- for (n = 0; n < nodes; ++n) {
- count = nzc_branch_ct[n][0] + nzc_branch_ct[n][1];
- count = count > count_sat ? count_sat : count;
- factor = (update_factor * count / count_sat);
- dst_nzc_probs[offset_nodes + n] =
- weighted_prob(pre_nzc_probs[offset_nodes + n],
- nzc_probs[n], factor);
- }
- }
-}
-
-static void adapt_nzc_pcat(VP9_COMMON *cm, int count_sat, int update_factor) {
- int c, t;
- int count, factor;
- for (c = 0; c < MAX_NZC_CONTEXTS; ++c) {
- for (t = 0; t < NZC_TOKENS_EXTRA; ++t) {
- int bits = vp9_extranzcbits[t + NZC_TOKENS_NOEXTRA];
- int b;
- for (b = 0; b < bits; ++b) {
- vp9_prob prob = get_binary_prob(cm->fc.nzc_pcat_counts[c][t][b][0],
- cm->fc.nzc_pcat_counts[c][t][b][1]);
- count = cm->fc.nzc_pcat_counts[c][t][b][0] +
- cm->fc.nzc_pcat_counts[c][t][b][1];
- count = count > count_sat ? count_sat : count;
- factor = (update_factor * count / count_sat);
- cm->fc.nzc_pcat_probs[c][t][b] = weighted_prob(
- cm->fc.pre_nzc_pcat_probs[c][t][b], prob, factor);
- }
- }
- }
-}
-
-// #define NZC_COUNT_TESTING
-void vp9_adapt_nzc_probs(VP9_COMMON *cm) {
- int count_sat;
- int update_factor; /* denominator 256 */
-#ifdef NZC_COUNT_TESTING
- int c, r, b, t;
- printf("\n");
- for (c = 0; c < MAX_NZC_CONTEXTS; ++c)
- for (r = 0; r < REF_TYPES; ++r) {
- for (b = 0; b < BLOCK_TYPES; ++b) {
- printf(" {");
- for (t = 0; t < NZC4X4_TOKENS; ++t) {
- printf(" %d,", cm->fc.nzc_counts_4x4[c][r][b][t]);
- }
- printf("}\n");
- }
- printf("\n");
- }
-#endif
-
- if (cm->frame_type == KEY_FRAME) {
- update_factor = COEF_MAX_UPDATE_FACTOR_KEY;
- count_sat = COEF_COUNT_SAT_KEY;
- } else if (cm->last_frame_type == KEY_FRAME) {
- update_factor = COEF_MAX_UPDATE_FACTOR_AFTER_KEY; /* adapt quickly */
- count_sat = COEF_COUNT_SAT_AFTER_KEY;
- } else {
- update_factor = COEF_MAX_UPDATE_FACTOR;
- count_sat = COEF_COUNT_SAT;
- }
-
- adapt_nzc_probs(cm, 4, count_sat, update_factor);
- adapt_nzc_probs(cm, 8, count_sat, update_factor);
- adapt_nzc_probs(cm, 16, count_sat, update_factor);
- adapt_nzc_probs(cm, 32, count_sat, update_factor);
- adapt_nzc_pcat(cm, count_sat, update_factor);
-}
-#endif // CONFIG_CODE_NONZEROCOUNT
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -16,8 +16,6 @@
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_common.h"
-extern const int vp9_i8x8_block[4];
-
/* Coefficient token alphabet */
#define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */
@@ -40,16 +38,19 @@
extern const vp9_tree_index vp9_coef_tree[];
-extern struct vp9_token_struct vp9_coef_encodings[MAX_ENTROPY_TOKENS];
+#define DCT_EOB_MODEL_TOKEN 3 /* EOB Extra Bits 0+0 */
+extern const vp9_tree_index vp9_coefmodel_tree[];
+extern struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS];
+
typedef struct {
vp9_tree_p tree;
const vp9_prob *prob;
- int Len;
+ int len;
int base_val;
-} vp9_extra_bit_struct;
+} vp9_extra_bit;
-extern vp9_extra_bit_struct vp9_extra_bits[12]; /* indexed by token value */
+extern vp9_extra_bit vp9_extra_bits[12]; /* indexed by token value */
#define PROB_UPDATE_BASELINE_COST 7
@@ -84,6 +85,8 @@
/*# define DC_TOKEN_CONTEXTS 3*/ /* 00, 0!0, !0!0 */
#define PREV_COEF_CONTEXTS 6
+// #define ENTROPY_STATS
+
typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
[MAX_ENTROPY_TOKENS];
typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
@@ -96,173 +99,126 @@
struct VP9Common;
void vp9_default_coef_probs(struct VP9Common *);
-extern DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_4x4[16]);
+extern DECLARE_ALIGNED(16, const int, vp9_default_scan_4x4[16]);
extern DECLARE_ALIGNED(16, const int, vp9_col_scan_4x4[16]);
extern DECLARE_ALIGNED(16, const int, vp9_row_scan_4x4[16]);
-extern DECLARE_ALIGNED(64, const int, vp9_default_zig_zag1d_8x8[64]);
+extern DECLARE_ALIGNED(64, const int, vp9_default_scan_8x8[64]);
extern DECLARE_ALIGNED(16, const int, vp9_col_scan_8x8[64]);
extern DECLARE_ALIGNED(16, const int, vp9_row_scan_8x8[64]);
-extern DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_16x16[256]);
+extern DECLARE_ALIGNED(16, const int, vp9_default_scan_16x16[256]);
extern DECLARE_ALIGNED(16, const int, vp9_col_scan_16x16[256]);
extern DECLARE_ALIGNED(16, const int, vp9_row_scan_16x16[256]);
-extern DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_32x32[1024]);
+extern DECLARE_ALIGNED(16, const int, vp9_default_scan_32x32[1024]);
void vp9_coef_tree_initialize(void);
void vp9_adapt_coef_probs(struct VP9Common *);
-static INLINE void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) {
+static INLINE void vp9_reset_sb_tokens_context(MACROBLOCKD* const xd,
+ BLOCK_SIZE_TYPE bsize) {
/* Clear entropy contexts */
- vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
+ const int bw = 1 << b_width_log2(bsize);
+ const int bh = 1 << b_height_log2(bsize);
+ int i;
+ for (i = 0; i < MAX_MB_PLANE; i++) {
+ vpx_memset(xd->plane[i].above_context, 0,
+ sizeof(ENTROPY_CONTEXT) * bw >> xd->plane[i].subsampling_x);
+ vpx_memset(xd->plane[i].left_context, 0,
+ sizeof(ENTROPY_CONTEXT) * bh >> xd->plane[i].subsampling_y);
+ }
}
-static INLINE void vp9_reset_sb_tokens_context(MACROBLOCKD* const xd) {
- /* Clear entropy contexts */
- vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * 2);
- vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * 2);
-}
+// This is the index in the scan order beyond which all coefficients for
+// 8x8 transform and above are in the top band.
+// For 4x4 blocks the index is less but to keep things common the lookup
+// table for 4x4 is padded out to this index.
+#define MAXBAND_INDEX 21
-static INLINE void vp9_reset_sb64_tokens_context(MACROBLOCKD* const xd) {
- /* Clear entropy contexts */
- vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * 4);
- vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * 4);
-}
+extern const uint8_t vp9_coefband_trans_8x8plus[MAXBAND_INDEX + 1];
+extern const uint8_t vp9_coefband_trans_4x4[MAXBAND_INDEX + 1];
-extern const int vp9_coef_bands8x8[64];
-extern const int vp9_coef_bands4x4[16];
-static int get_coef_band(const int *scan, TX_SIZE tx_size, int coef_index) {
- if (tx_size == TX_4X4) {
- return vp9_coef_bands4x4[scan[coef_index]];
- } else {
- const int pos = scan[coef_index];
- const int sz = 1 << (2 + tx_size);
- const int x = pos & (sz - 1), y = pos >> (2 + tx_size);
- if (x >= 8 || y >= 8)
- return 5;
- else
- return vp9_coef_bands8x8[y * 8 + x];
- }
+static int get_coef_band(const uint8_t * band_translate, int coef_index) {
+ return (coef_index > MAXBAND_INDEX)
+ ? (COEF_BANDS-1) : band_translate[coef_index];
}
+
extern int vp9_get_coef_context(const int *scan, const int *neighbors,
int nb_pad, uint8_t *token_cache, int c, int l);
const int *vp9_get_coef_neighbors_handle(const int *scan, int *pad);
-#if CONFIG_MODELCOEFPROB
-#define COEFPROB_BITS 8
-#define COEFPROB_MODELS (1 << COEFPROB_BITS)
-// 2 => EOB and Zero nodes are unconstrained, rest are modeled
-// 3 => EOB, Zero and One nodes are unconstrained, rest are modeled
-#define UNCONSTRAINED_NODES 3 // Choose one of 2 or 3
+// 128 lists of probabilities are stored for the following ONE node probs:
+// 1, 3, 5, 7, ..., 253, 255
+// In between probabilities are interpolated linearly
-// whether forward updates are model-based
-#define MODEL_BASED_UPDATE 0
-// if model-based how many nodes are unconstrained
-#define UNCONSTRAINED_UPDATE_NODES 3
-// whether backward updates are model-based
-#define MODEL_BASED_ADAPT 0
-#define UNCONSTRAINED_ADAPT_NODES 3
+#define COEFPROB_MODELS 128
-// whether to adjust the coef probs for key frames based on qindex
-#define ADJUST_KF_COEF_PROBS 0
+#define UNCONSTRAINED_NODES 3
+#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
+#define PIVOT_NODE 2 // which node is pivot
+
typedef vp9_prob vp9_coeff_probs_model[REF_TYPES][COEF_BANDS]
- [PREV_COEF_CONTEXTS][2];
-extern const vp9_prob vp9_modelcoefprobs[COEFPROB_MODELS][ENTROPY_NODES - 1];
-void vp9_get_model_distribution(vp9_prob model, vp9_prob *tree_probs,
- int b, int r);
-void vp9_adjust_default_coef_probs(struct VP9Common *cm);
-#endif // CONFIG_MODELCOEFPROB
+ [PREV_COEF_CONTEXTS]
+ [UNCONSTRAINED_NODES];
-#if CONFIG_CODE_NONZEROCOUNT
-/* Alphabet for number of non-zero symbols in block */
-#define NZC_0 0 /* Used for all blocks */
-#define NZC_1 1 /* Used for all blocks */
-#define NZC_2 2 /* Used for all blocks */
-#define NZC_3TO4 3 /* Used for all blocks */
-#define NZC_5TO8 4 /* Used for all blocks */
-#define NZC_9TO16 5 /* Used for all blocks */
-#define NZC_17TO32 6 /* Used for 8x8 and larger blocks */
-#define NZC_33TO64 7 /* Used for 8x8 and larger blocks */
-#define NZC_65TO128 8 /* Used for 16x16 and larger blocks */
-#define NZC_129TO256 9 /* Used for 16x16 and larger blocks */
-#define NZC_257TO512 10 /* Used for 32x32 and larger blocks */
-#define NZC_513TO1024 11 /* Used for 32x32 and larger blocks */
+typedef unsigned int vp9_coeff_count_model[REF_TYPES][COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [UNCONSTRAINED_NODES + 1];
+typedef unsigned int vp9_coeff_stats_model[REF_TYPES][COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [UNCONSTRAINED_NODES][2];
+extern void vp9_full_to_model_count(unsigned int *model_count,
+ unsigned int *full_count);
+extern void vp9_full_to_model_counts(
+ vp9_coeff_count_model *model_count, vp9_coeff_count *full_count);
-/* Number of tokens for each block size */
-#define NZC4X4_TOKENS 6
-#define NZC8X8_TOKENS 8
-#define NZC16X16_TOKENS 10
-#define NZC32X32_TOKENS 12
+void vp9_model_to_full_probs(const vp9_prob *model, vp9_prob *full);
-/* Number of nodes for each block size */
-#define NZC4X4_NODES 5
-#define NZC8X8_NODES 7
-#define NZC16X16_NODES 9
-#define NZC32X32_NODES 11
+void vp9_model_to_full_probs_sb(
+ vp9_prob model[COEF_BANDS][PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES],
+ vp9_prob full[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]);
-/* Max number of tokens with extra bits */
-#define NZC_TOKENS_EXTRA 9
+extern const vp9_prob vp9_modelcoefprobs[COEFPROB_MODELS][ENTROPY_NODES - 1];
-/* Max number of extra bits */
-#define NZC_BITS_EXTRA 9
+static INLINE const int* get_scan_4x4(TX_TYPE tx_type) {
+ switch (tx_type) {
+ case ADST_DCT:
+ return vp9_row_scan_4x4;
+ case DCT_ADST:
+ return vp9_col_scan_4x4;
+ default:
+ return vp9_default_scan_4x4;
+ }
+}
-/* Tokens without extra bits */
-#define NZC_TOKENS_NOEXTRA (NZC32X32_TOKENS - NZC_TOKENS_EXTRA)
+static INLINE const int* get_scan_8x8(TX_TYPE tx_type) {
+ switch (tx_type) {
+ case ADST_DCT:
+ return vp9_row_scan_8x8;
+ case DCT_ADST:
+ return vp9_col_scan_8x8;
+ default:
+ return vp9_default_scan_8x8;
+ }
+}
-#define MAX_NZC_CONTEXTS 3
-
-/* whether to update extra bit probabilities */
-#define NZC_PCAT_UPDATE
-
-/* nzc trees */
-extern const vp9_tree_index vp9_nzc4x4_tree[];
-extern const vp9_tree_index vp9_nzc8x8_tree[];
-extern const vp9_tree_index vp9_nzc16x16_tree[];
-extern const vp9_tree_index vp9_nzc32x32_tree[];
-
-/* nzc encodings */
-extern struct vp9_token_struct vp9_nzc4x4_encodings[NZC4X4_TOKENS];
-extern struct vp9_token_struct vp9_nzc8x8_encodings[NZC8X8_TOKENS];
-extern struct vp9_token_struct vp9_nzc16x16_encodings[NZC16X16_TOKENS];
-extern struct vp9_token_struct vp9_nzc32x32_encodings[NZC32X32_TOKENS];
-
-#define codenzc(x) (\
- (x) <= 3 ? (x) : (x) <= 4 ? 3 : (x) <= 8 ? 4 : \
- (x) <= 16 ? 5 : (x) <= 32 ? 6 : (x) <= 64 ? 7 :\
- (x) <= 128 ? 8 : (x) <= 256 ? 9 : (x) <= 512 ? 10 : 11)
-
-int vp9_get_nzc_context_y_sb64(struct VP9Common *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block);
-int vp9_get_nzc_context_y_sb32(struct VP9Common *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block);
-int vp9_get_nzc_context_y_mb16(struct VP9Common *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block);
-int vp9_get_nzc_context_uv_sb64(struct VP9Common *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block);
-int vp9_get_nzc_context_uv_sb32(struct VP9Common *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block);
-int vp9_get_nzc_context_uv_mb16(struct VP9Common *cm, MODE_INFO *cur,
- int mb_row, int mb_col, int block);
-int vp9_get_nzc_context(struct VP9Common *cm, MACROBLOCKD *xd, int block);
-void vp9_update_nzc_counts(struct VP9Common *cm, MACROBLOCKD *xd,
- int mb_row, int mb_col);
-void vp9_adapt_nzc_probs(struct VP9Common *cm);
-
-/* Extra bits array */
-extern const int vp9_extranzcbits[NZC32X32_TOKENS];
-
-/* Base nzc values */
-extern const int vp9_basenzcvalue[NZC32X32_TOKENS];
-
-#endif // CONFIG_CODE_NONZEROCOUNT
+static INLINE const int* get_scan_16x16(TX_TYPE tx_type) {
+ switch (tx_type) {
+ case ADST_DCT:
+ return vp9_row_scan_16x16;
+ case DCT_ADST:
+ return vp9_col_scan_16x16;
+ default:
+ return vp9_default_scan_16x16;
+ }
+}
#include "vp9/common/vp9_coefupdateprobs.h"
--- a/vp9/common/vp9_entropymode.c
+++ b/vp9/common/vp9_entropymode.c
@@ -15,464 +15,274 @@
#include "vp9/common/vp9_alloccommon.h"
#include "vpx_mem/vpx_mem.h"
-static const unsigned int kf_y_mode_cts[8][VP9_YMODES] = {
- /* DC V H D45 135 117 153 D27 D63 TM i8x8 BPRED */
- {12, 6, 5, 5, 5, 5, 5, 5, 5, 2, 22, 200},
- {25, 13, 13, 7, 7, 7, 7, 7, 7, 6, 27, 160},
- {31, 17, 18, 8, 8, 8, 8, 8, 8, 9, 26, 139},
- {40, 22, 23, 8, 8, 8, 8, 8, 8, 12, 27, 116},
- {53, 26, 28, 8, 8, 8, 8, 8, 8, 13, 26, 94},
- {68, 33, 35, 8, 8, 8, 8, 8, 8, 17, 20, 68},
- {78, 38, 38, 8, 8, 8, 8, 8, 8, 19, 16, 52},
- {89, 42, 42, 8, 8, 8, 8, 8, 8, 21, 12, 34},
+static const vp9_prob default_kf_uv_probs[VP9_INTRA_MODES]
+ [VP9_INTRA_MODES - 1] = {
+ { 144, 11, 54, 157, 195, 130, 46, 58, 108 } /* y = dc */,
+ { 118, 15, 123, 148, 131, 101, 44, 93, 131 } /* y = v */,
+ { 113, 12, 23, 188, 226, 142, 26, 32, 125 } /* y = h */,
+ { 120, 11, 50, 123, 163, 135, 64, 77, 103 } /* y = d45 */,
+ { 113, 9, 36, 155, 111, 157, 32, 44, 161 } /* y = d135 */,
+ { 116, 9, 55, 176, 76, 96, 37, 61, 149 } /* y = d117 */,
+ { 115, 9, 28, 141, 161, 167, 21, 25, 193 } /* y = d153 */,
+ { 120, 12, 32, 145, 195, 142, 32, 38, 86 } /* y = d27 */,
+ { 116, 12, 64, 120, 140, 125, 49, 115, 121 } /* y = d63 */,
+ { 102, 19, 66, 162, 182, 122, 35, 59, 128 } /* y = tm */
};
-static const unsigned int y_mode_cts [VP9_YMODES] = {
- /* DC V H D45 135 117 153 D27 D63 TM i8x8 BPRED */
- 98, 19, 15, 14, 14, 14, 14, 12, 12, 13, 16, 70
+static const vp9_prob default_if_y_probs[BLOCK_SIZE_GROUPS]
+ [VP9_INTRA_MODES - 1] = {
+ { 65, 32, 18, 144, 162, 194, 41, 51, 98 } /* block_size < 8x8 */,
+ { 132, 68, 18, 165, 217, 196, 45, 40, 78 } /* block_size < 16x16 */,
+ { 173, 80, 19, 176, 240, 193, 64, 35, 46 } /* block_size < 32x32 */,
+ { 221, 135, 38, 194, 248, 121, 96, 85, 29 } /* block_size >= 32x32 */
};
-static const unsigned int uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
- /* DC V H D45 135 117 153 D27 D63 TM */
- { 200, 15, 15, 10, 10, 10, 10, 10, 10, 6}, /* DC */
- { 130, 75, 10, 10, 10, 10, 10, 10, 10, 6}, /* V */
- { 130, 10, 75, 10, 10, 10, 10, 10, 10, 6}, /* H */
- { 130, 15, 10, 75, 10, 10, 10, 10, 10, 6}, /* D45 */
- { 150, 15, 10, 10, 75, 10, 10, 10, 10, 6}, /* D135 */
- { 150, 15, 10, 10, 10, 75, 10, 10, 10, 6}, /* D117 */
- { 150, 15, 10, 10, 10, 10, 75, 10, 10, 6}, /* D153 */
- { 150, 15, 10, 10, 10, 10, 10, 75, 10, 6}, /* D27 */
- { 150, 15, 10, 10, 10, 10, 10, 10, 75, 6}, /* D63 */
- { 160, 30, 30, 10, 10, 10, 10, 10, 10, 16}, /* TM */
- { 132, 46, 40, 10, 10, 10, 10, 10, 10, 18}, /* i8x8 - never used */
- { 150, 35, 41, 10, 10, 10, 10, 10, 10, 10}, /* BPRED */
+static const vp9_prob default_if_uv_probs[VP9_INTRA_MODES]
+ [VP9_INTRA_MODES - 1] = {
+ { 120, 7, 76, 176, 208, 126, 28, 54, 103 } /* y = dc */,
+ { 48, 12, 154, 155, 139, 90, 34, 117, 119 } /* y = v */,
+ { 67, 6, 25, 204, 243, 158, 13, 21, 96 } /* y = h */,
+ { 97, 5, 44, 131, 176, 139, 48, 68, 97 } /* y = d45 */,
+ { 83, 5, 42, 156, 111, 152, 26, 49, 152 } /* y = d135 */,
+ { 80, 5, 58, 178, 74, 83, 33, 62, 145 } /* y = d117 */,
+ { 86, 5, 32, 154, 192, 168, 14, 22, 163 } /* y = d153 */,
+ { 85, 5, 32, 156, 216, 148, 19, 29, 73 } /* y = d27 */,
+ { 77, 7, 64, 116, 132, 122, 37, 126, 120 } /* y = d63 */,
+ { 101, 21, 107, 181, 192, 103, 19, 67, 125 } /* y = tm */
};
-static const unsigned int i8x8_mode_cts [VP9_I8X8_MODES] = {
- /* DC V H D45 135 117 153 D27 D63 TM */
- 73, 49, 61, 30, 30, 30, 30, 30, 30, 13
+const vp9_prob vp9_partition_probs[NUM_FRAME_TYPES][NUM_PARTITION_CONTEXTS]
+ [PARTITION_TYPES - 1] = {
+ { /* frame_type = keyframe */
+ /* 8x8 -> 4x4 */
+ { 158, 97, 94 } /* a/l both not split */,
+ { 93, 24, 99 } /* a split, l not split */,
+ { 85, 119, 44 } /* l split, a not split */,
+ { 62, 59, 67 } /* a/l both split */,
+ /* 16x16 -> 8x8 */
+ { 149, 53, 53 } /* a/l both not split */,
+ { 94, 20, 48 } /* a split, l not split */,
+ { 83, 53, 24 } /* l split, a not split */,
+ { 52, 18, 18 } /* a/l both split */,
+ /* 32x32 -> 16x16 */
+ { 150, 40, 39 } /* a/l both not split */,
+ { 78, 12, 26 } /* a split, l not split */,
+ { 67, 33, 11 } /* l split, a not split */,
+ { 24, 7, 5 } /* a/l both split */,
+ /* 64x64 -> 32x32 */
+ { 174, 35, 49 } /* a/l both not split */,
+ { 68, 11, 27 } /* a split, l not split */,
+ { 57, 15, 9 } /* l split, a not split */,
+ { 12, 3, 3 } /* a/l both split */
+ }, { /* frame_type = interframe */
+ /* 8x8 -> 4x4 */
+ { 199, 122, 141 } /* a/l both not split */,
+ { 147, 63, 159 } /* a split, l not split */,
+ { 148, 133, 118 } /* l split, a not split */,
+ { 121, 104, 114 } /* a/l both split */,
+ /* 16x16 -> 8x8 */
+ { 174, 73, 87 } /* a/l both not split */,
+ { 92, 41, 83 } /* a split, l not split */,
+ { 82, 99, 50 } /* l split, a not split */,
+ { 53, 39, 39 } /* a/l both split */,
+ /* 32x32 -> 16x16 */
+ { 177, 58, 59 } /* a/l both not split */,
+ { 68, 26, 63 } /* a split, l not split */,
+ { 52, 79, 25 } /* l split, a not split */,
+ { 17, 14, 12 } /* a/l both split */,
+ /* 64x64 -> 32x32 */
+ { 222, 34, 30 } /* a/l both not split */,
+ { 72, 16, 44 } /* a split, l not split */,
+ { 58, 32, 12 } /* l split, a not split */,
+ { 10, 7, 6 } /* a/l both split */
+ }
};
-static const unsigned int kf_uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
- // DC V H D45 135 117 153 D27 D63 TM
- { 160, 24, 24, 20, 20, 20, 20, 20, 20, 8}, /* DC */
- { 102, 64, 30, 20, 20, 20, 20, 20, 20, 10}, /* V */
- { 102, 30, 64, 20, 20, 20, 20, 20, 20, 10}, /* H */
- { 102, 33, 20, 64, 20, 20, 20, 20, 20, 14}, /* D45 */
- { 102, 33, 20, 20, 64, 20, 20, 20, 20, 14}, /* D135 */
- { 122, 33, 20, 20, 20, 64, 20, 20, 20, 14}, /* D117 */
- { 102, 33, 20, 20, 20, 20, 64, 20, 20, 14}, /* D153 */
- { 102, 33, 20, 20, 20, 20, 20, 64, 20, 14}, /* D27 */
- { 102, 33, 20, 20, 20, 20, 20, 20, 64, 14}, /* D63 */
- { 132, 36, 30, 20, 20, 20, 20, 20, 20, 18}, /* TM */
- { 122, 41, 35, 20, 20, 20, 20, 20, 20, 18}, /* i8x8 - never used */
- { 122, 41, 35, 20, 20, 20, 20, 20, 20, 18}, /* BPRED */
+/* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
+const vp9_tree_index vp9_intra_mode_tree[VP9_INTRA_MODES * 2 - 2] = {
+ -DC_PRED, 2, /* 0 = DC_NODE */
+ -TM_PRED, 4, /* 1 = TM_NODE */
+ -V_PRED, 6, /* 2 = V_NODE */
+ 8, 12, /* 3 = COM_NODE */
+ -H_PRED, 10, /* 4 = H_NODE */
+ -D135_PRED, -D117_PRED, /* 5 = D135_NODE */
+ -D45_PRED, 14, /* 6 = D45_NODE */
+ -D63_PRED, 16, /* 7 = D63_NODE */
+ -D153_PRED, -D27_PRED /* 8 = D153_NODE */
};
-static const unsigned int bmode_cts[VP9_NKF_BINTRAMODES] = {
-#if CONFIG_NEWBINTRAMODES
-#if CONTEXT_PRED_REPLACEMENTS == 6
- /* DC TM VE HE CONTEXT */
- 43891, 17694, 10036, 3920, 20000
-#elif CONTEXT_PRED_REPLACEMENTS == 4
- /* DC TM VE HE LD RD CONTEXT */
- 43891, 17694, 10036, 3920, 3363, 2546, 14000
-#elif CONTEXT_PRED_REPLACEMENTS == 0
- /* DC TM VE HE LD RD VR VL HD HU CONTEXT */
- 43891, 17694, 10036, 3920, 3363, 2546, 5119, 3221, 2471, 1723, 50000
-#endif
-#else
- /* DC TM VE HE LD RD VR VL HD HU */
- 43891, 17694, 10036, 3920, 3363, 2546, 5119, 3221, 2471, 1723
-#endif
+const vp9_tree_index vp9_sb_mv_ref_tree[6] = {
+ -ZEROMV, 2,
+ -NEARESTMV, 4,
+ -NEARMV, -NEWMV
};
-typedef enum {
- SUBMVREF_NORMAL,
- SUBMVREF_LEFT_ZED,
- SUBMVREF_ABOVE_ZED,
- SUBMVREF_LEFT_ABOVE_SAME,
- SUBMVREF_LEFT_ABOVE_ZED
-} sumvfref_t;
+const vp9_tree_index vp9_partition_tree[6] = {
+ -PARTITION_NONE, 2,
+ -PARTITION_HORZ, 4,
+ -PARTITION_VERT, -PARTITION_SPLIT
+};
-int vp9_mv_cont(const int_mv *l, const int_mv *a) {
- int lez = (l->as_int == 0);
- int aez = (a->as_int == 0);
- int lea = (l->as_int == a->as_int);
+struct vp9_token vp9_intra_mode_encodings[VP9_INTRA_MODES];
- if (lea && lez)
- return SUBMVREF_LEFT_ABOVE_ZED;
+struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_INTER_MODES];
- if (lea)
- return SUBMVREF_LEFT_ABOVE_SAME;
+struct vp9_token vp9_partition_encodings[PARTITION_TYPES];
- if (aez)
- return SUBMVREF_ABOVE_ZED;
-
- if (lez)
- return SUBMVREF_LEFT_ZED;
-
- return SUBMVREF_NORMAL;
-}
-
-const vp9_prob vp9_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP9_SUBMVREFS - 1] = {
- { 147, 136, 18 },
- { 106, 145, 1 },
- { 179, 121, 1 },
- { 223, 1, 34 },
- { 208, 1, 1 }
+static const vp9_prob default_intra_inter_p[INTRA_INTER_CONTEXTS] = {
+ 9, 102, 187, 225
};
-vp9_mbsplit vp9_mbsplits [VP9_NUMMBSPLITS] = {
- {
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 1, 1, 1, 1,
- 1, 1, 1, 1,
- }, {
- 0, 0, 1, 1,
- 0, 0, 1, 1,
- 0, 0, 1, 1,
- 0, 0, 1, 1,
- }, {
- 0, 0, 1, 1,
- 0, 0, 1, 1,
- 2, 2, 3, 3,
- 2, 2, 3, 3,
- }, {
- 0, 1, 2, 3,
- 4, 5, 6, 7,
- 8, 9, 10, 11,
- 12, 13, 14, 15,
- },
+static const vp9_prob default_comp_inter_p[COMP_INTER_CONTEXTS] = {
+ 239, 183, 119, 96, 41
};
-const int vp9_mbsplit_count [VP9_NUMMBSPLITS] = { 2, 2, 4, 16};
-
-const vp9_prob vp9_mbsplit_probs [VP9_NUMMBSPLITS - 1] = { 110, 111, 150};
-
-/* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
-
-const vp9_tree_index vp9_kf_bmode_tree[VP9_KF_BINTRAMODES * 2 - 2] = {
- -B_DC_PRED, 2, /* 0 = DC_NODE */
- -B_TM_PRED, 4, /* 1 = TM_NODE */
- -B_VE_PRED, 6, /* 2 = VE_NODE */
- 8, 12, /* 3 = COM_NODE */
- -B_HE_PRED, 10, /* 4 = HE_NODE */
- -B_RD_PRED, -B_VR_PRED, /* 5 = RD_NODE */
- -B_LD_PRED, 14, /* 6 = LD_NODE */
- -B_VL_PRED, 16, /* 7 = VL_NODE */
- -B_HD_PRED, -B_HU_PRED /* 8 = HD_NODE */
+static const vp9_prob default_comp_ref_p[REF_CONTEXTS] = {
+ 50, 126, 123, 221, 226
};
-const vp9_tree_index vp9_bmode_tree[VP9_NKF_BINTRAMODES * 2 - 2] = {
-#if CONFIG_NEWBINTRAMODES
-#if CONTEXT_PRED_REPLACEMENTS == 6
- -B_DC_PRED, 2,
- -B_TM_PRED, 4,
- 6, -(B_CONTEXT_PRED - CONTEXT_PRED_REPLACEMENTS),
- -B_VE_PRED, -B_HE_PRED
-#elif CONTEXT_PRED_REPLACEMENTS == 4
- -B_DC_PRED, 2,
- -B_TM_PRED, 4,
- 6, 8,
- -B_VE_PRED, -B_HE_PRED,
- 10, -(B_CONTEXT_PRED - CONTEXT_PRED_REPLACEMENTS),
- -B_RD_PRED, -B_LD_PRED,
-#elif CONTEXT_PRED_REPLACEMENTS == 0
- -B_DC_PRED, 2, /* 0 = DC_NODE */
- -B_TM_PRED, 4, /* 1 = TM_NODE */
- -B_VE_PRED, 6, /* 2 = VE_NODE */
- 8, 12, /* 3 = COM_NODE */
- -B_HE_PRED, 10, /* 4 = HE_NODE */
- -B_RD_PRED, -B_VR_PRED, /* 5 = RD_NODE */
- -B_LD_PRED, 14, /* 6 = LD_NODE */
- -B_VL_PRED, 16, /* 7 = VL_NODE */
- -B_HD_PRED, 18,
- -B_HU_PRED, -B_CONTEXT_PRED
-#endif
-#else
- -B_DC_PRED, 2, /* 0 = DC_NODE */
- -B_TM_PRED, 4, /* 1 = TM_NODE */
- -B_VE_PRED, 6, /* 2 = VE_NODE */
- 8, 12, /* 3 = COM_NODE */
- -B_HE_PRED, 10, /* 4 = HE_NODE */
- -B_RD_PRED, -B_VR_PRED, /* 5 = RD_NODE */
- -B_LD_PRED, 14, /* 6 = LD_NODE */
- -B_VL_PRED, 16, /* 7 = VL_NODE */
- -B_HD_PRED, -B_HU_PRED /* 8 = HD_NODE */
-#endif
+static const vp9_prob default_single_ref_p[REF_CONTEXTS][2] = {
+ { 33, 16 },
+ { 77, 74 },
+ { 142, 142 },
+ { 172, 170 },
+ { 238, 247 }
};
-/* Again, these trees use the same probability indices as their
- explicitly-programmed predecessors. */
-const vp9_tree_index vp9_ymode_tree[VP9_YMODES * 2 - 2] = {
- 2, 14,
- -DC_PRED, 4,
- 6, 8,
- -D45_PRED, -D135_PRED,
- 10, 12,
- -D117_PRED, -D153_PRED,
- -D27_PRED, -D63_PRED,
- 16, 18,
- -V_PRED, -H_PRED,
- -TM_PRED, 20,
- -B_PRED, -I8X8_PRED
+const vp9_prob vp9_default_tx_probs_32x32p[TX_SIZE_CONTEXTS]
+ [TX_SIZE_MAX_SB - 1] = {
+ { 3, 136, 37, },
+ { 5, 52, 13, },
};
-
-const vp9_tree_index vp9_kf_ymode_tree[VP9_YMODES * 2 - 2] = {
- 2, 14,
- -DC_PRED, 4,
- 6, 8,
- -D45_PRED, -D135_PRED,
- 10, 12,
- -D117_PRED, -D153_PRED,
- -D27_PRED, -D63_PRED,
- 16, 18,
- -V_PRED, -H_PRED,
- -TM_PRED, 20,
- -B_PRED, -I8X8_PRED
+const vp9_prob vp9_default_tx_probs_16x16p[TX_SIZE_CONTEXTS]
+ [TX_SIZE_MAX_SB - 2] = {
+ { 20, 152, },
+ { 15, 101, },
};
-
-const vp9_tree_index vp9_i8x8_mode_tree[VP9_I8X8_MODES * 2 - 2] = {
- 2, 14,
- -DC_PRED, 4,
- 6, 8,
- -D45_PRED, -D135_PRED,
- 10, 12,
- -D117_PRED, -D153_PRED,
- -D27_PRED, -D63_PRED,
- -V_PRED, 16,
- -H_PRED, -TM_PRED
+const vp9_prob vp9_default_tx_probs_8x8p[TX_SIZE_CONTEXTS]
+ [TX_SIZE_MAX_SB - 3] = {
+ { 100, },
+ { 66, },
};
-const vp9_tree_index vp9_uv_mode_tree[VP9_UV_MODES * 2 - 2] = {
- 2, 14,
- -DC_PRED, 4,
- 6, 8,
- -D45_PRED, -D135_PRED,
- 10, 12,
- -D117_PRED, -D153_PRED,
- -D27_PRED, -D63_PRED,
- -V_PRED, 16,
- -H_PRED, -TM_PRED
-};
+void tx_counts_to_branch_counts_32x32(unsigned int *tx_count_32x32p,
+ unsigned int (*ct_32x32p)[2]) {
+ ct_32x32p[0][0] = tx_count_32x32p[TX_4X4];
+ ct_32x32p[0][1] = tx_count_32x32p[TX_8X8] +
+ tx_count_32x32p[TX_16X16] +
+ tx_count_32x32p[TX_32X32];
+ ct_32x32p[1][0] = tx_count_32x32p[TX_8X8];
+ ct_32x32p[1][1] = tx_count_32x32p[TX_16X16] +
+ tx_count_32x32p[TX_32X32];
+ ct_32x32p[2][0] = tx_count_32x32p[TX_16X16];
+ ct_32x32p[2][1] = tx_count_32x32p[TX_32X32];
+}
-const vp9_tree_index vp9_mbsplit_tree[6] = {
- -PARTITIONING_4X4, 2,
- -PARTITIONING_8X8, 4,
- -PARTITIONING_16X8, -PARTITIONING_8X16,
-};
+void tx_counts_to_branch_counts_16x16(unsigned int *tx_count_16x16p,
+ unsigned int (*ct_16x16p)[2]) {
+ ct_16x16p[0][0] = tx_count_16x16p[TX_4X4];
+ ct_16x16p[0][1] = tx_count_16x16p[TX_8X8] +
+ tx_count_16x16p[TX_16X16];
+ ct_16x16p[1][0] = tx_count_16x16p[TX_8X8];
+ ct_16x16p[1][1] = tx_count_16x16p[TX_16X16];
+}
-const vp9_tree_index vp9_mv_ref_tree[8] = {
- -ZEROMV, 2,
- -NEARESTMV, 4,
- -NEARMV, 6,
- -NEWMV, -SPLITMV
-};
+void tx_counts_to_branch_counts_8x8(unsigned int *tx_count_8x8p,
+ unsigned int (*ct_8x8p)[2]) {
+ ct_8x8p[0][0] = tx_count_8x8p[TX_4X4];
+ ct_8x8p[0][1] = tx_count_8x8p[TX_8X8];
+}
-const vp9_tree_index vp9_sb_mv_ref_tree[6] = {
- -ZEROMV, 2,
- -NEARESTMV, 4,
- -NEARMV, -NEWMV
+const vp9_prob vp9_default_mbskip_probs[MBSKIP_CONTEXTS] = {
+ 192, 128, 64
};
-const vp9_tree_index vp9_sub_mv_ref_tree[6] = {
- -LEFT4X4, 2,
- -ABOVE4X4, 4,
- -ZERO4X4, -NEW4X4
-};
-
-struct vp9_token_struct vp9_bmode_encodings[VP9_NKF_BINTRAMODES];
-struct vp9_token_struct vp9_kf_bmode_encodings[VP9_KF_BINTRAMODES];
-struct vp9_token_struct vp9_ymode_encodings[VP9_YMODES];
-struct vp9_token_struct vp9_sb_ymode_encodings[VP9_I32X32_MODES];
-struct vp9_token_struct vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
-struct vp9_token_struct vp9_kf_ymode_encodings[VP9_YMODES];
-struct vp9_token_struct vp9_uv_mode_encodings[VP9_UV_MODES];
-struct vp9_token_struct vp9_i8x8_mode_encodings[VP9_I8X8_MODES];
-struct vp9_token_struct vp9_mbsplit_encodings[VP9_NUMMBSPLITS];
-
-struct vp9_token_struct vp9_mv_ref_encoding_array[VP9_MVREFS];
-struct vp9_token_struct vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
-struct vp9_token_struct vp9_sub_mv_ref_encoding_array[VP9_SUBMVREFS];
-
void vp9_init_mbmode_probs(VP9_COMMON *x) {
- unsigned int bct [VP9_YMODES] [2]; /* num Ymodes > num UV modes */
+ vpx_memcpy(x->fc.uv_mode_prob, default_if_uv_probs,
+ sizeof(default_if_uv_probs));
+ vpx_memcpy(x->kf_uv_mode_prob, default_kf_uv_probs,
+ sizeof(default_kf_uv_probs));
+ vpx_memcpy(x->fc.y_mode_prob, default_if_y_probs,
+ sizeof(default_if_y_probs));
- vp9_tree_probs_from_distribution(vp9_ymode_tree, x->fc.ymode_prob,
- bct, y_mode_cts, 0);
- vp9_tree_probs_from_distribution(vp9_sb_ymode_tree, x->fc.sb_ymode_prob,
- bct, y_mode_cts, 0);
- {
- int i;
- for (i = 0; i < 8; i++) {
- vp9_tree_probs_from_distribution(vp9_kf_ymode_tree, x->kf_ymode_prob[i],
- bct, kf_y_mode_cts[i], 0);
- vp9_tree_probs_from_distribution(vp9_sb_kf_ymode_tree,
- x->sb_kf_ymode_prob[i], bct,
- kf_y_mode_cts[i], 0);
- }
- }
- {
- int i;
- for (i = 0; i < VP9_YMODES; i++) {
- vp9_tree_probs_from_distribution(vp9_uv_mode_tree, x->kf_uv_mode_prob[i],
- bct, kf_uv_mode_cts[i], 0);
- vp9_tree_probs_from_distribution(vp9_uv_mode_tree, x->fc.uv_mode_prob[i],
- bct, uv_mode_cts[i], 0);
- }
- }
-
- vp9_tree_probs_from_distribution(vp9_i8x8_mode_tree, x->fc.i8x8_mode_prob,
- bct, i8x8_mode_cts, 0);
-
- vpx_memcpy(x->fc.sub_mv_ref_prob, vp9_sub_mv_ref_prob2,
- sizeof(vp9_sub_mv_ref_prob2));
- vpx_memcpy(x->fc.mbsplit_prob, vp9_mbsplit_probs, sizeof(vp9_mbsplit_probs));
vpx_memcpy(x->fc.switchable_interp_prob, vp9_switchable_interp_prob,
sizeof(vp9_switchable_interp_prob));
-#if CONFIG_COMP_INTERINTRA_PRED
- x->fc.interintra_prob = VP9_DEF_INTERINTRA_PROB;
-#endif
- x->ref_pred_probs[0] = 120;
- x->ref_pred_probs[1] = 80;
- x->ref_pred_probs[2] = 40;
-}
+ vpx_memcpy(x->fc.partition_prob, vp9_partition_probs,
+ sizeof(vp9_partition_probs));
-static void intra_bmode_probs_from_distribution(
- vp9_prob p[VP9_NKF_BINTRAMODES - 1],
- unsigned int branch_ct[VP9_NKF_BINTRAMODES - 1][2],
- const unsigned int events[VP9_NKF_BINTRAMODES]) {
- vp9_tree_probs_from_distribution(vp9_bmode_tree, p, branch_ct, events, 0);
+ vpx_memcpy(x->fc.intra_inter_prob, default_intra_inter_p,
+ sizeof(default_intra_inter_p));
+ vpx_memcpy(x->fc.comp_inter_prob, default_comp_inter_p,
+ sizeof(default_comp_inter_p));
+ vpx_memcpy(x->fc.comp_ref_prob, default_comp_ref_p,
+ sizeof(default_comp_ref_p));
+ vpx_memcpy(x->fc.single_ref_prob, default_single_ref_p,
+ sizeof(default_single_ref_p));
+ vpx_memcpy(x->fc.tx_probs_32x32p, vp9_default_tx_probs_32x32p,
+ sizeof(vp9_default_tx_probs_32x32p));
+ vpx_memcpy(x->fc.tx_probs_16x16p, vp9_default_tx_probs_16x16p,
+ sizeof(vp9_default_tx_probs_16x16p));
+ vpx_memcpy(x->fc.tx_probs_8x8p, vp9_default_tx_probs_8x8p,
+ sizeof(vp9_default_tx_probs_8x8p));
+ vpx_memcpy(x->fc.mbskip_probs, vp9_default_mbskip_probs,
+ sizeof(vp9_default_mbskip_probs));
}
-void vp9_default_bmode_probs(vp9_prob p[VP9_NKF_BINTRAMODES - 1]) {
- unsigned int branch_ct[VP9_NKF_BINTRAMODES - 1][2];
- intra_bmode_probs_from_distribution(p, branch_ct, bmode_cts);
-}
-
-static void intra_kf_bmode_probs_from_distribution(
- vp9_prob p[VP9_KF_BINTRAMODES - 1],
- unsigned int branch_ct[VP9_KF_BINTRAMODES - 1][2],
- const unsigned int events[VP9_KF_BINTRAMODES]) {
- vp9_tree_probs_from_distribution(vp9_kf_bmode_tree, p, branch_ct, events, 0);
-}
-
-void vp9_kf_default_bmode_probs(vp9_prob p[VP9_KF_BINTRAMODES]
- [VP9_KF_BINTRAMODES]
- [VP9_KF_BINTRAMODES - 1]) {
- unsigned int branch_ct[VP9_KF_BINTRAMODES - 1][2];
- int i, j;
-
- for (i = 0; i < VP9_KF_BINTRAMODES; ++i) {
- for (j = 0; j < VP9_KF_BINTRAMODES; ++j) {
- intra_kf_bmode_probs_from_distribution(
- p[i][j], branch_ct, vp9_kf_default_bmode_counts[i][j]);
- }
- }
-}
-
-#if VP9_SWITCHABLE_FILTERS == 3
const vp9_tree_index vp9_switchable_interp_tree[VP9_SWITCHABLE_FILTERS*2-2] = {
-0, 2,
-1, -2
};
-struct vp9_token_struct vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
-#if CONFIG_ENABLE_6TAP
+struct vp9_token vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP9_SWITCHABLE_FILTERS] = {
- SIXTAP, EIGHTTAP, EIGHTTAP_SHARP};
-const int vp9_switchable_interp_map[SWITCHABLE+1] = {0, -1, 1, 2, -1, -1};
-#else
-const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP9_SWITCHABLE_FILTERS] = {
EIGHTTAP, EIGHTTAP_SMOOTH, EIGHTTAP_SHARP};
const int vp9_switchable_interp_map[SWITCHABLE+1] = {1, 0, 2, -1, -1};
-#endif
const vp9_prob vp9_switchable_interp_prob [VP9_SWITCHABLE_FILTERS+1]
[VP9_SWITCHABLE_FILTERS-1] = {
- {248, 192}, { 32, 248}, { 32, 32}, {192, 160}
+ { 235, 162, },
+ { 36, 255, },
+ { 34, 3, },
+ { 149, 144, },
};
-#elif VP9_SWITCHABLE_FILTERS == 2
-const vp9_tree_index vp9_switchable_interp_tree[VP9_SWITCHABLE_FILTERS*2-2] = {
- -0, -1,
-};
-struct vp9_token_struct vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
-const vp9_prob vp9_switchable_interp_prob [VP9_SWITCHABLE_FILTERS+1]
- [VP9_SWITCHABLE_FILTERS-1] = {
- {248},
- { 64},
- {192},
-};
-const INTERPOLATIONFILTERTYPE vp9_switchable_interp[VP9_SWITCHABLE_FILTERS] = {
- EIGHTTAP, EIGHTTAP_SHARP};
-#if CONFIG_ENABLE_6TAP
-const int vp9_switchable_interp_map[SWITCHABLE+1] = {-1, -1, 0, 1, -1, -1};
-#else
-const int vp9_switchable_interp_map[SWITCHABLE+1] = {-1, 0, 1, -1, -1};
-#endif
-#endif // VP9_SWITCHABLE_FILTERS
// Indicates if the filter is interpolating or non-interpolating
-// Note currently only the EIGHTTAP_SMOOTH is non-interpolating
-#if CONFIG_ENABLE_6TAP
-const int vp9_is_interpolating_filter[SWITCHABLE + 1] = {1, 0, 1, 1, 1, -1};
-#else
-const int vp9_is_interpolating_filter[SWITCHABLE + 1] = {0, 1, 1, 1, -1};
-#endif
+const int vp9_is_interpolating_filter[SWITCHABLE + 1] = {1, 1, 1, 1, -1};
void vp9_entropy_mode_init() {
- vp9_tokens_from_tree(vp9_kf_bmode_encodings, vp9_kf_bmode_tree);
- vp9_tokens_from_tree(vp9_bmode_encodings, vp9_bmode_tree);
- vp9_tokens_from_tree(vp9_ymode_encodings, vp9_ymode_tree);
- vp9_tokens_from_tree(vp9_kf_ymode_encodings, vp9_kf_ymode_tree);
- vp9_tokens_from_tree(vp9_sb_ymode_encodings, vp9_sb_ymode_tree);
- vp9_tokens_from_tree(vp9_sb_kf_ymode_encodings, vp9_sb_kf_ymode_tree);
- vp9_tokens_from_tree(vp9_uv_mode_encodings, vp9_uv_mode_tree);
- vp9_tokens_from_tree(vp9_i8x8_mode_encodings, vp9_i8x8_mode_tree);
- vp9_tokens_from_tree(vp9_mbsplit_encodings, vp9_mbsplit_tree);
+ vp9_tokens_from_tree(vp9_intra_mode_encodings, vp9_intra_mode_tree);
vp9_tokens_from_tree(vp9_switchable_interp_encodings,
vp9_switchable_interp_tree);
+ vp9_tokens_from_tree(vp9_partition_encodings, vp9_partition_tree);
- vp9_tokens_from_tree_offset(vp9_mv_ref_encoding_array,
- vp9_mv_ref_tree, NEARESTMV);
vp9_tokens_from_tree_offset(vp9_sb_mv_ref_encoding_array,
vp9_sb_mv_ref_tree, NEARESTMV);
- vp9_tokens_from_tree_offset(vp9_sub_mv_ref_encoding_array,
- vp9_sub_mv_ref_tree, LEFT4X4);
}
void vp9_init_mode_contexts(VP9_COMMON *pc) {
- vpx_memset(pc->fc.mv_ref_ct, 0, sizeof(pc->fc.mv_ref_ct));
- vpx_memcpy(pc->fc.vp9_mode_contexts,
- vp9_default_mode_contexts,
- sizeof(vp9_default_mode_contexts));
+ vpx_memset(pc->fc.inter_mode_counts, 0, sizeof(pc->fc.inter_mode_counts));
+ vpx_memcpy(pc->fc.inter_mode_probs,
+ vp9_default_inter_mode_probs,
+ sizeof(vp9_default_inter_mode_probs));
}
void vp9_accum_mv_refs(VP9_COMMON *pc,
MB_PREDICTION_MODE m,
const int context) {
- unsigned int (*mv_ref_ct)[4][2];
+ unsigned int (*inter_mode_counts)[VP9_INTER_MODES - 1][2] =
+ pc->fc.inter_mode_counts;
- mv_ref_ct = pc->fc.mv_ref_ct;
-
if (m == ZEROMV) {
- ++mv_ref_ct[context][0][0];
+ ++inter_mode_counts[context][0][0];
} else {
- ++mv_ref_ct[context][0][1];
+ ++inter_mode_counts[context][0][1];
if (m == NEARESTMV) {
- ++mv_ref_ct[context][1][0];
+ ++inter_mode_counts[context][1][0];
} else {
- ++mv_ref_ct[context][1][1];
+ ++inter_mode_counts[context][1][1];
if (m == NEARMV) {
- ++mv_ref_ct[context][2][0];
+ ++inter_mode_counts[context][2][0];
} else {
- ++mv_ref_ct[context][2][1];
- if (m == NEWMV) {
- ++mv_ref_ct[context][3][0];
- } else {
- ++mv_ref_ct[context][3][1];
- }
+ ++inter_mode_counts[context][2][1];
}
}
}
@@ -482,50 +292,35 @@
#define MVREF_MAX_UPDATE_FACTOR 128
void vp9_adapt_mode_context(VP9_COMMON *pc) {
int i, j;
- unsigned int (*mv_ref_ct)[4][2];
- int (*mode_context)[4];
+ unsigned int (*inter_mode_counts)[VP9_INTER_MODES - 1][2] =
+ pc->fc.inter_mode_counts;
+ vp9_prob (*mode_context)[VP9_INTER_MODES - 1] = pc->fc.inter_mode_probs;
- mode_context = pc->fc.vp9_mode_contexts;
-
- mv_ref_ct = pc->fc.mv_ref_ct;
-
for (j = 0; j < INTER_MODE_CONTEXTS; j++) {
- for (i = 0; i < 4; i++) {
- int count = mv_ref_ct[j][i][0] + mv_ref_ct[j][i][1], factor;
-
+ for (i = 0; i < VP9_INTER_MODES - 1; i++) {
+ int count = inter_mode_counts[j][i][0] + inter_mode_counts[j][i][1];
+ int factor;
count = count > MVREF_COUNT_SAT ? MVREF_COUNT_SAT : count;
factor = (MVREF_MAX_UPDATE_FACTOR * count / MVREF_COUNT_SAT);
- mode_context[j][i] = weighted_prob(pc->fc.vp9_mode_contexts[j][i],
- get_binary_prob(mv_ref_ct[j][i][0],
- mv_ref_ct[j][i][1]),
- factor);
+ mode_context[j][i] = weighted_prob(
+ pc->fc.pre_inter_mode_probs[j][i],
+ get_binary_prob(inter_mode_counts[j][i][0],
+ inter_mode_counts[j][i][1]),
+ factor);
}
}
}
-#ifdef MODE_STATS
-#include "vp9/common/vp9_modecont.h"
-void print_mode_contexts(VP9_COMMON *pc) {
- int j, i;
- printf("\n====================\n");
- for (j = 0; j < INTER_MODE_CONTEXTS; j++) {
- for (i = 0; i < 4; i++) {
- printf("%4d ", pc->fc.mode_context[j][i]);
- }
- printf("\n");
- }
- printf("====================\n");
- for (j = 0; j < INTER_MODE_CONTEXTS; j++) {
- for (i = 0; i < 4; i++) {
- printf("%4d ", pc->fc.mode_context_a[j][i]);
- }
- printf("\n");
- }
+#define MODE_COUNT_SAT 20
+#define MODE_MAX_UPDATE_FACTOR 128
+static int update_mode_ct(vp9_prob pre_prob, vp9_prob prob,
+ unsigned int branch_ct[2]) {
+ int factor, count = branch_ct[0] + branch_ct[1];
+ count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
+ factor = (MODE_MAX_UPDATE_FACTOR * count / MODE_COUNT_SAT);
+ return weighted_prob(pre_prob, prob, factor);
}
-#endif
-#define MODE_COUNT_SAT 20
-#define MODE_MAX_UPDATE_FACTOR 144
static void update_mode_probs(int n_modes,
const vp9_tree_index *tree, unsigned int *cnt,
vp9_prob *pre_probs, vp9_prob *dst_probs,
@@ -533,33 +328,37 @@
#define MAX_PROBS 32
vp9_prob probs[MAX_PROBS];
unsigned int branch_ct[MAX_PROBS][2];
- int t, count, factor;
+ int t;
assert(n_modes - 1 < MAX_PROBS);
vp9_tree_probs_from_distribution(tree, probs, branch_ct, cnt, tok0_offset);
- for (t = 0; t < n_modes - 1; ++t) {
- count = branch_ct[t][0] + branch_ct[t][1];
- count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
- factor = (MODE_MAX_UPDATE_FACTOR * count / MODE_COUNT_SAT);
- dst_probs[t] = weighted_prob(pre_probs[t], probs[t], factor);
- }
+ for (t = 0; t < n_modes - 1; ++t)
+ dst_probs[t] = update_mode_ct(pre_probs[t], probs[t], branch_ct[t]);
}
+static int update_mode_ct2(vp9_prob pre_prob, unsigned int branch_ct[2]) {
+ return update_mode_ct(pre_prob, get_binary_prob(branch_ct[0],
+ branch_ct[1]), branch_ct);
+}
+
// #define MODE_COUNT_TESTING
void vp9_adapt_mode_probs(VP9_COMMON *cm) {
- int i;
+ int i, j;
+ FRAME_CONTEXT *fc = &cm->fc;
#ifdef MODE_COUNT_TESTING
int t;
printf("static const unsigned int\nymode_counts"
- "[VP9_YMODES] = {\n");
- for (t = 0; t < VP9_YMODES; ++t) printf("%d, ", cm->fc.ymode_counts[t]);
+ "[VP9_INTRA_MODES] = {\n");
+ for (t = 0; t < VP9_INTRA_MODES; ++t)
+ printf("%d, ", fc->ymode_counts[t]);
printf("};\n");
printf("static const unsigned int\nuv_mode_counts"
- "[VP9_YMODES] [VP9_UV_MODES] = {\n");
- for (i = 0; i < VP9_YMODES; ++i) {
+ "[VP9_INTRA_MODES] [VP9_INTRA_MODES] = {\n");
+ for (i = 0; i < VP9_INTRA_MODES; ++i) {
printf(" {");
- for (t = 0; t < VP9_UV_MODES; ++t) printf("%d, ", cm->fc.uv_mode_counts[i][t]);
+ for (t = 0; t < VP9_INTRA_MODES; ++t)
+ printf("%d, ", fc->uv_mode_counts[i][t]);
printf("},\n");
}
printf("};\n");
@@ -566,71 +365,108 @@
printf("static const unsigned int\nbmode_counts"
"[VP9_NKF_BINTRAMODES] = {\n");
for (t = 0; t < VP9_NKF_BINTRAMODES; ++t)
- printf("%d, ", cm->fc.bmode_counts[t]);
+ printf("%d, ", fc->bmode_counts[t]);
printf("};\n");
printf("static const unsigned int\ni8x8_mode_counts"
"[VP9_I8X8_MODES] = {\n");
- for (t = 0; t < VP9_I8X8_MODES; ++t) printf("%d, ", cm->fc.i8x8_mode_counts[t]);
+ for (t = 0; t < VP9_I8X8_MODES; ++t)
+ printf("%d, ", fc->i8x8_mode_counts[t]);
printf("};\n");
- printf("static const unsigned int\nsub_mv_ref_counts"
- "[SUBMVREF_COUNT] [VP9_SUBMVREFS] = {\n");
- for (i = 0; i < SUBMVREF_COUNT; ++i) {
- printf(" {");
- for (t = 0; t < VP9_SUBMVREFS; ++t) printf("%d, ", cm->fc.sub_mv_ref_counts[i][t]);
- printf("},\n");
- }
- printf("};\n");
printf("static const unsigned int\nmbsplit_counts"
"[VP9_NUMMBSPLITS] = {\n");
- for (t = 0; t < VP9_NUMMBSPLITS; ++t) printf("%d, ", cm->fc.mbsplit_counts[t]);
+ for (t = 0; t < VP9_NUMMBSPLITS; ++t)
+ printf("%d, ", fc->mbsplit_counts[t]);
printf("};\n");
-#if CONFIG_COMP_INTERINTRA_PRED
- printf("static const unsigned int\ninterintra_counts"
- "[2] = {\n");
- for (t = 0; t < 2; ++t) printf("%d, ", cm->fc.interintra_counts[t]);
- printf("};\n");
#endif
-#endif
- update_mode_probs(VP9_YMODES, vp9_ymode_tree,
- cm->fc.ymode_counts, cm->fc.pre_ymode_prob,
- cm->fc.ymode_prob, 0);
- update_mode_probs(VP9_I32X32_MODES, vp9_sb_ymode_tree,
- cm->fc.sb_ymode_counts, cm->fc.pre_sb_ymode_prob,
- cm->fc.sb_ymode_prob, 0);
- for (i = 0; i < VP9_YMODES; ++i) {
- update_mode_probs(VP9_UV_MODES, vp9_uv_mode_tree,
- cm->fc.uv_mode_counts[i], cm->fc.pre_uv_mode_prob[i],
- cm->fc.uv_mode_prob[i], 0);
- }
- update_mode_probs(VP9_NKF_BINTRAMODES, vp9_bmode_tree,
- cm->fc.bmode_counts, cm->fc.pre_bmode_prob,
- cm->fc.bmode_prob, 0);
- update_mode_probs(VP9_I8X8_MODES,
- vp9_i8x8_mode_tree, cm->fc.i8x8_mode_counts,
- cm->fc.pre_i8x8_mode_prob, cm->fc.i8x8_mode_prob, 0);
- for (i = 0; i < SUBMVREF_COUNT; ++i) {
- update_mode_probs(VP9_SUBMVREFS,
- vp9_sub_mv_ref_tree, cm->fc.sub_mv_ref_counts[i],
- cm->fc.pre_sub_mv_ref_prob[i], cm->fc.sub_mv_ref_prob[i],
- LEFT4X4);
- }
- update_mode_probs(VP9_NUMMBSPLITS, vp9_mbsplit_tree,
- cm->fc.mbsplit_counts, cm->fc.pre_mbsplit_prob,
- cm->fc.mbsplit_prob, 0);
-#if CONFIG_COMP_INTERINTRA_PRED
- if (cm->use_interintra) {
- int factor, interintra_prob, count;
+ for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
+ fc->intra_inter_prob[i] = update_mode_ct2(fc->pre_intra_inter_prob[i],
+ fc->intra_inter_count[i]);
+ for (i = 0; i < COMP_INTER_CONTEXTS; i++)
+ fc->comp_inter_prob[i] = update_mode_ct2(fc->pre_comp_inter_prob[i],
+ fc->comp_inter_count[i]);
+ for (i = 0; i < REF_CONTEXTS; i++)
+ fc->comp_ref_prob[i] = update_mode_ct2(fc->pre_comp_ref_prob[i],
+ fc->comp_ref_count[i]);
+ for (i = 0; i < REF_CONTEXTS; i++)
+ for (j = 0; j < 2; j++)
+ fc->single_ref_prob[i][j] = update_mode_ct2(fc->pre_single_ref_prob[i][j],
+ fc->single_ref_count[i][j]);
- interintra_prob = get_binary_prob(cm->fc.interintra_counts[0],
- cm->fc.interintra_counts[1]);
- count = cm->fc.interintra_counts[0] + cm->fc.interintra_counts[1];
- count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
- factor = (MODE_MAX_UPDATE_FACTOR * count / MODE_COUNT_SAT);
- cm->fc.interintra_prob = weighted_prob(cm->fc.pre_interintra_prob,
- interintra_prob, factor);
+ for (i = 0; i < BLOCK_SIZE_GROUPS; i++)
+ update_mode_probs(VP9_INTRA_MODES, vp9_intra_mode_tree,
+ fc->y_mode_counts[i], fc->pre_y_mode_prob[i],
+ fc->y_mode_prob[i], 0);
+
+ for (i = 0; i < VP9_INTRA_MODES; ++i)
+ update_mode_probs(VP9_INTRA_MODES, vp9_intra_mode_tree,
+ fc->uv_mode_counts[i], fc->pre_uv_mode_prob[i],
+ fc->uv_mode_prob[i], 0);
+
+ for (i = 0; i < NUM_PARTITION_CONTEXTS; i++)
+ update_mode_probs(PARTITION_TYPES, vp9_partition_tree,
+ fc->partition_counts[i], fc->pre_partition_prob[i],
+ fc->partition_prob[INTER_FRAME][i], 0);
+
+ if (cm->mcomp_filter_type == SWITCHABLE) {
+ for (i = 0; i <= VP9_SWITCHABLE_FILTERS; i++) {
+ update_mode_probs(VP9_SWITCHABLE_FILTERS, vp9_switchable_interp_tree,
+ fc->switchable_interp_count[i],
+ fc->pre_switchable_interp_prob[i],
+ fc->switchable_interp_prob[i], 0);
+ }
}
-#endif
+ if (cm->txfm_mode == TX_MODE_SELECT) {
+ int j;
+ unsigned int branch_ct_8x8p[TX_SIZE_MAX_SB - 3][2];
+ unsigned int branch_ct_16x16p[TX_SIZE_MAX_SB - 2][2];
+ unsigned int branch_ct_32x32p[TX_SIZE_MAX_SB - 1][2];
+ for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
+ tx_counts_to_branch_counts_8x8(cm->fc.tx_count_8x8p[i],
+ branch_ct_8x8p);
+ for (j = 0; j < TX_SIZE_MAX_SB - 3; ++j) {
+ int factor;
+ int count = branch_ct_8x8p[j][0] + branch_ct_8x8p[j][1];
+ vp9_prob prob = get_binary_prob(branch_ct_8x8p[j][0],
+ branch_ct_8x8p[j][1]);
+ count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
+ factor = (MODE_MAX_UPDATE_FACTOR * count / MODE_COUNT_SAT);
+ cm->fc.tx_probs_8x8p[i][j] = weighted_prob(
+ cm->fc.pre_tx_probs_8x8p[i][j], prob, factor);
+ }
+ }
+ for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
+ tx_counts_to_branch_counts_16x16(cm->fc.tx_count_16x16p[i],
+ branch_ct_16x16p);
+ for (j = 0; j < TX_SIZE_MAX_SB - 2; ++j) {
+ int factor;
+ int count = branch_ct_16x16p[j][0] + branch_ct_16x16p[j][1];
+ vp9_prob prob = get_binary_prob(branch_ct_16x16p[j][0],
+ branch_ct_16x16p[j][1]);
+ count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
+ factor = (MODE_MAX_UPDATE_FACTOR * count / MODE_COUNT_SAT);
+ cm->fc.tx_probs_16x16p[i][j] = weighted_prob(
+ cm->fc.pre_tx_probs_16x16p[i][j], prob, factor);
+ }
+ }
+ for (i = 0; i < TX_SIZE_CONTEXTS; ++i) {
+ tx_counts_to_branch_counts_32x32(cm->fc.tx_count_32x32p[i],
+ branch_ct_32x32p);
+ for (j = 0; j < TX_SIZE_MAX_SB - 1; ++j) {
+ int factor;
+ int count = branch_ct_32x32p[j][0] + branch_ct_32x32p[j][1];
+ vp9_prob prob = get_binary_prob(branch_ct_32x32p[j][0],
+ branch_ct_32x32p[j][1]);
+ count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
+ factor = (MODE_MAX_UPDATE_FACTOR * count / MODE_COUNT_SAT);
+ cm->fc.tx_probs_32x32p[i][j] = weighted_prob(
+ cm->fc.pre_tx_probs_32x32p[i][j], prob, factor);
+ }
+ }
+ }
+ for (i = 0; i < MBSKIP_CONTEXTS; ++i)
+ fc->mbskip_probs[i] = update_mode_ct2(fc->pre_mbskip_probs[i],
+ fc->mbskip_count[i]);
}
static void set_default_lf_deltas(MACROBLOCKD *xd) {
@@ -637,15 +473,13 @@
xd->mode_ref_lf_delta_enabled = 1;
xd->mode_ref_lf_delta_update = 1;
- xd->ref_lf_deltas[INTRA_FRAME] = 2;
+ xd->ref_lf_deltas[INTRA_FRAME] = 1;
xd->ref_lf_deltas[LAST_FRAME] = 0;
- xd->ref_lf_deltas[GOLDEN_FRAME] = -2;
- xd->ref_lf_deltas[ALTREF_FRAME] = -2;
+ xd->ref_lf_deltas[GOLDEN_FRAME] = -1;
+ xd->ref_lf_deltas[ALTREF_FRAME] = -1;
- xd->mode_lf_deltas[0] = 4; // BPRED
- xd->mode_lf_deltas[1] = -2; // Zero
- xd->mode_lf_deltas[2] = 2; // New mv
- xd->mode_lf_deltas[3] = 4; // Split mv
+ xd->mode_lf_deltas[0] = 0; // Zero
+ xd->mode_lf_deltas[1] = 0; // New mv
}
void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
@@ -655,9 +489,9 @@
vp9_clearall_segfeatures(xd);
xd->mb_segment_abs_delta = SEGMENT_DELTADATA;
if (cm->last_frame_seg_map)
- vpx_memset(cm->last_frame_seg_map, 0, (cm->mb_rows * cm->mb_cols));
+ vpx_memset(cm->last_frame_seg_map, 0, (cm->mi_rows * cm->mi_cols));
- /* reset the mode ref deltas for loop filter */
+ // Reset the mode ref deltas for loop filter
vpx_memset(xd->last_ref_lf_deltas, 0, sizeof(xd->last_ref_lf_deltas));
vpx_memset(xd->last_mode_lf_deltas, 0, sizeof(xd->last_mode_lf_deltas));
set_default_lf_deltas(xd);
@@ -664,33 +498,38 @@
vp9_default_coef_probs(cm);
vp9_init_mbmode_probs(cm);
- vp9_default_bmode_probs(cm->fc.bmode_prob);
- vp9_kf_default_bmode_probs(cm->kf_bmode_prob);
+ vpx_memcpy(cm->kf_y_mode_prob, vp9_kf_default_bmode_probs,
+ sizeof(vp9_kf_default_bmode_probs));
vp9_init_mv_probs(cm);
+
// To force update of the sharpness
cm->last_sharpness_level = -1;
vp9_init_mode_contexts(cm);
- for (i = 0; i < NUM_FRAME_CONTEXTS; i++) {
- vpx_memcpy(&cm->frame_contexts[i], &cm->fc, sizeof(cm->fc));
+ if ((cm->frame_type == KEY_FRAME) ||
+ cm->error_resilient_mode || (cm->reset_frame_context == 3)) {
+ // Reset all frame contexts.
+ for (i = 0; i < NUM_FRAME_CONTEXTS; ++i)
+ vpx_memcpy(&cm->frame_contexts[i], &cm->fc, sizeof(cm->fc));
+ } else if (cm->reset_frame_context == 2) {
+ // Reset only the frame context specified in the frame header.
+ vpx_memcpy(&cm->frame_contexts[cm->frame_context_idx], &cm->fc,
+ sizeof(cm->fc));
}
vpx_memset(cm->prev_mip, 0,
- (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
+ cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
vpx_memset(cm->mip, 0,
- (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
+ cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
vp9_update_mode_info_border(cm, cm->mip);
vp9_update_mode_info_in_image(cm, cm->mi);
-#if CONFIG_NEW_MVREF
- // Defaults probabilities for encoding the MV ref id signal
- vpx_memset(xd->mb_mv_ref_probs, VP9_DEFAULT_MV_REF_PROB,
- sizeof(xd->mb_mv_ref_probs));
-#endif
- cm->ref_frame_sign_bias[GOLDEN_FRAME] = 0;
- cm->ref_frame_sign_bias[ALTREF_FRAME] = 0;
+ vp9_update_mode_info_border(cm, cm->prev_mip);
+ vp9_update_mode_info_in_image(cm, cm->prev_mi);
+
+ vpx_memset(cm->ref_frame_sign_bias, 0, sizeof(cm->ref_frame_sign_bias));
cm->frame_context_idx = 0;
}
--- a/vp9/common/vp9_entropymode.h
+++ b/vp9/common/vp9_entropymode.h
@@ -15,61 +15,35 @@
#include "vp9/common/vp9_treecoder.h"
#define SUBMVREF_COUNT 5
-#define VP9_NUMMBSPLITS 4
+#define TX_SIZE_CONTEXTS 2
-#if CONFIG_COMP_INTERINTRA_PRED
-#define VP9_DEF_INTERINTRA_PROB 248
-#define VP9_UPD_INTERINTRA_PROB 192
-// whether to use a separate uv mode (1) or use the same as the y mode (0)
-#define SEPARATE_INTERINTRA_UV 0
-#endif
+#define VP9_MODE_UPDATE_PROB 252
-typedef const int vp9_mbsplit[16];
+// #define MODE_STATS
-extern vp9_mbsplit vp9_mbsplits[VP9_NUMMBSPLITS];
-
-extern const int vp9_mbsplit_count[VP9_NUMMBSPLITS]; /* # of subsets */
-
-extern const vp9_prob vp9_mbsplit_probs[VP9_NUMMBSPLITS - 1];
-
extern int vp9_mv_cont(const int_mv *l, const int_mv *a);
-extern const vp9_prob vp9_sub_mv_ref_prob2[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
-extern const unsigned int vp9_kf_default_bmode_counts[VP9_KF_BINTRAMODES]
- [VP9_KF_BINTRAMODES]
- [VP9_KF_BINTRAMODES];
+extern const vp9_prob vp9_kf_default_bmode_probs[VP9_INTRA_MODES]
+ [VP9_INTRA_MODES]
+ [VP9_INTRA_MODES - 1];
-extern const vp9_tree_index vp9_bmode_tree[];
-extern const vp9_tree_index vp9_kf_bmode_tree[];
-
-extern const vp9_tree_index vp9_ymode_tree[];
-extern const vp9_tree_index vp9_kf_ymode_tree[];
-extern const vp9_tree_index vp9_uv_mode_tree[];
-#define vp9_sb_ymode_tree vp9_uv_mode_tree
-#define vp9_sb_kf_ymode_tree vp9_uv_mode_tree
-extern const vp9_tree_index vp9_i8x8_mode_tree[];
-extern const vp9_tree_index vp9_mbsplit_tree[];
-extern const vp9_tree_index vp9_mv_ref_tree[];
+extern const vp9_tree_index vp9_intra_mode_tree[];
extern const vp9_tree_index vp9_sb_mv_ref_tree[];
-extern const vp9_tree_index vp9_sub_mv_ref_tree[];
-extern struct vp9_token_struct vp9_bmode_encodings[VP9_NKF_BINTRAMODES];
-extern struct vp9_token_struct vp9_kf_bmode_encodings[VP9_KF_BINTRAMODES];
-extern struct vp9_token_struct vp9_ymode_encodings[VP9_YMODES];
-extern struct vp9_token_struct vp9_sb_ymode_encodings[VP9_I32X32_MODES];
-extern struct vp9_token_struct vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
-extern struct vp9_token_struct vp9_kf_ymode_encodings[VP9_YMODES];
-extern struct vp9_token_struct vp9_i8x8_mode_encodings[VP9_I8X8_MODES];
-extern struct vp9_token_struct vp9_uv_mode_encodings[VP9_UV_MODES];
-extern struct vp9_token_struct vp9_mbsplit_encodings[VP9_NUMMBSPLITS];
+extern struct vp9_token vp9_intra_mode_encodings[VP9_INTRA_MODES];
/* Inter mode values do not start at zero */
-extern struct vp9_token_struct vp9_mv_ref_encoding_array[VP9_MVREFS];
-extern struct vp9_token_struct vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
-extern struct vp9_token_struct vp9_sub_mv_ref_encoding_array[VP9_SUBMVREFS];
+extern struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_INTER_MODES];
+// probability models for partition information
+extern const vp9_tree_index vp9_partition_tree[];
+extern struct vp9_token vp9_partition_encodings[PARTITION_TYPES];
+extern const vp9_prob vp9_partition_probs[NUM_FRAME_TYPES]
+ [NUM_PARTITION_CONTEXTS]
+ [PARTITION_TYPES - 1];
+
void vp9_entropy_mode_init(void);
struct VP9Common;
@@ -87,12 +61,6 @@
MB_PREDICTION_MODE m,
const int context);
-void vp9_default_bmode_probs(vp9_prob dest[VP9_NKF_BINTRAMODES - 1]);
-
-void vp9_kf_default_bmode_probs(vp9_prob dest[VP9_KF_BINTRAMODES]
- [VP9_KF_BINTRAMODES]
- [VP9_KF_BINTRAMODES - 1]);
-
void vp9_adapt_mode_probs(struct VP9Common *);
#define VP9_SWITCHABLE_FILTERS 3 /* number of switchable filters */
@@ -107,10 +75,22 @@
extern const vp9_tree_index vp9_switchable_interp_tree
[2 * (VP9_SWITCHABLE_FILTERS - 1)];
-extern struct vp9_token_struct vp9_switchable_interp_encodings
- [VP9_SWITCHABLE_FILTERS];
+extern struct vp9_token vp9_switchable_interp_encodings[VP9_SWITCHABLE_FILTERS];
extern const vp9_prob vp9_switchable_interp_prob[VP9_SWITCHABLE_FILTERS + 1]
[VP9_SWITCHABLE_FILTERS - 1];
+extern const vp9_prob vp9_default_tx_probs_32x32p[TX_SIZE_CONTEXTS]
+ [TX_SIZE_MAX_SB - 1];
+extern const vp9_prob vp9_default_tx_probs_16x16p[TX_SIZE_CONTEXTS]
+ [TX_SIZE_MAX_SB - 2];
+extern const vp9_prob vp9_default_tx_probs_8x8p[TX_SIZE_CONTEXTS]
+ [TX_SIZE_MAX_SB - 3];
+
+extern void tx_counts_to_branch_counts_32x32(unsigned int *tx_count_32x32p,
+ unsigned int (*ct_32x32p)[2]);
+extern void tx_counts_to_branch_counts_16x16(unsigned int *tx_count_16x16p,
+ unsigned int (*ct_16x16p)[2]);
+extern void tx_counts_to_branch_counts_8x8(unsigned int *tx_count_8x8p,
+ unsigned int (*ct_8x8p)[2]);
#endif // VP9_COMMON_VP9_ENTROPYMODE_H_
--- a/vp9/common/vp9_entropymv.c
+++ b/vp9/common/vp9_entropymv.c
@@ -14,16 +14,11 @@
//#define MV_COUNT_TESTING
-#define MV_COUNT_SAT 16
-#define MV_MAX_UPDATE_FACTOR 160
+#define MV_COUNT_SAT 20
+#define MV_MAX_UPDATE_FACTOR 128
-#if CONFIG_NEW_MVREF
/* Integer pel reference mv threshold for use of high-precision 1/8 mv */
-#define COMPANDED_MVREF_THRESH 1000000
-#else
-/* Integer pel reference mv threshold for use of high-precision 1/8 mv */
#define COMPANDED_MVREF_THRESH 8
-#endif
/* Smooth or bias the mv-counts before prob computation */
/* #define SMOOTH_MV_COUNTS */
@@ -33,7 +28,7 @@
-MV_JOINT_HNZVZ, 4,
-MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
};
-struct vp9_token_struct vp9_mv_joint_encodings[MV_JOINTS];
+struct vp9_token vp9_mv_joint_encodings[MV_JOINTS];
const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2] = {
-MV_CLASS_0, 2,
@@ -47,12 +42,12 @@
-MV_CLASS_7, -MV_CLASS_8,
-MV_CLASS_9, -MV_CLASS_10,
};
-struct vp9_token_struct vp9_mv_class_encodings[MV_CLASSES];
+struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
const vp9_tree_index vp9_mv_class0_tree [2 * CLASS0_SIZE - 2] = {
-0, -1,
};
-struct vp9_token_struct vp9_mv_class0_encodings[CLASS0_SIZE];
+struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];
const vp9_tree_index vp9_mv_fp_tree [2 * 4 - 2] = {
-0, 2,
@@ -59,7 +54,7 @@
-1, 4,
-2, -3
};
-struct vp9_token_struct vp9_mv_fp_encodings[4];
+struct vp9_token vp9_mv_fp_encodings[4];
const nmv_context vp9_default_nmv_context = {
{32, 64, 96},
@@ -87,11 +82,15 @@
},
};
-MV_JOINT_TYPE vp9_get_mv_joint(MV mv) {
- if (mv.row == 0 && mv.col == 0) return MV_JOINT_ZERO;
- else if (mv.row == 0 && mv.col != 0) return MV_JOINT_HNZVZ;
- else if (mv.row != 0 && mv.col == 0) return MV_JOINT_HZVNZ;
- else return MV_JOINT_HNZVNZ;
+MV_JOINT_TYPE vp9_get_mv_joint(const MV *mv) {
+ if (mv->row == 0 && mv->col == 0)
+ return MV_JOINT_ZERO;
+ else if (mv->row == 0 && mv->col != 0)
+ return MV_JOINT_HNZVZ;
+ else if (mv->row != 0 && mv->col == 0)
+ return MV_JOINT_HZVNZ;
+ else
+ return MV_JOINT_HNZVNZ;
}
#define mv_class_base(c) ((c) ? (CLASS0_SIZE << (c + 2)) : 0)
@@ -137,7 +136,8 @@
int incr,
int usehp) {
int s, z, c, o, d, e, f;
- if (!incr) return;
+ if (!incr)
+ return;
assert (v != 0); /* should not be zero */
s = v < 0;
mvcomp->sign[s] += incr;
@@ -152,8 +152,8 @@
if (c == MV_CLASS_0) {
mvcomp->class0[d] += incr;
} else {
- int i, b;
- b = c + CLASS0_BITS - 1; /* number of bits */
+ int i;
+ int b = c + CLASS0_BITS - 1; // number of bits
for (i = 0; i < b; ++i)
mvcomp->bits[i][((d >> i) & 1)] += incr;
}
@@ -204,25 +204,22 @@
void vp9_increment_nmv(const MV *mv, const MV *ref, nmv_context_counts *mvctx,
int usehp) {
- MV_JOINT_TYPE j = vp9_get_mv_joint(*mv);
+ const MV_JOINT_TYPE j = vp9_get_mv_joint(mv);
mvctx->joints[j]++;
usehp = usehp && vp9_use_nmv_hp(ref);
- if (j == MV_JOINT_HZVNZ || j == MV_JOINT_HNZVNZ) {
+ if (mv_joint_vertical(j))
increment_nmv_component_count(mv->row, &mvctx->comps[0], 1, usehp);
- }
- if (j == MV_JOINT_HNZVZ || j == MV_JOINT_HNZVNZ) {
+
+ if (mv_joint_horizontal(j))
increment_nmv_component_count(mv->col, &mvctx->comps[1], 1, usehp);
- }
}
-static void adapt_prob(vp9_prob *dest, vp9_prob prep,
- unsigned int ct[2]) {
- int count = ct[0] + ct[1];
+static void adapt_prob(vp9_prob *dest, vp9_prob prep, unsigned int ct[2]) {
+ const int count = MIN(ct[0] + ct[1], MV_COUNT_SAT);
if (count) {
- vp9_prob newp = get_binary_prob(ct[0], ct[1]);
- count = count > MV_COUNT_SAT ? MV_COUNT_SAT : count;
- *dest = weighted_prob(prep, newp,
- MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT);
+ const vp9_prob newp = get_binary_prob(ct[0], ct[1]);
+ const int factor = MV_MAX_UPDATE_FACTOR * count / MV_COUNT_SAT;
+ *dest = weighted_prob(prep, newp, factor);
} else {
*dest = prep;
}
@@ -253,10 +250,12 @@
branch_ct_joint,
nmv_count->joints, 0);
for (i = 0; i < 2; ++i) {
- prob->comps[i].sign = get_binary_prob(nmv_count->comps[i].sign[0],
- nmv_count->comps[i].sign[1]);
- branch_ct_sign[i][0] = nmv_count->comps[i].sign[0];
- branch_ct_sign[i][1] = nmv_count->comps[i].sign[1];
+ const uint32_t s0 = nmv_count->comps[i].sign[0];
+ const uint32_t s1 = nmv_count->comps[i].sign[1];
+
+ prob->comps[i].sign = get_binary_prob(s0, s1);
+ branch_ct_sign[i][0] = s0;
+ branch_ct_sign[i][1] = s1;
vp9_tree_probs_from_distribution(vp9_mv_class_tree,
prob->comps[i].classes,
branch_ct_classes[i],
@@ -266,10 +265,12 @@
branch_ct_class0[i],
nmv_count->comps[i].class0, 0);
for (j = 0; j < MV_OFFSET_BITS; ++j) {
- prob->comps[i].bits[j] = get_binary_prob(nmv_count->comps[i].bits[j][0],
- nmv_count->comps[i].bits[j][1]);
- branch_ct_bits[i][j][0] = nmv_count->comps[i].bits[j][0];
- branch_ct_bits[i][j][1] = nmv_count->comps[i].bits[j][1];
+ const uint32_t b0 = nmv_count->comps[i].bits[j][0];
+ const uint32_t b1 = nmv_count->comps[i].bits[j][1];
+
+ prob->comps[i].bits[j] = get_binary_prob(b0, b1);
+ branch_ct_bits[i][j][0] = b0;
+ branch_ct_bits[i][j][1] = b1;
}
}
for (i = 0; i < 2; ++i) {
@@ -286,16 +287,18 @@
}
if (usehp) {
for (i = 0; i < 2; ++i) {
- prob->comps[i].class0_hp =
- get_binary_prob(nmv_count->comps[i].class0_hp[0],
- nmv_count->comps[i].class0_hp[1]);
- branch_ct_class0_hp[i][0] = nmv_count->comps[i].class0_hp[0];
- branch_ct_class0_hp[i][1] = nmv_count->comps[i].class0_hp[1];
+ const uint32_t c0_hp0 = nmv_count->comps[i].class0_hp[0];
+ const uint32_t c0_hp1 = nmv_count->comps[i].class0_hp[1];
+ const uint32_t hp0 = nmv_count->comps[i].hp[0];
+ const uint32_t hp1 = nmv_count->comps[i].hp[1];
- prob->comps[i].hp = get_binary_prob(nmv_count->comps[i].hp[0],
- nmv_count->comps[i].hp[1]);
- branch_ct_hp[i][0] = nmv_count->comps[i].hp[0];
- branch_ct_hp[i][1] = nmv_count->comps[i].hp[1];
+ prob->comps[i].class0_hp = get_binary_prob(c0_hp0, c0_hp1);
+ branch_ct_class0_hp[i][0] = c0_hp0;
+ branch_ct_class0_hp[i][1] = c0_hp1;
+
+ prob->comps[i].hp = get_binary_prob(hp0, hp1);
+ branch_ct_hp[i][0] = hp0;
+ branch_ct_hp[i][1] = hp1;
}
}
}
--- a/vp9/common/vp9_entropymv.h
+++ b/vp9/common/vp9_entropymv.h
@@ -24,14 +24,8 @@
void vp9_adapt_nmv_probs(struct VP9Common *cm, int usehp);
int vp9_use_nmv_hp(const MV *ref);
-#define VP9_NMV_UPDATE_PROB 255
+#define VP9_NMV_UPDATE_PROB 252
-#if CONFIG_NEW_MVREF
-#define VP9_MVREF_UPDATE_PROB 252
-#define VP9_DEFAULT_MV_REF_PROB 192
-#define VP9_MV_REF_UPDATE_COST (14 << 8)
-#endif
-
//#define MV_GROUP_UPDATE
#define LOW_PRECISION_MV_UPDATE /* Use 7 bit forward update */
@@ -45,8 +39,16 @@
MV_JOINT_HNZVNZ = 3, /* Both components nonzero */
} MV_JOINT_TYPE;
+static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) {
+ return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ;
+}
+
+static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) {
+ return type == MV_JOINT_HNZVZ || type == MV_JOINT_HNZVNZ;
+}
+
extern const vp9_tree_index vp9_mv_joint_tree[2 * MV_JOINTS - 2];
-extern struct vp9_token_struct vp9_mv_joint_encodings [MV_JOINTS];
+extern struct vp9_token vp9_mv_joint_encodings[MV_JOINTS];
/* Symbols for coding magnitude class of nonzero components */
#define MV_CLASSES 11
@@ -65,7 +67,7 @@
} MV_CLASS_TYPE;
extern const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2];
-extern struct vp9_token_struct vp9_mv_class_encodings [MV_CLASSES];
+extern struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
#define CLASS0_BITS 1 /* bits at integer precision for class 0 */
#define CLASS0_SIZE (1 << CLASS0_BITS)
@@ -76,10 +78,10 @@
#define MV_VALS ((MV_MAX << 1) + 1)
extern const vp9_tree_index vp9_mv_class0_tree[2 * CLASS0_SIZE - 2];
-extern struct vp9_token_struct vp9_mv_class0_encodings[CLASS0_SIZE];
+extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];
extern const vp9_tree_index vp9_mv_fp_tree[2 * 4 - 2];
-extern struct vp9_token_struct vp9_mv_fp_encodings[4];
+extern struct vp9_token vp9_mv_fp_encodings[4];
typedef struct {
vp9_prob sign;
@@ -97,7 +99,7 @@
nmv_component comps[2];
} nmv_context;
-MV_JOINT_TYPE vp9_get_mv_joint(MV mv);
+MV_JOINT_TYPE vp9_get_mv_joint(const MV *mv);
MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset);
int vp9_get_mv_mag(MV_CLASS_TYPE c, int offset);
--- /dev/null
+++ b/vp9/common/vp9_enums.h
@@ -1,0 +1,49 @@
+/*
+ * 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_ENUMS_H_
+#define VP9_COMMON_VP9_ENUMS_H_
+
+#include "./vpx_config.h"
+
+#define LOG2_MI_SIZE 3
+
+#define MI_SIZE (1 << LOG2_MI_SIZE)
+#define MI_MASK ((64 >> LOG2_MI_SIZE) - 1)
+
+typedef enum BLOCK_SIZE_TYPE {
+ BLOCK_SIZE_AB4X4,
+ BLOCK_SIZE_SB4X8,
+ BLOCK_SIZE_SB8X4,
+ BLOCK_SIZE_SB8X8,
+ BLOCK_SIZE_SB8X16,
+ BLOCK_SIZE_SB16X8,
+ BLOCK_SIZE_MB16X16,
+ BLOCK_SIZE_SB16X32,
+ BLOCK_SIZE_SB32X16,
+ BLOCK_SIZE_SB32X32,
+ BLOCK_SIZE_SB32X64,
+ BLOCK_SIZE_SB64X32,
+ BLOCK_SIZE_SB64X64,
+ BLOCK_SIZE_TYPES
+} BLOCK_SIZE_TYPE;
+
+typedef enum PARTITION_TYPE {
+ PARTITION_NONE,
+ PARTITION_HORZ,
+ PARTITION_VERT,
+ PARTITION_SPLIT,
+ PARTITION_TYPES
+} PARTITION_TYPE;
+
+#define PARTITION_PLOFFSET 4 // number of probability models per block size
+#define NUM_PARTITION_CONTEXTS (4 * PARTITION_PLOFFSET)
+
+#endif // VP9_COMMON_VP9_ENUMS_H_
--- a/vp9/common/vp9_extend.c
+++ b/vp9/common/vp9_extend.c
@@ -60,11 +60,23 @@
const int eb_y = dst->border + dst->y_height - src->y_height;
const int er_y = dst->border + dst->y_width - src->y_width;
- const int et_uv = dst->border >> 1;
- const int el_uv = dst->border >> 1;
- const int eb_uv = (dst->border >> 1) + dst->uv_height - src->uv_height;
- const int er_uv = (dst->border >> 1) + dst->uv_width - src->uv_width;
+ const int et_uv = dst->border >> (dst->uv_height != dst->y_height);
+ const int el_uv = dst->border >> (dst->uv_width != dst->y_width);
+ const int eb_uv = et_uv + dst->uv_height - src->uv_height;
+ const int er_uv = el_uv + dst->uv_width - src->uv_width;
+#if CONFIG_ALPHA
+ const int et_a = dst->border >> (dst->alpha_height != dst->y_height);
+ const int el_a = dst->border >> (dst->alpha_width != dst->y_width);
+ const int eb_a = et_a + dst->alpha_height - src->alpha_height;
+ const int er_a = el_a + dst->alpha_width - src->alpha_width;
+
+ copy_and_extend_plane(src->alpha_buffer, src->alpha_stride,
+ dst->alpha_buffer, dst->alpha_stride,
+ src->alpha_width, src->alpha_height,
+ et_a, el_a, eb_a, er_a);
+#endif
+
copy_and_extend_plane(src->y_buffer, src->y_stride,
dst->y_buffer, dst->y_stride,
src->y_width, src->y_height,
@@ -78,7 +90,7 @@
copy_and_extend_plane(src->v_buffer, src->uv_stride,
dst->v_buffer, dst->uv_stride,
src->uv_width, src->uv_height,
- et_y, el_y, eb_uv, er_uv);
+ et_uv, el_uv, eb_uv, er_uv);
}
void vp9_copy_and_extend_frame_with_rect(const YV12_BUFFER_CONFIG *src,
@@ -118,30 +130,4 @@
dst->v_buffer + dst_uv_offset, dst->uv_stride,
srcw_uv, srch_uv,
et_uv, el_uv, eb_uv, er_uv);
-}
-
-// note the extension is only for the last row, for intra prediction purpose
-void vp9_extend_mb_row(YV12_BUFFER_CONFIG *buf,
- uint8_t *y, uint8_t *u, uint8_t *v) {
- int i;
-
- y += buf->y_stride * 14;
- u += buf->uv_stride * 6;
- v += buf->uv_stride * 6;
-
- for (i = 0; i < 4; i++) {
- y[i] = y[-1];
- u[i] = u[-1];
- v[i] = v[-1];
- }
-
- y += buf->y_stride;
- u += buf->uv_stride;
- v += buf->uv_stride;
-
- for (i = 0; i < 4; i++) {
- y[i] = y[-1];
- u[i] = u[-1];
- v[i] = v[-1];
- }
}
--- a/vp9/common/vp9_extend.h
+++ b/vp9/common/vp9_extend.h
@@ -22,9 +22,4 @@
YV12_BUFFER_CONFIG *dst,
int srcy, int srcx,
int srch, int srcw);
-
-void vp9_extend_mb_row(YV12_BUFFER_CONFIG *buf,
- uint8_t *y, uint8_t *u, uint8_t *v);
-
-
#endif // VP9_COMMON_VP9_EXTEND_H_
--- a/vp9/common/vp9_filter.c
+++ b/vp9/common/vp9_filter.c
@@ -34,12 +34,7 @@
{ 0, 0, 0, 8, 120, 0, 0, 0 }
};
-#define FILTER_ALPHA 0
-#define FILTER_ALPHA_SHARP 0
-#define FILTER_ALPHA_SMOOTH 50
-DECLARE_ALIGNED(256, const int16_t, vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8])
- = {
-#if FILTER_ALPHA == 0
+DECLARE_ALIGNED(256, const int16_t, vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8]) = {
/* Lagrangian interpolation filter */
{ 0, 0, 0, 128, 0, 0, 0, 0},
{ 0, 1, -5, 126, 8, -3, 1, 0},
@@ -57,38 +52,10 @@
{ -1, 3, -9, 27, 118, -13, 4, -1},
{ 0, 2, -6, 18, 122, -10, 3, -1},
{ 0, 1, -3, 8, 126, -5, 1, 0}
-
-#elif FILTER_ALPHA == 50
- /* Generated using MATLAB:
- * alpha = 0.5;
- * b=intfilt(8,4,alpha);
- * bi=round(128*b);
- * ba=flipud(reshape([bi 0], 8, 8));
- * disp(num2str(ba, '%d,'))
- */
- { 0, 0, 0, 128, 0, 0, 0, 0},
- { 0, 1, -5, 126, 8, -3, 1, 0},
- { 0, 2, -10, 122, 18, -6, 2, 0},
- { -1, 3, -13, 118, 27, -9, 3, 0},
- { -1, 4, -16, 112, 37, -11, 3, 0},
- { -1, 5, -17, 104, 48, -14, 4, -1},
- { -1, 5, -18, 96, 58, -16, 5, -1},
- { -1, 5, -19, 88, 68, -17, 5, -1},
- { -1, 5, -18, 78, 78, -18, 5, -1},
- { -1, 5, -17, 68, 88, -19, 5, -1},
- { -1, 5, -16, 58, 96, -18, 5, -1},
- { -1, 4, -14, 48, 104, -17, 5, -1},
- { 0, 3, -11, 37, 112, -16, 4, -1},
- { 0, 3, -9, 27, 118, -13, 3, -1},
- { 0, 2, -6, 18, 122, -10, 2, 0},
- { 0, 1, -3, 8, 126, -5, 1, 0}
-
-#endif /* FILTER_ALPHA */
};
DECLARE_ALIGNED(256, const int16_t, vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8])
= {
-#if FILTER_ALPHA_SHARP == 0
/* dct based filter */
{0, 0, 0, 128, 0, 0, 0, 0},
{-1, 3, -7, 127, 8, -3, 1, 0},
@@ -106,88 +73,25 @@
{-2, 5, -10, 27, 121, -17, 7, -3},
{-1, 3, -6, 17, 125, -13, 5, -2},
{0, 1, -3, 8, 127, -7, 3, -1}
-
-#elif FILTER_ALPHA_SHARP == 80
- /* alpha = 0.80 */
- { 0, 0, 0, 128, 0, 0, 0, 0},
- {-1, 2, -6, 127, 9, -4, 2, -1},
- {-2, 5, -12, 124, 18, -7, 4, -2},
- {-2, 7, -16, 119, 28, -11, 5, -2},
- {-3, 8, -19, 114, 38, -14, 7, -3},
- {-3, 9, -22, 107, 49, -17, 8, -3},
- {-4, 10, -23, 99, 60, -20, 10, -4},
- {-4, 11, -23, 90, 70, -22, 10, -4},
- {-4, 11, -23, 80, 80, -23, 11, -4},
- {-4, 10, -22, 70, 90, -23, 11, -4},
- {-4, 10, -20, 60, 99, -23, 10, -4},
- {-3, 8, -17, 49, 107, -22, 9, -3},
- {-3, 7, -14, 38, 114, -19, 8, -3},
- {-2, 5, -11, 28, 119, -16, 7, -2},
- {-2, 4, -7, 18, 124, -12, 5, -2},
- {-1, 2, -4, 9, 127, -6, 2, -1}
-#endif /* FILTER_ALPHA_SHARP */
};
DECLARE_ALIGNED(256, const int16_t,
vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS][8]) = {
- /* 8-tap lowpass filter */
- /* Hamming window */
- /* freqmultiplier = 0.625 */
-#if FILTER_ALPHA_SMOOTH == 625
- {-1, -7, 32, 80, 32, -7, -1, 0},
- {-1, -8, 28, 80, 37, -7, -2, 1},
- { 0, -8, 24, 79, 41, -7, -2, 1},
- { 0, -8, 20, 78, 45, -5, -3, 1},
- { 0, -8, 16, 76, 50, -4, -3, 1},
- { 0, -7, 13, 74, 54, -3, -4, 1},
- { 1, -7, 9, 71, 58, -1, -4, 1},
- { 1, -6, 6, 68, 62, 1, -5, 1},
- { 1, -6, 4, 65, 65, 4, -6, 1},
- { 1, -5, 1, 62, 68, 6, -6, 1},
- { 1, -4, -1, 58, 71, 9, -7, 1},
- { 1, -4, -3, 54, 74, 13, -7, 0},
- { 1, -3, -4, 50, 76, 16, -8, 0},
- { 1, -3, -5, 45, 78, 20, -8, 0},
- { 1, -2, -7, 41, 79, 24, -8, 0},
- { 1, -2, -7, 37, 80, 28, -8, -1}
-
-#elif FILTER_ALPHA_SMOOTH == 50
/* freqmultiplier = 0.5 */
- {-3, 0, 35, 64, 35, 0, -3, 0},
- {-3, -1, 32, 64, 38, 1, -3, 0},
- {-2, -2, 29, 63, 41, 2, -3, 0},
- {-2, -2, 26, 63, 43, 4, -4, 0},
- {-2, -3, 24, 62, 46, 5, -4, 0},
- {-2, -3, 21, 60, 49, 7, -4, 0},
- {-1, -4, 18, 59, 51, 9, -4, 0},
- {-1, -4, 16, 57, 53, 12, -4, -1},
- {-1, -4, 14, 55, 55, 14, -4, -1},
- {-1, -4, 12, 53, 57, 16, -4, -1},
- {0, -4, 9, 51, 59, 18, -4, -1},
- {0, -4, 7, 49, 60, 21, -3, -2},
- {0, -4, 5, 46, 62, 24, -3, -2},
- {0, -4, 4, 43, 63, 26, -2, -2},
- {0, -3, 2, 41, 63, 29, -2, -2},
- {0, -3, 1, 38, 64, 32, -1, -3}
-#endif
-};
-
-DECLARE_ALIGNED(256, const int16_t, vp9_sub_pel_filters_6[SUBPEL_SHIFTS][8])
- = {
- {0, 0, 0, 128, 0, 0, 0, 0},
- {0, 1, -5, 125, 8, -2, 1, 0},
- {0, 1, -8, 122, 17, -5, 1, 0},
- {0, 2, -11, 116, 27, -8, 2, 0},
- {0, 3, -14, 110, 37, -10, 2, 0},
- {0, 3, -15, 103, 47, -12, 2, 0},
- {0, 3, -16, 95, 57, -14, 3, 0},
- {0, 3, -16, 86, 67, -15, 3, 0},
- {0, 3, -16, 77, 77, -16, 3, 0},
- {0, 3, -15, 67, 86, -16, 3, 0},
- {0, 3, -14, 57, 95, -16, 3, 0},
- {0, 2, -12, 47, 103, -15, 3, 0},
- {0, 2, -10, 37, 110, -14, 3, 0},
- {0, 2, -8, 27, 116, -11, 2, 0},
- {0, 1, -5, 17, 122, -8, 1, 0},
- {0, 1, -2, 8, 125, -5, 1, 0}
+ { 0, 0, 0, 128, 0, 0, 0, 0},
+ {-3, -1, 32, 64, 38, 1, -3, 0},
+ {-2, -2, 29, 63, 41, 2, -3, 0},
+ {-2, -2, 26, 63, 43, 4, -4, 0},
+ {-2, -3, 24, 62, 46, 5, -4, 0},
+ {-2, -3, 21, 60, 49, 7, -4, 0},
+ {-1, -4, 18, 59, 51, 9, -4, 0},
+ {-1, -4, 16, 57, 53, 12, -4, -1},
+ {-1, -4, 14, 55, 55, 14, -4, -1},
+ {-1, -4, 12, 53, 57, 16, -4, -1},
+ { 0, -4, 9, 51, 59, 18, -4, -1},
+ { 0, -4, 7, 49, 60, 21, -3, -2},
+ { 0, -4, 5, 46, 62, 24, -3, -2},
+ { 0, -4, 4, 43, 63, 26, -2, -2},
+ { 0, -3, 2, 41, 63, 29, -2, -2},
+ { 0, -3, 1, 38, 64, 32, -1, -3}
};
--- a/vp9/common/vp9_findnearmv.c
+++ b/vp9/common/vp9_findnearmv.c
@@ -8,22 +8,14 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
#include <limits.h>
#include "vp9/common/vp9_findnearmv.h"
+#include "vp9/common/vp9_mvref_common.h"
#include "vp9/common/vp9_sadmxn.h"
#include "vp9/common/vp9_subpelvar.h"
-const uint8_t vp9_mbsplit_offset[4][16] = {
- { 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
-};
-
-static void lower_mv_precision(int_mv *mv, int usehp)
-{
+static void lower_mv_precision(int_mv *mv, int usehp) {
if (!usehp || !vp9_use_nmv_hp(&mv->as_mv)) {
if (mv->as_mv.row & 1)
mv->as_mv.row += (mv->as_mv.row > 0 ? -1 : 1);
@@ -32,288 +24,73 @@
}
}
-vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
- vp9_prob p[4], const int context) {
- p[0] = pc->fc.vp9_mode_contexts[context][0];
- p[1] = pc->fc.vp9_mode_contexts[context][1];
- p[2] = pc->fc.vp9_mode_contexts[context][2];
- p[3] = pc->fc.vp9_mode_contexts[context][3];
+vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc, vp9_prob *p, int context) {
+ p[0] = pc->fc.inter_mode_probs[context][0];
+ p[1] = pc->fc.inter_mode_probs[context][1];
+ p[2] = pc->fc.inter_mode_probs[context][2];
return p;
}
-#define SP(x) (((x) & 7) << 1)
-unsigned int vp9_sad3x16_c(const uint8_t *src_ptr,
- int src_stride,
- const uint8_t *ref_ptr,
- int ref_stride) {
- return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 3, 16);
-}
-unsigned int vp9_sad16x3_c(const uint8_t *src_ptr,
- int src_stride,
- const uint8_t *ref_ptr,
- int ref_stride) {
- return sad_mx_n_c(src_ptr, src_stride, ref_ptr, ref_stride, 16, 3);
-}
-
-
-unsigned int vp9_variance2x16_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- int sum;
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 2, 16, sse, &sum);
- return (*sse - (((unsigned int)sum * sum) >> 5));
-}
-
-unsigned int vp9_variance16x2_c(const uint8_t *src_ptr,
- int source_stride,
- const uint8_t *ref_ptr,
- int recon_stride,
- unsigned int *sse) {
- int sum;
- variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 2, sse, &sum);
- return (*sse - (((unsigned int)sum * sum) >> 5));
-}
-
-unsigned int vp9_sub_pixel_variance16x2_c(const uint8_t *src_ptr,
- int source_stride,
- int xoffset,
- int yoffset,
- const uint8_t *ref_ptr,
- int ref_stride,
- unsigned int *sse) {
- uint16_t FData3[16 * 3]; // Temp data buffer used in filtering
- uint8_t temp2[2 * 16];
- const int16_t *HFilter, *VFilter;
-
- HFilter = VP9_BILINEAR_FILTERS_2TAP(xoffset);
- VFilter = VP9_BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, FData3,
- source_stride, 1, 3, 16, HFilter);
- var_filter_block2d_bil_second_pass(FData3, temp2, 16, 16, 2, 16, VFilter);
-
- return vp9_variance16x2_c(temp2, 16, ref_ptr, ref_stride, sse);
-}
-
-unsigned int vp9_sub_pixel_variance2x16_c(const uint8_t *src_ptr,
- int source_stride,
- int xoffset,
- int yoffset,
- const uint8_t *ref_ptr,
- int ref_stride,
- unsigned int *sse) {
- uint16_t FData3[2 * 17]; // Temp data buffer used in filtering
- uint8_t temp2[2 * 16];
- const int16_t *HFilter, *VFilter;
-
- HFilter = VP9_BILINEAR_FILTERS_2TAP(xoffset);
- VFilter = VP9_BILINEAR_FILTERS_2TAP(yoffset);
-
- var_filter_block2d_bil_first_pass(src_ptr, FData3,
- source_stride, 1, 17, 2, HFilter);
- var_filter_block2d_bil_second_pass(FData3, temp2, 2, 2, 16, 2, VFilter);
-
- return vp9_variance2x16_c(temp2, 2, ref_ptr, ref_stride, sse);
-}
-
-#if CONFIG_USESELECTREFMV
-/* check a list of motion vectors by sad score using a number rows of pixels
- * above and a number cols of pixels in the left to select the one with best
- * score to use as ref motion vector
- */
-
void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
- uint8_t *ref_y_buffer,
- int ref_y_stride,
int_mv *mvlist,
int_mv *nearest,
int_mv *near) {
- int i, j;
- uint8_t *above_src;
- uint8_t *above_ref;
-#if !CONFIG_ABOVESPREFMV
- uint8_t *left_src;
- uint8_t *left_ref;
-#endif
- unsigned int score;
- unsigned int sse;
- unsigned int ref_scores[MAX_MV_REF_CANDIDATES] = {0};
- int_mv sorted_mvs[MAX_MV_REF_CANDIDATES];
- int zero_seen = FALSE;
+ int i;
+ // Make sure all the candidates are properly clamped etc
+ for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
+ lower_mv_precision(&mvlist[i], xd->allow_high_precision_mv);
+ clamp_mv2(&mvlist[i], xd);
+ }
+ *nearest = mvlist[0];
+ *near = mvlist[1];
+}
- if (ref_y_buffer) {
+void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
+ int_mv *dst_nearest,
+ int_mv *dst_near,
+ int block_idx, int ref_idx) {
+ int_mv dst_list[MAX_MV_REF_CANDIDATES];
+ int_mv mv_list[MAX_MV_REF_CANDIDATES];
+ MODE_INFO *mi = xd->mode_info_context;
+ MB_MODE_INFO *const mbmi = &mi->mbmi;
- // Default all to 0,0 if nothing else available
- nearest->as_int = near->as_int = 0;
- vpx_memset(sorted_mvs, 0, sizeof(sorted_mvs));
+ assert(ref_idx == 0 || ref_idx == 1);
+ assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier
- above_src = xd->dst.y_buffer - xd->dst.y_stride * 2;
- above_ref = ref_y_buffer - ref_y_stride * 2;
-#if CONFIG_ABOVESPREFMV
- above_src -= 4;
- above_ref -= 4;
-#else
- left_src = xd->dst.y_buffer - 2;
- left_ref = ref_y_buffer - 2;
-#endif
+ vp9_find_mv_refs_idx(cm, xd, xd->mode_info_context,
+ xd->prev_mode_info_context,
+ mbmi->ref_frame[ref_idx],
+ mv_list, cm->ref_frame_sign_bias, block_idx);
- // Limit search to the predicted best few candidates
- for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
- int_mv this_mv;
- int offset = 0;
- int row_offset, col_offset;
+ dst_list[1].as_int = 0;
+ if (block_idx == 0) {
+ memcpy(dst_list, mv_list, MAX_MV_REF_CANDIDATES * sizeof(int_mv));
+ } else if (block_idx == 1 || block_idx == 2) {
+ int dst = 0, n;
+ union b_mode_info *bmi = mi->bmi;
- this_mv.as_int = mvlist[i].as_int;
-
- // If we see a 0,0 vector for a second time we have reached the end of
- // the list of valid candidate vectors.
- if (!this_mv.as_int && zero_seen)
- break;
-
- zero_seen = zero_seen || !this_mv.as_int;
-
-#if !CONFIG_ABOVESPREFMV
- clamp_mv(&this_mv,
- xd->mb_to_left_edge - LEFT_TOP_MARGIN + 24,
- xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
- xd->mb_to_top_edge - LEFT_TOP_MARGIN + 24,
- xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
-#else
- clamp_mv(&this_mv,
- xd->mb_to_left_edge - LEFT_TOP_MARGIN + 32,
- xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
- xd->mb_to_top_edge - LEFT_TOP_MARGIN + 24,
- xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
-#endif
-
- row_offset = this_mv.as_mv.row >> 3;
- col_offset = this_mv.as_mv.col >> 3;
- offset = ref_y_stride * row_offset + col_offset;
- score = 0;
-#if !CONFIG_ABOVESPREFMV
- if (xd->up_available) {
-#else
- if (xd->up_available && xd->left_available) {
-#endif
- vp9_sub_pixel_variance16x2(above_ref + offset, ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- above_src, xd->dst.y_stride, &sse);
- score += sse;
- if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB32X32) {
- vp9_sub_pixel_variance16x2(above_ref + offset + 16,
- ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- above_src + 16, xd->dst.y_stride, &sse);
- score += sse;
- }
- if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB64X64) {
- vp9_sub_pixel_variance16x2(above_ref + offset + 32,
- ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- above_src + 32, xd->dst.y_stride, &sse);
- score += sse;
- vp9_sub_pixel_variance16x2(above_ref + offset + 48,
- ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- above_src + 48, xd->dst.y_stride, &sse);
- score += sse;
- }
- }
-#if !CONFIG_ABOVESPREFMV
- if (xd->left_available) {
- vp9_sub_pixel_variance2x16_c(left_ref + offset, ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- left_src, xd->dst.y_stride, &sse);
- score += sse;
- if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB32X32) {
- vp9_sub_pixel_variance2x16_c(left_ref + offset + ref_y_stride * 16,
- ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- left_src + xd->dst.y_stride * 16,
- xd->dst.y_stride, &sse);
- score += sse;
- }
- if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB64X64) {
- vp9_sub_pixel_variance2x16_c(left_ref + offset + ref_y_stride * 32,
- ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- left_src + xd->dst.y_stride * 32,
- xd->dst.y_stride, &sse);
- score += sse;
- vp9_sub_pixel_variance2x16_c(left_ref + offset + ref_y_stride * 48,
- ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- left_src + xd->dst.y_stride * 48,
- xd->dst.y_stride, &sse);
- score += sse;
- }
- }
-#endif
- // Add the entry to our list and then resort the list on score.
- ref_scores[i] = score;
- sorted_mvs[i].as_int = this_mv.as_int;
- j = i;
- while (j > 0) {
- if (ref_scores[j] < ref_scores[j-1]) {
- ref_scores[j] = ref_scores[j-1];
- sorted_mvs[j].as_int = sorted_mvs[j-1].as_int;
- ref_scores[j-1] = score;
- sorted_mvs[j-1].as_int = this_mv.as_int;
- j--;
- } else {
- break;
- }
- }
- }
+ dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int;
+ for (n = 0; dst < MAX_MV_REF_CANDIDATES &&
+ n < MAX_MV_REF_CANDIDATES; n++)
+ if (mv_list[n].as_int != dst_list[0].as_int)
+ dst_list[dst++].as_int = mv_list[n].as_int;
} else {
- vpx_memcpy(sorted_mvs, mvlist, sizeof(sorted_mvs));
- }
+ int dst = 0, n;
+ union b_mode_info *bmi = mi->bmi;
- // Make sure all the candidates are properly clamped etc
- for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
- lower_mv_precision(&sorted_mvs[i], xd->allow_high_precision_mv);
- clamp_mv2(&sorted_mvs[i], xd);
+ assert(block_idx == 3);
+ dst_list[dst++].as_int = bmi[2].as_mv[ref_idx].as_int;
+ if (dst_list[0].as_int != bmi[1].as_mv[ref_idx].as_int)
+ dst_list[dst++].as_int = bmi[1].as_mv[ref_idx].as_int;
+ if (dst < MAX_MV_REF_CANDIDATES &&
+ dst_list[0].as_int != bmi[0].as_mv[ref_idx].as_int)
+ dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int;
+ for (n = 0; dst < MAX_MV_REF_CANDIDATES &&
+ n < MAX_MV_REF_CANDIDATES; n++)
+ if (mv_list[n].as_int != dst_list[0].as_int)
+ dst_list[dst++].as_int = mv_list[n].as_int;
}
- // Nearest may be a 0,0 or non zero vector and now matches the chosen
- // "best reference". This has advantages when it is used as part of a
- // compound predictor as it means a non zero vector can be paired using
- // this mode with a 0 vector. The Near vector is still forced to be a
- // non zero candidate if one is avaialble.
- nearest->as_int = sorted_mvs[0].as_int;
- if ( sorted_mvs[1].as_int ) {
- near->as_int = sorted_mvs[1].as_int;
- } else {
- near->as_int = sorted_mvs[2].as_int;
- }
-
- // Copy back the re-ordered mv list
- vpx_memcpy(mvlist, sorted_mvs, sizeof(sorted_mvs));
+ dst_nearest->as_int = dst_list[0].as_int;
+ dst_near->as_int = dst_list[1].as_int;
}
-#else
-void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
- uint8_t *ref_y_buffer,
- int ref_y_stride,
- int_mv *mvlist,
- int_mv *nearest,
- int_mv *near) {
- int i;
- // Make sure all the candidates are properly clamped etc
- for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
- lower_mv_precision(&mvlist[i], xd->allow_high_precision_mv);
- clamp_mv2(&mvlist[i], xd);
- }
- *nearest = mvlist[0];
- *near = mvlist[1];
-}
-#endif
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -17,16 +17,13 @@
#include "vp9/common/vp9_treecoder.h"
#include "vp9/common/vp9_onyxc_int.h"
-#define LEFT_TOP_MARGIN (16 << 3)
-#define RIGHT_BOTTOM_MARGIN (16 << 3)
+#define LEFT_TOP_MARGIN ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3)
+#define RIGHT_BOTTOM_MARGIN ((VP9BORDERINPIXELS - VP9_INTERP_EXTEND) << 3)
-/* check a list of motion vectors by sad score using a number rows of pixels
- * above and a number cols of pixels in the left to select the one with best
- * score to use as ref motion vector
- */
+// check a list of motion vectors by sad score using a number rows of pixels
+// above and a number cols of pixels in the left to select the one with best
+// score to use as ref motion vector
void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
- uint8_t *ref_y_buffer,
- int ref_y_stride,
int_mv *mvlist,
int_mv *nearest,
int_mv *near);
@@ -43,35 +40,30 @@
mvp->as_mv = xmv;
}
-
+// TODO(jingning): this mv clamping function should be block size dependent.
static void clamp_mv(int_mv *mv,
int mb_to_left_edge,
int mb_to_right_edge,
int mb_to_top_edge,
int mb_to_bottom_edge) {
- mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ?
- mb_to_left_edge : mv->as_mv.col;
- mv->as_mv.col = (mv->as_mv.col > mb_to_right_edge) ?
- mb_to_right_edge : mv->as_mv.col;
- mv->as_mv.row = (mv->as_mv.row < mb_to_top_edge) ?
- mb_to_top_edge : mv->as_mv.row;
- mv->as_mv.row = (mv->as_mv.row > mb_to_bottom_edge) ?
- mb_to_bottom_edge : mv->as_mv.row;
+ mv->as_mv.col = clamp(mv->as_mv.col, mb_to_left_edge, mb_to_right_edge);
+ mv->as_mv.row = clamp(mv->as_mv.row, mb_to_top_edge, mb_to_bottom_edge);
}
-static void clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
+static int clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) {
+ int_mv tmp_mv;
+ tmp_mv.as_int = mv->as_int;
clamp_mv(mv,
xd->mb_to_left_edge - LEFT_TOP_MARGIN,
xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
xd->mb_to_top_edge - LEFT_TOP_MARGIN,
xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
+ return tmp_mv.as_int != mv->as_int;
}
-static unsigned int check_mv_bounds(int_mv *mv,
- int mb_to_left_edge,
- int mb_to_right_edge,
- int mb_to_top_edge,
- int mb_to_bottom_edge) {
+static int check_mv_bounds(int_mv *mv,
+ int mb_to_left_edge, int mb_to_right_edge,
+ int mb_to_top_edge, int mb_to_bottom_edge) {
return mv->as_mv.col < mb_to_left_edge ||
mv->as_mv.col > mb_to_right_edge ||
mv->as_mv.row < mb_to_top_edge ||
@@ -79,116 +71,50 @@
}
vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
- vp9_prob p[VP9_MVREFS - 1],
+ vp9_prob p[VP9_INTER_MODES - 1],
const int context);
-extern const uint8_t vp9_mbsplit_offset[4][16];
+void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *pc,
+ MACROBLOCKD *xd,
+ int_mv *dst_nearest,
+ int_mv *dst_near,
+ int block_idx, int ref_idx);
-static int left_block_mv(const MACROBLOCKD *xd,
- const MODE_INFO *cur_mb, int b) {
- if (!(b & 3)) {
- if (!xd->left_available)
- return 0;
-
- // On L edge, get from MB to left of us
- --cur_mb;
-
- if (cur_mb->mbmi.mode != SPLITMV)
- return cur_mb->mbmi.mv[0].as_int;
-
- b += 4;
- }
-
- return (cur_mb->bmi + b - 1)->as_mv[0].as_int;
-}
-
-static int left_block_second_mv(const MACROBLOCKD *xd,
- const MODE_INFO *cur_mb, int b) {
- if (!(b & 3)) {
- if (!xd->left_available)
- return 0;
-
+static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
+ // FIXME(rbultje, jingning): temporary hack because jenkins doesn't
+ // understand this condition. This will go away soon.
+ if (b == 0 || b == 2) {
/* On L edge, get from MB to left of us */
--cur_mb;
- if (cur_mb->mbmi.mode != SPLITMV)
- return cur_mb->mbmi.second_ref_frame > 0 ?
- cur_mb->mbmi.mv[1].as_int : cur_mb->mbmi.mv[0].as_int;
- b += 4;
- }
-
- return cur_mb->mbmi.second_ref_frame > 0 ?
- (cur_mb->bmi + b - 1)->as_mv[1].as_int :
- (cur_mb->bmi + b - 1)->as_mv[0].as_int;
-}
-
-static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
- if (!(b >> 2)) {
- /* On top edge, get from MB above us */
- cur_mb -= mi_stride;
-
- if (cur_mb->mbmi.mode != SPLITMV)
- return cur_mb->mbmi.mv[0].as_int;
- b += 16;
- }
-
- return (cur_mb->bmi + b - 4)->as_mv[0].as_int;
-}
-
-static int above_block_second_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
- if (!(b >> 2)) {
- /* On top edge, get from MB above us */
- cur_mb -= mi_stride;
-
- if (cur_mb->mbmi.mode != SPLITMV)
- return cur_mb->mbmi.second_ref_frame > 0 ?
- cur_mb->mbmi.mv[1].as_int : cur_mb->mbmi.mv[0].as_int;
- b += 16;
- }
-
- return cur_mb->mbmi.second_ref_frame > 0 ?
- (cur_mb->bmi + b - 4)->as_mv[1].as_int :
- (cur_mb->bmi + b - 4)->as_mv[0].as_int;
-}
-
-static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
- if (!(b & 3)) {
- /* On L edge, get from MB to left of us */
- --cur_mb;
-
- if (cur_mb->mbmi.mode < I8X8_PRED) {
- return pred_mode_conv(cur_mb->mbmi.mode);
- } else if (cur_mb->mbmi.mode == I8X8_PRED) {
- return pred_mode_conv(
- (MB_PREDICTION_MODE)(cur_mb->bmi + 3 + b)->as_mode.first);
- } else if (cur_mb->mbmi.mode == B_PRED) {
- return ((cur_mb->bmi + 3 + b)->as_mode.first);
+ if (cur_mb->mbmi.ref_frame[0] != INTRA_FRAME) {
+ return DC_PRED;
+ } else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
+ return ((cur_mb->bmi + 1 + b)->as_mode.first);
} else {
- return B_DC_PRED;
+ return cur_mb->mbmi.mode;
}
}
+ assert(b == 1 || b == 3);
return (cur_mb->bmi + b - 1)->as_mode.first;
}
-static B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
+static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
int b, int mi_stride) {
- if (!(b >> 2)) {
+ if (!(b >> 1)) {
/* On top edge, get from MB above us */
cur_mb -= mi_stride;
- if (cur_mb->mbmi.mode < I8X8_PRED) {
- return pred_mode_conv(cur_mb->mbmi.mode);
- } else if (cur_mb->mbmi.mode == I8X8_PRED) {
- return pred_mode_conv(
- (MB_PREDICTION_MODE)(cur_mb->bmi + 12 + b)->as_mode.first);
- } else if (cur_mb->mbmi.mode == B_PRED) {
- return ((cur_mb->bmi + 12 + b)->as_mode.first);
+ if (cur_mb->mbmi.ref_frame[0] != INTRA_FRAME) {
+ return DC_PRED;
+ } else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
+ return ((cur_mb->bmi + 2 + b)->as_mode.first);
} else {
- return B_DC_PRED;
+ return cur_mb->mbmi.mode;
}
}
- return (cur_mb->bmi + b - 4)->as_mode.first;
+ return (cur_mb->bmi + b - 2)->as_mode.first;
}
#endif // VP9_COMMON_VP9_FINDNEARMV_H_
--- a/vp9/common/vp9_header.h
+++ /dev/null
@@ -1,40 +1,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_HEADER_H_
-#define VP9_COMMON_VP9_HEADER_H_
-
-/* 24 bits total */
-typedef struct {
- unsigned int type: 1;
- unsigned int version: 3;
- unsigned int show_frame: 1;
-
- /* Allow 2^20 bytes = 8 megabits for first partition */
-
- unsigned int first_partition_length_in_bytes: 19;
-
-#ifdef PACKET_TESTING
- unsigned int frame_number;
- unsigned int update_gold: 1;
- unsigned int uses_gold: 1;
- unsigned int update_last: 1;
- unsigned int uses_last: 1;
-#endif
-
-} VP9_HEADER;
-
-#ifdef PACKET_TESTING
-#define VP9_HEADER_SIZE 8
-#else
-#define VP9_HEADER_SIZE 3
-#endif
-
-#endif // VP9_COMMON_VP9_HEADER_H_
--- a/vp9/common/vp9_idct.c
+++ b/vp9/common/vp9_idct.c
@@ -18,84 +18,84 @@
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_idct.h"
-void vp9_short_iwalsh4x4_c(int16_t *input, int16_t *output, int pitch) {
+void vp9_short_iwalsh4x4_add_c(int16_t *input, uint8_t *dest, int dest_stride) {
+/* 4-point reversible, orthonormal inverse Walsh-Hadamard in 3.5 adds,
+ 0.5 shifts per pixel. */
int i;
- int a1, b1, c1, d1;
+ int16_t output[16];
+ int a1, b1, c1, d1, e1;
int16_t *ip = input;
int16_t *op = output;
- const int half_pitch = pitch >> 1;
for (i = 0; i < 4; i++) {
- a1 = (ip[0] + ip[3]) >> WHT_UPSCALE_FACTOR;
- b1 = (ip[1] + ip[2]) >> WHT_UPSCALE_FACTOR;
- c1 = (ip[1] - ip[2]) >> WHT_UPSCALE_FACTOR;
- d1 = (ip[0] - ip[3]) >> WHT_UPSCALE_FACTOR;
-
- op[0] = (a1 + b1 + 1) >> 1;
- op[1] = (c1 + d1) >> 1;
- op[2] = (a1 - b1) >> 1;
- op[3] = (d1 - c1) >> 1;
-
+ a1 = ip[0] >> WHT_UPSCALE_FACTOR;
+ c1 = ip[1] >> WHT_UPSCALE_FACTOR;
+ d1 = ip[2] >> WHT_UPSCALE_FACTOR;
+ b1 = ip[3] >> WHT_UPSCALE_FACTOR;
+ a1 += c1;
+ d1 -= b1;
+ e1 = (a1 - d1) >> 1;
+ b1 = e1 - b1;
+ c1 = e1 - c1;
+ a1 -= b1;
+ d1 += c1;
+ op[0] = a1;
+ op[1] = b1;
+ op[2] = c1;
+ op[3] = d1;
ip += 4;
- op += half_pitch;
+ op += 4;
}
ip = output;
- op = output;
for (i = 0; i < 4; i++) {
- a1 = ip[half_pitch * 0] + ip[half_pitch * 3];
- b1 = ip[half_pitch * 1] + ip[half_pitch * 2];
- c1 = ip[half_pitch * 1] - ip[half_pitch * 2];
- d1 = ip[half_pitch * 0] - ip[half_pitch * 3];
+ a1 = ip[4 * 0];
+ c1 = ip[4 * 1];
+ d1 = ip[4 * 2];
+ b1 = ip[4 * 3];
+ a1 += c1;
+ d1 -= b1;
+ e1 = (a1 - d1) >> 1;
+ b1 = e1 - b1;
+ c1 = e1 - c1;
+ a1 -= b1;
+ d1 += c1;
+ dest[dest_stride * 0] = clip_pixel(dest[dest_stride * 0] + a1);
+ dest[dest_stride * 1] = clip_pixel(dest[dest_stride * 1] + b1);
+ dest[dest_stride * 2] = clip_pixel(dest[dest_stride * 2] + c1);
+ dest[dest_stride * 3] = clip_pixel(dest[dest_stride * 3] + d1);
-
- op[half_pitch * 0] = (a1 + b1 + 1) >> 1;
- op[half_pitch * 1] = (c1 + d1) >> 1;
- op[half_pitch * 2] = (a1 - b1) >> 1;
- op[half_pitch * 3] = (d1 - c1) >> 1;
-
ip++;
- op++;
+ dest++;
}
}
-void vp9_short_iwalsh4x4_1_c(int16_t *in, int16_t *out, int pitch) {
+void vp9_short_iwalsh4x4_1_add_c(int16_t *in, uint8_t *dest, int dest_stride) {
int i;
+ int a1, e1;
int16_t tmp[4];
int16_t *ip = in;
int16_t *op = tmp;
- const int half_pitch = pitch >> 1;
- op[0] = ((ip[0] >> WHT_UPSCALE_FACTOR) + 1) >> 1;
- op[1] = op[2] = op[3] = (ip[0] >> WHT_UPSCALE_FACTOR) >> 1;
+ a1 = ip[0] >> WHT_UPSCALE_FACTOR;
+ e1 = a1 >> 1;
+ a1 -= e1;
+ op[0] = a1;
+ op[1] = op[2] = op[3] = e1;
ip = tmp;
- op = out;
for (i = 0; i < 4; i++) {
- op[half_pitch * 0] = (ip[0] + 1) >> 1;
- op[half_pitch * 1] = op[half_pitch * 2] = op[half_pitch * 3] = ip[0] >> 1;
+ e1 = ip[0] >> 1;
+ a1 = ip[0] - e1;
+ dest[dest_stride * 0] = clip_pixel(dest[dest_stride * 0] + a1);
+ dest[dest_stride * 1] = clip_pixel(dest[dest_stride * 1] + e1);
+ dest[dest_stride * 2] = clip_pixel(dest[dest_stride * 2] + e1);
+ dest[dest_stride * 3] = clip_pixel(dest[dest_stride * 3] + e1);
ip++;
- op++;
+ dest++;
}
}
-void vp9_dc_only_inv_walsh_add_c(int input_dc, uint8_t *pred_ptr,
- uint8_t *dst_ptr,
- int pitch, int stride) {
- int r, c;
- int16_t dc = input_dc;
- int16_t tmp[4 * 4];
- vp9_short_iwalsh4x4_1_c(&dc, tmp, 4 << 1);
-
- for (r = 0; r < 4; r++) {
- for (c = 0; c < 4; c++)
- dst_ptr[c] = clip_pixel(tmp[r * 4 + c] + pred_ptr[c]);
-
- dst_ptr += stride;
- pred_ptr += pitch;
- }
-}
-
void vp9_idct4_1d_c(int16_t *input, int16_t *output) {
int16_t step[4];
int temp1, temp2;
@@ -116,10 +116,9 @@
output[3] = step[0] - step[3];
}
-void vp9_short_idct4x4_c(int16_t *input, int16_t *output, int pitch) {
+void vp9_short_idct4x4_add_c(int16_t *input, uint8_t *dest, int dest_stride) {
int16_t out[4 * 4];
int16_t *outptr = out;
- const int half_pitch = pitch >> 1;
int i, j;
int16_t temp_in[4], temp_out[4];
@@ -138,22 +137,24 @@
temp_in[j] = out[j * 4 + i];
vp9_idct4_1d(temp_in, temp_out);
for (j = 0; j < 4; ++j)
- output[j * half_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 4);
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 4)
+ + dest[j * dest_stride + i]);
}
}
-void vp9_short_idct4x4_1_c(int16_t *input, int16_t *output, int pitch) {
+void vp9_short_idct4x4_1_add_c(int16_t *input, uint8_t *dest, int dest_stride) {
int i;
int a1;
- int16_t *op = output;
- const int half_pitch = pitch >> 1;
int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
out = dct_const_round_shift(out * cospi_16_64);
a1 = ROUND_POWER_OF_TWO(out, 4);
for (i = 0; i < 4; i++) {
- op[0] = op[1] = op[2] = op[3] = a1;
- op += half_pitch;
+ dest[0] = clip_pixel(dest[0] + a1);
+ dest[1] = clip_pixel(dest[1] + a1);
+ dest[2] = clip_pixel(dest[2] + a1);
+ dest[3] = clip_pixel(dest[3] + a1);
+ dest += dest_stride;
}
}
@@ -219,14 +220,13 @@
output[7] = step1[0] - step1[7];
}
-void vp9_short_idct8x8_c(int16_t *input, int16_t *output, int pitch) {
+void vp9_short_idct8x8_add_c(int16_t *input, uint8_t *dest, int dest_stride) {
int16_t out[8 * 8];
int16_t *outptr = out;
- const int half_pitch = pitch >> 1;
int i, j;
int16_t temp_in[8], temp_out[8];
- // Rows
+ // First transform rows
for (i = 0; i < 8; ++i) {
idct8_1d(input, outptr);
input += 8;
@@ -233,13 +233,14 @@
outptr += 8;
}
- // Columns
+ // Then transform columns
for (i = 0; i < 8; ++i) {
for (j = 0; j < 8; ++j)
temp_in[j] = out[j * 8 + i];
idct8_1d(temp_in, temp_out);
for (j = 0; j < 8; ++j)
- output[j * half_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 5);
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
+ + dest[j * dest_stride + i]);
}
}
@@ -285,8 +286,8 @@
output[3] = dct_const_round_shift(s3);
}
-void vp9_short_iht4x4_c(int16_t *input, int16_t *output,
- int pitch, int tx_type) {
+void vp9_short_iht4x4_add_c(int16_t *input, uint8_t *dest, int dest_stride,
+ int tx_type) {
const transform_2d IHT_4[] = {
{ vp9_idct4_1d, vp9_idct4_1d }, // DCT_DCT = 0
{ iadst4_1d, vp9_idct4_1d }, // ADST_DCT = 1
@@ -312,10 +313,10 @@
temp_in[j] = out[j * 4 + i];
IHT_4[tx_type].cols(temp_in, temp_out);
for (j = 0; j < 4; ++j)
- output[j * pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 4);
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 4)
+ + dest[j * dest_stride + i]);
}
}
-
static void iadst8_1d(int16_t *input, int16_t *output) {
int s0, s1, s2, s3, s4, s5, s6, s7;
@@ -400,8 +401,8 @@
{ iadst8_1d, iadst8_1d } // ADST_ADST = 3
};
-void vp9_short_iht8x8_c(int16_t *input, int16_t *output,
- int pitch, int tx_type) {
+void vp9_short_iht8x8_add_c(int16_t *input, uint8_t *dest, int dest_stride,
+ int tx_type) {
int i, j;
int16_t out[8 * 8];
int16_t *outptr = out;
@@ -421,14 +422,14 @@
temp_in[j] = out[j * 8 + i];
ht.cols(temp_in, temp_out);
for (j = 0; j < 8; ++j)
- output[j * pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 5);
- }
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
+ + dest[j * dest_stride + i]); }
}
-void vp9_short_idct10_8x8_c(int16_t *input, int16_t *output, int pitch) {
+void vp9_short_idct10_8x8_add_c(int16_t *input, uint8_t *dest,
+ int dest_stride) {
int16_t out[8 * 8];
int16_t *outptr = out;
- const int half_pitch = pitch >> 1;
int i, j;
int16_t temp_in[8], temp_out[8];
@@ -447,7 +448,8 @@
temp_in[j] = out[j * 8 + i];
idct8_1d(temp_in, temp_out);
for (j = 0; j < 8; ++j)
- output[j * half_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 5);
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 5)
+ + dest[j * dest_stride + i]);
}
}
@@ -621,10 +623,9 @@
output[15] = step2[0] - step2[15];
}
-void vp9_short_idct16x16_c(int16_t *input, int16_t *output, int pitch) {
+void vp9_short_idct16x16_add_c(int16_t *input, uint8_t *dest, int dest_stride) {
int16_t out[16 * 16];
int16_t *outptr = out;
- const int half_pitch = pitch >> 1;
int i, j;
int16_t temp_in[16], temp_out[16];
@@ -641,7 +642,8 @@
temp_in[j] = out[j * 16 + i];
idct16_1d(temp_in, temp_out);
for (j = 0; j < 16; ++j)
- output[j * half_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 6);
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
+ + dest[j * dest_stride + i]);
}
}
@@ -823,8 +825,8 @@
{ iadst16_1d, iadst16_1d } // ADST_ADST = 3
};
-void vp9_short_iht16x16_c(int16_t *input, int16_t *output,
- int pitch, int tx_type) {
+void vp9_short_iht16x16_add_c(int16_t *input, uint8_t *dest, int dest_stride,
+ int tx_type) {
int i, j;
int16_t out[16 * 16];
int16_t *outptr = out;
@@ -844,38 +846,38 @@
temp_in[j] = out[j * 16 + i];
ht.cols(temp_in, temp_out);
for (j = 0; j < 16; ++j)
- output[j * pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 6);
- }
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
+ + dest[j * dest_stride + i]); }
}
-void vp9_short_idct10_16x16_c(int16_t *input, int16_t *output, int pitch) {
- int16_t out[16 * 16];
- int16_t *outptr = out;
- const int half_pitch = pitch >> 1;
- int i, j;
- int16_t temp_in[16], temp_out[16];
+void vp9_short_idct10_16x16_add_c(int16_t *input, uint8_t *dest,
+ int dest_stride) {
+ int16_t out[16 * 16];
+ int16_t *outptr = out;
+ int i, j;
+ int16_t temp_in[16], temp_out[16];
- /* First transform rows. Since all non-zero dct coefficients are in
- * upper-left 4x4 area, we only need to calculate first 4 rows here.
- */
- vpx_memset(out, 0, sizeof(out));
- for (i = 0; i < 4; ++i) {
- idct16_1d(input, outptr);
- input += 16;
- outptr += 16;
- }
+ /* First transform rows. Since all non-zero dct coefficients are in
+ * upper-left 4x4 area, we only need to calculate first 4 rows here.
+ */
+ vpx_memset(out, 0, sizeof(out));
+ for (i = 0; i < 4; ++i) {
+ idct16_1d(input, outptr);
+ input += 16;
+ outptr += 16;
+ }
- // Then transform columns
- for (i = 0; i < 16; ++i) {
- for (j = 0; j < 16; ++j)
- temp_in[j] = out[j*16 + i];
- idct16_1d(temp_in, temp_out);
- for (j = 0; j < 16; ++j)
- output[j * half_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 6);
- }
+ // Then transform columns
+ for (i = 0; i < 16; ++i) {
+ for (j = 0; j < 16; ++j)
+ temp_in[j] = out[j*16 + i];
+ idct16_1d(temp_in, temp_out);
+ for (j = 0; j < 16; ++j)
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
+ + dest[j * dest_stride + i]);
+ }
}
-
void vp9_short_idct1_16x16_c(int16_t *input, int16_t *output) {
int16_t out = dct_const_round_shift(input[0] * cospi_16_64);
out = dct_const_round_shift(out * cospi_16_64);
@@ -1249,10 +1251,9 @@
output[31] = step1[0] - step1[31];
}
-void vp9_short_idct32x32_c(int16_t *input, int16_t *output, int pitch) {
+void vp9_short_idct32x32_add_c(int16_t *input, uint8_t *dest, int dest_stride) {
int16_t out[32 * 32];
int16_t *outptr = out;
- const int half_pitch = pitch >> 1;
int i, j;
int16_t temp_in[32], temp_out[32];
@@ -1269,7 +1270,8 @@
temp_in[j] = out[j * 32 + i];
idct32_1d(temp_in, temp_out);
for (j = 0; j < 32; ++j)
- output[j * half_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 6);
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
+ + dest[j * dest_stride + i]);
}
}
@@ -1279,10 +1281,10 @@
output[0] = ROUND_POWER_OF_TWO(out, 6);
}
-void vp9_short_idct10_32x32_c(int16_t *input, int16_t *output, int pitch) {
+void vp9_short_idct10_32x32_add_c(int16_t *input, uint8_t *dest,
+ int dest_stride) {
int16_t out[32 * 32];
int16_t *outptr = out;
- const int half_pitch = pitch >> 1;
int i, j;
int16_t temp_in[32], temp_out[32];
@@ -1302,6 +1304,7 @@
temp_in[j] = out[j * 32 + i];
idct32_1d(temp_in, temp_out);
for (j = 0; j < 32; ++j)
- output[j * half_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 6);
+ dest[j * dest_stride + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6)
+ + dest[j * dest_stride + i]);
}
}
--- a/vp9/common/vp9_idct.h
+++ b/vp9/common/vp9_idct.h
@@ -17,6 +17,7 @@
#include "vpx/vpx_integer.h"
#include "vp9/common/vp9_common.h"
+
// Constants and Macros used by all idct/dct functions
#define DCT_CONST_BITS 14
#define DCT_CONST_ROUNDING (1 << (DCT_CONST_BITS - 1))
--- a/vp9/common/vp9_implicit_segmentation.c
+++ b/vp9/common/vp9_implicit_segmentation.c
@@ -140,11 +140,11 @@
break;
case SEGMENT_MV:
n = mi[mb_index].mbmi.mv[0].as_int;
- if (mi[mb_index].mbmi.ref_frame == INTRA_FRAME)
+ if (mi[mb_index].mbmi.ref_frame[0] == INTRA_FRAME)
n = -9999999;
break;
case SEGMENT_REFFRAME:
- n = mi[mb_index].mbmi.ref_frame;
+ n = mi[mb_index].mbmi.ref_frame[0];
break;
case SEGMENT_SKIPPED:
n = mi[mb_index].mbmi.mb_skip_coeff;
@@ -191,11 +191,12 @@
// give new labels to regions
for (i = 1; i < label; i++)
- if (labels[i].next->count > min_mbs_in_region && labels[labels[i].next->label].label == 0) {
+ if (labels[i].next->count > min_mbs_in_region &&
+ labels[labels[i].next->label].label == 0) {
segment_info *cs = &segments[label_count];
cs->label = label_count;
labels[labels[i].next->label].label = label_count++;
- labels[labels[i].next->label].seg_value = labels[i].next->seg_value;
+ labels[labels[i].next->label].seg_value = labels[i].next->seg_value;
cs->seg_value = labels[labels[i].next->label].seg_value;
cs->min_x = oci->mb_cols;
cs->min_y = oci->mb_rows;
@@ -204,24 +205,21 @@
cs->sum_x = 0;
cs->sum_y = 0;
cs->pixels = 0;
-
}
+
lp = labeling;
// this is just to gather stats...
for (i = 0; i < oci->mb_rows; i++, lp += pitch) {
for (j = 0; j < oci->mb_cols; j++) {
- segment_info *cs;
- int oldlab = labels[lp[j]].next->label;
- int lab = labels[oldlab].label;
- lp[j] = lab;
+ const int old_lab = labels[lp[j]].next->label;
+ const int lab = labels[old_lab].label;
+ segment_info *cs = &segments[lab];
- cs = &segments[lab];
-
- cs->min_x = (j < cs->min_x ? j : cs->min_x);
- cs->max_x = (j > cs->max_x ? j : cs->max_x);
- cs->min_y = (i < cs->min_y ? i : cs->min_y);
- cs->max_y = (i > cs->max_y ? i : cs->max_y);
+ cs->min_x = MIN(cs->min_x, j);
+ cs->max_x = MAX(cs->max_x, j);
+ cs->min_y = MIN(cs->min_y, i);
+ cs->max_y = MAX(cs->max_y, i);
cs->sum_x += j;
cs->sum_y += i;
cs->pixels++;
--- a/vp9/common/vp9_invtrans.c
+++ b/vp9/common/vp9_invtrans.c
@@ -11,311 +11,10 @@
#include "vp9/common/vp9_invtrans.h"
#include "./vp9_rtcd.h"
-void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int eob,
- int16_t *dqcoeff, int16_t *diff,
- int pitch) {
+void vp9_inverse_transform_b_4x4_add(MACROBLOCKD *xd, int eob, int16_t *dqcoeff,
+ uint8_t *dest, int stride) {
if (eob <= 1)
- xd->inv_txm4x4_1(dqcoeff, diff, pitch);
+ xd->inv_txm4x4_1_add(dqcoeff, dest, stride);
else
- xd->inv_txm4x4(dqcoeff, diff, pitch);
-}
-
-void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) {
- int i;
-
- for (i = 0; i < 16; i++) {
- TX_TYPE tx_type = get_tx_type_4x4(xd, i);
- if (tx_type != DCT_DCT) {
- vp9_short_iht4x4(xd->block[i].dqcoeff, xd->block[i].diff, 16, tx_type);
- } else {
- vp9_inverse_transform_b_4x4(xd, xd->eobs[i], xd->block[i].dqcoeff,
- xd->block[i].diff, 32);
- }
- }
-}
-
-void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd) {
- int i;
-
- for (i = 16; i < 24; i++) {
- vp9_inverse_transform_b_4x4(xd, xd->eobs[i], xd->block[i].dqcoeff,
- xd->block[i].diff, 16);
- }
-}
-
-void vp9_inverse_transform_mb_4x4(MACROBLOCKD *xd) {
- vp9_inverse_transform_mby_4x4(xd);
- vp9_inverse_transform_mbuv_4x4(xd);
-}
-
-void vp9_inverse_transform_b_8x8(int16_t *input_dqcoeff, int16_t *output_coeff,
- int pitch) {
- vp9_short_idct8x8(input_dqcoeff, output_coeff, pitch);
-}
-
-void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) {
- int i;
- BLOCKD *blockd = xd->block;
-
- for (i = 0; i < 9; i += 8) {
- TX_TYPE tx_type = get_tx_type_8x8(xd, i);
- if (tx_type != DCT_DCT) {
- vp9_short_iht8x8(xd->block[i].dqcoeff, xd->block[i].diff, 16, tx_type);
- } else {
- vp9_inverse_transform_b_8x8(&blockd[i].dqcoeff[0],
- &blockd[i].diff[0], 32);
- }
- }
- for (i = 2; i < 11; i += 8) {
- TX_TYPE tx_type = get_tx_type_8x8(xd, i);
- if (tx_type != DCT_DCT) {
- vp9_short_iht8x8(xd->block[i + 2].dqcoeff, xd->block[i].diff,
- 16, tx_type);
- } else {
- vp9_inverse_transform_b_8x8(&blockd[i + 2].dqcoeff[0],
- &blockd[i].diff[0], 32);
- }
- }
-}
-
-void vp9_inverse_transform_mbuv_8x8(MACROBLOCKD *xd) {
- int i;
- BLOCKD *blockd = xd->block;
-
- for (i = 16; i < 24; i += 4) {
- vp9_inverse_transform_b_8x8(&blockd[i].dqcoeff[0],
- &blockd[i].diff[0], 16);
- }
-}
-
-void vp9_inverse_transform_mb_8x8(MACROBLOCKD *xd) {
- vp9_inverse_transform_mby_8x8(xd);
- vp9_inverse_transform_mbuv_8x8(xd);
-}
-
-void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
- int16_t *output_coeff, int pitch) {
- vp9_short_idct16x16(input_dqcoeff, output_coeff, pitch);
-}
-
-void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd) {
- BLOCKD *bd = &xd->block[0];
- TX_TYPE tx_type = get_tx_type_16x16(xd, 0);
- if (tx_type != DCT_DCT) {
- vp9_short_iht16x16(bd->dqcoeff, bd->diff, 16, tx_type);
- } else {
- vp9_inverse_transform_b_16x16(&xd->block[0].dqcoeff[0],
- &xd->block[0].diff[0], 32);
- }
-}
-
-void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd) {
- vp9_inverse_transform_mby_16x16(xd);
- vp9_inverse_transform_mbuv_8x8(xd);
-}
-
-void vp9_inverse_transform_sby_32x32(MACROBLOCKD *xd) {
- vp9_short_idct32x32(xd->dqcoeff, xd->diff, 64);
-}
-
-void vp9_inverse_transform_sby_16x16(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 4; n++) {
- const int x_idx = n & 1, y_idx = n >> 1;
- const TX_TYPE tx_type = get_tx_type_16x16(xd, (y_idx * 8 + x_idx) * 4);
-
- if (tx_type == DCT_DCT) {
- vp9_inverse_transform_b_16x16(xd->dqcoeff + n * 256,
- xd->diff + x_idx * 16 + y_idx * 32 * 16,
- 64);
- } else {
- vp9_short_iht16x16(xd->dqcoeff + n * 256,
- xd->diff + x_idx * 16 + y_idx * 32 * 16, 32, tx_type);
- }
- }
-}
-
-void vp9_inverse_transform_sby_8x8(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 16; n++) {
- const int x_idx = n & 3, y_idx = n >> 2;
- const TX_TYPE tx_type = get_tx_type_8x8(xd, (y_idx * 8 + x_idx) * 2);
-
- if (tx_type == DCT_DCT) {
- vp9_inverse_transform_b_8x8(xd->dqcoeff + n * 64,
- xd->diff + x_idx * 8 + y_idx * 32 * 8, 64);
- } else {
- vp9_short_iht8x8(xd->dqcoeff + n * 64,
- xd->diff + x_idx * 8 + y_idx * 32 * 8, 32, tx_type);
- }
- }
-}
-
-void vp9_inverse_transform_sby_4x4(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 64; n++) {
- const int x_idx = n & 7, y_idx = n >> 3;
- const TX_TYPE tx_type = get_tx_type_4x4(xd, y_idx * 8 + x_idx);
-
- if (tx_type == DCT_DCT) {
- vp9_inverse_transform_b_4x4(xd, xd->eobs[n], xd->dqcoeff + n * 16,
- xd->diff + x_idx * 4 + y_idx * 4 * 32, 64);
- } else {
- vp9_short_iht4x4(xd->dqcoeff + n * 16,
- xd->diff + x_idx * 4 + y_idx * 4 * 32, 32, tx_type);
- }
- }
-}
-
-void vp9_inverse_transform_sbuv_16x16(MACROBLOCKD *xd) {
- vp9_inverse_transform_b_16x16(xd->dqcoeff + 1024,
- xd->diff + 1024, 32);
- vp9_inverse_transform_b_16x16(xd->dqcoeff + 1280,
- xd->diff + 1280, 32);
-}
-
-void vp9_inverse_transform_sbuv_8x8(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 4; n++) {
- const int x_idx = n & 1, y_idx = n >> 1;
-
- vp9_inverse_transform_b_8x8(xd->dqcoeff + 1024 + n * 64,
- xd->diff + 1024 + x_idx * 8 + y_idx * 16 * 8,
- 32);
- vp9_inverse_transform_b_8x8(xd->dqcoeff + 1280 + n * 64,
- xd->diff + 1280 + x_idx * 8 + y_idx * 16 * 8,
- 32);
- }
-}
-
-void vp9_inverse_transform_sbuv_4x4(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 16; n++) {
- const int x_idx = n & 3, y_idx = n >> 2;
-
- vp9_inverse_transform_b_4x4(xd, xd->eobs[64 + n],
- xd->dqcoeff + 1024 + n * 16,
- xd->diff + 1024 + x_idx * 4 + y_idx * 16 * 4,
- 32);
- vp9_inverse_transform_b_4x4(xd, xd->eobs[64 + 16 + n],
- xd->dqcoeff + 1280 + n * 16,
- xd->diff + 1280 + x_idx * 4 + y_idx * 16 * 4,
- 32);
- }
-}
-
-void vp9_inverse_transform_sb64y_32x32(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 4; n++) {
- const int x_idx = n & 1, y_idx = n >> 1;
-
- vp9_short_idct32x32(xd->dqcoeff + n * 1024,
- xd->diff + x_idx * 32 + y_idx * 32 * 64, 128);
- }
-}
-
-void vp9_inverse_transform_sb64y_16x16(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 16; n++) {
- const int x_idx = n & 3, y_idx = n >> 2;
- const TX_TYPE tx_type = get_tx_type_16x16(xd, (y_idx * 16 + x_idx) * 4);
-
- if (tx_type == DCT_DCT) {
- vp9_inverse_transform_b_16x16(xd->dqcoeff + n * 256,
- xd->diff + x_idx * 16 + y_idx * 64 * 16,
- 128);
- } else {
- vp9_short_iht16x16(xd->dqcoeff + n * 256,
- xd->diff + x_idx * 16 + y_idx * 64 * 16, 64, tx_type);
- }
- }
-}
-
-void vp9_inverse_transform_sb64y_8x8(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 64; n++) {
- const int x_idx = n & 7, y_idx = n >> 3;
- const TX_TYPE tx_type = get_tx_type_8x8(xd, (y_idx * 16 + x_idx) * 2);
-
- if (tx_type == DCT_DCT) {
- vp9_inverse_transform_b_8x8(xd->dqcoeff + n * 64,
- xd->diff + x_idx * 8 + y_idx * 64 * 8, 128);
- } else {
- vp9_short_iht8x8(xd->dqcoeff + n * 64,
- xd->diff + x_idx * 8 + y_idx * 64 * 8, 64, tx_type);
- }
- }
-}
-
-void vp9_inverse_transform_sb64y_4x4(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 256; n++) {
- const int x_idx = n & 15, y_idx = n >> 4;
- const TX_TYPE tx_type = get_tx_type_4x4(xd, y_idx * 16 + x_idx);
-
- if (tx_type == DCT_DCT) {
- vp9_inverse_transform_b_4x4(xd, xd->eobs[n], xd->dqcoeff + n * 16,
- xd->diff + x_idx * 4 + y_idx * 4 * 64, 128);
- } else {
- vp9_short_iht4x4(xd->dqcoeff + n * 16,
- xd->diff + x_idx * 4 + y_idx * 4 * 64, 64, tx_type);
- }
- }
-}
-
-void vp9_inverse_transform_sb64uv_32x32(MACROBLOCKD *xd) {
- vp9_short_idct32x32(xd->dqcoeff + 4096,
- xd->diff + 4096, 64);
- vp9_short_idct32x32(xd->dqcoeff + 4096 + 1024,
- xd->diff + 4096 + 1024, 64);
-}
-
-void vp9_inverse_transform_sb64uv_16x16(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 4; n++) {
- const int x_idx = n & 1, y_idx = n >> 1, off = x_idx * 16 + y_idx * 32 * 16;
-
- vp9_inverse_transform_b_16x16(xd->dqcoeff + 4096 + n * 256,
- xd->diff + 4096 + off, 64);
- vp9_inverse_transform_b_16x16(xd->dqcoeff + 4096 + 1024 + n * 256,
- xd->diff + 4096 + 1024 + off, 64);
- }
-}
-
-void vp9_inverse_transform_sb64uv_8x8(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 16; n++) {
- const int x_idx = n & 3, y_idx = n >> 2, off = x_idx * 8 + y_idx * 32 * 8;
-
- vp9_inverse_transform_b_8x8(xd->dqcoeff + 4096 + n * 64,
- xd->diff + 4096 + off, 64);
- vp9_inverse_transform_b_8x8(xd->dqcoeff + 4096 + 1024 + n * 64,
- xd->diff + 4096 + 1024 + off, 64);
- }
-}
-
-void vp9_inverse_transform_sb64uv_4x4(MACROBLOCKD *xd) {
- int n;
-
- for (n = 0; n < 64; n++) {
- const int x_idx = n & 7, y_idx = n >> 3, off = x_idx * 4 + y_idx * 32 * 4;
-
- vp9_inverse_transform_b_4x4(xd, xd->eobs[256 + n],
- xd->dqcoeff + 4096 + n * 16,
- xd->diff + 4096 + off, 64);
- vp9_inverse_transform_b_4x4(xd, xd->eobs[256 + 64 + n],
- xd->dqcoeff + 4096 + 1024 + n * 16,
- xd->diff + 4096 + 1024 + off, 64);
- }
+ xd->inv_txm4x4_add(dqcoeff, dest, stride);
}
--- a/vp9/common/vp9_invtrans.h
+++ b/vp9/common/vp9_invtrans.h
@@ -15,47 +15,6 @@
#include "vpx/vpx_integer.h"
#include "vp9/common/vp9_blockd.h"
-void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int eob,
- int16_t *dqcoeff, int16_t *diff,
- int pitch);
-
-void vp9_inverse_transform_mb_4x4(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_b_8x8(int16_t *input_dqcoeff,
- int16_t *output_coeff, int pitch);
-
-void vp9_inverse_transform_mb_8x8(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mbuv_8x8(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
- int16_t *output_coeff, int pitch);
-
-void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_sby_32x32(MACROBLOCKD *xd);
-void vp9_inverse_transform_sby_16x16(MACROBLOCKD *xd);
-void vp9_inverse_transform_sby_8x8(MACROBLOCKD *xd);
-void vp9_inverse_transform_sby_4x4(MACROBLOCKD *xd);
-void vp9_inverse_transform_sbuv_16x16(MACROBLOCKD *xd);
-void vp9_inverse_transform_sbuv_8x8(MACROBLOCKD *xd);
-void vp9_inverse_transform_sbuv_4x4(MACROBLOCKD *xd);
-
-void vp9_inverse_transform_sb64y_32x32(MACROBLOCKD *xd);
-void vp9_inverse_transform_sb64y_16x16(MACROBLOCKD *xd);
-void vp9_inverse_transform_sb64y_8x8(MACROBLOCKD *xd);
-void vp9_inverse_transform_sb64y_4x4(MACROBLOCKD *xd);
-void vp9_inverse_transform_sb64uv_32x32(MACROBLOCKD *xd);
-void vp9_inverse_transform_sb64uv_16x16(MACROBLOCKD *xd);
-void vp9_inverse_transform_sb64uv_8x8(MACROBLOCKD *xd);
-void vp9_inverse_transform_sb64uv_4x4(MACROBLOCKD *xd);
-
+void vp9_inverse_transform_b_4x4_add(MACROBLOCKD *xd, int eob, int16_t *dqcoeff,
+ uint8_t *dest, int stride);
#endif // VP9_COMMON_VP9_INVTRANS_H_
--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -11,46 +11,26 @@
#include "vpx_config.h"
#include "vp9/common/vp9_loopfilter.h"
#include "vp9/common/vp9_onyxc_int.h"
+#include "vp9/common/vp9_reconinter.h"
#include "vpx_mem/vpx_mem.h"
#include "vp9/common/vp9_seg_common.h"
static void lf_init_lut(loop_filter_info_n *lfi) {
- int filt_lvl;
-
- for (filt_lvl = 0; filt_lvl <= MAX_LOOP_FILTER; filt_lvl++) {
- if (filt_lvl >= 40) {
- lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 2;
- lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 3;
- } else if (filt_lvl >= 20) {
- lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 1;
- lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 2;
- } else if (filt_lvl >= 15) {
- lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 1;
- lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 1;
- } else {
- lfi->hev_thr_lut[KEY_FRAME][filt_lvl] = 0;
- lfi->hev_thr_lut[INTER_FRAME][filt_lvl] = 0;
- }
- }
-
- lfi->mode_lf_lut[DC_PRED] = 1;
- lfi->mode_lf_lut[D45_PRED] = 1;
- lfi->mode_lf_lut[D135_PRED] = 1;
- lfi->mode_lf_lut[D117_PRED] = 1;
- lfi->mode_lf_lut[D153_PRED] = 1;
- lfi->mode_lf_lut[D27_PRED] = 1;
- lfi->mode_lf_lut[D63_PRED] = 1;
- lfi->mode_lf_lut[V_PRED] = 1;
- lfi->mode_lf_lut[H_PRED] = 1;
- lfi->mode_lf_lut[TM_PRED] = 1;
- lfi->mode_lf_lut[B_PRED] = 0;
- lfi->mode_lf_lut[I8X8_PRED] = 0;
- lfi->mode_lf_lut[ZEROMV] = 1;
- lfi->mode_lf_lut[NEARESTMV] = 2;
- lfi->mode_lf_lut[NEARMV] = 2;
- lfi->mode_lf_lut[NEWMV] = 2;
- lfi->mode_lf_lut[SPLITMV] = 3;
+ lfi->mode_lf_lut[DC_PRED] = 0;
+ lfi->mode_lf_lut[D45_PRED] = 0;
+ lfi->mode_lf_lut[D135_PRED] = 0;
+ lfi->mode_lf_lut[D117_PRED] = 0;
+ lfi->mode_lf_lut[D153_PRED] = 0;
+ lfi->mode_lf_lut[D27_PRED] = 0;
+ lfi->mode_lf_lut[D63_PRED] = 0;
+ lfi->mode_lf_lut[V_PRED] = 0;
+ lfi->mode_lf_lut[H_PRED] = 0;
+ lfi->mode_lf_lut[TM_PRED] = 0;
+ lfi->mode_lf_lut[ZEROMV] = 0;
+ lfi->mode_lf_lut[NEARESTMV] = 1;
+ lfi->mode_lf_lut[NEARMV] = 1;
+ lfi->mode_lf_lut[NEWMV] = 1;
}
void vp9_loop_filter_update_sharpness(loop_filter_info_n *lfi,
@@ -86,25 +66,28 @@
loop_filter_info_n *lfi = &cm->lf_info;
int i;
- /* init limits for given sharpness*/
+ // init limits for given sharpness
vp9_loop_filter_update_sharpness(lfi, cm->sharpness_level);
cm->last_sharpness_level = cm->sharpness_level;
- /* init LUT for lvl and hev thr picking */
+ // init LUT for lvl and hev thr picking
lf_init_lut(lfi);
- /* init hev threshold const vectors */
- for (i = 0; i < 4; i++) {
+ // init hev threshold const vectors
+ for (i = 0; i < 4; i++)
vpx_memset(lfi->hev_thr[i], i, SIMD_WIDTH);
- }
}
void vp9_loop_filter_frame_init(VP9_COMMON *cm,
MACROBLOCKD *xd,
int default_filt_lvl) {
- int seg, /* segment number */
- ref, /* index in ref_lf_deltas */
- mode; /* index in mode_lf_deltas */
+ int seg, // segment number
+ ref, // index in ref_lf_deltas
+ mode; // index in mode_lf_deltas
+ // n_shift is the a multiplier for lf_deltas
+ // the multiplier is 1 for when filter_lvl is between 0 and 31;
+ // 2 when filter_lvl is between 32 and 63
+ int n_shift = default_filt_lvl >> 5;
loop_filter_info_n *lfi = &cm->lf_info;
@@ -147,360 +130,278 @@
ref = INTRA_FRAME;
/* Apply delta for reference frame */
- lvl_ref += xd->ref_lf_deltas[ref];
+ lvl_ref += xd->ref_lf_deltas[ref] << n_shift;
- /* Apply delta for Intra modes */
- mode = 0; /* B_PRED */
- /* Only the split mode BPRED has a further special case */
- lvl_mode = clamp(lvl_ref + xd->mode_lf_deltas[mode], 0, 63);
+ mode = 0; /* all the rest of Intra modes */
+ lvl_mode = lvl_ref;
+ lfi->lvl[seg][ref][mode] = clamp(lvl_mode, 0, 63);
- lfi->lvl[seg][ref][mode] = lvl_mode;
-
- mode = 1; /* all the rest of Intra modes */
- lvl_mode = clamp(lvl_ref, 0, 63);
- lfi->lvl[seg][ref][mode] = lvl_mode;
-
/* LAST, GOLDEN, ALT */
for (ref = 1; ref < MAX_REF_FRAMES; ref++) {
int lvl_ref = lvl_seg;
/* Apply delta for reference frame */
- lvl_ref += xd->ref_lf_deltas[ref];
+ lvl_ref += xd->ref_lf_deltas[ref] << n_shift;
/* Apply delta for Inter modes */
- for (mode = 1; mode < 4; mode++) {
- lvl_mode = clamp(lvl_ref + xd->mode_lf_deltas[mode], 0, 63);
- lfi->lvl[seg][ref][mode] = lvl_mode;
+ for (mode = 0; mode < MAX_MODE_LF_DELTAS; mode++) {
+ lvl_mode = lvl_ref + (xd->mode_lf_deltas[mode] << n_shift);
+ lfi->lvl[seg][ref][mode] = clamp(lvl_mode, 0, 63);
}
}
}
}
-// Determine if we should skip inner-MB loop filtering within a MB
-// The current condition is that the loop filtering is skipped only
-// the MB uses a prediction size of 16x16 and either 16x16 transform
-// is used or there is no residue at all.
-static int mb_lf_skip(const MB_MODE_INFO *const mbmi) {
- const MB_PREDICTION_MODE mode = mbmi->mode;
- const int skip_coef = mbmi->mb_skip_coeff;
- const int tx_size = mbmi->txfm_size;
- return mode != B_PRED && mode != I8X8_PRED && mode != SPLITMV &&
- (tx_size >= TX_16X16 || skip_coef);
-}
+static int build_lfi(const VP9_COMMON *cm, const MB_MODE_INFO *mbmi,
+ struct loop_filter_info *lfi) {
+ const loop_filter_info_n *lfi_n = &cm->lf_info;
+ int mode = mbmi->mode;
+ int mode_index = lfi_n->mode_lf_lut[mode];
+ int seg = mbmi->segment_id;
+ int ref_frame = mbmi->ref_frame[0];
+ int filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
-// Determine if we should skip MB loop filtering on a MB edge within
-// a superblock, the current condition is that MB loop filtering is
-// skipped only when both MBs do not use inner MB loop filtering, and
-// same motion vector with same reference frame
-static int sb_mb_lf_skip(const MODE_INFO *const mip0,
- const MODE_INFO *const mip1) {
- const MB_MODE_INFO *mbmi0 = &mip0->mbmi;
- const MB_MODE_INFO *mbmi1 = &mip0->mbmi;
- return mb_lf_skip(mbmi0) && mb_lf_skip(mbmi1) &&
- (mbmi0->ref_frame == mbmi1->ref_frame) &&
- (mbmi0->mv[mbmi0->ref_frame].as_int ==
- mbmi1->mv[mbmi1->ref_frame].as_int) &&
- mbmi0->ref_frame != INTRA_FRAME;
+ if (filter_level) {
+ const int hev_index = filter_level >> 4;
+ lfi->mblim = lfi_n->mblim[filter_level];
+ lfi->blim = lfi_n->blim[filter_level];
+ lfi->lim = lfi_n->lim[filter_level];
+ lfi->hev_thr = lfi_n->hev_thr[hev_index];
+ return 1;
+ }
+ return 0;
}
-void vp9_loop_filter_frame(VP9_COMMON *cm,
- MACROBLOCKD *xd,
- int frame_filter_level,
- int y_only,
- int dering) {
- YV12_BUFFER_CONFIG *post = cm->frame_to_show;
- loop_filter_info_n *lfi_n = &cm->lf_info;
- struct loop_filter_info lfi;
- const FRAME_TYPE frame_type = cm->frame_type;
- int mb_row, mb_col;
- uint8_t *y_ptr, *u_ptr, *v_ptr;
+static void filter_selectively_vert(uint8_t *s, int pitch,
+ unsigned int mask_16x16,
+ unsigned int mask_8x8,
+ unsigned int mask_4x4,
+ unsigned int mask_4x4_int,
+ const struct loop_filter_info *lfi) {
+ unsigned int mask;
- /* Point at base of Mb MODE_INFO list */
- const MODE_INFO *mode_info_context = cm->mi;
- const int mis = cm->mode_info_stride;
+ for (mask = mask_16x16 | mask_8x8 | mask_4x4; mask; mask >>= 1) {
+ if (mask & 1) {
+ if (mask_16x16 & 1) {
+ vp9_mb_lpf_vertical_edge_w(s, pitch, lfi->mblim, lfi->lim,
+ lfi->hev_thr, 1);
+ assert(!(mask_8x8 & 1));
+ assert(!(mask_4x4 & 1));
+ assert(!(mask_4x4_int & 1));
+ } else if (mask_8x8 & 1) {
+ vp9_mbloop_filter_vertical_edge(s, pitch, lfi->mblim, lfi->lim,
+ lfi->hev_thr, 1);
+ assert(!(mask_16x16 & 1));
+ assert(!(mask_4x4 & 1));
+ } else if (mask_4x4 & 1) {
+ vp9_loop_filter_vertical_edge(s, pitch, lfi->mblim, lfi->lim,
+ lfi->hev_thr, 1);
+ assert(!(mask_16x16 & 1));
+ assert(!(mask_8x8 & 1));
+ } else {
+ assert(0);
+ }
- /* Initialize the loop filter for this frame. */
- vp9_loop_filter_frame_init(cm, xd, frame_filter_level);
- /* Set up the buffer pointers */
- y_ptr = post->y_buffer;
- if (y_only) {
- u_ptr = 0;
- v_ptr = 0;
- } else {
- u_ptr = post->u_buffer;
- v_ptr = post->v_buffer;
+ if (mask_4x4_int & 1)
+ vp9_loop_filter_vertical_edge(s + 4, pitch, lfi->mblim, lfi->lim,
+ lfi->hev_thr, 1);
+ }
+ s += 8;
+ lfi++;
+ mask_16x16 >>= 1;
+ mask_8x8 >>= 1;
+ mask_4x4 >>= 1;
+ mask_4x4_int >>= 1;
}
+}
- /* vp9_filter each macro block */
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) {
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
- const MB_PREDICTION_MODE mode = mode_info_context->mbmi.mode;
- const int mode_index = lfi_n->mode_lf_lut[mode];
- const int seg = mode_info_context->mbmi.segment_id;
- const int ref_frame = mode_info_context->mbmi.ref_frame;
- const int filter_level = lfi_n->lvl[seg][ref_frame][mode_index];
- if (filter_level) {
- const int skip_lf = mb_lf_skip(&mode_info_context->mbmi);
- const int tx_size = mode_info_context->mbmi.txfm_size;
- if (cm->filter_type == NORMAL_LOOPFILTER) {
- const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
- lfi.mblim = lfi_n->mblim[filter_level];
- lfi.blim = lfi_n->blim[filter_level];
- lfi.lim = lfi_n->lim[filter_level];
- lfi.hev_thr = lfi_n->hev_thr[hev_index];
+static void filter_selectively_horiz(uint8_t *s, int pitch,
+ unsigned int mask_16x16,
+ unsigned int mask_8x8,
+ unsigned int mask_4x4,
+ unsigned int mask_4x4_int,
+ int only_4x4_1,
+ const struct loop_filter_info *lfi) {
+ unsigned int mask;
- if (mb_col > 0 &&
- !((mb_col & 1) && mode_info_context->mbmi.sb_type &&
- (sb_mb_lf_skip(mode_info_context - 1, mode_info_context) ||
- tx_size >= TX_32X32))
- ) {
- if (tx_size >= TX_16X16)
- vp9_lpf_mbv_w(y_ptr, u_ptr, v_ptr, post->y_stride,
- post->uv_stride, &lfi);
- else
- vp9_loop_filter_mbv(y_ptr, u_ptr, v_ptr, post->y_stride,
- post->uv_stride, &lfi);
- }
- if (!skip_lf) {
- if (tx_size >= TX_8X8) {
- if (tx_size == TX_8X8 && (mode == I8X8_PRED || mode == SPLITMV))
- vp9_loop_filter_bv8x8(y_ptr, u_ptr, v_ptr, post->y_stride,
- post->uv_stride, &lfi);
- else
- vp9_loop_filter_bv8x8(y_ptr, NULL, NULL, post->y_stride,
- post->uv_stride, &lfi);
- } else {
- vp9_loop_filter_bv(y_ptr, u_ptr, v_ptr, post->y_stride,
- post->uv_stride, &lfi);
- }
- }
- /* don't apply across umv border */
- if (mb_row > 0 &&
- !((mb_row & 1) && mode_info_context->mbmi.sb_type &&
- (sb_mb_lf_skip(mode_info_context - mis, mode_info_context) ||
- tx_size >= TX_32X32))
- ) {
- if (tx_size >= TX_16X16)
- vp9_lpf_mbh_w(y_ptr, u_ptr, v_ptr, post->y_stride,
- post->uv_stride, &lfi);
- else
- vp9_loop_filter_mbh(y_ptr, u_ptr, v_ptr, post->y_stride,
- post->uv_stride, &lfi);
- }
- if (!skip_lf) {
- if (tx_size >= TX_8X8) {
- if (tx_size == TX_8X8 && (mode == I8X8_PRED || mode == SPLITMV))
- vp9_loop_filter_bh8x8(y_ptr, u_ptr, v_ptr, post->y_stride,
- post->uv_stride, &lfi);
- else
- vp9_loop_filter_bh8x8(y_ptr, NULL, NULL, post->y_stride,
- post->uv_stride, &lfi);
- } else {
- vp9_loop_filter_bh(y_ptr, u_ptr, v_ptr, post->y_stride,
- post->uv_stride, &lfi);
- }
- }
-#if CONFIG_LOOP_DERING
- if (dering) {
- if (mb_row && mb_row < cm->mb_rows - 1 &&
- mb_col && mb_col < cm->mb_cols - 1) {
- vp9_post_proc_down_and_across(y_ptr, y_ptr,
- post->y_stride, post->y_stride,
- 16, 16, dering);
- if (!y_only) {
- vp9_post_proc_down_and_across(u_ptr, u_ptr,
- post->uv_stride, post->uv_stride,
- 8, 8, dering);
- vp9_post_proc_down_and_across(v_ptr, v_ptr,
- post->uv_stride, post->uv_stride,
- 8, 8, dering);
- }
- } else {
- // Adjust the filter so that no out-of-frame data is used.
- uint8_t *dr_y = y_ptr, *dr_u = u_ptr, *dr_v = v_ptr;
- int w_adjust = 0;
- int h_adjust = 0;
-
- if (mb_col == 0) {
- dr_y += 2;
- dr_u += 2;
- dr_v += 2;
- w_adjust += 2;
- }
- if (mb_col == cm->mb_cols - 1)
- w_adjust += 2;
- if (mb_row == 0) {
- dr_y += 2 * post->y_stride;
- dr_u += 2 * post->uv_stride;
- dr_v += 2 * post->uv_stride;
- h_adjust += 2;
- }
- if (mb_row == cm->mb_rows - 1)
- h_adjust += 2;
- vp9_post_proc_down_and_across_c(dr_y, dr_y,
- post->y_stride, post->y_stride,
- 16 - w_adjust, 16 - h_adjust,
- dering);
- if (!y_only) {
- vp9_post_proc_down_and_across_c(dr_u, dr_u,
- post->uv_stride,
- post->uv_stride,
- 8 - w_adjust, 8 - h_adjust,
- dering);
- vp9_post_proc_down_and_across_c(dr_v, dr_v,
- post->uv_stride,
- post->uv_stride,
- 8 - w_adjust, 8 - h_adjust,
- dering);
- }
- }
- }
-#endif
+ for (mask = mask_16x16 | mask_8x8 | mask_4x4; mask; mask >>= 1) {
+ if (mask & 1) {
+ if (!only_4x4_1) {
+ if (mask_16x16 & 1) {
+ vp9_mb_lpf_horizontal_edge_w(s, pitch, lfi->mblim, lfi->lim,
+ lfi->hev_thr, 1);
+ assert(!(mask_8x8 & 1));
+ assert(!(mask_4x4 & 1));
+ assert(!(mask_4x4_int & 1));
+ } else if (mask_8x8 & 1) {
+ vp9_mbloop_filter_horizontal_edge(s, pitch, lfi->mblim, lfi->lim,
+ lfi->hev_thr, 1);
+ assert(!(mask_16x16 & 1));
+ assert(!(mask_4x4 & 1));
+ } else if (mask_4x4 & 1) {
+ vp9_loop_filter_horizontal_edge(s, pitch, lfi->mblim, lfi->lim,
+ lfi->hev_thr, 1);
+ assert(!(mask_16x16 & 1));
+ assert(!(mask_8x8 & 1));
} else {
- // FIXME: Not 8x8 aware
- if (mb_col > 0 &&
- !(skip_lf && mb_lf_skip(&mode_info_context[-1].mbmi)) &&
- !((mb_col & 1) && mode_info_context->mbmi.sb_type))
- vp9_loop_filter_simple_mbv(y_ptr, post->y_stride,
- lfi_n->mblim[filter_level]);
- if (!skip_lf)
- vp9_loop_filter_simple_bv(y_ptr, post->y_stride,
- lfi_n->blim[filter_level]);
-
- /* don't apply across umv border */
- if (mb_row > 0 &&
- !(skip_lf && mb_lf_skip(&mode_info_context[-mis].mbmi)) &&
- !((mb_row & 1) && mode_info_context->mbmi.sb_type))
- vp9_loop_filter_simple_mbh(y_ptr, post->y_stride,
- lfi_n->mblim[filter_level]);
- if (!skip_lf)
- vp9_loop_filter_simple_bh(y_ptr, post->y_stride,
- lfi_n->blim[filter_level]);
+ assert(0);
}
}
- y_ptr += 16;
- if (!y_only) {
- u_ptr += 8;
- v_ptr += 8;
- }
- mode_info_context++; /* step to next MB */
+
+ if (mask_4x4_int & 1)
+ vp9_loop_filter_horizontal_edge(s + 4 * pitch, pitch, lfi->mblim,
+ lfi->lim, lfi->hev_thr, 1);
}
- y_ptr += post->y_stride * 16 - post->y_width;
- if (!y_only) {
- u_ptr += post->uv_stride * 8 - post->uv_width;
- v_ptr += post->uv_stride * 8 - post->uv_width;
- }
- mode_info_context++; /* Skip border mb */
+ s += 8;
+ lfi++;
+ mask_16x16 >>= 1;
+ mask_8x8 >>= 1;
+ mask_4x4 >>= 1;
+ mask_4x4_int >>= 1;
}
}
+static void filter_block_plane(VP9_COMMON *cm, MACROBLOCKD *xd,
+ int plane, int mi_row, int mi_col) {
+ const int ss_x = xd->plane[plane].subsampling_x;
+ const int ss_y = xd->plane[plane].subsampling_y;
+ const int row_step = 1 << xd->plane[plane].subsampling_y;
+ const int col_step = 1 << xd->plane[plane].subsampling_x;
+ struct buf_2d * const dst = &xd->plane[plane].dst;
+ uint8_t* const dst0 = dst->buf;
+ MODE_INFO* const mi0 = xd->mode_info_context;
+ unsigned int mask_16x16[64 / MI_SIZE] = {0};
+ unsigned int mask_8x8[64 / MI_SIZE] = {0};
+ unsigned int mask_4x4[64 / MI_SIZE] = {0};
+ unsigned int mask_4x4_int[64 / MI_SIZE] = {0};
+ struct loop_filter_info lfi[64 / MI_SIZE][64 / MI_SIZE];
+ int r, c;
-void vp9_loop_filter_partial_frame(VP9_COMMON *cm, MACROBLOCKD *xd,
- int default_filt_lvl) {
- YV12_BUFFER_CONFIG *post = cm->frame_to_show;
+ for (r = 0; r < 64 / MI_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
+ unsigned int mask_16x16_c = 0;
+ unsigned int mask_8x8_c = 0;
+ unsigned int mask_4x4_c = 0;
+ unsigned int border_mask;
- uint8_t *y_ptr;
- int mb_row;
- int mb_col;
- int mb_cols = post->y_width >> 4;
+ // Determine the vertical edges that need filtering
+ for (c = 0; c < 64 / MI_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
+ const MODE_INFO const *mi = xd->mode_info_context;
+ const int skip_this = mi[c].mbmi.mb_skip_coeff
+ && mi[c].mbmi.ref_frame != INTRA_FRAME;
+ // left edge of current unit is block/partition edge -> no skip
+ const int block_edge_left = b_width_log2(mi[c].mbmi.sb_type) ?
+ !(c & ((1 << (b_width_log2(mi[c].mbmi.sb_type)-1)) - 1)) : 1;
+ const int skip_this_c = skip_this && !block_edge_left;
+ // top edge of current unit is block/partition edge -> no skip
+ const int block_edge_above = b_height_log2(mi[c].mbmi.sb_type) ?
+ !(r & ((1 << (b_height_log2(mi[c].mbmi.sb_type)-1)) - 1)) : 1;
+ const int skip_this_r = skip_this && !block_edge_above;
+ const TX_SIZE tx_size = plane ? get_uv_tx_size(&mi[c].mbmi)
+ : mi[c].mbmi.txfm_size;
+ const int skip_border_4x4_c = ss_x && mi_col + c == cm->mi_cols - 1;
+ const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
- int linestocopy, i;
+ // Filter level can vary per MI
+ if (!build_lfi(cm, &mi[c].mbmi,
+ lfi[r] + (c >> xd->plane[plane].subsampling_x)))
+ continue;
- loop_filter_info_n *lfi_n = &cm->lf_info;
- struct loop_filter_info lfi;
+ // Build masks based on the transform size of each block
+ if (tx_size == TX_32X32) {
+ if (!skip_this_c && ((c >> ss_x) & 3) == 0) {
+ if (!skip_border_4x4_c)
+ mask_16x16_c |= 1 << (c >> ss_x);
+ else
+ mask_8x8_c |= 1 << (c >> ss_x);
+ }
+ if (!skip_this_r && ((r >> ss_y) & 3) == 0) {
+ if (!skip_border_4x4_r)
+ mask_16x16[r] |= 1 << (c >> ss_x);
+ else
+ mask_8x8[r] |= 1 << (c >> ss_x);
+ }
+ } else if (tx_size == TX_16X16) {
+ if (!skip_this_c && ((c >> ss_x) & 1) == 0) {
+ if (!skip_border_4x4_c)
+ mask_16x16_c |= 1 << (c >> ss_x);
+ else
+ mask_8x8_c |= 1 << (c >> ss_x);
+ }
+ if (!skip_this_r && ((r >> ss_y) & 1) == 0) {
+ if (!skip_border_4x4_r)
+ mask_16x16[r] |= 1 << (c >> ss_x);
+ else
+ mask_8x8[r] |= 1 << (c >> ss_x);
+ }
+ } else {
+ // force 8x8 filtering on 32x32 boundaries
+ if (!skip_this_c) {
+ if (tx_size == TX_8X8 || ((c >> ss_x) & 3) == 0)
+ mask_8x8_c |= 1 << (c >> ss_x);
+ else
+ mask_4x4_c |= 1 << (c >> ss_x);
+ }
- int filter_level;
- int alt_flt_enabled = xd->segmentation_enabled;
- FRAME_TYPE frame_type = cm->frame_type;
+ if (!skip_this_r) {
+ if (tx_size == TX_8X8 || ((r >> ss_y) & 3) == 0)
+ mask_8x8[r] |= 1 << (c >> ss_x);
+ else
+ mask_4x4[r] |= 1 << (c >> ss_x);
+ }
- const MODE_INFO *mode_info_context;
-
- int lvl_seg[MAX_MB_SEGMENTS];
-
- mode_info_context = cm->mi + (post->y_height >> 5) * (mb_cols + 1);
-
- /* 3 is a magic number. 4 is probably magic too */
- linestocopy = (post->y_height >> (4 + 3));
-
- if (linestocopy < 1)
- linestocopy = 1;
-
- linestocopy <<= 4;
-
- /* Note the baseline filter values for each segment */
- /* See vp9_loop_filter_frame_init. Rather than call that for each change
- * to default_filt_lvl, copy the relevant calculation here.
- */
- if (alt_flt_enabled) {
- for (i = 0; i < MAX_MB_SEGMENTS; i++) {
- if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
- // Abs value
- lvl_seg[i] = vp9_get_segdata(xd, i, SEG_LVL_ALT_LF);
- } else {
- // Delta Value
- lvl_seg[i] = default_filt_lvl + vp9_get_segdata(xd, i, SEG_LVL_ALT_LF);
- lvl_seg[i] = clamp(lvl_seg[i], 0, 63);
+ if (!skip_this && tx_size < TX_8X8 && !skip_border_4x4_c)
+ mask_4x4_int[r] |= 1 << (c >> ss_x);
}
}
+
+ // Disable filtering on the leftmost column
+ border_mask = ~(mi_col == 0);
+ filter_selectively_vert(dst->buf, dst->stride,
+ mask_16x16_c & border_mask,
+ mask_8x8_c & border_mask,
+ mask_4x4_c & border_mask,
+ mask_4x4_int[r], lfi[r]);
+ dst->buf += 8 * dst->stride;
+ xd->mode_info_context += cm->mode_info_stride * row_step;
}
- /* Set up the buffer pointers */
- y_ptr = post->y_buffer + (post->y_height >> 5) * 16 * post->y_stride;
+ // Now do horizontal pass
+ dst->buf = dst0;
+ xd->mode_info_context = mi0;
+ for (r = 0; r < 64 / MI_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
+ const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
+ const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r];
- /* vp9_filter each macro block */
- for (mb_row = 0; mb_row < (linestocopy >> 4); mb_row++) {
- for (mb_col = 0; mb_col < mb_cols; mb_col++) {
- int skip_lf = (mode_info_context->mbmi.mode != B_PRED &&
- mode_info_context->mbmi.mode != I8X8_PRED &&
- mode_info_context->mbmi.mode != SPLITMV &&
- mode_info_context->mbmi.mb_skip_coeff);
+ filter_selectively_horiz(dst->buf, dst->stride,
+ mask_16x16[r],
+ mask_8x8[r],
+ mask_4x4[r],
+ mask_4x4_int_r, mi_row + r == 0, lfi[r]);
+ dst->buf += 8 * dst->stride;
+ xd->mode_info_context += cm->mode_info_stride * row_step;
+ }
+}
- if (alt_flt_enabled)
- filter_level = lvl_seg[mode_info_context->mbmi.segment_id];
- else
- filter_level = default_filt_lvl;
+void vp9_loop_filter_frame(VP9_COMMON *cm,
+ MACROBLOCKD *xd,
+ int frame_filter_level,
+ int y_only) {
+ int mi_row, mi_col;
- if (filter_level) {
- if (cm->filter_type == NORMAL_LOOPFILTER) {
- const int hev_index = lfi_n->hev_thr_lut[frame_type][filter_level];
- lfi.mblim = lfi_n->mblim[filter_level];
- lfi.blim = lfi_n->blim[filter_level];
- lfi.lim = lfi_n->lim[filter_level];
- lfi.hev_thr = lfi_n->hev_thr[hev_index];
+ // Initialize the loop filter for this frame.
+ vp9_loop_filter_frame_init(cm, xd, frame_filter_level);
- if (mb_col > 0)
- vp9_loop_filter_mbv(y_ptr, 0, 0, post->y_stride, 0, &lfi);
+ for (mi_row = 0; mi_row < cm->mi_rows; mi_row += 64 / MI_SIZE) {
+ MODE_INFO* const mi = cm->mi + mi_row * cm->mode_info_stride;
- if (!skip_lf)
- vp9_loop_filter_bv(y_ptr, 0, 0, post->y_stride, 0, &lfi);
+ for (mi_col = 0; mi_col < cm->mi_cols; mi_col += 64 / MI_SIZE) {
+ int plane;
- vp9_loop_filter_mbh(y_ptr, 0, 0, post->y_stride, 0, &lfi);
-
- if (!skip_lf)
- vp9_loop_filter_bh(y_ptr, 0, 0, post->y_stride, 0, &lfi);
- } else {
- if (mb_col > 0)
- vp9_loop_filter_simple_mbv (y_ptr, post->y_stride,
- lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp9_loop_filter_simple_bv(y_ptr, post->y_stride,
- lfi_n->blim[filter_level]);
-
- vp9_loop_filter_simple_mbh(y_ptr, post->y_stride,
- lfi_n->mblim[filter_level]);
-
- if (!skip_lf)
- vp9_loop_filter_simple_bh(y_ptr, post->y_stride,
- lfi_n->blim[filter_level]);
- }
+ setup_dst_planes(xd, cm->frame_to_show, mi_row, mi_col);
+ for (plane = 0; plane < (y_only ? 1 : MAX_MB_PLANE); plane++) {
+ xd->mode_info_context = mi + mi_col;
+ filter_block_plane(cm, xd, plane, mi_row, mi_col);
}
-
- y_ptr += 16;
- mode_info_context += 1; /* step to next MB */
}
-
- y_ptr += post->y_stride * 16 - post->y_width;
- mode_info_context += 1; /* Skip border mb */
}
}
--- a/vp9/common/vp9_loopfilter.h
+++ b/vp9/common/vp9_loopfilter.h
@@ -16,12 +16,6 @@
#include "vp9/common/vp9_blockd.h"
#define MAX_LOOP_FILTER 63
-
-typedef enum {
- NORMAL_LOOPFILTER = 0,
- SIMPLE_LOOPFILTER = 1
-} LOOPFILTERTYPE;
-
#define SIMD_WIDTH 16
/* Need to align this structure so when it is declared and
@@ -36,8 +30,7 @@
lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
DECLARE_ALIGNED(SIMD_WIDTH, unsigned char,
hev_thr[4][SIMD_WIDTH]);
- unsigned char lvl[4][4][4];
- unsigned char hev_thr_lut[2][MAX_LOOP_FILTER + 1];
+ unsigned char lvl[MAX_MB_SEGMENTS][4][4];
unsigned char mode_lf_lut[MB_MODE_COUNT];
} loop_filter_info_n;
@@ -56,9 +49,6 @@
void sym(uint8_t *y, uint8_t *u, uint8_t *v, \
int ystride, int uv_stride, struct loop_filter_info *lfi)
-#define prototype_simple_loopfilter(sym) \
- void sym(uint8_t *y, int ystride, const unsigned char *blimit)
-
#if ARCH_X86 || ARCH_X86_64
#include "x86/vp9_loopfilter_x86.h"
#endif
@@ -83,8 +73,7 @@
void vp9_loop_filter_frame(struct VP9Common *cm,
struct macroblockd *mbd,
int filter_level,
- int y_only,
- int dering);
+ int y_only);
void vp9_loop_filter_partial_frame(struct VP9Common *cm,
struct macroblockd *mbd,
--- a/vp9/common/vp9_loopfilter_filters.c
+++ b/vp9/common/vp9_loopfilter_filters.c
@@ -8,19 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include <stdlib.h>
#include "vpx_config.h"
+#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_loopfilter.h"
#include "vp9/common/vp9_onyxc_int.h"
static INLINE int8_t signed_char_clamp(int t) {
- t = (t < -128 ? -128 : t);
- t = (t > 127 ? 127 : t);
- return (int8_t) t;
+ return (int8_t)clamp(t, -128, 127);
}
-
-/* should we apply any filter at all ( 11111111 yes, 00000000 no) */
+// should we apply any filter at all: 11111111 yes, 00000000 no
static INLINE int8_t filter_mask(uint8_t limit, uint8_t blimit,
uint8_t p3, uint8_t p2,
uint8_t p1, uint8_t p0,
@@ -34,11 +31,10 @@
mask |= (abs(q2 - q1) > limit) * -1;
mask |= (abs(q3 - q2) > limit) * -1;
mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
- mask = ~mask;
- return mask;
+ return ~mask;
}
-/* is there high variance internal edge ( 11111111 yes, 00000000 no) */
+// is there high edge variance internal edge: 11111111 yes, 00000000 no
static INLINE int8_t hevmask(uint8_t thresh, uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1) {
int8_t hev = 0;
@@ -70,73 +66,59 @@
*oq0 = signed_char_clamp(qs0 - filter1) ^ 0x80;
*op0 = signed_char_clamp(ps0 + filter2) ^ 0x80;
- filter = filter1;
// outer tap adjustments
- filter += 1;
- filter >>= 1;
- filter &= ~hev;
+ filter = ((filter1 + 1) >> 1) & ~hev;
*oq1 = signed_char_clamp(qs1 - filter) ^ 0x80;
*op1 = signed_char_clamp(ps1 + filter) ^ 0x80;
}
-void vp9_loop_filter_horizontal_edge_c(uint8_t *s,
- int p, /* pitch */
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
+void vp9_loop_filter_horizontal_edge_c(uint8_t *s, int p /* pitch */,
+ const uint8_t *blimit,
+ const uint8_t *limit,
+ const uint8_t *thresh,
int count) {
- int hev = 0; /* high edge variance */
- int8_t mask = 0;
- int i = 0;
+ int i;
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
- do {
- mask = filter_mask(limit[0], blimit[0],
- s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
- s[0 * p], s[1 * p], s[2 * p], s[3 * p]);
-
- hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
-
+ // loop filter designed to work using chars so that we can make maximum use
+ // of 8 bit simd instructions.
+ for (i = 0; i < 8 * count; ++i) {
+ const uint8_t p3 = s[-4 * p], p2 = s[-3 * p], p1 = s[-2 * p], p0 = s[-p];
+ const uint8_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
+ const int8_t mask = filter_mask(*limit, *blimit,
+ p3, p2, p1, p0, q0, q1, q2, q3);
+ const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
filter(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p);
-
++s;
- } while (++i < count * 8);
+ }
}
-void vp9_loop_filter_vertical_edge_c(uint8_t *s,
- int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
+void vp9_loop_filter_vertical_edge_c(uint8_t *s, int pitch,
+ const uint8_t *blimit,
+ const uint8_t *limit,
+ const uint8_t *thresh,
int count) {
- int hev = 0; /* high edge variance */
- int8_t mask = 0;
- int i = 0;
+ int i;
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
- do {
- mask = filter_mask(limit[0], blimit[0],
- s[-4], s[-3], s[-2], s[-1],
- s[0], s[1], s[2], s[3]);
-
- hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
-
+ // loop filter designed to work using chars so that we can make maximum use
+ // of 8 bit simd instructions.
+ for (i = 0; i < 8 * count; ++i) {
+ const uint8_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
+ const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
+ const int8_t mask = filter_mask(*limit, *blimit,
+ p3, p2, p1, p0, q0, q1, q2, q3);
+ const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
filter(mask, hev, s - 2, s - 1, s, s + 1);
-
- s += p;
- } while (++i < count * 8);
+ s += pitch;
+ }
}
-static INLINE signed char flatmask4(uint8_t thresh,
- uint8_t p3, uint8_t p2,
- uint8_t p1, uint8_t p0,
- uint8_t q0, uint8_t q1,
- uint8_t q2, uint8_t q3) {
+
+static INLINE int8_t flatmask4(uint8_t thresh,
+ uint8_t p3, uint8_t p2,
+ uint8_t p1, uint8_t p0,
+ uint8_t q0, uint8_t q1,
+ uint8_t q2, uint8_t q3) {
int8_t flat = 0;
flat |= (abs(p1 - p0) > thresh) * -1;
flat |= (abs(q1 - q0) > thresh) * -1;
@@ -144,8 +126,7 @@
flat |= (abs(q0 - q2) > thresh) * -1;
flat |= (abs(p3 - p0) > thresh) * -1;
flat |= (abs(q3 - q0) > thresh) * -1;
- flat = ~flat;
- return flat;
+ return ~flat;
}
static INLINE signed char flatmask5(uint8_t thresh,
uint8_t p4, uint8_t p3, uint8_t p2,
@@ -167,289 +148,64 @@
uint8_t *oq2, uint8_t *oq3) {
// use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line
if (flat && mask) {
- const uint8_t p3 = *op3;
- const uint8_t p2 = *op2;
- const uint8_t p1 = *op1;
- const uint8_t p0 = *op0;
- const uint8_t q0 = *oq0;
- const uint8_t q1 = *oq1;
- const uint8_t q2 = *oq2;
- const uint8_t q3 = *oq3;
+ const uint8_t p3 = *op3, p2 = *op2, p1 = *op1, p0 = *op0;
+ const uint8_t q0 = *oq0, q1 = *oq1, q2 = *oq2, q3 = *oq3;
- *op2 = (p3 + p3 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3;
- *op1 = (p3 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3;
- *op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3;
- *oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3;
- *oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3 + 4) >> 3;
- *oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3 + 4) >> 3;
+ *op2 = ROUND_POWER_OF_TWO(p3 + p3 + p3 + p2 + p2 + p1 + p0 + q0, 3);
+ *op1 = ROUND_POWER_OF_TWO(p3 + p3 + p2 + p1 + p1 + p0 + q0 + q1, 3);
+ *op0 = ROUND_POWER_OF_TWO(p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2, 3);
+ *oq0 = ROUND_POWER_OF_TWO(p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3, 3);
+ *oq1 = ROUND_POWER_OF_TWO(p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3, 3);
+ *oq2 = ROUND_POWER_OF_TWO(p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3, 3);
} else {
- int8_t filter1, filter2;
-
- const int8_t ps1 = (int8_t) *op1 ^ 0x80;
- const int8_t ps0 = (int8_t) *op0 ^ 0x80;
- const int8_t qs0 = (int8_t) *oq0 ^ 0x80;
- const int8_t qs1 = (int8_t) *oq1 ^ 0x80;
-
- // add outer taps if we have high edge variance
- int8_t filter = signed_char_clamp(ps1 - qs1) & hev;
-
- // inner taps
- filter = signed_char_clamp(filter + 3 * (qs0 - ps0)) & mask;
-
- filter1 = signed_char_clamp(filter + 4) >> 3;
- filter2 = signed_char_clamp(filter + 3) >> 3;
-
- *oq0 = signed_char_clamp(qs0 - filter1) ^ 0x80;
- *op0 = signed_char_clamp(ps0 + filter2) ^ 0x80;
- filter = filter1;
-
- // outer tap adjustments
- filter += 1;
- filter >>= 1;
- filter &= ~hev;
-
- *oq1 = signed_char_clamp(qs1 - filter) ^ 0x80;
- *op1 = signed_char_clamp(ps1 + filter) ^ 0x80;
+ filter(mask, hev, op1, op0, oq0, oq1);
}
}
-void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s,
- int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
+void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s, int p,
+ const uint8_t *blimit,
+ const uint8_t *limit,
+ const uint8_t *thresh,
int count) {
- int8_t hev = 0; /* high edge variance */
- int8_t mask = 0;
- int8_t flat = 0;
- int i = 0;
+ int i;
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
- do {
- mask = filter_mask(limit[0], blimit[0],
- s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
- s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
+ // loop filter designed to work using chars so that we can make maximum use
+ // of 8 bit simd instructions.
+ for (i = 0; i < 8 * count; ++i) {
+ const uint8_t p3 = s[-4 * p], p2 = s[-3 * p], p1 = s[-2 * p], p0 = s[-p];
+ const uint8_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
- hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
-
- flat = flatmask4(1, s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
- s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
+ const int8_t mask = filter_mask(*limit, *blimit,
+ p3, p2, p1, p0, q0, q1, q2, q3);
+ const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
+ const int8_t flat = flatmask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
mbfilter(mask, hev, flat,
s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
s, s + 1 * p, s + 2 * p, s + 3 * p);
-
++s;
- } while (++i < count * 8);
-
+ }
}
-void vp9_mbloop_filter_vertical_edge_c(uint8_t *s,
- int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
+void vp9_mbloop_filter_vertical_edge_c(uint8_t *s, int pitch,
+ const uint8_t *blimit,
+ const uint8_t *limit,
+ const uint8_t *thresh,
int count) {
- int8_t hev = 0; /* high edge variance */
- int8_t mask = 0;
- int8_t flat = 0;
- int i = 0;
+ int i;
- do {
- mask = filter_mask(limit[0], blimit[0],
- s[-4], s[-3], s[-2], s[-1],
- s[0], s[1], s[2], s[3]);
-
- hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
- flat = flatmask4(1,
- s[-4], s[-3], s[-2], s[-1],
- s[ 0], s[ 1], s[ 2], s[ 3]);
- mbfilter(mask, hev, flat,
- s - 4, s - 3, s - 2, s - 1,
- s, s + 1, s + 2, s + 3);
- s += p;
- } while (++i < count * 8);
-
+ for (i = 0; i < 8 * count; ++i) {
+ const uint8_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
+ const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
+ const int8_t mask = filter_mask(*limit, *blimit,
+ p3, p2, p1, p0, q0, q1, q2, q3);
+ const int8_t hev = hevmask(thresh[0], p1, p0, q0, q1);
+ const int8_t flat = flatmask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
+ mbfilter(mask, hev, flat, s - 4, s - 3, s - 2, s - 1,
+ s, s + 1, s + 2, s + 3);
+ s += pitch;
+ }
}
-/* should we apply any filter at all ( 11111111 yes, 00000000 no) */
-static INLINE int8_t simple_filter_mask(uint8_t blimit,
- uint8_t p1, uint8_t p0,
- uint8_t q0, uint8_t q1) {
- return (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 <= blimit) * -1;
-}
-
-static INLINE void simple_filter(int8_t mask,
- uint8_t *op1, uint8_t *op0,
- uint8_t *oq0, uint8_t *oq1) {
- int8_t filter1, filter2;
- const int8_t p1 = (int8_t) *op1 ^ 0x80;
- const int8_t p0 = (int8_t) *op0 ^ 0x80;
- const int8_t q0 = (int8_t) *oq0 ^ 0x80;
- const int8_t q1 = (int8_t) *oq1 ^ 0x80;
-
- int8_t filter = signed_char_clamp(p1 - q1);
- filter = signed_char_clamp(filter + 3 * (q0 - p0));
- filter &= mask;
-
- // save bottom 3 bits so that we round one side +4 and the other +3
- filter1 = signed_char_clamp(filter + 4) >> 3;
- *oq0 = signed_char_clamp(q0 - filter1) ^ 0x80;
-
- filter2 = signed_char_clamp(filter + 3) >> 3;
- *op0 = signed_char_clamp(p0 + filter2) ^ 0x80;
-}
-
-void vp9_loop_filter_simple_horizontal_edge_c(uint8_t *s,
- int p,
- const unsigned char *blimit) {
- int8_t mask = 0;
- int i = 0;
-
- do {
- mask = simple_filter_mask(blimit[0],
- s[-2 * p], s[-1 * p],
- s[0 * p], s[1 * p]);
- simple_filter(mask,
- s - 2 * p, s - 1 * p,
- s, s + 1 * p);
- ++s;
- } while (++i < 16);
-}
-
-void vp9_loop_filter_simple_vertical_edge_c(uint8_t *s,
- int p,
- const unsigned char *blimit) {
- int8_t mask = 0;
- int i = 0;
-
- do {
- mask = simple_filter_mask(blimit[0], s[-2], s[-1], s[0], s[1]);
- simple_filter(mask, s - 2, s - 1, s, s + 1);
- s += p;
- } while (++i < 16);
-}
-
-/* Vertical MB Filtering */
-void vp9_loop_filter_mbv_c(uint8_t *y_ptr, uint8_t *u_ptr,
- uint8_t *v_ptr, int y_stride, int uv_stride,
- struct loop_filter_info *lfi) {
- vp9_mbloop_filter_vertical_edge_c(y_ptr, y_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp9_mbloop_filter_vertical_edge_c(u_ptr, uv_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp9_mbloop_filter_vertical_edge_c(v_ptr, uv_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-
-/* Vertical B Filtering */
-void vp9_loop_filter_bv_c(uint8_t*y_ptr, uint8_t *u_ptr,
- uint8_t *v_ptr, int y_stride, int uv_stride,
- struct loop_filter_info *lfi) {
- vp9_loop_filter_vertical_edge_c(y_ptr + 4, y_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp9_loop_filter_vertical_edge_c(y_ptr + 8, y_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp9_loop_filter_vertical_edge_c(y_ptr + 12, y_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp9_loop_filter_vertical_edge_c(u_ptr + 4, uv_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp9_loop_filter_vertical_edge_c(v_ptr + 4, uv_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-/* Horizontal MB filtering */
-void vp9_loop_filter_mbh_c(uint8_t *y_ptr, uint8_t *u_ptr,
- uint8_t *v_ptr, int y_stride, int uv_stride,
- struct loop_filter_info *lfi) {
- vp9_mbloop_filter_horizontal_edge_c(y_ptr, y_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp9_mbloop_filter_horizontal_edge_c(u_ptr, uv_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp9_mbloop_filter_horizontal_edge_c(v_ptr, uv_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-
-/* Horizontal B Filtering */
-void vp9_loop_filter_bh_c(uint8_t *y_ptr, uint8_t *u_ptr,
- uint8_t *v_ptr, int y_stride, int uv_stride,
- struct loop_filter_info *lfi) {
- vp9_loop_filter_horizontal_edge_c(y_ptr + 4 * y_stride, y_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp9_loop_filter_horizontal_edge_c(y_ptr + 8 * y_stride, y_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 2);
- vp9_loop_filter_horizontal_edge_c(y_ptr + 12 * y_stride, y_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp9_loop_filter_horizontal_edge_c(u_ptr + 4 * uv_stride, uv_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp9_loop_filter_horizontal_edge_c(v_ptr + 4 * uv_stride, uv_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-void vp9_loop_filter_bh8x8_c(uint8_t *y_ptr, uint8_t *u_ptr,
- uint8_t *v_ptr, int y_stride, int uv_stride,
- struct loop_filter_info *lfi) {
- vp9_mbloop_filter_horizontal_edge_c(
- y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp9_loop_filter_horizontal_edge_c(u_ptr + 4 * uv_stride, uv_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp9_loop_filter_horizontal_edge_c(v_ptr + 4 * uv_stride, uv_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-void vp9_loop_filter_bhs_c(uint8_t *y_ptr, int y_stride,
- const unsigned char *blimit) {
- vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 4 * y_stride,
- y_stride, blimit);
- vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 8 * y_stride,
- y_stride, blimit);
- vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 12 * y_stride,
- y_stride, blimit);
-}
-
-void vp9_loop_filter_bv8x8_c(uint8_t *y_ptr, uint8_t *u_ptr,
- uint8_t *v_ptr, int y_stride, int uv_stride,
- struct loop_filter_info *lfi) {
- vp9_mbloop_filter_vertical_edge_c(
- y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp9_loop_filter_vertical_edge_c(u_ptr + 4, uv_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp9_loop_filter_vertical_edge_c(v_ptr + 4, uv_stride,
- lfi->blim, lfi->lim, lfi->hev_thr, 1);
-}
-
-void vp9_loop_filter_bvs_c(uint8_t *y_ptr, int y_stride,
- const unsigned char *blimit) {
- vp9_loop_filter_simple_vertical_edge_c(y_ptr + 4, y_stride, blimit);
- vp9_loop_filter_simple_vertical_edge_c(y_ptr + 8, y_stride, blimit);
- vp9_loop_filter_simple_vertical_edge_c(y_ptr + 12, y_stride, blimit);
-}
-
static INLINE void wide_mbfilter(int8_t mask, uint8_t hev,
uint8_t flat, uint8_t flat2,
uint8_t *op7, uint8_t *op6, uint8_t *op5,
@@ -460,130 +216,65 @@
uint8_t *oq7) {
// use a 15 tap filter [1,1,1,1,1,1,1,2,1,1,1,1,1,1,1] for flat line
if (flat2 && flat && mask) {
- const uint8_t p7 = *op7;
- const uint8_t p6 = *op6;
- const uint8_t p5 = *op5;
- const uint8_t p4 = *op4;
- const uint8_t p3 = *op3;
- const uint8_t p2 = *op2;
- const uint8_t p1 = *op1;
- const uint8_t p0 = *op0;
- const uint8_t q0 = *oq0;
- const uint8_t q1 = *oq1;
- const uint8_t q2 = *oq2;
- const uint8_t q3 = *oq3;
- const uint8_t q4 = *oq4;
- const uint8_t q5 = *oq5;
- const uint8_t q6 = *oq6;
- const uint8_t q7 = *oq7;
+ const uint8_t p7 = *op7, p6 = *op6, p5 = *op5, p4 = *op4,
+ p3 = *op3, p2 = *op2, p1 = *op1, p0 = *op0;
- *op6 = (p7 * 7 + p6 * 2 +
- p5 + p4 + p3 + p2 + p1 + p0 + q0 + 8) >> 4;
- *op5 = (p7 * 6 + p6 + p5 * 2 +
- p4 + p3 + p2 + p1 + p0 + q0 + q1 + 8) >> 4;
- *op4 = (p7 * 5 + p6 + p5 + p4 * 2 +
- p3 + p2 + p1 + p0 + q0 + q1 + q2 + 8) >> 4;
- *op3 = (p7 * 4 + p6 + p5 + p4 + p3 * 2 +
- p2 + p1 + p0 + q0 + q1 + q2 + q3 + 8) >> 4;
- *op2 = (p7 * 3 + p6 + p5 + p4 + p3 + p2 * 2 +
- p1 + p0 + q0 + q1 + q2 + q3 + q4 + 8) >> 4;
- *op1 = (p7 * 2 + p6 + p5 + p4 + p3 + p2 + p1 * 2 +
- p0 + q0 + q1 + q2 + q3 + q4 + q5 + 8) >> 4;
- *op0 = (p7 + p6 + p5 + p4 + p3 + p2 + p1 + p0 * 2 +
- q0 + q1 + q2 + q3 + q4 + q5 + q6 + 8) >> 4;
- *oq0 = (p6 + p5 + p4 + p3 + p2 + p1 + p0 + q0 * 2 +
- q1 + q2 + q3 + q4 + q5 + q6 + q7 + 8) >> 4;
- *oq1 = (p5 + p4 + p3 + p2 + p1 + p0 + q0 + q1 * 2 +
- q2 + q3 + q4 + q5 + q6 + q7 * 2 + 8) >> 4;
- *oq2 = (p4 + p3 + p2 + p1 + p0 + q0 + q1 + q2 * 2 +
- q3 + q4 + q5 + q6 + q7 * 3 + 8) >> 4;
- *oq3 = (p3 + p2 + p1 + p0 + q0 + q1 + q2 + q3 * 2 +
- q4 + q5 + q6 + q7 * 4 + 8) >> 4;
- *oq4 = (p2 + p1 + p0 + q0 + q1 + q2 + q3 + q4 * 2 +
- q5 + q6 + q7 * 5 + 8) >> 4;
- *oq5 = (p1 + p0 + q0 + q1 + q2 + q3 + q4 + q5 * 2 +
- q6 + q7 * 6 + 8) >> 4;
- *oq6 = (p0 + q0 + q1 + q2 + q3 + q4 + q5 + q6 * 2 +
- q7 * 7 + 8) >> 4;
- } else if (flat && mask) {
- const uint8_t p3 = *op3;
- const uint8_t p2 = *op2;
- const uint8_t p1 = *op1;
- const uint8_t p0 = *op0;
- const uint8_t q0 = *oq0;
- const uint8_t q1 = *oq1;
- const uint8_t q2 = *oq2;
- const uint8_t q3 = *oq3;
+ const uint8_t q0 = *oq0, q1 = *oq1, q2 = *oq2, q3 = *oq3,
+ q4 = *oq4, q5 = *oq5, q6 = *oq6, q7 = *oq7;
- *op2 = (p3 + p3 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3;
- *op1 = (p3 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3;
- *op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3;
- *oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3;
- *oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3 + 4) >> 3;
- *oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3 + 4) >> 3;
+ *op6 = ROUND_POWER_OF_TWO(p7 * 7 + p6 * 2 + p5 + p4 + p3 + p2 + p1 + p0 +
+ q0, 4);
+ *op5 = ROUND_POWER_OF_TWO(p7 * 6 + p6 + p5 * 2 + p4 + p3 + p2 + p1 + p0 +
+ q0 + q1, 4);
+ *op4 = ROUND_POWER_OF_TWO(p7 * 5 + p6 + p5 + p4 * 2 + p3 + p2 + p1 + p0 +
+ q0 + q1 + q2, 4);
+ *op3 = ROUND_POWER_OF_TWO(p7 * 4 + p6 + p5 + p4 + p3 * 2 + p2 + p1 + p0 +
+ q0 + q1 + q2 + q3, 4);
+ *op2 = ROUND_POWER_OF_TWO(p7 * 3 + p6 + p5 + p4 + p3 + p2 * 2 + p1 + p0 +
+ q0 + q1 + q2 + q3 + q4, 4);
+ *op1 = ROUND_POWER_OF_TWO(p7 * 2 + p6 + p5 + p4 + p3 + p2 + p1 * 2 + p0 +
+ q0 + q1 + q2 + q3 + q4 + q5, 4);
+ *op0 = ROUND_POWER_OF_TWO(p7 + p6 + p5 + p4 + p3 + p2 + p1 + p0 * 2 +
+ q0 + q1 + q2 + q3 + q4 + q5 + q6, 4);
+ *oq0 = ROUND_POWER_OF_TWO(p6 + p5 + p4 + p3 + p2 + p1 + p0 +
+ q0 * 2 + q1 + q2 + q3 + q4 + q5 + q6 + q7, 4);
+ *oq1 = ROUND_POWER_OF_TWO(p5 + p4 + p3 + p2 + p1 + p0 +
+ q0 + q1 * 2 + q2 + q3 + q4 + q5 + q6 + q7 * 2, 4);
+ *oq2 = ROUND_POWER_OF_TWO(p4 + p3 + p2 + p1 + p0 +
+ q0 + q1 + q2 * 2 + q3 + q4 + q5 + q6 + q7 * 3, 4);
+ *oq3 = ROUND_POWER_OF_TWO(p3 + p2 + p1 + p0 +
+ q0 + q1 + q2 + q3 * 2 + q4 + q5 + q6 + q7 * 4, 4);
+ *oq4 = ROUND_POWER_OF_TWO(p2 + p1 + p0 +
+ q0 + q1 + q2 + q3 + q4 * 2 + q5 + q6 + q7 * 5, 4);
+ *oq5 = ROUND_POWER_OF_TWO(p1 + p0 +
+ q0 + q1 + q2 + q3 + q4 + q5 * 2 + q6 + q7 * 6, 4);
+ *oq6 = ROUND_POWER_OF_TWO(p0 +
+ q0 + q1 + q2 + q3 + q4 + q5 + q6 * 2 + q7 * 7, 4);
} else {
- int8_t filter1, filter2;
-
- const int8_t ps1 = (int8_t) * op1 ^ 0x80;
- const int8_t ps0 = (int8_t) * op0 ^ 0x80;
- const int8_t qs0 = (int8_t) * oq0 ^ 0x80;
- const int8_t qs1 = (int8_t) * oq1 ^ 0x80;
-
- // add outer taps if we have high edge variance
- int8_t filter = signed_char_clamp(ps1 - qs1) & hev;
-
- // inner taps
- filter = signed_char_clamp(filter + 3 * (qs0 - ps0)) & mask;
- filter1 = signed_char_clamp(filter + 4) >> 3;
- filter2 = signed_char_clamp(filter + 3) >> 3;
-
- *oq0 = signed_char_clamp(qs0 - filter1) ^ 0x80;
- *op0 = signed_char_clamp(ps0 + filter2) ^ 0x80;
- filter = filter1;
-
- // outer tap adjustments
- filter += 1;
- filter >>= 1;
- filter &= ~hev;
-
- *oq1 = signed_char_clamp(qs1 - filter) ^ 0x80;
- *op1 = signed_char_clamp(ps1 + filter) ^ 0x80;
+ mbfilter(mask, hev, flat, op3, op2, op1, op0, oq0, oq1, oq2, oq3);
}
}
-void vp9_mb_lpf_horizontal_edge_w
-(
- unsigned char *s,
- int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
- int count
-) {
- signed char hev = 0; /* high edge variance */
- signed char mask = 0;
- signed char flat = 0;
- signed char flat2 = 0;
- int i = 0;
+void vp9_mb_lpf_horizontal_edge_w(uint8_t *s, int p,
+ const uint8_t *blimit,
+ const uint8_t *limit,
+ const uint8_t *thresh,
+ int count) {
+ int i;
- /* loop filter designed to work using chars so that we can make maximum use
- * of 8 bit simd instructions.
- */
- do {
- mask = filter_mask(limit[0], blimit[0],
- s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
- s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
+ // loop filter designed to work using chars so that we can make maximum use
+ // of 8 bit simd instructions.
+ for (i = 0; i < 8 * count; ++i) {
+ const uint8_t p3 = s[-4 * p], p2 = s[-3 * p], p1 = s[-2 * p], p0 = s[-p];
+ const uint8_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
+ const int8_t mask = filter_mask(*limit, *blimit,
+ p3, p2, p1, p0, q0, q1, q2, q3);
+ const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
+ const int8_t flat = flatmask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
+ const int8_t flat2 = flatmask5(1,
+ s[-8 * p], s[-7 * p], s[-6 * p], s[-5 * p], p0,
+ q0, s[4 * p], s[5 * p], s[6 * p], s[7 * p]);
- hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
-
- flat = flatmask4(1,
- s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
- s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
-
- flat2 = flatmask5(1,
- s[-8 * p], s[-7 * p], s[-6 * p], s[-5 * p], s[-1 * p],
- s[ 0 * p], s[ 4 * p], s[ 5 * p], s[ 6 * p], s[ 7 * p]);
-
wide_mbfilter(mask, hev, flat, flat2,
s - 8 * p, s - 7 * p, s - 6 * p, s - 5 * p,
s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
@@ -591,71 +282,29 @@
s + 4 * p, s + 5 * p, s + 6 * p, s + 7 * p);
++s;
- } while (++i < count * 8);
+ }
}
-void vp9_mb_lpf_vertical_edge_w
-(
- unsigned char *s,
- int p,
- const unsigned char *blimit,
- const unsigned char *limit,
- const unsigned char *thresh,
- int count
-) {
- signed char hev = 0; /* high edge variance */
- signed char mask = 0;
- signed char flat = 0;
- signed char flat2 = 0;
- int i = 0;
- do {
- mask = filter_mask(limit[0], blimit[0],
- s[-4], s[-3], s[-2], s[-1],
- s[0], s[1], s[2], s[3]);
+void vp9_mb_lpf_vertical_edge_w(uint8_t *s, int p,
+ const uint8_t *blimit,
+ const uint8_t *limit,
+ const uint8_t *thresh,
+ int count) {
+ int i;
- hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
- flat = flatmask4(1,
- s[-4], s[-3], s[-2], s[-1],
- s[ 0], s[ 1], s[ 2], s[ 3]);
- flat2 = flatmask5(1,
- s[-8], s[-7], s[-6], s[-5], s[-1],
- s[ 0], s[ 4], s[ 5], s[ 6], s[ 7]);
+ for (i = 0; i < 8 * count; ++i) {
+ const uint8_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
+ const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
+ const int8_t mask = filter_mask(*limit, *blimit,
+ p3, p2, p1, p0, q0, q1, q2, q3);
+ const int8_t hev = hevmask(*thresh, p1, p0, q0, q1);
+ const int8_t flat = flatmask4(1, p3, p2, p1, p0, q0, q1, q2, q3);
+ const int8_t flat2 = flatmask5(1, s[-8], s[-7], s[-6], s[-5], p0,
+ q0, s[4], s[5], s[6], s[7]);
wide_mbfilter(mask, hev, flat, flat2,
- s - 8, s - 7, s - 6, s - 5,
- s - 4, s - 3, s - 2, s - 1,
- s, s + 1, s + 2, s + 3,
- s + 4, s + 5, s + 6, s + 7);
+ s - 8, s - 7, s - 6, s - 5, s - 4, s - 3, s - 2, s - 1,
+ s, s + 1, s + 2, s + 3, s + 4, s + 5, s + 6, s + 7);
s += p;
- } while (++i < count * 8);
+ }
}
-
-void vp9_lpf_mbv_w_c(unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr, int y_stride, int uv_stride,
- struct loop_filter_info *lfi) {
- vp9_mb_lpf_vertical_edge_w(y_ptr, y_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp9_mbloop_filter_vertical_edge_c(u_ptr, uv_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp9_mbloop_filter_vertical_edge_c(v_ptr, uv_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-void vp9_lpf_mbh_w_c(unsigned char *y_ptr, unsigned char *u_ptr,
- unsigned char *v_ptr, int y_stride, int uv_stride,
- struct loop_filter_info *lfi) {
- vp9_mb_lpf_horizontal_edge_w(y_ptr, y_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 2);
-
- if (u_ptr)
- vp9_mbloop_filter_horizontal_edge_c(u_ptr, uv_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-
- if (v_ptr)
- vp9_mbloop_filter_horizontal_edge_c(v_ptr, uv_stride,
- lfi->mblim, lfi->lim, lfi->hev_thr, 1);
-}
-
--- a/vp9/common/vp9_mbpitch.c
+++ b/vp9/common/vp9_mbpitch.c
@@ -11,105 +11,18 @@
#include "vp9/common/vp9_blockd.h"
-typedef enum {
- PRED = 0,
- DEST = 1
-} BLOCKSET;
+void vp9_setup_block_dptrs(MACROBLOCKD *mb,
+ int subsampling_x, int subsampling_y) {
+ int i;
-static void setup_block(BLOCKD *b,
- int mv_stride,
- uint8_t **base,
- uint8_t **base2,
- int stride,
- int offset,
- BLOCKSET bs) {
- if (bs == DEST) {
- b->dst_stride = stride;
- b->dst = offset;
- b->base_dst = base;
- } else {
- b->pre_stride = stride;
- b->pre = offset;
- b->base_pre = base;
- b->base_second_pre = base2;
+ for (i = 0; i < MAX_MB_PLANE; i++) {
+ mb->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y_WITH_DC;
+ mb->plane[i].subsampling_x = i ? subsampling_x : 0;
+ mb->plane[i].subsampling_y = i ? subsampling_y : 0;
}
-}
-
-static void setup_macroblock(MACROBLOCKD *xd, BLOCKSET bs) {
- int block;
-
- uint8_t **y, **u, **v;
- uint8_t **y2 = NULL, **u2 = NULL, **v2 = NULL;
- BLOCKD *blockd = xd->block;
- int stride;
-
- if (bs == DEST) {
- y = &xd->dst.y_buffer;
- u = &xd->dst.u_buffer;
- v = &xd->dst.v_buffer;
- } else {
- y = &xd->pre.y_buffer;
- u = &xd->pre.u_buffer;
- v = &xd->pre.v_buffer;
-
- y2 = &xd->second_pre.y_buffer;
- u2 = &xd->second_pre.u_buffer;
- v2 = &xd->second_pre.v_buffer;
- }
-
- stride = xd->dst.y_stride;
- for (block = 0; block < 16; block++) { /* y blocks */
- setup_block(&blockd[block], stride, y, y2, stride,
- (block >> 2) * 4 * stride + (block & 3) * 4, bs);
- }
-
- stride = xd->dst.uv_stride;
- for (block = 16; block < 20; block++) { /* U and V blocks */
- setup_block(&blockd[block], stride, u, u2, stride,
- ((block - 16) >> 1) * 4 * stride + (block & 1) * 4, bs);
-
- setup_block(&blockd[block + 4], stride, v, v2, stride,
- ((block - 16) >> 1) * 4 * stride + (block & 1) * 4, bs);
- }
-}
-
-void vp9_setup_block_dptrs(MACROBLOCKD *xd) {
- int r, c;
- BLOCKD *blockd = xd->block;
-
- for (r = 0; r < 4; r++) {
- for (c = 0; c < 4; c++) {
- blockd[r * 4 + c].diff = &xd->diff[r * 4 * 16 + c * 4];
- blockd[r * 4 + c].predictor = xd->predictor + r * 4 * 16 + c * 4;
- }
- }
-
- for (r = 0; r < 2; r++) {
- for (c = 0; c < 2; c++) {
- blockd[16 + r * 2 + c].diff = &xd->diff[256 + r * 4 * 8 + c * 4];
- blockd[16 + r * 2 + c].predictor =
- xd->predictor + 256 + r * 4 * 8 + c * 4;
-
- }
- }
-
- for (r = 0; r < 2; r++) {
- for (c = 0; c < 2; c++) {
- blockd[20 + r * 2 + c].diff = &xd->diff[320 + r * 4 * 8 + c * 4];
- blockd[20 + r * 2 + c].predictor =
- xd->predictor + 320 + r * 4 * 8 + c * 4;
-
- }
- }
-
- for (r = 0; r < 24; r++) {
- blockd[r].qcoeff = xd->qcoeff + r * 16;
- blockd[r].dqcoeff = xd->dqcoeff + r * 16;
- }
-}
-
-void vp9_build_block_doffsets(MACROBLOCKD *xd) {
- /* handle the destination pitch features */
- setup_macroblock(xd, DEST);
- setup_macroblock(xd, PRED);
+#if CONFIG_ALPHA
+ // TODO(jkoleszar): Using the Y w/h for now
+ mb->plane[3].subsampling_x = 0;
+ mb->plane[3].subsampling_y = 0;
+#endif
}
--- a/vp9/common/vp9_modecont.c
+++ b/vp9/common/vp9_modecont.c
@@ -11,12 +11,13 @@
#include "vp9/common/vp9_entropy.h"
-const int vp9_default_mode_contexts[INTER_MODE_CONTEXTS][4] = {
- {1, 223, 1, 237}, // 0,0 best: Only candidate
- {87, 166, 26, 219}, // 0,0 best: non zero candidates
- {89, 67, 18, 125}, // 0,0 best: non zero candidates, split
- {16, 141, 69, 226}, // strong nz candidate(s), no split
- {35, 122, 14, 227}, // weak nz candidate(s), no split
- {14, 122, 22, 164}, // strong nz candidate(s), split
- {16, 70, 9, 183}, // weak nz candidate(s), split
+const vp9_prob vp9_default_inter_mode_probs[INTER_MODE_CONTEXTS]
+ [VP9_INTER_MODES - 1] = {
+ {2, 173, 34}, // 0 = both zero mv
+ {7, 145, 85}, // 1 = one zero mv + one a predicted mv
+ {7, 166, 63}, // 2 = two predicted mvs
+ {7, 94, 66}, // 3 = one predicted/zero and one new mv
+ {8, 64, 46}, // 4 = two new mvs
+ {17, 81, 31}, // 5 = one intra neighbour + x
+ {25, 29, 30}, // 6 = two intra neighbours
};
--- a/vp9/common/vp9_modecont.h
+++ b/vp9/common/vp9_modecont.h
@@ -11,6 +11,9 @@
#ifndef VP9_COMMON_VP9_MODECONT_H_
#define VP9_COMMON_VP9_MODECONT_H_
-extern const int vp9_default_mode_contexts[INTER_MODE_CONTEXTS][4];
+#include "vp9/common/vp9_entropy.h"
+
+extern const int vp9_default_inter_mode_probs[INTER_MODE_CONTEXTS]
+ [VP9_INTER_MODES - 1];
#endif // VP9_COMMON_VP9_MODECONT_H_
--- a/vp9/common/vp9_modecontext.c
+++ b/vp9/common/vp9_modecontext.c
@@ -11,137 +11,118 @@
#include "vp9/common/vp9_entropymode.h"
-const unsigned int vp9_kf_default_bmode_counts[VP9_KF_BINTRAMODES]
- [VP9_KF_BINTRAMODES]
- [VP9_KF_BINTRAMODES] = {
- {
- /*Above Mode : 0*/
- { 43438, 2195, 470, 316, 615, 171, 217, 412, 124, 160, }, /* left_mode 0 */
- { 5722, 2751, 296, 291, 81, 68, 80, 101, 100, 170, }, /* left_mode 1 */
- { 1629, 201, 307, 25, 47, 16, 34, 72, 19, 28, }, /* left_mode 2 */
- { 332, 266, 36, 500, 20, 65, 23, 14, 154, 106, }, /* left_mode 3 */
- { 450, 97, 10, 24, 117, 10, 2, 12, 8, 71, }, /* left_mode 4 */
- { 384, 49, 29, 44, 12, 162, 51, 5, 87, 42, }, /* left_mode 5 */
- { 495, 53, 157, 27, 14, 57, 180, 17, 17, 34, }, /* left_mode 6 */
- { 695, 64, 62, 9, 27, 5, 3, 147, 10, 26, }, /* left_mode 7 */
- { 230, 54, 20, 124, 16, 125, 29, 12, 283, 37, }, /* left_mode 8 */
- { 260, 87, 21, 120, 32, 16, 33, 16, 33, 203, }, /* left_mode 9 */
- },
- {
- /*Above Mode : 1*/
- { 3934, 2573, 355, 137, 128, 87, 133, 117, 37, 27, }, /* left_mode 0 */
- { 1036, 1929, 278, 135, 27, 37, 48, 55, 41, 91, }, /* left_mode 1 */
- { 223, 256, 253, 15, 13, 9, 28, 64, 3, 3, }, /* left_mode 2 */
- { 120, 129, 17, 316, 15, 11, 9, 4, 53, 74, }, /* left_mode 3 */
- { 129, 58, 6, 11, 38, 2, 0, 5, 2, 67, }, /* left_mode 4 */
- { 53, 22, 11, 16, 8, 26, 14, 3, 19, 12, }, /* left_mode 5 */
- { 59, 26, 61, 11, 4, 9, 35, 13, 8, 8, }, /* left_mode 6 */
- { 101, 52, 40, 8, 5, 2, 8, 59, 2, 20, }, /* left_mode 7 */
- { 48, 34, 10, 52, 8, 15, 6, 6, 63, 20, }, /* left_mode 8 */
- { 96, 48, 22, 63, 11, 14, 5, 8, 9, 96, }, /* left_mode 9 */
- },
- {
- /*Above Mode : 2*/
- { 709, 461, 506, 36, 27, 33, 151, 98, 24, 6, }, /* left_mode 0 */
- { 201, 375, 442, 27, 13, 8, 46, 58, 6, 19, }, /* left_mode 1 */
- { 122, 140, 417, 4, 13, 3, 33, 59, 4, 2, }, /* left_mode 2 */
- { 36, 17, 22, 16, 6, 8, 12, 17, 9, 21, }, /* left_mode 3 */
- { 51, 15, 7, 1, 14, 0, 4, 5, 3, 22, }, /* left_mode 4 */
- { 18, 11, 30, 9, 7, 20, 11, 5, 2, 6, }, /* left_mode 5 */
- { 38, 21, 103, 9, 4, 12, 79, 13, 2, 5, }, /* left_mode 6 */
- { 64, 17, 66, 2, 12, 4, 2, 65, 4, 5, }, /* left_mode 7 */
- { 14, 7, 7, 16, 3, 11, 4, 13, 15, 16, }, /* left_mode 8 */
- { 36, 8, 32, 9, 9, 4, 14, 7, 6, 24, }, /* left_mode 9 */
- },
- {
- /*Above Mode : 3*/
- { 1340, 173, 36, 119, 30, 10, 13, 10, 20, 26, }, /* left_mode 0 */
- { 156, 293, 26, 108, 5, 16, 2, 4, 23, 30, }, /* left_mode 1 */
- { 60, 34, 13, 7, 3, 3, 0, 8, 4, 5, }, /* left_mode 2 */
- { 72, 64, 1, 235, 3, 9, 2, 7, 28, 38, }, /* left_mode 3 */
- { 29, 14, 1, 3, 5, 0, 2, 2, 5, 13, }, /* left_mode 4 */
- { 22, 7, 4, 11, 2, 5, 1, 2, 6, 4, }, /* left_mode 5 */
- { 18, 14, 5, 6, 4, 3, 14, 0, 9, 2, }, /* left_mode 6 */
- { 41, 10, 7, 1, 2, 0, 0, 10, 2, 1, }, /* left_mode 7 */
- { 23, 19, 2, 33, 1, 5, 2, 0, 51, 8, }, /* left_mode 8 */
- { 33, 26, 7, 53, 3, 9, 3, 3, 9, 19, }, /* left_mode 9 */
- },
- {
- /*Above Mode : 4*/
- { 410, 165, 43, 31, 66, 15, 30, 54, 8, 17, }, /* left_mode 0 */
- { 115, 64, 27, 18, 30, 7, 11, 15, 4, 19, }, /* left_mode 1 */
- { 31, 23, 25, 1, 7, 2, 2, 10, 0, 5, }, /* left_mode 2 */
- { 17, 4, 1, 6, 8, 2, 7, 5, 5, 21, }, /* left_mode 3 */
- { 120, 12, 1, 2, 83, 3, 0, 4, 1, 40, }, /* left_mode 4 */
- { 4, 3, 1, 2, 1, 2, 5, 0, 3, 6, }, /* left_mode 5 */
- { 10, 2, 13, 6, 6, 6, 8, 2, 4, 5, }, /* left_mode 6 */
- { 58, 10, 5, 1, 28, 1, 1, 33, 1, 9, }, /* left_mode 7 */
- { 8, 2, 1, 4, 2, 5, 1, 1, 2, 10, }, /* left_mode 8 */
- { 76, 7, 5, 7, 18, 2, 2, 0, 5, 45, }, /* left_mode 9 */
- },
- {
- /*Above Mode : 5*/
- { 444, 46, 47, 20, 14, 110, 60, 14, 60, 7, }, /* left_mode 0 */
- { 59, 57, 25, 18, 3, 17, 21, 6, 14, 6, }, /* left_mode 1 */
- { 24, 17, 20, 6, 4, 13, 7, 2, 3, 2, }, /* left_mode 2 */
- { 13, 11, 5, 14, 4, 9, 2, 4, 15, 7, }, /* left_mode 3 */
- { 8, 5, 2, 1, 4, 0, 1, 1, 2, 12, }, /* left_mode 4 */
- { 19, 5, 5, 7, 4, 40, 6, 3, 10, 4, }, /* left_mode 5 */
- { 16, 5, 9, 1, 1, 16, 26, 2, 10, 4, }, /* left_mode 6 */
- { 11, 4, 8, 1, 1, 4, 4, 5, 4, 1, }, /* left_mode 7 */
- { 15, 1, 3, 7, 3, 21, 7, 1, 34, 5, }, /* left_mode 8 */
- { 18, 5, 1, 3, 4, 3, 7, 1, 2, 9, }, /* left_mode 9 */
- },
- {
- /*Above Mode : 6*/
- { 476, 149, 94, 13, 14, 77, 291, 27, 23, 3, }, /* left_mode 0 */
- { 79, 83, 42, 14, 2, 12, 63, 2, 4, 14, }, /* left_mode 1 */
- { 43, 36, 55, 1, 3, 8, 42, 11, 5, 1, }, /* left_mode 2 */
- { 9, 9, 6, 16, 1, 5, 6, 3, 11, 10, }, /* left_mode 3 */
- { 10, 3, 1, 3, 10, 1, 0, 1, 1, 4, }, /* left_mode 4 */
- { 14, 6, 15, 5, 1, 20, 25, 2, 5, 0, }, /* left_mode 5 */
- { 28, 7, 51, 1, 0, 8, 127, 6, 2, 5, }, /* left_mode 6 */
- { 13, 3, 3, 2, 3, 1, 2, 8, 1, 2, }, /* left_mode 7 */
- { 10, 3, 3, 3, 3, 8, 2, 2, 9, 3, }, /* left_mode 8 */
- { 13, 7, 11, 4, 0, 4, 6, 2, 5, 8, }, /* left_mode 9 */
- },
- {
- /*Above Mode : 7*/
- { 376, 135, 119, 6, 32, 8, 31, 224, 9, 3, }, /* left_mode 0 */
- { 93, 60, 54, 6, 13, 7, 8, 92, 2, 12, }, /* left_mode 1 */
- { 74, 36, 84, 0, 3, 2, 9, 67, 2, 1, }, /* left_mode 2 */
- { 19, 4, 4, 8, 8, 2, 4, 7, 6, 16, }, /* left_mode 3 */
- { 51, 7, 4, 1, 77, 3, 0, 14, 1, 15, }, /* left_mode 4 */
- { 7, 7, 5, 7, 4, 7, 4, 5, 0, 3, }, /* left_mode 5 */
- { 18, 2, 19, 2, 2, 4, 12, 11, 1, 2, }, /* left_mode 6 */
- { 129, 6, 27, 1, 21, 3, 0, 189, 0, 6, }, /* left_mode 7 */
- { 9, 1, 2, 8, 3, 7, 0, 5, 3, 3, }, /* left_mode 8 */
- { 20, 4, 5, 10, 4, 2, 7, 17, 3, 16, }, /* left_mode 9 */
- },
- {
- /*Above Mode : 8*/
- { 617, 68, 34, 79, 11, 27, 25, 14, 75, 13, }, /* left_mode 0 */
- { 51, 82, 21, 26, 6, 12, 13, 1, 26, 16, }, /* left_mode 1 */
- { 29, 9, 12, 11, 3, 7, 1, 10, 2, 2, }, /* left_mode 2 */
- { 17, 19, 11, 74, 4, 3, 2, 0, 58, 13, }, /* left_mode 3 */
- { 10, 1, 1, 3, 4, 1, 0, 2, 1, 8, }, /* left_mode 4 */
- { 14, 4, 5, 5, 1, 13, 2, 0, 27, 8, }, /* left_mode 5 */
- { 10, 3, 5, 4, 1, 7, 6, 4, 5, 1, }, /* left_mode 6 */
- { 10, 2, 6, 2, 1, 1, 1, 4, 2, 1, }, /* left_mode 7 */
- { 14, 8, 5, 23, 2, 12, 6, 2, 117, 5, }, /* left_mode 8 */
- { 9, 6, 2, 19, 1, 6, 3, 2, 9, 9, }, /* left_mode 9 */
- },
- {
- /*Above Mode : 9*/
- { 680, 73, 22, 38, 42, 5, 11, 9, 6, 28, }, /* left_mode 0 */
- { 113, 112, 21, 22, 10, 2, 8, 4, 6, 42, }, /* left_mode 1 */
- { 44, 20, 24, 6, 5, 4, 3, 3, 1, 2, }, /* left_mode 2 */
- { 40, 23, 7, 71, 5, 2, 4, 1, 7, 22, }, /* left_mode 3 */
- { 85, 9, 4, 4, 17, 2, 0, 3, 2, 23, }, /* left_mode 4 */
- { 13, 4, 2, 6, 1, 7, 0, 1, 7, 6, }, /* left_mode 5 */
- { 26, 6, 8, 3, 2, 3, 8, 1, 5, 4, }, /* left_mode 6 */
- { 54, 8, 9, 6, 7, 0, 1, 11, 1, 3, }, /* left_mode 7 */
- { 9, 10, 4, 13, 2, 5, 4, 2, 14, 8, }, /* left_mode 8 */
- { 92, 9, 5, 19, 15, 3, 3, 1, 6, 58, }, /* left_mode 9 */
- },
+const vp9_prob vp9_kf_default_bmode_probs[VP9_INTRA_MODES]
+ [VP9_INTRA_MODES]
+ [VP9_INTRA_MODES - 1] = {
+ { /* above = dc */
+ { 137, 30, 42, 148, 151, 207, 70, 52, 91 } /* left = dc */,
+ { 92, 45, 102, 136, 116, 180, 74, 90, 100 } /* left = v */,
+ { 73, 32, 19, 187, 222, 215, 46, 34, 100 } /* left = h */,
+ { 91, 30, 32, 116, 121, 186, 93, 86, 94 } /* left = d45 */,
+ { 72, 35, 36, 149, 68, 206, 68, 63, 105 } /* left = d135 */,
+ { 73, 31, 28, 138, 57, 124, 55, 122, 151 } /* left = d117 */,
+ { 67, 23, 21, 140, 126, 197, 40, 37, 171 } /* left = d153 */,
+ { 86, 27, 28, 128, 154, 212, 45, 43, 53 } /* left = d27 */,
+ { 74, 32, 27, 107, 86, 160, 63, 134, 102 } /* left = d63 */,
+ { 59, 67, 44, 140, 161, 202, 78, 67, 119 } /* left = tm */
+ }, { /* above = v */
+ { 63, 36, 126, 146, 123, 158, 60, 90, 96 } /* left = dc */,
+ { 43, 46, 168, 134, 107, 128, 69, 142, 92 } /* left = v */,
+ { 44, 29, 68, 159, 201, 177, 50, 57, 77 } /* left = h */,
+ { 58, 38, 76, 114, 97, 172, 78, 133, 92 } /* left = d45 */,
+ { 46, 41, 76, 140, 63, 184, 69, 112, 57 } /* left = d135 */,
+ { 38, 32, 85, 140, 46, 112, 54, 151, 133 } /* left = d117 */,
+ { 39, 27, 61, 131, 110, 175, 44, 75, 136 } /* left = d153 */,
+ { 52, 30, 74, 113, 130, 175, 51, 64, 58 } /* left = d27 */,
+ { 47, 35, 80, 100, 74, 143, 64, 163, 74 } /* left = d63 */,
+ { 36, 61, 116, 114, 128, 162, 80, 125, 82 } /* left = tm */
+ }, { /* above = h */
+ { 82, 26, 26, 171, 208, 204, 44, 32, 105 } /* left = dc */,
+ { 55, 44, 68, 166, 179, 192, 57, 57, 108 } /* left = v */,
+ { 42, 26, 11, 199, 241, 228, 23, 15, 85 } /* left = h */,
+ { 68, 42, 19, 131, 160, 199, 55, 52, 83 } /* left = d45 */,
+ { 58, 50, 25, 139, 115, 232, 39, 52, 118 } /* left = d135 */,
+ { 50, 35, 33, 153, 104, 162, 64, 59, 131 } /* left = d117 */,
+ { 44, 24, 16, 150, 177, 202, 33, 19, 156 } /* left = d153 */,
+ { 55, 27, 12, 153, 203, 218, 26, 27, 49 } /* left = d27 */,
+ { 53, 49, 21, 110, 116, 168, 59, 80, 76 } /* left = d63 */,
+ { 38, 72, 19, 168, 203, 212, 50, 50, 107 } /* left = tm */
+ }, { /* above = d45 */
+ { 103, 26, 36, 129, 132, 201, 83, 80, 93 } /* left = dc */,
+ { 59, 38, 83, 112, 103, 162, 98, 136, 90 } /* left = v */,
+ { 62, 30, 23, 158, 200, 207, 59, 57, 50 } /* left = h */,
+ { 67, 30, 29, 84, 86, 191, 102, 91, 59 } /* left = d45 */,
+ { 60, 32, 33, 112, 71, 220, 64, 89, 104 } /* left = d135 */,
+ { 53, 26, 34, 130, 56, 149, 84, 120, 103 } /* left = d117 */,
+ { 53, 21, 23, 133, 109, 210, 56, 77, 172 } /* left = d153 */,
+ { 77, 19, 29, 112, 142, 228, 55, 66, 36 } /* left = d27 */,
+ { 61, 29, 29, 93, 97, 165, 83, 175, 162 } /* left = d63 */,
+ { 47, 47, 43, 114, 137, 181, 100, 99, 95 } /* left = tm */
+ }, { /* above = d135 */
+ { 69, 23, 29, 128, 83, 199, 46, 44, 101 } /* left = dc */,
+ { 53, 40, 55, 139, 69, 183, 61, 80, 110 } /* left = v */,
+ { 40, 29, 19, 161, 180, 207, 43, 24, 91 } /* left = h */,
+ { 60, 34, 19, 105, 61, 198, 53, 64, 89 } /* left = d45 */,
+ { 52, 31, 22, 158, 40, 209, 58, 62, 89 } /* left = d135 */,
+ { 44, 31, 29, 147, 46, 158, 56, 102, 198 } /* left = d117 */,
+ { 35, 19, 12, 135, 87, 209, 41, 45, 167 } /* left = d153 */,
+ { 55, 25, 21, 118, 95, 215, 38, 39, 66 } /* left = d27 */,
+ { 51, 38, 25, 113, 58, 164, 70, 93, 97 } /* left = d63 */,
+ { 47, 54, 34, 146, 108, 203, 72, 103, 151 } /* left = tm */
+ }, { /* above = d117 */
+ { 64, 19, 37, 156, 66, 138, 49, 95, 133 } /* left = dc */,
+ { 46, 27, 80, 150, 55, 124, 55, 121, 135 } /* left = v */,
+ { 36, 23, 27, 165, 149, 166, 54, 64, 118 } /* left = h */,
+ { 53, 21, 36, 131, 63, 163, 60, 109, 81 } /* left = d45 */,
+ { 40, 26, 35, 154, 40, 185, 51, 97, 123 } /* left = d135 */,
+ { 35, 19, 34, 179, 19, 97, 48, 129, 124 } /* left = d117 */,
+ { 36, 20, 26, 136, 62, 164, 33, 77, 154 } /* left = d153 */,
+ { 45, 18, 32, 130, 90, 157, 40, 79, 91 } /* left = d27 */,
+ { 45, 26, 28, 129, 45, 129, 49, 147, 123 } /* left = d63 */,
+ { 38, 44, 51, 136, 74, 162, 57, 97, 121 } /* left = tm */
+ }, { /* above = d153 */
+ { 75, 17, 22, 136, 138, 185, 32, 34, 166 } /* left = dc */,
+ { 56, 39, 58, 133, 117, 173, 48, 53, 187 } /* left = v */,
+ { 35, 21, 12, 161, 212, 207, 20, 23, 145 } /* left = h */,
+ { 56, 29, 19, 117, 109, 181, 55, 68, 112 } /* left = d45 */,
+ { 47, 29, 17, 153, 64, 220, 59, 51, 114 } /* left = d135 */,
+ { 46, 16, 24, 136, 76, 147, 41, 64, 172 } /* left = d117 */,
+ { 34, 17, 11, 108, 152, 187, 13, 15, 209 } /* left = d153 */,
+ { 51, 24, 14, 115, 133, 209, 32, 26, 104 } /* left = d27 */,
+ { 55, 30, 18, 122, 79, 179, 44, 88, 116 } /* left = d63 */,
+ { 37, 49, 25, 129, 168, 164, 41, 54, 148 } /* left = tm */
+ }, { /* above = d27 */
+ { 82, 22, 32, 127, 143, 213, 39, 41, 70 } /* left = dc */,
+ { 62, 44, 61, 123, 105, 189, 48, 57, 64 } /* left = v */,
+ { 47, 25, 17, 175, 222, 220, 24, 30, 86 } /* left = h */,
+ { 68, 36, 17, 106, 102, 206, 59, 74, 74 } /* left = d45 */,
+ { 57, 39, 23, 151, 68, 216, 55, 63, 58 } /* left = d135 */,
+ { 49, 30, 35, 141, 70, 168, 82, 40, 115 } /* left = d117 */,
+ { 51, 25, 15, 136, 129, 202, 38, 35, 139 } /* left = d153 */,
+ { 68, 26, 16, 111, 141, 215, 29, 28, 28 } /* left = d27 */,
+ { 59, 39, 19, 114, 75, 180, 77, 104, 42 } /* left = d63 */,
+ { 40, 61, 26, 126, 152, 206, 61, 59, 93 } /* left = tm */
+ }, { /* above = d63 */
+ { 78, 23, 39, 111, 117, 170, 74, 124, 94 } /* left = dc */,
+ { 48, 34, 86, 101, 92, 146, 78, 179, 134 } /* left = v */,
+ { 47, 22, 24, 138, 187, 178, 68, 69, 59 } /* left = h */,
+ { 56, 25, 33, 105, 112, 187, 95, 177, 129 } /* left = d45 */,
+ { 48, 31, 27, 114, 63, 183, 82, 116, 56 } /* left = d135 */,
+ { 43, 28, 37, 121, 63, 123, 61, 192, 169 } /* left = d117 */,
+ { 42, 17, 24, 109, 97, 177, 56, 76, 122 } /* left = d153 */,
+ { 58, 18, 28, 105, 139, 182, 70, 92, 63 } /* left = d27 */,
+ { 46, 23, 32, 74, 86, 150, 67, 183, 88 } /* left = d63 */,
+ { 36, 38, 48, 92, 122, 165, 88, 137, 91 } /* left = tm */
+ }, { /* above = tm */
+ { 65, 70, 60, 155, 159, 199, 61, 60, 81 } /* left = dc */,
+ { 44, 78, 115, 132, 119, 173, 71, 112, 93 } /* left = v */,
+ { 39, 38, 21, 184, 227, 206, 42, 32, 64 } /* left = h */,
+ { 58, 47, 36, 124, 137, 193, 80, 82, 78 } /* left = d45 */,
+ { 49, 50, 35, 144, 95, 205, 63, 78, 59 } /* left = d135 */,
+ { 41, 53, 52, 148, 71, 142, 65, 128, 51 } /* left = d117 */,
+ { 40, 36, 28, 143, 143, 202, 40, 55, 137 } /* left = d153 */,
+ { 52, 34, 29, 129, 183, 227, 42, 35, 43 } /* left = d27 */,
+ { 42, 44, 44, 104, 105, 164, 64, 130, 80 } /* left = d63 */,
+ { 43, 81, 53, 140, 169, 204, 68, 84, 72 } /* left = tm */
+ }
};
--- a/vp9/common/vp9_mvref_common.c
+++ b/vp9/common/vp9_mvref_common.c
@@ -11,35 +11,34 @@
#include "vp9/common/vp9_mvref_common.h"
#define MVREF_NEIGHBOURS 8
-
-static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
- {0, -1}, {-1, 0}, {-1, -1}, {0, -2},
- {-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}
+static int mv_ref_blocks[BLOCK_SIZE_TYPES][MVREF_NEIGHBOURS][2] = {
+ // SB4X4
+ {{0, -1}, {-1, 0}, {-1, -1}, {0, -2}, {-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}},
+ // SB4X8
+ {{0, -1}, {-1, 0}, {-1, -1}, {0, -2}, {-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}},
+ // SB8X4
+ {{0, -1}, {-1, 0}, {-1, -1}, {0, -2}, {-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}},
+ // SB8X8
+ {{0, -1}, {-1, 0}, {-1, -1}, {0, -2}, {-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}},
+ // SB8X16
+ {{-1, 0}, {0, -1}, {-1, 1}, {-1, -1}, {-2, 0}, {0, -2}, {-1, -2}, {-2, -1}},
+ // SB16X8
+ {{0, -1}, {-1, 0}, {1, -1}, {-1, -1}, {0, -2}, {-2, 0}, {-2, -1}, {-1, -2}},
+ // SB16X16
+ {{0, -1}, {-1, 0}, {1, -1}, {-1, 1}, {-1, -1}, {0, -3}, {-3, 0}, {-3, -3}},
+ // SB16X32
+ {{-1, 0}, {0, -1}, {-1, 2}, {-1, -1}, {1, -1}, {-3, 0}, {0, -3}, {-3, -3}},
+ // SB32X16
+ {{0, -1}, {-1, 0}, {2, -1}, {-1, -1}, {-1, 1}, {0, -3}, {-3, 0}, {-3, -3}},
+ // SB32X32
+ {{1, -1}, {-1, 1}, {2, -1}, {-1, 2}, {-1, -1}, {0, -3}, {-3, 0}, {-3, -3}},
+ // SB32X64
+ {{-1, 0}, {0, -1}, {-1, 4}, {2, -1}, {-1, -1}, {-3, 0}, {0, -3}, {-1, 2}},
+ // SB64X32
+ {{0, -1}, {-1, 0}, {4, -1}, {-1, 2}, {-1, -1}, {0, -3}, {-3, 0}, {2, -1}},
+ // SB64X64
+ {{3, -1}, {-1, 3}, {4, -1}, {-1, 4}, {-1, -1}, {0, -1}, {-1, 0}, {6, -1}}
};
-
-static int mb_ref_distance_weight[MVREF_NEIGHBOURS] =
- { 3, 3, 2, 1, 1, 1, 1, 1 };
-
-static int sb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
- {0, -1}, {-1, 0}, {1, -1}, {-1, 1},
- {-1, -1}, {0, -2}, {-2, 0}, {-1, -2}
-};
-
-static int sb_ref_distance_weight[MVREF_NEIGHBOURS] =
- { 3, 3, 2, 2, 2, 1, 1, 1 };
-
-
-
-static int sb64_mv_ref_search[MVREF_NEIGHBOURS][2] = {
- {0, -1}, {-1, 0}, {1, -1}, {-1, 1},
- {2, -1}, {-1, 2}, {3, -1}, {-1,-1}
-};
-
-static int sb64_ref_distance_weight[MVREF_NEIGHBOURS] =
- { 1, 1, 1, 1, 1, 1, 1, 1 };
-
-
-
// clamp_mv_ref
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
@@ -50,15 +49,21 @@
xd->mb_to_bottom_edge + MV_BORDER);
}
-// Gets a candidate refenence motion vector from the given mode info
+// Gets a candidate reference motion vector from the given mode info
// structure if one exists that matches the given reference frame.
static int get_matching_candidate(const MODE_INFO *candidate_mi,
MV_REFERENCE_FRAME ref_frame,
- int_mv *c_mv) {
- if (ref_frame == candidate_mi->mbmi.ref_frame) {
- c_mv->as_int = candidate_mi->mbmi.mv[0].as_int;
- } else if (ref_frame == candidate_mi->mbmi.second_ref_frame) {
- c_mv->as_int = candidate_mi->mbmi.mv[1].as_int;
+ int_mv *c_mv, int block_idx) {
+ if (ref_frame == candidate_mi->mbmi.ref_frame[0]) {
+ if (block_idx >= 0 && candidate_mi->mbmi.sb_type < BLOCK_SIZE_SB8X8)
+ c_mv->as_int = candidate_mi->bmi[block_idx].as_mv[0].as_int;
+ else
+ c_mv->as_int = candidate_mi->mbmi.mv[0].as_int;
+ } else if (ref_frame == candidate_mi->mbmi.ref_frame[1]) {
+ if (block_idx >= 0 && candidate_mi->mbmi.sb_type < BLOCK_SIZE_SB8X8)
+ c_mv->as_int = candidate_mi->bmi[block_idx].as_mv[1].as_int;
+ else
+ c_mv->as_int = candidate_mi->mbmi.mv[1].as_int;
} else {
return 0;
}
@@ -66,7 +71,7 @@
return 1;
}
-// Gets candidate refenence motion vector(s) from the given mode info
+// Gets candidate reference motion vector(s) from the given mode info
// structure if they exists and do NOT match the given reference frame.
static void get_non_matching_candidates(const MODE_INFO *candidate_mi,
MV_REFERENCE_FRAME ref_frame,
@@ -81,18 +86,18 @@
*c2_ref_frame = INTRA_FRAME;
// If first candidate not valid neither will be.
- if (candidate_mi->mbmi.ref_frame > INTRA_FRAME) {
+ if (candidate_mi->mbmi.ref_frame[0] > INTRA_FRAME) {
// First candidate
- if (candidate_mi->mbmi.ref_frame != ref_frame) {
- *c_ref_frame = candidate_mi->mbmi.ref_frame;
+ if (candidate_mi->mbmi.ref_frame[0] != ref_frame) {
+ *c_ref_frame = candidate_mi->mbmi.ref_frame[0];
c_mv->as_int = candidate_mi->mbmi.mv[0].as_int;
}
// Second candidate
- if ((candidate_mi->mbmi.second_ref_frame > INTRA_FRAME) &&
- (candidate_mi->mbmi.second_ref_frame != ref_frame) &&
+ if ((candidate_mi->mbmi.ref_frame[1] > INTRA_FRAME) &&
+ (candidate_mi->mbmi.ref_frame[1] != ref_frame) &&
(candidate_mi->mbmi.mv[1].as_int != candidate_mi->mbmi.mv[0].as_int)) {
- *c2_ref_frame = candidate_mi->mbmi.second_ref_frame;
+ *c2_ref_frame = candidate_mi->mbmi.ref_frame[1];
c2_mv->as_int = candidate_mi->mbmi.mv[1].as_int;
}
}
@@ -103,10 +108,6 @@
static void scale_mv(MACROBLOCKD *xd, MV_REFERENCE_FRAME this_ref_frame,
MV_REFERENCE_FRAME candidate_ref_frame,
int_mv *candidate_mv, int *ref_sign_bias) {
- // int frame_distances[MAX_REF_FRAMES];
- // int last_distance = 1;
- // int gf_distance = xd->frames_since_golden;
- // int arf_distance = xd->frames_till_alt_ref_frame;
// Sign inversion where appropriate.
if (ref_sign_bias[candidate_ref_frame] != ref_sign_bias[this_ref_frame]) {
@@ -113,135 +114,35 @@
candidate_mv->as_mv.row = -candidate_mv->as_mv.row;
candidate_mv->as_mv.col = -candidate_mv->as_mv.col;
}
-
- /*
- // Scale based on frame distance if the reference frames not the same.
- frame_distances[INTRA_FRAME] = 1; // should never be used
- frame_distances[LAST_FRAME] = 1;
- frame_distances[GOLDEN_FRAME] =
- (xd->frames_since_golden) ? xd->frames_si nce_golden : 1;
- frame_distances[ALTREF_FRAME] =
- (xd->frames_till_alt_ref_frame) ? xd->frames_till_alt_ref_frame : 1;
-
- if (frame_distances[this_ref_frame] &&
- frame_distances[candidate_ref_frame]) {
- candidate_mv->as_mv.row =
- (short)(((int)(candidate_mv->as_mv.row) *
- frame_distances[this_ref_frame]) /
- frame_distances[candidate_ref_frame]);
-
- candidate_mv->as_mv.col =
- (short)(((int)(candidate_mv->as_mv.col) *
- frame_distances[this_ref_frame]) /
- frame_distances[candidate_ref_frame]);
- }
- */
}
-/*
-// Adds a new candidate reference vector to the sorted list.
-// If it is a repeat the weight of the existing entry is increased
-// and the order of the list is resorted.
-// This method of add plus sort has been deprecated for now as there is a
-// further sort of the best candidates in vp9_find_best_ref_mvs() and the
-// incremental benefit of both is small. If the decision is made to remove
-// the sort in vp9_find_best_ref_mvs() for performance reasons then it may be
-// worth re-instating some sort of list reordering by weight here.
-//
-static void addmv_and_shuffle(
- int_mv *mv_list,
- int *mv_scores,
- int *refmv_count,
- int_mv candidate_mv,
- int weight
-) {
-
- int i;
- int insert_point;
- int duplicate_found = FALSE;
-
- // Check for duplicates. If there is one increase its score.
- // We only compare vs the current top candidates.
- insert_point = (*refmv_count < (MAX_MV_REF_CANDIDATES - 1))
- ? *refmv_count : (MAX_MV_REF_CANDIDATES - 1);
-
- i = insert_point;
- if (*refmv_count > i)
- i++;
- while (i > 0) {
- i--;
- if (candidate_mv.as_int == mv_list[i].as_int) {
- duplicate_found = TRUE;
- mv_scores[i] += weight;
- break;
- }
- }
-
- // If no duplicate and the new candidate is good enough then add it.
- if (!duplicate_found ) {
- if (weight > mv_scores[insert_point]) {
- mv_list[insert_point].as_int = candidate_mv.as_int;
- mv_scores[insert_point] = weight;
- i = insert_point;
- }
- (*refmv_count)++;
- }
-
- // Reshuffle the list so that highest scoring mvs at the top.
- while (i > 0) {
- if (mv_scores[i] > mv_scores[i-1]) {
- int tmp_score = mv_scores[i-1];
- int_mv tmp_mv = mv_list[i-1];
-
- mv_scores[i-1] = mv_scores[i];
- mv_list[i-1] = mv_list[i];
- mv_scores[i] = tmp_score;
- mv_list[i] = tmp_mv;
- i--;
- } else
- break;
- }
-}
-*/
-
-// Adds a new candidate reference vector to the list.
-// The mv is thrown out if it is already in the list.
-// Unlike the addmv_and_shuffle() this does not reorder the list
-// but assumes that candidates are added in the order most likely to
-// match distance and reference frame bias.
+// Add a candidate mv.
+// Discard if it has already been seen.
static void add_candidate_mv(int_mv *mv_list, int *mv_scores,
int *candidate_count, int_mv candidate_mv,
int weight) {
- int i;
-
- // Make sure we dont insert off the end of the list
- const int insert_point = MIN(*candidate_count, MAX_MV_REF_CANDIDATES - 1);
-
- // Look for duplicates
- for (i = 0; i <= insert_point; ++i) {
- if (candidate_mv.as_int == mv_list[i].as_int)
- break;
+ if (*candidate_count == 0) {
+ mv_list[0].as_int = candidate_mv.as_int;
+ mv_scores[0] = weight;
+ *candidate_count += 1;
+ } else if ((*candidate_count == 1) &&
+ (candidate_mv.as_int != mv_list[0].as_int)) {
+ mv_list[1].as_int = candidate_mv.as_int;
+ mv_scores[1] = weight;
+ *candidate_count += 1;
}
-
- // Add the candidate. If the list is already full it is only desirable that
- // it should overwrite if it has a higher weight than the last entry.
- if (i >= insert_point && weight > mv_scores[insert_point]) {
- mv_list[insert_point].as_int = candidate_mv.as_int;
- mv_scores[insert_point] = weight;
- *candidate_count += (*candidate_count < MAX_MV_REF_CANDIDATES);
- }
}
-// This function searches the neighbourhood of a given MB/SB and populates a
-// list of candidate reference vectors.
+// This function searches the neighbourhood of a given MB/SB
+// to try and find candidate reference vectors.
//
-void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
- MODE_INFO *lf_here, MV_REFERENCE_FRAME ref_frame,
- int_mv *mv_ref_list, int *ref_sign_bias) {
+void vp9_find_mv_refs_idx(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
+ MODE_INFO *lf_here, MV_REFERENCE_FRAME ref_frame,
+ int_mv *mv_ref_list, int *ref_sign_bias,
+ int block_idx) {
int i;
MODE_INFO *candidate_mi;
MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi;
- int_mv candidate_mvs[MAX_MV_REF_CANDIDATES];
int_mv c_refmv;
int_mv c2_refmv;
MV_REFERENCE_FRAME c_ref_frame;