Merge branch 'experimental' into master
VP9 preview bitstream 2, commit '868ecb55a1528ca3f19286e7d1551572bf89b642' Conflicts: vp9/vp9_common.mk Change-Id: I3f0f6e692c987ff24f98ceafbb86cb9cf64ad8d3
This commit is contained in:
commit
7f7d1357a2
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,6 +3,8 @@
|
||||
*.d
|
||||
*.o
|
||||
*~
|
||||
/*.ivf
|
||||
/*.ivf.md5
|
||||
/*-*.mk
|
||||
/*.asm
|
||||
/*.doxy
|
||||
|
@ -460,6 +460,7 @@ write_common_target_config_h() {
|
||||
#ifndef VPX_CONFIG_H
|
||||
#define VPX_CONFIG_H
|
||||
#define RESTRICT ${RESTRICT}
|
||||
#define INLINE ${INLINE}
|
||||
EOF
|
||||
print_config_h ARCH "${TMP_H}" ${ARCH_LIST}
|
||||
print_config_h HAVE "${TMP_H}" ${HAVE_LIST}
|
||||
@ -1005,12 +1006,6 @@ process_common_toolchain() {
|
||||
#error "not x32"
|
||||
#endif
|
||||
EOF
|
||||
soft_enable runtime_cpu_detect
|
||||
soft_enable mmx
|
||||
soft_enable sse
|
||||
soft_enable sse2
|
||||
soft_enable sse3
|
||||
soft_enable ssse3
|
||||
|
||||
case ${tgt_os} in
|
||||
win*)
|
||||
@ -1064,9 +1059,15 @@ EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
soft_enable runtime_cpu_detect
|
||||
soft_enable mmx
|
||||
soft_enable sse
|
||||
soft_enable sse2
|
||||
soft_enable sse3
|
||||
soft_enable ssse3
|
||||
# We can't use 'check_cflags' until the compiler is configured and CC is
|
||||
# populated.
|
||||
if enabled gcc && ! disabled sse4_1 && ! check_cflags -msse4.1; then
|
||||
if enabled gcc && ! disabled sse4_1 && ! check_cflags -msse4; then
|
||||
RTCD_OPTIONS="${RTCD_OPTIONS}--disable-sse4_1 "
|
||||
else
|
||||
soft_enable sse4_1
|
||||
@ -1174,6 +1175,14 @@ EOF
|
||||
[ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' |
|
||||
grep '4f *32 *42 *45' >/dev/null 2>&1 && enable big_endian
|
||||
|
||||
# Try to find which inline keywords are supported
|
||||
check_cc <<EOF && INLINE="inline"
|
||||
static inline function() {}
|
||||
EOF
|
||||
check_cc <<EOF && INLINE="__attribute__((always_inline))"
|
||||
static __attribute__((always_inline)) function() {}
|
||||
EOF
|
||||
|
||||
# Almost every platform uses pthreads.
|
||||
if enabled multithread; then
|
||||
case ${toolchain} in
|
||||
|
12
configure
vendored
12
configure
vendored
@ -239,17 +239,18 @@ HAVE_LIST="
|
||||
"
|
||||
EXPERIMENT_LIST="
|
||||
csm
|
||||
lossless
|
||||
new_mvref
|
||||
implicit_segmentation
|
||||
newbintramodes
|
||||
comp_interintra_pred
|
||||
tx64x64
|
||||
dwtdcthybrid
|
||||
cnvcontext
|
||||
newcoefcontext
|
||||
enable_6tap
|
||||
abovesprefmv
|
||||
code_nonzerocount
|
||||
useselectrefmv
|
||||
modelcoefprob
|
||||
loop_dering
|
||||
implicit_compoundinter_weight
|
||||
scatterscan
|
||||
"
|
||||
CONFIG_LIST="
|
||||
external_build
|
||||
@ -647,6 +648,7 @@ process_toolchain() {
|
||||
enable solution
|
||||
vs_version=${tgt_cc##vs}
|
||||
all_targets="${all_targets} solution"
|
||||
INLINE="__forceinline"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -8,19 +8,20 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#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 {
|
||||
|
||||
// lookahead range: [kLookAheadMin, kLookAheadMax).
|
||||
const int kLookAheadMin = 5;
|
||||
const int kLookAheadMax = 26;
|
||||
|
||||
class AltRefTest : public libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<int> {
|
||||
class AltRefTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
AltRefTest() : altref_count_(0) {}
|
||||
AltRefTest() : EncoderTest(GET_PARAM(0)), altref_count_(0) {}
|
||||
virtual ~AltRefTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
@ -58,7 +59,7 @@ TEST_P(AltRefTest, MonotonicTimestamps) {
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = 1000;
|
||||
cfg_.g_lag_in_frames = GetParam();
|
||||
cfg_.g_lag_in_frames = GET_PARAM(1);
|
||||
|
||||
libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
timebase.den, timebase.num, 0, 30);
|
||||
@ -66,6 +67,7 @@ TEST_P(AltRefTest, MonotonicTimestamps) {
|
||||
EXPECT_GE(altref_count(), 1);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(NonZeroLag, AltRefTest,
|
||||
::testing::Range(kLookAheadMin, kLookAheadMax));
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(AltRefTest,
|
||||
::testing::Range(kLookAheadMin, kLookAheadMax));
|
||||
} // namespace
|
||||
|
232
test/codec_factory.h
Normal file
232
test/codec_factory.h
Normal file
@ -0,0 +1,232 @@
|
||||
/*
|
||||
* Copyright (c) 2013 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#ifndef TEST_CODEC_FACTORY_H_
|
||||
#define TEST_CODEC_FACTORY_H_
|
||||
|
||||
extern "C" {
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
|
||||
#include "vpx/vp8cx.h"
|
||||
#endif
|
||||
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
|
||||
#include "vpx/vp8dx.h"
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
namespace libvpx_test {
|
||||
|
||||
class CodecFactory {
|
||||
public:
|
||||
CodecFactory() {}
|
||||
|
||||
virtual ~CodecFactory() {}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
unsigned long deadline) const = 0;
|
||||
|
||||
virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const = 0;
|
||||
|
||||
virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
|
||||
int usage) const = 0;
|
||||
};
|
||||
|
||||
/* Provide CodecTestWith<n>Params classes for a variable number of parameters
|
||||
* to avoid having to include a pointer to the CodecFactory in every test
|
||||
* definition.
|
||||
*/
|
||||
template<class T1>
|
||||
class CodecTestWithParam : public ::testing::TestWithParam<
|
||||
std::tr1::tuple< const libvpx_test::CodecFactory*, T1 > > {
|
||||
};
|
||||
|
||||
template<class T1, class T2>
|
||||
class CodecTestWith2Params : public ::testing::TestWithParam<
|
||||
std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2 > > {
|
||||
};
|
||||
|
||||
template<class T1, class T2, class T3>
|
||||
class CodecTestWith3Params : public ::testing::TestWithParam<
|
||||
std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2, T3 > > {
|
||||
};
|
||||
|
||||
/*
|
||||
* VP8 Codec Definitions
|
||||
*/
|
||||
#if CONFIG_VP8
|
||||
class VP8Decoder : public Decoder {
|
||||
public:
|
||||
VP8Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
|
||||
: Decoder(cfg, deadline) {}
|
||||
|
||||
protected:
|
||||
virtual const vpx_codec_iface_t* CodecInterface() const {
|
||||
#if CONFIG_VP8_DECODER
|
||||
return &vpx_codec_vp8_dx_algo;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class VP8Encoder : public Encoder {
|
||||
public:
|
||||
VP8Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
|
||||
const unsigned long init_flags, TwopassStatsStore *stats)
|
||||
: Encoder(cfg, deadline, init_flags, stats) {}
|
||||
|
||||
protected:
|
||||
virtual const vpx_codec_iface_t* CodecInterface() const {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return &vpx_codec_vp8_cx_algo;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class VP8CodecFactory : public CodecFactory {
|
||||
public:
|
||||
VP8CodecFactory() : CodecFactory() {}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
unsigned long deadline) const {
|
||||
#if CONFIG_VP8_DECODER
|
||||
return new VP8Decoder(cfg, deadline);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return new VP8Encoder(cfg, deadline, init_flags, stats);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
|
||||
int usage) const {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return vpx_codec_enc_config_default(&vpx_codec_vp8_cx_algo, cfg, usage);
|
||||
#else
|
||||
return VPX_CODEC_INCAPABLE;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
const libvpx_test::VP8CodecFactory kVP8;
|
||||
|
||||
#define VP8_INSTANTIATE_TEST_CASE(test, params)\
|
||||
INSTANTIATE_TEST_CASE_P(VP8, test, \
|
||||
::testing::Combine( \
|
||||
::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
|
||||
&libvpx_test::kVP8)), \
|
||||
params))
|
||||
#else
|
||||
#define VP8_INSTANTIATE_TEST_CASE(test, params)
|
||||
#endif // CONFIG_VP8
|
||||
|
||||
|
||||
/*
|
||||
* VP9 Codec Definitions
|
||||
*/
|
||||
#if CONFIG_VP9
|
||||
class VP9Decoder : public Decoder {
|
||||
public:
|
||||
VP9Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
|
||||
: Decoder(cfg, deadline) {}
|
||||
|
||||
protected:
|
||||
virtual const vpx_codec_iface_t* CodecInterface() const {
|
||||
#if CONFIG_VP9_DECODER
|
||||
return &vpx_codec_vp9_dx_algo;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class VP9Encoder : public Encoder {
|
||||
public:
|
||||
VP9Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
|
||||
const unsigned long init_flags, TwopassStatsStore *stats)
|
||||
: Encoder(cfg, deadline, init_flags, stats) {}
|
||||
|
||||
protected:
|
||||
virtual const vpx_codec_iface_t* CodecInterface() const {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return &vpx_codec_vp9_cx_algo;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class VP9CodecFactory : public CodecFactory {
|
||||
public:
|
||||
VP9CodecFactory() : CodecFactory() {}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
unsigned long deadline) const {
|
||||
#if CONFIG_VP9_DECODER
|
||||
return new VP9Decoder(cfg, deadline);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return new VP9Encoder(cfg, deadline, init_flags, stats);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
|
||||
int usage) const {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return vpx_codec_enc_config_default(&vpx_codec_vp9_cx_algo, cfg, usage);
|
||||
#else
|
||||
return VPX_CODEC_INCAPABLE;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
const libvpx_test::VP9CodecFactory kVP9;
|
||||
|
||||
#define VP9_INSTANTIATE_TEST_CASE(test, params)\
|
||||
INSTANTIATE_TEST_CASE_P(VP9, test, \
|
||||
::testing::Combine( \
|
||||
::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
|
||||
&libvpx_test::kVP9)), \
|
||||
params))
|
||||
#else
|
||||
#define VP9_INSTANTIATE_TEST_CASE(test, params)
|
||||
#endif // CONFIG_VP9
|
||||
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // TEST_CODEC_FACTORY_H_
|
@ -8,20 +8,22 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/util.h"
|
||||
#include "test/video_source.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ConfigTest : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<enum libvpx_test::TestMode> {
|
||||
public:
|
||||
ConfigTest() : frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}
|
||||
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
ConfigTest() : EncoderTest(GET_PARAM(0)),
|
||||
frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GetParam());
|
||||
SetMode(GET_PARAM(1));
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
@ -57,5 +59,5 @@ TEST_P(ConfigTest, LagIsDisabled) {
|
||||
EXPECT_EQ(frame_count_in_, frame_count_out_);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(OnePassModes, ConfigTest, ONE_PASS_TEST_MODES);
|
||||
VP8_INSTANTIATE_TEST_CASE(ConfigTest, ONE_PASS_TEST_MODES);
|
||||
} // namespace
|
||||
|
509
test/convolve_test.cc
Normal file
509
test/convolve_test.cc
Normal file
@ -0,0 +1,509 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include "./vpx_config.h"
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "vp9/common/vp9_filter.h"
|
||||
#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,
|
||||
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);
|
||||
|
||||
struct ConvolveFunctions {
|
||||
ConvolveFunctions(convolve_fn_t h8, convolve_fn_t h8_avg,
|
||||
convolve_fn_t v8, convolve_fn_t v8_avg,
|
||||
convolve_fn_t hv8, convolve_fn_t hv8_avg)
|
||||
: h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg), v8_avg_(v8_avg),
|
||||
hv8_avg_(hv8_avg) {}
|
||||
|
||||
convolve_fn_t h8_;
|
||||
convolve_fn_t v8_;
|
||||
convolve_fn_t hv8_;
|
||||
convolve_fn_t h8_avg_;
|
||||
convolve_fn_t v8_avg_;
|
||||
convolve_fn_t hv8_avg_;
|
||||
};
|
||||
|
||||
// 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) {
|
||||
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) {
|
||||
// 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
|
||||
// support.
|
||||
const int kInterp_Extend = 4;
|
||||
const unsigned int intermediate_height =
|
||||
(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
|
||||
* + kInterp_Extend
|
||||
* = 3 + 16 + 4
|
||||
* = 23
|
||||
* and filter_max_width = 16
|
||||
*/
|
||||
uint8_t intermediate_buffer[23 * 16];
|
||||
const int intermediate_next_stride = 1 - intermediate_height * output_width;
|
||||
|
||||
// Horizontal pass (src -> transposed intermediate).
|
||||
{
|
||||
uint8_t *output_ptr = intermediate_buffer;
|
||||
const int src_next_row_stride = src_stride - output_width;
|
||||
unsigned int i, j;
|
||||
src_ptr -= (kInterp_Extend - 1) * src_stride + (kInterp_Extend - 1);
|
||||
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
|
||||
|
||||
// Normalize back to 0-255...
|
||||
*output_ptr = clip_pixel(temp >> VP9_FILTER_SHIFT);
|
||||
++src_ptr;
|
||||
output_ptr += intermediate_height;
|
||||
}
|
||||
src_ptr += src_next_row_stride;
|
||||
output_ptr += intermediate_next_stride;
|
||||
}
|
||||
}
|
||||
|
||||
// Vertical pass (transposed intermediate -> dst).
|
||||
{
|
||||
uint8_t *src_ptr = intermediate_buffer;
|
||||
const int dst_next_row_stride = dst_stride - output_width;
|
||||
unsigned int i, j;
|
||||
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
|
||||
|
||||
// Normalize back to 0-255...
|
||||
*dst_ptr++ = clip_pixel(temp >> VP9_FILTER_SHIFT);
|
||||
src_ptr += intermediate_height;
|
||||
}
|
||||
src_ptr += intermediate_next_stride;
|
||||
dst_ptr += dst_next_row_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
unsigned int i, j;
|
||||
for (i = 0; i < output_height; ++i) {
|
||||
for (j = 0; j < output_width; ++j) {
|
||||
output_ptr[j] = (output_ptr[j] + src[i * src_stride + j] + 1) >> 1;
|
||||
}
|
||||
output_ptr += output_stride;
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
assert(output_width <= 16);
|
||||
assert(output_height <= 16);
|
||||
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 16,
|
||||
output_width, output_height);
|
||||
block2d_average_c(tmp, 16, dst_ptr, dst_stride,
|
||||
output_width, output_height);
|
||||
}
|
||||
|
||||
class ConvolveTest : public PARAMS(int, int, const ConvolveFunctions*) {
|
||||
public:
|
||||
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;
|
||||
output_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, kOuterBlockSize * kOuterBlockSize));
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
vpx_free(input_ - 1);
|
||||
input_ = NULL;
|
||||
vpx_free(output_);
|
||||
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;
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void CheckGuardBlocks() {
|
||||
for (int i = 0; i < kOuterBlockSize * kOuterBlockSize; ++i) {
|
||||
if (IsIndexInBorder(i))
|
||||
EXPECT_EQ(255, output_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t* input() {
|
||||
return input_ + BorderTop() * kOuterBlockSize + BorderLeft();
|
||||
}
|
||||
|
||||
uint8_t* output() {
|
||||
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;
|
||||
|
||||
TEST_P(ConvolveTest, GuardBlocks) {
|
||||
CheckGuardBlocks();
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest, CopyHoriz) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
const int16_t filter8[8] = {0, 0, 0, 128, 0, 0, 0, 0};
|
||||
|
||||
REGISTER_STATE_CHECK(
|
||||
UUT_->h8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
|
||||
Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(out[y * kOutputStride + x], in[y * kInputStride + x])
|
||||
<< "(" << x << "," << y << ")";
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest, CopyVert) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
const int16_t filter8[8] = {0, 0, 0, 128, 0, 0, 0, 0};
|
||||
|
||||
REGISTER_STATE_CHECK(
|
||||
UUT_->v8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
|
||||
Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(out[y * kOutputStride + x], in[y * kInputStride + x])
|
||||
<< "(" << x << "," << y << ")";
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest, Copy2D) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
const int16_t filter8[8] = {0, 0, 0, 128, 0, 0, 0, 0};
|
||||
|
||||
REGISTER_STATE_CHECK(
|
||||
UUT_->hv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
|
||||
Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(out[y * kOutputStride + x], in[y * kInputStride + x])
|
||||
<< "(" << x << "," << y << ")";
|
||||
}
|
||||
|
||||
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 int16_t kInvalidFilter[8] = { 0 };
|
||||
|
||||
TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
|
||||
uint8_t* const in = input();
|
||||
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) {
|
||||
filter_block2d_8_c(in, kInputStride,
|
||||
filters[filter_x], filters[filter_y],
|
||||
ref, kOutputStride,
|
||||
Width(), Height());
|
||||
|
||||
if (filters == vp9_sub_pel_filters_8lp || (filter_x && filter_y))
|
||||
REGISTER_STATE_CHECK(
|
||||
UUT_->hv8_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
else if (filter_y)
|
||||
REGISTER_STATE_CHECK(
|
||||
UUT_->v8_(in, kInputStride, out, kOutputStride,
|
||||
kInvalidFilter, 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
else
|
||||
REGISTER_STATE_CHECK(
|
||||
UUT_->h8_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, kInvalidFilter, 16,
|
||||
Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(ref[y * kOutputStride + x], out[y * kOutputStride + x])
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters (" << filter_bank << ","
|
||||
<< filter_x << "," << filter_y << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
uint8_t ref[kOutputStride * kMaxDimension];
|
||||
|
||||
// Populate ref and out with some random data
|
||||
::libvpx_test::ACMRandom prng;
|
||||
for (int y = 0; y < Height(); ++y) {
|
||||
for (int x = 0; x < Width(); ++x) {
|
||||
const uint8_t r = prng.Rand8();
|
||||
|
||||
out[y * kOutputStride + x] = r;
|
||||
ref[y * kOutputStride + x] = r;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
filter_average_block2d_8_c(in, kInputStride,
|
||||
filters[filter_x], filters[filter_y],
|
||||
ref, kOutputStride,
|
||||
Width(), Height());
|
||||
|
||||
if (filters == vp9_sub_pel_filters_8lp || (filter_x && filter_y))
|
||||
REGISTER_STATE_CHECK(
|
||||
UUT_->hv8_avg_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
else if (filter_y)
|
||||
REGISTER_STATE_CHECK(
|
||||
UUT_->v8_avg_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
else
|
||||
REGISTER_STATE_CHECK(
|
||||
UUT_->h8_avg_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(ref[y * kOutputStride + x], out[y * kOutputStride + x])
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters (" << filter_bank << ","
|
||||
<< filter_x << "," << filter_y << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DECLARE_ALIGNED(256, const int16_t, kChangeFilters[16][8]) = {
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 128},
|
||||
{ 0, 0, 0, 0, 0, 0, 128},
|
||||
{ 0, 0, 0, 0, 0, 128},
|
||||
{ 0, 0, 0, 0, 128},
|
||||
{ 0, 0, 0, 128},
|
||||
{ 0, 0, 128},
|
||||
{ 0, 128},
|
||||
{ 128},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 128},
|
||||
{ 0, 0, 0, 0, 0, 0, 128},
|
||||
{ 0, 0, 0, 0, 0, 128},
|
||||
{ 0, 0, 0, 0, 128},
|
||||
{ 0, 0, 0, 128},
|
||||
{ 0, 0, 128},
|
||||
{ 0, 128},
|
||||
{ 128}
|
||||
};
|
||||
|
||||
TEST_P(ConvolveTest, ChangeFilterWorks) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
|
||||
REGISTER_STATE_CHECK(UUT_->h8_(in, kInputStride, out, kOutputStride,
|
||||
kChangeFilters[8], 17, kChangeFilters[4], 16,
|
||||
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;
|
||||
}
|
||||
|
||||
REGISTER_STATE_CHECK(UUT_->v8_(in, kInputStride, out, kOutputStride,
|
||||
kChangeFilters[4], 16, kChangeFilters[8], 17,
|
||||
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;
|
||||
}
|
||||
|
||||
REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride,
|
||||
kChangeFilters[8], 17, kChangeFilters[8], 17,
|
||||
Width(), Height()));
|
||||
|
||||
for (int y = 0; y < Height(); ++y) {
|
||||
for (int x = 0; x < Width(); ++x) {
|
||||
const int ref_x = x < 8 ? 4 : 12;
|
||||
const int ref_y = y < 8 ? 4 : 12;
|
||||
|
||||
ASSERT_EQ(in[ref_y * kInputStride + ref_x], out[y * kOutputStride + x])
|
||||
<< "x == " << x << ", y == " << y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
const ConvolveFunctions convolve8_c(
|
||||
vp9_convolve8_horiz_c, vp9_convolve8_avg_horiz_c,
|
||||
vp9_convolve8_vert_c, vp9_convolve8_avg_vert_c,
|
||||
vp9_convolve8_c, vp9_convolve8_avg_c);
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::Values(
|
||||
make_tuple(4, 4, &convolve8_c),
|
||||
make_tuple(8, 4, &convolve8_c),
|
||||
make_tuple(8, 8, &convolve8_c),
|
||||
make_tuple(16, 8, &convolve8_c),
|
||||
make_tuple(16, 16, &convolve8_c)));
|
||||
}
|
||||
|
||||
#if HAVE_SSSE3
|
||||
const ConvolveFunctions convolve8_ssse3(
|
||||
vp9_convolve8_horiz_ssse3, vp9_convolve8_avg_horiz_c,
|
||||
vp9_convolve8_vert_ssse3, vp9_convolve8_avg_vert_c,
|
||||
vp9_convolve8_ssse3, vp9_convolve8_avg_c);
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, ::testing::Values(
|
||||
make_tuple(4, 4, &convolve8_ssse3),
|
||||
make_tuple(8, 4, &convolve8_ssse3),
|
||||
make_tuple(8, 8, &convolve8_ssse3),
|
||||
make_tuple(16, 8, &convolve8_ssse3),
|
||||
make_tuple(16, 16, &convolve8_ssse3)));
|
||||
#endif
|
@ -9,8 +9,12 @@
|
||||
*/
|
||||
#include <cmath>
|
||||
#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 {
|
||||
|
||||
// CQ level range: [kCQLevelMin, kCQLevelMax).
|
||||
const int kCQLevelMin = 4;
|
||||
@ -18,12 +22,13 @@ const int kCQLevelMax = 63;
|
||||
const int kCQLevelStep = 8;
|
||||
const int kCQTargetBitrate = 2000;
|
||||
|
||||
namespace {
|
||||
|
||||
class CQTest : public libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<int> {
|
||||
class CQTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
CQTest() : cq_level_(GetParam()) { init_flags_ = VPX_CODEC_USE_PSNR; }
|
||||
CQTest() : EncoderTest(GET_PARAM(0)), cq_level_(GET_PARAM(1)) {
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
}
|
||||
|
||||
virtual ~CQTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
@ -100,7 +105,7 @@ TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
|
||||
EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(CQLevelRange, CQTest,
|
||||
::testing::Range(kCQLevelMin, kCQLevelMax,
|
||||
kCQLevelStep));
|
||||
VP8_INSTANTIATE_TEST_CASE(CQTest,
|
||||
::testing::Range(kCQLevelMin, kCQLevelMax,
|
||||
kCQLevelStep));
|
||||
} // namespace
|
||||
|
@ -7,17 +7,23 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#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 "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class DatarateTest : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<enum libvpx_test::TestMode> {
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
public:
|
||||
DatarateTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GetParam());
|
||||
SetMode(GET_PARAM(1));
|
||||
ResetModel();
|
||||
}
|
||||
|
||||
@ -174,5 +180,6 @@ TEST_P(DatarateTest, ChangingDropFrameThresh) {
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllModes, DatarateTest, ALL_TEST_MODES);
|
||||
VP8_INSTANTIATE_TEST_CASE(DatarateTest, ALL_TEST_MODES);
|
||||
|
||||
} // namespace
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
extern "C" {
|
||||
#include "vp9/common/entropy.h"
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
#include "vp9_rtcd.h"
|
||||
}
|
||||
|
||||
@ -26,6 +26,15 @@ using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
static int round(double x) {
|
||||
if (x < 0)
|
||||
return (int)ceil(x - 0.5);
|
||||
else
|
||||
return (int)floor(x + 0.5);
|
||||
}
|
||||
#endif
|
||||
|
||||
const double PI = 3.1415926535898;
|
||||
void reference2_16x16_idct_2d(double *input, double *output) {
|
||||
double x;
|
||||
@ -278,18 +287,10 @@ TEST(VP9Idct16x16Test, AccuracyCheck) {
|
||||
<< "Error: 16x16 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
|
||||
vp9_short_fdct16x16_c(in, out_c, 32);
|
||||
for (int j = 0; j < 256; ++j) {
|
||||
const double diff = coeff[j] - out_c[j];
|
||||
const double error = diff * diff;
|
||||
EXPECT_GE(1.0, error)
|
||||
<< "Error: 16x16 FDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 1
|
||||
// we need enable fdct test once we re-do the 16 point fdct.
|
||||
TEST(VP9Fdct16x16Test, AccuracyCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int max_error = 0;
|
||||
@ -318,10 +319,10 @@ TEST(VP9Fdct16x16Test, AccuracyCheck) {
|
||||
}
|
||||
|
||||
EXPECT_GE(1, max_error)
|
||||
<< "Error: 16x16 FDCT/IDCT has an individual roundtrip error > 1";
|
||||
<< "Error: 16x16 FDCT/IDCT has an individual round trip error > 1";
|
||||
|
||||
EXPECT_GE(count_test_block/10, total_error)
|
||||
<< "Error: 16x16 FDCT/IDCT has average roundtrip error > 1/10 per block";
|
||||
EXPECT_GE(count_test_block , total_error)
|
||||
<< "Error: 16x16 FDCT/IDCT has average round trip error > 1 per block";
|
||||
}
|
||||
|
||||
TEST(VP9Fdct16x16Test, CoeffSizeCheck) {
|
||||
@ -353,4 +354,6 @@ TEST(VP9Fdct16x16Test, CoeffSizeCheck) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
@ -36,7 +36,6 @@ static int round(double x) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !CONFIG_DWTDCTHYBRID
|
||||
static const double kPi = 3.141592653589793238462643383279502884;
|
||||
static void reference2_32x32_idct_2d(double *input, double *output) {
|
||||
double x;
|
||||
@ -116,20 +115,9 @@ TEST(VP9Idct32x32Test, AccuracyCheck) {
|
||||
<< "Error: 3x32 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
|
||||
vp9_short_fdct32x32_c(in, out_c, 64);
|
||||
for (int j = 0; j < 1024; ++j) {
|
||||
const double diff = coeff[j] - out_c[j];
|
||||
const double error = diff * diff;
|
||||
EXPECT_GE(1.0, error)
|
||||
<< "Error: 32x32 FDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else // CONFIG_DWTDCTHYBRID
|
||||
// TODO(rbultje/debargha): add DWT-specific tests
|
||||
#endif // CONFIG_DWTDCTHYBRID
|
||||
|
||||
TEST(VP9Fdct32x32Test, AccuracyCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
unsigned int max_error = 0;
|
||||
@ -160,8 +148,8 @@ TEST(VP9Fdct32x32Test, AccuracyCheck) {
|
||||
EXPECT_GE(1u, max_error)
|
||||
<< "Error: 32x32 FDCT/IDCT has an individual roundtrip error > 1";
|
||||
|
||||
EXPECT_GE(count_test_block/10, total_error)
|
||||
<< "Error: 32x32 FDCT/IDCT has average roundtrip error > 1/10 per block";
|
||||
EXPECT_GE(count_test_block, total_error)
|
||||
<< "Error: 32x32 FDCT/IDCT has average roundtrip error > 1 per block";
|
||||
}
|
||||
|
||||
TEST(VP9Fdct32x32Test, CoeffSizeCheck) {
|
||||
|
@ -7,16 +7,17 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/video_source.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
#if CONFIG_VP8_DECODER
|
||||
|
||||
vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, int size) {
|
||||
vpx_codec_err_t res_dec;
|
||||
InitOnce();
|
||||
REGISTER_STATE_CHECK(res_dec = vpx_codec_decode(&decoder_,
|
||||
cxdata, size, NULL, 0));
|
||||
return res_dec;
|
||||
@ -24,21 +25,23 @@ vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, int size) {
|
||||
|
||||
void DecoderTest::RunLoop(CompressedVideoSource *video) {
|
||||
vpx_codec_dec_cfg_t dec_cfg = {0};
|
||||
Decoder decoder(dec_cfg, 0);
|
||||
Decoder* const decoder = codec_->CreateDecoder(dec_cfg, 0);
|
||||
ASSERT_TRUE(decoder != NULL);
|
||||
|
||||
// Decode frames.
|
||||
for (video->Begin(); video->cxdata(); video->Next()) {
|
||||
vpx_codec_err_t res_dec = decoder.DecodeFrame(video->cxdata(),
|
||||
video->frame_size());
|
||||
ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder.DecodeError();
|
||||
vpx_codec_err_t res_dec = decoder->DecodeFrame(video->cxdata(),
|
||||
video->frame_size());
|
||||
ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
|
||||
|
||||
DxDataIterator dec_iter = decoder.GetDxData();
|
||||
DxDataIterator dec_iter = decoder->GetDxData();
|
||||
const vpx_image_t *img = NULL;
|
||||
|
||||
// Get decompressed data
|
||||
while ((img = dec_iter.Next()))
|
||||
DecompressedFrameHook(*img, video->frame_number());
|
||||
}
|
||||
|
||||
delete decoder;
|
||||
}
|
||||
#endif
|
||||
} // namespace libvpx_test
|
||||
|
@ -14,10 +14,10 @@
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
#include "vpx/vp8dx.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
class CodecFactory;
|
||||
class CompressedVideoSource;
|
||||
|
||||
// Provides an object to handle decoding output
|
||||
@ -42,12 +42,11 @@ class DxDataIterator {
|
||||
class Decoder {
|
||||
public:
|
||||
Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
|
||||
: cfg_(cfg), deadline_(deadline) {
|
||||
: cfg_(cfg), deadline_(deadline), init_done_(false) {
|
||||
memset(&decoder_, 0, sizeof(decoder_));
|
||||
Init();
|
||||
}
|
||||
|
||||
~Decoder() {
|
||||
virtual ~Decoder() {
|
||||
vpx_codec_destroy(&decoder_);
|
||||
}
|
||||
|
||||
@ -62,37 +61,45 @@ class Decoder {
|
||||
}
|
||||
|
||||
void Control(int ctrl_id, int arg) {
|
||||
InitOnce();
|
||||
const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
|
||||
}
|
||||
|
||||
void Control(int ctrl_id, const void *arg) {
|
||||
InitOnce();
|
||||
const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
|
||||
}
|
||||
|
||||
const char *DecodeError() {
|
||||
const char* DecodeError() {
|
||||
const char *detail = vpx_codec_error_detail(&decoder_);
|
||||
return detail ? detail : vpx_codec_error(&decoder_);
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init() {
|
||||
const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_,
|
||||
&vpx_codec_vp8_dx_algo,
|
||||
&cfg_, 0);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
|
||||
virtual const vpx_codec_iface_t* CodecInterface() const = 0;
|
||||
|
||||
void InitOnce() {
|
||||
if (!init_done_) {
|
||||
const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_,
|
||||
CodecInterface(),
|
||||
&cfg_, 0);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
|
||||
init_done_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
vpx_codec_ctx_t decoder_;
|
||||
vpx_codec_dec_cfg_t cfg_;
|
||||
unsigned int deadline_;
|
||||
bool init_done_;
|
||||
};
|
||||
|
||||
// Common test functionality for all Decoder tests.
|
||||
class DecoderTest {
|
||||
public:
|
||||
// Main loop.
|
||||
// Main decoding loop
|
||||
virtual void RunLoop(CompressedVideoSource *video);
|
||||
|
||||
// Hook to be called on every decompressed frame.
|
||||
@ -100,9 +107,11 @@ class DecoderTest {
|
||||
const unsigned int frame_number) {}
|
||||
|
||||
protected:
|
||||
DecoderTest() {}
|
||||
explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {}
|
||||
|
||||
virtual ~DecoderTest() {}
|
||||
|
||||
const CodecFactory *codec_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
@ -7,11 +7,11 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#if CONFIG_VP8_DECODER
|
||||
#include "test/decode_test_driver.h"
|
||||
#endif
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/video_source.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
@ -45,7 +45,7 @@ void Encoder::EncodeFrameInternal(const VideoSource &video,
|
||||
cfg_.g_h = img->d_h;
|
||||
cfg_.g_timebase = video.timebase();
|
||||
cfg_.rc_twopass_stats_in = stats_->buf();
|
||||
res = vpx_codec_enc_init(&encoder_, &vpx_codec_vp8_cx_algo, &cfg_,
|
||||
res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_,
|
||||
init_flags_);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
@ -72,6 +72,11 @@ void Encoder::Flush() {
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void EncoderTest::InitializeConfig() {
|
||||
const vpx_codec_err_t res = codec_->DefaultEncoderConfig(&cfg_, 0);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res);
|
||||
}
|
||||
|
||||
void EncoderTest::SetMode(TestMode mode) {
|
||||
switch (mode) {
|
||||
case kRealTime:
|
||||
@ -125,13 +130,17 @@ static bool compare_img(const vpx_image_t *img1,
|
||||
return match;
|
||||
}
|
||||
|
||||
void EncoderTest::MismatchHook(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2) {
|
||||
ASSERT_TRUE(0) << "Encode/Decode mismatch found";
|
||||
}
|
||||
|
||||
void EncoderTest::RunLoop(VideoSource *video) {
|
||||
#if CONFIG_VP8_DECODER
|
||||
vpx_codec_dec_cfg_t dec_cfg = {0};
|
||||
#endif
|
||||
|
||||
stats_.Reset();
|
||||
|
||||
ASSERT_TRUE(passes_ == 1 || passes_ == 2);
|
||||
for (unsigned int pass = 0; pass < passes_; pass++) {
|
||||
last_pts_ = 0;
|
||||
|
||||
@ -143,34 +152,34 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
cfg_.g_pass = VPX_RC_LAST_PASS;
|
||||
|
||||
BeginPassHook(pass);
|
||||
Encoder encoder(cfg_, deadline_, init_flags_, &stats_);
|
||||
#if CONFIG_VP8_DECODER
|
||||
Decoder decoder(dec_cfg, 0);
|
||||
bool has_cxdata = false;
|
||||
#endif
|
||||
Encoder* const encoder = codec_->CreateEncoder(cfg_, deadline_, init_flags_,
|
||||
&stats_);
|
||||
ASSERT_TRUE(encoder != NULL);
|
||||
Decoder* const decoder = codec_->CreateDecoder(dec_cfg, 0);
|
||||
bool again;
|
||||
for (again = true, video->Begin(); again; video->Next()) {
|
||||
again = video->img() != NULL;
|
||||
|
||||
PreEncodeFrameHook(video);
|
||||
PreEncodeFrameHook(video, &encoder);
|
||||
encoder.EncodeFrame(video, frame_flags_);
|
||||
PreEncodeFrameHook(video, encoder);
|
||||
encoder->EncodeFrame(video, frame_flags_);
|
||||
|
||||
CxDataIterator iter = encoder.GetCxData();
|
||||
CxDataIterator iter = encoder->GetCxData();
|
||||
|
||||
bool has_cxdata = false;
|
||||
bool has_dxdata = false;
|
||||
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
|
||||
pkt = MutateEncoderOutputHook(pkt);
|
||||
again = true;
|
||||
#if CONFIG_VP8_DECODER
|
||||
vpx_codec_err_t res_dec;
|
||||
#endif
|
||||
switch (pkt->kind) {
|
||||
case VPX_CODEC_CX_FRAME_PKT:
|
||||
#if CONFIG_VP8_DECODER
|
||||
has_cxdata = true;
|
||||
res_dec = decoder.DecodeFrame((const uint8_t*)pkt->data.frame.buf,
|
||||
pkt->data.frame.sz);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder.DecodeError();
|
||||
#endif
|
||||
if (decoder && DoDecode()) {
|
||||
vpx_codec_err_t res_dec = decoder->DecodeFrame(
|
||||
(const uint8_t*)pkt->data.frame.buf, pkt->data.frame.sz);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
|
||||
has_dxdata = true;
|
||||
}
|
||||
ASSERT_GE(pkt->data.frame.pts, last_pts_);
|
||||
last_pts_ = pkt->data.frame.pts;
|
||||
FramePktHook(pkt);
|
||||
@ -185,25 +194,32 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP8_DECODER
|
||||
if (has_cxdata) {
|
||||
const vpx_image_t *img_enc = encoder.GetPreviewFrame();
|
||||
DxDataIterator dec_iter = decoder.GetDxData();
|
||||
if (has_dxdata && has_cxdata) {
|
||||
const vpx_image_t *img_enc = encoder->GetPreviewFrame();
|
||||
DxDataIterator dec_iter = decoder->GetDxData();
|
||||
const vpx_image_t *img_dec = dec_iter.Next();
|
||||
if(img_enc && img_dec) {
|
||||
if (img_enc && img_dec) {
|
||||
const bool res = compare_img(img_enc, img_dec);
|
||||
ASSERT_TRUE(res)<< "Encoder/Decoder mismatch found.";
|
||||
if (!res) { // Mismatch
|
||||
MismatchHook(img_enc, img_dec);
|
||||
}
|
||||
}
|
||||
if (img_dec)
|
||||
DecompressedFrameHook(*img_dec, video->pts());
|
||||
}
|
||||
#endif
|
||||
if (!Continue())
|
||||
break;
|
||||
}
|
||||
|
||||
EndPassHook();
|
||||
|
||||
if (decoder)
|
||||
delete decoder;
|
||||
delete encoder;
|
||||
|
||||
if (!Continue())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
@ -9,14 +9,16 @@
|
||||
*/
|
||||
#ifndef TEST_ENCODE_TEST_DRIVER_H_
|
||||
#define TEST_ENCODE_TEST_DRIVER_H_
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#include "vpx/vp8cx.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
class CodecFactory;
|
||||
class VideoSource;
|
||||
|
||||
enum TestMode {
|
||||
@ -36,6 +38,9 @@ enum TestMode {
|
||||
::libvpx_test::kOnePassGood, \
|
||||
::libvpx_test::kOnePassBest)
|
||||
|
||||
#define TWO_PASS_TEST_MODES ::testing::Values(::libvpx_test::kTwoPassGood, \
|
||||
::libvpx_test::kTwoPassBest)
|
||||
|
||||
|
||||
// Provides an object to handle the libvpx get_cx_data() iteration pattern
|
||||
class CxDataIterator {
|
||||
@ -83,7 +88,7 @@ class Encoder {
|
||||
public:
|
||||
Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
|
||||
const unsigned long init_flags, TwopassStatsStore *stats)
|
||||
: cfg_(cfg), deadline_(deadline), init_flags_(init_flags), stats_(stats) {
|
||||
: cfg_(cfg), deadline_(deadline), init_flags_(init_flags), stats_(stats) {
|
||||
memset(&encoder_, 0, sizeof(encoder_));
|
||||
}
|
||||
|
||||
@ -112,11 +117,18 @@ class Encoder {
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void Control(int ctrl_id, struct vpx_scaling_mode *arg) {
|
||||
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void set_deadline(unsigned long deadline) {
|
||||
deadline_ = deadline;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual const vpx_codec_iface_t* CodecInterface() const = 0;
|
||||
|
||||
const char *EncoderError() {
|
||||
const char *detail = vpx_codec_error_detail(&encoder_);
|
||||
return detail ? detail : vpx_codec_error(&encoder_);
|
||||
@ -145,22 +157,19 @@ class Encoder {
|
||||
// classes directly, so that tests can be parameterized differently.
|
||||
class EncoderTest {
|
||||
protected:
|
||||
EncoderTest() : abort_(false), init_flags_(0), frame_flags_(0),
|
||||
last_pts_(0) {}
|
||||
explicit EncoderTest(const CodecFactory *codec)
|
||||
: codec_(codec), abort_(false), init_flags_(0), frame_flags_(0),
|
||||
last_pts_(0) {}
|
||||
|
||||
virtual ~EncoderTest() {}
|
||||
|
||||
// Initialize the cfg_ member with the default configuration.
|
||||
void InitializeConfig() {
|
||||
const vpx_codec_err_t res = vpx_codec_enc_config_default(
|
||||
&vpx_codec_vp8_cx_algo, &cfg_, 0);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res);
|
||||
}
|
||||
void InitializeConfig();
|
||||
|
||||
// Map the TestMode enum to the deadline_ and passes_ variables.
|
||||
void SetMode(TestMode mode);
|
||||
|
||||
// Main loop.
|
||||
// Main loop
|
||||
virtual void RunLoop(VideoSource *video);
|
||||
|
||||
// Hook to be called at the beginning of a pass.
|
||||
@ -182,6 +191,24 @@ class EncoderTest {
|
||||
// Hook to determine whether the encode loop should continue.
|
||||
virtual bool Continue() const { return !abort_; }
|
||||
|
||||
const CodecFactory *codec_;
|
||||
// Hook to determine whether to decode frame after encoding
|
||||
virtual bool DoDecode() const { return 1; }
|
||||
|
||||
// Hook to handle encode/decode mismatch
|
||||
virtual void MismatchHook(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2);
|
||||
|
||||
// Hook to be called on every decompressed frame.
|
||||
virtual void DecompressedFrameHook(const vpx_image_t& img,
|
||||
vpx_codec_pts_t pts) {}
|
||||
|
||||
// Hook that can modify the encoder's output data
|
||||
virtual const vpx_codec_cx_pkt_t * MutateEncoderOutputHook(
|
||||
const vpx_codec_cx_pkt_t *pkt) {
|
||||
return pkt;
|
||||
}
|
||||
|
||||
bool abort_;
|
||||
vpx_codec_enc_cfg_t cfg_;
|
||||
unsigned int passes_;
|
||||
|
@ -7,22 +7,37 @@
|
||||
in the file PATENTS. All contributing project authors may
|
||||
be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#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 ErrorResilienceTest : public libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<int> {
|
||||
const int kMaxErrorFrames = 8;
|
||||
const int kMaxDroppableFrames = 8;
|
||||
|
||||
class ErrorResilienceTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
ErrorResilienceTest() {
|
||||
psnr_ = 0.0;
|
||||
nframes_ = 0;
|
||||
encoding_mode_ = static_cast<libvpx_test::TestMode>(GetParam());
|
||||
ErrorResilienceTest() : EncoderTest(GET_PARAM(0)),
|
||||
psnr_(0.0),
|
||||
nframes_(0),
|
||||
mismatch_psnr_(0.0),
|
||||
mismatch_nframes_(0),
|
||||
encoding_mode_(GET_PARAM(1)) {
|
||||
Reset();
|
||||
}
|
||||
|
||||
virtual ~ErrorResilienceTest() {}
|
||||
|
||||
void Reset() {
|
||||
error_nframes_ = 0;
|
||||
droppable_nframes_ = 0;
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(encoding_mode_);
|
||||
@ -31,6 +46,8 @@ class ErrorResilienceTest : public libvpx_test::EncoderTest,
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
psnr_ = 0.0;
|
||||
nframes_ = 0;
|
||||
mismatch_psnr_ = 0.0;
|
||||
mismatch_nframes_ = 0;
|
||||
}
|
||||
|
||||
virtual bool Continue() const {
|
||||
@ -42,15 +59,92 @@ class ErrorResilienceTest : public libvpx_test::EncoderTest,
|
||||
nframes_++;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video) {
|
||||
frame_flags_ &= ~(VP8_EFLAG_NO_UPD_LAST |
|
||||
VP8_EFLAG_NO_UPD_GF |
|
||||
VP8_EFLAG_NO_UPD_ARF);
|
||||
if (droppable_nframes_ > 0 &&
|
||||
(cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
|
||||
for (unsigned int i = 0; i < droppable_nframes_; ++i) {
|
||||
if (droppable_frames_[i] == nframes_) {
|
||||
std::cout << " Encoding droppable frame: "
|
||||
<< droppable_frames_[i] << "\n";
|
||||
frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST |
|
||||
VP8_EFLAG_NO_UPD_GF |
|
||||
VP8_EFLAG_NO_UPD_ARF);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double GetAveragePsnr() const {
|
||||
if (nframes_)
|
||||
return psnr_ / nframes_;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double GetAverageMismatchPsnr() const {
|
||||
if (mismatch_nframes_)
|
||||
return mismatch_psnr_ / mismatch_nframes_;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
virtual bool DoDecode() const {
|
||||
if (error_nframes_ > 0 &&
|
||||
(cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
|
||||
for (unsigned int i = 0; i < error_nframes_; ++i) {
|
||||
if (error_frames_[i] == nframes_ - 1) {
|
||||
std::cout << " Skipping decoding frame: "
|
||||
<< error_frames_[i] << "\n";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual void MismatchHook(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2) {
|
||||
double mismatch_psnr = compute_psnr(img1, img2);
|
||||
mismatch_psnr_ += mismatch_psnr;
|
||||
++mismatch_nframes_;
|
||||
// std::cout << "Mismatch frame psnr: " << mismatch_psnr << "\n";
|
||||
}
|
||||
|
||||
void SetErrorFrames(int num, unsigned int *list) {
|
||||
if (num > kMaxErrorFrames)
|
||||
num = kMaxErrorFrames;
|
||||
else if (num < 0)
|
||||
num = 0;
|
||||
error_nframes_ = num;
|
||||
for (unsigned int i = 0; i < error_nframes_; ++i)
|
||||
error_frames_[i] = list[i];
|
||||
}
|
||||
|
||||
void SetDroppableFrames(int num, unsigned int *list) {
|
||||
if (num > kMaxDroppableFrames)
|
||||
num = kMaxDroppableFrames;
|
||||
else if (num < 0)
|
||||
num = 0;
|
||||
droppable_nframes_ = num;
|
||||
for (unsigned int i = 0; i < droppable_nframes_; ++i)
|
||||
droppable_frames_[i] = list[i];
|
||||
}
|
||||
|
||||
unsigned int GetMismatchFrames() {
|
||||
return mismatch_nframes_;
|
||||
}
|
||||
|
||||
private:
|
||||
double psnr_;
|
||||
unsigned int nframes_;
|
||||
unsigned int error_nframes_;
|
||||
unsigned int droppable_nframes_;
|
||||
double mismatch_psnr_;
|
||||
unsigned int mismatch_nframes_;
|
||||
unsigned int error_frames_[kMaxErrorFrames];
|
||||
unsigned int droppable_frames_[kMaxDroppableFrames];
|
||||
libvpx_test::TestMode encoding_mode_;
|
||||
};
|
||||
|
||||
@ -85,6 +179,49 @@ TEST_P(ErrorResilienceTest, OnVersusOff) {
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(OnOffTest, ErrorResilienceTest,
|
||||
ONE_PASS_TEST_MODES);
|
||||
TEST_P(ErrorResilienceTest, DropFramesWithoutRecovery) {
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = 500;
|
||||
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
|
||||
libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
timebase.den, timebase.num, 0, 30);
|
||||
|
||||
// Error resilient mode ON.
|
||||
cfg_.g_error_resilient = 1;
|
||||
|
||||
// Set an arbitrary set of error frames same as droppable frames
|
||||
unsigned int num_droppable_frames = 2;
|
||||
unsigned int droppable_frame_list[] = {5, 16};
|
||||
SetDroppableFrames(num_droppable_frames, droppable_frame_list);
|
||||
SetErrorFrames(num_droppable_frames, droppable_frame_list);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
// Test that no mismatches have been found
|
||||
std::cout << " Mismatch frames: "
|
||||
<< GetMismatchFrames() << "\n";
|
||||
EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
|
||||
|
||||
// reset previously set error/droppable frames
|
||||
Reset();
|
||||
|
||||
// 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
|
||||
// with mismatch.
|
||||
const double psnr_resilience_mismatch = GetAverageMismatchPsnr();
|
||||
std::cout << " Mismatch PSNR: "
|
||||
<< psnr_resilience_mismatch << "\n";
|
||||
EXPECT_GT(psnr_resilience_mismatch, 20.0);
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES);
|
||||
VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES);
|
||||
|
||||
} // namespace
|
||||
|
@ -25,7 +25,7 @@ using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(Vp9FdctTest, SignBiasCheck) {
|
||||
TEST(Vp9Fdct4x4Test, SignBiasCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int16_t test_input_block[16];
|
||||
int16_t test_output_block[16];
|
||||
@ -88,7 +88,7 @@ TEST(Vp9FdctTest, SignBiasCheck) {
|
||||
}
|
||||
};
|
||||
|
||||
TEST(Vp9FdctTest, RoundTripErrorCheck) {
|
||||
TEST(Vp9Fdct4x4Test, RoundTripErrorCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int max_error = 0;
|
||||
double total_error = 0;
|
||||
@ -120,7 +120,7 @@ TEST(Vp9FdctTest, RoundTripErrorCheck) {
|
||||
}
|
||||
|
||||
// Because the bitstream is not frozen yet, use the idct in the codebase.
|
||||
vp9_short_idct4x4llm_c(test_temp_block, test_output_block, pitch);
|
||||
vp9_short_idct4x4_c(test_temp_block, test_output_block, pitch);
|
||||
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
const int diff = test_input_block[j] - test_output_block[j];
|
||||
|
@ -149,7 +149,7 @@ TEST(VP9Fdct8x8Test, ExtremalCheck) {
|
||||
|
||||
// Initialize a test block with input range {-255, 255}.
|
||||
for (int j = 0; j < 64; ++j)
|
||||
test_input_block[j] = rnd.Rand8() % 2 ? 255 : -255;
|
||||
test_input_block[j] = rnd.Rand8() % 2 ? 255 : -256;
|
||||
|
||||
const int pitch = 16;
|
||||
vp9_short_fdct8x8_c(test_input_block, test_temp_block, pitch);
|
||||
|
@ -120,31 +120,6 @@ TEST(VP9Idct8x8Test, AccuracyCheck) {
|
||||
input[j] = rnd.Rand8() - rnd.Rand8();
|
||||
|
||||
const int pitch = 16;
|
||||
vp9_short_fdct8x8_c(input, output_c, pitch);
|
||||
reference_dct_2d(input, output_r);
|
||||
|
||||
for (int j = 0; j < 64; ++j) {
|
||||
const double diff = output_c[j] - output_r[j];
|
||||
const double error = diff * diff;
|
||||
// An error in a DCT coefficient isn't that bad.
|
||||
// We care more about the reconstructed pixels.
|
||||
EXPECT_GE(2.0, error)
|
||||
<< "Error: 8x8 FDCT/IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Tests that the reference iDCT and fDCT match.
|
||||
reference_dct_2d(input, output_r);
|
||||
reference_idct_2d(output_r, output_c);
|
||||
for (int j = 0; j < 64; ++j) {
|
||||
const int diff = output_c[j] -input[j];
|
||||
const int error = diff * diff;
|
||||
EXPECT_EQ(0, error)
|
||||
<< "Error: 8x8 FDCT/IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
#endif
|
||||
reference_dct_2d(input, output_r);
|
||||
for (int j = 0; j < 64; ++j)
|
||||
coeff[j] = round(output_r[j]);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include "vpx_config.h"
|
||||
#include "vp8_rtcd.h"
|
||||
#include "./vpx_config.h"
|
||||
#include "./vp8_rtcd.h"
|
||||
}
|
||||
#include "test/register_state_check.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
@ -20,18 +20,16 @@ typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr,
|
||||
int pred_stride, unsigned char *dst_ptr,
|
||||
int dst_stride);
|
||||
namespace {
|
||||
class IDCTTest : public ::testing::TestWithParam<idct_fn_t>
|
||||
{
|
||||
class IDCTTest : public ::testing::TestWithParam<idct_fn_t> {
|
||||
protected:
|
||||
virtual void SetUp()
|
||||
{
|
||||
virtual void SetUp() {
|
||||
int i;
|
||||
|
||||
UUT = GetParam();
|
||||
memset(input, 0, sizeof(input));
|
||||
/* Set up guard blocks */
|
||||
for(i=0; i<256; i++)
|
||||
output[i] = ((i&0xF)<4&&(i<64))?0:-1;
|
||||
for (i = 0; i < 256; i++)
|
||||
output[i] = ((i & 0xF) < 4 && (i < 64)) ? 0 : -1;
|
||||
}
|
||||
|
||||
idct_fn_t UUT;
|
||||
@ -40,78 +38,72 @@ class IDCTTest : public ::testing::TestWithParam<idct_fn_t>
|
||||
unsigned char predict[256];
|
||||
};
|
||||
|
||||
TEST_P(IDCTTest, TestGuardBlocks)
|
||||
{
|
||||
TEST_P(IDCTTest, TestGuardBlocks) {
|
||||
int i;
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) < 4 && i<64)
|
||||
for (i = 0; i < 256; i++)
|
||||
if ((i & 0xF) < 4 && i < 64)
|
||||
EXPECT_EQ(0, output[i]) << i;
|
||||
else
|
||||
EXPECT_EQ(255, output[i]);
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestAllZeros)
|
||||
{
|
||||
TEST_P(IDCTTest, TestAllZeros) {
|
||||
int i;
|
||||
|
||||
REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) < 4 && i<64)
|
||||
for (i = 0; i < 256; i++)
|
||||
if ((i & 0xF) < 4 && i < 64)
|
||||
EXPECT_EQ(0, output[i]) << "i==" << i;
|
||||
else
|
||||
EXPECT_EQ(255, output[i]) << "i==" << i;
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestAllOnes)
|
||||
{
|
||||
TEST_P(IDCTTest, TestAllOnes) {
|
||||
int i;
|
||||
|
||||
input[0] = 4;
|
||||
REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) < 4 && i<64)
|
||||
for (i = 0; i < 256; i++)
|
||||
if ((i & 0xF) < 4 && i < 64)
|
||||
EXPECT_EQ(1, output[i]) << "i==" << i;
|
||||
else
|
||||
EXPECT_EQ(255, output[i]) << "i==" << i;
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestAddOne)
|
||||
{
|
||||
TEST_P(IDCTTest, TestAddOne) {
|
||||
int i;
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
for (i = 0; i < 256; i++)
|
||||
predict[i] = i;
|
||||
|
||||
input[0] = 4;
|
||||
REGISTER_STATE_CHECK(UUT(input, predict, 16, output, 16));
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) < 4 && i<64)
|
||||
for (i = 0; i < 256; i++)
|
||||
if ((i & 0xF) < 4 && i < 64)
|
||||
EXPECT_EQ(i+1, output[i]) << "i==" << i;
|
||||
else
|
||||
EXPECT_EQ(255, output[i]) << "i==" << i;
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestWithData)
|
||||
{
|
||||
TEST_P(IDCTTest, TestWithData) {
|
||||
int i;
|
||||
|
||||
for(i=0; i<16; i++)
|
||||
for (i = 0; i < 16; i++)
|
||||
input[i] = i;
|
||||
|
||||
REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) > 3 || i>63)
|
||||
for (i = 0; i < 256; i++)
|
||||
if ((i & 0xF) > 3 || i > 63)
|
||||
EXPECT_EQ(255, output[i]) << "i==" << i;
|
||||
else if(i == 0)
|
||||
else if (i == 0)
|
||||
EXPECT_EQ(11, output[i]) << "i==" << i;
|
||||
else if(i == 34)
|
||||
else if (i == 34)
|
||||
EXPECT_EQ(1, output[i]) << "i==" << i;
|
||||
else if(i == 2 || i == 17 || i == 32)
|
||||
else if (i == 2 || i == 17 || i == 32)
|
||||
EXPECT_EQ(3, output[i]) << "i==" << i;
|
||||
else
|
||||
EXPECT_EQ(0, output[i]) << "i==" << i;
|
@ -9,18 +9,22 @@
|
||||
*/
|
||||
#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 "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class KeyframeTest : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<enum libvpx_test::TestMode> {
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
KeyframeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GetParam());
|
||||
SetMode(GET_PARAM(1));
|
||||
kf_count_ = 0;
|
||||
kf_count_max_ = INT_MAX;
|
||||
kf_do_force_kf_ = false;
|
||||
@ -64,7 +68,7 @@ TEST_P(KeyframeTest, TestRandomVideoSource) {
|
||||
|
||||
// In realtime mode - auto placed keyframes are exceedingly rare, don't
|
||||
// bother with this check if(GetParam() > 0)
|
||||
if(GetParam() > 0)
|
||||
if (GET_PARAM(1) > 0)
|
||||
EXPECT_GT(kf_count_, 1);
|
||||
}
|
||||
|
||||
@ -126,7 +130,7 @@ TEST_P(KeyframeTest, TestAutoKeyframe) {
|
||||
|
||||
// In realtime mode - auto placed keyframes are exceedingly rare, don't
|
||||
// bother with this check
|
||||
if(GetParam() > 0)
|
||||
if (GET_PARAM(1) > 0)
|
||||
EXPECT_EQ(2u, kf_pts_list_.size()) << " Not the right number of keyframes ";
|
||||
|
||||
// Verify that keyframes match the file keyframes in the file.
|
||||
@ -141,5 +145,5 @@ TEST_P(KeyframeTest, TestAutoKeyframe) {
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllModes, KeyframeTest, ALL_TEST_MODES);
|
||||
VP8_INSTANTIATE_TEST_CASE(KeyframeTest, ALL_TEST_MODES);
|
||||
} // namespace
|
||||
|
64
test/md5_helper.h
Normal file
64
test/md5_helper.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBVPX_TEST_MD5_HELPER_H_
|
||||
#define LIBVPX_TEST_MD5_HELPER_H_
|
||||
|
||||
extern "C" {
|
||||
#include "./md5_utils.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
}
|
||||
|
||||
namespace libvpx_test {
|
||||
class MD5 {
|
||||
public:
|
||||
MD5() {
|
||||
MD5Init(&md5_);
|
||||
}
|
||||
|
||||
void Add(const vpx_image_t *img) {
|
||||
for (int plane = 0; plane < 3; ++plane) {
|
||||
uint8_t *buf = img->planes[plane];
|
||||
const int h = plane ? (img->d_h + 1) >> 1 : img->d_h;
|
||||
const int w = plane ? (img->d_w + 1) >> 1 : img->d_w;
|
||||
|
||||
for (int y = 0; y < h; ++y) {
|
||||
MD5Update(&md5_, buf, w);
|
||||
buf += img->stride[plane];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *Get(void) {
|
||||
static const char hex[16] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
};
|
||||
uint8_t tmp[16];
|
||||
MD5Context ctx_tmp = md5_;
|
||||
|
||||
MD5Final(tmp, &ctx_tmp);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
res_[i * 2 + 0] = hex[tmp[i] >> 4];
|
||||
res_[i * 2 + 1] = hex[tmp[i] & 0xf];
|
||||
}
|
||||
res_[32] = 0;
|
||||
|
||||
return res_;
|
||||
}
|
||||
|
||||
protected:
|
||||
char res_[33];
|
||||
MD5Context md5_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // LIBVPX_TEST_MD5_HELPER_H_
|
@ -9,9 +9,12 @@
|
||||
*/
|
||||
#include <climits>
|
||||
#include <vector>
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/video_source.h"
|
||||
#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/video_source.h"
|
||||
#include "test/util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -49,8 +52,10 @@ class ResizingVideoSource : public ::libvpx_test::DummyVideoSource {
|
||||
};
|
||||
|
||||
class ResizeTest : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<enum libvpx_test::TestMode> {
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
ResizeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
|
||||
struct FrameInfo {
|
||||
FrameInfo(vpx_codec_pts_t _pts, unsigned int _w, unsigned int _h)
|
||||
: pts(_pts), w(_w), h(_h) {}
|
||||
@ -62,22 +67,16 @@ class ResizeTest : public ::libvpx_test::EncoderTest,
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GetParam());
|
||||
SetMode(GET_PARAM(1));
|
||||
}
|
||||
|
||||
virtual bool Continue() const {
|
||||
return !HasFatalFailure() && !abort_;
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
|
||||
const unsigned char *buf =
|
||||
reinterpret_cast<const unsigned char *>(pkt->data.frame.buf);
|
||||
const unsigned int w = (buf[6] | (buf[7] << 8)) & 0x3fff;
|
||||
const unsigned int h = (buf[8] | (buf[9] << 8)) & 0x3fff;
|
||||
|
||||
frame_info_list_.push_back(FrameInfo(pkt->data.frame.pts, w, h));
|
||||
}
|
||||
virtual void DecompressedFrameHook(const vpx_image_t &img,
|
||||
vpx_codec_pts_t pts) {
|
||||
frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
|
||||
}
|
||||
|
||||
std::vector< FrameInfo > frame_info_list_;
|
||||
@ -100,5 +99,53 @@ TEST_P(ResizeTest, TestExternalResizeWorks) {
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(OnePass, ResizeTest, ONE_PASS_TEST_MODES);
|
||||
class ResizeInternalTest : public ResizeTest {
|
||||
protected:
|
||||
ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
if (video->frame() == 3) {
|
||||
struct vpx_scaling_mode mode = {VP8E_FOURFIVE, VP8E_THREEFIVE};
|
||||
encoder->Control(VP8E_SET_SCALEMODE, &mode);
|
||||
}
|
||||
if (video->frame() == 6) {
|
||||
struct vpx_scaling_mode mode = {VP8E_NORMAL, VP8E_NORMAL};
|
||||
encoder->Control(VP8E_SET_SCALEMODE, &mode);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (!frame0_psnr_)
|
||||
frame0_psnr_ = pkt->data.psnr.psnr[0];
|
||||
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 1.0);
|
||||
}
|
||||
|
||||
double frame0_psnr_;
|
||||
};
|
||||
|
||||
TEST_P(ResizeInternalTest, TestInternalResizeWorks) {
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, 10);
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
// q picked such that initial keyframe on this clip is ~30dB PSNR
|
||||
cfg_.rc_min_quantizer = cfg_.rc_max_quantizer = 48;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
for (std::vector<FrameInfo>::iterator info = frame_info_list_.begin();
|
||||
info != frame_info_list_.end(); ++info) {
|
||||
const vpx_codec_pts_t pts = info->pts;
|
||||
if (pts >= 3 && pts < 6) {
|
||||
ASSERT_EQ(282U, info->w) << "Frame " << pts << " had unexpected width";
|
||||
ASSERT_EQ(173U, info->h) << "Frame " << pts << " had unexpected height";
|
||||
} else {
|
||||
EXPECT_EQ(352U, info->w) << "Frame " << pts << " had unexpected width";
|
||||
EXPECT_EQ(288U, info->h) << "Frame " << pts << " had unexpected height";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(ResizeTest, ONE_PASS_TEST_MODES);
|
||||
VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest,
|
||||
::testing::Values(::libvpx_test::kOnePassBest));
|
||||
} // namespace
|
||||
|
304
test/sad_test.cc
304
test/sad_test.cc
@ -15,8 +15,13 @@
|
||||
|
||||
extern "C" {
|
||||
#include "./vpx_config.h"
|
||||
#if CONFIG_VP8_ENCODER
|
||||
#include "./vp8_rtcd.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
//#include "vp8/common/blockd.h"
|
||||
#endif
|
||||
#if CONFIG_VP9_ENCODER
|
||||
#include "./vp9_rtcd.h"
|
||||
#endif
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
}
|
||||
|
||||
@ -32,14 +37,22 @@ typedef unsigned int (*sad_m_by_n_fn_t)(const unsigned char *source_ptr,
|
||||
int reference_stride,
|
||||
unsigned int max_sad);
|
||||
|
||||
typedef void (*sad_n_by_n_by_4_fn_t)(const uint8_t *src_ptr,
|
||||
int src_stride,
|
||||
const unsigned char * const ref_ptr[],
|
||||
int ref_stride,
|
||||
unsigned int *sad_array);
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
class SADTest : public PARAMS(int, int, sad_m_by_n_fn_t) {
|
||||
class SADTestBase : public ::testing::Test {
|
||||
public:
|
||||
SADTestBase(int width, int height) : width_(width), height_(height) {}
|
||||
|
||||
static void SetUpTestCase() {
|
||||
source_data_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
vpx_memalign(kDataAlignment, kDataBlockSize));
|
||||
reference_data_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
}
|
||||
@ -52,36 +65,31 @@ class SADTest : public PARAMS(int, int, sad_m_by_n_fn_t) {
|
||||
}
|
||||
|
||||
protected:
|
||||
// Handle blocks up to 4 blocks 64x64 with stride up to 128
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kDataBufferSize = 16 * 32;
|
||||
static const int kDataBlockSize = 64 * 128;
|
||||
static const int kDataBufferSize = 4 * kDataBlockSize;
|
||||
|
||||
virtual void SetUp() {
|
||||
sad_fn_ = GET_PARAM(2);
|
||||
height_ = GET_PARAM(1);
|
||||
width_ = GET_PARAM(0);
|
||||
source_stride_ = width_ * 2;
|
||||
source_stride_ = (width_ + 31) & ~31;
|
||||
reference_stride_ = width_ * 2;
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
}
|
||||
|
||||
sad_m_by_n_fn_t sad_fn_;
|
||||
virtual unsigned int SAD(unsigned int max_sad) {
|
||||
unsigned int ret;
|
||||
REGISTER_STATE_CHECK(ret = sad_fn_(source_data_, source_stride_,
|
||||
reference_data_, reference_stride_,
|
||||
max_sad));
|
||||
return ret;
|
||||
virtual uint8_t* GetReference(int block_idx) {
|
||||
return reference_data_ + block_idx * kDataBlockSize;
|
||||
}
|
||||
|
||||
// Sum of Absolute Differences. Given two blocks, calculate the absolute
|
||||
// difference between two pixels in the same relative location; accumulate.
|
||||
unsigned int ReferenceSAD(unsigned int max_sad) {
|
||||
unsigned int ReferenceSAD(unsigned int max_sad, int block_idx = 0) {
|
||||
unsigned int sad = 0;
|
||||
const uint8_t* const reference = GetReference(block_idx);
|
||||
|
||||
for (int h = 0; h < height_; ++h) {
|
||||
for (int w = 0; w < width_; ++w) {
|
||||
sad += abs(source_data_[h * source_stride_ + w]
|
||||
- reference_data_[h * reference_stride_ + w]);
|
||||
- reference[h * reference_stride_ + w]);
|
||||
}
|
||||
if (sad > max_sad) {
|
||||
break;
|
||||
@ -106,6 +114,32 @@ class SADTest : public PARAMS(int, int, sad_m_by_n_fn_t) {
|
||||
}
|
||||
}
|
||||
|
||||
int width_, height_;
|
||||
static uint8_t* source_data_;
|
||||
int source_stride_;
|
||||
static uint8_t* reference_data_;
|
||||
int reference_stride_;
|
||||
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
||||
class SADTest : public SADTestBase,
|
||||
public ::testing::WithParamInterface<
|
||||
std::tr1::tuple<int, int, sad_m_by_n_fn_t> > {
|
||||
public:
|
||||
SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {}
|
||||
|
||||
protected:
|
||||
unsigned int SAD(unsigned int max_sad, int block_idx = 0) {
|
||||
unsigned int ret;
|
||||
const uint8_t* const reference = GetReference(block_idx);
|
||||
|
||||
REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
|
||||
reference, reference_stride_,
|
||||
max_sad));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CheckSad(unsigned int max_sad) {
|
||||
unsigned int reference_sad, exp_sad;
|
||||
|
||||
@ -119,19 +153,38 @@ class SADTest : public PARAMS(int, int, sad_m_by_n_fn_t) {
|
||||
ASSERT_GE(exp_sad, reference_sad);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle blocks up to 16x16 with stride up to 32
|
||||
int height_, width_;
|
||||
static uint8_t* source_data_;
|
||||
int source_stride_;
|
||||
static uint8_t* reference_data_;
|
||||
int reference_stride_;
|
||||
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
||||
uint8_t* SADTest::source_data_ = NULL;
|
||||
uint8_t* SADTest::reference_data_ = NULL;
|
||||
class SADx4Test : public SADTestBase,
|
||||
public ::testing::WithParamInterface<
|
||||
std::tr1::tuple<int, int, sad_n_by_n_by_4_fn_t> > {
|
||||
public:
|
||||
SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {}
|
||||
|
||||
protected:
|
||||
void SADs(unsigned int *results) {
|
||||
const uint8_t* refs[] = {GetReference(0), GetReference(1),
|
||||
GetReference(2), GetReference(3)};
|
||||
|
||||
REGISTER_STATE_CHECK(GET_PARAM(2)(source_data_, source_stride_,
|
||||
refs, reference_stride_,
|
||||
results));
|
||||
}
|
||||
|
||||
void CheckSADs() {
|
||||
unsigned int reference_sad, exp_sad[4];
|
||||
|
||||
SADs(exp_sad);
|
||||
for (int block = 0; block < 4; block++) {
|
||||
reference_sad = ReferenceSAD(UINT_MAX, block);
|
||||
|
||||
EXPECT_EQ(exp_sad[block], reference_sad) << "block " << block;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
uint8_t* SADTestBase::source_data_ = NULL;
|
||||
uint8_t* SADTestBase::reference_data_ = NULL;
|
||||
|
||||
TEST_P(SADTest, MaxRef) {
|
||||
FillConstant(source_data_, source_stride_, 0);
|
||||
@ -139,12 +192,30 @@ TEST_P(SADTest, MaxRef) {
|
||||
CheckSad(UINT_MAX);
|
||||
}
|
||||
|
||||
TEST_P(SADx4Test, MaxRef) {
|
||||
FillConstant(source_data_, source_stride_, 0);
|
||||
FillConstant(GetReference(0), reference_stride_, 255);
|
||||
FillConstant(GetReference(1), reference_stride_, 255);
|
||||
FillConstant(GetReference(2), reference_stride_, 255);
|
||||
FillConstant(GetReference(3), reference_stride_, 255);
|
||||
CheckSADs();
|
||||
}
|
||||
|
||||
TEST_P(SADTest, MaxSrc) {
|
||||
FillConstant(source_data_, source_stride_, 255);
|
||||
FillConstant(reference_data_, reference_stride_, 0);
|
||||
CheckSad(UINT_MAX);
|
||||
}
|
||||
|
||||
TEST_P(SADx4Test, MaxSrc) {
|
||||
FillConstant(source_data_, source_stride_, 255);
|
||||
FillConstant(GetReference(0), reference_stride_, 0);
|
||||
FillConstant(GetReference(1), reference_stride_, 0);
|
||||
FillConstant(GetReference(2), reference_stride_, 0);
|
||||
FillConstant(GetReference(3), reference_stride_, 0);
|
||||
CheckSADs();
|
||||
}
|
||||
|
||||
TEST_P(SADTest, ShortRef) {
|
||||
int tmp_stride = reference_stride_;
|
||||
reference_stride_ >>= 1;
|
||||
@ -154,6 +225,18 @@ TEST_P(SADTest, ShortRef) {
|
||||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADx4Test, ShortRef) {
|
||||
int tmp_stride = reference_stride_;
|
||||
reference_stride_ >>= 1;
|
||||
FillRandom(source_data_, source_stride_);
|
||||
FillRandom(GetReference(0), reference_stride_);
|
||||
FillRandom(GetReference(1), reference_stride_);
|
||||
FillRandom(GetReference(2), reference_stride_);
|
||||
FillRandom(GetReference(3), reference_stride_);
|
||||
CheckSADs();
|
||||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADTest, UnalignedRef) {
|
||||
// The reference frame, but not the source frame, may be unaligned for
|
||||
// certain types of searches.
|
||||
@ -165,6 +248,20 @@ TEST_P(SADTest, UnalignedRef) {
|
||||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADx4Test, UnalignedRef) {
|
||||
// The reference frame, but not the source frame, may be unaligned for
|
||||
// certain types of searches.
|
||||
int tmp_stride = reference_stride_;
|
||||
reference_stride_ -= 1;
|
||||
FillRandom(source_data_, source_stride_);
|
||||
FillRandom(GetReference(0), reference_stride_);
|
||||
FillRandom(GetReference(1), reference_stride_);
|
||||
FillRandom(GetReference(2), reference_stride_);
|
||||
FillRandom(GetReference(3), reference_stride_);
|
||||
CheckSADs();
|
||||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADTest, ShortSrc) {
|
||||
int tmp_stride = source_stride_;
|
||||
source_stride_ >>= 1;
|
||||
@ -174,6 +271,18 @@ TEST_P(SADTest, ShortSrc) {
|
||||
source_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADx4Test, ShortSrc) {
|
||||
int tmp_stride = source_stride_;
|
||||
source_stride_ >>= 1;
|
||||
FillRandom(source_data_, source_stride_);
|
||||
FillRandom(GetReference(0), reference_stride_);
|
||||
FillRandom(GetReference(1), reference_stride_);
|
||||
FillRandom(GetReference(2), reference_stride_);
|
||||
FillRandom(GetReference(3), reference_stride_);
|
||||
CheckSADs();
|
||||
source_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADTest, MaxSAD) {
|
||||
// Verify that, when max_sad is set, the implementation does not return a
|
||||
// value lower than the reference.
|
||||
@ -184,17 +293,61 @@ TEST_P(SADTest, MaxSAD) {
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_VP8_ENCODER && CONFIG_VP9_ENCODER
|
||||
#define VP8_VP9_SEPARATOR ,
|
||||
#else
|
||||
#define VP8_VP9_SEPARATOR
|
||||
#endif
|
||||
|
||||
#if CONFIG_VP8_ENCODER
|
||||
const sad_m_by_n_fn_t sad_16x16_c = vp8_sad16x16_c;
|
||||
const sad_m_by_n_fn_t sad_8x16_c = vp8_sad8x16_c;
|
||||
const sad_m_by_n_fn_t sad_16x8_c = vp8_sad16x8_c;
|
||||
const sad_m_by_n_fn_t sad_8x8_c = vp8_sad8x8_c;
|
||||
const sad_m_by_n_fn_t sad_4x4_c = vp8_sad4x4_c;
|
||||
#endif
|
||||
#if CONFIG_VP9_ENCODER
|
||||
const sad_m_by_n_fn_t sad_64x64_c_vp9 = vp9_sad64x64_c;
|
||||
const sad_m_by_n_fn_t sad_32x32_c_vp9 = vp9_sad32x32_c;
|
||||
const sad_m_by_n_fn_t sad_16x16_c_vp9 = vp9_sad16x16_c;
|
||||
const sad_m_by_n_fn_t sad_8x16_c_vp9 = vp9_sad8x16_c;
|
||||
const sad_m_by_n_fn_t sad_16x8_c_vp9 = vp9_sad16x8_c;
|
||||
const sad_m_by_n_fn_t sad_8x8_c_vp9 = vp9_sad8x8_c;
|
||||
const sad_m_by_n_fn_t sad_4x4_c_vp9 = vp9_sad4x4_c;
|
||||
#endif
|
||||
INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::Values(
|
||||
#if CONFIG_VP8_ENCODER
|
||||
make_tuple(16, 16, sad_16x16_c),
|
||||
make_tuple(8, 16, sad_8x16_c),
|
||||
make_tuple(16, 8, sad_16x8_c),
|
||||
make_tuple(8, 8, sad_8x8_c),
|
||||
make_tuple(4, 4, sad_4x4_c)));
|
||||
make_tuple(4, 4, sad_4x4_c)
|
||||
#endif
|
||||
VP8_VP9_SEPARATOR
|
||||
#if CONFIG_VP9_ENCODER
|
||||
make_tuple(64, 64, sad_64x64_c_vp9),
|
||||
make_tuple(32, 32, sad_32x32_c_vp9),
|
||||
make_tuple(16, 16, sad_16x16_c_vp9),
|
||||
make_tuple(8, 16, sad_8x16_c_vp9),
|
||||
make_tuple(16, 8, sad_16x8_c_vp9),
|
||||
make_tuple(8, 8, sad_8x8_c_vp9),
|
||||
make_tuple(4, 4, sad_4x4_c_vp9)
|
||||
#endif
|
||||
));
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
const sad_n_by_n_by_4_fn_t sad_64x64x4d_c = vp9_sad64x64x4d_c;
|
||||
const sad_n_by_n_by_4_fn_t sad_32x32x4d_c = vp9_sad32x32x4d_c;
|
||||
const sad_n_by_n_by_4_fn_t sad_16x16x4d_c = vp9_sad16x16x4d_c;
|
||||
const sad_n_by_n_by_4_fn_t sad_8x8x4d_c = vp9_sad8x8x4d_c;
|
||||
const sad_n_by_n_by_4_fn_t sad_4x4x4d_c = vp9_sad4x4x4d_c;
|
||||
INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::Values(
|
||||
make_tuple(64, 64, sad_64x64x4d_c),
|
||||
make_tuple(32, 32, sad_32x32x4d_c),
|
||||
make_tuple(16, 16, sad_16x16x4d_c),
|
||||
make_tuple(8, 8, sad_8x8x4d_c),
|
||||
make_tuple(4, 4, sad_4x4x4d_c)));
|
||||
#endif
|
||||
|
||||
// ARM tests
|
||||
#if HAVE_MEDIA
|
||||
@ -219,31 +372,120 @@ INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::Values(
|
||||
|
||||
// X86 tests
|
||||
#if HAVE_MMX
|
||||
#if CONFIG_VP8_ENCODER
|
||||
const sad_m_by_n_fn_t sad_16x16_mmx = vp8_sad16x16_mmx;
|
||||
const sad_m_by_n_fn_t sad_8x16_mmx = vp8_sad8x16_mmx;
|
||||
const sad_m_by_n_fn_t sad_16x8_mmx = vp8_sad16x8_mmx;
|
||||
const sad_m_by_n_fn_t sad_8x8_mmx = vp8_sad8x8_mmx;
|
||||
const sad_m_by_n_fn_t sad_4x4_mmx = vp8_sad4x4_mmx;
|
||||
#endif
|
||||
#if CONFIG_VP9_ENCODER
|
||||
const sad_m_by_n_fn_t sad_16x16_mmx_vp9 = vp9_sad16x16_mmx;
|
||||
const sad_m_by_n_fn_t sad_8x16_mmx_vp9 = vp9_sad8x16_mmx;
|
||||
const sad_m_by_n_fn_t sad_16x8_mmx_vp9 = vp9_sad16x8_mmx;
|
||||
const sad_m_by_n_fn_t sad_8x8_mmx_vp9 = vp9_sad8x8_mmx;
|
||||
const sad_m_by_n_fn_t sad_4x4_mmx_vp9 = vp9_sad4x4_mmx;
|
||||
#endif
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MMX, SADTest, ::testing::Values(
|
||||
#if CONFIG_VP8_ENCODER
|
||||
make_tuple(16, 16, sad_16x16_mmx),
|
||||
make_tuple(8, 16, sad_8x16_mmx),
|
||||
make_tuple(16, 8, sad_16x8_mmx),
|
||||
make_tuple(8, 8, sad_8x8_mmx),
|
||||
make_tuple(4, 4, sad_4x4_mmx)));
|
||||
make_tuple(4, 4, sad_4x4_mmx)
|
||||
#endif
|
||||
VP8_VP9_SEPARATOR
|
||||
#if CONFIG_VP9_ENCODER
|
||||
make_tuple(16, 16, sad_16x16_mmx_vp9),
|
||||
make_tuple(8, 16, sad_8x16_mmx_vp9),
|
||||
make_tuple(16, 8, sad_16x8_mmx_vp9),
|
||||
make_tuple(8, 8, sad_8x8_mmx_vp9),
|
||||
make_tuple(4, 4, sad_4x4_mmx_vp9)
|
||||
#endif
|
||||
));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE
|
||||
#if CONFIG_VP9_ENCODER
|
||||
const sad_m_by_n_fn_t sad_4x4_sse_vp9 = vp9_sad4x4_sse;
|
||||
INSTANTIATE_TEST_CASE_P(SSE, SADTest, ::testing::Values(
|
||||
make_tuple(4, 4, sad_4x4_sse_vp9)));
|
||||
|
||||
const sad_n_by_n_by_4_fn_t sad_4x4x4d_sse = vp9_sad4x4x4d_sse;
|
||||
INSTANTIATE_TEST_CASE_P(SSE, SADx4Test, ::testing::Values(
|
||||
make_tuple(4, 4, sad_4x4x4d_sse)));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2
|
||||
#if CONFIG_VP8_ENCODER
|
||||
const sad_m_by_n_fn_t sad_16x16_wmt = vp8_sad16x16_wmt;
|
||||
const sad_m_by_n_fn_t sad_8x16_wmt = vp8_sad8x16_wmt;
|
||||
const sad_m_by_n_fn_t sad_16x8_wmt = vp8_sad16x8_wmt;
|
||||
const sad_m_by_n_fn_t sad_8x8_wmt = vp8_sad8x8_wmt;
|
||||
const sad_m_by_n_fn_t sad_4x4_wmt = vp8_sad4x4_wmt;
|
||||
#endif
|
||||
#if CONFIG_VP9_ENCODER
|
||||
const sad_m_by_n_fn_t sad_64x64_sse2_vp9 = vp9_sad64x64_sse2;
|
||||
const sad_m_by_n_fn_t sad_32x32_sse2_vp9 = vp9_sad32x32_sse2;
|
||||
const sad_m_by_n_fn_t sad_16x16_sse2_vp9 = vp9_sad16x16_sse2;
|
||||
const sad_m_by_n_fn_t sad_8x16_sse2_vp9 = vp9_sad8x16_sse2;
|
||||
const sad_m_by_n_fn_t sad_16x8_sse2_vp9 = vp9_sad16x8_sse2;
|
||||
const sad_m_by_n_fn_t sad_8x8_sse2_vp9 = vp9_sad8x8_sse2;
|
||||
#endif
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::Values(
|
||||
#if CONFIG_VP8_ENCODER
|
||||
make_tuple(16, 16, sad_16x16_wmt),
|
||||
make_tuple(8, 16, sad_8x16_wmt),
|
||||
make_tuple(16, 8, sad_16x8_wmt),
|
||||
make_tuple(8, 8, sad_8x8_wmt),
|
||||
make_tuple(4, 4, sad_4x4_wmt)));
|
||||
make_tuple(4, 4, sad_4x4_wmt)
|
||||
#endif
|
||||
VP8_VP9_SEPARATOR
|
||||
#if CONFIG_VP9_ENCODER
|
||||
make_tuple(64, 64, sad_64x64_sse2_vp9),
|
||||
make_tuple(32, 32, sad_32x32_sse2_vp9),
|
||||
make_tuple(16, 16, sad_16x16_sse2_vp9),
|
||||
make_tuple(8, 16, sad_8x16_sse2_vp9),
|
||||
make_tuple(16, 8, sad_16x8_sse2_vp9),
|
||||
make_tuple(8, 8, sad_8x8_sse2_vp9)
|
||||
#endif
|
||||
));
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
const sad_n_by_n_by_4_fn_t sad_64x64x4d_sse2 = vp9_sad64x64x4d_sse2;
|
||||
const sad_n_by_n_by_4_fn_t sad_32x32x4d_sse2 = vp9_sad32x32x4d_sse2;
|
||||
const sad_n_by_n_by_4_fn_t sad_16x16x4d_sse2 = vp9_sad16x16x4d_sse2;
|
||||
const sad_n_by_n_by_4_fn_t sad_16x8x4d_sse2 = vp9_sad16x8x4d_sse2;
|
||||
const sad_n_by_n_by_4_fn_t sad_8x16x4d_sse2 = vp9_sad8x16x4d_sse2;
|
||||
const sad_n_by_n_by_4_fn_t sad_8x8x4d_sse2 = vp9_sad8x8x4d_sse2;
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::Values(
|
||||
make_tuple(64, 64, sad_64x64x4d_sse2),
|
||||
make_tuple(32, 32, sad_32x32x4d_sse2),
|
||||
make_tuple(16, 16, sad_16x16x4d_sse2),
|
||||
make_tuple(16, 8, sad_16x8x4d_sse2),
|
||||
make_tuple(8, 16, sad_8x16x4d_sse2),
|
||||
make_tuple(8, 8, sad_8x8x4d_sse2)));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE3
|
||||
#if CONFIG_VP8_ENCODER
|
||||
const sad_n_by_n_by_4_fn_t sad_16x16x4d_sse3 = vp8_sad16x16x4d_sse3;
|
||||
const sad_n_by_n_by_4_fn_t sad_16x8x4d_sse3 = vp8_sad16x8x4d_sse3;
|
||||
const sad_n_by_n_by_4_fn_t sad_8x16x4d_sse3 = vp8_sad8x16x4d_sse3;
|
||||
const sad_n_by_n_by_4_fn_t sad_8x8x4d_sse3 = vp8_sad8x8x4d_sse3;
|
||||
const sad_n_by_n_by_4_fn_t sad_4x4x4d_sse3 = vp8_sad4x4x4d_sse3;
|
||||
INSTANTIATE_TEST_CASE_P(SSE3, SADx4Test, ::testing::Values(
|
||||
make_tuple(16, 16, sad_16x16x4d_sse3),
|
||||
make_tuple(16, 8, sad_16x8x4d_sse3),
|
||||
make_tuple(8, 16, sad_8x16x4d_sse3),
|
||||
make_tuple(8, 8, sad_8x8x4d_sse3),
|
||||
make_tuple(4, 4, sad_4x4x4d_sse3)));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_SSSE3
|
||||
const sad_m_by_n_fn_t sad_16x16_sse3 = vp8_sad16x16_sse3;
|
||||
INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values(
|
||||
|
100
test/superframe_test.cc
Normal file
100
test/superframe_test.cc
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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 "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 SuperframeTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
SuperframeTest() : EncoderTest(GET_PARAM(0)), modified_buf_(NULL),
|
||||
last_sf_pts_(0) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GET_PARAM(1));
|
||||
sf_count_ = 0;
|
||||
sf_count_max_ = INT_MAX;
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
delete modified_buf_;
|
||||
}
|
||||
|
||||
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_ENABLEAUTOALTREF, 1);
|
||||
}
|
||||
}
|
||||
|
||||
virtual const vpx_codec_cx_pkt_t * MutateEncoderOutputHook(
|
||||
const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)
|
||||
return pkt;
|
||||
|
||||
const uint8_t *buffer = reinterpret_cast<uint8_t*>(pkt->data.frame.buf);
|
||||
const uint8_t marker = buffer[pkt->data.frame.sz - 1];
|
||||
const int frames = (marker & 0x7) + 1;
|
||||
const int mag = ((marker >> 3) & 3) + 1;
|
||||
const unsigned int index_sz = 2 + mag * frames;
|
||||
if ((marker & 0xe0) == 0xc0 &&
|
||||
pkt->data.frame.sz >= index_sz &&
|
||||
buffer[pkt->data.frame.sz - index_sz] == marker) {
|
||||
// frame is a superframe. strip off the index.
|
||||
if (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);
|
||||
modified_pkt_ = *pkt;
|
||||
modified_pkt_.data.frame.buf = modified_buf_;
|
||||
modified_pkt_.data.frame.sz -= index_sz;
|
||||
|
||||
sf_count_++;
|
||||
last_sf_pts_ = pkt->data.frame.pts;
|
||||
return &modified_pkt_;
|
||||
}
|
||||
|
||||
// Make sure we do a few frames after the last SF
|
||||
abort_ |= sf_count_ > sf_count_max_ &&
|
||||
pkt->data.frame.pts - last_sf_pts_ >= 5;
|
||||
return pkt;
|
||||
}
|
||||
|
||||
int sf_count_;
|
||||
int sf_count_max_;
|
||||
vpx_codec_cx_pkt_t modified_pkt_;
|
||||
uint8_t *modified_buf_;
|
||||
vpx_codec_pts_t last_sf_pts_;
|
||||
};
|
||||
|
||||
TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) {
|
||||
sf_count_max_ = 0; // early exit on successful test.
|
||||
cfg_.g_lag_in_frames = 25;
|
||||
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, 40);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
EXPECT_EQ(sf_count_, 1);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Values(
|
||||
::libvpx_test::kTwoPassGood));
|
||||
} // namespace
|
36
test/test.mk
36
test/test.mk
@ -1,7 +1,8 @@
|
||||
LIBVPX_TEST_SRCS-yes += register_state_check.h
|
||||
LIBVPX_TEST_SRCS-yes += test.mk
|
||||
LIBVPX_TEST_SRCS-yes += acm_random.h
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += md5_helper.h
|
||||
LIBVPX_TEST_SRCS-yes += codec_factory.h
|
||||
LIBVPX_TEST_SRCS-yes += test_libvpx.cc
|
||||
LIBVPX_TEST_SRCS-yes += util.h
|
||||
LIBVPX_TEST_SRCS-yes += video_source.h
|
||||
@ -15,17 +16,20 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += altref_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += config_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += cq_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += datarate_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += encode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += encode_test_driver.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += error_resilience_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += i420_video_source.h
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += encode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-yes += encode_test_driver.h
|
||||
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_VP8_ENCODER) += resize_test.cc
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += ../md5_utils.h ../md5_utils.c
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += decode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += decode_test_driver.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += ivf_video_source.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../md5_utils.h ../md5_utils.c
|
||||
LIBVPX_TEST_SRCS-yes += decode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-yes += decode_test_driver.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ivf_video_source.h
|
||||
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += test_vector_test.cc
|
||||
|
||||
##
|
||||
@ -44,10 +48,10 @@ ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),yesyes)
|
||||
LIBVPX_TEST_SRCS-yes += vp8_boolcoder_test.cc
|
||||
endif
|
||||
|
||||
LIBVPX_TEST_SRCS-yes += idctllm_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += idct_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += intrapred_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_POSTPROC) += pp_filter_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += sad_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += sad_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += set_roi.cc
|
||||
LIBVPX_TEST_SRCS-yes += sixtap_predict_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += subtract_test.cc
|
||||
@ -66,13 +70,18 @@ LIBVPX_TEST_SRCS-yes += vp9_boolcoder_test.cc
|
||||
|
||||
# IDCT test currently depends on FDCT function
|
||||
LIBVPX_TEST_SRCS-yes += idct8x8_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += superframe_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += tile_independence_test.cc
|
||||
endif
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9) += convolve_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct4x4_test.cc
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct8x8_test.cc
|
||||
#LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct16x16_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct16x16_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += variance_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += dct32x32_test.cc
|
||||
|
||||
endif # VP9
|
||||
|
||||
|
||||
@ -82,7 +91,8 @@ endif
|
||||
##
|
||||
## TEST DATA
|
||||
##
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_ENCODER) += hantro_collage_w352h288.yuv
|
||||
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS) += hantro_collage_w352h288.yuv
|
||||
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-003.ivf
|
||||
|
@ -12,17 +12,15 @@
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/codec_factory.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/ivf_video_source.h"
|
||||
#include "test/util.h"
|
||||
#include "test/md5_helper.h"
|
||||
extern "C" {
|
||||
#include "./md5_utils.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
// There are 61 test vectors in total.
|
||||
const char *kTestVectors[] = {
|
||||
@ -59,10 +57,10 @@ const char *kTestVectors[] = {
|
||||
"vp80-05-sharpness-1440.ivf", "vp80-05-sharpness-1443.ivf"
|
||||
};
|
||||
|
||||
class TestVectorTest : public libvpx_test::DecoderTest,
|
||||
public ::testing::TestWithParam<const char*> {
|
||||
class TestVectorTest : public ::libvpx_test::DecoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<const char*> {
|
||||
protected:
|
||||
TestVectorTest() : md5_file_(NULL) {}
|
||||
TestVectorTest() : DecoderTest(GET_PARAM(0)), md5_file_(NULL) {}
|
||||
|
||||
virtual ~TestVectorTest() {
|
||||
if (md5_file_)
|
||||
@ -85,30 +83,9 @@ class TestVectorTest : public libvpx_test::DecoderTest,
|
||||
ASSERT_NE(res, EOF) << "Read md5 data failed";
|
||||
expected_md5[32] = '\0';
|
||||
|
||||
MD5Context md5;
|
||||
MD5Init(&md5);
|
||||
|
||||
// Compute and update md5 for each raw in decompressed data.
|
||||
for (int plane = 0; plane < 3; ++plane) {
|
||||
uint8_t *buf = img.planes[plane];
|
||||
|
||||
for (unsigned int y = 0; y < (plane ? (img.d_h + 1) >> 1 : img.d_h);
|
||||
++y) {
|
||||
MD5Update(&md5, buf, (plane ? (img.d_w + 1) >> 1 : img.d_w));
|
||||
buf += img.stride[plane];
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t md5_sum[16];
|
||||
MD5Final(md5_sum, &md5);
|
||||
|
||||
char actual_md5[33];
|
||||
// Convert to get the actual md5.
|
||||
for (int i = 0; i < 16; i++) {
|
||||
snprintf(&actual_md5[i * 2], sizeof(actual_md5) - i * 2, "%02x",
|
||||
md5_sum[i]);
|
||||
}
|
||||
actual_md5[32] = '\0';
|
||||
::libvpx_test::MD5 md5_res;
|
||||
md5_res.Add(&img);
|
||||
const char *actual_md5 = md5_res.Get();
|
||||
|
||||
// Check md5 match.
|
||||
ASSERT_STREQ(expected_md5, actual_md5)
|
||||
@ -124,7 +101,7 @@ class TestVectorTest : public libvpx_test::DecoderTest,
|
||||
// checksums match the correct md5 data, then the test is passed. Otherwise,
|
||||
// the test failed.
|
||||
TEST_P(TestVectorTest, MD5Match) {
|
||||
const std::string filename = GetParam();
|
||||
const std::string filename = GET_PARAM(1);
|
||||
// Open compressed video file.
|
||||
libvpx_test::IVFVideoSource video(filename);
|
||||
|
||||
@ -138,7 +115,7 @@ TEST_P(TestVectorTest, MD5Match) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(TestVectorSequence, TestVectorTest,
|
||||
::testing::ValuesIn(kTestVectors));
|
||||
VP8_INSTANTIATE_TEST_CASE(TestVectorTest,
|
||||
::testing::ValuesIn(kTestVectors));
|
||||
|
||||
} // namespace
|
||||
|
102
test/tile_independence_test.cc
Normal file
102
test/tile_independence_test.cc
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
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 <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#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"
|
||||
#include "test/md5_helper.h"
|
||||
extern "C" {
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
}
|
||||
|
||||
namespace {
|
||||
class TileIndependenceTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
TileIndependenceTest() : EncoderTest(GET_PARAM(0)), n_tiles_(GET_PARAM(1)),
|
||||
md5_fw_order_(), md5_inv_order_() {
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
vpx_codec_dec_cfg_t cfg;
|
||||
cfg.w = 704;
|
||||
cfg.h = 144;
|
||||
cfg.threads = 1;
|
||||
fw_dec_ = codec_->CreateDecoder(cfg, 0);
|
||||
inv_dec_ = codec_->CreateDecoder(cfg, 0);
|
||||
inv_dec_->Control(VP9_INVERT_TILE_DECODE_ORDER, 1);
|
||||
}
|
||||
|
||||
virtual ~TileIndependenceTest() {
|
||||
delete fw_dec_;
|
||||
delete inv_dec_;
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
encoder->Control(VP9E_SET_TILE_COLUMNS, n_tiles_);
|
||||
}
|
||||
}
|
||||
|
||||
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_image_t *img = dec->GetDxData().Next();
|
||||
md5->Add(img);
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
UpdateMD5(fw_dec_, pkt, &md5_fw_order_);
|
||||
UpdateMD5(inv_dec_, pkt, &md5_inv_order_);
|
||||
}
|
||||
|
||||
private:
|
||||
int n_tiles_;
|
||||
protected:
|
||||
::libvpx_test::MD5 md5_fw_order_, md5_inv_order_;
|
||||
::libvpx_test::Decoder *fw_dec_, *inv_dec_;
|
||||
};
|
||||
|
||||
// run an encode with 2 or 4 tiles, and do the decode both in normal and
|
||||
// inverted tile ordering. Ensure that the MD5 of the output in both cases
|
||||
// is identical. If so, tiles are considered independent and the test passes.
|
||||
TEST_P(TileIndependenceTest, MD5Match) {
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = 500;
|
||||
cfg_.g_lag_in_frames = 25;
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
|
||||
libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 704, 144,
|
||||
timebase.den, timebase.num, 0, 30);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
const char *md5_fw_str = md5_fw_order_.Get();
|
||||
const char *md5_inv_str = md5_inv_order_.Get();
|
||||
|
||||
// could use ASSERT_EQ(!memcmp(.., .., 16) here, but this gives nicer
|
||||
// output if it fails. Not sure if it's helpful since it's really just
|
||||
// a MD5...
|
||||
ASSERT_STREQ(md5_fw_str, md5_inv_str);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(TileIndependenceTest,
|
||||
::testing::Range(0, 2, 1));
|
||||
|
||||
} // namespace
|
30
test/util.h
30
test/util.h
@ -11,8 +11,38 @@
|
||||
#ifndef TEST_UTIL_H_
|
||||
#define TEST_UTIL_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx/vpx_image.h"
|
||||
|
||||
// Macros
|
||||
#define PARAMS(...) ::testing::TestWithParam< std::tr1::tuple< __VA_ARGS__ > >
|
||||
#define GET_PARAM(k) std::tr1::get< k >(GetParam())
|
||||
|
||||
static double compute_psnr(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2) {
|
||||
assert((img1->fmt == img2->fmt) &&
|
||||
(img1->d_w == img2->d_w) &&
|
||||
(img1->d_h == img2->d_h));
|
||||
|
||||
const unsigned int width_y = img1->d_w;
|
||||
const unsigned int height_y = img1->d_h;
|
||||
unsigned int i, j;
|
||||
|
||||
int64_t sqrerr = 0;
|
||||
for (i = 0; i < height_y; ++i)
|
||||
for (j = 0; j < width_y; ++j) {
|
||||
int64_t d = img1->planes[VPX_PLANE_Y][i * img1->stride[VPX_PLANE_Y] + j] -
|
||||
img2->planes[VPX_PLANE_Y][i * img2->stride[VPX_PLANE_Y] + j];
|
||||
sqrerr += d * d;
|
||||
}
|
||||
double mse = sqrerr / (width_y * height_y);
|
||||
double psnr = 100.0;
|
||||
if (mse > 0.0) {
|
||||
psnr = 10 * log10(255.0 * 255.0 / mse);
|
||||
}
|
||||
return psnr;
|
||||
}
|
||||
|
||||
#endif // TEST_UTIL_H_
|
||||
|
@ -302,7 +302,7 @@ int check_fragments_for_errors(VP8D_COMP *pbi)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int vp8dx_receive_compressed_data(VP8D_COMP *pbi, size_t size,
|
||||
const uint8_t *source,
|
||||
int64_t time_stamp)
|
||||
|
@ -50,7 +50,7 @@ const int vp8cx_base_skip_false_prob[128] =
|
||||
unsigned __int64 Sectionbits[500];
|
||||
#endif
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
int intra_mode_stats[10][10][10];
|
||||
static unsigned int tree_update_hist [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES] [2];
|
||||
extern unsigned int active_section;
|
||||
@ -531,7 +531,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
|
||||
|
||||
vp8_convert_rfct_to_prob(cpi);
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 1;
|
||||
#endif
|
||||
|
||||
@ -580,7 +580,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
|
||||
xd->mb_to_top_edge = -((mb_row * 16)) << 3;
|
||||
xd->mb_to_bottom_edge = ((pc->mb_rows - 1 - mb_row) * 16) << 3;
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 9;
|
||||
#endif
|
||||
|
||||
@ -593,7 +593,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
|
||||
if (rf == INTRA_FRAME)
|
||||
{
|
||||
vp8_write(w, 0, cpi->prob_intra_coded);
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 6;
|
||||
#endif
|
||||
write_ymode(w, mode, pc->fc.ymode_prob);
|
||||
@ -633,13 +633,13 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
|
||||
|
||||
vp8_mv_ref_probs(mv_ref_p, ct);
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
accum_mv_refs(mode, ct);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 3;
|
||||
#endif
|
||||
|
||||
@ -649,7 +649,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
|
||||
{
|
||||
case NEWMV:
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 5;
|
||||
#endif
|
||||
|
||||
@ -692,7 +692,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
|
||||
|
||||
if (blockmode == NEW4X4)
|
||||
{
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 11;
|
||||
#endif
|
||||
write_mv(w, &blockmv.as_mv, &best_mv, (const MV_CONTEXT *) mvc);
|
||||
@ -769,7 +769,7 @@ static void write_kfmodes(VP8_COMP *cpi)
|
||||
const B_PREDICTION_MODE L = left_block_mode(m, i);
|
||||
const int bm = m->bmi[i].as_mode;
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
++intra_mode_stats [A] [L] [bm];
|
||||
#endif
|
||||
|
||||
@ -1160,7 +1160,7 @@ void vp8_update_coef_probs(VP8_COMP *cpi)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
++ tree_update_hist [i][j][k][t] [u];
|
||||
#endif
|
||||
|
||||
@ -1181,7 +1181,7 @@ void vp8_update_coef_probs(VP8_COMP *cpi)
|
||||
while (++t < ENTROPY_NODES);
|
||||
|
||||
/* Accum token counts for generation of default statistics */
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
t = 0;
|
||||
|
||||
do
|
||||
@ -1527,7 +1527,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest
|
||||
if (pc->frame_type != KEY_FRAME)
|
||||
vp8_write_bit(bc, pc->refresh_last_frame);
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
|
||||
if (pc->frame_type == INTER_FRAME)
|
||||
active_section = 0;
|
||||
@ -1550,7 +1550,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest
|
||||
vp8_update_coef_probs(cpi);
|
||||
#endif
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 2;
|
||||
#endif
|
||||
|
||||
@ -1561,7 +1561,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest
|
||||
{
|
||||
write_kfmodes(cpi);
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 8;
|
||||
#endif
|
||||
}
|
||||
@ -1569,7 +1569,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest
|
||||
{
|
||||
pack_inter_mode_mvs(cpi);
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 1;
|
||||
#endif
|
||||
}
|
||||
@ -1687,7 +1687,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
void print_tree_update_probs()
|
||||
{
|
||||
int i, j, k, l;
|
||||
|
@ -16,7 +16,7 @@ unsigned __int64 Sectionbits[500];
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
unsigned int active_section = 0;
|
||||
#endif
|
||||
|
||||
|
@ -67,7 +67,7 @@ static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability)
|
||||
unsigned int lowvalue = br->lowvalue;
|
||||
register unsigned int shift;
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
#if defined(SECTIONBITS_OUTPUT)
|
||||
|
||||
if (bit)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
extern unsigned int active_section;
|
||||
#endif
|
||||
|
||||
@ -359,7 +359,7 @@ void vp8_write_mvprobs(VP8_COMP *cpi)
|
||||
vp8_writer *const w = cpi->bc;
|
||||
MV_CONTEXT *mvc = cpi->common.fc.mvc;
|
||||
int flags[2] = {0, 0};
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 4;
|
||||
#endif
|
||||
write_component_probs(
|
||||
@ -374,7 +374,7 @@ void vp8_write_mvprobs(VP8_COMP *cpi)
|
||||
if (flags[0] || flags[1])
|
||||
vp8_build_component_cost_table(cpi->mb.mvcost, (const MV_CONTEXT *) cpi->common.fc.mvc, flags);
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
active_section = 5;
|
||||
#endif
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <math.h>
|
||||
#include "vp8/common/findnearmv.h"
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
static int mv_ref_ct [31] [4] [2];
|
||||
static int mv_mode_cts [4] [2];
|
||||
#endif
|
||||
@ -1912,7 +1912,7 @@ int vp8_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
|
||||
+ mv_err_cost(&this_mv, center_mv, mvcost, x->errorperbit);
|
||||
}
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
void print_mode_context(void)
|
||||
{
|
||||
FILE *f = fopen("modecont.c", "w");
|
||||
@ -1965,8 +1965,8 @@ void print_mode_context(void)
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
/* MV ref count ENTROPY_STATS stats code */
|
||||
#ifdef ENTROPY_STATS
|
||||
/* MV ref count VP8_ENTROPY_STATS stats code */
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
void init_mv_ref_counts()
|
||||
{
|
||||
vpx_memset(mv_ref_ct, 0, sizeof(mv_ref_ct));
|
||||
@ -2020,6 +2020,6 @@ void accum_mv_refs(MB_PREDICTION_MODE m, const int ct[4])
|
||||
}
|
||||
}
|
||||
|
||||
#endif/* END MV ref count ENTROPY_STATS stats code */
|
||||
#endif/* END MV ref count VP8_ENTROPY_STATS stats code */
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "block.h"
|
||||
#include "vp8/common/variance.h"
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
extern void init_mv_ref_counts();
|
||||
extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
|
||||
#endif
|
||||
|
@ -111,7 +111,7 @@ extern int skip_false_count;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
extern int intra_mode_stats[10][10][10];
|
||||
#endif
|
||||
|
||||
@ -1805,7 +1805,7 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
|
||||
else
|
||||
cpi->cyclic_refresh_map = (signed char *) NULL;
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
init_context_counters();
|
||||
#endif
|
||||
|
||||
@ -1923,7 +1923,7 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
|
||||
cpi->mb.rd_thresh_mult[i] = 128;
|
||||
}
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
init_mv_ref_counts();
|
||||
#endif
|
||||
|
||||
@ -2060,7 +2060,7 @@ void vp8_remove_compressor(VP8_COMP **ptr)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
print_context_counters();
|
||||
print_tree_update_probs();
|
||||
print_mode_context();
|
||||
@ -2242,7 +2242,7 @@ void vp8_remove_compressor(VP8_COMP **ptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
{
|
||||
int i, j, k;
|
||||
FILE *fmode = fopen("modecontext.c", "w");
|
||||
|
@ -20,7 +20,7 @@
|
||||
/* Global event counters used for accumulating statistics across several
|
||||
compressions, then generating context.c = initial stats. */
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
_int64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
#endif
|
||||
void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t) ;
|
||||
@ -413,7 +413,7 @@ void vp8_tokenize_mb(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t)
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
|
||||
void init_context_counters(void)
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ typedef struct
|
||||
|
||||
int rd_cost_mby(MACROBLOCKD *);
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
#ifdef VP8_ENTROPY_STATS
|
||||
void init_context_counters();
|
||||
void print_context_counters();
|
||||
|
||||
|
@ -684,6 +684,8 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
|
||||
yv12->u_buffer = img->planes[VPX_PLANE_U];
|
||||
yv12->v_buffer = img->planes[VPX_PLANE_V];
|
||||
|
||||
yv12->y_crop_width = img->d_w;
|
||||
yv12->y_crop_height = img->d_h;
|
||||
yv12->y_width = img->d_w;
|
||||
yv12->y_height = img->d_h;
|
||||
yv12->uv_width = (1 + yv12->y_width) / 2;
|
||||
|
@ -790,6 +790,8 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
|
||||
yv12->u_buffer = img->planes[VPX_PLANE_U];
|
||||
yv12->v_buffer = img->planes[VPX_PLANE_V];
|
||||
|
||||
yv12->y_crop_width = img->d_w;
|
||||
yv12->y_crop_height = img->d_h;
|
||||
yv12->y_width = img->d_w;
|
||||
yv12->y_height = img->d_h;
|
||||
yv12->uv_width = yv12->y_width / 2;
|
||||
|
@ -89,12 +89,12 @@ VP8_CX_SRCS-$(HAVE_MMX) += encoder/x86/subtract_mmx.asm
|
||||
VP8_CX_SRCS-$(HAVE_MMX) += encoder/x86/vp8_enc_stubs_mmx.c
|
||||
VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/dct_sse2.asm
|
||||
VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/fwalsh_sse2.asm
|
||||
VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/quantize_sse2.c
|
||||
VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/quantize_sse2_intrinsics.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
|
||||
vp8/encoder/x86/quantize_sse2_intrinsics.c.o: CFLAGS += -msse2
|
||||
vp8/encoder/x86/quantize_sse2_intrinsics.c.d: CFLAGS += -msse2
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TEMPORAL_DENOISING),yes)
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vp9_rtcd.h"
|
||||
#include "vp9/common/vp9_subpixel.h"
|
||||
#include "vp9/common/vp9_loopfilter.h"
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
|
||||
void vp9_machine_specific_config(VP9_COMMON *ctx) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
;
|
||||
|
||||
|
||||
.globl short_idct4x4llm_ppc
|
||||
.globl short_idct4x4_ppc
|
||||
|
||||
.macro load_c V, LABEL, OFF, R0, R1
|
||||
lis \R0, \LABEL@ha
|
||||
@ -21,7 +21,7 @@
|
||||
;# r4 short *output
|
||||
;# r5 int pitch
|
||||
.align 2
|
||||
short_idct4x4llm_ppc:
|
||||
short_idct4x4_ppc:
|
||||
mfspr r11, 256 ;# get old VRSAVE
|
||||
oris r12, r11, 0xfff8
|
||||
mtspr 256, r12 ;# set VRSAVE
|
@ -8,7 +8,6 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "vp9/common/vp9_subpixel.h"
|
||||
#include "vp9/common/vp9_loopfilter.h"
|
||||
#include "recon.h"
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
@ -17,32 +16,28 @@ 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_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 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;
|
||||
@ -60,11 +55,14 @@ 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);
|
||||
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_idct4x4llm_ppc(short *input, short *output, int pitch);
|
||||
extern void short_idct4x4_ppc(short *input, short *output, int pitch);
|
||||
|
||||
// Generic C
|
||||
extern subpixel_predict_function vp9_sixtap_predict_c;
|
||||
@ -80,12 +78,15 @@ 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);
|
||||
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_idct4x4llm_1_c(short *input, short *output, int pitch);
|
||||
extern void vp9_short_idct4x4llm_c(short *input, short *output, int pitch);
|
||||
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
|
||||
@ -140,8 +141,8 @@ void vp9_machine_specific_config(void) {
|
||||
vp9_sixtap_predict8x4 = sixtap_predict8x4_ppc;
|
||||
vp9_sixtap_predict = sixtap_predict_ppc;
|
||||
|
||||
vp8_short_idct4x4_1 = vp9_short_idct4x4llm_1_c;
|
||||
vp8_short_idct4x4 = short_idct4x4llm_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;
|
||||
|
@ -67,20 +67,16 @@ void vp9_de_alloc_frame_buffers(VP9_COMMON *oci) {
|
||||
|
||||
int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
|
||||
int i;
|
||||
int aligned_width, aligned_height;
|
||||
|
||||
vp9_de_alloc_frame_buffers(oci);
|
||||
|
||||
/* our internal buffers are always multiples of 16 */
|
||||
if ((width & 0xf) != 0)
|
||||
width += 16 - (width & 0xf);
|
||||
|
||||
if ((height & 0xf) != 0)
|
||||
height += 16 - (height & 0xf);
|
||||
|
||||
aligned_width = (width + 15) & ~15;
|
||||
aligned_height = (height + 15) & ~15;
|
||||
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++) {
|
||||
oci->fb_idx_ref_cnt[i] = 0;
|
||||
oci->yv12_fb[i].flags = 0;
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height,
|
||||
VP9BORDERINPIXELS) < 0) {
|
||||
vp9_de_alloc_frame_buffers(oci);
|
||||
@ -88,15 +84,16 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
|
||||
}
|
||||
}
|
||||
|
||||
oci->new_fb_idx = 0;
|
||||
oci->lst_fb_idx = 1;
|
||||
oci->gld_fb_idx = 2;
|
||||
oci->alt_fb_idx = 3;
|
||||
oci->new_fb_idx = NUM_YV12_BUFFERS - 1;
|
||||
oci->fb_idx_ref_cnt[oci->new_fb_idx] = 1;
|
||||
|
||||
oci->fb_idx_ref_cnt[0] = 1;
|
||||
oci->fb_idx_ref_cnt[1] = 1;
|
||||
oci->fb_idx_ref_cnt[2] = 1;
|
||||
oci->fb_idx_ref_cnt[3] = 1;
|
||||
for (i = 0; i < 3; i++)
|
||||
oci->active_ref_idx[i] = i;
|
||||
|
||||
for (i = 0; i < NUM_REF_FRAMES; i++) {
|
||||
oci->ref_frame_map[i] = i;
|
||||
oci->fb_idx_ref_cnt[i] = 1;
|
||||
}
|
||||
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16,
|
||||
VP9BORDERINPIXELS) < 0) {
|
||||
@ -110,8 +107,8 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
oci->mb_rows = height >> 4;
|
||||
oci->mb_cols = width >> 4;
|
||||
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));
|
||||
@ -134,7 +131,8 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
|
||||
|
||||
oci->prev_mi = oci->prev_mip + oci->mode_info_stride + 1;
|
||||
|
||||
oci->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * oci->mb_cols, 1);
|
||||
oci->above_context =
|
||||
vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * (3 + oci->mb_cols), 1);
|
||||
|
||||
if (!oci->above_context) {
|
||||
vp9_de_alloc_frame_buffers(oci);
|
||||
@ -146,6 +144,7 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vp9_setup_version(VP9_COMMON *cm) {
|
||||
if (cm->version & 0x4) {
|
||||
if (!CONFIG_EXPERIMENTAL)
|
||||
@ -204,9 +203,6 @@ void vp9_create_common(VP9_COMMON *oci) {
|
||||
/* Initialise reference frame sign bias structure to defaults */
|
||||
vpx_memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
|
||||
|
||||
/* Default disable buffer to buffer copying */
|
||||
oci->copy_buffer_to_gf = 0;
|
||||
oci->copy_buffer_to_arf = 0;
|
||||
oci->kf_ymode_probs_update = 0;
|
||||
}
|
||||
|
||||
@ -220,8 +216,4 @@ void vp9_initialize_common() {
|
||||
vp9_entropy_mode_init();
|
||||
|
||||
vp9_entropy_mv_init();
|
||||
|
||||
#if CONFIG_NEWCOEFCONTEXT
|
||||
vp9_init_neighbors();
|
||||
#endif
|
||||
}
|
||||
|
@ -12,15 +12,431 @@
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
const uint8_t vp9_block2left[TX_SIZE_MAX_SB][25] = {
|
||||
{0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 6, 6, 6, 6, 8},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 6, 6, 6, 6, 8}
|
||||
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_SB][25] = {
|
||||
{0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8},
|
||||
{0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 6, 6, 6, 6, 8},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 6, 6, 6, 6, 8}
|
||||
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
|
||||
|
@ -16,9 +16,9 @@ void vpx_log(const char *format, ...);
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
#include "vp9/common/vp9_convolve.h"
|
||||
#include "vp9/common/vp9_mv.h"
|
||||
#include "vp9/common/vp9_treecoder.h"
|
||||
#include "vp9/common/vp9_subpixel.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
#include "vp9/common/vp9_common.h"
|
||||
|
||||
@ -47,27 +47,13 @@ void vpx_log(const char *format, ...);
|
||||
#define MAX_MV_REFS 9
|
||||
#define MAX_MV_REF_CANDIDATES 4
|
||||
|
||||
#if CONFIG_DWTDCTHYBRID
|
||||
#define DWT_MAX_LENGTH 64
|
||||
#define DWT_TYPE 26 // 26/53/97
|
||||
#define DWT_PRECISION_BITS 2
|
||||
#define DWT_PRECISION_RND ((1 << DWT_PRECISION_BITS) / 2)
|
||||
|
||||
#define DWTDCT16X16 0
|
||||
#define DWTDCT16X16_LEAN 1
|
||||
#define DWTDCT8X8 2
|
||||
#define DWTDCT_TYPE DWTDCT16X16_LEAN
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int r, c;
|
||||
} POS;
|
||||
|
||||
typedef enum PlaneType {
|
||||
PLANE_TYPE_Y_NO_DC = 0,
|
||||
PLANE_TYPE_Y2,
|
||||
PLANE_TYPE_UV,
|
||||
typedef enum {
|
||||
PLANE_TYPE_Y_WITH_DC,
|
||||
PLANE_TYPE_UV,
|
||||
} PLANE_TYPE;
|
||||
|
||||
typedef char ENTROPY_CONTEXT;
|
||||
@ -75,10 +61,9 @@ typedef struct {
|
||||
ENTROPY_CONTEXT y1[4];
|
||||
ENTROPY_CONTEXT u[2];
|
||||
ENTROPY_CONTEXT v[2];
|
||||
ENTROPY_CONTEXT y2;
|
||||
} ENTROPY_CONTEXT_PLANES;
|
||||
|
||||
#define VP9_COMBINEENTROPYCONTEXTS( Dest, A, B) \
|
||||
#define VP9_COMBINEENTROPYCONTEXTS(Dest, A, B) \
|
||||
Dest = ((A)!=0) + ((B)!=0);
|
||||
|
||||
typedef enum {
|
||||
@ -86,8 +71,7 @@ typedef enum {
|
||||
INTER_FRAME = 1
|
||||
} FRAME_TYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
#if CONFIG_ENABLE_6TAP
|
||||
SIXTAP,
|
||||
#endif
|
||||
@ -98,8 +82,7 @@ typedef enum
|
||||
SWITCHABLE /* should be the last one */
|
||||
} INTERPOLATIONFILTERTYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
DC_PRED, /* average of above and left pixels */
|
||||
V_PRED, /* vertical prediction */
|
||||
H_PRED, /* horizontal prediction */
|
||||
@ -125,10 +108,8 @@ typedef enum {
|
||||
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
|
||||
SEG_LVL_ALT_LF = 1, // Use alternate loop filter value...
|
||||
SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
|
||||
SEG_LVL_MODE = 3, // Optional Segment mode
|
||||
SEG_LVL_EOB = 4, // EOB end stop marker.
|
||||
SEG_LVL_TRANSFORM = 5, // Block transform size.
|
||||
SEG_LVL_MAX = 6 // Number of MB level features supported
|
||||
SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode
|
||||
SEG_LVL_MAX = 4 // Number of MB level features supported
|
||||
} SEG_LVL_FEATURES;
|
||||
|
||||
// Segment level features.
|
||||
@ -155,10 +136,7 @@ typedef enum {
|
||||
|
||||
#define VP9_MVREFS (1 + SPLITMV - NEARESTMV)
|
||||
|
||||
#if CONFIG_LOSSLESS
|
||||
#define WHT_UPSCALE_FACTOR 3
|
||||
#define Y2_WHT_UPSCALE_FACTOR 2
|
||||
#endif
|
||||
#define WHT_UPSCALE_FACTOR 2
|
||||
|
||||
typedef enum {
|
||||
B_DC_PRED, /* average of above and left pixels */
|
||||
@ -219,10 +197,7 @@ union b_mode_info {
|
||||
B_PREDICTION_MODE context;
|
||||
#endif
|
||||
} as_mode;
|
||||
struct {
|
||||
int_mv first;
|
||||
int_mv second;
|
||||
} as_mv;
|
||||
int_mv as_mv[2]; // first, second inter predictor motion vectors
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@ -274,6 +249,9 @@ typedef struct {
|
||||
INTERPOLATIONFILTERTYPE interp_filter;
|
||||
|
||||
BLOCK_SIZE_TYPE sb_type;
|
||||
#if CONFIG_CODE_NONZEROCOUNT
|
||||
uint16_t nzcs[256+64*2];
|
||||
#endif
|
||||
} MB_MODE_INFO;
|
||||
|
||||
typedef struct {
|
||||
@ -298,36 +276,44 @@ typedef struct blockd {
|
||||
int dst;
|
||||
int dst_stride;
|
||||
|
||||
int eob;
|
||||
|
||||
union b_mode_info bmi;
|
||||
} BLOCKD;
|
||||
|
||||
typedef struct superblockd {
|
||||
/* 32x32 Y and 16x16 U/V. No 2nd order transform yet. */
|
||||
DECLARE_ALIGNED(16, int16_t, diff[32*32+16*16*2]);
|
||||
DECLARE_ALIGNED(16, int16_t, qcoeff[32*32+16*16*2]);
|
||||
DECLARE_ALIGNED(16, int16_t, dqcoeff[32*32+16*16*2]);
|
||||
} SUPERBLOCKD;
|
||||
struct scale_factors {
|
||||
int x_num;
|
||||
int x_den;
|
||||
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
|
||||
convolve_fn_t predict[2][2][2]; // horiz, vert, avg
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct macroblockd {
|
||||
DECLARE_ALIGNED(16, int16_t, diff[400]); /* from idct diff */
|
||||
DECLARE_ALIGNED(16, uint8_t, predictor[384]);
|
||||
DECLARE_ALIGNED(16, int16_t, qcoeff[400]);
|
||||
DECLARE_ALIGNED(16, int16_t, dqcoeff[400]);
|
||||
DECLARE_ALIGNED(16, uint16_t, eobs[25]);
|
||||
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]);
|
||||
#endif
|
||||
|
||||
SUPERBLOCKD sb_coeff_data;
|
||||
|
||||
/* 16 Y blocks, 4 U, 4 V, 1 DC 2nd order block, each with 16 entries. */
|
||||
BLOCKD block[25];
|
||||
/* 16 Y blocks, 4 U, 4 V, each with 16 entries. */
|
||||
BLOCKD block[24];
|
||||
int fullpixel_mask;
|
||||
|
||||
YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */
|
||||
struct {
|
||||
uint8_t *y_buffer, *u_buffer, *v_buffer;
|
||||
} second_pre;
|
||||
YV12_BUFFER_CONFIG second_pre;
|
||||
YV12_BUFFER_CONFIG dst;
|
||||
struct scale_factors scale_factor[2];
|
||||
struct scale_factors scale_factor_uv[2];
|
||||
|
||||
MODE_INFO *prev_mode_info_context;
|
||||
MODE_INFO *mode_info_context;
|
||||
@ -337,8 +323,9 @@ typedef struct macroblockd {
|
||||
|
||||
int up_available;
|
||||
int left_available;
|
||||
int right_available;
|
||||
|
||||
/* Y,U,V,Y2 */
|
||||
/* Y,U,V */
|
||||
ENTROPY_CONTEXT_PLANES *above_context;
|
||||
ENTROPY_CONTEXT_PLANES *left_context;
|
||||
|
||||
@ -359,6 +346,7 @@ typedef struct macroblockd {
|
||||
|
||||
// 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];
|
||||
|
||||
#if CONFIG_NEW_MVREF
|
||||
vp9_prob mb_mv_ref_probs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES-1];
|
||||
@ -387,21 +375,20 @@ typedef struct macroblockd {
|
||||
unsigned int frames_since_golden;
|
||||
unsigned int frames_till_alt_ref_frame;
|
||||
|
||||
int lossless;
|
||||
/* Inverse transform function pointers. */
|
||||
void (*inv_xform4x4_1_x8)(int16_t *input, int16_t *output, int pitch);
|
||||
void (*inv_xform4x4_x8)(int16_t *input, int16_t *output, int pitch);
|
||||
void (*inv_walsh4x4_1)(int16_t *in, int16_t *out);
|
||||
void (*inv_walsh4x4_lossless)(int16_t *in, int16_t *out);
|
||||
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,
|
||||
struct macroblockd *xd);
|
||||
|
||||
struct subpix_fn_table subpix;
|
||||
|
||||
vp9_subpix_fn_t subpixel_predict4x4;
|
||||
vp9_subpix_fn_t subpixel_predict8x4;
|
||||
vp9_subpix_fn_t subpixel_predict8x8;
|
||||
vp9_subpix_fn_t subpixel_predict16x16;
|
||||
vp9_subpix_fn_t subpixel_predict_avg4x4;
|
||||
vp9_subpix_fn_t subpixel_predict_avg8x4;
|
||||
vp9_subpix_fn_t subpixel_predict_avg8x8;
|
||||
vp9_subpix_fn_t subpixel_predict_avg16x16;
|
||||
int allow_high_precision_mv;
|
||||
|
||||
int corrupted;
|
||||
@ -412,74 +399,46 @@ typedef struct macroblockd {
|
||||
|
||||
} MACROBLOCKD;
|
||||
|
||||
#define ACTIVE_HT 110 // quantization stepsize threshold
|
||||
#define ACTIVE_HT 110 // quantization stepsize threshold
|
||||
|
||||
#define ACTIVE_HT8 300
|
||||
#define ACTIVE_HT8 300
|
||||
|
||||
#define ACTIVE_HT16 300
|
||||
|
||||
// convert MB_PREDICTION_MODE to B_PREDICTION_MODE
|
||||
static B_PREDICTION_MODE pred_mode_conv(MB_PREDICTION_MODE mode) {
|
||||
B_PREDICTION_MODE b_mode;
|
||||
switch (mode) {
|
||||
case DC_PRED:
|
||||
b_mode = B_DC_PRED;
|
||||
break;
|
||||
case V_PRED:
|
||||
b_mode = B_VE_PRED;
|
||||
break;
|
||||
case H_PRED:
|
||||
b_mode = B_HE_PRED;
|
||||
break;
|
||||
case TM_PRED:
|
||||
b_mode = B_TM_PRED;
|
||||
break;
|
||||
case D45_PRED:
|
||||
b_mode = B_LD_PRED;
|
||||
break;
|
||||
case D135_PRED:
|
||||
b_mode = B_RD_PRED;
|
||||
break;
|
||||
case D117_PRED:
|
||||
b_mode = B_VR_PRED;
|
||||
break;
|
||||
case D153_PRED:
|
||||
b_mode = B_HD_PRED;
|
||||
break;
|
||||
case D27_PRED:
|
||||
b_mode = B_HU_PRED;
|
||||
break;
|
||||
case D63_PRED:
|
||||
b_mode = B_VL_PRED;
|
||||
break;
|
||||
default :
|
||||
// for debug purpose, to be removed after full testing
|
||||
assert(0);
|
||||
break;
|
||||
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;
|
||||
default:
|
||||
assert(0);
|
||||
return B_MODE_COUNT; // Dummy value
|
||||
}
|
||||
return b_mode;
|
||||
}
|
||||
|
||||
// transform mapping
|
||||
static TX_TYPE txfm_map(B_PREDICTION_MODE bmode) {
|
||||
// map transform type
|
||||
TX_TYPE tx_type;
|
||||
switch (bmode) {
|
||||
case B_TM_PRED :
|
||||
case B_RD_PRED :
|
||||
tx_type = ADST_ADST;
|
||||
break;
|
||||
return ADST_ADST;
|
||||
|
||||
case B_VE_PRED :
|
||||
case B_VR_PRED :
|
||||
tx_type = ADST_DCT;
|
||||
break;
|
||||
return ADST_DCT;
|
||||
|
||||
case B_HE_PRED :
|
||||
case B_HD_PRED :
|
||||
case B_HU_PRED :
|
||||
tx_type = DCT_ADST;
|
||||
break;
|
||||
return DCT_ADST;
|
||||
|
||||
#if CONFIG_NEWBINTRAMODES
|
||||
case B_CONTEXT_PRED:
|
||||
@ -487,33 +446,41 @@ static TX_TYPE txfm_map(B_PREDICTION_MODE bmode) {
|
||||
break;
|
||||
#endif
|
||||
|
||||
default :
|
||||
tx_type = DCT_DCT;
|
||||
break;
|
||||
default:
|
||||
return DCT_DCT;
|
||||
}
|
||||
return tx_type;
|
||||
}
|
||||
|
||||
extern const uint8_t vp9_block2left[TX_SIZE_MAX_SB][25];
|
||||
extern const uint8_t vp9_block2above[TX_SIZE_MAX_SB][25];
|
||||
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 0
|
||||
#define USE_ADST_FOR_I16X16_4X4 0
|
||||
#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, const BLOCKD *b) {
|
||||
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;
|
||||
int ib = (int)(b - xd->block);
|
||||
if (ib >= 16)
|
||||
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
|
||||
#if !USE_ADST_FOR_SB
|
||||
if (sb_type)
|
||||
return tx_type;
|
||||
// TODO(rbultje, debargha): Explore ADST usage for superblocks
|
||||
if (xd->mode_info_context->mbmi.sb_type)
|
||||
#endif
|
||||
if (ib >= (16 << (2 * sb_type))) // no chroma adst
|
||||
return tx_type;
|
||||
if (xd->lossless)
|
||||
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 :
|
||||
@ -521,16 +488,32 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) {
|
||||
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
|
||||
int ic = (ib & 10);
|
||||
const int inner = ib & 5;
|
||||
b += ic - ib;
|
||||
tx_type = (ic != 10) ?
|
||||
txfm_map(pred_mode_conv((MB_PREDICTION_MODE)b->bmi.as_mode.first)) :
|
||||
DCT_DCT;
|
||||
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
|
||||
@ -542,9 +525,22 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) {
|
||||
xd->q_index < ACTIVE_HT) {
|
||||
#if USE_ADST_FOR_I16X16_4X4
|
||||
#if USE_ADST_PERIPHERY_ONLY
|
||||
// Use ADST for periphery blocks only
|
||||
tx_type = (ib < 4 || ((ib & 3) == 0)) ?
|
||||
txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode)) : DCT_DCT;
|
||||
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));
|
||||
@ -557,29 +553,44 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) {
|
||||
return tx_type;
|
||||
}
|
||||
|
||||
static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, const BLOCKD *b) {
|
||||
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;
|
||||
int ib = (int)(b - xd->block);
|
||||
if (ib >= 16)
|
||||
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
|
||||
#if !USE_ADST_FOR_SB
|
||||
if (sb_type)
|
||||
return tx_type;
|
||||
// TODO(rbultje, debargha): Explore ADST usage for superblocks
|
||||
if (xd->mode_info_context->mbmi.sb_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_I8X8_4X4
|
||||
#if USE_ADST_FOR_I16X16_8X8
|
||||
#if USE_ADST_PERIPHERY_ONLY
|
||||
// Use ADST for periphery blocks only
|
||||
tx_type = (ib != 10) ?
|
||||
txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode)) : DCT_DCT;
|
||||
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));
|
||||
@ -592,63 +603,73 @@ static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, const BLOCKD *b) {
|
||||
return tx_type;
|
||||
}
|
||||
|
||||
static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, const BLOCKD *b) {
|
||||
static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, int ib) {
|
||||
TX_TYPE tx_type = DCT_DCT;
|
||||
int ib = (int)(b - xd->block);
|
||||
if (ib >= 16)
|
||||
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type;
|
||||
#if !USE_ADST_FOR_SB
|
||||
if (sb_type)
|
||||
return tx_type;
|
||||
// TODO(rbultje, debargha): Explore ADST usage for superblocks
|
||||
if (xd->mode_info_context->mbmi.sb_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;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return tx_type;
|
||||
}
|
||||
|
||||
static TX_TYPE get_tx_type(const MACROBLOCKD *xd, const BLOCKD *b) {
|
||||
TX_TYPE tx_type = DCT_DCT;
|
||||
int ib = (int)(b - xd->block);
|
||||
if (ib >= 16)
|
||||
return tx_type;
|
||||
if (xd->mode_info_context->mbmi.txfm_size == TX_16X16) {
|
||||
tx_type = get_tx_type_16x16(xd, b);
|
||||
}
|
||||
if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
|
||||
ib = (ib & 8) + ((ib & 4) >> 1);
|
||||
tx_type = get_tx_type_8x8(xd, &xd->block[ib]);
|
||||
}
|
||||
if (xd->mode_info_context->mbmi.txfm_size == TX_4X4) {
|
||||
tx_type = get_tx_type_4x4(xd, b);
|
||||
}
|
||||
return tx_type;
|
||||
}
|
||||
|
||||
static int get_2nd_order_usage(const MACROBLOCKD *xd) {
|
||||
int has_2nd_order = (xd->mode_info_context->mbmi.mode != SPLITMV &&
|
||||
xd->mode_info_context->mbmi.mode != I8X8_PRED &&
|
||||
xd->mode_info_context->mbmi.mode != B_PRED &&
|
||||
xd->mode_info_context->mbmi.txfm_size != TX_16X16);
|
||||
if (has_2nd_order)
|
||||
has_2nd_order = (get_tx_type(xd, xd->block) == DCT_DCT);
|
||||
return has_2nd_order;
|
||||
}
|
||||
|
||||
extern void vp9_build_block_doffsets(MACROBLOCKD *xd);
|
||||
extern void vp9_setup_block_dptrs(MACROBLOCKD *xd);
|
||||
void vp9_build_block_doffsets(MACROBLOCKD *xd);
|
||||
void vp9_setup_block_dptrs(MACROBLOCKD *xd);
|
||||
|
||||
static void update_blockd_bmi(MACROBLOCKD *xd) {
|
||||
int i;
|
||||
int is_4x4;
|
||||
is_4x4 = (xd->mode_info_context->mbmi.mode == SPLITMV) ||
|
||||
(xd->mode_info_context->mbmi.mode == I8X8_PRED) ||
|
||||
(xd->mode_info_context->mbmi.mode == B_PRED);
|
||||
const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
|
||||
|
||||
if (is_4x4) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
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 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;
|
||||
} 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;
|
||||
}
|
||||
return tx_size_uv;
|
||||
}
|
||||
#endif // VP9_COMMON_VP9_BLOCKD_H_
|
||||
|
@ -9,12 +9,25 @@
|
||||
*/
|
||||
|
||||
#ifndef VP9_COMMON_VP9_COEFUPDATEPROBS_H_
|
||||
#define VP9_COMMON_VP9_COEFUPDATEPROBS_H__
|
||||
#define VP9_COMMON_VP9_COEFUPDATEPROBS_H_
|
||||
|
||||
/* Update probabilities for the nodes in the token entropy tree.
|
||||
Generated file included by vp9_entropy.c */
|
||||
#define COEF_UPDATE_PROB 252
|
||||
#define COEF_UPDATE_PROB_8X8 252
|
||||
#define COEF_UPDATE_PROB_16X16 252
|
||||
|
||||
static const vp9_prob vp9_coef_update_prob[ENTROPY_NODES] = {
|
||||
252, 252, 252, 252, 252, 252, 252, 252, 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__
|
||||
|
@ -11,10 +11,11 @@
|
||||
#ifndef VP9_COMMON_VP9_COMMON_H_
|
||||
#define VP9_COMMON_VP9_COMMON_H_
|
||||
|
||||
#include <assert.h>
|
||||
#include "vpx_config.h"
|
||||
/* Interface header for common constant data structures and lookup tables */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
@ -24,26 +25,34 @@
|
||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
/* Only need this for fixed-size arrays, for structs just assign. */
|
||||
#define ROUND_POWER_OF_TWO(value, n) (((value) + (1 << ((n) - 1))) >> (n))
|
||||
|
||||
#define vp9_copy(Dest, Src) { \
|
||||
assert(sizeof(Dest) == sizeof(Src)); \
|
||||
vpx_memcpy(Dest, Src, sizeof(Src)); \
|
||||
/* If we don't want to use ROUND_POWER_OF_TWO macro
|
||||
static INLINE int16_t round_power_of_two(int16_t value, int n) {
|
||||
return (value + (1 << (n - 1))) >> n;
|
||||
}*/
|
||||
|
||||
// Only need this for fixed-size arrays, for structs just assign.
|
||||
#define vp9_copy(dest, src) { \
|
||||
assert(sizeof(dest) == sizeof(src)); \
|
||||
vpx_memcpy(dest, src, sizeof(src)); \
|
||||
}
|
||||
|
||||
/* Use this for variably-sized arrays. */
|
||||
|
||||
#define vp9_copy_array(Dest, Src, N) { \
|
||||
assert(sizeof(*Dest) == sizeof(*Src)); \
|
||||
vpx_memcpy(Dest, Src, N * sizeof(*Src)); \
|
||||
// Use this for variably-sized arrays.
|
||||
#define vp9_copy_array(dest, src, n) { \
|
||||
assert(sizeof(*dest) == sizeof(*src)); \
|
||||
vpx_memcpy(dest, src, n * sizeof(*src)); \
|
||||
}
|
||||
|
||||
#define vp9_zero(Dest) vpx_memset(&Dest, 0, sizeof(Dest));
|
||||
#define vp9_zero(dest) vpx_memset(&dest, 0, sizeof(dest));
|
||||
#define vp9_zero_array(dest, n) vpx_memset(dest, 0, n * sizeof(*dest));
|
||||
|
||||
#define vp9_zero_array(Dest, N) vpx_memset(Dest, 0, N * sizeof(*Dest));
|
||||
|
||||
static __inline uint8_t clip_pixel(int val) {
|
||||
static INLINE uint8_t clip_pixel(int val) {
|
||||
return (val > 255) ? 255u : (val < 0) ? 0u : val;
|
||||
}
|
||||
|
||||
static INLINE int clamp(int value, int low, int high) {
|
||||
return value < low ? low : (value > high ? high : value);
|
||||
}
|
||||
|
||||
#endif // VP9_COMMON_VP9_COMMON_H_
|
||||
|
850
vp9/common/vp9_convolve.c
Normal file
850
vp9/common/vp9_convolve.c
Normal file
@ -0,0 +1,850 @@
|
||||
/*
|
||||
* Copyright (c) 2013 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "vp9/common/vp9_convolve.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vp9_rtcd.h"
|
||||
#include "vp9/common/vp9_common.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
|
||||
#define VP9_FILTER_WEIGHT 128
|
||||
#define VP9_FILTER_SHIFT 7
|
||||
|
||||
/* Assume a bank of 16 filters to choose from. There are two implementations
|
||||
* for filter wrapping behavior, since we want to be able to pick which filter
|
||||
* to start with. We could either:
|
||||
*
|
||||
* 1) make filter_ a pointer to the base of the filter array, and then add an
|
||||
* additional offset parameter, to choose the starting filter.
|
||||
* 2) use a pointer to 2 periods worth of filters, so that even if the original
|
||||
* phase offset is at 15/16, we'll have valid data to read. The filter
|
||||
* tables become [32][8], and the second half is duplicated.
|
||||
* 3) fix the alignment of the filter tables, so that we know the 0/16 is
|
||||
* always 256 byte aligned.
|
||||
*
|
||||
* Implementations 2 and 3 are likely preferable, as they avoid an extra 2
|
||||
* parameters, and switching between them is trivial, with the
|
||||
* ALIGN_FILTERS_256 macro, below.
|
||||
*/
|
||||
#define ALIGN_FILTERS_256 1
|
||||
|
||||
static void convolve_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) {
|
||||
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] = 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;
|
||||
}
|
||||
}
|
||||
|
||||
static void convolve_avg_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) {
|
||||
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] = (dst[x] + clip_pixel(sum >> VP9_FILTER_SHIFT) + 1) >> 1;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
#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,
|
||||
const int16_t *filter_y0, int y_step_q4,
|
||||
int w, int h, int taps) {
|
||||
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] = 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;
|
||||
}
|
||||
}
|
||||
|
||||
static void convolve_avg_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) {
|
||||
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] =
|
||||
(dst[y * dst_stride] + clip_pixel(sum >> VP9_FILTER_SHIFT) + 1) >> 1;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
#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,
|
||||
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.
|
||||
*/
|
||||
uint8_t temp[16 * 39];
|
||||
int intermediate_height = ((h * y_step_q4) >> 4) + taps - 1;
|
||||
|
||||
assert(w <= 16);
|
||||
assert(h <= 16);
|
||||
assert(taps <= 8);
|
||||
assert(y_step_q4 <= 32);
|
||||
|
||||
if (intermediate_height < h)
|
||||
intermediate_height = h;
|
||||
|
||||
convolve_horiz_c(src - src_stride * (taps / 2 - 1), src_stride,
|
||||
temp, 16,
|
||||
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,
|
||||
filter_x, x_step_q4, filter_y, y_step_q4,
|
||||
w, h, taps);
|
||||
}
|
||||
|
||||
static void convolve_avg_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, int taps) {
|
||||
/* Fixed size intermediate buffer places limits on parameters.
|
||||
* Maximum intermediate_height is 39, for y_step_q4 == 32,
|
||||
* h == 16, taps == 8.
|
||||
*/
|
||||
uint8_t temp[16 * 39];
|
||||
int intermediate_height = ((h * y_step_q4) >> 4) + taps - 1;
|
||||
|
||||
assert(w <= 16);
|
||||
assert(h <= 16);
|
||||
assert(taps <= 8);
|
||||
assert(y_step_q4 <= 32);
|
||||
|
||||
if (intermediate_height < h)
|
||||
intermediate_height = h;
|
||||
|
||||
convolve_horiz_c(src - src_stride * (taps / 2 - 1), src_stride,
|
||||
temp, 16,
|
||||
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,
|
||||
filter_x, x_step_q4, filter_y, y_step_q4,
|
||||
w, h, taps);
|
||||
}
|
||||
|
||||
void vp9_convolve8_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_horiz_c(src, src_stride, dst, dst_stride,
|
||||
filter_x, x_step_q4, filter_y, y_step_q4,
|
||||
w, h, 8);
|
||||
}
|
||||
|
||||
void vp9_convolve8_avg_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_avg_horiz_c(src, src_stride, dst, dst_stride,
|
||||
filter_x, x_step_q4, filter_y, y_step_q4,
|
||||
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,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
convolve_vert_c(src, src_stride, dst, dst_stride,
|
||||
filter_x, x_step_q4, filter_y, y_step_q4,
|
||||
w, h, 8);
|
||||
}
|
||||
|
||||
void vp9_convolve8_avg_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_avg_vert_c(src, src_stride, dst, dst_stride,
|
||||
filter_x, x_step_q4, filter_y, y_step_q4,
|
||||
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,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
convolve_c(src, src_stride, dst, dst_stride,
|
||||
filter_x, x_step_q4, filter_y, y_step_q4,
|
||||
w, h, 8);
|
||||
}
|
||||
|
||||
void vp9_convolve8_avg_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_avg(temp, 16,
|
||||
dst, dst_stride,
|
||||
NULL, 0, /* These unused parameter should be removed! */
|
||||
NULL, 0, /* These unused parameter should be removed! */
|
||||
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,
|
||||
const int16_t *filter_y, int filter_y_stride,
|
||||
int w, int h) {
|
||||
if (w == 16 && h == 16) {
|
||||
vp9_copy_mem16x16(src, src_stride, dst, dst_stride);
|
||||
} else if (w == 8 && h == 8) {
|
||||
vp9_copy_mem8x8(src, src_stride, dst, dst_stride);
|
||||
} else if (w == 8 && h == 4) {
|
||||
vp9_copy_mem8x4(src, src_stride, dst, dst_stride);
|
||||
} else {
|
||||
int r;
|
||||
|
||||
for (r = h; r > 0; --r) {
|
||||
memcpy(dst, src, w);
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_convolve_avg(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] = (dst[x] + src[x] + 1) >> 1;
|
||||
}
|
||||
src += src_stride;
|
||||
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
|
85
vp9/common/vp9_convolve.h
Normal file
85
vp9/common/vp9_convolve.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2013 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#ifndef VP9_COMMON_CONVOLVE_H_
|
||||
#define VP9_COMMON_CONVOLVE_H_
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
typedef void (*convolve_fn_t)(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 copy conforming to the convolution prototype
|
||||
void vp9_convolve_copy(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 average conforming to the convolution prototype
|
||||
void vp9_convolve_avg(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);
|
||||
|
||||
#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];
|
||||
};
|
||||
|
||||
#endif // VP9_COMMON_CONVOLVE_H_
|
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
|
||||
void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols,
|
||||
@ -18,8 +19,7 @@ void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols,
|
||||
int mb_index = 0;
|
||||
FILE *mvs = fopen("mvs.stt", "a");
|
||||
|
||||
/* print out the macroblock Y modes */
|
||||
mb_index = 0;
|
||||
// Print out the macroblock Y modes
|
||||
fprintf(mvs, "Mb Modes for Frame %d\n", frame);
|
||||
|
||||
for (mb_row = 0; mb_row < rows; mb_row++) {
|
||||
@ -129,8 +129,8 @@ void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols,
|
||||
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.first.as_mv.row,
|
||||
mi[mb_index].bmi[bindex].as_mv.first.as_mv.col);
|
||||
mi[mb_index].bmi[bindex].as_mv[0].as_mv.row,
|
||||
mi[mb_index].bmi[bindex].as_mv[0].as_mv.col);
|
||||
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,6 @@
|
||||
#include "vp9/common/vp9_treecoder.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp9/common/vp9_common.h"
|
||||
#include "vp9/common/vp9_coefupdateprobs.h"
|
||||
|
||||
extern const int vp9_i8x8_block[4];
|
||||
|
||||
@ -31,10 +30,10 @@ extern const int vp9_i8x8_block[4];
|
||||
#define DCT_VAL_CATEGORY3 7 /* 11-18 Extra Bits 3+1 */
|
||||
#define DCT_VAL_CATEGORY4 8 /* 19-34 Extra Bits 4+1 */
|
||||
#define DCT_VAL_CATEGORY5 9 /* 35-66 Extra Bits 5+1 */
|
||||
#define DCT_VAL_CATEGORY6 10 /* 67+ Extra Bits 13+1 */
|
||||
#define DCT_VAL_CATEGORY6 10 /* 67+ Extra Bits 14+1 */
|
||||
#define DCT_EOB_TOKEN 11 /* EOB Extra Bits 0+0 */
|
||||
#define MAX_ENTROPY_TOKENS 12
|
||||
#define ENTROPY_NODES 11
|
||||
#define MAX_ENTROPY_TOKENS 12
|
||||
#define ENTROPY_NODES 11
|
||||
#define EOSB_TOKEN 127 /* Not signalled, encoder only */
|
||||
|
||||
#define INTER_MODE_CONTEXTS 7
|
||||
@ -59,31 +58,20 @@ extern vp9_extra_bit_struct vp9_extra_bits[12]; /* indexed by token value */
|
||||
|
||||
/* Coefficients are predicted via a 3-dimensional probability table. */
|
||||
|
||||
/* Outside dimension. 0 = Y no DC, 1 = Y2, 2 = UV, 3 = Y with DC */
|
||||
#define BLOCK_TYPES_4X4 4
|
||||
/* Outside dimension. 0 = Y with DC, 1 = UV */
|
||||
#define BLOCK_TYPES 2
|
||||
#define REF_TYPES 2 // intra=0, inter=1
|
||||
|
||||
#define BLOCK_TYPES_8X8 4
|
||||
/* Middle dimension reflects the coefficient position within the transform. */
|
||||
#define COEF_BANDS 6
|
||||
|
||||
#define BLOCK_TYPES_16X16 4
|
||||
|
||||
#define BLOCK_TYPES_32X32 4
|
||||
|
||||
/* Middle dimension is a coarsening of the coefficient's
|
||||
position within the 4x4 DCT. */
|
||||
|
||||
#define COEF_BANDS 8
|
||||
extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_4x4[16]);
|
||||
extern DECLARE_ALIGNED(64, const int, vp9_coef_bands_8x8[64]);
|
||||
extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_16x16[256]);
|
||||
extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_32x32[1024]);
|
||||
|
||||
/* Inside dimension is 3-valued measure of nearby complexity, that is,
|
||||
the extent to which nearby coefficients are nonzero. For the first
|
||||
coefficient (DC, unless block type is 0), we look at the (already encoded)
|
||||
blocks above and to the left of the current block. The context index is
|
||||
then the number (0,1,or 2) of these blocks having nonzero coefficients.
|
||||
After decoding a coefficient, the measure is roughly the size of the
|
||||
most recently decoded coefficient (0 for 0, 1 for 1, 2 for >1).
|
||||
/* Inside dimension is measure of nearby complexity, that reflects the energy
|
||||
of nearby coefficients are nonzero. For the first coefficient (DC, unless
|
||||
block type is 0), we look at the (already encoded) blocks above and to the
|
||||
left of the current block. The context index is then the number (0,1,or 2)
|
||||
of these blocks having nonzero coefficients.
|
||||
After decoding a coefficient, the measure is determined by the size of the
|
||||
most recently decoded coefficient.
|
||||
Note that the intuitive meaning of this measure changes as coefficients
|
||||
are decoded, e.g., prior to the first token, a zero means that my neighbors
|
||||
are empty while, after the first token, because of the use of end-of-block,
|
||||
@ -94,21 +82,18 @@ extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_32x32[1024]);
|
||||
distinct bands). */
|
||||
|
||||
/*# define DC_TOKEN_CONTEXTS 3*/ /* 00, 0!0, !0!0 */
|
||||
#define PREV_COEF_CONTEXTS 4
|
||||
#define PREV_COEF_CONTEXTS 6
|
||||
|
||||
typedef unsigned int vp9_coeff_count[COEF_BANDS][PREV_COEF_CONTEXTS]
|
||||
typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
|
||||
[MAX_ENTROPY_TOKENS];
|
||||
typedef unsigned int vp9_coeff_stats[COEF_BANDS][PREV_COEF_CONTEXTS]
|
||||
typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES][2];
|
||||
typedef vp9_prob vp9_coeff_probs[COEF_BANDS][PREV_COEF_CONTEXTS]
|
||||
typedef vp9_prob vp9_coeff_probs[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES];
|
||||
|
||||
#define SUBEXP_PARAM 4 /* Subexponential code parameter */
|
||||
#define MODULUS_PARAM 13 /* Modulus parameter */
|
||||
|
||||
extern DECLARE_ALIGNED(16, const uint8_t,
|
||||
vp9_prev_token_class[MAX_ENTROPY_TOKENS]);
|
||||
|
||||
struct VP9Common;
|
||||
void vp9_default_coef_probs(struct VP9Common *);
|
||||
extern DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_4x4[16]);
|
||||
@ -117,38 +102,168 @@ 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(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_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]);
|
||||
|
||||
void vp9_coef_tree_initialize(void);
|
||||
void vp9_adapt_coef_probs(struct VP9Common *);
|
||||
|
||||
static void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) {
|
||||
static INLINE void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) {
|
||||
/* Clear entropy contexts */
|
||||
vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
|
||||
vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
|
||||
}
|
||||
|
||||
#if CONFIG_NEWCOEFCONTEXT
|
||||
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);
|
||||
}
|
||||
|
||||
#define MAX_NEIGHBORS 5
|
||||
#define NEWCOEFCONTEXT_BAND_COND(b) ((b) >= 1)
|
||||
void vp9_init_neighbors(void);
|
||||
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 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];
|
||||
}
|
||||
}
|
||||
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
|
||||
|
||||
// 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
|
||||
|
||||
// whether to adjust the coef probs for key frames based on qindex
|
||||
#define ADJUST_KF_COEF_PROBS 0
|
||||
|
||||
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
|
||||
|
||||
#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 */
|
||||
|
||||
/* Number of tokens for each block size */
|
||||
#define NZC4X4_TOKENS 6
|
||||
#define NZC8X8_TOKENS 8
|
||||
#define NZC16X16_TOKENS 10
|
||||
#define NZC32X32_TOKENS 12
|
||||
|
||||
/* Number of nodes for each block size */
|
||||
#define NZC4X4_NODES 5
|
||||
#define NZC8X8_NODES 7
|
||||
#define NZC16X16_NODES 9
|
||||
#define NZC32X32_NODES 11
|
||||
|
||||
/* Max number of tokens with extra bits */
|
||||
#define NZC_TOKENS_EXTRA 9
|
||||
|
||||
/* Max number of extra bits */
|
||||
#define NZC_BITS_EXTRA 9
|
||||
|
||||
/* Tokens without extra bits */
|
||||
#define NZC_TOKENS_NOEXTRA (NZC32X32_TOKENS - NZC_TOKENS_EXTRA)
|
||||
|
||||
#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
|
||||
|
||||
#include "vp9/common/vp9_coefupdateprobs.h"
|
||||
|
||||
const int *vp9_get_coef_neighbors_handle(const int *scan);
|
||||
int vp9_get_coef_neighbor_context(const short int *qcoeff_ptr, int nodc,
|
||||
const int *neigbor_handle, int rc);
|
||||
extern DECLARE_ALIGNED(16, int, vp9_default_zig_zag1d_4x4_neighbors[
|
||||
16 * MAX_NEIGHBORS]);
|
||||
extern DECLARE_ALIGNED(16, int, vp9_row_scan_4x4_neighbors[
|
||||
16 * MAX_NEIGHBORS]);
|
||||
extern DECLARE_ALIGNED(16, int, vp9_col_scan_4x4_neighbors[
|
||||
16 * MAX_NEIGHBORS]);
|
||||
extern DECLARE_ALIGNED(16, int, vp9_default_zig_zag1d_8x8_neighbors[
|
||||
64 * MAX_NEIGHBORS]);
|
||||
extern DECLARE_ALIGNED(16, int, vp9_default_zig_zag1d_16x16_neighbors[
|
||||
256 * MAX_NEIGHBORS]);
|
||||
extern DECLARE_ALIGNED(16, int, vp9_default_zig_zag1d_32x32_neighbors[
|
||||
1024 * MAX_NEIGHBORS]);
|
||||
#endif // CONFIG_NEWCOEFCONTEXT
|
||||
#endif // VP9_COMMON_VP9_ENTROPY_H_
|
||||
|
@ -11,9 +11,10 @@
|
||||
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
#include "vp9/common/vp9_modecont.h"
|
||||
#include "vp9/common/vp9_seg_common.h"
|
||||
#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},
|
||||
@ -114,8 +115,6 @@ int vp9_mv_cont(const int_mv *l, const int_mv *a) {
|
||||
return SUBMVREF_NORMAL;
|
||||
}
|
||||
|
||||
const vp9_prob vp9_sub_mv_ref_prob [VP9_SUBMVREFS - 1] = { 180, 162, 25};
|
||||
|
||||
const vp9_prob vp9_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP9_SUBMVREFS - 1] = {
|
||||
{ 147, 136, 18 },
|
||||
{ 106, 145, 1 },
|
||||
@ -301,40 +300,32 @@ 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 */
|
||||
|
||||
vp9_tree_probs_from_distribution(VP9_YMODES, vp9_ymode_encodings,
|
||||
vp9_ymode_tree, x->fc.ymode_prob,
|
||||
bct, y_mode_cts);
|
||||
vp9_tree_probs_from_distribution(VP9_I32X32_MODES, vp9_sb_ymode_encodings,
|
||||
vp9_sb_ymode_tree, x->fc.sb_ymode_prob,
|
||||
bct, y_mode_cts);
|
||||
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_YMODES, vp9_kf_ymode_encodings,
|
||||
vp9_kf_ymode_tree, x->kf_ymode_prob[i],
|
||||
bct, kf_y_mode_cts[i]);
|
||||
vp9_tree_probs_from_distribution(VP9_I32X32_MODES,
|
||||
vp9_sb_kf_ymode_encodings,
|
||||
vp9_sb_kf_ymode_tree,
|
||||
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]);
|
||||
kf_y_mode_cts[i], 0);
|
||||
}
|
||||
}
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < VP9_YMODES; i++) {
|
||||
vp9_tree_probs_from_distribution(VP9_UV_MODES, vp9_uv_mode_encodings,
|
||||
vp9_uv_mode_tree, x->kf_uv_mode_prob[i],
|
||||
bct, kf_uv_mode_cts[i]);
|
||||
vp9_tree_probs_from_distribution(VP9_UV_MODES, vp9_uv_mode_encodings,
|
||||
vp9_uv_mode_tree, x->fc.uv_mode_prob[i],
|
||||
bct, uv_mode_cts[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_MODES, vp9_i8x8_mode_encodings,
|
||||
vp9_i8x8_mode_tree, x->fc.i8x8_mode_prob,
|
||||
bct, i8x8_mode_cts);
|
||||
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));
|
||||
@ -344,6 +335,9 @@ void vp9_init_mbmode_probs(VP9_COMMON *x) {
|
||||
#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;
|
||||
}
|
||||
|
||||
|
||||
@ -351,8 +345,7 @@ 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_NKF_BINTRAMODES, vp9_bmode_encodings,
|
||||
vp9_bmode_tree, p, branch_ct, events);
|
||||
vp9_tree_probs_from_distribution(vp9_bmode_tree, p, branch_ct, events, 0);
|
||||
}
|
||||
|
||||
void vp9_default_bmode_probs(vp9_prob p[VP9_NKF_BINTRAMODES - 1]) {
|
||||
@ -364,8 +357,7 @@ 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_BINTRAMODES, vp9_kf_bmode_encodings,
|
||||
vp9_kf_bmode_tree, p, branch_ct, events);
|
||||
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]
|
||||
@ -419,6 +411,14 @@ 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
|
||||
|
||||
void vp9_entropy_mode_init() {
|
||||
@ -480,7 +480,7 @@ void vp9_accum_mv_refs(VP9_COMMON *pc,
|
||||
|
||||
#define MVREF_COUNT_SAT 20
|
||||
#define MVREF_MAX_UPDATE_FACTOR 128
|
||||
void vp9_update_mode_context(VP9_COMMON *pc) {
|
||||
void vp9_adapt_mode_context(VP9_COMMON *pc) {
|
||||
int i, j;
|
||||
unsigned int (*mv_ref_ct)[4][2];
|
||||
int (*mode_context)[4];
|
||||
@ -526,17 +526,17 @@ void print_mode_contexts(VP9_COMMON *pc) {
|
||||
|
||||
#define MODE_COUNT_SAT 20
|
||||
#define MODE_MAX_UPDATE_FACTOR 144
|
||||
static void update_mode_probs(int n_modes, struct vp9_token_struct *encoding,
|
||||
static void update_mode_probs(int n_modes,
|
||||
const vp9_tree_index *tree, unsigned int *cnt,
|
||||
vp9_prob *pre_probs, vp9_prob *dst_probs) {
|
||||
vp9_prob *pre_probs, vp9_prob *dst_probs,
|
||||
unsigned int tok0_offset) {
|
||||
#define MAX_PROBS 32
|
||||
vp9_prob probs[MAX_PROBS];
|
||||
unsigned int branch_ct[MAX_PROBS][2];
|
||||
int t, count, factor;
|
||||
|
||||
assert(n_modes - 1 < MAX_PROBS);
|
||||
vp9_tree_probs_from_distribution(n_modes, encoding, tree, probs,
|
||||
branch_ct, cnt);
|
||||
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;
|
||||
@ -592,31 +592,32 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
update_mode_probs(VP9_YMODES, vp9_ymode_encodings, vp9_ymode_tree,
|
||||
update_mode_probs(VP9_YMODES, vp9_ymode_tree,
|
||||
cm->fc.ymode_counts, cm->fc.pre_ymode_prob,
|
||||
cm->fc.ymode_prob);
|
||||
update_mode_probs(VP9_I32X32_MODES, vp9_sb_ymode_encodings, vp9_sb_ymode_tree,
|
||||
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);
|
||||
cm->fc.sb_ymode_prob, 0);
|
||||
for (i = 0; i < VP9_YMODES; ++i) {
|
||||
update_mode_probs(VP9_UV_MODES, vp9_uv_mode_encodings, vp9_uv_mode_tree,
|
||||
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]);
|
||||
cm->fc.uv_mode_prob[i], 0);
|
||||
}
|
||||
update_mode_probs(VP9_NKF_BINTRAMODES, vp9_bmode_encodings, vp9_bmode_tree,
|
||||
update_mode_probs(VP9_NKF_BINTRAMODES, vp9_bmode_tree,
|
||||
cm->fc.bmode_counts, cm->fc.pre_bmode_prob,
|
||||
cm->fc.bmode_prob);
|
||||
update_mode_probs(VP9_I8X8_MODES, vp9_i8x8_mode_encodings,
|
||||
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);
|
||||
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_encoding_array,
|
||||
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]);
|
||||
cm->fc.pre_sub_mv_ref_prob[i], cm->fc.sub_mv_ref_prob[i],
|
||||
LEFT4X4);
|
||||
}
|
||||
update_mode_probs(VP9_NUMMBSPLITS, vp9_mbsplit_encodings, vp9_mbsplit_tree,
|
||||
update_mode_probs(VP9_NUMMBSPLITS, vp9_mbsplit_tree,
|
||||
cm->fc.mbsplit_counts, cm->fc.pre_mbsplit_prob,
|
||||
cm->fc.mbsplit_prob);
|
||||
cm->fc.mbsplit_prob, 0);
|
||||
#if CONFIG_COMP_INTERINTRA_PRED
|
||||
if (cm->use_interintra) {
|
||||
int factor, interintra_prob, count;
|
||||
@ -631,3 +632,65 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void set_default_lf_deltas(MACROBLOCKD *xd) {
|
||||
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[LAST_FRAME] = 0;
|
||||
xd->ref_lf_deltas[GOLDEN_FRAME] = -2;
|
||||
xd->ref_lf_deltas[ALTREF_FRAME] = -2;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
|
||||
// Reset the segment feature data to the default stats:
|
||||
// Features disabled, 0, with delta coding (Default state).
|
||||
int i;
|
||||
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));
|
||||
|
||||
/* 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);
|
||||
|
||||
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);
|
||||
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));
|
||||
}
|
||||
|
||||
vpx_memset(cm->prev_mip, 0,
|
||||
(cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
|
||||
vpx_memset(cm->mip, 0,
|
||||
(cm->mb_cols + 1) * (cm->mb_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;
|
||||
|
||||
cm->frame_context_idx = 0;
|
||||
}
|
||||
|
@ -34,8 +34,6 @@ 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_prob[VP9_SUBMVREFS - 1];
|
||||
|
||||
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]
|
||||
@ -76,11 +74,14 @@ void vp9_entropy_mode_init(void);
|
||||
|
||||
struct VP9Common;
|
||||
|
||||
/* sets up common features to forget past dependence */
|
||||
void vp9_setup_past_independence(struct VP9Common *cm, MACROBLOCKD *xd);
|
||||
|
||||
void vp9_init_mbmode_probs(struct VP9Common *x);
|
||||
|
||||
extern void vp9_init_mode_contexts(struct VP9Common *pc);
|
||||
|
||||
extern void vp9_update_mode_context(struct VP9Common *pc);
|
||||
extern void vp9_adapt_mode_context(struct VP9Common *pc);
|
||||
|
||||
extern void vp9_accum_mv_refs(struct VP9Common *pc,
|
||||
MB_PREDICTION_MODE m,
|
||||
@ -101,6 +102,8 @@ extern const INTERPOLATIONFILTERTYPE vp9_switchable_interp
|
||||
|
||||
extern const int vp9_switchable_interp_map[SWITCHABLE + 1];
|
||||
|
||||
extern const int vp9_is_interpolating_filter[SWITCHABLE + 1];
|
||||
|
||||
extern const vp9_tree_index vp9_switchable_interp_tree
|
||||
[2 * (VP9_SWITCHABLE_FILTERS - 1)];
|
||||
|
||||
|
@ -42,7 +42,10 @@ const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2] = {
|
||||
-MV_CLASS_2, -MV_CLASS_3,
|
||||
10, 12,
|
||||
-MV_CLASS_4, -MV_CLASS_5,
|
||||
-MV_CLASS_6, -MV_CLASS_7,
|
||||
-MV_CLASS_6, 14,
|
||||
16, 18,
|
||||
-MV_CLASS_7, -MV_CLASS_8,
|
||||
-MV_CLASS_9, -MV_CLASS_10,
|
||||
};
|
||||
struct vp9_token_struct vp9_mv_class_encodings[MV_CLASSES];
|
||||
|
||||
@ -62,24 +65,24 @@ const nmv_context vp9_default_nmv_context = {
|
||||
{32, 64, 96},
|
||||
{
|
||||
{ /* vert component */
|
||||
128, /* sign */
|
||||
{224, 144, 192, 168, 192, 176, 192}, /* class */
|
||||
{216}, /* class0 */
|
||||
{136, 140, 148, 160, 176, 192, 224}, /* bits */
|
||||
{{128, 128, 64}, {96, 112, 64}}, /* class0_fp */
|
||||
{64, 96, 64}, /* fp */
|
||||
160, /* class0_hp bit */
|
||||
128, /* hp */
|
||||
128, /* sign */
|
||||
{224, 144, 192, 168, 192, 176, 192, 198, 198, 245}, /* class */
|
||||
{216}, /* class0 */
|
||||
{136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, /* bits */
|
||||
{{128, 128, 64}, {96, 112, 64}}, /* class0_fp */
|
||||
{64, 96, 64}, /* fp */
|
||||
160, /* class0_hp bit */
|
||||
128, /* hp */
|
||||
},
|
||||
{ /* hor component */
|
||||
128, /* sign */
|
||||
{216, 128, 176, 160, 176, 176, 192}, /* class */
|
||||
{208}, /* class0 */
|
||||
{136, 140, 148, 160, 176, 192, 224}, /* bits */
|
||||
{{128, 128, 64}, {96, 112, 64}}, /* class0_fp */
|
||||
{64, 96, 64}, /* fp */
|
||||
160, /* class0_hp bit */
|
||||
128, /* hp */
|
||||
128, /* sign */
|
||||
{216, 128, 176, 160, 176, 176, 192, 198, 198, 208}, /* class */
|
||||
{208}, /* class0 */
|
||||
{136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, /* bits */
|
||||
{{128, 128, 64}, {96, 112, 64}}, /* class0_fp */
|
||||
{64, 96, 64}, /* fp */
|
||||
160, /* class0_hp bit */
|
||||
128, /* hp */
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -103,6 +106,9 @@ MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) {
|
||||
else if (z < CLASS0_SIZE * 256) c = MV_CLASS_5;
|
||||
else if (z < CLASS0_SIZE * 512) c = MV_CLASS_6;
|
||||
else if (z < CLASS0_SIZE * 1024) c = MV_CLASS_7;
|
||||
else if (z < CLASS0_SIZE * 2048) c = MV_CLASS_8;
|
||||
else if (z < CLASS0_SIZE * 4096) c = MV_CLASS_9;
|
||||
else if (z < CLASS0_SIZE * 8192) c = MV_CLASS_10;
|
||||
else assert(0);
|
||||
if (offset)
|
||||
*offset = z - mv_class_base(c);
|
||||
@ -110,11 +116,8 @@ MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) {
|
||||
}
|
||||
|
||||
int vp9_use_nmv_hp(const MV *ref) {
|
||||
if ((abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH &&
|
||||
(abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH &&
|
||||
(abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH;
|
||||
}
|
||||
|
||||
int vp9_get_mv_mag(MV_CLASS_TYPE c, int offset) {
|
||||
@ -134,6 +137,7 @@ static void increment_nmv_component(int v,
|
||||
int incr,
|
||||
int usehp) {
|
||||
int s, z, c, o, d, e, f;
|
||||
if (!incr) return;
|
||||
assert (v != 0); /* should not be zero */
|
||||
s = v < 0;
|
||||
mvcomp->sign[s] += incr;
|
||||
@ -211,24 +215,26 @@ void vp9_increment_nmv(const MV *mv, const MV *ref, nmv_context_counts *mvctx,
|
||||
}
|
||||
}
|
||||
|
||||
static void adapt_prob(vp9_prob *dest, vp9_prob prep, vp9_prob newp,
|
||||
static void adapt_prob(vp9_prob *dest, vp9_prob prep,
|
||||
unsigned int ct[2]) {
|
||||
int count = ct[0] + ct[1];
|
||||
|
||||
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);
|
||||
} else {
|
||||
*dest = prep;
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_counts_process(nmv_context_counts *NMVcount, int usehp) {
|
||||
counts_to_context(&NMVcount->comps[0], usehp);
|
||||
counts_to_context(&NMVcount->comps[1], usehp);
|
||||
void vp9_counts_process(nmv_context_counts *nmv_count, int usehp) {
|
||||
counts_to_context(&nmv_count->comps[0], usehp);
|
||||
counts_to_context(&nmv_count->comps[1], usehp);
|
||||
}
|
||||
|
||||
void vp9_counts_to_nmv_context(
|
||||
nmv_context_counts *NMVcount,
|
||||
nmv_context_counts *nmv_count,
|
||||
nmv_context *prob,
|
||||
int usehp,
|
||||
unsigned int (*branch_ct_joint)[2],
|
||||
@ -241,81 +247,90 @@ void vp9_counts_to_nmv_context(
|
||||
unsigned int (*branch_ct_class0_hp)[2],
|
||||
unsigned int (*branch_ct_hp)[2]) {
|
||||
int i, j, k;
|
||||
vp9_counts_process(NMVcount, usehp);
|
||||
vp9_tree_probs_from_distribution(MV_JOINTS,
|
||||
vp9_mv_joint_encodings,
|
||||
vp9_mv_joint_tree,
|
||||
vp9_counts_process(nmv_count, usehp);
|
||||
vp9_tree_probs_from_distribution(vp9_mv_joint_tree,
|
||||
prob->joints,
|
||||
branch_ct_joint,
|
||||
NMVcount->joints);
|
||||
nmv_count->joints, 0);
|
||||
for (i = 0; i < 2; ++i) {
|
||||
prob->comps[i].sign = get_binary_prob(NMVcount->comps[i].sign[0],
|
||||
NMVcount->comps[i].sign[1]);
|
||||
branch_ct_sign[i][0] = NMVcount->comps[i].sign[0];
|
||||
branch_ct_sign[i][1] = NMVcount->comps[i].sign[1];
|
||||
vp9_tree_probs_from_distribution(MV_CLASSES,
|
||||
vp9_mv_class_encodings,
|
||||
vp9_mv_class_tree,
|
||||
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];
|
||||
vp9_tree_probs_from_distribution(vp9_mv_class_tree,
|
||||
prob->comps[i].classes,
|
||||
branch_ct_classes[i],
|
||||
NMVcount->comps[i].classes);
|
||||
vp9_tree_probs_from_distribution(CLASS0_SIZE,
|
||||
vp9_mv_class0_encodings,
|
||||
vp9_mv_class0_tree,
|
||||
nmv_count->comps[i].classes, 0);
|
||||
vp9_tree_probs_from_distribution(vp9_mv_class0_tree,
|
||||
prob->comps[i].class0,
|
||||
branch_ct_class0[i],
|
||||
NMVcount->comps[i].class0);
|
||||
nmv_count->comps[i].class0, 0);
|
||||
for (j = 0; j < MV_OFFSET_BITS; ++j) {
|
||||
prob->comps[i].bits[j] = get_binary_prob(NMVcount->comps[i].bits[j][0],
|
||||
NMVcount->comps[i].bits[j][1]);
|
||||
branch_ct_bits[i][j][0] = NMVcount->comps[i].bits[j][0];
|
||||
branch_ct_bits[i][j][1] = NMVcount->comps[i].bits[j][1];
|
||||
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];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (k = 0; k < CLASS0_SIZE; ++k) {
|
||||
vp9_tree_probs_from_distribution(4,
|
||||
vp9_mv_fp_encodings,
|
||||
vp9_mv_fp_tree,
|
||||
vp9_tree_probs_from_distribution(vp9_mv_fp_tree,
|
||||
prob->comps[i].class0_fp[k],
|
||||
branch_ct_class0_fp[i][k],
|
||||
NMVcount->comps[i].class0_fp[k]);
|
||||
nmv_count->comps[i].class0_fp[k], 0);
|
||||
}
|
||||
vp9_tree_probs_from_distribution(4,
|
||||
vp9_mv_fp_encodings,
|
||||
vp9_mv_fp_tree,
|
||||
vp9_tree_probs_from_distribution(vp9_mv_fp_tree,
|
||||
prob->comps[i].fp,
|
||||
branch_ct_fp[i],
|
||||
NMVcount->comps[i].fp);
|
||||
nmv_count->comps[i].fp, 0);
|
||||
}
|
||||
if (usehp) {
|
||||
for (i = 0; i < 2; ++i) {
|
||||
prob->comps[i].class0_hp =
|
||||
get_binary_prob(NMVcount->comps[i].class0_hp[0],
|
||||
NMVcount->comps[i].class0_hp[1]);
|
||||
branch_ct_class0_hp[i][0] = NMVcount->comps[i].class0_hp[0];
|
||||
branch_ct_class0_hp[i][1] = NMVcount->comps[i].class0_hp[1];
|
||||
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];
|
||||
|
||||
prob->comps[i].hp = get_binary_prob(NMVcount->comps[i].hp[0],
|
||||
NMVcount->comps[i].hp[1]);
|
||||
branch_ct_hp[i][0] = NMVcount->comps[i].hp[0];
|
||||
branch_ct_hp[i][1] = NMVcount->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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int adapt_probs(unsigned int i,
|
||||
vp9_tree tree,
|
||||
vp9_prob this_probs[],
|
||||
const vp9_prob last_probs[],
|
||||
const unsigned int num_events[]) {
|
||||
vp9_prob this_prob;
|
||||
|
||||
const uint32_t left = tree[i] <= 0
|
||||
? num_events[-tree[i]]
|
||||
: adapt_probs(tree[i], tree, this_probs, last_probs, num_events);
|
||||
|
||||
const uint32_t right = tree[i + 1] <= 0
|
||||
? num_events[-tree[i + 1]]
|
||||
: adapt_probs(tree[i + 1], tree, this_probs, last_probs, num_events);
|
||||
|
||||
uint32_t weight = left + right;
|
||||
if (weight) {
|
||||
this_prob = get_binary_prob(left, right);
|
||||
weight = weight > MV_COUNT_SAT ? MV_COUNT_SAT : weight;
|
||||
this_prob = weighted_prob(last_probs[i >> 1], this_prob,
|
||||
MV_MAX_UPDATE_FACTOR * weight / MV_COUNT_SAT);
|
||||
} else {
|
||||
this_prob = last_probs[i >> 1];
|
||||
}
|
||||
this_probs[i >> 1] = this_prob;
|
||||
return left + right;
|
||||
}
|
||||
|
||||
|
||||
void vp9_adapt_nmv_probs(VP9_COMMON *cm, int usehp) {
|
||||
int i, j, k;
|
||||
nmv_context prob;
|
||||
unsigned int branch_ct_joint[MV_JOINTS - 1][2];
|
||||
unsigned int branch_ct_sign[2][2];
|
||||
unsigned int branch_ct_classes[2][MV_CLASSES - 1][2];
|
||||
unsigned int branch_ct_class0[2][CLASS0_SIZE - 1][2];
|
||||
unsigned int branch_ct_bits[2][MV_OFFSET_BITS][2];
|
||||
unsigned int branch_ct_class0_fp[2][CLASS0_SIZE][4 - 1][2];
|
||||
unsigned int branch_ct_fp[2][4 - 1][2];
|
||||
unsigned int branch_ct_class0_hp[2][2];
|
||||
unsigned int branch_ct_hp[2][2];
|
||||
int i, j;
|
||||
#ifdef MV_COUNT_TESTING
|
||||
printf("joints count: ");
|
||||
for (j = 0; j < MV_JOINTS; ++j) printf("%d ", cm->fc.NMVcount.joints[j]);
|
||||
@ -376,75 +391,48 @@ void vp9_adapt_nmv_probs(VP9_COMMON *cm, int usehp) {
|
||||
smooth_counts(&cm->fc.NMVcount.comps[0]);
|
||||
smooth_counts(&cm->fc.NMVcount.comps[1]);
|
||||
#endif
|
||||
vp9_counts_to_nmv_context(&cm->fc.NMVcount,
|
||||
&prob,
|
||||
usehp,
|
||||
branch_ct_joint,
|
||||
branch_ct_sign,
|
||||
branch_ct_classes,
|
||||
branch_ct_class0,
|
||||
branch_ct_bits,
|
||||
branch_ct_class0_fp,
|
||||
branch_ct_fp,
|
||||
branch_ct_class0_hp,
|
||||
branch_ct_hp);
|
||||
vp9_counts_process(&cm->fc.NMVcount, usehp);
|
||||
|
||||
adapt_probs(0, vp9_mv_joint_tree,
|
||||
cm->fc.nmvc.joints, cm->fc.pre_nmvc.joints,
|
||||
cm->fc.NMVcount.joints);
|
||||
|
||||
for (j = 0; j < MV_JOINTS - 1; ++j) {
|
||||
adapt_prob(&cm->fc.nmvc.joints[j],
|
||||
cm->fc.pre_nmvc.joints[j],
|
||||
prob.joints[j],
|
||||
branch_ct_joint[j]);
|
||||
}
|
||||
for (i = 0; i < 2; ++i) {
|
||||
adapt_prob(&cm->fc.nmvc.comps[i].sign,
|
||||
cm->fc.pre_nmvc.comps[i].sign,
|
||||
prob.comps[i].sign,
|
||||
branch_ct_sign[i]);
|
||||
for (j = 0; j < MV_CLASSES - 1; ++j) {
|
||||
adapt_prob(&cm->fc.nmvc.comps[i].classes[j],
|
||||
cm->fc.pre_nmvc.comps[i].classes[j],
|
||||
prob.comps[i].classes[j],
|
||||
branch_ct_classes[i][j]);
|
||||
}
|
||||
for (j = 0; j < CLASS0_SIZE - 1; ++j) {
|
||||
adapt_prob(&cm->fc.nmvc.comps[i].class0[j],
|
||||
cm->fc.pre_nmvc.comps[i].class0[j],
|
||||
prob.comps[i].class0[j],
|
||||
branch_ct_class0[i][j]);
|
||||
}
|
||||
cm->fc.NMVcount.comps[i].sign);
|
||||
adapt_probs(0, vp9_mv_class_tree,
|
||||
cm->fc.nmvc.comps[i].classes, cm->fc.pre_nmvc.comps[i].classes,
|
||||
cm->fc.NMVcount.comps[i].classes);
|
||||
adapt_probs(0, vp9_mv_class0_tree,
|
||||
cm->fc.nmvc.comps[i].class0, cm->fc.pre_nmvc.comps[i].class0,
|
||||
cm->fc.NMVcount.comps[i].class0);
|
||||
for (j = 0; j < MV_OFFSET_BITS; ++j) {
|
||||
adapt_prob(&cm->fc.nmvc.comps[i].bits[j],
|
||||
cm->fc.pre_nmvc.comps[i].bits[j],
|
||||
prob.comps[i].bits[j],
|
||||
branch_ct_bits[i][j]);
|
||||
cm->fc.NMVcount.comps[i].bits[j]);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (j = 0; j < CLASS0_SIZE; ++j) {
|
||||
for (k = 0; k < 3; ++k) {
|
||||
adapt_prob(&cm->fc.nmvc.comps[i].class0_fp[j][k],
|
||||
cm->fc.pre_nmvc.comps[i].class0_fp[j][k],
|
||||
prob.comps[i].class0_fp[j][k],
|
||||
branch_ct_class0_fp[i][j][k]);
|
||||
}
|
||||
}
|
||||
for (j = 0; j < 3; ++j) {
|
||||
adapt_prob(&cm->fc.nmvc.comps[i].fp[j],
|
||||
cm->fc.pre_nmvc.comps[i].fp[j],
|
||||
prob.comps[i].fp[j],
|
||||
branch_ct_fp[i][j]);
|
||||
adapt_probs(0, vp9_mv_fp_tree,
|
||||
cm->fc.nmvc.comps[i].class0_fp[j],
|
||||
cm->fc.pre_nmvc.comps[i].class0_fp[j],
|
||||
cm->fc.NMVcount.comps[i].class0_fp[j]);
|
||||
}
|
||||
adapt_probs(0, vp9_mv_fp_tree,
|
||||
cm->fc.nmvc.comps[i].fp,
|
||||
cm->fc.pre_nmvc.comps[i].fp,
|
||||
cm->fc.NMVcount.comps[i].fp);
|
||||
}
|
||||
if (usehp) {
|
||||
for (i = 0; i < 2; ++i) {
|
||||
adapt_prob(&cm->fc.nmvc.comps[i].class0_hp,
|
||||
cm->fc.pre_nmvc.comps[i].class0_hp,
|
||||
prob.comps[i].class0_hp,
|
||||
branch_ct_class0_hp[i]);
|
||||
cm->fc.NMVcount.comps[i].class0_hp);
|
||||
adapt_prob(&cm->fc.nmvc.comps[i].hp,
|
||||
cm->fc.pre_nmvc.comps[i].hp,
|
||||
prob.comps[i].hp,
|
||||
branch_ct_hp[i]);
|
||||
cm->fc.NMVcount.comps[i].hp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ extern const vp9_tree_index vp9_mv_joint_tree[2 * MV_JOINTS - 2];
|
||||
extern struct vp9_token_struct vp9_mv_joint_encodings [MV_JOINTS];
|
||||
|
||||
/* Symbols for coding magnitude class of nonzero components */
|
||||
#define MV_CLASSES 8
|
||||
#define MV_CLASSES 11
|
||||
typedef enum {
|
||||
MV_CLASS_0 = 0, /* (0, 2] integer pel */
|
||||
MV_CLASS_1 = 1, /* (2, 4] integer pel */
|
||||
@ -59,6 +59,9 @@ typedef enum {
|
||||
MV_CLASS_5 = 5, /* (32, 64] integer pel */
|
||||
MV_CLASS_6 = 6, /* (64, 128] integer pel */
|
||||
MV_CLASS_7 = 7, /* (128, 256] integer pel */
|
||||
MV_CLASS_8 = 8, /* (256, 512] integer pel */
|
||||
MV_CLASS_9 = 9, /* (512, 1024] integer pel */
|
||||
MV_CLASS_10 = 10, /* (1024,2048] integer pel */
|
||||
} MV_CLASS_TYPE;
|
||||
|
||||
extern const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2];
|
||||
|
@ -11,159 +11,137 @@
|
||||
#include "vp9/common/vp9_extend.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
static void copy_and_extend_plane(uint8_t *s, /* source */
|
||||
int sp, /* source pitch */
|
||||
uint8_t *d, /* destination */
|
||||
int dp, /* destination pitch */
|
||||
int h, /* height */
|
||||
int w, /* width */
|
||||
int et, /* extend top border */
|
||||
int el, /* extend left border */
|
||||
int eb, /* extend bottom border */
|
||||
int er) { /* extend right border */
|
||||
int i;
|
||||
uint8_t *src_ptr1, *src_ptr2;
|
||||
uint8_t *dest_ptr1, *dest_ptr2;
|
||||
int linesize;
|
||||
static void copy_and_extend_plane(const uint8_t *src, int src_pitch,
|
||||
uint8_t *dst, int dst_pitch,
|
||||
int w, int h,
|
||||
int extend_top, int extend_left,
|
||||
int extend_bottom, int extend_right) {
|
||||
int i, linesize;
|
||||
|
||||
/* copy the left and right most columns out */
|
||||
src_ptr1 = s;
|
||||
src_ptr2 = s + w - 1;
|
||||
dest_ptr1 = d - el;
|
||||
dest_ptr2 = d + w;
|
||||
// copy the left and right most columns out
|
||||
const uint8_t *src_ptr1 = src;
|
||||
const uint8_t *src_ptr2 = src + w - 1;
|
||||
uint8_t *dst_ptr1 = dst - extend_left;
|
||||
uint8_t *dst_ptr2 = dst + w;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
vpx_memset(dest_ptr1, src_ptr1[0], el);
|
||||
vpx_memcpy(dest_ptr1 + el, src_ptr1, w);
|
||||
vpx_memset(dest_ptr2, src_ptr2[0], er);
|
||||
src_ptr1 += sp;
|
||||
src_ptr2 += sp;
|
||||
dest_ptr1 += dp;
|
||||
dest_ptr2 += dp;
|
||||
vpx_memset(dst_ptr1, src_ptr1[0], extend_left);
|
||||
vpx_memcpy(dst_ptr1 + extend_left, src_ptr1, w);
|
||||
vpx_memset(dst_ptr2, src_ptr2[0], extend_right);
|
||||
src_ptr1 += src_pitch;
|
||||
src_ptr2 += src_pitch;
|
||||
dst_ptr1 += dst_pitch;
|
||||
dst_ptr2 += dst_pitch;
|
||||
}
|
||||
|
||||
/* Now copy the top and bottom lines into each line of the respective
|
||||
* borders
|
||||
*/
|
||||
src_ptr1 = d - el;
|
||||
src_ptr2 = d + dp * (h - 1) - el;
|
||||
dest_ptr1 = d + dp * (-et) - el;
|
||||
dest_ptr2 = d + dp * (h) - el;
|
||||
linesize = el + er + w;
|
||||
// Now copy the top and bottom lines into each line of the respective
|
||||
// borders
|
||||
src_ptr1 = dst - extend_left;
|
||||
src_ptr2 = dst + dst_pitch * (h - 1) - extend_left;
|
||||
dst_ptr1 = dst + dst_pitch * (-extend_top) - extend_left;
|
||||
dst_ptr2 = dst + dst_pitch * (h) - extend_left;
|
||||
linesize = extend_left + extend_right + w;
|
||||
|
||||
for (i = 0; i < et; i++) {
|
||||
vpx_memcpy(dest_ptr1, src_ptr1, linesize);
|
||||
dest_ptr1 += dp;
|
||||
for (i = 0; i < extend_top; i++) {
|
||||
vpx_memcpy(dst_ptr1, src_ptr1, linesize);
|
||||
dst_ptr1 += dst_pitch;
|
||||
}
|
||||
|
||||
for (i = 0; i < eb; i++) {
|
||||
vpx_memcpy(dest_ptr2, src_ptr2, linesize);
|
||||
dest_ptr2 += dp;
|
||||
for (i = 0; i < extend_bottom; i++) {
|
||||
vpx_memcpy(dst_ptr2, src_ptr2, linesize);
|
||||
dst_ptr2 += dst_pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_copy_and_extend_frame(YV12_BUFFER_CONFIG *src,
|
||||
void vp9_copy_and_extend_frame(const YV12_BUFFER_CONFIG *src,
|
||||
YV12_BUFFER_CONFIG *dst) {
|
||||
int et = dst->border;
|
||||
int el = dst->border;
|
||||
int eb = dst->border + dst->y_height - src->y_height;
|
||||
int er = dst->border + dst->y_width - src->y_width;
|
||||
const int et_y = dst->border;
|
||||
const int el_y = dst->border;
|
||||
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;
|
||||
|
||||
copy_and_extend_plane(src->y_buffer, src->y_stride,
|
||||
dst->y_buffer, dst->y_stride,
|
||||
src->y_height, src->y_width,
|
||||
et, el, eb, er);
|
||||
|
||||
et = dst->border >> 1;
|
||||
el = dst->border >> 1;
|
||||
eb = (dst->border >> 1) + dst->uv_height - src->uv_height;
|
||||
er = (dst->border >> 1) + dst->uv_width - src->uv_width;
|
||||
src->y_width, src->y_height,
|
||||
et_y, el_y, eb_y, er_y);
|
||||
|
||||
copy_and_extend_plane(src->u_buffer, src->uv_stride,
|
||||
dst->u_buffer, dst->uv_stride,
|
||||
src->uv_height, src->uv_width,
|
||||
et, el, eb, er);
|
||||
src->uv_width, src->uv_height,
|
||||
et_uv, el_uv, eb_uv, er_uv);
|
||||
|
||||
copy_and_extend_plane(src->v_buffer, src->uv_stride,
|
||||
dst->v_buffer, dst->uv_stride,
|
||||
src->uv_height, src->uv_width,
|
||||
et, el, eb, er);
|
||||
src->uv_width, src->uv_height,
|
||||
et_y, el_y, eb_uv, er_uv);
|
||||
}
|
||||
|
||||
void vp9_copy_and_extend_frame_with_rect(YV12_BUFFER_CONFIG *src,
|
||||
void vp9_copy_and_extend_frame_with_rect(const YV12_BUFFER_CONFIG *src,
|
||||
YV12_BUFFER_CONFIG *dst,
|
||||
int srcy, int srcx,
|
||||
int srch, int srcw) {
|
||||
int et = dst->border;
|
||||
int el = dst->border;
|
||||
int eb = dst->border + dst->y_height - src->y_height;
|
||||
int er = dst->border + dst->y_width - src->y_width;
|
||||
int src_y_offset = srcy * src->y_stride + srcx;
|
||||
int dst_y_offset = srcy * dst->y_stride + srcx;
|
||||
int src_uv_offset = ((srcy * src->uv_stride) >> 1) + (srcx >> 1);
|
||||
int dst_uv_offset = ((srcy * dst->uv_stride) >> 1) + (srcx >> 1);
|
||||
|
||||
// If the side is not touching the bounder then don't extend.
|
||||
if (srcy)
|
||||
et = 0;
|
||||
if (srcx)
|
||||
el = 0;
|
||||
if (srcy + srch != src->y_height)
|
||||
eb = 0;
|
||||
if (srcx + srcw != src->y_width)
|
||||
er = 0;
|
||||
const int et_y = srcy ? 0 : dst->border;
|
||||
const int el_y = srcx ? 0 : dst->border;
|
||||
const int eb_y = srcy + srch != src->y_height ? 0 :
|
||||
dst->border + dst->y_height - src->y_height;
|
||||
const int er_y = srcx + srcw != src->y_width ? 0 :
|
||||
dst->border + dst->y_width - src->y_width;
|
||||
const int src_y_offset = srcy * src->y_stride + srcx;
|
||||
const int dst_y_offset = srcy * dst->y_stride + srcx;
|
||||
|
||||
copy_and_extend_plane(src->y_buffer + src_y_offset,
|
||||
src->y_stride,
|
||||
dst->y_buffer + dst_y_offset,
|
||||
dst->y_stride,
|
||||
srch, srcw,
|
||||
et, el, eb, er);
|
||||
const int et_uv = (et_y + 1) >> 1;
|
||||
const int el_uv = (el_y + 1) >> 1;
|
||||
const int eb_uv = (eb_y + 1) >> 1;
|
||||
const int er_uv = (er_y + 1) >> 1;
|
||||
const int src_uv_offset = ((srcy * src->uv_stride) >> 1) + (srcx >> 1);
|
||||
const int dst_uv_offset = ((srcy * dst->uv_stride) >> 1) + (srcx >> 1);
|
||||
const int srch_uv = (srch + 1) >> 1;
|
||||
const int srcw_uv = (srcw + 1) >> 1;
|
||||
|
||||
et = (et + 1) >> 1;
|
||||
el = (el + 1) >> 1;
|
||||
eb = (eb + 1) >> 1;
|
||||
er = (er + 1) >> 1;
|
||||
srch = (srch + 1) >> 1;
|
||||
srcw = (srcw + 1) >> 1;
|
||||
copy_and_extend_plane(src->y_buffer + src_y_offset, src->y_stride,
|
||||
dst->y_buffer + dst_y_offset, dst->y_stride,
|
||||
srcw, srch,
|
||||
et_y, el_y, eb_y, er_y);
|
||||
|
||||
copy_and_extend_plane(src->u_buffer + src_uv_offset,
|
||||
src->uv_stride,
|
||||
dst->u_buffer + dst_uv_offset,
|
||||
dst->uv_stride,
|
||||
srch, srcw,
|
||||
et, el, eb, er);
|
||||
copy_and_extend_plane(src->u_buffer + src_uv_offset, src->uv_stride,
|
||||
dst->u_buffer + dst_uv_offset, dst->uv_stride,
|
||||
srcw_uv, srch_uv,
|
||||
et_uv, el_uv, eb_uv, er_uv);
|
||||
|
||||
copy_and_extend_plane(src->v_buffer + src_uv_offset,
|
||||
src->uv_stride,
|
||||
dst->v_buffer + dst_uv_offset,
|
||||
dst->uv_stride,
|
||||
srch, srcw,
|
||||
et, el, eb, er);
|
||||
copy_and_extend_plane(src->v_buffer + src_uv_offset, src->uv_stride,
|
||||
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 *ybf, uint8_t *YPtr,
|
||||
uint8_t *UPtr, uint8_t *VPtr) {
|
||||
// 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;
|
||||
|
||||
YPtr += ybf->y_stride * 14;
|
||||
UPtr += ybf->uv_stride * 6;
|
||||
VPtr += ybf->uv_stride * 6;
|
||||
y += buf->y_stride * 14;
|
||||
u += buf->uv_stride * 6;
|
||||
v += buf->uv_stride * 6;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
YPtr[i] = YPtr[-1];
|
||||
UPtr[i] = UPtr[-1];
|
||||
VPtr[i] = VPtr[-1];
|
||||
y[i] = y[-1];
|
||||
u[i] = u[-1];
|
||||
v[i] = v[-1];
|
||||
}
|
||||
|
||||
YPtr += ybf->y_stride;
|
||||
UPtr += ybf->uv_stride;
|
||||
VPtr += ybf->uv_stride;
|
||||
y += buf->y_stride;
|
||||
u += buf->uv_stride;
|
||||
v += buf->uv_stride;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
YPtr[i] = YPtr[-1];
|
||||
UPtr[i] = UPtr[-1];
|
||||
VPtr[i] = VPtr[-1];
|
||||
y[i] = y[-1];
|
||||
u[i] = u[-1];
|
||||
v[i] = v[-1];
|
||||
}
|
||||
}
|
||||
|
@ -14,15 +14,17 @@
|
||||
#include "vpx_scale/yv12config.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
void vp9_extend_mb_row(YV12_BUFFER_CONFIG *ybf, uint8_t *YPtr,
|
||||
uint8_t *UPtr, uint8_t *VPtr);
|
||||
|
||||
void vp9_copy_and_extend_frame(YV12_BUFFER_CONFIG *src,
|
||||
void vp9_copy_and_extend_frame(const YV12_BUFFER_CONFIG *src,
|
||||
YV12_BUFFER_CONFIG *dst);
|
||||
|
||||
void vp9_copy_and_extend_frame_with_rect(YV12_BUFFER_CONFIG *src,
|
||||
void vp9_copy_and_extend_frame_with_rect(const YV12_BUFFER_CONFIG *src,
|
||||
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_
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,10 +21,17 @@
|
||||
|
||||
#define SUBPEL_SHIFTS 16
|
||||
|
||||
extern const int16_t vp9_bilinear_filters[SUBPEL_SHIFTS][2];
|
||||
extern const int16_t vp9_sub_pel_filters_6[SUBPEL_SHIFTS][6];
|
||||
extern const int16_t vp9_bilinear_filters[SUBPEL_SHIFTS][8];
|
||||
extern const int16_t vp9_sub_pel_filters_6[SUBPEL_SHIFTS][8];
|
||||
extern const int16_t vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8];
|
||||
extern const int16_t vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8];
|
||||
extern const int16_t vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS][8];
|
||||
|
||||
// The VP9_BILINEAR_FILTERS_2TAP macro returns a pointer to the bilinear
|
||||
// filter kernel as a 2 tap filter.
|
||||
#define BF_LENGTH (sizeof(vp9_bilinear_filters[0]) / \
|
||||
sizeof(vp9_bilinear_filters[0][0]))
|
||||
#define BF_OFFSET (BF_LENGTH / 2 - 1)
|
||||
#define VP9_BILINEAR_FILTERS_2TAP(x) (vp9_bilinear_filters[x] + BF_OFFSET)
|
||||
|
||||
#endif // VP9_COMMON_VP9_FILTER_H_
|
||||
|
@ -9,10 +9,11 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "vp9/common/vp9_findnearmv.h"
|
||||
#include "vp9/common/vp9_sadmxn.h"
|
||||
#include "vp9/common/vp9_subpelvar.h"
|
||||
#include <limits.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},
|
||||
@ -32,8 +33,7 @@ static void lower_mv_precision(int_mv *mv, int usehp)
|
||||
}
|
||||
|
||||
vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
|
||||
vp9_prob p[4], const int context
|
||||
) {
|
||||
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];
|
||||
@ -87,8 +87,8 @@ unsigned int vp9_sub_pixel_variance16x2_c(const uint8_t *src_ptr,
|
||||
uint8_t temp2[2 * 16];
|
||||
const int16_t *HFilter, *VFilter;
|
||||
|
||||
HFilter = vp9_bilinear_filters[xoffset];
|
||||
VFilter = vp9_bilinear_filters[yoffset];
|
||||
HFilter = VP9_BILINEAR_FILTERS_2TAP(xoffset);
|
||||
VFilter = VP9_BILINEAR_FILTERS_2TAP(yoffset);
|
||||
|
||||
var_filter_block2d_bil_first_pass(src_ptr, FData3,
|
||||
src_pixels_per_line, 1, 3, 16, HFilter);
|
||||
@ -108,8 +108,8 @@ unsigned int vp9_sub_pixel_variance2x16_c(const uint8_t *src_ptr,
|
||||
uint8_t temp2[2 * 16];
|
||||
const int16_t *HFilter, *VFilter;
|
||||
|
||||
HFilter = vp9_bilinear_filters[xoffset];
|
||||
VFilter = vp9_bilinear_filters[yoffset];
|
||||
HFilter = VP9_BILINEAR_FILTERS_2TAP(xoffset);
|
||||
VFilter = VP9_BILINEAR_FILTERS_2TAP(yoffset);
|
||||
|
||||
var_filter_block2d_bil_first_pass(src_ptr, FData3,
|
||||
src_pixels_per_line, 1, 17, 2, HFilter);
|
||||
@ -118,10 +118,12 @@ unsigned int vp9_sub_pixel_variance2x16_c(const uint8_t *src_ptr,
|
||||
return vp9_variance2x16_c(temp2, 2, dst_ptr, dst_pixels_per_line, 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,
|
||||
@ -141,130 +143,140 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
|
||||
int_mv sorted_mvs[MAX_MV_REF_CANDIDATES];
|
||||
int zero_seen = FALSE;
|
||||
|
||||
// Default all to 0,0 if nothing else available
|
||||
nearest->as_int = near->as_int = 0;
|
||||
vpx_memset(sorted_mvs, 0, sizeof(sorted_mvs));
|
||||
if (ref_y_buffer) {
|
||||
|
||||
above_src = xd->dst.y_buffer - xd->dst.y_stride * 2;
|
||||
above_ref = ref_y_buffer - ref_y_stride * 2;
|
||||
// Default all to 0,0 if nothing else available
|
||||
nearest->as_int = near->as_int = 0;
|
||||
vpx_memset(sorted_mvs, 0, sizeof(sorted_mvs));
|
||||
|
||||
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;
|
||||
above_src -= 4;
|
||||
above_ref -= 4;
|
||||
#else
|
||||
left_src = xd->dst.y_buffer - 2;
|
||||
left_ref = ref_y_buffer - 2;
|
||||
left_src = xd->dst.y_buffer - 2;
|
||||
left_ref = ref_y_buffer - 2;
|
||||
#endif
|
||||
|
||||
// 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;
|
||||
// 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;
|
||||
|
||||
this_mv.as_int = mvlist[i].as_int;
|
||||
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 (xd->up_available) {
|
||||
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
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vpx_memcpy(sorted_mvs, mvlist, sizeof(sorted_mvs));
|
||||
}
|
||||
|
||||
// Make sure all the candidates are properly clamped etc
|
||||
@ -273,23 +285,35 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
|
||||
clamp_mv2(&sorted_mvs[i], xd);
|
||||
}
|
||||
|
||||
// Provided that there are non zero vectors available there will not
|
||||
// be more than one 0,0 entry in the sorted list.
|
||||
// The best ref mv is always set to the first entry (which gave the best
|
||||
// results. The nearest is set to the first non zero vector if available and
|
||||
// near to the second non zero vector if available.
|
||||
// We do not use 0,0 as a nearest or near as 0,0 has its own mode.
|
||||
if ( sorted_mvs[0].as_int ) {
|
||||
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;
|
||||
// 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 {
|
||||
nearest->as_int = sorted_mvs[1].as_int;
|
||||
near->as_int = sorted_mvs[2].as_int;
|
||||
near->as_int = sorted_mvs[2].as_int;
|
||||
}
|
||||
|
||||
// Copy back the re-ordered mv list
|
||||
vpx_memcpy(mvlist, sorted_mvs, sizeof(sorted_mvs));
|
||||
}
|
||||
#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
|
||||
|
@ -17,6 +17,9 @@
|
||||
#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)
|
||||
|
||||
/* 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
|
||||
@ -28,9 +31,9 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
|
||||
int_mv *nearest,
|
||||
int_mv *near);
|
||||
|
||||
static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, const int *ref_frame_sign_bias) {
|
||||
MV xmv;
|
||||
xmv = mvp->as_mv;
|
||||
static void mv_bias(int refmb_ref_frame_sign_bias, int refframe,
|
||||
int_mv *mvp, const int *ref_frame_sign_bias) {
|
||||
MV xmv = mvp->as_mv;
|
||||
|
||||
if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe]) {
|
||||
xmv.row *= -1;
|
||||
@ -40,8 +43,6 @@ static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, co
|
||||
mvp->as_mv = xmv;
|
||||
}
|
||||
|
||||
#define LEFT_TOP_MARGIN (16 << 3)
|
||||
#define RIGHT_BOTTOM_MARGIN (16 << 3)
|
||||
|
||||
static void clamp_mv(int_mv *mv,
|
||||
int mb_to_left_edge,
|
||||
@ -71,10 +72,10 @@ static unsigned int check_mv_bounds(int_mv *mv,
|
||||
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) ||
|
||||
(mv->as_mv.row > 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 ||
|
||||
mv->as_mv.row > mb_to_bottom_edge;
|
||||
}
|
||||
|
||||
vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
|
||||
@ -83,21 +84,30 @@ vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
|
||||
|
||||
extern const uint8_t vp9_mbsplit_offset[4][16];
|
||||
|
||||
static int left_block_mv(const MODE_INFO *cur_mb, int b) {
|
||||
static int left_block_mv(const MACROBLOCKD *xd,
|
||||
const MODE_INFO *cur_mb, int b) {
|
||||
if (!(b & 3)) {
|
||||
/* On L edge, get from MB to left of us */
|
||||
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.first.as_int;
|
||||
return (cur_mb->bmi + b - 1)->as_mv[0].as_int;
|
||||
}
|
||||
|
||||
static int left_block_second_mv(const MODE_INFO *cur_mb, int b) {
|
||||
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;
|
||||
|
||||
/* On L edge, get from MB to left of us */
|
||||
--cur_mb;
|
||||
|
||||
@ -108,8 +118,8 @@ static int left_block_second_mv(const MODE_INFO *cur_mb, int b) {
|
||||
}
|
||||
|
||||
return cur_mb->mbmi.second_ref_frame > 0 ?
|
||||
(cur_mb->bmi + b - 1)->as_mv.second.as_int :
|
||||
(cur_mb->bmi + b - 1)->as_mv.first.as_int;
|
||||
(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) {
|
||||
@ -122,7 +132,7 @@ static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
|
||||
b += 16;
|
||||
}
|
||||
|
||||
return (cur_mb->bmi + b - 4)->as_mv.first.as_int;
|
||||
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) {
|
||||
@ -137,8 +147,8 @@ static int above_block_second_mv(const MODE_INFO *cur_mb, int b, int mi_stride)
|
||||
}
|
||||
|
||||
return cur_mb->mbmi.second_ref_frame > 0 ?
|
||||
(cur_mb->bmi + b - 4)->as_mv.second.as_int :
|
||||
(cur_mb->bmi + b - 4)->as_mv.first.as_int;
|
||||
(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) {
|
||||
|
1307
vp9/common/vp9_idct.c
Normal file
1307
vp9/common/vp9_idct.c
Normal file
File diff suppressed because it is too large
Load Diff
85
vp9/common/vp9_idct.h
Normal file
85
vp9/common/vp9_idct.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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_IDCT_H_
|
||||
#define VP9_COMMON_VP9_IDCT_H_
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#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))
|
||||
|
||||
#define pair_set_epi16(a, b) \
|
||||
_mm_set1_epi32(((uint16_t)(a)) + (((uint16_t)(b)) << 16))
|
||||
|
||||
// Constants are round(16384 * cos(k*Pi/64)) where k = 1 to 31.
|
||||
// Note: sin(k*Pi/64) = cos((32-k)*Pi/64)
|
||||
static const int cospi_1_64 = 16364;
|
||||
static const int cospi_2_64 = 16305;
|
||||
static const int cospi_3_64 = 16207;
|
||||
static const int cospi_4_64 = 16069;
|
||||
static const int cospi_5_64 = 15893;
|
||||
static const int cospi_6_64 = 15679;
|
||||
static const int cospi_7_64 = 15426;
|
||||
static const int cospi_8_64 = 15137;
|
||||
static const int cospi_9_64 = 14811;
|
||||
static const int cospi_10_64 = 14449;
|
||||
static const int cospi_11_64 = 14053;
|
||||
static const int cospi_12_64 = 13623;
|
||||
static const int cospi_13_64 = 13160;
|
||||
static const int cospi_14_64 = 12665;
|
||||
static const int cospi_15_64 = 12140;
|
||||
static const int cospi_16_64 = 11585;
|
||||
static const int cospi_17_64 = 11003;
|
||||
static const int cospi_18_64 = 10394;
|
||||
static const int cospi_19_64 = 9760;
|
||||
static const int cospi_20_64 = 9102;
|
||||
static const int cospi_21_64 = 8423;
|
||||
static const int cospi_22_64 = 7723;
|
||||
static const int cospi_23_64 = 7005;
|
||||
static const int cospi_24_64 = 6270;
|
||||
static const int cospi_25_64 = 5520;
|
||||
static const int cospi_26_64 = 4756;
|
||||
static const int cospi_27_64 = 3981;
|
||||
static const int cospi_28_64 = 3196;
|
||||
static const int cospi_29_64 = 2404;
|
||||
static const int cospi_30_64 = 1606;
|
||||
static const int cospi_31_64 = 804;
|
||||
|
||||
// 16384 * sqrt(2) * sin(kPi/9) * 2 / 3
|
||||
static const int sinpi_1_9 = 5283;
|
||||
static const int sinpi_2_9 = 9929;
|
||||
static const int sinpi_3_9 = 13377;
|
||||
static const int sinpi_4_9 = 15212;
|
||||
|
||||
static INLINE int dct_const_round_shift(int input) {
|
||||
int rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
|
||||
assert(INT16_MIN <= rv && rv <= INT16_MAX);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static INLINE int dct_32_round(int input) {
|
||||
int rv = ROUND_POWER_OF_TWO(input, DCT_CONST_BITS);
|
||||
assert(-131072 <= rv && rv <= 131071);
|
||||
return rv;
|
||||
}
|
||||
|
||||
typedef void (*transform_1d)(int16_t*, int16_t*);
|
||||
|
||||
typedef struct {
|
||||
transform_1d cols, rows; // vertical and horizontal
|
||||
} transform_2d;
|
||||
|
||||
#endif // VP9_COMMON_VP9_IDCT_H_
|
File diff suppressed because it is too large
Load Diff
@ -11,50 +11,25 @@
|
||||
#include "vp9/common/vp9_invtrans.h"
|
||||
#include "./vp9_rtcd.h"
|
||||
|
||||
static void recon_dcblock(MACROBLOCKD *xd) {
|
||||
BLOCKD *b = &xd->block[24];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
xd->block[i].dqcoeff[0] = b->diff[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void recon_dcblock_8x8(MACROBLOCKD *xd) {
|
||||
BLOCKD *b = &xd->block[24]; // for coeff 0, 2, 8, 10
|
||||
|
||||
xd->block[0].dqcoeff[0] = b->diff[0];
|
||||
xd->block[4].dqcoeff[0] = b->diff[1];
|
||||
xd->block[8].dqcoeff[0] = b->diff[4];
|
||||
xd->block[12].dqcoeff[0] = b->diff[8];
|
||||
}
|
||||
|
||||
void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int block, int pitch) {
|
||||
BLOCKD *b = &xd->block[block];
|
||||
if (b->eob <= 1)
|
||||
xd->inv_xform4x4_1_x8(b->dqcoeff, b->diff, pitch);
|
||||
void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int eob,
|
||||
int16_t *dqcoeff, int16_t *diff,
|
||||
int pitch) {
|
||||
if (eob <= 1)
|
||||
xd->inv_txm4x4_1(dqcoeff, diff, pitch);
|
||||
else
|
||||
xd->inv_xform4x4_x8(b->dqcoeff, b->diff, pitch);
|
||||
xd->inv_txm4x4(dqcoeff, diff, pitch);
|
||||
}
|
||||
|
||||
void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) {
|
||||
int i;
|
||||
BLOCKD *blockd = xd->block;
|
||||
int has_2nd_order = get_2nd_order_usage(xd);
|
||||
|
||||
if (has_2nd_order) {
|
||||
/* do 2nd order transform on the dc block */
|
||||
vp9_short_inv_walsh4x4(blockd[24].dqcoeff, blockd[24].diff);
|
||||
recon_dcblock(xd);
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
TX_TYPE tx_type = get_tx_type_4x4(xd, &xd->block[i]);
|
||||
TX_TYPE tx_type = get_tx_type_4x4(xd, i);
|
||||
if (tx_type != DCT_DCT) {
|
||||
vp9_ihtllm(xd->block[i].dqcoeff, xd->block[i].diff, 32,
|
||||
tx_type, 4, xd->block[i].eob);
|
||||
vp9_short_iht4x4(xd->block[i].dqcoeff, xd->block[i].diff, 16, tx_type);
|
||||
} else {
|
||||
vp9_inverse_transform_b_4x4(xd, i, 32);
|
||||
vp9_inverse_transform_b_4x4(xd, xd->eobs[i], xd->block[i].dqcoeff,
|
||||
xd->block[i].diff, 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -63,7 +38,8 @@ void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd) {
|
||||
int i;
|
||||
|
||||
for (i = 16; i < 24; i++) {
|
||||
vp9_inverse_transform_b_4x4(xd, i, 16);
|
||||
vp9_inverse_transform_b_4x4(xd, xd->eobs[i], xd->block[i].dqcoeff,
|
||||
xd->block[i].diff, 16);
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,29 +56,21 @@ void vp9_inverse_transform_b_8x8(int16_t *input_dqcoeff, int16_t *output_coeff,
|
||||
void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) {
|
||||
int i;
|
||||
BLOCKD *blockd = xd->block;
|
||||
int has_2nd_order = get_2nd_order_usage(xd);
|
||||
|
||||
if (has_2nd_order) {
|
||||
// do 2nd order transform on the dc block
|
||||
vp9_short_ihaar2x2(blockd[24].dqcoeff, blockd[24].diff, 8);
|
||||
recon_dcblock_8x8(xd); // need to change for 8x8
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; i += 8) {
|
||||
TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[i]);
|
||||
TX_TYPE tx_type = get_tx_type_8x8(xd, i);
|
||||
if (tx_type != DCT_DCT) {
|
||||
vp9_ihtllm(xd->block[i].dqcoeff, xd->block[i].diff, 32, tx_type, 8,
|
||||
xd->block[i].eob);
|
||||
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, &xd->block[i]);
|
||||
TX_TYPE tx_type = get_tx_type_8x8(xd, i);
|
||||
if (tx_type != DCT_DCT) {
|
||||
vp9_ihtllm(xd->block[i + 2].dqcoeff, xd->block[i].diff, 32, tx_type, 8,
|
||||
xd->block[i + 2].eob);
|
||||
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);
|
||||
@ -132,9 +100,9 @@ void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
|
||||
|
||||
void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd) {
|
||||
BLOCKD *bd = &xd->block[0];
|
||||
TX_TYPE tx_type = get_tx_type_16x16(xd, bd);
|
||||
TX_TYPE tx_type = get_tx_type_16x16(xd, 0);
|
||||
if (tx_type != DCT_DCT) {
|
||||
vp9_ihtllm(bd->dqcoeff, bd->diff, 32, tx_type, 16, bd->eob);
|
||||
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);
|
||||
@ -146,13 +114,208 @@ void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd) {
|
||||
vp9_inverse_transform_mbuv_8x8(xd);
|
||||
}
|
||||
|
||||
void vp9_inverse_transform_sby_32x32(SUPERBLOCKD *xd_sb) {
|
||||
vp9_short_idct32x32(xd_sb->dqcoeff, xd_sb->diff, 64);
|
||||
void vp9_inverse_transform_sby_32x32(MACROBLOCKD *xd) {
|
||||
vp9_short_idct32x32(xd->dqcoeff, xd->diff, 64);
|
||||
}
|
||||
|
||||
void vp9_inverse_transform_sbuv_16x16(SUPERBLOCKD *xd_sb) {
|
||||
vp9_inverse_transform_b_16x16(xd_sb->dqcoeff + 1024,
|
||||
xd_sb->diff + 1024, 32);
|
||||
vp9_inverse_transform_b_16x16(xd_sb->dqcoeff + 1280,
|
||||
xd_sb->diff + 1280, 32);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -15,31 +15,47 @@
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
|
||||
extern void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int block, int pitch);
|
||||
void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int eob,
|
||||
int16_t *dqcoeff, int16_t *diff,
|
||||
int pitch);
|
||||
|
||||
extern void vp9_inverse_transform_mb_4x4(MACROBLOCKD *xd);
|
||||
void vp9_inverse_transform_mb_4x4(MACROBLOCKD *xd);
|
||||
|
||||
extern void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd);
|
||||
void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd);
|
||||
|
||||
extern void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd);
|
||||
void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd);
|
||||
|
||||
extern void vp9_inverse_transform_b_8x8(int16_t *input_dqcoeff,
|
||||
void vp9_inverse_transform_b_8x8(int16_t *input_dqcoeff,
|
||||
int16_t *output_coeff, int pitch);
|
||||
|
||||
extern void vp9_inverse_transform_mb_8x8(MACROBLOCKD *xd);
|
||||
void vp9_inverse_transform_mb_8x8(MACROBLOCKD *xd);
|
||||
|
||||
extern void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd);
|
||||
void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd);
|
||||
|
||||
extern void vp9_inverse_transform_mbuv_8x8(MACROBLOCKD *xd);
|
||||
void vp9_inverse_transform_mbuv_8x8(MACROBLOCKD *xd);
|
||||
|
||||
extern void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
|
||||
void vp9_inverse_transform_b_16x16(int16_t *input_dqcoeff,
|
||||
int16_t *output_coeff, int pitch);
|
||||
|
||||
extern void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd);
|
||||
void vp9_inverse_transform_mb_16x16(MACROBLOCKD *xd);
|
||||
|
||||
extern void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd);
|
||||
void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd);
|
||||
|
||||
extern void vp9_inverse_transform_sby_32x32(SUPERBLOCKD *xd_sb);
|
||||
extern void vp9_inverse_transform_sbuv_16x16(SUPERBLOCKD *xd_sb);
|
||||
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);
|
||||
|
||||
#endif // VP9_COMMON_VP9_INVTRANS_H_
|
||||
|
@ -109,6 +109,9 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm,
|
||||
loop_filter_info_n *lfi = &cm->lf_info;
|
||||
|
||||
/* update limits if sharpness has changed */
|
||||
// printf("vp9_loop_filter_frame_init %d\n", default_filt_lvl);
|
||||
// printf("sharpness level: %d [%d]\n",
|
||||
// cm->sharpness_level, cm->last_sharpness_level);
|
||||
if (cm->last_sharpness_level != cm->sharpness_level) {
|
||||
vp9_loop_filter_update_sharpness(lfi, cm->sharpness_level);
|
||||
cm->last_sharpness_level = cm->sharpness_level;
|
||||
@ -126,7 +129,7 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm,
|
||||
lvl_seg = vp9_get_segdata(xd, seg, SEG_LVL_ALT_LF);
|
||||
} else { /* Delta Value */
|
||||
lvl_seg += vp9_get_segdata(xd, seg, SEG_LVL_ALT_LF);
|
||||
lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63 : lvl_seg) : 0;
|
||||
lvl_seg = clamp(lvl_seg, 0, 63);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,13 +152,12 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm,
|
||||
/* Apply delta for Intra modes */
|
||||
mode = 0; /* B_PRED */
|
||||
/* Only the split mode BPRED has a further special case */
|
||||
lvl_mode = lvl_ref + xd->mode_lf_deltas[mode];
|
||||
lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0; /* clamp */
|
||||
lvl_mode = clamp(lvl_ref + xd->mode_lf_deltas[mode], 0, 63);
|
||||
|
||||
lfi->lvl[seg][ref][mode] = lvl_mode;
|
||||
|
||||
mode = 1; /* all the rest of Intra modes */
|
||||
lvl_mode = (lvl_ref > 0) ? (lvl_ref > 63 ? 63 : lvl_ref) : 0; /* clamp */
|
||||
lvl_mode = clamp(lvl_ref, 0, 63);
|
||||
lfi->lvl[seg][ref][mode] = lvl_mode;
|
||||
|
||||
/* LAST, GOLDEN, ALT */
|
||||
@ -167,9 +169,7 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm,
|
||||
|
||||
/* Apply delta for Inter modes */
|
||||
for (mode = 1; mode < 4; mode++) {
|
||||
lvl_mode = lvl_ref + xd->mode_lf_deltas[mode];
|
||||
lvl_mode = (lvl_mode > 0) ? (lvl_mode > 63 ? 63 : lvl_mode) : 0; /* clamp */
|
||||
|
||||
lvl_mode = clamp(lvl_ref + xd->mode_lf_deltas[mode], 0, 63);
|
||||
lfi->lvl[seg][ref][mode] = lvl_mode;
|
||||
}
|
||||
}
|
||||
@ -202,10 +202,12 @@ static int sb_mb_lf_skip(const MODE_INFO *const mip0,
|
||||
mbmi1->mv[mbmi1->ref_frame].as_int) &&
|
||||
mbmi0->ref_frame != INTRA_FRAME;
|
||||
}
|
||||
|
||||
void vp9_loop_filter_frame(VP9_COMMON *cm,
|
||||
MACROBLOCKD *xd,
|
||||
int frame_filter_level,
|
||||
int y_only) {
|
||||
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;
|
||||
@ -271,7 +273,6 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
|
||||
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 &&
|
||||
@ -299,6 +300,62 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
|
||||
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
|
||||
} else {
|
||||
// FIXME: Not 8x8 aware
|
||||
if (mb_col > 0 &&
|
||||
@ -376,16 +433,13 @@ void vp9_loop_filter_partial_frame(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||
*/
|
||||
if (alt_flt_enabled) {
|
||||
for (i = 0; i < MAX_MB_SEGMENTS; i++) {
|
||||
/* Abs value */
|
||||
if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
|
||||
// Abs value
|
||||
lvl_seg[i] = vp9_get_segdata(xd, i, SEG_LVL_ALT_LF);
|
||||
}
|
||||
/* Delta Value */
|
||||
else {
|
||||
lvl_seg[i] = default_filt_lvl +
|
||||
vp9_get_segdata(xd, i, SEG_LVL_ALT_LF);
|
||||
lvl_seg[i] = (lvl_seg[i] > 0) ?
|
||||
((lvl_seg[i] > 63) ? 63 : lvl_seg[i]) : 0;
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,8 @@ void vp9_loop_filter_frame_init(struct VP9Common *cm,
|
||||
void vp9_loop_filter_frame(struct VP9Common *cm,
|
||||
struct macroblockd *mbd,
|
||||
int filter_level,
|
||||
int y_only);
|
||||
int y_only,
|
||||
int dering);
|
||||
|
||||
void vp9_loop_filter_partial_frame(struct VP9Common *cm,
|
||||
struct macroblockd *mbd,
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "vp9/common/vp9_loopfilter.h"
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
|
||||
static __inline int8_t signed_char_clamp(int t) {
|
||||
static INLINE int8_t signed_char_clamp(int t) {
|
||||
t = (t < -128 ? -128 : t);
|
||||
t = (t > 127 ? 127 : t);
|
||||
return (int8_t) t;
|
||||
@ -21,11 +21,11 @@ static __inline int8_t signed_char_clamp(int t) {
|
||||
|
||||
|
||||
/* 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,
|
||||
uint8_t q0, uint8_t q1,
|
||||
uint8_t q2, uint8_t q3) {
|
||||
static INLINE int8_t filter_mask(uint8_t limit, uint8_t blimit,
|
||||
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 mask = 0;
|
||||
mask |= (abs(p3 - p2) > limit) * -1;
|
||||
mask |= (abs(p2 - p1) > limit) * -1;
|
||||
@ -39,57 +39,46 @@ static __inline int8_t filter_mask(uint8_t limit, uint8_t blimit,
|
||||
}
|
||||
|
||||
/* is there high 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) {
|
||||
static INLINE int8_t hevmask(uint8_t thresh, uint8_t p1, uint8_t p0,
|
||||
uint8_t q0, uint8_t q1) {
|
||||
int8_t hev = 0;
|
||||
hev |= (abs(p1 - p0) > thresh) * -1;
|
||||
hev |= (abs(q1 - q0) > thresh) * -1;
|
||||
return hev;
|
||||
}
|
||||
|
||||
static __inline void filter(int8_t mask, uint8_t hev, uint8_t *op1,
|
||||
uint8_t *op0, uint8_t *oq0, uint8_t *oq1) {
|
||||
int8_t ps0, qs0;
|
||||
int8_t ps1, qs1;
|
||||
int8_t filter, Filter1, Filter2;
|
||||
int8_t u;
|
||||
static INLINE void filter(int8_t mask, uint8_t hev, uint8_t *op1,
|
||||
uint8_t *op0, uint8_t *oq0, uint8_t *oq1) {
|
||||
int8_t filter1, filter2;
|
||||
|
||||
ps1 = (int8_t) *op1 ^ 0x80;
|
||||
ps0 = (int8_t) *op0 ^ 0x80;
|
||||
qs0 = (int8_t) *oq0 ^ 0x80;
|
||||
qs1 = (int8_t) *oq1 ^ 0x80;
|
||||
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 */
|
||||
filter = signed_char_clamp(ps1 - qs1);
|
||||
filter &= hev;
|
||||
// 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));
|
||||
filter &= mask;
|
||||
// inner taps
|
||||
filter = signed_char_clamp(filter + 3 * (qs0 - ps0)) & mask;
|
||||
|
||||
/* save bottom 3 bits so that we round one side +4 and the other +3
|
||||
* if it equals 4 we'll set to adjust by -1 to account for the fact
|
||||
* we'd round 3 the other way
|
||||
*/
|
||||
Filter1 = signed_char_clamp(filter + 4);
|
||||
Filter2 = signed_char_clamp(filter + 3);
|
||||
Filter1 >>= 3;
|
||||
Filter2 >>= 3;
|
||||
u = signed_char_clamp(qs0 - Filter1);
|
||||
*oq0 = u ^ 0x80;
|
||||
u = signed_char_clamp(ps0 + Filter2);
|
||||
*op0 = u ^ 0x80;
|
||||
filter = Filter1;
|
||||
// save bottom 3 bits so that we round one side +4 and the other +3
|
||||
// if it equals 4 we'll set to adjust by -1 to account for the fact
|
||||
// we'd round 3 the other way
|
||||
filter1 = signed_char_clamp(filter + 4) >> 3;
|
||||
filter2 = signed_char_clamp(filter + 3) >> 3;
|
||||
|
||||
/* outer tap adjustments */
|
||||
*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;
|
||||
|
||||
u = signed_char_clamp(qs1 - filter);
|
||||
*oq1 = u ^ 0x80;
|
||||
u = signed_char_clamp(ps1 + filter);
|
||||
*op1 = u ^ 0x80;
|
||||
*oq1 = signed_char_clamp(qs1 - filter) ^ 0x80;
|
||||
*op1 = signed_char_clamp(ps1 + filter) ^ 0x80;
|
||||
}
|
||||
|
||||
void vp9_loop_filter_horizontal_edge_c(uint8_t *s,
|
||||
@ -143,11 +132,11 @@ void vp9_loop_filter_vertical_edge_c(uint8_t *s,
|
||||
s += p;
|
||||
} while (++i < count * 8);
|
||||
}
|
||||
static __inline signed char flatmask(uint8_t thresh,
|
||||
uint8_t p4, uint8_t p3, uint8_t p2,
|
||||
uint8_t p1, uint8_t p0,
|
||||
uint8_t q0, uint8_t q1, uint8_t q2,
|
||||
uint8_t q3, uint8_t q4) {
|
||||
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) {
|
||||
int8_t flat = 0;
|
||||
flat |= (abs(p1 - p0) > thresh) * -1;
|
||||
flat |= (abs(q1 - q0) > thresh) * -1;
|
||||
@ -155,81 +144,72 @@ static __inline signed char flatmask(uint8_t thresh,
|
||||
flat |= (abs(q0 - q2) > thresh) * -1;
|
||||
flat |= (abs(p3 - p0) > thresh) * -1;
|
||||
flat |= (abs(q3 - q0) > thresh) * -1;
|
||||
flat |= (abs(p4 - p0) > thresh) * -1;
|
||||
flat |= (abs(q4 - q0) > thresh) * -1;
|
||||
flat = ~flat;
|
||||
return flat;
|
||||
}
|
||||
static INLINE signed char flatmask5(uint8_t thresh,
|
||||
uint8_t p4, uint8_t p3, uint8_t p2,
|
||||
uint8_t p1, uint8_t p0,
|
||||
uint8_t q0, uint8_t q1, uint8_t q2,
|
||||
uint8_t q3, uint8_t q4) {
|
||||
int8_t flat = 0;
|
||||
flat |= (abs(p4 - p0) > thresh) * -1;
|
||||
flat |= (abs(q4 - q0) > thresh) * -1;
|
||||
flat = ~flat;
|
||||
return flat & flatmask4(thresh, p3, p2, p1, p0, q0, q1, q2, q3);
|
||||
}
|
||||
|
||||
static __inline void mbfilter(int8_t mask, uint8_t hev, uint8_t flat,
|
||||
uint8_t *op4, uint8_t *op3, uint8_t *op2,
|
||||
uint8_t *op1, uint8_t *op0,
|
||||
uint8_t *oq0, uint8_t *oq1, uint8_t *oq2,
|
||||
uint8_t *oq3, uint8_t *oq4) {
|
||||
/* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
|
||||
|
||||
static INLINE void mbfilter(int8_t mask, uint8_t hev, uint8_t flat,
|
||||
uint8_t *op3, uint8_t *op2,
|
||||
uint8_t *op1, uint8_t *op0,
|
||||
uint8_t *oq0, uint8_t *oq1,
|
||||
uint8_t *oq2, uint8_t *oq3) {
|
||||
// use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line
|
||||
if (flat && mask) {
|
||||
uint8_t p0, q0;
|
||||
uint8_t p1, q1;
|
||||
uint8_t p2, q2;
|
||||
uint8_t p3, q3;
|
||||
uint8_t p4, q4;
|
||||
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;
|
||||
|
||||
p4 = *op4;
|
||||
p3 = *op3;
|
||||
p2 = *op2;
|
||||
p1 = *op1;
|
||||
p0 = *op0;
|
||||
q0 = *oq0;
|
||||
q1 = *oq1;
|
||||
q2 = *oq2;
|
||||
q3 = *oq3;
|
||||
q4 = *oq4;
|
||||
|
||||
*op2 = (p4 + p4 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3;
|
||||
*op1 = (p4 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3;
|
||||
*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 + q4 + 4) >> 3;
|
||||
*oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4) >> 3;
|
||||
*oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3 + 4) >> 3;
|
||||
*oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3 + 4) >> 3;
|
||||
} else {
|
||||
int8_t ps0, qs0;
|
||||
int8_t ps1, qs1;
|
||||
int8_t filter, Filter1, Filter2;
|
||||
int8_t u;
|
||||
int8_t filter1, filter2;
|
||||
|
||||
ps1 = (int8_t) *op1 ^ 0x80;
|
||||
ps0 = (int8_t) *op0 ^ 0x80;
|
||||
qs0 = (int8_t) *oq0 ^ 0x80;
|
||||
qs1 = (int8_t) *oq1 ^ 0x80;
|
||||
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 */
|
||||
filter = signed_char_clamp(ps1 - qs1);
|
||||
filter &= hev;
|
||||
// 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));
|
||||
filter &= mask;
|
||||
// inner taps
|
||||
filter = signed_char_clamp(filter + 3 * (qs0 - ps0)) & mask;
|
||||
|
||||
Filter1 = signed_char_clamp(filter + 4);
|
||||
Filter2 = signed_char_clamp(filter + 3);
|
||||
Filter1 >>= 3;
|
||||
Filter2 >>= 3;
|
||||
filter1 = signed_char_clamp(filter + 4) >> 3;
|
||||
filter2 = signed_char_clamp(filter + 3) >> 3;
|
||||
|
||||
u = signed_char_clamp(qs0 - Filter1);
|
||||
*oq0 = u ^ 0x80;
|
||||
u = signed_char_clamp(ps0 + Filter2);
|
||||
*op0 = u ^ 0x80;
|
||||
filter = Filter1;
|
||||
*oq0 = signed_char_clamp(qs0 - filter1) ^ 0x80;
|
||||
*op0 = signed_char_clamp(ps0 + filter2) ^ 0x80;
|
||||
filter = filter1;
|
||||
|
||||
/* outer tap adjustments */
|
||||
// outer tap adjustments
|
||||
filter += 1;
|
||||
filter >>= 1;
|
||||
filter &= ~hev;
|
||||
|
||||
u = signed_char_clamp(qs1 - filter);
|
||||
*oq1 = u ^ 0x80;
|
||||
u = signed_char_clamp(ps1 + filter);
|
||||
*op1 = u ^ 0x80;
|
||||
*oq1 = signed_char_clamp(qs1 - filter) ^ 0x80;
|
||||
*op1 = signed_char_clamp(ps1 + filter) ^ 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,12 +234,11 @@ void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s,
|
||||
|
||||
hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
|
||||
|
||||
flat = flatmask(1,
|
||||
s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
|
||||
s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * 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]);
|
||||
mbfilter(mask, hev, flat,
|
||||
s - 5 * p, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
|
||||
s, s + 1 * p, s + 2 * p, s + 3 * p, s + 4 * p);
|
||||
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);
|
||||
@ -283,53 +262,43 @@ void vp9_mbloop_filter_vertical_edge_c(uint8_t *s,
|
||||
s[0], s[1], s[2], s[3]);
|
||||
|
||||
hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
|
||||
flat = flatmask(1,
|
||||
s[-5], s[-4], s[-3], s[-2], s[-1],
|
||||
s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]);
|
||||
flat = flatmask4(1,
|
||||
s[-4], s[-3], s[-2], s[-1],
|
||||
s[ 0], s[ 1], s[ 2], s[ 3]);
|
||||
mbfilter(mask, hev, flat,
|
||||
s - 5, s - 4, s - 3, s - 2, s - 1,
|
||||
s, s + 1, s + 2, s + 3, s + 4);
|
||||
s - 4, s - 3, s - 2, s - 1,
|
||||
s, s + 1, s + 2, s + 3);
|
||||
s += p;
|
||||
} while (++i < count * 8);
|
||||
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
/* Why does this cause problems for win32?
|
||||
* error C2143: syntax error : missing ';' before 'type'
|
||||
* (void) limit;
|
||||
*/
|
||||
int8_t mask = (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 <= blimit) * -1;
|
||||
return mask;
|
||||
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 filter, Filter1, Filter2;
|
||||
int8_t p1 = (int8_t) *op1 ^ 0x80;
|
||||
int8_t p0 = (int8_t) *op0 ^ 0x80;
|
||||
int8_t q0 = (int8_t) *oq0 ^ 0x80;
|
||||
int8_t q1 = (int8_t) *oq1 ^ 0x80;
|
||||
int8_t u;
|
||||
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;
|
||||
|
||||
filter = signed_char_clamp(p1 - q1);
|
||||
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);
|
||||
Filter1 >>= 3;
|
||||
u = signed_char_clamp(q0 - Filter1);
|
||||
*oq0 = u ^ 0x80;
|
||||
// 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);
|
||||
Filter2 >>= 3;
|
||||
u = signed_char_clamp(p0 + Filter2);
|
||||
*op0 = u ^ 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,
|
||||
@ -481,41 +450,32 @@ void vp9_loop_filter_bvs_c(uint8_t *y_ptr, int y_stride,
|
||||
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,
|
||||
uint8_t *op4, uint8_t *op3, uint8_t *op2,
|
||||
uint8_t *op1, uint8_t *op0, uint8_t *oq0,
|
||||
uint8_t *oq1, uint8_t *oq2, uint8_t *oq3,
|
||||
uint8_t *oq4, uint8_t *oq5, uint8_t *oq6,
|
||||
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 */
|
||||
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,
|
||||
uint8_t *op4, uint8_t *op3, uint8_t *op2,
|
||||
uint8_t *op1, uint8_t *op0, uint8_t *oq0,
|
||||
uint8_t *oq1, uint8_t *oq2, uint8_t *oq3,
|
||||
uint8_t *oq4, uint8_t *oq5, uint8_t *oq6,
|
||||
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) {
|
||||
uint8_t p0, q0;
|
||||
uint8_t p1, q1;
|
||||
uint8_t p2, q2;
|
||||
uint8_t p3, q3;
|
||||
uint8_t p4, q4;
|
||||
uint8_t p5, q5;
|
||||
uint8_t p6, q6;
|
||||
uint8_t p7, q7;
|
||||
|
||||
p7 = *op7;
|
||||
p6 = *op6;
|
||||
p5 = *op5;
|
||||
p4 = *op4;
|
||||
p3 = *op3;
|
||||
p2 = *op2;
|
||||
p1 = *op1;
|
||||
p0 = *op0;
|
||||
q0 = *oq0;
|
||||
q1 = *oq1;
|
||||
q2 = *oq2;
|
||||
q3 = *oq3;
|
||||
q4 = *oq4;
|
||||
q5 = *oq5;
|
||||
q6 = *oq6;
|
||||
q7 = *oq7;
|
||||
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;
|
||||
|
||||
*op6 = (p7 * 7 + p6 * 2 +
|
||||
p5 + p4 + p3 + p2 + p1 + p0 + q0 + 8) >> 4;
|
||||
@ -546,68 +506,48 @@ static __inline void wide_mbfilter(int8_t mask, uint8_t hev,
|
||||
*oq6 = (p0 + q0 + q1 + q2 + q3 + q4 + q5 + q6 * 2 +
|
||||
q7 * 7 + 8) >> 4;
|
||||
} else if (flat && mask) {
|
||||
unsigned char p0, q0;
|
||||
unsigned char p1, q1;
|
||||
unsigned char p2, q2;
|
||||
unsigned char p3, q3;
|
||||
unsigned char p4, q4;
|
||||
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;
|
||||
|
||||
p4 = *op4;
|
||||
p3 = *op3;
|
||||
p2 = *op2;
|
||||
p1 = *op1;
|
||||
p0 = *op0;
|
||||
q0 = *oq0;
|
||||
q1 = *oq1;
|
||||
q2 = *oq2;
|
||||
q3 = *oq3;
|
||||
q4 = *oq4;
|
||||
|
||||
*op2 = (p4 + p4 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3;
|
||||
*op1 = (p4 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3;
|
||||
*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 + q4 + 4) >> 3;
|
||||
*oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4) >> 3;
|
||||
*oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q3 + 4) >> 3;
|
||||
*oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q3 + q3 + 4) >> 3;
|
||||
} else {
|
||||
signed char ps0, qs0;
|
||||
signed char ps1, qs1;
|
||||
signed char filter, Filter1, Filter2;
|
||||
signed char u;
|
||||
int8_t filter1, filter2;
|
||||
|
||||
ps1 = (signed char) * op1 ^ 0x80;
|
||||
ps0 = (signed char) * op0 ^ 0x80;
|
||||
qs0 = (signed char) * oq0 ^ 0x80;
|
||||
qs1 = (signed char) * oq1 ^ 0x80;
|
||||
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 */
|
||||
filter = signed_char_clamp(ps1 - qs1);
|
||||
filter &= hev;
|
||||
// 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));
|
||||
filter &= mask;
|
||||
// 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;
|
||||
|
||||
Filter1 = signed_char_clamp(filter + 4);
|
||||
Filter2 = signed_char_clamp(filter + 3);
|
||||
Filter1 >>= 3;
|
||||
Filter2 >>= 3;
|
||||
*oq0 = signed_char_clamp(qs0 - filter1) ^ 0x80;
|
||||
*op0 = signed_char_clamp(ps0 + filter2) ^ 0x80;
|
||||
filter = filter1;
|
||||
|
||||
u = signed_char_clamp(qs0 - Filter1);
|
||||
*oq0 = u ^ 0x80;
|
||||
u = signed_char_clamp(ps0 + Filter2);
|
||||
*op0 = u ^ 0x80;
|
||||
filter = Filter1;
|
||||
|
||||
/* outer tap adjustments */
|
||||
// outer tap adjustments
|
||||
filter += 1;
|
||||
filter >>= 1;
|
||||
filter &= ~hev;
|
||||
|
||||
u = signed_char_clamp(qs1 - filter);
|
||||
*oq1 = u ^ 0x80;
|
||||
u = signed_char_clamp(ps1 + filter);
|
||||
*op1 = u ^ 0x80;
|
||||
*oq1 = signed_char_clamp(qs1 - filter) ^ 0x80;
|
||||
*op1 = signed_char_clamp(ps1 + filter) ^ 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
@ -636,19 +576,19 @@ void vp9_mb_lpf_horizontal_edge_w
|
||||
|
||||
hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
|
||||
|
||||
flat = flatmask(1,
|
||||
s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
|
||||
s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * 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 = flatmask(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]);
|
||||
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,
|
||||
s, s + 1 * p, s + 2 * p, s + 3 * p,
|
||||
s + 4 * p, s + 5 * p, s + 6 * p, s + 7 * p);
|
||||
s - 8 * p, s - 7 * p, s - 6 * p, s - 5 * p,
|
||||
s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
|
||||
s, s + 1 * p, s + 2 * p, s + 3 * p,
|
||||
s + 4 * p, s + 5 * p, s + 6 * p, s + 7 * p);
|
||||
|
||||
++s;
|
||||
} while (++i < count * 8);
|
||||
@ -674,18 +614,18 @@ void vp9_mb_lpf_vertical_edge_w
|
||||
s[0], s[1], s[2], s[3]);
|
||||
|
||||
hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
|
||||
flat = flatmask(1,
|
||||
s[-5], s[-4], s[-3], s[-2], s[-1],
|
||||
s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]);
|
||||
flat2 = flatmask(1,
|
||||
s[-8], s[-7], s[-6], s[-5], s[-1],
|
||||
s[ 0], s[ 4], s[ 5], s[ 6], s[ 7]);
|
||||
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]);
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -11,25 +11,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
extern unsigned int vp9_sad16x16_sse3(
|
||||
|
||||
unsigned int vp9_sad16x16_sse3(
|
||||
unsigned char *src_ptr,
|
||||
int src_stride,
|
||||
unsigned char *ref_ptr,
|
||||
int ref_stride,
|
||||
int max_err);
|
||||
|
||||
extern void vp9_sad16x16x3_sse3(
|
||||
unsigned char *src_ptr,
|
||||
int src_stride,
|
||||
unsigned char *ref_ptr,
|
||||
int ref_stride,
|
||||
int *results);
|
||||
|
||||
extern int vp8_growmaskmb_sse3(
|
||||
int vp8_growmaskmb_sse3(
|
||||
unsigned char *om,
|
||||
unsigned char *nm);
|
||||
|
||||
extern void vp8_makemask_sse3(
|
||||
void vp8_makemask_sse3(
|
||||
unsigned char *y,
|
||||
unsigned char *u,
|
||||
unsigned char *v,
|
||||
@ -238,6 +232,7 @@ void grow_ymask(unsigned char *ym) {
|
||||
for (i = 0; i < 256; i++)
|
||||
ym[i] = nym[i];
|
||||
}
|
||||
|
||||
void make_mb_mask(unsigned char *y, unsigned char *u, unsigned char *v,
|
||||
unsigned char *ym, unsigned char *uvm,
|
||||
int yp, int uvp,
|
||||
@ -283,6 +278,7 @@ int compare_masks(unsigned char *sym, unsigned char *ym) {
|
||||
|
||||
return sad;
|
||||
}
|
||||
|
||||
int unmasked_sad(unsigned char *src, int p, unsigned char *dst, int dp,
|
||||
unsigned char *ym) {
|
||||
int i, j;
|
||||
@ -294,6 +290,7 @@ int unmasked_sad(unsigned char *src, int p, unsigned char *dst, int dp,
|
||||
|
||||
return sad;
|
||||
}
|
||||
|
||||
int masked_motion_search(unsigned char *y, unsigned char *u, unsigned char *v,
|
||||
int yp, int uvp,
|
||||
unsigned char *dy, unsigned char *du, unsigned char *dv,
|
||||
@ -802,5 +799,5 @@ int mainz(int argc, char *argv[]) {
|
||||
}
|
||||
fclose(f);
|
||||
fclose(g);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
@ -20,15 +20,15 @@ static void setup_block(BLOCKD *b,
|
||||
int mv_stride,
|
||||
uint8_t **base,
|
||||
uint8_t **base2,
|
||||
int Stride,
|
||||
int stride,
|
||||
int offset,
|
||||
BLOCKSET bs) {
|
||||
if (bs == DEST) {
|
||||
b->dst_stride = Stride;
|
||||
b->dst_stride = stride;
|
||||
b->dst = offset;
|
||||
b->base_dst = base;
|
||||
} else {
|
||||
b->pre_stride = Stride;
|
||||
b->pre_stride = stride;
|
||||
b->pre = offset;
|
||||
b->base_pre = base;
|
||||
b->base_second_pre = base2;
|
||||
@ -102,9 +102,7 @@ void vp9_setup_block_dptrs(MACROBLOCKD *xd) {
|
||||
}
|
||||
}
|
||||
|
||||
blockd[24].diff = &xd->diff[384];
|
||||
|
||||
for (r = 0; r < 25; r++) {
|
||||
for (r = 0; r < 24; r++) {
|
||||
blockd[r].qcoeff = xd->qcoeff + r * 16;
|
||||
blockd[r].dqcoeff = xd->dqcoeff + r * 16;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "vp9/common/vp9_entropy.h"
|
||||
|
||||
const int vp9_default_mode_contexts[INTER_MODE_CONTEXTS][4] = {
|
||||
{223, 1, 1, 237}, // 0,0 best: Only candidate
|
||||
{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
|
||||
|
@ -23,4 +23,14 @@ typedef union int_mv {
|
||||
MV as_mv;
|
||||
} int_mv; /* facilitates faster equality tests and copies */
|
||||
|
||||
struct mv32 {
|
||||
int32_t row;
|
||||
int32_t col;
|
||||
};
|
||||
|
||||
typedef union int_mv32 {
|
||||
uint64_t as_int;
|
||||
struct mv32 as_mv;
|
||||
} int_mv32; /* facilitates faster equality tests and copies */
|
||||
|
||||
#endif // VP9_COMMON_VP9_MV_H_
|
||||
|
@ -11,64 +11,69 @@
|
||||
#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 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 };
|
||||
|
||||
// clamp_mv
|
||||
|
||||
|
||||
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
|
||||
static void clamp_mv(const MACROBLOCKD *xd, int_mv *mv) {
|
||||
|
||||
if (mv->as_mv.col < (xd->mb_to_left_edge - MV_BORDER))
|
||||
mv->as_mv.col = xd->mb_to_left_edge - MV_BORDER;
|
||||
else if (mv->as_mv.col > xd->mb_to_right_edge + MV_BORDER)
|
||||
mv->as_mv.col = xd->mb_to_right_edge + MV_BORDER;
|
||||
|
||||
if (mv->as_mv.row < (xd->mb_to_top_edge - MV_BORDER))
|
||||
mv->as_mv.row = xd->mb_to_top_edge - MV_BORDER;
|
||||
else if (mv->as_mv.row > xd->mb_to_bottom_edge + MV_BORDER)
|
||||
mv->as_mv.row = xd->mb_to_bottom_edge + MV_BORDER;
|
||||
static void clamp_mv_ref(const MACROBLOCKD *xd, int_mv *mv) {
|
||||
mv->as_mv.col = clamp(mv->as_mv.col, xd->mb_to_left_edge - MV_BORDER,
|
||||
xd->mb_to_right_edge + MV_BORDER);
|
||||
mv->as_mv.row = clamp(mv->as_mv.row, xd->mb_to_top_edge - MV_BORDER,
|
||||
xd->mb_to_bottom_edge + MV_BORDER);
|
||||
}
|
||||
|
||||
// Gets a candidate refenence 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
|
||||
) {
|
||||
int ret_val = TRUE;
|
||||
|
||||
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;
|
||||
} else {
|
||||
ret_val = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Gets candidate refenence 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,
|
||||
MV_REFERENCE_FRAME *c_ref_frame,
|
||||
int_mv *c_mv,
|
||||
MV_REFERENCE_FRAME *c2_ref_frame,
|
||||
int_mv *c2_mv
|
||||
) {
|
||||
static void get_non_matching_candidates(const MODE_INFO *candidate_mi,
|
||||
MV_REFERENCE_FRAME ref_frame,
|
||||
MV_REFERENCE_FRAME *c_ref_frame,
|
||||
int_mv *c_mv,
|
||||
MV_REFERENCE_FRAME *c2_ref_frame,
|
||||
int_mv *c2_mv) {
|
||||
|
||||
c_mv->as_int = 0;
|
||||
c2_mv->as_int = 0;
|
||||
@ -85,73 +90,68 @@ static void get_non_matching_candidates(
|
||||
|
||||
// Second candidate
|
||||
if ((candidate_mi->mbmi.second_ref_frame > INTRA_FRAME) &&
|
||||
(candidate_mi->mbmi.second_ref_frame != ref_frame)) { // &&
|
||||
// (candidate_mi->mbmi.mv[1].as_int != 0) &&
|
||||
// (candidate_mi->mbmi.mv[1].as_int !=
|
||||
// candidate_mi->mbmi.mv[0].as_int)) {
|
||||
(candidate_mi->mbmi.second_ref_frame != 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_mv->as_int = candidate_mi->mbmi.mv[1].as_int;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Performs mv adjustment based on reference frame and clamps the MV
|
||||
// if it goes off the edge of the buffer.
|
||||
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
|
||||
) {
|
||||
|
||||
if (candidate_ref_frame != this_ref_frame) {
|
||||
// Performs mv sign inversion if indicated by the reference frame combination.
|
||||
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;
|
||||
|
||||
//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]) {
|
||||
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_since_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]);
|
||||
}
|
||||
*/
|
||||
// Sign inversion where appropriate.
|
||||
if (ref_sign_bias[candidate_ref_frame] != ref_sign_bias[this_ref_frame]) {
|
||||
candidate_mv->as_mv.row = -candidate_mv->as_mv.row;
|
||||
candidate_mv->as_mv.col = -candidate_mv->as_mv.col;
|
||||
}
|
||||
|
||||
// Clamp the MV so it does not point out of the frame buffer
|
||||
clamp_mv(xd, candidate_mv);
|
||||
/*
|
||||
// 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 list if indeed it is new.
|
||||
// If it is not new then the score of the existing candidate that it matches
|
||||
// is increased and the list is resorted.
|
||||
/*
|
||||
// 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 *index,
|
||||
int *refmv_count,
|
||||
int_mv candidate_mv,
|
||||
int weight
|
||||
) {
|
||||
@ -162,11 +162,11 @@ static void addmv_and_shuffle(
|
||||
|
||||
// Check for duplicates. If there is one increase its score.
|
||||
// We only compare vs the current top candidates.
|
||||
insert_point = (*index < (MAX_MV_REF_CANDIDATES - 1))
|
||||
? *index : (MAX_MV_REF_CANDIDATES - 1);
|
||||
insert_point = (*refmv_count < (MAX_MV_REF_CANDIDATES - 1))
|
||||
? *refmv_count : (MAX_MV_REF_CANDIDATES - 1);
|
||||
|
||||
i = insert_point;
|
||||
if (*index > i)
|
||||
if (*refmv_count > i)
|
||||
i++;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
@ -184,7 +184,7 @@ static void addmv_and_shuffle(
|
||||
mv_scores[insert_point] = weight;
|
||||
i = insert_point;
|
||||
}
|
||||
(*index)++;
|
||||
(*refmv_count)++;
|
||||
}
|
||||
|
||||
// Reshuffle the list so that highest scoring mvs at the top.
|
||||
@ -202,19 +202,42 @@ static void addmv_and_shuffle(
|
||||
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.
|
||||
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;
|
||||
}
|
||||
|
||||
// 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.
|
||||
//
|
||||
void vp9_find_mv_refs(
|
||||
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(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 i;
|
||||
MODE_INFO *candidate_mi;
|
||||
MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi;
|
||||
@ -224,17 +247,22 @@ void vp9_find_mv_refs(
|
||||
MV_REFERENCE_FRAME c_ref_frame;
|
||||
MV_REFERENCE_FRAME c2_ref_frame;
|
||||
int candidate_scores[MAX_MV_REF_CANDIDATES];
|
||||
int index = 0;
|
||||
int refmv_count = 0;
|
||||
int split_count = 0;
|
||||
int (*mv_ref_search)[2];
|
||||
int *ref_distance_weight;
|
||||
int zero_seen = FALSE;
|
||||
const int mb_col = (-xd->mb_to_left_edge) >> 7;
|
||||
|
||||
// Blank the reference vector lists and other local structures.
|
||||
vpx_memset(mv_ref_list, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES);
|
||||
vpx_memset(candidate_mvs, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES);
|
||||
vpx_memset(candidate_scores, 0, sizeof(candidate_scores));
|
||||
|
||||
if (mbmi->sb_type) {
|
||||
if (mbmi->sb_type == BLOCK_SIZE_SB64X64) {
|
||||
mv_ref_search = sb64_mv_ref_search;
|
||||
ref_distance_weight = sb64_ref_distance_weight;
|
||||
} else if (mbmi->sb_type == BLOCK_SIZE_SB32X32) {
|
||||
mv_ref_search = sb_mv_ref_search;
|
||||
ref_distance_weight = sb_ref_distance_weight;
|
||||
} else {
|
||||
@ -245,39 +273,44 @@ void vp9_find_mv_refs(
|
||||
// We first scan for candidate vectors that match the current reference frame
|
||||
// Look at nearest neigbours
|
||||
for (i = 0; i < 2; ++i) {
|
||||
if (((mv_ref_search[i][0] << 7) >= xd->mb_to_left_edge) &&
|
||||
const int mb_search_col = mb_col + mv_ref_search[i][0];
|
||||
|
||||
if ((mb_search_col >= cm->cur_tile_mb_col_start) &&
|
||||
(mb_search_col < cm->cur_tile_mb_col_end) &&
|
||||
((mv_ref_search[i][1] << 7) >= xd->mb_to_top_edge)) {
|
||||
|
||||
candidate_mi = here + mv_ref_search[i][0] +
|
||||
(mv_ref_search[i][1] * xd->mode_info_stride);
|
||||
|
||||
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
|
||||
clamp_mv(xd, &c_refmv);
|
||||
addmv_and_shuffle(candidate_mvs, candidate_scores,
|
||||
&index, c_refmv, ref_distance_weight[i] + 16);
|
||||
add_candidate_mv(candidate_mvs, candidate_scores,
|
||||
&refmv_count, c_refmv, ref_distance_weight[i] + 16);
|
||||
}
|
||||
split_count += (candidate_mi->mbmi.mode == SPLITMV);
|
||||
}
|
||||
}
|
||||
// Look in the last frame
|
||||
candidate_mi = lf_here;
|
||||
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
|
||||
clamp_mv(xd, &c_refmv);
|
||||
addmv_and_shuffle(candidate_mvs, candidate_scores,
|
||||
&index, c_refmv, 18);
|
||||
// Look in the last frame if it exists
|
||||
if (lf_here) {
|
||||
candidate_mi = lf_here;
|
||||
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
|
||||
add_candidate_mv(candidate_mvs, candidate_scores,
|
||||
&refmv_count, c_refmv, 18);
|
||||
}
|
||||
}
|
||||
// More distant neigbours
|
||||
for (i = 2; (i < MVREF_NEIGHBOURS) &&
|
||||
(index < (MAX_MV_REF_CANDIDATES - 1)); ++i) {
|
||||
if (((mv_ref_search[i][0] << 7) >= xd->mb_to_left_edge) &&
|
||||
(refmv_count < (MAX_MV_REF_CANDIDATES - 1)); ++i) {
|
||||
const int mb_search_col = mb_col + mv_ref_search[i][0];
|
||||
|
||||
if ((mb_search_col >= cm->cur_tile_mb_col_start) &&
|
||||
(mb_search_col < cm->cur_tile_mb_col_end) &&
|
||||
((mv_ref_search[i][1] << 7) >= xd->mb_to_top_edge)) {
|
||||
candidate_mi = here + mv_ref_search[i][0] +
|
||||
(mv_ref_search[i][1] * xd->mode_info_stride);
|
||||
|
||||
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
|
||||
clamp_mv(xd, &c_refmv);
|
||||
addmv_and_shuffle(candidate_mvs, candidate_scores,
|
||||
&index, c_refmv, ref_distance_weight[i] + 16);
|
||||
add_candidate_mv(candidate_mvs, candidate_scores,
|
||||
&refmv_count, c_refmv, ref_distance_weight[i] + 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -286,9 +319,12 @@ void vp9_find_mv_refs(
|
||||
// reference frame does not match. Break out when we have
|
||||
// MAX_MV_REF_CANDIDATES candidates.
|
||||
// Look first at spatial neighbours
|
||||
if (index < (MAX_MV_REF_CANDIDATES - 1)) {
|
||||
if (refmv_count < (MAX_MV_REF_CANDIDATES - 1)) {
|
||||
for (i = 0; i < MVREF_NEIGHBOURS; ++i) {
|
||||
if (((mv_ref_search[i][0] << 7) >= xd->mb_to_left_edge) &&
|
||||
const int mb_search_col = mb_col + mv_ref_search[i][0];
|
||||
|
||||
if ((mb_search_col >= cm->cur_tile_mb_col_start) &&
|
||||
(mb_search_col < cm->cur_tile_mb_col_end) &&
|
||||
((mv_ref_search[i][1] << 7) >= xd->mb_to_top_edge)) {
|
||||
|
||||
candidate_mi = here + mv_ref_search[i][0] +
|
||||
@ -300,24 +336,24 @@ void vp9_find_mv_refs(
|
||||
|
||||
if (c_ref_frame != INTRA_FRAME) {
|
||||
scale_mv(xd, ref_frame, c_ref_frame, &c_refmv, ref_sign_bias);
|
||||
addmv_and_shuffle(candidate_mvs, candidate_scores,
|
||||
&index, c_refmv, ref_distance_weight[i]);
|
||||
add_candidate_mv(candidate_mvs, candidate_scores,
|
||||
&refmv_count, c_refmv, ref_distance_weight[i]);
|
||||
}
|
||||
|
||||
if (c2_ref_frame != INTRA_FRAME) {
|
||||
scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias);
|
||||
addmv_and_shuffle(candidate_mvs, candidate_scores,
|
||||
&index, c2_refmv, ref_distance_weight[i]);
|
||||
add_candidate_mv(candidate_mvs, candidate_scores,
|
||||
&refmv_count, c2_refmv, ref_distance_weight[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (index >= (MAX_MV_REF_CANDIDATES - 1)) {
|
||||
if (refmv_count >= (MAX_MV_REF_CANDIDATES - 1)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Look at the last frame
|
||||
if (index < (MAX_MV_REF_CANDIDATES - 1)) {
|
||||
// Look at the last frame if it exists
|
||||
if (refmv_count < (MAX_MV_REF_CANDIDATES - 1) && lf_here) {
|
||||
candidate_mi = lf_here;
|
||||
get_non_matching_candidates(candidate_mi, ref_frame,
|
||||
&c_ref_frame, &c_refmv,
|
||||
@ -325,14 +361,14 @@ void vp9_find_mv_refs(
|
||||
|
||||
if (c_ref_frame != INTRA_FRAME) {
|
||||
scale_mv(xd, ref_frame, c_ref_frame, &c_refmv, ref_sign_bias);
|
||||
addmv_and_shuffle(candidate_mvs, candidate_scores,
|
||||
&index, c_refmv, 2);
|
||||
add_candidate_mv(candidate_mvs, candidate_scores,
|
||||
&refmv_count, c_refmv, 2);
|
||||
}
|
||||
|
||||
if (c2_ref_frame != INTRA_FRAME) {
|
||||
scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias);
|
||||
addmv_and_shuffle(candidate_mvs, candidate_scores,
|
||||
&index, c2_refmv, 2);
|
||||
add_candidate_mv(candidate_mvs, candidate_scores,
|
||||
&refmv_count, c2_refmv, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,7 +376,7 @@ void vp9_find_mv_refs(
|
||||
// 0,0 was best
|
||||
if (candidate_mvs[0].as_int == 0) {
|
||||
// 0,0 is only candidate
|
||||
if (index <= 1) {
|
||||
if (refmv_count <= 1) {
|
||||
mbmi->mb_mode_context[ref_frame] = 0;
|
||||
// non zero candidates candidates available
|
||||
} else if (split_count == 0) {
|
||||
@ -348,30 +384,25 @@ void vp9_find_mv_refs(
|
||||
} else {
|
||||
mbmi->mb_mode_context[ref_frame] = 2;
|
||||
}
|
||||
// Non zero best, No Split MV cases
|
||||
} else if (split_count == 0) {
|
||||
if (candidate_scores[0] >= 32) {
|
||||
mbmi->mb_mode_context[ref_frame] = 3;
|
||||
} else {
|
||||
mbmi->mb_mode_context[ref_frame] = 4;
|
||||
}
|
||||
// Non zero best, some split mv
|
||||
// Non zero best, No Split MV cases
|
||||
mbmi->mb_mode_context[ref_frame] = candidate_scores[0] >= 16 ? 3 : 4;
|
||||
} else {
|
||||
if (candidate_scores[0] >= 32) {
|
||||
mbmi->mb_mode_context[ref_frame] = 5;
|
||||
} else {
|
||||
mbmi->mb_mode_context[ref_frame] = 6;
|
||||
}
|
||||
// Non zero best, some split mv
|
||||
mbmi->mb_mode_context[ref_frame] = candidate_scores[0] >= 16 ? 5 : 6;
|
||||
}
|
||||
|
||||
// 0,0 is always a valid reference.
|
||||
// Scan for 0,0 case and clamp non zero choices
|
||||
for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
|
||||
if (candidate_mvs[i].as_int == 0)
|
||||
break;
|
||||
if (candidate_mvs[i].as_int == 0) {
|
||||
zero_seen = TRUE;
|
||||
} else {
|
||||
clamp_mv_ref(xd, &candidate_mvs[i]);
|
||||
}
|
||||
}
|
||||
if (i == MAX_MV_REF_CANDIDATES) {
|
||||
// 0,0 is always a valid reference. Add it if not already seen.
|
||||
if (!zero_seen)
|
||||
candidate_mvs[MAX_MV_REF_CANDIDATES-1].as_int = 0;
|
||||
}
|
||||
|
||||
// Copy over the candidate list.
|
||||
vpx_memcpy(mv_ref_list, candidate_mvs, sizeof(candidate_mvs));
|
||||
|
@ -14,7 +14,8 @@
|
||||
#ifndef VP9_COMMON_VP9_MVREF_COMMON_H_
|
||||
#define VP9_COMMON_VP9_MVREF_COMMON_H_
|
||||
|
||||
void vp9_find_mv_refs(MACROBLOCKD *xd,
|
||||
void vp9_find_mv_refs(VP9_COMMON *cm,
|
||||
MACROBLOCKD *xd,
|
||||
MODE_INFO *here,
|
||||
MODE_INFO *lf_here,
|
||||
MV_REFERENCE_FRAME ref_frame,
|
||||
|
@ -16,6 +16,7 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx/internal/vpx_codec_internal.h"
|
||||
#include "vpx/vp8cx.h"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
@ -62,7 +63,7 @@ extern "C"
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
static __inline void Scale2Ratio(int mode, int *hr, int *hs) {
|
||||
static INLINE void Scale2Ratio(int mode, int *hr, int *hs) {
|
||||
switch (mode) {
|
||||
case NORMAL:
|
||||
*hr = 1;
|
||||
@ -89,11 +90,13 @@ extern "C"
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int Version; // 4 versions of bitstream defined 0 best quality/slowest decode, 3 lowest quality/fastest decode
|
||||
int Width; // width of data passed to the compressor
|
||||
int Height; // height of data passed to the compressor
|
||||
int version; // 4 versions of bitstream defined:
|
||||
// 0 - best quality/slowest decode,
|
||||
// 3 - lowest quality/fastest decode
|
||||
int width; // width of data passed to the compressor
|
||||
int height; // height of data passed to the compressor
|
||||
double frame_rate; // set to passed in framerate
|
||||
int target_bandwidth; // bandwidth to be used in kilobits per second
|
||||
int64_t target_bandwidth; // bandwidth to be used in kilobits per second
|
||||
|
||||
int noise_sensitivity; // parameter used for applying pre processing blur: recommendation 0
|
||||
int Sharpness; // parameter used for sharpening output: recommendation 0:
|
||||
@ -134,9 +137,9 @@ extern "C"
|
||||
int over_shoot_pct;
|
||||
|
||||
// buffering parameters
|
||||
int starting_buffer_level; // in seconds
|
||||
int optimal_buffer_level;
|
||||
int maximum_buffer_size;
|
||||
int64_t starting_buffer_level; // in seconds
|
||||
int64_t optimal_buffer_level;
|
||||
int64_t maximum_buffer_size;
|
||||
|
||||
// controlling quality
|
||||
int fixed_q;
|
||||
@ -159,10 +162,25 @@ extern "C"
|
||||
|
||||
int encode_breakout; // early breakout encode threshold : for video conf recommend 800
|
||||
|
||||
/* Bitfield defining the error resiliency features to enable.
|
||||
* Can provide decodable frames after losses in previous
|
||||
* frames and decodable partitions after losses in the same frame.
|
||||
*/
|
||||
unsigned int error_resilient_mode;
|
||||
|
||||
/* Bitfield defining the parallel decoding mode where the
|
||||
* decoding in successive frames may be conducted in parallel
|
||||
* just by decoding the frame headers.
|
||||
*/
|
||||
unsigned int frame_parallel_decoding_mode;
|
||||
|
||||
int arnr_max_frames;
|
||||
int arnr_strength;
|
||||
int arnr_type;
|
||||
|
||||
int tile_columns;
|
||||
int tile_rows;
|
||||
|
||||
struct vpx_fixed_buf two_pass_stats_in;
|
||||
struct vpx_codec_pkt_list *output_pkt_list;
|
||||
|
||||
@ -195,8 +213,10 @@ extern "C"
|
||||
|
||||
int vp9_update_reference(VP9_PTR comp, int ref_frame_flags);
|
||||
|
||||
int vp9_get_reference_enc(VP9_PTR comp, VP9_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd);
|
||||
int vp9_copy_reference_enc(VP9_PTR comp, VP9_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd);
|
||||
|
||||
int vp9_get_reference_enc(VP9_PTR ptr, int index, YV12_BUFFER_CONFIG **fb);
|
||||
|
||||
int vp9_set_reference_enc(VP9_PTR comp, VP9_REFFRAME ref_frame_flag,
|
||||
YV12_BUFFER_CONFIG *sd);
|
||||
|
@ -37,7 +37,16 @@ void vp9_initialize_common(void);
|
||||
|
||||
#define QINDEX_RANGE (MAXQ + 1)
|
||||
|
||||
#define NUM_YV12_BUFFERS 4
|
||||
#define NUM_REF_FRAMES 3
|
||||
#define NUM_REF_FRAMES_LG2 2
|
||||
|
||||
// 1 scratch frame for the new frame, 3 for scaled references on the encoder
|
||||
// TODO(jkoleszar): These 3 extra references could probably come from the
|
||||
// normal reference pool.
|
||||
#define NUM_YV12_BUFFERS (NUM_REF_FRAMES + 4)
|
||||
|
||||
#define NUM_FRAME_CONTEXTS_LG2 2
|
||||
#define NUM_FRAME_CONTEXTS (1 << NUM_FRAME_CONTEXTS_LG2)
|
||||
|
||||
#define COMP_PRED_CONTEXTS 2
|
||||
|
||||
@ -49,13 +58,23 @@ typedef struct frame_contexts {
|
||||
vp9_prob i8x8_mode_prob[VP9_I8X8_MODES - 1];
|
||||
vp9_prob sub_mv_ref_prob[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
|
||||
vp9_prob mbsplit_prob[VP9_NUMMBSPLITS - 1];
|
||||
vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs hybrid_coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs hybrid_coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_probs hybrid_coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES_32X32];
|
||||
|
||||
vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES];
|
||||
vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES];
|
||||
vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES];
|
||||
vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES];
|
||||
#if CONFIG_CODE_NONZEROCOUNT
|
||||
vp9_prob nzc_probs_4x4[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC4X4_NODES];
|
||||
vp9_prob nzc_probs_8x8[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC8X8_NODES];
|
||||
vp9_prob nzc_probs_16x16[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC16X16_NODES];
|
||||
vp9_prob nzc_probs_32x32[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC32X32_NODES];
|
||||
vp9_prob nzc_pcat_probs[MAX_NZC_CONTEXTS]
|
||||
[NZC_TOKENS_EXTRA][NZC_BITS_EXTRA];
|
||||
#endif
|
||||
|
||||
nmv_context nmvc;
|
||||
nmv_context pre_nmvc;
|
||||
@ -74,21 +93,42 @@ typedef struct frame_contexts {
|
||||
unsigned int sub_mv_ref_counts[SUBMVREF_COUNT][VP9_SUBMVREFS];
|
||||
unsigned int mbsplit_counts[VP9_NUMMBSPLITS];
|
||||
|
||||
vp9_coeff_probs pre_coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs pre_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs pre_coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs pre_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs pre_coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_probs pre_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_probs pre_coef_probs_32x32[BLOCK_TYPES_32X32];
|
||||
vp9_coeff_probs pre_coef_probs_4x4[BLOCK_TYPES];
|
||||
vp9_coeff_probs pre_coef_probs_8x8[BLOCK_TYPES];
|
||||
vp9_coeff_probs pre_coef_probs_16x16[BLOCK_TYPES];
|
||||
vp9_coeff_probs pre_coef_probs_32x32[BLOCK_TYPES];
|
||||
#if CONFIG_CODE_NONZEROCOUNT
|
||||
vp9_prob pre_nzc_probs_4x4[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC4X4_NODES];
|
||||
vp9_prob pre_nzc_probs_8x8[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC8X8_NODES];
|
||||
vp9_prob pre_nzc_probs_16x16[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC16X16_NODES];
|
||||
vp9_prob pre_nzc_probs_32x32[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC32X32_NODES];
|
||||
vp9_prob pre_nzc_pcat_probs[MAX_NZC_CONTEXTS]
|
||||
[NZC_TOKENS_EXTRA][NZC_BITS_EXTRA];
|
||||
#endif
|
||||
|
||||
vp9_coeff_count coef_counts_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_count hybrid_coef_counts_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_count coef_counts_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_count hybrid_coef_counts_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_count coef_counts_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_count hybrid_coef_counts_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_count coef_counts_32x32[BLOCK_TYPES_32X32];
|
||||
vp9_coeff_count coef_counts_4x4[BLOCK_TYPES];
|
||||
vp9_coeff_count coef_counts_8x8[BLOCK_TYPES];
|
||||
vp9_coeff_count coef_counts_16x16[BLOCK_TYPES];
|
||||
vp9_coeff_count coef_counts_32x32[BLOCK_TYPES];
|
||||
unsigned int eob_branch_counts[TX_SIZE_MAX_SB][BLOCK_TYPES][REF_TYPES]
|
||||
[COEF_BANDS][PREV_COEF_CONTEXTS];
|
||||
|
||||
#if CONFIG_CODE_NONZEROCOUNT
|
||||
unsigned int nzc_counts_4x4[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC4X4_TOKENS];
|
||||
unsigned int nzc_counts_8x8[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC8X8_TOKENS];
|
||||
unsigned int nzc_counts_16x16[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC16X16_TOKENS];
|
||||
unsigned int nzc_counts_32x32[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
|
||||
[NZC32X32_TOKENS];
|
||||
unsigned int nzc_pcat_counts[MAX_NZC_CONTEXTS]
|
||||
[NZC_TOKENS_EXTRA][NZC_BITS_EXTRA][2];
|
||||
#endif
|
||||
|
||||
nmv_context_counts NMVcount;
|
||||
vp9_prob switchable_interp_prob[VP9_SWITCHABLE_FILTERS + 1]
|
||||
@ -128,13 +168,14 @@ typedef struct VP9Common {
|
||||
struct vpx_internal_error_info error;
|
||||
|
||||
DECLARE_ALIGNED(16, int16_t, Y1dequant[QINDEX_RANGE][16]);
|
||||
DECLARE_ALIGNED(16, int16_t, Y2dequant[QINDEX_RANGE][16]);
|
||||
DECLARE_ALIGNED(16, int16_t, UVdequant[QINDEX_RANGE][16]);
|
||||
|
||||
int Width;
|
||||
int Height;
|
||||
int horiz_scale;
|
||||
int vert_scale;
|
||||
int width;
|
||||
int height;
|
||||
int display_width;
|
||||
int display_height;
|
||||
int last_width;
|
||||
int last_height;
|
||||
|
||||
YUV_TYPE clr_type;
|
||||
CLAMP_TYPE clamp_type;
|
||||
@ -142,8 +183,15 @@ typedef struct VP9Common {
|
||||
YV12_BUFFER_CONFIG *frame_to_show;
|
||||
|
||||
YV12_BUFFER_CONFIG yv12_fb[NUM_YV12_BUFFERS];
|
||||
int fb_idx_ref_cnt[NUM_YV12_BUFFERS];
|
||||
int new_fb_idx, lst_fb_idx, gld_fb_idx, alt_fb_idx;
|
||||
int fb_idx_ref_cnt[NUM_YV12_BUFFERS]; /* reference counts */
|
||||
int ref_frame_map[NUM_REF_FRAMES]; /* maps fb_idx to reference slot */
|
||||
|
||||
/* TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and
|
||||
* roll new_fb_idx into it.
|
||||
*/
|
||||
int active_ref_idx[3]; /* each frame can reference 3 buffers */
|
||||
int new_fb_idx;
|
||||
struct scale_factors active_ref_scale[3];
|
||||
|
||||
YV12_BUFFER_CONFIG post_proc_buffer;
|
||||
YV12_BUFFER_CONFIG temp_scale_frame;
|
||||
@ -173,8 +221,6 @@ typedef struct VP9Common {
|
||||
int last_kf_gf_q; /* Q used on the last GF or KF */
|
||||
|
||||
int y1dc_delta_q;
|
||||
int y2dc_delta_q;
|
||||
int y2ac_delta_q;
|
||||
int uvdc_delta_q;
|
||||
int uvac_delta_q;
|
||||
|
||||
@ -201,19 +247,13 @@ typedef struct VP9Common {
|
||||
int filter_level;
|
||||
int last_sharpness_level;
|
||||
int sharpness_level;
|
||||
|
||||
int refresh_last_frame; /* Two state 0 = NO, 1 = YES */
|
||||
int refresh_golden_frame; /* Two state 0 = NO, 1 = YES */
|
||||
int refresh_alt_ref_frame; /* Two state 0 = NO, 1 = YES */
|
||||
|
||||
int copy_buffer_to_gf; /* 0 none, 1 Last to GF, 2 ARF to GF */
|
||||
int copy_buffer_to_arf; /* 0 none, 1 Last to ARF, 2 GF to ARF */
|
||||
int dering_enabled;
|
||||
|
||||
int refresh_entropy_probs; /* Two state 0 = NO, 1 = YES */
|
||||
|
||||
int ref_frame_sign_bias[MAX_REF_FRAMES]; /* Two state 0, 1 */
|
||||
|
||||
/* Y,U,V,Y2 */
|
||||
/* Y,U,V */
|
||||
ENTROPY_CONTEXT_PLANES *above_context; /* row of context for each plane */
|
||||
ENTROPY_CONTEXT_PLANES left_context[4]; /* (up to) 4 contexts "" */
|
||||
|
||||
@ -250,9 +290,9 @@ typedef struct VP9Common {
|
||||
|
||||
vp9_prob mbskip_pred_probs[MBSKIP_CONTEXTS];
|
||||
|
||||
FRAME_CONTEXT lfc_a; /* last alt ref entropy */
|
||||
FRAME_CONTEXT lfc; /* last frame entropy */
|
||||
FRAME_CONTEXT fc; /* this frame entropy */
|
||||
FRAME_CONTEXT frame_contexts[NUM_FRAME_CONTEXTS];
|
||||
unsigned int frame_context_idx; /* Context to use/update */
|
||||
|
||||
unsigned int current_video_frame;
|
||||
int near_boffset[3];
|
||||
@ -272,6 +312,60 @@ typedef struct VP9Common {
|
||||
int use_interintra;
|
||||
#endif
|
||||
|
||||
int error_resilient_mode;
|
||||
int frame_parallel_decoding_mode;
|
||||
|
||||
int tile_columns, log2_tile_columns;
|
||||
int cur_tile_mb_col_start, cur_tile_mb_col_end, cur_tile_col_idx;
|
||||
int tile_rows, log2_tile_rows;
|
||||
int cur_tile_mb_row_start, cur_tile_mb_row_end, cur_tile_row_idx;
|
||||
} VP9_COMMON;
|
||||
|
||||
static int get_free_fb(VP9_COMMON *cm) {
|
||||
int i;
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++)
|
||||
if (cm->fb_idx_ref_cnt[i] == 0)
|
||||
break;
|
||||
|
||||
assert(i < NUM_YV12_BUFFERS);
|
||||
cm->fb_idx_ref_cnt[i] = 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
static void ref_cnt_fb(int *buf, int *idx, int new_idx) {
|
||||
if (buf[*idx] > 0)
|
||||
buf[*idx]--;
|
||||
|
||||
*idx = new_idx;
|
||||
|
||||
buf[new_idx]++;
|
||||
}
|
||||
|
||||
// TODO(debargha): merge the two functions
|
||||
static void set_mb_row(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mb_row, int block_size) {
|
||||
xd->mb_to_top_edge = -((mb_row * 16) << 3);
|
||||
xd->mb_to_bottom_edge = ((cm->mb_rows - block_size - mb_row) * 16) << 3;
|
||||
|
||||
// Are edges available for intra prediction?
|
||||
xd->up_available = (mb_row != 0);
|
||||
}
|
||||
|
||||
static void set_mb_col(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mb_col, int block_size) {
|
||||
xd->mb_to_left_edge = -((mb_col * 16) << 3);
|
||||
xd->mb_to_right_edge = ((cm->mb_cols - block_size - mb_col) * 16) << 3;
|
||||
|
||||
// Are edges available for intra prediction?
|
||||
xd->left_available = (mb_col > cm->cur_tile_mb_col_start);
|
||||
xd->right_available = (mb_col + block_size < cm->cur_tile_mb_col_end);
|
||||
}
|
||||
|
||||
static int get_mb_row(const MACROBLOCKD *xd) {
|
||||
return ((-xd->mb_to_top_edge) >> 7);
|
||||
}
|
||||
|
||||
static int get_mb_col(const MACROBLOCKD *xd) {
|
||||
return ((-xd->mb_to_left_edge) >> 7);
|
||||
}
|
||||
#endif // VP9_COMMON_VP9_ONYXC_INT_H_
|
||||
|
@ -336,11 +336,8 @@ void vp9_deblock(YV12_BUFFER_CONFIG *source,
|
||||
source->uv_height, source->uv_width, ppl);
|
||||
}
|
||||
|
||||
void vp9_de_noise(YV12_BUFFER_CONFIG *src,
|
||||
YV12_BUFFER_CONFIG *post,
|
||||
int q,
|
||||
int low_var_thresh,
|
||||
int flag) {
|
||||
void vp9_denoise(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *post,
|
||||
int q, int low_var_thresh, int flag) {
|
||||
double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
|
||||
int ppl = (int)(level + .5);
|
||||
(void) post;
|
||||
@ -424,9 +421,9 @@ static void fillrd(struct postproc_state *state, int q, int a) {
|
||||
*
|
||||
* INPUTS : unsigned char *Start starting address of buffer to
|
||||
* add gaussian noise to
|
||||
* unsigned int Width width of plane
|
||||
* unsigned int Height height of plane
|
||||
* int Pitch distance between subsequent lines of frame
|
||||
* unsigned int width width of plane
|
||||
* unsigned int height height of plane
|
||||
* int pitch distance between subsequent lines of frame
|
||||
* int q quantizer used to determine amount of noise
|
||||
* to add
|
||||
*
|
||||
@ -439,25 +436,25 @@ static void fillrd(struct postproc_state *state, int q, int a) {
|
||||
* SPECIAL NOTES : None.
|
||||
*
|
||||
****************************************************************************/
|
||||
void vp9_plane_add_noise_c(uint8_t *Start, char *noise,
|
||||
void vp9_plane_add_noise_c(uint8_t *start, char *noise,
|
||||
char blackclamp[16],
|
||||
char whiteclamp[16],
|
||||
char bothclamp[16],
|
||||
unsigned int Width, unsigned int Height, int Pitch) {
|
||||
unsigned int width, unsigned int height, int pitch) {
|
||||
unsigned int i, j;
|
||||
|
||||
for (i = 0; i < Height; i++) {
|
||||
uint8_t *Pos = Start + i * Pitch;
|
||||
char *Ref = (char *)(noise + (rand() & 0xff));
|
||||
for (i = 0; i < height; i++) {
|
||||
uint8_t *pos = start + i * pitch;
|
||||
char *ref = (char *)(noise + (rand() & 0xff)); // NOLINT
|
||||
|
||||
for (j = 0; j < Width; j++) {
|
||||
if (Pos[j] < blackclamp[0])
|
||||
Pos[j] = blackclamp[0];
|
||||
for (j = 0; j < width; j++) {
|
||||
if (pos[j] < blackclamp[0])
|
||||
pos[j] = blackclamp[0];
|
||||
|
||||
if (Pos[j] > 255 + whiteclamp[0])
|
||||
Pos[j] = 255 + whiteclamp[0];
|
||||
if (pos[j] > 255 + whiteclamp[0])
|
||||
pos[j] = 255 + whiteclamp[0];
|
||||
|
||||
Pos[j] += Ref[j];
|
||||
pos[j] += ref[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -636,8 +633,8 @@ int vp9_post_proc_frame(VP9_COMMON *oci, YV12_BUFFER_CONFIG *dest,
|
||||
*dest = *oci->frame_to_show;
|
||||
|
||||
/* handle problem with extending borders */
|
||||
dest->y_width = oci->Width;
|
||||
dest->y_height = oci->Height;
|
||||
dest->y_width = oci->width;
|
||||
dest->y_height = oci->height;
|
||||
dest->uv_height = dest->y_height / 2;
|
||||
return 0;
|
||||
|
||||
@ -1004,8 +1001,8 @@ int vp9_post_proc_frame(VP9_COMMON *oci, YV12_BUFFER_CONFIG *dest,
|
||||
*dest = oci->post_proc_buffer;
|
||||
|
||||
/* handle problem with extending borders */
|
||||
dest->y_width = oci->Width;
|
||||
dest->y_height = oci->Height;
|
||||
dest->y_width = oci->width;
|
||||
dest->y_height = oci->height;
|
||||
dest->uv_height = dest->y_height / 2;
|
||||
|
||||
return 0;
|
||||
|
@ -13,30 +13,26 @@
|
||||
#define VP9_COMMON_VP9_POSTPROC_H_
|
||||
|
||||
#include "vpx_ports/mem.h"
|
||||
|
||||
struct postproc_state {
|
||||
int last_q;
|
||||
int last_noise;
|
||||
char noise[3072];
|
||||
int last_q;
|
||||
int last_noise;
|
||||
char noise[3072];
|
||||
DECLARE_ALIGNED(16, char, blackclamp[16]);
|
||||
DECLARE_ALIGNED(16, char, whiteclamp[16]);
|
||||
DECLARE_ALIGNED(16, char, bothclamp[16]);
|
||||
};
|
||||
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
#include "vp9/common/vp9_ppflags.h"
|
||||
|
||||
int vp9_post_proc_frame(struct VP9Common *oci, YV12_BUFFER_CONFIG *dest,
|
||||
vp9_ppflags_t *flags);
|
||||
|
||||
void vp9_denoise(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post,
|
||||
int q, int low_var_thresh, int flag);
|
||||
|
||||
void vp9_de_noise(YV12_BUFFER_CONFIG *source,
|
||||
YV12_BUFFER_CONFIG *post,
|
||||
int q,
|
||||
int low_var_thresh,
|
||||
int flag);
|
||||
|
||||
void vp9_deblock(YV12_BUFFER_CONFIG *source,
|
||||
YV12_BUFFER_CONFIG *post,
|
||||
int q,
|
||||
int low_var_thresh,
|
||||
int flag);
|
||||
void vp9_deblock(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post,
|
||||
int q, int low_var_thresh, int flag);
|
||||
|
||||
#endif // VP9_COMMON_VP9_POSTPROC_H_
|
||||
|
@ -14,6 +14,7 @@
|
||||
#ifdef __INTEL_COMPILER
|
||||
#pragma warning(disable:997 1011 170)
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4799)
|
||||
#endif
|
||||
|
@ -29,14 +29,15 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
||||
// The prediction flags in these dummy entries are initialised to 0.
|
||||
switch (pred_id) {
|
||||
case PRED_SEG_ID:
|
||||
pred_context = (m - 1)->mbmi.seg_id_predicted +
|
||||
(m - cm->mode_info_stride)->mbmi.seg_id_predicted;
|
||||
pred_context = (m - cm->mode_info_stride)->mbmi.seg_id_predicted;
|
||||
if (xd->left_available)
|
||||
pred_context += (m - 1)->mbmi.seg_id_predicted;
|
||||
break;
|
||||
|
||||
|
||||
case PRED_REF:
|
||||
pred_context = (m - 1)->mbmi.ref_predicted +
|
||||
(m - cm->mode_info_stride)->mbmi.ref_predicted;
|
||||
pred_context = (m - cm->mode_info_stride)->mbmi.ref_predicted;
|
||||
if (xd->left_available)
|
||||
pred_context += (m - 1)->mbmi.ref_predicted;
|
||||
break;
|
||||
|
||||
case PRED_COMP:
|
||||
@ -61,13 +62,14 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
||||
break;
|
||||
|
||||
case PRED_MBSKIP:
|
||||
pred_context = (m - 1)->mbmi.mb_skip_coeff +
|
||||
(m - cm->mode_info_stride)->mbmi.mb_skip_coeff;
|
||||
pred_context = (m - cm->mode_info_stride)->mbmi.mb_skip_coeff;
|
||||
if (xd->left_available)
|
||||
pred_context += (m - 1)->mbmi.mb_skip_coeff;
|
||||
break;
|
||||
|
||||
case PRED_SWITCHABLE_INTERP:
|
||||
{
|
||||
int left_in_image = (m - 1)->mbmi.mb_in_image;
|
||||
int left_in_image = xd->left_available && (m - 1)->mbmi.mb_in_image;
|
||||
int above_in_image = (m - cm->mode_info_stride)->mbmi.mb_in_image;
|
||||
int left_mode = (m - 1)->mbmi.mode;
|
||||
int above_mode = (m - cm->mode_info_stride)->mbmi.mode;
|
||||
@ -98,8 +100,7 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
||||
break;
|
||||
|
||||
default:
|
||||
// TODO *** add error trap code.
|
||||
pred_context = 0;
|
||||
pred_context = 0; // *** add error trap code.
|
||||
break;
|
||||
}
|
||||
|
||||
@ -111,39 +112,23 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
||||
vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id) {
|
||||
vp9_prob pred_probability;
|
||||
int pred_context;
|
||||
|
||||
// Get the appropriate prediction context
|
||||
pred_context = vp9_get_pred_context(cm, xd, pred_id);
|
||||
const int pred_context = vp9_get_pred_context(cm, xd, pred_id);
|
||||
|
||||
switch (pred_id) {
|
||||
case PRED_SEG_ID:
|
||||
pred_probability = cm->segment_pred_probs[pred_context];
|
||||
break;
|
||||
|
||||
return cm->segment_pred_probs[pred_context];
|
||||
case PRED_REF:
|
||||
pred_probability = cm->ref_pred_probs[pred_context];
|
||||
break;
|
||||
|
||||
return cm->ref_pred_probs[pred_context];
|
||||
case PRED_COMP:
|
||||
// In keeping with convention elsewhre the probability returned is
|
||||
// the probability of a "0" outcome which in this case means the
|
||||
// probability of comp pred off.
|
||||
pred_probability = cm->prob_comppred[pred_context];
|
||||
break;
|
||||
|
||||
return cm->prob_comppred[pred_context];
|
||||
case PRED_MBSKIP:
|
||||
pred_probability = cm->mbskip_pred_probs[pred_context];
|
||||
break;
|
||||
|
||||
return cm->mbskip_pred_probs[pred_context];
|
||||
default:
|
||||
// TODO *** add error trap code.
|
||||
pred_probability = 128;
|
||||
break;
|
||||
return 128; // *** add error trap code.
|
||||
}
|
||||
|
||||
return pred_probability;
|
||||
}
|
||||
|
||||
// This function returns a context probability ptr for coding a given
|
||||
@ -151,71 +136,41 @@ vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
|
||||
const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id) {
|
||||
const vp9_prob *pred_probability;
|
||||
int pred_context;
|
||||
|
||||
// Get the appropriate prediction context
|
||||
pred_context = vp9_get_pred_context(cm, xd, pred_id);
|
||||
const int pred_context = vp9_get_pred_context(cm, xd, pred_id);
|
||||
|
||||
switch (pred_id) {
|
||||
case PRED_SEG_ID:
|
||||
pred_probability = &cm->segment_pred_probs[pred_context];
|
||||
break;
|
||||
|
||||
return &cm->segment_pred_probs[pred_context];
|
||||
case PRED_REF:
|
||||
pred_probability = &cm->ref_pred_probs[pred_context];
|
||||
break;
|
||||
|
||||
return &cm->ref_pred_probs[pred_context];
|
||||
case PRED_COMP:
|
||||
// In keeping with convention elsewhre the probability returned is
|
||||
// the probability of a "0" outcome which in this case means the
|
||||
// probability of comp pred off.
|
||||
pred_probability = &cm->prob_comppred[pred_context];
|
||||
break;
|
||||
|
||||
return &cm->prob_comppred[pred_context];
|
||||
case PRED_MBSKIP:
|
||||
pred_probability = &cm->mbskip_pred_probs[pred_context];
|
||||
break;
|
||||
|
||||
return &cm->mbskip_pred_probs[pred_context];
|
||||
case PRED_SWITCHABLE_INTERP:
|
||||
pred_probability = &cm->fc.switchable_interp_prob[pred_context][0];
|
||||
break;
|
||||
|
||||
return &cm->fc.switchable_interp_prob[pred_context][0];
|
||||
default:
|
||||
// TODO *** add error trap code.
|
||||
pred_probability = NULL;
|
||||
break;
|
||||
return NULL; // *** add error trap code.
|
||||
}
|
||||
|
||||
return pred_probability;
|
||||
}
|
||||
|
||||
// This function returns the status of the given prediction signal.
|
||||
// I.e. is the predicted value for the given signal correct.
|
||||
unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id) {
|
||||
unsigned char pred_flag = 0;
|
||||
|
||||
switch (pred_id) {
|
||||
case PRED_SEG_ID:
|
||||
pred_flag = xd->mode_info_context->mbmi.seg_id_predicted;
|
||||
break;
|
||||
|
||||
return xd->mode_info_context->mbmi.seg_id_predicted;
|
||||
case PRED_REF:
|
||||
pred_flag = xd->mode_info_context->mbmi.ref_predicted;
|
||||
break;
|
||||
|
||||
return xd->mode_info_context->mbmi.ref_predicted;
|
||||
case PRED_MBSKIP:
|
||||
pred_flag = xd->mode_info_context->mbmi.mb_skip_coeff;
|
||||
break;
|
||||
|
||||
return xd->mode_info_context->mbmi.mb_skip_coeff;
|
||||
default:
|
||||
// TODO *** add error trap code.
|
||||
pred_flag = 0;
|
||||
break;
|
||||
return 0; // *** add error trap code.
|
||||
}
|
||||
|
||||
return pred_flag;
|
||||
}
|
||||
|
||||
// This function sets the status of the given prediction signal.
|
||||
@ -277,7 +232,7 @@ void vp9_set_pred_flag(MACROBLOCKD *const xd,
|
||||
break;
|
||||
|
||||
default:
|
||||
// TODO *** add error trap code.
|
||||
// *** add error trap code.
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -322,7 +277,6 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
||||
MV_REFERENCE_FRAME pred_ref = LAST_FRAME;
|
||||
|
||||
int segment_id = xd->mode_info_context->mbmi.segment_id;
|
||||
int seg_ref_active;
|
||||
int i;
|
||||
|
||||
unsigned char frame_allowed[MAX_REF_FRAMES] = {1, 1, 1, 1};
|
||||
@ -333,7 +287,7 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
||||
unsigned char above_left_in_image;
|
||||
|
||||
// Is segment coding ennabled
|
||||
seg_ref_active = vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
|
||||
int seg_ref_active = vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
|
||||
|
||||
// Special case treatment if segment coding is enabled.
|
||||
// Dont allow prediction of a reference frame that the segment
|
||||
@ -355,9 +309,10 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
||||
above_left = (m - 1 - cm->mode_info_stride)->mbmi.ref_frame;
|
||||
|
||||
// Are neighbours in image
|
||||
left_in_image = (m - 1)->mbmi.mb_in_image;
|
||||
left_in_image = (m - 1)->mbmi.mb_in_image && xd->left_available;
|
||||
above_in_image = (m - cm->mode_info_stride)->mbmi.mb_in_image;
|
||||
above_left_in_image = (m - 1 - cm->mode_info_stride)->mbmi.mb_in_image;
|
||||
above_left_in_image = (m - 1 - cm->mode_info_stride)->mbmi.mb_in_image &&
|
||||
xd->left_available;
|
||||
|
||||
// Adjust scores for candidate reference frames based on neigbours
|
||||
if (frame_allowed[left] && left_in_image) {
|
||||
@ -385,9 +340,7 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
||||
// Functions to computes a set of modified reference frame probabilities
|
||||
// to use when the prediction of the reference frame value fails
|
||||
void vp9_calc_ref_probs(int *count, vp9_prob *probs) {
|
||||
int tot_count;
|
||||
|
||||
tot_count = count[0] + count[1] + count[2] + count[3];
|
||||
int tot_count = count[0] + count[1] + count[2] + count[3];
|
||||
probs[0] = get_prob(count[0], tot_count);
|
||||
|
||||
tot_count -= count[0];
|
||||
@ -403,19 +356,12 @@ void vp9_calc_ref_probs(int *count, vp9_prob *probs) {
|
||||
// they are not allowed for a given segment.
|
||||
void vp9_compute_mod_refprobs(VP9_COMMON *const cm) {
|
||||
int norm_cnt[MAX_REF_FRAMES];
|
||||
int intra_count;
|
||||
int inter_count;
|
||||
int last_count;
|
||||
int gfarf_count;
|
||||
int gf_count;
|
||||
int arf_count;
|
||||
|
||||
intra_count = cm->prob_intra_coded;
|
||||
inter_count = (255 - intra_count);
|
||||
last_count = (inter_count * cm->prob_last_coded) / 255;
|
||||
gfarf_count = inter_count - last_count;
|
||||
gf_count = (gfarf_count * cm->prob_gf_coded) / 255;
|
||||
arf_count = gfarf_count - gf_count;
|
||||
const int intra_count = cm->prob_intra_coded;
|
||||
const int inter_count = (255 - intra_count);
|
||||
const int last_count = (inter_count * cm->prob_last_coded) / 255;
|
||||
const int gfarf_count = inter_count - last_count;
|
||||
const int gf_count = (gfarf_count * cm->prob_gf_coded) / 255;
|
||||
const int arf_count = gfarf_count - gf_count;
|
||||
|
||||
// Work out modified reference frame probabilities to use where prediction
|
||||
// of the reference frame fails
|
||||
|
@ -8,48 +8,48 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
|
||||
#ifndef VP9_COMMON_VP9_PRED_COMMON_H_
|
||||
#define VP9_COMMON_VP9_PRED_COMMON_H_
|
||||
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
|
||||
// Predicted items
|
||||
typedef enum {
|
||||
PRED_SEG_ID = 0, // Segment identifier
|
||||
PRED_SEG_ID = 0, // Segment identifier
|
||||
PRED_REF = 1,
|
||||
PRED_COMP = 2,
|
||||
PRED_MBSKIP = 3,
|
||||
PRED_SWITCHABLE_INTERP = 4
|
||||
} PRED_ID;
|
||||
|
||||
extern unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
|
||||
extern vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
|
||||
extern const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
|
||||
extern unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id);
|
||||
|
||||
extern void vp9_set_pred_flag(MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id,
|
||||
unsigned char pred_flag);
|
||||
void vp9_set_pred_flag(MACROBLOCKD *const xd,
|
||||
PRED_ID pred_id,
|
||||
unsigned char pred_flag);
|
||||
|
||||
|
||||
extern unsigned char vp9_get_pred_mb_segid(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
int MbIndex);
|
||||
unsigned char vp9_get_pred_mb_segid(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd,
|
||||
int MbIndex);
|
||||
|
||||
extern MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd);
|
||||
extern void vp9_compute_mod_refprobs(VP9_COMMON *const cm);
|
||||
MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
||||
const MACROBLOCKD *const xd);
|
||||
|
||||
void vp9_compute_mod_refprobs(VP9_COMMON *const cm);
|
||||
|
||||
#endif // VP9_COMMON_VP9_PRED_COMMON_H_
|
||||
|
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
#include "vp9/common/vp9_common.h"
|
||||
#include "vp9/common/vp9_quant_common.h"
|
||||
|
||||
static int dc_qlookup[QINDEX_RANGE];
|
||||
@ -24,7 +24,7 @@ void vp9_init_quant_tables() {
|
||||
|
||||
for (i = 0; i < QINDEX_RANGE; i++) {
|
||||
ac_qlookup[i] = current_val;
|
||||
current_val = (int)((double)current_val * 1.02);
|
||||
current_val = (int)(current_val * 1.02);
|
||||
if (current_val == last_val)
|
||||
current_val++;
|
||||
last_val = current_val;
|
||||
@ -38,88 +38,18 @@ void vp9_init_quant_tables() {
|
||||
}
|
||||
}
|
||||
|
||||
int vp9_dc_quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = dc_qlookup[ QIndex ];
|
||||
return retval;
|
||||
int vp9_dc_quant(int qindex, int delta) {
|
||||
return dc_qlookup[clamp(qindex + delta, 0, MAXQ)];
|
||||
}
|
||||
|
||||
int vp9_dc2quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = dc_qlookup[ QIndex ];
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
int vp9_dc_uv_quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = dc_qlookup[ QIndex ];
|
||||
|
||||
return retval;
|
||||
int vp9_dc_uv_quant(int qindex, int delta) {
|
||||
return dc_qlookup[clamp(qindex + delta, 0, MAXQ)];
|
||||
}
|
||||
|
||||
int vp9_ac_yquant(int QIndex) {
|
||||
int retval;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = ac_qlookup[ QIndex ];
|
||||
return retval;
|
||||
int vp9_ac_yquant(int qindex) {
|
||||
return ac_qlookup[clamp(qindex, 0, MAXQ)];
|
||||
}
|
||||
|
||||
int vp9_ac2quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = (ac_qlookup[ QIndex ] * 775) / 1000;
|
||||
if (retval < 4)
|
||||
retval = 4;
|
||||
|
||||
return retval;
|
||||
}
|
||||
int vp9_ac_uv_quant(int QIndex, int Delta) {
|
||||
int retval;
|
||||
|
||||
QIndex = QIndex + Delta;
|
||||
|
||||
if (QIndex > MAXQ)
|
||||
QIndex = MAXQ;
|
||||
else if (QIndex < 0)
|
||||
QIndex = 0;
|
||||
|
||||
retval = ac_qlookup[ QIndex ];
|
||||
return retval;
|
||||
int vp9_ac_uv_quant(int qindex, int delta) {
|
||||
return ac_qlookup[clamp(qindex + delta, 0, MAXQ)];
|
||||
}
|
||||
|
@ -11,16 +11,15 @@
|
||||
#ifndef VP9_COMMON_VP9_QUANT_COMMON_H_
|
||||
#define VP9_COMMON_VP9_QUANT_COMMON_H_
|
||||
|
||||
#include "string.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
|
||||
extern void vp9_init_quant_tables(void);
|
||||
extern int vp9_ac_yquant(int QIndex);
|
||||
extern int vp9_dc_quant(int QIndex, int Delta);
|
||||
extern int vp9_dc2quant(int QIndex, int Delta);
|
||||
extern int vp9_ac2quant(int QIndex, int Delta);
|
||||
extern int vp9_dc_uv_quant(int QIndex, int Delta);
|
||||
extern int vp9_ac_uv_quant(int QIndex, int Delta);
|
||||
void vp9_init_quant_tables();
|
||||
int vp9_ac_yquant(int qindex);
|
||||
int vp9_dc_quant(int qindex, int delta);
|
||||
int vp9_dc2quant(int qindex, int delta);
|
||||
int vp9_ac2quant(int qindex, int delta);
|
||||
int vp9_dc_uv_quant(int qindex, int delta);
|
||||
int vp9_ac_uv_quant(int qindex, int delta);
|
||||
|
||||
#endif // VP9_COMMON_VP9_QUANT_COMMON_H_
|
||||
|
@ -117,7 +117,7 @@ void vp9_recon_mbuv_s_c(MACROBLOCKD *xd, uint8_t *udst, uint8_t *vdst) {
|
||||
|
||||
void vp9_recon_sby_s_c(MACROBLOCKD *xd, uint8_t *dst) {
|
||||
int x, y, stride = xd->block[0].dst_stride;
|
||||
int16_t *diff = xd->sb_coeff_data.diff;
|
||||
int16_t *diff = xd->diff;
|
||||
|
||||
for (y = 0; y < 32; y++) {
|
||||
for (x = 0; x < 32; x++) {
|
||||
@ -130,8 +130,8 @@ void vp9_recon_sby_s_c(MACROBLOCKD *xd, uint8_t *dst) {
|
||||
|
||||
void vp9_recon_sbuv_s_c(MACROBLOCKD *xd, uint8_t *udst, uint8_t *vdst) {
|
||||
int x, y, stride = xd->block[16].dst_stride;
|
||||
int16_t *udiff = xd->sb_coeff_data.diff + 1024;
|
||||
int16_t *vdiff = xd->sb_coeff_data.diff + 1280;
|
||||
int16_t *udiff = xd->diff + 1024;
|
||||
int16_t *vdiff = xd->diff + 1280;
|
||||
|
||||
for (y = 0; y < 16; y++) {
|
||||
for (x = 0; x < 16; x++) {
|
||||
@ -145,6 +145,36 @@ void vp9_recon_sbuv_s_c(MACROBLOCKD *xd, uint8_t *udst, uint8_t *vdst) {
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_recon_sb64y_s_c(MACROBLOCKD *xd, uint8_t *dst) {
|
||||
int x, y, stride = xd->block[0].dst_stride;
|
||||
int16_t *diff = xd->diff;
|
||||
|
||||
for (y = 0; y < 64; y++) {
|
||||
for (x = 0; x < 64; x++) {
|
||||
dst[x] = clip_pixel(dst[x] + diff[x]);
|
||||
}
|
||||
dst += stride;
|
||||
diff += 64;
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_recon_sb64uv_s_c(MACROBLOCKD *xd, uint8_t *udst, uint8_t *vdst) {
|
||||
int x, y, stride = xd->block[16].dst_stride;
|
||||
int16_t *udiff = xd->diff + 4096;
|
||||
int16_t *vdiff = xd->diff + 4096 + 1024;
|
||||
|
||||
for (y = 0; y < 32; y++) {
|
||||
for (x = 0; x < 32; x++) {
|
||||
udst[x] = clip_pixel(udst[x] + udiff[x]);
|
||||
vdst[x] = clip_pixel(vdst[x] + vdiff[x]);
|
||||
}
|
||||
udst += stride;
|
||||
vdst += stride;
|
||||
udiff += 32;
|
||||
vdiff += 32;
|
||||
}
|
||||
}
|
||||
|
||||
void vp9_recon_mby_c(MACROBLOCKD *xd) {
|
||||
int i;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,71 +14,128 @@
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vp9/common/vp9_onyxc_int.h"
|
||||
|
||||
extern void vp9_build_1st_inter16x16_predictors_mby(MACROBLOCKD *xd,
|
||||
uint8_t *dst_y,
|
||||
int dst_ystride,
|
||||
int clamp_mvs);
|
||||
struct subpix_fn_table;
|
||||
|
||||
extern void vp9_build_1st_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_uvstride);
|
||||
void vp9_build_inter16x16_predictors_mby(MACROBLOCKD *xd,
|
||||
uint8_t *dst_y,
|
||||
int dst_ystride,
|
||||
int mb_row,
|
||||
int mb_col);
|
||||
|
||||
extern void vp9_build_1st_inter16x16_predictors_mb(MACROBLOCKD *xd,
|
||||
uint8_t *dst_y,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_ystride,
|
||||
int dst_uvstride);
|
||||
void vp9_build_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_uvstride,
|
||||
int mb_row,
|
||||
int mb_col);
|
||||
|
||||
extern void vp9_build_2nd_inter16x16_predictors_mby(MACROBLOCKD *xd,
|
||||
uint8_t *dst_y,
|
||||
int dst_ystride);
|
||||
void vp9_build_inter16x16_predictors_mb(MACROBLOCKD *xd,
|
||||
uint8_t *dst_y,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_ystride,
|
||||
int dst_uvstride,
|
||||
int mb_row,
|
||||
int mb_col);
|
||||
|
||||
extern void vp9_build_2nd_inter16x16_predictors_mbuv(MACROBLOCKD *xd,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_uvstride);
|
||||
void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x,
|
||||
uint8_t *dst_y,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_ystride,
|
||||
int dst_uvstride,
|
||||
int mb_row,
|
||||
int mb_col);
|
||||
|
||||
extern void vp9_build_2nd_inter16x16_predictors_mb(MACROBLOCKD *xd,
|
||||
uint8_t *dst_y,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_ystride,
|
||||
int dst_uvstride);
|
||||
void vp9_build_inter64x64_predictors_sb(MACROBLOCKD *x,
|
||||
uint8_t *dst_y,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_ystride,
|
||||
int dst_uvstride,
|
||||
int mb_row,
|
||||
int mb_col);
|
||||
|
||||
extern void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x,
|
||||
uint8_t *dst_y,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_ystride,
|
||||
int dst_uvstride);
|
||||
void vp9_build_inter_predictors_mb(MACROBLOCKD *xd,
|
||||
int mb_row,
|
||||
int mb_col);
|
||||
|
||||
extern void vp9_build_inter64x64_predictors_sb(MACROBLOCKD *x,
|
||||
uint8_t *dst_y,
|
||||
uint8_t *dst_u,
|
||||
uint8_t *dst_v,
|
||||
int dst_ystride,
|
||||
int dst_uvstride);
|
||||
void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd,
|
||||
int mb_row,
|
||||
int mb_col);
|
||||
|
||||
extern void vp9_build_inter_predictors_mb(MACROBLOCKD *xd);
|
||||
void vp9_setup_interp_filters(MACROBLOCKD *xd,
|
||||
INTERPOLATIONFILTERTYPE filter,
|
||||
VP9_COMMON *cm);
|
||||
|
||||
extern void vp9_build_inter_predictors_b(BLOCKD *d, int pitch,
|
||||
vp9_subpix_fn_t sppf);
|
||||
void vp9_setup_scale_factors_for_frame(struct scale_factors *scale,
|
||||
YV12_BUFFER_CONFIG *other,
|
||||
int this_w, int this_h);
|
||||
|
||||
extern void vp9_build_2nd_inter_predictors_b(BLOCKD *d, int pitch,
|
||||
vp9_subpix_fn_t sppf);
|
||||
void vp9_build_inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
const int_mv *mv_q3,
|
||||
const struct scale_factors *scale,
|
||||
int w, int h, int do_avg,
|
||||
const struct subpix_fn_table *subpix);
|
||||
|
||||
extern void vp9_build_inter_predictors4b(MACROBLOCKD *xd, BLOCKD *d,
|
||||
int pitch);
|
||||
void vp9_build_inter_predictor_q4(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
const int_mv *fullpel_mv_q3,
|
||||
const int_mv *frac_mv_q4,
|
||||
const struct scale_factors *scale,
|
||||
int w, int h, int do_avg,
|
||||
const struct subpix_fn_table *subpix);
|
||||
|
||||
extern void vp9_build_2nd_inter_predictors4b(MACROBLOCKD *xd,
|
||||
BLOCKD *d, int pitch);
|
||||
static int scale_value_x(int val, const struct scale_factors *scale) {
|
||||
return val * scale->x_num / scale->x_den;
|
||||
}
|
||||
|
||||
extern void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd);
|
||||
static int scale_value_y(int val, const struct scale_factors *scale) {
|
||||
return val * scale->y_num / scale->y_den;
|
||||
}
|
||||
|
||||
extern void vp9_setup_interp_filters(MACROBLOCKD *xd,
|
||||
INTERPOLATIONFILTERTYPE filter,
|
||||
VP9_COMMON *cm);
|
||||
static int scaled_buffer_offset(int x_offset,
|
||||
int y_offset,
|
||||
int stride,
|
||||
const struct scale_factors *scale) {
|
||||
return scale_value_y(y_offset, scale) * stride +
|
||||
scale_value_x(x_offset, scale);
|
||||
}
|
||||
|
||||
static void setup_pred_block(YV12_BUFFER_CONFIG *dst,
|
||||
const YV12_BUFFER_CONFIG *src,
|
||||
int mb_row, int mb_col,
|
||||
const struct scale_factors *scale,
|
||||
const struct scale_factors *scale_uv) {
|
||||
const int recon_y_stride = src->y_stride;
|
||||
const int recon_uv_stride = src->uv_stride;
|
||||
int recon_yoffset;
|
||||
int recon_uvoffset;
|
||||
|
||||
if (scale) {
|
||||
recon_yoffset = scaled_buffer_offset(16 * mb_col, 16 * mb_row,
|
||||
recon_y_stride, scale);
|
||||
recon_uvoffset = scaled_buffer_offset(8 * mb_col, 8 * mb_row,
|
||||
recon_uv_stride, scale_uv);
|
||||
} else {
|
||||
recon_yoffset = 16 * mb_row * recon_y_stride + 16 * mb_col;
|
||||
recon_uvoffset = 8 * mb_row * recon_uv_stride + 8 * mb_col;
|
||||
}
|
||||
*dst = *src;
|
||||
dst->y_buffer += recon_yoffset;
|
||||
dst->u_buffer += recon_uvoffset;
|
||||
dst->v_buffer += recon_uvoffset;
|
||||
}
|
||||
|
||||
static void set_scale_factors(MACROBLOCKD *xd,
|
||||
int ref0, int ref1,
|
||||
struct scale_factors scale_factor[MAX_REF_FRAMES]) {
|
||||
|
||||
xd->scale_factor[0] = scale_factor[ref0 >= 0 ? ref0 : 0];
|
||||
xd->scale_factor[1] = scale_factor[ref1 >= 0 ? ref1 : 0];
|
||||
xd->scale_factor_uv[0] = xd->scale_factor[0];
|
||||
xd->scale_factor_uv[1] = xd->scale_factor[1];
|
||||
}
|
||||
|
||||
#endif // VP9_COMMON_VP9_RECONINTER_H_
|
||||
|
@ -9,106 +9,131 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vp9_rtcd.h"
|
||||
#include "vp9/common/vp9_reconintra.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
/* For skip_recon_mb(), add vp9_build_intra_predictors_mby_s(MACROBLOCKD *xd)
|
||||
* and vp9_build_intra_predictors_mbuv_s(MACROBLOCKD *xd).
|
||||
*/
|
||||
// For skip_recon_mb(), add vp9_build_intra_predictors_mby_s(MACROBLOCKD *xd)
|
||||
// and vp9_build_intra_predictors_mbuv_s(MACROBLOCKD *xd).
|
||||
|
||||
// Using multiplication and shifting instead of division in diagonal prediction.
|
||||
// iscale table is calculated from ((1 << 16) + (i + 2) / 2) / (i+2) and used as
|
||||
// ((A + B) * iscale[i] + (1 << 15)) >> 16;
|
||||
// where A and B are weighted pixel values.
|
||||
static const unsigned int iscale[64] = {
|
||||
32768, 21845, 16384, 13107, 10923, 9362, 8192, 7282,
|
||||
6554, 5958, 5461, 5041, 4681, 4369, 4096, 3855,
|
||||
3641, 3449, 3277, 3121, 2979, 2849, 2731, 2621,
|
||||
2521, 2427, 2341, 2260, 2185, 2114, 2048, 1986,
|
||||
1928, 1872, 1820, 1771, 1725, 1680, 1638, 1598,
|
||||
1560, 1524, 1489, 1456, 1425, 1394, 1365, 1337,
|
||||
1311, 1285, 1260, 1237, 1214, 1192, 1170, 1150,
|
||||
1130, 1111, 1092, 1074, 1057, 1040, 1024, 1008,
|
||||
};
|
||||
|
||||
static INLINE int iscale_round(int value, int i) {
|
||||
return ROUND_POWER_OF_TWO(value * iscale[i], 16);
|
||||
}
|
||||
|
||||
static void d27_predictor(uint8_t *ypred_ptr, int y_stride, int n,
|
||||
uint8_t *yabove_row, uint8_t *yleft_col) {
|
||||
int r, c, h, w, v;
|
||||
int a, b;
|
||||
int r, c;
|
||||
|
||||
r = 0;
|
||||
for (c = 0; c < n - 2; c++) {
|
||||
if (c & 1)
|
||||
a = yleft_col[r + 1];
|
||||
else
|
||||
a = (yleft_col[r] + yleft_col[r + 1] + 1) >> 1;
|
||||
b = yabove_row[c + 2];
|
||||
ypred_ptr[c] = (2 * a + (c + 1) * b + (c + 3) / 2) / (c + 3);
|
||||
int a = c & 1 ? yleft_col[r + 1]
|
||||
: ROUND_POWER_OF_TWO(yleft_col[r] + yleft_col[r + 1], 1);
|
||||
int b = yabove_row[c + 2];
|
||||
ypred_ptr[c] = iscale_round(2 * a + (c + 1) * b, 1 + c);
|
||||
}
|
||||
|
||||
for (r = 1; r < n / 2 - 1; r++) {
|
||||
for (c = 0; c < n - 2 - 2 * r; c++) {
|
||||
if (c & 1)
|
||||
a = yleft_col[r + 1];
|
||||
else
|
||||
a = (yleft_col[r] + yleft_col[r + 1] + 1) >> 1;
|
||||
b = ypred_ptr[(r - 1) * y_stride + c + 2];
|
||||
ypred_ptr[r * y_stride + c] = (2 * a + (c + 1) * b + (c + 3) / 2) / (c + 3);
|
||||
int a = c & 1 ? yleft_col[r + 1]
|
||||
: ROUND_POWER_OF_TWO(yleft_col[r] + yleft_col[r + 1], 1);
|
||||
int b = ypred_ptr[(r - 1) * y_stride + c + 2];
|
||||
ypred_ptr[r * y_stride + c] = iscale_round(2 * a + (c + 1) * b, 1 + c);
|
||||
}
|
||||
}
|
||||
for (; r < n - 1; ++r) {
|
||||
|
||||
for (; r < n - 1; r++) {
|
||||
for (c = 0; c < n; c++) {
|
||||
v = (c & 1 ? yleft_col[r + 1] : (yleft_col[r] + yleft_col[r + 1] + 1) >> 1);
|
||||
h = r - c / 2;
|
||||
int v = c & 1 ? yleft_col[r + 1]
|
||||
: ROUND_POWER_OF_TWO(yleft_col[r] + yleft_col[r + 1], 1);
|
||||
int h = r - c / 2;
|
||||
ypred_ptr[h * y_stride + c] = v;
|
||||
}
|
||||
}
|
||||
|
||||
c = 0;
|
||||
r = n - 1;
|
||||
ypred_ptr[r * y_stride] = (ypred_ptr[(r - 1) * y_stride] +
|
||||
yleft_col[r] + 1) >> 1;
|
||||
ypred_ptr[r * y_stride] = ROUND_POWER_OF_TWO(ypred_ptr[(r - 1) * y_stride] +
|
||||
yleft_col[r], 1);
|
||||
for (r = n - 2; r >= n / 2; --r) {
|
||||
w = c + (n - 1 - r) * 2;
|
||||
ypred_ptr[r * y_stride + w] = (ypred_ptr[(r - 1) * y_stride + w] +
|
||||
ypred_ptr[r * y_stride + w - 1] + 1) >> 1;
|
||||
int w = c + (n - 1 - r) * 2;
|
||||
ypred_ptr[r * y_stride + w] =
|
||||
ROUND_POWER_OF_TWO(ypred_ptr[(r - 1) * y_stride + w] +
|
||||
ypred_ptr[r * y_stride + w - 1], 1);
|
||||
}
|
||||
|
||||
for (c = 1; c < n; c++) {
|
||||
for (r = n - 1; r >= n / 2 + c / 2; --r) {
|
||||
w = c + (n - 1 - r) * 2;
|
||||
ypred_ptr[r * y_stride + w] = (ypred_ptr[(r - 1) * y_stride + w] +
|
||||
ypred_ptr[r * y_stride + w - 1] + 1) >> 1;
|
||||
int w = c + (n - 1 - r) * 2;
|
||||
ypred_ptr[r * y_stride + w] =
|
||||
ROUND_POWER_OF_TWO(ypred_ptr[(r - 1) * y_stride + w] +
|
||||
ypred_ptr[r * y_stride + w - 1], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void d63_predictor(uint8_t *ypred_ptr, int y_stride, int n,
|
||||
uint8_t *yabove_row, uint8_t *yleft_col) {
|
||||
int r, c, h, w, v;
|
||||
int a, b;
|
||||
int r, c;
|
||||
|
||||
c = 0;
|
||||
for (r = 0; r < n - 2; r++) {
|
||||
if (r & 1)
|
||||
a = yabove_row[c + 1];
|
||||
else
|
||||
a = (yabove_row[c] + yabove_row[c + 1] + 1) >> 1;
|
||||
b = yleft_col[r + 2];
|
||||
ypred_ptr[r * y_stride] = (2 * a + (r + 1) * b + (r + 3) / 2) / (r + 3);
|
||||
int a = r & 1 ? yabove_row[c + 1]
|
||||
: ROUND_POWER_OF_TWO(yabove_row[c] + yabove_row[c + 1], 1);
|
||||
int b = yleft_col[r + 2];
|
||||
ypred_ptr[r * y_stride] = iscale_round(2 * a + (r + 1) * b, 1 + r);
|
||||
}
|
||||
|
||||
for (c = 1; c < n / 2 - 1; c++) {
|
||||
for (r = 0; r < n - 2 - 2 * c; r++) {
|
||||
if (r & 1)
|
||||
a = yabove_row[c + 1];
|
||||
else
|
||||
a = (yabove_row[c] + yabove_row[c + 1] + 1) >> 1;
|
||||
b = ypred_ptr[(r + 2) * y_stride + c - 1];
|
||||
ypred_ptr[r * y_stride + c] = (2 * a + (c + 1) * b + (c + 3) / 2) / (c + 3);
|
||||
int a = r & 1 ? yabove_row[c + 1]
|
||||
: ROUND_POWER_OF_TWO(yabove_row[c] + yabove_row[c + 1], 1);
|
||||
int b = ypred_ptr[(r + 2) * y_stride + c - 1];
|
||||
ypred_ptr[r * y_stride + c] = iscale_round(2 * a + (c + 1) * b, 1 + c);
|
||||
}
|
||||
}
|
||||
|
||||
for (; c < n - 1; ++c) {
|
||||
for (r = 0; r < n; r++) {
|
||||
v = (r & 1 ? yabove_row[c + 1] : (yabove_row[c] + yabove_row[c + 1] + 1) >> 1);
|
||||
w = c - r / 2;
|
||||
int v = r & 1 ? yabove_row[c + 1]
|
||||
: ROUND_POWER_OF_TWO(yabove_row[c] + yabove_row[c + 1], 1);
|
||||
int w = c - r / 2;
|
||||
ypred_ptr[r * y_stride + w] = v;
|
||||
}
|
||||
}
|
||||
|
||||
r = 0;
|
||||
c = n - 1;
|
||||
ypred_ptr[c] = (ypred_ptr[(c - 1)] + yabove_row[c] + 1) >> 1;
|
||||
ypred_ptr[c] = ROUND_POWER_OF_TWO(ypred_ptr[(c - 1)] + yabove_row[c], 1);
|
||||
for (c = n - 2; c >= n / 2; --c) {
|
||||
h = r + (n - 1 - c) * 2;
|
||||
ypred_ptr[h * y_stride + c] = (ypred_ptr[h * y_stride + c - 1] +
|
||||
ypred_ptr[(h - 1) * y_stride + c] + 1) >> 1;
|
||||
int h = r + (n - 1 - c) * 2;
|
||||
ypred_ptr[h * y_stride + c] =
|
||||
ROUND_POWER_OF_TWO(ypred_ptr[h * y_stride + c - 1] +
|
||||
ypred_ptr[(h - 1) * y_stride + c], 1);
|
||||
}
|
||||
|
||||
for (r = 1; r < n; r++) {
|
||||
for (c = n - 1; c >= n / 2 + r / 2; --c) {
|
||||
h = r + (n - 1 - c) * 2;
|
||||
ypred_ptr[h * y_stride + c] = (ypred_ptr[h * y_stride + c - 1] +
|
||||
ypred_ptr[(h - 1) * y_stride + c] + 1) >> 1;
|
||||
int h = r + (n - 1 - c) * 2;
|
||||
ypred_ptr[h * y_stride + c] =
|
||||
ROUND_POWER_OF_TWO(ypred_ptr[h * y_stride + c - 1] +
|
||||
ypred_ptr[(h - 1) * y_stride + c], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,27 +141,28 @@ static void d63_predictor(uint8_t *ypred_ptr, int y_stride, int n,
|
||||
static void d45_predictor(uint8_t *ypred_ptr, int y_stride, int n,
|
||||
uint8_t *yabove_row, uint8_t *yleft_col) {
|
||||
int r, c;
|
||||
|
||||
for (r = 0; r < n - 1; ++r) {
|
||||
for (c = 0; c <= r; ++c) {
|
||||
ypred_ptr[(r - c) * y_stride + c] =
|
||||
(yabove_row[r + 1] * (c + 1) +
|
||||
yleft_col[r + 1] * (r - c + 1) + r / 2 + 1) / (r + 2);
|
||||
ypred_ptr[(r - c) * y_stride + c] = iscale_round(
|
||||
yabove_row[r + 1] * (c + 1) + yleft_col[r + 1] * (r - c + 1), r);
|
||||
}
|
||||
}
|
||||
|
||||
for (c = 0; c <= r; ++c) {
|
||||
int yabove_ext = yabove_row[r]; // clip_pixel(2 * yabove_row[r] -
|
||||
// yabove_row[r - 1]);
|
||||
int yleft_ext = yleft_col[r]; // clip_pixel(2 * yleft_col[r] -
|
||||
// yleft_col[r-1]);
|
||||
ypred_ptr[(r - c) * y_stride + c] =
|
||||
(yabove_ext * (c + 1) +
|
||||
yleft_ext * (r - c + 1) + r / 2 + 1) / (r + 2);
|
||||
iscale_round(yabove_ext * (c + 1) + yleft_ext * (r - c + 1), r);
|
||||
}
|
||||
for (r = 1; r < n; ++r) {
|
||||
for (c = n - r; c < n; ++c) {
|
||||
const int yabove_ext = ypred_ptr[(r - 1) * y_stride + c];
|
||||
const int yleft_ext = ypred_ptr[r * y_stride + c - 1];
|
||||
ypred_ptr[r * y_stride + c] = (yabove_ext + yleft_ext + 1) >> 1;
|
||||
ypred_ptr[r * y_stride + c] =
|
||||
ROUND_POWER_OF_TWO(yabove_ext + yleft_ext, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,7 +171,7 @@ static void d117_predictor(uint8_t *ypred_ptr, int y_stride, int n,
|
||||
uint8_t *yabove_row, uint8_t *yleft_col) {
|
||||
int r, c;
|
||||
for (c = 0; c < n; c++)
|
||||
ypred_ptr[c] = (yabove_row[c - 1] + yabove_row[c] + 1) >> 1;
|
||||
ypred_ptr[c] = ROUND_POWER_OF_TWO(yabove_row[c - 1] + yabove_row[c], 1);
|
||||
ypred_ptr += y_stride;
|
||||
for (c = 0; c < n; c++)
|
||||
ypred_ptr[c] = yabove_row[c - 1];
|
||||
@ -179,9 +205,10 @@ static void d135_predictor(uint8_t *ypred_ptr, int y_stride, int n,
|
||||
static void d153_predictor(uint8_t *ypred_ptr, int y_stride, int n,
|
||||
uint8_t *yabove_row, uint8_t *yleft_col) {
|
||||
int r, c;
|
||||
ypred_ptr[0] = (yabove_row[-1] + yleft_col[0] + 1) >> 1;
|
||||
ypred_ptr[0] = ROUND_POWER_OF_TWO(yabove_row[-1] + yleft_col[0], 1);
|
||||
for (r = 1; r < n; r++)
|
||||
ypred_ptr[r * y_stride] = (yleft_col[r - 1] + yleft_col[r] + 1) >> 1;
|
||||
ypred_ptr[r * y_stride] =
|
||||
ROUND_POWER_OF_TWO(yleft_col[r - 1] + yleft_col[r], 1);
|
||||
ypred_ptr++;
|
||||
ypred_ptr[0] = yabove_row[-1];
|
||||
for (r = 1; r < n; r++)
|
||||
@ -248,20 +275,58 @@ void vp9_recon_intra_mbuv(MACROBLOCKD *xd) {
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE int log2_minus_1(int n) {
|
||||
switch (n) {
|
||||
case 4: return 1;
|
||||
case 8: return 2;
|
||||
case 16: return 3;
|
||||
case 32: return 4;
|
||||
case 64: return 5;
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vp9_build_intra_predictors_internal(uint8_t *src, int src_stride,
|
||||
uint8_t *ypred_ptr,
|
||||
int y_stride, int mode, int bsize,
|
||||
int up_available, int left_available) {
|
||||
|
||||
uint8_t *yabove_row = src - src_stride;
|
||||
uint8_t yleft_col[64];
|
||||
uint8_t ytop_left = yabove_row[-1];
|
||||
int up_available, int left_available,
|
||||
int right_available) {
|
||||
int r, c, i;
|
||||
uint8_t yleft_col[64], yabove_data[65], ytop_left;
|
||||
uint8_t *yabove_row = yabove_data + 1;
|
||||
/*
|
||||
* 127 127 127 .. 127 127 127 127 127 127
|
||||
* 129 A B .. Y Z
|
||||
* 129 C D .. W X
|
||||
* 129 E F .. U V
|
||||
* 129 G H .. S T T T T T
|
||||
* ..
|
||||
*/
|
||||
|
||||
for (i = 0; i < bsize; i++) {
|
||||
yleft_col[i] = src[i * src_stride - 1];
|
||||
if (left_available) {
|
||||
for (i = 0; i < bsize; i++)
|
||||
yleft_col[i] = src[i * src_stride - 1];
|
||||
} else {
|
||||
vpx_memset(yleft_col, 129, bsize);
|
||||
}
|
||||
|
||||
if (up_available) {
|
||||
uint8_t *yabove_ptr = src - src_stride;
|
||||
vpx_memcpy(yabove_row, yabove_ptr, bsize);
|
||||
if (left_available) {
|
||||
ytop_left = yabove_ptr[-1];
|
||||
} else {
|
||||
ytop_left = 127;
|
||||
}
|
||||
} else {
|
||||
vpx_memset(yabove_row, 127, bsize);
|
||||
ytop_left = 127;
|
||||
}
|
||||
yabove_row[-1] = ytop_left;
|
||||
|
||||
/* for Y */
|
||||
switch (mode) {
|
||||
case DC_PRED: {
|
||||
@ -269,22 +334,7 @@ void vp9_build_intra_predictors_internal(uint8_t *src, int src_stride,
|
||||
int i;
|
||||
int shift;
|
||||
int average = 0;
|
||||
int log2_bsize_minus_1;
|
||||
|
||||
assert(bsize == 4 || bsize == 8 || bsize == 16 || bsize == 32 ||
|
||||
bsize == 64);
|
||||
if (bsize == 4) {
|
||||
log2_bsize_minus_1 = 1;
|
||||
} else if (bsize == 8) {
|
||||
log2_bsize_minus_1 = 2;
|
||||
} else if (bsize == 16) {
|
||||
log2_bsize_minus_1 = 3;
|
||||
} else if (bsize == 32) {
|
||||
log2_bsize_minus_1 = 4;
|
||||
} else {
|
||||
assert(bsize == 64);
|
||||
log2_bsize_minus_1 = 5;
|
||||
}
|
||||
int log2_bsize_minus_1 = log2_minus_1(bsize);
|
||||
|
||||
if (up_available || left_available) {
|
||||
if (up_available) {
|
||||
@ -299,7 +349,7 @@ void vp9_build_intra_predictors_internal(uint8_t *src, int src_stride,
|
||||
}
|
||||
}
|
||||
shift = log2_bsize_minus_1 + up_available + left_available;
|
||||
expected_dc = (average + (1 << (shift - 1))) >> shift;
|
||||
expected_dc = ROUND_POWER_OF_TWO(average, shift);
|
||||
} else {
|
||||
expected_dc = 128;
|
||||
}
|
||||
@ -310,21 +360,19 @@ void vp9_build_intra_predictors_internal(uint8_t *src, int src_stride,
|
||||
}
|
||||
}
|
||||
break;
|
||||
case V_PRED: {
|
||||
case V_PRED:
|
||||
for (r = 0; r < bsize; r++) {
|
||||
memcpy(ypred_ptr, yabove_row, bsize);
|
||||
ypred_ptr += y_stride;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case H_PRED: {
|
||||
break;
|
||||
case H_PRED:
|
||||
for (r = 0; r < bsize; r++) {
|
||||
vpx_memset(ypred_ptr, yleft_col[r], bsize);
|
||||
ypred_ptr += y_stride;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TM_PRED: {
|
||||
break;
|
||||
case TM_PRED:
|
||||
for (r = 0; r < bsize; r++) {
|
||||
for (c = 0; c < bsize; c++) {
|
||||
ypred_ptr[c] = clip_pixel(yleft_col[r] + yabove_row[c] - ytop_left);
|
||||
@ -332,32 +380,25 @@ void vp9_build_intra_predictors_internal(uint8_t *src, int src_stride,
|
||||
|
||||
ypred_ptr += y_stride;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case D45_PRED: {
|
||||
break;
|
||||
case D45_PRED:
|
||||
d45_predictor(ypred_ptr, y_stride, bsize, yabove_row, yleft_col);
|
||||
}
|
||||
break;
|
||||
case D135_PRED: {
|
||||
break;
|
||||
case D135_PRED:
|
||||
d135_predictor(ypred_ptr, y_stride, bsize, yabove_row, yleft_col);
|
||||
}
|
||||
break;
|
||||
case D117_PRED: {
|
||||
break;
|
||||
case D117_PRED:
|
||||
d117_predictor(ypred_ptr, y_stride, bsize, yabove_row, yleft_col);
|
||||
}
|
||||
break;
|
||||
case D153_PRED: {
|
||||
break;
|
||||
case D153_PRED:
|
||||
d153_predictor(ypred_ptr, y_stride, bsize, yabove_row, yleft_col);
|
||||
}
|
||||
break;
|
||||
case D27_PRED: {
|
||||
break;
|
||||
case D27_PRED:
|
||||
d27_predictor(ypred_ptr, y_stride, bsize, yabove_row, yleft_col);
|
||||
}
|
||||
break;
|
||||
case D63_PRED: {
|
||||
break;
|
||||
case D63_PRED:
|
||||
d63_predictor(ypred_ptr, y_stride, bsize, yabove_row, yleft_col);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case I8X8_PRED:
|
||||
case B_PRED:
|
||||
case NEARESTMV:
|
||||
@ -383,155 +424,28 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
|
||||
static const int scale_max = 256; // 1 << scale_bits;
|
||||
static const int scale_round = 127; // (1 << (scale_bits - 1));
|
||||
// This table is a function A + B*exp(-kx), where x is hor. index
|
||||
static const int weights1d[32] = {
|
||||
128, 122, 116, 111, 107, 103, 99, 96,
|
||||
93, 90, 88, 85, 83, 81, 80, 78,
|
||||
77, 76, 75, 74, 73, 72, 71, 70,
|
||||
70, 69, 69, 68, 68, 68, 67, 67,
|
||||
static const int weights1d[64] = {
|
||||
128, 125, 122, 119, 116, 114, 111, 109,
|
||||
107, 105, 103, 101, 99, 97, 96, 94,
|
||||
93, 91, 90, 89, 88, 86, 85, 84,
|
||||
83, 82, 81, 81, 80, 79, 78, 78,
|
||||
77, 76, 76, 75, 75, 74, 74, 73,
|
||||
73, 72, 72, 71, 71, 71, 70, 70,
|
||||
70, 70, 69, 69, 69, 69, 68, 68,
|
||||
68, 68, 68, 67, 67, 67, 67, 67,
|
||||
};
|
||||
// This table is a function A + B*exp(-k.sqrt(xy)), where x, y are
|
||||
// hor. and vert. indices
|
||||
static const int weights2d[1024] = {
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 122, 120, 118, 116, 115, 114, 113,
|
||||
112, 111, 111, 110, 109, 109, 108, 107,
|
||||
107, 106, 106, 105, 105, 104, 104, 104,
|
||||
103, 103, 102, 102, 102, 101, 101, 101,
|
||||
128, 120, 116, 114, 112, 111, 109, 108,
|
||||
107, 106, 105, 104, 103, 102, 102, 101,
|
||||
100, 100, 99, 99, 98, 97, 97, 96,
|
||||
96, 96, 95, 95, 94, 94, 93, 93,
|
||||
128, 118, 114, 111, 109, 107, 106, 104,
|
||||
103, 102, 101, 100, 99, 98, 97, 97,
|
||||
96, 95, 95, 94, 93, 93, 92, 92,
|
||||
91, 91, 90, 90, 90, 89, 89, 88,
|
||||
128, 116, 112, 109, 107, 105, 103, 102,
|
||||
100, 99, 98, 97, 96, 95, 94, 93,
|
||||
93, 92, 91, 91, 90, 90, 89, 89,
|
||||
88, 88, 87, 87, 86, 86, 85, 85,
|
||||
128, 115, 111, 107, 105, 103, 101, 99,
|
||||
98, 97, 96, 94, 93, 93, 92, 91,
|
||||
90, 89, 89, 88, 88, 87, 86, 86,
|
||||
85, 85, 84, 84, 84, 83, 83, 82,
|
||||
128, 114, 109, 106, 103, 101, 99, 97,
|
||||
96, 95, 93, 92, 91, 90, 90, 89,
|
||||
88, 87, 87, 86, 85, 85, 84, 84,
|
||||
83, 83, 82, 82, 82, 81, 81, 80,
|
||||
128, 113, 108, 104, 102, 99, 97, 96,
|
||||
94, 93, 92, 91, 90, 89, 88, 87,
|
||||
86, 85, 85, 84, 84, 83, 83, 82,
|
||||
82, 81, 81, 80, 80, 79, 79, 79,
|
||||
128, 112, 107, 103, 100, 98, 96, 94,
|
||||
93, 91, 90, 89, 88, 87, 86, 85,
|
||||
85, 84, 83, 83, 82, 82, 81, 80,
|
||||
80, 80, 79, 79, 78, 78, 78, 77,
|
||||
128, 111, 106, 102, 99, 97, 95, 93,
|
||||
91, 90, 89, 88, 87, 86, 85, 84,
|
||||
83, 83, 82, 81, 81, 80, 80, 79,
|
||||
79, 78, 78, 77, 77, 77, 76, 76,
|
||||
128, 111, 105, 101, 98, 96, 93, 92,
|
||||
90, 89, 88, 86, 85, 84, 84, 83,
|
||||
82, 81, 81, 80, 80, 79, 79, 78,
|
||||
78, 77, 77, 76, 76, 76, 75, 75,
|
||||
128, 110, 104, 100, 97, 94, 92, 91,
|
||||
89, 88, 86, 85, 84, 83, 83, 82,
|
||||
81, 80, 80, 79, 79, 78, 78, 77,
|
||||
77, 76, 76, 75, 75, 75, 74, 74,
|
||||
128, 109, 103, 99, 96, 93, 91, 90,
|
||||
88, 87, 85, 84, 83, 82, 82, 81,
|
||||
80, 79, 79, 78, 78, 77, 77, 76,
|
||||
76, 75, 75, 75, 74, 74, 74, 73,
|
||||
128, 109, 102, 98, 95, 93, 90, 89,
|
||||
87, 86, 84, 83, 82, 81, 81, 80,
|
||||
79, 78, 78, 77, 77, 76, 76, 75,
|
||||
75, 75, 74, 74, 73, 73, 73, 73,
|
||||
128, 108, 102, 97, 94, 92, 90, 88,
|
||||
86, 85, 84, 83, 82, 81, 80, 79,
|
||||
78, 78, 77, 77, 76, 76, 75, 75,
|
||||
74, 74, 73, 73, 73, 73, 72, 72,
|
||||
128, 107, 101, 97, 93, 91, 89, 87,
|
||||
85, 84, 83, 82, 81, 80, 79, 78,
|
||||
78, 77, 76, 76, 75, 75, 74, 74,
|
||||
74, 73, 73, 73, 72, 72, 72, 71,
|
||||
128, 107, 100, 96, 93, 90, 88, 86,
|
||||
85, 83, 82, 81, 80, 79, 78, 78,
|
||||
77, 76, 76, 75, 75, 74, 74, 73,
|
||||
73, 73, 72, 72, 72, 71, 71, 71,
|
||||
128, 106, 100, 95, 92, 89, 87, 85,
|
||||
84, 83, 81, 80, 79, 78, 78, 77,
|
||||
76, 76, 75, 75, 74, 74, 73, 73,
|
||||
72, 72, 72, 72, 71, 71, 71, 70,
|
||||
128, 106, 99, 95, 91, 89, 87, 85,
|
||||
83, 82, 81, 80, 79, 78, 77, 76,
|
||||
76, 75, 75, 74, 74, 73, 73, 72,
|
||||
72, 72, 71, 71, 71, 71, 70, 70,
|
||||
128, 105, 99, 94, 91, 88, 86, 84,
|
||||
83, 81, 80, 79, 78, 77, 77, 76,
|
||||
75, 75, 74, 74, 73, 73, 72, 72,
|
||||
72, 71, 71, 71, 70, 70, 70, 70,
|
||||
128, 105, 98, 93, 90, 88, 85, 84,
|
||||
82, 81, 80, 79, 78, 77, 76, 75,
|
||||
75, 74, 74, 73, 73, 72, 72, 71,
|
||||
71, 71, 71, 70, 70, 70, 70, 69,
|
||||
128, 104, 97, 93, 90, 87, 85, 83,
|
||||
82, 80, 79, 78, 77, 76, 76, 75,
|
||||
74, 74, 73, 73, 72, 72, 71, 71,
|
||||
71, 70, 70, 70, 70, 69, 69, 69,
|
||||
128, 104, 97, 92, 89, 86, 84, 83,
|
||||
81, 80, 79, 78, 77, 76, 75, 74,
|
||||
74, 73, 73, 72, 72, 71, 71, 71,
|
||||
70, 70, 70, 70, 69, 69, 69, 69,
|
||||
128, 104, 96, 92, 89, 86, 84, 82,
|
||||
80, 79, 78, 77, 76, 75, 75, 74,
|
||||
73, 73, 72, 72, 71, 71, 71, 70,
|
||||
70, 70, 70, 69, 69, 69, 69, 68,
|
||||
128, 103, 96, 91, 88, 85, 83, 82,
|
||||
80, 79, 78, 77, 76, 75, 74, 74,
|
||||
73, 72, 72, 72, 71, 71, 70, 70,
|
||||
70, 70, 69, 69, 69, 69, 68, 68,
|
||||
128, 103, 96, 91, 88, 85, 83, 81,
|
||||
80, 78, 77, 76, 75, 75, 74, 73,
|
||||
73, 72, 72, 71, 71, 70, 70, 70,
|
||||
70, 69, 69, 69, 69, 68, 68, 68,
|
||||
128, 102, 95, 90, 87, 84, 82, 81,
|
||||
79, 78, 77, 76, 75, 74, 73, 73,
|
||||
72, 72, 71, 71, 71, 70, 70, 70,
|
||||
69, 69, 69, 69, 68, 68, 68, 68,
|
||||
128, 102, 95, 90, 87, 84, 82, 80,
|
||||
79, 77, 76, 75, 75, 74, 73, 73,
|
||||
72, 72, 71, 71, 70, 70, 70, 69,
|
||||
69, 69, 69, 68, 68, 68, 68, 68,
|
||||
128, 102, 94, 90, 86, 84, 82, 80,
|
||||
78, 77, 76, 75, 74, 73, 73, 72,
|
||||
72, 71, 71, 70, 70, 70, 69, 69,
|
||||
69, 69, 68, 68, 68, 68, 68, 67,
|
||||
128, 101, 94, 89, 86, 83, 81, 79,
|
||||
78, 77, 76, 75, 74, 73, 73, 72,
|
||||
71, 71, 71, 70, 70, 69, 69, 69,
|
||||
69, 68, 68, 68, 68, 68, 67, 67,
|
||||
128, 101, 93, 89, 85, 83, 81, 79,
|
||||
78, 76, 75, 74, 74, 73, 72, 72,
|
||||
71, 71, 70, 70, 70, 69, 69, 69,
|
||||
68, 68, 68, 68, 68, 67, 67, 67,
|
||||
128, 101, 93, 88, 85, 82, 80, 79,
|
||||
77, 76, 75, 74, 73, 73, 72, 71,
|
||||
71, 70, 70, 70, 69, 69, 69, 68,
|
||||
68, 68, 68, 68, 67, 67, 67, 67,
|
||||
};
|
||||
int size_scale = (size >= 32 ? 1 :
|
||||
size == 16 ? 2 :
|
||||
size == 8 ? 4 : 8);
|
||||
int size_shift = size == 64 ? 1 : 0;
|
||||
|
||||
int size_scale = (size >= 64 ? 1:
|
||||
size == 32 ? 2 :
|
||||
size == 16 ? 4 :
|
||||
size == 8 ? 8 : 16);
|
||||
int i, j;
|
||||
switch (mode) {
|
||||
case V_PRED:
|
||||
for (i = 0; i < size; ++i) {
|
||||
for (j = 0; j < size; ++j) {
|
||||
int k = i * interstride + j;
|
||||
int scale = weights1d[i * size_scale >> size_shift];
|
||||
int scale = weights1d[i * size_scale];
|
||||
interpred[k] =
|
||||
((scale_max - scale) * interpred[k] +
|
||||
scale * intrapred[i * intrastride + j] + scale_round)
|
||||
@ -544,7 +458,7 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
|
||||
for (i = 0; i < size; ++i) {
|
||||
for (j = 0; j < size; ++j) {
|
||||
int k = i * interstride + j;
|
||||
int scale = weights1d[j * size_scale >> size_shift];
|
||||
int scale = weights1d[j * size_scale];
|
||||
interpred[k] =
|
||||
((scale_max - scale) * interpred[k] +
|
||||
scale * intrapred[i * intrastride + j] + scale_round)
|
||||
@ -558,9 +472,8 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
|
||||
for (i = 0; i < size; ++i) {
|
||||
for (j = 0; j < size; ++j) {
|
||||
int k = i * interstride + j;
|
||||
int scale = (weights2d[(i * size_scale * 32 +
|
||||
j * size_scale) >> size_shift] +
|
||||
weights1d[i * size_scale >> size_shift]) >> 1;
|
||||
int scale = (weights1d[i * size_scale] * 3 +
|
||||
weights1d[j * size_scale]) >> 2;
|
||||
interpred[k] =
|
||||
((scale_max - scale) * interpred[k] +
|
||||
scale * intrapred[i * intrastride + j] + scale_round)
|
||||
@ -574,9 +487,8 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
|
||||
for (i = 0; i < size; ++i) {
|
||||
for (j = 0; j < size; ++j) {
|
||||
int k = i * interstride + j;
|
||||
int scale = (weights2d[(i * size_scale * 32 +
|
||||
j * size_scale) >> size_shift] +
|
||||
weights1d[j * size_scale >> size_shift]) >> 1;
|
||||
int scale = (weights1d[j * size_scale] * 3 +
|
||||
weights1d[i * size_scale]) >> 2;
|
||||
interpred[k] =
|
||||
((scale_max - scale) * interpred[k] +
|
||||
scale * intrapred[i * intrastride + j] + scale_round)
|
||||
@ -589,8 +501,7 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
|
||||
for (i = 0; i < size; ++i) {
|
||||
for (j = 0; j < size; ++j) {
|
||||
int k = i * interstride + j;
|
||||
int scale = weights2d[(i * size_scale * 32 +
|
||||
j * size_scale) >> size_shift];
|
||||
int scale = weights1d[(i < j ? i : j) * size_scale];
|
||||
interpred[k] =
|
||||
((scale_max - scale) * interpred[k] +
|
||||
scale * intrapred[i * intrastride + j] + scale_round)
|
||||
@ -600,8 +511,21 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
|
||||
break;
|
||||
|
||||
case D45_PRED:
|
||||
case DC_PRED:
|
||||
for (i = 0; i < size; ++i) {
|
||||
for (j = 0; j < size; ++j) {
|
||||
int k = i * interstride + j;
|
||||
int scale = (weights1d[i * size_scale] +
|
||||
weights1d[j * size_scale]) >> 1;
|
||||
interpred[k] =
|
||||
((scale_max - scale) * interpred[k] +
|
||||
scale * intrapred[i * intrastride + j] + scale_round)
|
||||
>> scale_bits;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TM_PRED:
|
||||
case DC_PRED:
|
||||
default:
|
||||
// simple average
|
||||
for (i = 0; i < size; ++i) {
|
||||
@ -631,7 +555,7 @@ void vp9_build_interintra_16x16_predictors_mby(MACROBLOCKD *xd,
|
||||
xd->dst.y_buffer, xd->dst.y_stride,
|
||||
intrapredictor, 16,
|
||||
xd->mode_info_context->mbmi.interintra_mode, 16,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available, xd->right_available);
|
||||
combine_interintra(xd->mode_info_context->mbmi.interintra_mode,
|
||||
ypred, ystride, intrapredictor, 16, 16);
|
||||
}
|
||||
@ -646,12 +570,12 @@ void vp9_build_interintra_16x16_predictors_mbuv(MACROBLOCKD *xd,
|
||||
xd->dst.u_buffer, xd->dst.uv_stride,
|
||||
uintrapredictor, 8,
|
||||
xd->mode_info_context->mbmi.interintra_uv_mode, 8,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available, xd->right_available);
|
||||
vp9_build_intra_predictors_internal(
|
||||
xd->dst.v_buffer, xd->dst.uv_stride,
|
||||
vintrapredictor, 8,
|
||||
xd->mode_info_context->mbmi.interintra_uv_mode, 8,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available, xd->right_available);
|
||||
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
|
||||
upred, uvstride, uintrapredictor, 8, 8);
|
||||
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
|
||||
@ -666,7 +590,7 @@ void vp9_build_interintra_32x32_predictors_sby(MACROBLOCKD *xd,
|
||||
xd->dst.y_buffer, xd->dst.y_stride,
|
||||
intrapredictor, 32,
|
||||
xd->mode_info_context->mbmi.interintra_mode, 32,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available, xd->right_available);
|
||||
combine_interintra(xd->mode_info_context->mbmi.interintra_mode,
|
||||
ypred, ystride, intrapredictor, 32, 32);
|
||||
}
|
||||
@ -681,12 +605,12 @@ void vp9_build_interintra_32x32_predictors_sbuv(MACROBLOCKD *xd,
|
||||
xd->dst.u_buffer, xd->dst.uv_stride,
|
||||
uintrapredictor, 16,
|
||||
xd->mode_info_context->mbmi.interintra_uv_mode, 16,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available, xd->right_available);
|
||||
vp9_build_intra_predictors_internal(
|
||||
xd->dst.v_buffer, xd->dst.uv_stride,
|
||||
vintrapredictor, 16,
|
||||
xd->mode_info_context->mbmi.interintra_uv_mode, 16,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available, xd->right_available);
|
||||
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
|
||||
upred, uvstride, uintrapredictor, 16, 16);
|
||||
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
|
||||
@ -710,7 +634,8 @@ void vp9_build_interintra_64x64_predictors_sby(MACROBLOCKD *xd,
|
||||
const int mode = xd->mode_info_context->mbmi.interintra_mode;
|
||||
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
|
||||
intrapredictor, 64, mode, 64,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available,
|
||||
xd->right_available);
|
||||
combine_interintra(xd->mode_info_context->mbmi.interintra_mode,
|
||||
ypred, ystride, intrapredictor, 64, 64);
|
||||
}
|
||||
@ -724,10 +649,12 @@ void vp9_build_interintra_64x64_predictors_sbuv(MACROBLOCKD *xd,
|
||||
const int mode = xd->mode_info_context->mbmi.interintra_uv_mode;
|
||||
vp9_build_intra_predictors_internal(xd->dst.u_buffer, xd->dst.uv_stride,
|
||||
uintrapredictor, 32, mode, 32,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available,
|
||||
xd->right_available);
|
||||
vp9_build_intra_predictors_internal(xd->dst.v_buffer, xd->dst.uv_stride,
|
||||
vintrapredictor, 32, mode, 32,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available,
|
||||
xd->right_available);
|
||||
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
|
||||
upred, uvstride, uintrapredictor, 32, 32);
|
||||
combine_interintra(xd->mode_info_context->mbmi.interintra_uv_mode,
|
||||
@ -749,28 +676,32 @@ void vp9_build_intra_predictors_mby(MACROBLOCKD *xd) {
|
||||
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
|
||||
xd->predictor, 16,
|
||||
xd->mode_info_context->mbmi.mode, 16,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available,
|
||||
xd->right_available);
|
||||
}
|
||||
|
||||
void vp9_build_intra_predictors_mby_s(MACROBLOCKD *xd) {
|
||||
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
|
||||
xd->dst.y_buffer, xd->dst.y_stride,
|
||||
xd->mode_info_context->mbmi.mode, 16,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available,
|
||||
xd->right_available);
|
||||
}
|
||||
|
||||
void vp9_build_intra_predictors_sby_s(MACROBLOCKD *xd) {
|
||||
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
|
||||
xd->dst.y_buffer, xd->dst.y_stride,
|
||||
xd->mode_info_context->mbmi.mode, 32,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available,
|
||||
xd->right_available);
|
||||
}
|
||||
|
||||
void vp9_build_intra_predictors_sb64y_s(MACROBLOCKD *xd) {
|
||||
vp9_build_intra_predictors_internal(xd->dst.y_buffer, xd->dst.y_stride,
|
||||
xd->dst.y_buffer, xd->dst.y_stride,
|
||||
xd->mode_info_context->mbmi.mode, 64,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available,
|
||||
xd->right_available);
|
||||
}
|
||||
|
||||
void vp9_build_intra_predictors_mbuv_internal(MACROBLOCKD *xd,
|
||||
@ -780,10 +711,12 @@ void vp9_build_intra_predictors_mbuv_internal(MACROBLOCKD *xd,
|
||||
int mode, int bsize) {
|
||||
vp9_build_intra_predictors_internal(xd->dst.u_buffer, xd->dst.uv_stride,
|
||||
upred_ptr, uv_stride, mode, bsize,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available,
|
||||
xd->right_available);
|
||||
vp9_build_intra_predictors_internal(xd->dst.v_buffer, xd->dst.uv_stride,
|
||||
vpred_ptr, uv_stride, mode, bsize,
|
||||
xd->up_available, xd->left_available);
|
||||
xd->up_available, xd->left_available,
|
||||
xd->right_available);
|
||||
}
|
||||
|
||||
void vp9_build_intra_predictors_mbuv(MACROBLOCKD *xd) {
|
||||
@ -815,20 +748,35 @@ void vp9_build_intra_predictors_sb64uv_s(MACROBLOCKD *xd) {
|
||||
32);
|
||||
}
|
||||
|
||||
void vp9_intra8x8_predict(BLOCKD *xd,
|
||||
void vp9_intra8x8_predict(MACROBLOCKD *xd,
|
||||
BLOCKD *b,
|
||||
int mode,
|
||||
uint8_t *predictor) {
|
||||
vp9_build_intra_predictors_internal(*(xd->base_dst) + xd->dst,
|
||||
xd->dst_stride, predictor, 16,
|
||||
mode, 8, 1, 1);
|
||||
const int block4x4_idx = (b - xd->block);
|
||||
const int block_idx = (block4x4_idx >> 2) | !!(block4x4_idx & 2);
|
||||
const int have_top = (block_idx >> 1) || xd->up_available;
|
||||
const int have_left = (block_idx & 1) || xd->left_available;
|
||||
const int have_right = !(block_idx & 1) || xd->right_available;
|
||||
|
||||
vp9_build_intra_predictors_internal(*(b->base_dst) + b->dst,
|
||||
b->dst_stride, predictor, 16,
|
||||
mode, 8, have_top, have_left,
|
||||
have_right);
|
||||
}
|
||||
|
||||
void vp9_intra_uv4x4_predict(BLOCKD *xd,
|
||||
void vp9_intra_uv4x4_predict(MACROBLOCKD *xd,
|
||||
BLOCKD *b,
|
||||
int mode,
|
||||
uint8_t *predictor) {
|
||||
vp9_build_intra_predictors_internal(*(xd->base_dst) + xd->dst,
|
||||
xd->dst_stride, predictor, 8,
|
||||
mode, 4, 1, 1);
|
||||
const int block_idx = (b - xd->block) & 3;
|
||||
const int have_top = (block_idx >> 1) || xd->up_available;
|
||||
const int have_left = (block_idx & 1) || xd->left_available;
|
||||
const int have_right = !(block_idx & 1) || xd->right_available;
|
||||
|
||||
vp9_build_intra_predictors_internal(*(b->base_dst) + b->dst,
|
||||
b->dst_stride, predictor, 8,
|
||||
mode, 4, have_top, have_left,
|
||||
have_right);
|
||||
}
|
||||
|
||||
/* TODO: try different ways of use Y-UV mode correlation
|
||||
|
@ -14,37 +14,44 @@
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
|
||||
extern void vp9_recon_intra_mbuv(MACROBLOCKD *xd);
|
||||
extern B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
|
||||
int stride, int n);
|
||||
extern B_PREDICTION_MODE vp9_find_bpred_context(BLOCKD *x);
|
||||
void vp9_recon_intra_mbuv(MACROBLOCKD *xd);
|
||||
|
||||
B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
|
||||
int stride, int n,
|
||||
int tx, int ty);
|
||||
|
||||
B_PREDICTION_MODE vp9_find_bpred_context(MACROBLOCKD *xd, BLOCKD *x);
|
||||
|
||||
#if CONFIG_COMP_INTERINTRA_PRED
|
||||
extern void vp9_build_interintra_16x16_predictors_mb(MACROBLOCKD *xd,
|
||||
uint8_t *ypred,
|
||||
uint8_t *upred,
|
||||
uint8_t *vpred,
|
||||
int ystride,
|
||||
int uvstride);
|
||||
extern void vp9_build_interintra_16x16_predictors_mby(MACROBLOCKD *xd,
|
||||
uint8_t *ypred,
|
||||
int ystride);
|
||||
extern void vp9_build_interintra_16x16_predictors_mbuv(MACROBLOCKD *xd,
|
||||
uint8_t *upred,
|
||||
uint8_t *vpred,
|
||||
int uvstride);
|
||||
void vp9_build_interintra_16x16_predictors_mb(MACROBLOCKD *xd,
|
||||
uint8_t *ypred,
|
||||
uint8_t *upred,
|
||||
uint8_t *vpred,
|
||||
int ystride,
|
||||
int uvstride);
|
||||
|
||||
void vp9_build_interintra_16x16_predictors_mby(MACROBLOCKD *xd,
|
||||
uint8_t *ypred,
|
||||
int ystride);
|
||||
|
||||
void vp9_build_interintra_16x16_predictors_mbuv(MACROBLOCKD *xd,
|
||||
uint8_t *upred,
|
||||
uint8_t *vpred,
|
||||
int uvstride);
|
||||
#endif // CONFIG_COMP_INTERINTRA_PRED
|
||||
|
||||
extern void vp9_build_interintra_32x32_predictors_sb(MACROBLOCKD *xd,
|
||||
uint8_t *ypred,
|
||||
uint8_t *upred,
|
||||
uint8_t *vpred,
|
||||
int ystride,
|
||||
int uvstride);
|
||||
extern void vp9_build_interintra_64x64_predictors_sb(MACROBLOCKD *xd,
|
||||
uint8_t *ypred,
|
||||
uint8_t *upred,
|
||||
uint8_t *vpred,
|
||||
int ystride,
|
||||
int uvstride);
|
||||
void vp9_build_interintra_32x32_predictors_sb(MACROBLOCKD *xd,
|
||||
uint8_t *ypred,
|
||||
uint8_t *upred,
|
||||
uint8_t *vpred,
|
||||
int ystride,
|
||||
int uvstride);
|
||||
|
||||
void vp9_build_interintra_64x64_predictors_sb(MACROBLOCKD *xd,
|
||||
uint8_t *ypred,
|
||||
uint8_t *upred,
|
||||
uint8_t *vpred,
|
||||
int ystride,
|
||||
int uvstride);
|
||||
|
||||
#endif // VP9_COMMON_VP9_RECONINTRA_H_
|
||||
|
@ -15,17 +15,17 @@
|
||||
#include "vp9_rtcd.h"
|
||||
|
||||
#if CONFIG_NEWBINTRAMODES
|
||||
static int find_grad_measure(uint8_t *x, int stride, int n, int t,
|
||||
static int find_grad_measure(uint8_t *x, int stride, int n, int tx, int ty,
|
||||
int dx, int dy) {
|
||||
int i, j;
|
||||
int count = 0, gsum = 0, gdiv;
|
||||
/* TODO: Make this code more efficient by breaking up into two loops */
|
||||
for (i = -t; i < n; ++i)
|
||||
for (j = -t; j < n; ++j) {
|
||||
for (i = -ty; i < n; ++i)
|
||||
for (j = -tx; j < n; ++j) {
|
||||
int g;
|
||||
if (i >= 0 && j >= 0) continue;
|
||||
if (i + dy >= 0 && j + dx >= 0) continue;
|
||||
if (i + dy < -t || i + dy >= n || j + dx < -t || j + dx >= n) continue;
|
||||
if (i + dy < -ty || i + dy >= n || j + dx < -tx || j + dx >= n) continue;
|
||||
g = abs(x[(i + dy) * stride + j + dx] - x[i * stride + j]);
|
||||
gsum += g * g;
|
||||
count++;
|
||||
@ -36,14 +36,15 @@ static int find_grad_measure(uint8_t *x, int stride, int n, int t,
|
||||
|
||||
#if CONTEXT_PRED_REPLACEMENTS == 6
|
||||
B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
|
||||
int stride, int n) {
|
||||
int stride, int n,
|
||||
int tx, int ty) {
|
||||
int g[8], i, imin, imax;
|
||||
g[1] = find_grad_measure(ptr, stride, n, 4, 2, 1);
|
||||
g[2] = find_grad_measure(ptr, stride, n, 4, 1, 1);
|
||||
g[3] = find_grad_measure(ptr, stride, n, 4, 1, 2);
|
||||
g[5] = find_grad_measure(ptr, stride, n, 4, -1, 2);
|
||||
g[6] = find_grad_measure(ptr, stride, n, 4, -1, 1);
|
||||
g[7] = find_grad_measure(ptr, stride, n, 4, -2, 1);
|
||||
g[1] = find_grad_measure(ptr, stride, n, tx, ty, 2, 1);
|
||||
g[2] = find_grad_measure(ptr, stride, n, tx, ty, 1, 1);
|
||||
g[3] = find_grad_measure(ptr, stride, n, tx, ty, 1, 2);
|
||||
g[5] = find_grad_measure(ptr, stride, n, tx, ty, -1, 2);
|
||||
g[6] = find_grad_measure(ptr, stride, n, tx, ty, -1, 1);
|
||||
g[7] = find_grad_measure(ptr, stride, n, tx, ty, -2, 1);
|
||||
imin = 1;
|
||||
for (i = 2; i < 8; i += 1 + (i == 3))
|
||||
imin = (g[i] < g[imin] ? i : imin);
|
||||
@ -73,12 +74,13 @@ B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
|
||||
}
|
||||
#elif CONTEXT_PRED_REPLACEMENTS == 4
|
||||
B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
|
||||
int stride, int n) {
|
||||
int stride, int n,
|
||||
int tx, int ty) {
|
||||
int g[8], i, imin, imax;
|
||||
g[1] = find_grad_measure(ptr, stride, n, 4, 2, 1);
|
||||
g[3] = find_grad_measure(ptr, stride, n, 4, 1, 2);
|
||||
g[5] = find_grad_measure(ptr, stride, n, 4, -1, 2);
|
||||
g[7] = find_grad_measure(ptr, stride, n, 4, -2, 1);
|
||||
g[1] = find_grad_measure(ptr, stride, n, tx, ty, 2, 1);
|
||||
g[3] = find_grad_measure(ptr, stride, n, tx, ty, 1, 2);
|
||||
g[5] = find_grad_measure(ptr, stride, n, tx, ty, -1, 2);
|
||||
g[7] = find_grad_measure(ptr, stride, n, tx, ty, -2, 1);
|
||||
imin = 1;
|
||||
for (i = 3; i < 8; i+=2)
|
||||
imin = (g[i] < g[imin] ? i : imin);
|
||||
@ -104,16 +106,17 @@ B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
|
||||
}
|
||||
#elif CONTEXT_PRED_REPLACEMENTS == 0
|
||||
B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
|
||||
int stride, int n) {
|
||||
int stride, int n,
|
||||
int tx, int ty) {
|
||||
int g[8], i, imin, imax;
|
||||
g[0] = find_grad_measure(ptr, stride, n, 4, 1, 0);
|
||||
g[1] = find_grad_measure(ptr, stride, n, 4, 2, 1);
|
||||
g[2] = find_grad_measure(ptr, stride, n, 4, 1, 1);
|
||||
g[3] = find_grad_measure(ptr, stride, n, 4, 1, 2);
|
||||
g[4] = find_grad_measure(ptr, stride, n, 4, 0, 1);
|
||||
g[5] = find_grad_measure(ptr, stride, n, 4, -1, 2);
|
||||
g[6] = find_grad_measure(ptr, stride, n, 4, -1, 1);
|
||||
g[7] = find_grad_measure(ptr, stride, n, 4, -2, 1);
|
||||
g[0] = find_grad_measure(ptr, stride, n, tx, ty, 1, 0);
|
||||
g[1] = find_grad_measure(ptr, stride, n, tx, ty, 2, 1);
|
||||
g[2] = find_grad_measure(ptr, stride, n, tx, ty, 1, 1);
|
||||
g[3] = find_grad_measure(ptr, stride, n, tx, ty, 1, 2);
|
||||
g[4] = find_grad_measure(ptr, stride, n, tx, ty, 0, 1);
|
||||
g[5] = find_grad_measure(ptr, stride, n, tx, ty, -1, 2);
|
||||
g[6] = find_grad_measure(ptr, stride, n, tx, ty, -1, 1);
|
||||
g[7] = find_grad_measure(ptr, stride, n, tx, ty, -2, 1);
|
||||
imax = 0;
|
||||
for (i = 1; i < 8; i++)
|
||||
imax = (g[i] > g[imax] ? i : imax);
|
||||
@ -144,26 +147,113 @@ B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr,
|
||||
}
|
||||
#endif
|
||||
|
||||
B_PREDICTION_MODE vp9_find_bpred_context(BLOCKD *x) {
|
||||
B_PREDICTION_MODE vp9_find_bpred_context(MACROBLOCKD *xd, BLOCKD *x) {
|
||||
const int block_idx = x - xd->block;
|
||||
const int have_top = (block_idx >> 2) || xd->up_available;
|
||||
const int have_left = (block_idx & 3) || xd->left_available;
|
||||
uint8_t *ptr = *(x->base_dst) + x->dst;
|
||||
int stride = x->dst_stride;
|
||||
return vp9_find_dominant_direction(ptr, stride, 4);
|
||||
int tx = have_left ? 4 : 0;
|
||||
int ty = have_top ? 4 : 0;
|
||||
if (!have_left && !have_top)
|
||||
return B_DC_PRED;
|
||||
return vp9_find_dominant_direction(ptr, stride, 4, tx, ty);
|
||||
}
|
||||
#endif
|
||||
|
||||
void vp9_intra4x4_predict(BLOCKD *x,
|
||||
void vp9_intra4x4_predict(MACROBLOCKD *xd,
|
||||
BLOCKD *x,
|
||||
int b_mode,
|
||||
uint8_t *predictor) {
|
||||
int i, r, c;
|
||||
const int block_idx = x - xd->block;
|
||||
const int have_top = (block_idx >> 2) || xd->up_available;
|
||||
const int have_left = (block_idx & 3) || xd->left_available;
|
||||
const int have_right = (block_idx & 3) != 3 || xd->right_available;
|
||||
uint8_t left[4], above[8], top_left;
|
||||
/*
|
||||
* 127 127 127 .. 127 127 127 127 127 127
|
||||
* 129 A B .. Y Z
|
||||
* 129 C D .. W X
|
||||
* 129 E F .. U V
|
||||
* 129 G H .. S T T T T T
|
||||
* ..
|
||||
*/
|
||||
|
||||
uint8_t *above = *(x->base_dst) + x->dst - x->dst_stride;
|
||||
uint8_t left[4];
|
||||
uint8_t top_left = above[-1];
|
||||
if (have_left) {
|
||||
uint8_t *left_ptr = *(x->base_dst) + x->dst - 1;
|
||||
const int stride = x->dst_stride;
|
||||
|
||||
left[0] = (*(x->base_dst))[x->dst - 1];
|
||||
left[1] = (*(x->base_dst))[x->dst - 1 + x->dst_stride];
|
||||
left[2] = (*(x->base_dst))[x->dst - 1 + 2 * x->dst_stride];
|
||||
left[3] = (*(x->base_dst))[x->dst - 1 + 3 * x->dst_stride];
|
||||
left[0] = left_ptr[0 * stride];
|
||||
left[1] = left_ptr[1 * stride];
|
||||
left[2] = left_ptr[2 * stride];
|
||||
left[3] = left_ptr[3 * stride];
|
||||
} else {
|
||||
left[0] = left[1] = left[2] = left[3] = 129;
|
||||
}
|
||||
|
||||
if (have_top) {
|
||||
uint8_t *above_ptr = *(x->base_dst) + x->dst - x->dst_stride;
|
||||
|
||||
if (have_left) {
|
||||
top_left = above_ptr[-1];
|
||||
} else {
|
||||
top_left = 127;
|
||||
}
|
||||
|
||||
above[0] = above_ptr[0];
|
||||
above[1] = above_ptr[1];
|
||||
above[2] = above_ptr[2];
|
||||
above[3] = above_ptr[3];
|
||||
if (((block_idx & 3) != 3) ||
|
||||
(have_right && block_idx == 3 &&
|
||||
((xd->mb_index != 3 && xd->sb_index != 3) ||
|
||||
((xd->mb_index & 1) == 0 && xd->sb_index == 3)))) {
|
||||
above[4] = above_ptr[4];
|
||||
above[5] = above_ptr[5];
|
||||
above[6] = above_ptr[6];
|
||||
above[7] = above_ptr[7];
|
||||
} else if (have_right) {
|
||||
uint8_t *above_right = above_ptr + 4;
|
||||
|
||||
if (xd->sb_index == 3 && (xd->mb_index & 1))
|
||||
above_right -= 32 * x->dst_stride;
|
||||
if (xd->mb_index == 3)
|
||||
above_right -= 16 * x->dst_stride;
|
||||
above_right -= (block_idx & ~3) * x->dst_stride;
|
||||
|
||||
/* use a more distant above-right (from closest available top-right
|
||||
* corner), but with a "localized DC" (similar'ish to TM-pred):
|
||||
*
|
||||
* A B C D E F G H
|
||||
* I J K L
|
||||
* M N O P
|
||||
* Q R S T
|
||||
* U V W X x1 x2 x3 x4
|
||||
*
|
||||
* Where:
|
||||
* x1 = clip_pixel(E + X - D)
|
||||
* x2 = clip_pixel(F + X - D)
|
||||
* x3 = clip_pixel(G + X - D)
|
||||
* x4 = clip_pixel(H + X - D)
|
||||
*
|
||||
* This is applied anytime when we use a "distant" above-right edge
|
||||
* that is not immediately top-right to the block that we're going
|
||||
* to do intra prediction for.
|
||||
*/
|
||||
above[4] = clip_pixel(above_right[0] + above_ptr[3] - above_right[-1]);
|
||||
above[5] = clip_pixel(above_right[1] + above_ptr[3] - above_right[-1]);
|
||||
above[6] = clip_pixel(above_right[2] + above_ptr[3] - above_right[-1]);
|
||||
above[7] = clip_pixel(above_right[3] + above_ptr[3] - above_right[-1]);
|
||||
} else {
|
||||
// extend edge
|
||||
above[4] = above[5] = above[6] = above[7] = above[3];
|
||||
}
|
||||
} else {
|
||||
above[0] = above[1] = above[2] = above[3] = 127;
|
||||
above[4] = above[5] = above[6] = above[7] = 127;
|
||||
top_left = 127;
|
||||
}
|
||||
|
||||
#if CONFIG_NEWBINTRAMODES
|
||||
if (b_mode == B_CONTEXT_PRED)
|
||||
@ -411,39 +501,3 @@ void vp9_intra4x4_predict(BLOCKD *x,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* copy 4 bytes from the above right down so that the 4x4 prediction modes using pixels above and
|
||||
* to the right prediction have filled in pixels to use.
|
||||
*/
|
||||
void vp9_intra_prediction_down_copy(MACROBLOCKD *xd) {
|
||||
int extend_edge = xd->mb_to_right_edge == 0 && xd->mb_index < 2;
|
||||
uint8_t *above_right = *(xd->block[0].base_dst) + xd->block[0].dst -
|
||||
xd->block[0].dst_stride + 16;
|
||||
uint32_t *dst_ptr0 = (uint32_t *)above_right;
|
||||
uint32_t *dst_ptr1 =
|
||||
(uint32_t *)(above_right + 4 * xd->block[0].dst_stride);
|
||||
uint32_t *dst_ptr2 =
|
||||
(uint32_t *)(above_right + 8 * xd->block[0].dst_stride);
|
||||
uint32_t *dst_ptr3 =
|
||||
(uint32_t *)(above_right + 12 * xd->block[0].dst_stride);
|
||||
|
||||
uint32_t *src_ptr = (uint32_t *) above_right;
|
||||
|
||||
if ((xd->sb_index >= 2 && xd->mb_to_right_edge == 0) ||
|
||||
(xd->sb_index == 3 && xd->mb_index & 1))
|
||||
src_ptr = (uint32_t *) (((uint8_t *) src_ptr) - 32 *
|
||||
xd->block[0].dst_stride);
|
||||
if (xd->mb_index == 3 ||
|
||||
(xd->mb_to_right_edge == 0 && xd->mb_index == 2))
|
||||
src_ptr = (uint32_t *) (((uint8_t *) src_ptr) - 16 *
|
||||
xd->block[0].dst_stride);
|
||||
|
||||
if (extend_edge) {
|
||||
*src_ptr = ((uint8_t *) src_ptr)[-1] * 0x01010101U;
|
||||
}
|
||||
|
||||
*dst_ptr0 = *src_ptr;
|
||||
*dst_ptr1 = *src_ptr;
|
||||
*dst_ptr2 = *src_ptr;
|
||||
*dst_ptr3 = *src_ptr;
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef VP9_COMMON_VP9_RECONINTRA4X4_H_
|
||||
#define VP9_COMMON_VP9_RECONINTRA4X4_H_
|
||||
|
||||
extern void vp9_intra_prediction_down_copy(MACROBLOCKD *xd);
|
||||
|
||||
#endif // VP9_COMMON_VP9_RECONINTRA4X4_H_
|
@ -12,10 +12,9 @@
|
||||
#include "vp9_rtcd.h"
|
||||
#include "vpx_ports/vpx_once.h"
|
||||
|
||||
extern void vpx_scale_rtcd(void);
|
||||
void vpx_scale_rtcd(void);
|
||||
|
||||
void vp9_rtcd()
|
||||
{
|
||||
void vp9_rtcd() {
|
||||
vpx_scale_rtcd();
|
||||
once(setup_rtcd_internal);
|
||||
}
|
||||
|
@ -23,90 +23,50 @@ EOF
|
||||
}
|
||||
forward_decls vp9_common_forward_decls
|
||||
|
||||
prototype void vp9_filter_block2d_4x4_8 "const uint8_t *src_ptr, const unsigned int src_stride, const int16_t *HFilter_aligned16, const int16_t *VFilter_aligned16, uint8_t *dst_ptr, unsigned int dst_stride"
|
||||
prototype void vp9_filter_block2d_8x4_8 "const uint8_t *src_ptr, const unsigned int src_stride, const int16_t *HFilter_aligned16, const int16_t *VFilter_aligned16, uint8_t *dst_ptr, unsigned int dst_stride"
|
||||
prototype void vp9_filter_block2d_8x8_8 "const uint8_t *src_ptr, const unsigned int src_stride, const int16_t *HFilter_aligned16, const int16_t *VFilter_aligned16, uint8_t *dst_ptr, unsigned int dst_stride"
|
||||
prototype void vp9_filter_block2d_16x16_8 "const uint8_t *src_ptr, const unsigned int src_stride, const int16_t *HFilter_aligned16, const int16_t *VFilter_aligned16, uint8_t *dst_ptr, unsigned int dst_stride"
|
||||
|
||||
# At the very least, MSVC 2008 has compiler bug exhibited by this code; code
|
||||
# compiles warning free but a dissassembly of generated code show bugs. To be
|
||||
# on the safe side, only enabled when compiled with 'gcc'.
|
||||
if [ "$CONFIG_GCC" = "yes" ]; then
|
||||
specialize vp9_filter_block2d_4x4_8 sse4_1 sse2
|
||||
fi
|
||||
specialize vp9_filter_block2d_8x4_8 ssse3 #sse4_1 sse2
|
||||
specialize vp9_filter_block2d_8x8_8 ssse3 #sse4_1 sse2
|
||||
specialize vp9_filter_block2d_16x16_8 ssse3 #sse4_1 sse2
|
||||
|
||||
#
|
||||
# Dequant
|
||||
#
|
||||
prototype void vp9_dequantize_b "struct blockd *x"
|
||||
specialize vp9_dequantize_b
|
||||
|
||||
prototype void vp9_dequantize_b_2x2 "struct blockd *x"
|
||||
specialize vp9_dequantize_b_2x2
|
||||
|
||||
prototype void vp9_dequant_dc_idct_add_y_block_8x8 "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs, const int16_t *dc, struct macroblockd *xd"
|
||||
specialize vp9_dequant_dc_idct_add_y_block_8x8
|
||||
|
||||
prototype void vp9_dequant_idct_add_y_block_8x8 "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs, struct macroblockd *xd"
|
||||
prototype void vp9_dequant_idct_add_y_block_8x8 "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, struct macroblockd *xd"
|
||||
specialize vp9_dequant_idct_add_y_block_8x8
|
||||
|
||||
prototype void vp9_dequant_idct_add_uv_block_8x8 "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dstu, uint8_t *dstv, int stride, uint16_t *eobs, struct macroblockd *xd"
|
||||
prototype void vp9_dequant_idct_add_uv_block_8x8 "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dstu, uint8_t *dstv, int stride, struct macroblockd *xd"
|
||||
specialize vp9_dequant_idct_add_uv_block_8x8
|
||||
|
||||
prototype void vp9_dequant_idct_add_16x16 "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride, int eob"
|
||||
specialize vp9_dequant_idct_add_16x16
|
||||
|
||||
prototype void vp9_dequant_idct_add_8x8 "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride, int dc, int eob"
|
||||
prototype void vp9_dequant_idct_add_8x8 "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride, int eob"
|
||||
specialize vp9_dequant_idct_add_8x8
|
||||
|
||||
prototype void vp9_dequant_idct_add "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride"
|
||||
prototype void vp9_dequant_idct_add "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride, int eob"
|
||||
specialize vp9_dequant_idct_add
|
||||
|
||||
prototype void vp9_dequant_dc_idct_add "int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *dest, int pitch, int stride, int dc"
|
||||
specialize vp9_dequant_dc_idct_add
|
||||
|
||||
prototype void vp9_dequant_dc_idct_add_y_block "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs, const int16_t *dcs"
|
||||
specialize vp9_dequant_dc_idct_add_y_block
|
||||
|
||||
prototype void vp9_dequant_idct_add_y_block "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs"
|
||||
prototype void vp9_dequant_idct_add_y_block "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, struct macroblockd *xd"
|
||||
specialize vp9_dequant_idct_add_y_block
|
||||
|
||||
prototype void vp9_dequant_idct_add_uv_block "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dstu, uint8_t *dstv, int stride, uint16_t *eobs"
|
||||
prototype void vp9_dequant_idct_add_uv_block "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dstu, uint8_t *dstv, int stride, struct macroblockd *xd"
|
||||
specialize vp9_dequant_idct_add_uv_block
|
||||
|
||||
prototype void vp9_dequant_idct_add_32x32 "int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int pitch, int stride, int eob"
|
||||
specialize vp9_dequant_idct_add_32x32
|
||||
|
||||
prototype void vp9_dequant_idct_add_uv_block_16x16 "int16_t *q, const int16_t *dq, uint8_t *dstu, uint8_t *dstv, int stride, uint16_t *eobs"
|
||||
prototype void vp9_dequant_idct_add_uv_block_16x16 "int16_t *q, const int16_t *dq, uint8_t *dstu, uint8_t *dstv, int stride, struct macroblockd *xd"
|
||||
specialize vp9_dequant_idct_add_uv_block_16x16
|
||||
|
||||
#
|
||||
# RECON
|
||||
#
|
||||
prototype void vp9_copy_mem16x16 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
|
||||
prototype void vp9_copy_mem16x16 "const uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
|
||||
specialize vp9_copy_mem16x16 mmx sse2 dspr2
|
||||
vp9_copy_mem16x16_dspr2=vp9_copy_mem16x16_dspr2
|
||||
|
||||
prototype void vp9_copy_mem8x8 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
|
||||
prototype void vp9_copy_mem8x8 "const uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
|
||||
specialize vp9_copy_mem8x8 mmx dspr2
|
||||
vp9_copy_mem8x8_dspr2=vp9_copy_mem8x8_dspr2
|
||||
|
||||
prototype void vp9_copy_mem8x4 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
|
||||
prototype void vp9_copy_mem8x4 "const uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
|
||||
specialize vp9_copy_mem8x4 mmx
|
||||
|
||||
prototype void vp9_avg_mem16x16 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
|
||||
specialize vp9_avg_mem16x16
|
||||
|
||||
prototype void vp9_avg_mem8x8 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
|
||||
specialize vp9_avg_mem8x8
|
||||
|
||||
prototype void vp9_copy_mem8x4 "uint8_t *src, int src_pitch, uint8_t *dst, int dst_pitch"
|
||||
specialize vp9_copy_mem8x4 mmx dspr2
|
||||
vp9_copy_mem8x4_dspr2=vp9_copy_mem8x4_dspr2
|
||||
|
||||
prototype void vp9_recon_b "uint8_t *pred_ptr, int16_t *diff_ptr, uint8_t *dst_ptr, int stride"
|
||||
specialize vp9_recon_b
|
||||
|
||||
@ -137,6 +97,12 @@ specialize vp9_recon_sby_s
|
||||
prototype void vp9_recon_sbuv_s "struct macroblockd *x, uint8_t *udst, uint8_t *vdst"
|
||||
specialize void vp9_recon_sbuv_s
|
||||
|
||||
prototype void vp9_recon_sb64y_s "struct macroblockd *x, uint8_t *dst"
|
||||
specialize vp9_recon_sb64y_s
|
||||
|
||||
prototype void vp9_recon_sb64uv_s "struct macroblockd *x, uint8_t *udst, uint8_t *vdst"
|
||||
specialize void vp9_recon_sb64uv_s
|
||||
|
||||
prototype void vp9_build_intra_predictors_mby_s "struct macroblockd *x"
|
||||
specialize vp9_build_intra_predictors_mby_s
|
||||
|
||||
@ -164,15 +130,38 @@ specialize vp9_build_intra_predictors_sb64y_s;
|
||||
prototype void vp9_build_intra_predictors_sb64uv_s "struct macroblockd *x"
|
||||
specialize vp9_build_intra_predictors_sb64uv_s;
|
||||
|
||||
prototype void vp9_intra4x4_predict "struct blockd *x, int b_mode, uint8_t *predictor"
|
||||
prototype void vp9_intra4x4_predict "struct macroblockd *xd, struct blockd *x, int b_mode, uint8_t *predictor"
|
||||
specialize vp9_intra4x4_predict;
|
||||
|
||||
prototype void vp9_intra8x8_predict "struct blockd *x, int b_mode, uint8_t *predictor"
|
||||
prototype void vp9_intra8x8_predict "struct macroblockd *xd, struct blockd *x, int b_mode, uint8_t *predictor"
|
||||
specialize vp9_intra8x8_predict;
|
||||
|
||||
prototype void vp9_intra_uv4x4_predict "struct blockd *x, int b_mode, uint8_t *predictor"
|
||||
prototype void vp9_intra_uv4x4_predict "struct macroblockd *xd, struct blockd *x, int b_mode, uint8_t *predictor"
|
||||
specialize vp9_intra_uv4x4_predict;
|
||||
|
||||
if [ "$CONFIG_VP9_DECODER" = "yes" ]; then
|
||||
prototype void vp9_add_residual_4x4 "const int16_t *diff, const uint8_t *pred, int pitch, uint8_t *dest, int stride"
|
||||
specialize vp9_add_residual_4x4 sse2
|
||||
|
||||
prototype void vp9_add_residual_8x8 "const int16_t *diff, const uint8_t *pred, int pitch, uint8_t *dest, int stride"
|
||||
specialize vp9_add_residual_8x8 sse2
|
||||
|
||||
prototype void vp9_add_residual_16x16 "const int16_t *diff, const uint8_t *pred, int pitch, uint8_t *dest, int stride"
|
||||
specialize vp9_add_residual_16x16 sse2
|
||||
|
||||
prototype void vp9_add_residual_32x32 "const int16_t *diff, const uint8_t *pred, int pitch, uint8_t *dest, int stride"
|
||||
specialize vp9_add_residual_32x32 sse2
|
||||
|
||||
prototype void vp9_add_constant_residual_8x8 "const int16_t diff, const uint8_t *pred, int pitch, uint8_t *dest, int stride"
|
||||
specialize vp9_add_constant_residual_8x8 sse2
|
||||
|
||||
prototype void vp9_add_constant_residual_16x16 "const int16_t diff, const uint8_t *pred, int pitch, uint8_t *dest, int stride"
|
||||
specialize vp9_add_constant_residual_16x16 sse2
|
||||
|
||||
prototype void vp9_add_constant_residual_32x32 "const int16_t diff, const uint8_t *pred, int pitch, uint8_t *dest, int stride"
|
||||
specialize vp9_add_constant_residual_32x32 sse2
|
||||
fi
|
||||
|
||||
#
|
||||
# Loopfilter
|
||||
#
|
||||
@ -263,171 +252,146 @@ specialize vp9_sad16x3 sse2
|
||||
prototype unsigned int vp9_sad3x16 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride"
|
||||
specialize vp9_sad3x16 sse2
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_variance16x2 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
prototype unsigned int vp9_sub_pixel_variance16x2 "const uint8_t *src_ptr, const int source_stride, const int xoffset, const int yoffset, const uint8_t *ref_ptr, const int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance16x2 sse2
|
||||
|
||||
#
|
||||
# Sub Pixel Filters
|
||||
#
|
||||
prototype void vp9_eighttap_predict16x16 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict16x16
|
||||
prototype void vp9_convolve8 "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"
|
||||
specialize vp9_convolve8 ssse3
|
||||
|
||||
prototype void vp9_eighttap_predict8x8 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict8x8
|
||||
prototype void vp9_convolve8_horiz "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"
|
||||
specialize vp9_convolve8_horiz ssse3
|
||||
|
||||
prototype void vp9_eighttap_predict_avg16x16 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict_avg16x16
|
||||
prototype void vp9_convolve8_vert "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"
|
||||
specialize vp9_convolve8_vert ssse3
|
||||
|
||||
prototype void vp9_eighttap_predict_avg8x8 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict_avg8x8
|
||||
prototype void vp9_convolve8_avg "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"
|
||||
specialize vp9_convolve8_avg ssse3
|
||||
|
||||
prototype void vp9_eighttap_predict_avg4x4 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict_avg4x4
|
||||
prototype void vp9_convolve8_avg_horiz "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"
|
||||
specialize vp9_convolve8_avg_horiz ssse3
|
||||
|
||||
prototype void vp9_eighttap_predict8x4 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict8x4
|
||||
prototype void vp9_convolve8_avg_vert "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"
|
||||
specialize vp9_convolve8_avg_vert ssse3
|
||||
|
||||
prototype void vp9_eighttap_predict4x4 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict4x4
|
||||
#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT
|
||||
prototype void vp9_convolve8_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"
|
||||
specialize vp9_convolve8_1by8
|
||||
|
||||
prototype void vp9_eighttap_predict16x16_sharp "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict16x16_sharp
|
||||
prototype void vp9_convolve8_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"
|
||||
specialize vp9_convolve8_qtr
|
||||
|
||||
prototype void vp9_eighttap_predict8x8_sharp "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict8x8_sharp
|
||||
prototype void vp9_convolve8_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"
|
||||
specialize vp9_convolve8_3by8
|
||||
|
||||
prototype void vp9_eighttap_predict_avg16x16_sharp "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict_avg16x16_sharp
|
||||
prototype void vp9_convolve8_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"
|
||||
specialize vp9_convolve8_5by8
|
||||
|
||||
prototype void vp9_eighttap_predict_avg8x8_sharp "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict_avg8x8_sharp
|
||||
prototype void vp9_convolve8_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"
|
||||
specialize vp9_convolve8_3qtr
|
||||
|
||||
prototype void vp9_eighttap_predict_avg4x4_sharp "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict_avg4x4_sharp
|
||||
prototype void vp9_convolve8_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"
|
||||
specialize vp9_convolve8_7by8
|
||||
|
||||
prototype void vp9_eighttap_predict8x4_sharp "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict8x4_sharp
|
||||
prototype void vp9_convolve8_1by8_horiz "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"
|
||||
specialize vp9_convolve8_1by8_horiz
|
||||
|
||||
prototype void vp9_eighttap_predict4x4_sharp "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict4x4_sharp
|
||||
prototype void vp9_convolve8_qtr_horiz "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"
|
||||
specialize vp9_convolve8_qtr_horiz
|
||||
|
||||
prototype void vp9_eighttap_predict16x16_smooth "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict16x16_smooth
|
||||
prototype void vp9_convolve8_3by8_horiz "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"
|
||||
specialize vp9_convolve8_3by8_horiz
|
||||
|
||||
prototype void vp9_eighttap_predict8x8_smooth "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict8x8_smooth
|
||||
prototype void vp9_convolve8_5by8_horiz "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"
|
||||
specialize vp9_convolve8_5by8_horiz
|
||||
|
||||
prototype void vp9_eighttap_predict_avg16x16_smooth "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict_avg16x16_smooth
|
||||
prototype void vp9_convolve8_3qtr_horiz "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"
|
||||
specialize vp9_convolve8_3qtr_horiz
|
||||
|
||||
prototype void vp9_eighttap_predict_avg8x8_smooth "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict_avg8x8_smooth
|
||||
prototype void vp9_convolve8_7by8_horiz "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"
|
||||
specialize vp9_convolve8_7by8_horiz
|
||||
|
||||
prototype void vp9_eighttap_predict_avg4x4_smooth "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict_avg4x4_smooth
|
||||
prototype void vp9_convolve8_1by8_vert "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"
|
||||
specialize vp9_convolve8_1by8_vert
|
||||
|
||||
prototype void vp9_eighttap_predict8x4_smooth "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict8x4_smooth
|
||||
prototype void vp9_convolve8_qtr_vert "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"
|
||||
specialize vp9_convolve8_qtr_vert
|
||||
|
||||
prototype void vp9_eighttap_predict4x4_smooth "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_eighttap_predict4x4_smooth
|
||||
prototype void vp9_convolve8_3by8_vert "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"
|
||||
specialize vp9_convolve8_3by8_vert
|
||||
|
||||
prototype void vp9_sixtap_predict16x16 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_sixtap_predict16x16
|
||||
prototype void vp9_convolve8_5by8_vert "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"
|
||||
specialize vp9_convolve8_5by8_vert
|
||||
|
||||
prototype void vp9_sixtap_predict8x8 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_sixtap_predict8x8
|
||||
prototype void vp9_convolve8_3qtr_vert "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"
|
||||
specialize vp9_convolve8_3qtr_vert
|
||||
|
||||
prototype void vp9_sixtap_predict_avg16x16 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_sixtap_predict_avg16x16
|
||||
|
||||
prototype void vp9_sixtap_predict_avg8x8 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_sixtap_predict_avg8x8
|
||||
|
||||
prototype void vp9_sixtap_predict8x4 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_sixtap_predict8x4
|
||||
|
||||
prototype void vp9_sixtap_predict4x4 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_sixtap_predict4x4
|
||||
|
||||
prototype void vp9_sixtap_predict_avg4x4 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_sixtap_predict_avg4x4
|
||||
|
||||
prototype void vp9_bilinear_predict16x16 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_bilinear_predict16x16 sse2
|
||||
|
||||
prototype void vp9_bilinear_predict8x8 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_bilinear_predict8x8 sse2
|
||||
|
||||
prototype void vp9_bilinear_predict_avg16x16 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_bilinear_predict_avg16x16
|
||||
|
||||
prototype void vp9_bilinear_predict_avg8x8 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_bilinear_predict_avg8x8
|
||||
|
||||
prototype void vp9_bilinear_predict8x4 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_bilinear_predict8x4
|
||||
|
||||
prototype void vp9_bilinear_predict4x4 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_bilinear_predict4x4
|
||||
|
||||
prototype void vp9_bilinear_predict_avg4x4 "uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr, int dst_pitch"
|
||||
specialize vp9_bilinear_predict_avg4x4
|
||||
prototype void vp9_convolve8_7by8_vert "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"
|
||||
specialize vp9_convolve8_7by8_vert
|
||||
#endif
|
||||
|
||||
#
|
||||
# dct
|
||||
#
|
||||
prototype void vp9_short_idct4x4llm_1 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct4x4llm_1
|
||||
prototype void vp9_short_idct4x4_1 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct4x4_1
|
||||
|
||||
prototype void vp9_short_idct4x4llm "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct4x4llm
|
||||
prototype void vp9_short_idct4x4 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct4x4 sse2
|
||||
|
||||
prototype void vp9_short_idct8x8 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct8x8
|
||||
specialize vp9_short_idct8x8 sse2
|
||||
|
||||
prototype void vp9_short_idct10_8x8 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct10_8x8
|
||||
specialize vp9_short_idct10_8x8 sse2
|
||||
|
||||
prototype void vp9_short_ihaar2x2 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_ihaar2x2
|
||||
prototype void vp9_short_idct1_8x8 "int16_t *input, int16_t *output"
|
||||
specialize vp9_short_idct1_8x8
|
||||
|
||||
prototype void vp9_short_idct16x16 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct16x16
|
||||
specialize vp9_short_idct16x16 sse2
|
||||
|
||||
prototype void vp9_short_idct10_16x16 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct10_16x16
|
||||
specialize vp9_short_idct10_16x16 sse2
|
||||
|
||||
prototype void vp9_short_idct1_16x16 "int16_t *input, int16_t *output"
|
||||
specialize vp9_short_idct1_16x16
|
||||
|
||||
|
||||
prototype void vp9_short_idct32x32 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct32x32
|
||||
specialize vp9_short_idct32x32 sse2
|
||||
|
||||
prototype void vp9_ihtllm "const int16_t *input, int16_t *output, int pitch, int tx_type, int tx_dim, int16_t eobs"
|
||||
specialize vp9_ihtllm
|
||||
prototype void vp9_short_idct1_32x32 "int16_t *input, int16_t *output"
|
||||
specialize vp9_short_idct1_32x32
|
||||
|
||||
#
|
||||
# 2nd order
|
||||
#
|
||||
prototype void vp9_short_inv_walsh4x4_1 "int16_t *in, int16_t *out"
|
||||
specialize vp9_short_inv_walsh4x4_1
|
||||
prototype void vp9_short_idct10_32x32 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_idct10_32x32
|
||||
|
||||
prototype void vp9_short_inv_walsh4x4 "int16_t *in, int16_t *out"
|
||||
specialize vp9_short_inv_walsh4x4_
|
||||
prototype void vp9_short_iht8x8 "int16_t *input, int16_t *output, int pitch, int tx_type"
|
||||
specialize vp9_short_iht8x8
|
||||
|
||||
prototype void vp9_short_iht4x4 "int16_t *input, int16_t *output, int pitch, int tx_type"
|
||||
specialize vp9_short_iht4x4
|
||||
|
||||
prototype void vp9_short_iht16x16 "int16_t *input, int16_t *output, int pitch, int tx_type"
|
||||
specialize vp9_short_iht16x16
|
||||
|
||||
prototype void vp9_idct4_1d "int16_t *input, int16_t *output"
|
||||
specialize vp9_idct4_1d sse2
|
||||
|
||||
# dct and add
|
||||
prototype void vp9_dc_only_idct_add_8x8 "int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride"
|
||||
specialize vp9_dc_only_idct_add_8x8
|
||||
|
||||
prototype void vp9_dc_only_idct_add "int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride"
|
||||
specialize vp9_dc_only_idct_add
|
||||
specialize vp9_dc_only_idct_add sse2
|
||||
|
||||
if [ "$CONFIG_LOSSLESS" = "yes" ]; then
|
||||
prototype void vp9_short_inv_walsh4x4_1_x8 "int16_t *input, int16_t *output, int pitch"
|
||||
prototype void vp9_short_inv_walsh4x4_x8 "int16_t *input, int16_t *output, int pitch"
|
||||
prototype void vp9_short_iwalsh4x4_1 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_iwalsh4x4_1
|
||||
prototype void vp9_short_iwalsh4x4 "int16_t *input, int16_t *output, int pitch"
|
||||
specialize vp9_short_iwalsh4x4
|
||||
prototype void vp9_dc_only_inv_walsh_add "int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride"
|
||||
prototype void vp9_short_inv_walsh4x4_1_lossless "int16_t *in, int16_t *out"
|
||||
prototype void vp9_short_inv_walsh4x4_lossless "int16_t *in, int16_t *out"
|
||||
fi
|
||||
specialize vp9_dc_only_inv_walsh_add
|
||||
|
||||
prototype unsigned int vp9_sad32x3 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, int max_sad"
|
||||
specialize vp9_sad32x3
|
||||
@ -475,58 +439,52 @@ specialize vp9_variance4x4 mmx sse2
|
||||
vp9_variance4x4_sse2=vp9_variance4x4_wmt
|
||||
vp9_variance4x4_mmx=vp9_variance4x4_mmx
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_variance64x64 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance64x64
|
||||
prototype unsigned int vp9_sub_pixel_variance64x64 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance64x64 sse2
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_variance32x32 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance32x32
|
||||
prototype unsigned int vp9_sub_pixel_variance32x32 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance32x32 sse2
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_variance16x16 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
prototype unsigned int vp9_sub_pixel_variance16x16 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance16x16 sse2 mmx ssse3
|
||||
vp9_sub_pixel_variance16x16_sse2=vp9_sub_pixel_variance16x16_wmt
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_variance8x16 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
prototype unsigned int vp9_sub_pixel_variance8x16 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance8x16 sse2 mmx
|
||||
vp9_sub_pixel_variance8x16_sse2=vp9_sub_pixel_variance8x16_wmt
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_variance16x8 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
prototype unsigned int vp9_sub_pixel_variance16x8 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance16x8 sse2 mmx ssse3
|
||||
vp9_sub_pixel_variance16x8_sse2=vp9_sub_pixel_variance16x8_ssse3;
|
||||
vp9_sub_pixel_variance16x8_sse2=vp9_sub_pixel_variance16x8_wmt
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_variance8x8 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
prototype unsigned int vp9_sub_pixel_variance8x8 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance8x8 sse2 mmx
|
||||
vp9_sub_pixel_variance8x8_sse2=vp9_sub_pixel_variance8x8_wmt
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_variance4x4 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
prototype unsigned int vp9_sub_pixel_variance4x4 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_variance4x4 sse2 mmx
|
||||
vp9_sub_pixel_variance4x4_sse2=vp9_sub_pixel_variance4x4_wmt
|
||||
|
||||
prototype unsigned int vp9_sad64x64 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"
|
||||
specialize vp9_sad64x64
|
||||
specialize vp9_sad64x64 sse2
|
||||
|
||||
prototype unsigned int vp9_sad32x32 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"
|
||||
specialize vp9_sad32x32
|
||||
specialize vp9_sad32x32 sse2
|
||||
|
||||
prototype unsigned int vp9_sad16x16 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"
|
||||
specialize vp9_sad16x16 mmx sse2 sse3
|
||||
vp9_sad16x16_sse2=vp9_sad16x16_wmt
|
||||
specialize vp9_sad16x16 mmx sse2
|
||||
|
||||
prototype unsigned int vp9_sad16x8 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"
|
||||
specialize vp9_sad16x8 mmx sse2
|
||||
vp9_sad16x8_sse2=vp9_sad16x8_wmt
|
||||
|
||||
prototype unsigned int vp9_sad8x16 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"
|
||||
specialize vp9_sad8x16 mmx sse2
|
||||
vp9_sad8x16_sse2=vp9_sad8x16_wmt
|
||||
|
||||
prototype unsigned int vp9_sad8x8 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"
|
||||
specialize vp9_sad8x8 mmx sse2
|
||||
vp9_sad8x8_sse2=vp9_sad8x8_wmt
|
||||
|
||||
prototype unsigned int vp9_sad4x4 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int max_sad"
|
||||
specialize vp9_sad4x4 mmx sse2
|
||||
vp9_sad4x4_sse2=vp9_sad4x4_wmt
|
||||
specialize vp9_sad4x4 mmx sse
|
||||
|
||||
prototype unsigned int vp9_variance_halfpixvar16x16_h "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_variance_halfpixvar16x16_h mmx sse2
|
||||
@ -579,76 +537,64 @@ specialize vp9_sad8x8x3 sse3
|
||||
prototype void vp9_sad4x4x3 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad4x4x3 sse3
|
||||
|
||||
prototype void vp9_sad64x64x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint16_t *sad_array"
|
||||
prototype void vp9_sad64x64x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array"
|
||||
specialize vp9_sad64x64x8
|
||||
|
||||
prototype void vp9_sad32x32x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint16_t *sad_array"
|
||||
prototype void vp9_sad32x32x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array"
|
||||
specialize vp9_sad32x32x8
|
||||
|
||||
prototype void vp9_sad16x16x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint16_t *sad_array"
|
||||
prototype void vp9_sad16x16x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array"
|
||||
specialize vp9_sad16x16x8 sse4
|
||||
|
||||
prototype void vp9_sad16x8x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint16_t *sad_array"
|
||||
prototype void vp9_sad16x8x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array"
|
||||
specialize vp9_sad16x8x8 sse4
|
||||
|
||||
prototype void vp9_sad8x16x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint16_t *sad_array"
|
||||
prototype void vp9_sad8x16x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array"
|
||||
specialize vp9_sad8x16x8 sse4
|
||||
|
||||
prototype void vp9_sad8x8x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint16_t *sad_array"
|
||||
prototype void vp9_sad8x8x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array"
|
||||
specialize vp9_sad8x8x8 sse4
|
||||
|
||||
prototype void vp9_sad4x4x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint16_t *sad_array"
|
||||
prototype void vp9_sad4x4x8 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array"
|
||||
specialize vp9_sad4x4x8 sse4
|
||||
|
||||
prototype void vp9_sad64x64x4d "const uint8_t *src_ptr, int src_stride, const uint8_t **ref_ptr, int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad64x64x4d
|
||||
prototype void vp9_sad64x64x4d "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad64x64x4d sse2
|
||||
|
||||
prototype void vp9_sad32x32x4d "const uint8_t *src_ptr, int src_stride, const uint8_t **ref_ptr, int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad32x32x4d
|
||||
prototype void vp9_sad32x32x4d "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad32x32x4d sse2
|
||||
|
||||
prototype void vp9_sad16x16x4d "const uint8_t *src_ptr, int src_stride, const uint8_t **ref_ptr, int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad16x16x4d sse3
|
||||
prototype void vp9_sad16x16x4d "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad16x16x4d sse2
|
||||
|
||||
prototype void vp9_sad16x8x4d "const uint8_t *src_ptr, int src_stride, const uint8_t **ref_ptr, int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad16x8x4d sse3
|
||||
prototype void vp9_sad16x8x4d "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad16x8x4d sse2
|
||||
|
||||
prototype void vp9_sad8x16x4d "const uint8_t *src_ptr, int src_stride, const uint8_t **ref_ptr, int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad8x16x4d sse3
|
||||
prototype void vp9_sad8x16x4d "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad8x16x4d sse2
|
||||
|
||||
prototype void vp9_sad8x8x4d "const uint8_t *src_ptr, int src_stride, const uint8_t **ref_ptr, int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad8x8x4d sse3
|
||||
|
||||
prototype void vp9_sad4x4x4d "const uint8_t *src_ptr, int src_stride, const uint8_t **ref_ptr, int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad4x4x4d sse3
|
||||
|
||||
#
|
||||
# Block copy
|
||||
#
|
||||
case $arch in
|
||||
x86*)
|
||||
prototype void vp9_copy32xn "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, int n"
|
||||
specialize vp9_copy32xn sse2 sse3
|
||||
;;
|
||||
esac
|
||||
prototype void vp9_sad8x8x4d "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad8x8x4d sse2
|
||||
|
||||
prototype void vp9_sad4x4x4d "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, unsigned int *sad_array"
|
||||
specialize vp9_sad4x4x4d sse
|
||||
prototype unsigned int vp9_sub_pixel_mse16x16 "const uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_mse16x16 sse2 mmx
|
||||
vp9_sub_pixel_mse16x16_sse2=vp9_sub_pixel_mse16x16_wmt
|
||||
|
||||
prototype unsigned int vp9_mse16x16 "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse"
|
||||
specialize vp9_mse16x16 mmx sse2
|
||||
vp9_mse16x16_sse2=vp9_mse16x16_wmt
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_mse64x64 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
prototype unsigned int vp9_sub_pixel_mse64x64 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_mse64x64
|
||||
|
||||
prototype unsigned int vp9_sub_pixel_mse32x32 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int Refstride, unsigned int *sse"
|
||||
prototype unsigned int vp9_sub_pixel_mse32x32 "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse"
|
||||
specialize vp9_sub_pixel_mse32x32
|
||||
|
||||
prototype unsigned int vp9_get_mb_ss "const int16_t *"
|
||||
specialize vp9_get_mb_ss mmx sse2
|
||||
# ENCODEMB INVOKE
|
||||
prototype int vp9_mbblock_error "struct macroblock *mb, int dc"
|
||||
prototype int vp9_mbblock_error "struct macroblock *mb"
|
||||
specialize vp9_mbblock_error mmx sse2
|
||||
vp9_mbblock_error_sse2=vp9_mbblock_error_xmm
|
||||
|
||||
@ -686,14 +632,17 @@ if [ "$CONFIG_INTERNAL_STATS" = "yes" ]; then
|
||||
fi
|
||||
|
||||
# fdct functions
|
||||
prototype void vp9_fht "const int16_t *input, int pitch, int16_t *output, int tx_type, int tx_dim"
|
||||
specialize vp9_fht
|
||||
prototype void vp9_short_fht4x4 "int16_t *InputData, int16_t *OutputData, int pitch, int tx_type"
|
||||
specialize vp9_short_fht4x4
|
||||
|
||||
prototype void vp9_short_fht8x8 "int16_t *InputData, int16_t *OutputData, int pitch, int tx_type"
|
||||
specialize vp9_short_fht8x8
|
||||
|
||||
prototype void vp9_short_fht16x16 "int16_t *InputData, int16_t *OutputData, int pitch, int tx_type"
|
||||
specialize vp9_short_fht16x16
|
||||
|
||||
prototype void vp9_short_fdct8x8 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_fdct8x8
|
||||
|
||||
prototype void vp9_short_fhaar2x2 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_fhaar2x2
|
||||
specialize vp9_short_fdct8x8 sse2
|
||||
|
||||
prototype void vp9_short_fdct4x4 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_fdct4x4
|
||||
@ -701,23 +650,17 @@ specialize vp9_short_fdct4x4
|
||||
prototype void vp9_short_fdct8x4 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_fdct8x4
|
||||
|
||||
prototype void vp9_short_walsh4x4 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_walsh4x4
|
||||
|
||||
prototype void vp9_short_fdct32x32 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_fdct32x32
|
||||
|
||||
prototype void vp9_short_fdct16x16 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_fdct16x16
|
||||
specialize vp9_short_fdct16x16 sse2
|
||||
|
||||
prototype void vp9_short_walsh4x4_lossless "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_walsh4x4_lossless
|
||||
prototype void vp9_short_walsh4x4 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_walsh4x4
|
||||
|
||||
prototype void vp9_short_walsh4x4_x8 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_walsh4x4_x8
|
||||
|
||||
prototype void vp9_short_walsh8x4_x8 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_walsh8x4_x8
|
||||
prototype void vp9_short_walsh8x4 "int16_t *InputData, int16_t *OutputData, int pitch"
|
||||
specialize vp9_short_walsh8x4
|
||||
|
||||
#
|
||||
# Motion search
|
||||
|
@ -11,14 +11,15 @@
|
||||
#ifndef VP9_COMMON_VP9_SADMXN_H_
|
||||
#define VP9_COMMON_VP9_SADMXN_H_
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
static __inline unsigned int sad_mx_n_c(const uint8_t *src_ptr,
|
||||
int src_stride,
|
||||
const uint8_t *ref_ptr,
|
||||
int ref_stride,
|
||||
int m,
|
||||
int n) {
|
||||
static INLINE unsigned int sad_mx_n_c(const uint8_t *src_ptr,
|
||||
int src_stride,
|
||||
const uint8_t *ref_ptr,
|
||||
int ref_stride,
|
||||
int m,
|
||||
int n) {
|
||||
int r, c;
|
||||
unsigned int sad = 0;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user