Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
8ea3319e
Commit
8ea3319e
authored
May 10, 2017
by
Thomas Daede
Browse files
Remove VAR_BASED_PARTITION.
BUG=aomedia:526 Change-Id: I5d9b86a36f412ded2d6f20e198d2f4de4f97aaeb
parent
ef39c843
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
aom_dsp/aom_dsp.cmake
View file @
8ea3319e
...
...
@@ -327,7 +327,6 @@ if (CONFIG_AV1_ENCODER)
"
${
AOM_ROOT
}
/aom_dsp/x86/quantize_avx_x86_64.asm"
)
set
(
AOM_DSP_ENCODER_INTRIN_MSA
"
${
AOM_ROOT
}
/aom_dsp/mips/avg_msa.c"
"
${
AOM_ROOT
}
/aom_dsp/mips/sad_msa.c"
"
${
AOM_ROOT
}
/aom_dsp/mips/subtract_msa.c"
"
${
AOM_ROOT
}
/aom_dsp/mips/variance_msa.c"
...
...
aom_dsp/aom_dsp.mk
View file @
8ea3319e
...
...
@@ -302,7 +302,6 @@ endif
DSP_SRCS-yes
+=
avg.c
DSP_SRCS-$(HAVE_SSE2)
+=
x86/avg_intrin_sse2.c
DSP_SRCS-$(HAVE_NEON)
+=
arm/avg_neon.c
DSP_SRCS-$(HAVE_MSA)
+=
mips/avg_msa.c
DSP_SRCS-$(HAVE_NEON)
+=
arm/hadamard_neon.c
ifeq
($(ARCH_X86_64),yes)
DSP_SRCS-$(HAVE_SSSE3)
+=
x86/avg_ssse3_x86_64.asm
...
...
aom_dsp/aom_dsp_rtcd_defs.pl
View file @
8ea3319e
...
...
@@ -617,13 +617,8 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
#
# Avg
#
add_proto
qw/unsigned int aom_avg_8x8/
,
"
const uint8_t *, int p
";
specialize
qw/aom_avg_8x8 sse2 neon msa/
;
add_proto
qw/unsigned int aom_avg_4x4/
,
"
const uint8_t *, int p
";
specialize
qw/aom_avg_4x4 sse2 neon msa/
;
if
(
aom_config
("
CONFIG_HIGHBITDEPTH
")
eq
"
yes
")
{
add_proto
qw/unsigned int aom_highbd_avg_8x8/
,
"
const uint8_t *, int p
";
add_proto
qw/unsigned int aom_highbd_avg_4x4/
,
"
const uint8_t *, int p
";
add_proto
qw/void aom_highbd_subtract_block/
,
"
int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride, int bd
";
specialize
qw/aom_highbd_subtract_block sse2/
;
}
...
...
aom_dsp/arm/avg_neon.c
View file @
8ea3319e
...
...
@@ -25,44 +25,6 @@ static INLINE unsigned int horizontal_add_u16x8(const uint16x8_t v_16x8) {
return
vget_lane_u32
(
c
,
0
);
}
unsigned
int
aom_avg_4x4_neon
(
const
uint8_t
*
s
,
int
p
)
{
uint16x8_t
v_sum
;
uint32x2_t
v_s0
=
vdup_n_u32
(
0
);
uint32x2_t
v_s1
=
vdup_n_u32
(
0
);
v_s0
=
vld1_lane_u32
((
const
uint32_t
*
)
s
,
v_s0
,
0
);
v_s0
=
vld1_lane_u32
((
const
uint32_t
*
)(
s
+
p
),
v_s0
,
1
);
v_s1
=
vld1_lane_u32
((
const
uint32_t
*
)(
s
+
2
*
p
),
v_s1
,
0
);
v_s1
=
vld1_lane_u32
((
const
uint32_t
*
)(
s
+
3
*
p
),
v_s1
,
1
);
v_sum
=
vaddl_u8
(
vreinterpret_u8_u32
(
v_s0
),
vreinterpret_u8_u32
(
v_s1
));
return
(
horizontal_add_u16x8
(
v_sum
)
+
8
)
>>
4
;
}
unsigned
int
aom_avg_8x8_neon
(
const
uint8_t
*
s
,
int
p
)
{
uint8x8_t
v_s0
=
vld1_u8
(
s
);
const
uint8x8_t
v_s1
=
vld1_u8
(
s
+
p
);
uint16x8_t
v_sum
=
vaddl_u8
(
v_s0
,
v_s1
);
v_s0
=
vld1_u8
(
s
+
2
*
p
);
v_sum
=
vaddw_u8
(
v_sum
,
v_s0
);
v_s0
=
vld1_u8
(
s
+
3
*
p
);
v_sum
=
vaddw_u8
(
v_sum
,
v_s0
);
v_s0
=
vld1_u8
(
s
+
4
*
p
);
v_sum
=
vaddw_u8
(
v_sum
,
v_s0
);
v_s0
=
vld1_u8
(
s
+
5
*
p
);
v_sum
=
vaddw_u8
(
v_sum
,
v_s0
);
v_s0
=
vld1_u8
(
s
+
6
*
p
);
v_sum
=
vaddw_u8
(
v_sum
,
v_s0
);
v_s0
=
vld1_u8
(
s
+
7
*
p
);
v_sum
=
vaddw_u8
(
v_sum
,
v_s0
);
return
(
horizontal_add_u16x8
(
v_sum
)
+
32
)
>>
6
;
}
// coeff: 16 bits, dynamic range [-32640, 32640].
// length: value range {16, 64, 256, 1024}.
int
aom_satd_neon
(
const
int16_t
*
coeff
,
int
length
)
{
...
...
aom_dsp/avg.c
View file @
8ea3319e
...
...
@@ -13,26 +13,6 @@
#include "./aom_dsp_rtcd.h"
#include "aom_ports/mem.h"
unsigned
int
aom_avg_8x8_c
(
const
uint8_t
*
src
,
int
stride
)
{
int
i
,
j
;
int
sum
=
0
;
for
(
i
=
0
;
i
<
8
;
++
i
,
src
+=
stride
)
for
(
j
=
0
;
j
<
8
;
sum
+=
src
[
j
],
++
j
)
{
}
return
ROUND_POWER_OF_TWO
(
sum
,
6
);
}
unsigned
int
aom_avg_4x4_c
(
const
uint8_t
*
src
,
int
stride
)
{
int
i
,
j
;
int
sum
=
0
;
for
(
i
=
0
;
i
<
4
;
++
i
,
src
+=
stride
)
for
(
j
=
0
;
j
<
4
;
sum
+=
src
[
j
],
++
j
)
{
}
return
ROUND_POWER_OF_TWO
(
sum
,
4
);
}
// src_diff: first pass, 9 bit, dynamic range [-255, 255]
// second pass, 12 bit, dynamic range [-2040, 2040]
static
void
hadamard_col8
(
const
int16_t
*
src_diff
,
int
src_stride
,
...
...
@@ -192,28 +172,6 @@ void aom_minmax_8x8_c(const uint8_t *src, int src_stride, const uint8_t *ref,
}
#if CONFIG_HIGHBITDEPTH
unsigned
int
aom_highbd_avg_8x8_c
(
const
uint8_t
*
src
,
int
stride
)
{
int
i
,
j
;
int
sum
=
0
;
const
uint16_t
*
s
=
CONVERT_TO_SHORTPTR
(
src
);
for
(
i
=
0
;
i
<
8
;
++
i
,
s
+=
stride
)
for
(
j
=
0
;
j
<
8
;
sum
+=
s
[
j
],
++
j
)
{
}
return
ROUND_POWER_OF_TWO
(
sum
,
6
);
}
unsigned
int
aom_highbd_avg_4x4_c
(
const
uint8_t
*
src
,
int
stride
)
{
int
i
,
j
;
int
sum
=
0
;
const
uint16_t
*
s
=
CONVERT_TO_SHORTPTR
(
src
);
for
(
i
=
0
;
i
<
4
;
++
i
,
s
+=
stride
)
for
(
j
=
0
;
j
<
4
;
sum
+=
s
[
j
],
++
j
)
{
}
return
ROUND_POWER_OF_TWO
(
sum
,
4
);
}
void
aom_highbd_minmax_8x8_c
(
const
uint8_t
*
s8
,
int
p
,
const
uint8_t
*
d8
,
int
dp
,
int
*
min
,
int
*
max
)
{
int
i
,
j
;
...
...
aom_dsp/mips/avg_msa.c
deleted
100644 → 0
View file @
ef39c843
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "./aom_dsp_rtcd.h"
#include "aom_dsp/mips/macros_msa.h"
uint32_t
aom_avg_8x8_msa
(
const
uint8_t
*
src
,
int32_t
src_stride
)
{
uint32_t
sum_out
;
v16u8
src0
,
src1
,
src2
,
src3
,
src4
,
src5
,
src6
,
src7
;
v8u16
sum0
,
sum1
,
sum2
,
sum3
,
sum4
,
sum5
,
sum6
,
sum7
;
v4u32
sum
=
{
0
};
LD_UB8
(
src
,
src_stride
,
src0
,
src1
,
src2
,
src3
,
src4
,
src5
,
src6
,
src7
);
HADD_UB4_UH
(
src0
,
src1
,
src2
,
src3
,
sum0
,
sum1
,
sum2
,
sum3
);
HADD_UB4_UH
(
src4
,
src5
,
src6
,
src7
,
sum4
,
sum5
,
sum6
,
sum7
);
ADD4
(
sum0
,
sum1
,
sum2
,
sum3
,
sum4
,
sum5
,
sum6
,
sum7
,
sum0
,
sum2
,
sum4
,
sum6
);
ADD2
(
sum0
,
sum2
,
sum4
,
sum6
,
sum0
,
sum4
);
sum0
+=
sum4
;
sum
=
__msa_hadd_u_w
(
sum0
,
sum0
);
sum0
=
(
v8u16
)
__msa_pckev_h
((
v8i16
)
sum
,
(
v8i16
)
sum
);
sum
=
__msa_hadd_u_w
(
sum0
,
sum0
);
sum
=
(
v4u32
)
__msa_srari_w
((
v4i32
)
sum
,
6
);
sum_out
=
__msa_copy_u_w
((
v4i32
)
sum
,
0
);
return
sum_out
;
}
uint32_t
aom_avg_4x4_msa
(
const
uint8_t
*
src
,
int32_t
src_stride
)
{
uint32_t
sum_out
;
uint32_t
src0
,
src1
,
src2
,
src3
;
v16u8
vec
=
{
0
};
v8u16
sum0
;
v4u32
sum1
;
v2u64
sum2
;
LW4
(
src
,
src_stride
,
src0
,
src1
,
src2
,
src3
);
INSERT_W4_UB
(
src0
,
src1
,
src2
,
src3
,
vec
);
sum0
=
__msa_hadd_u_h
(
vec
,
vec
);
sum1
=
__msa_hadd_u_w
(
sum0
,
sum0
);
sum0
=
(
v8u16
)
__msa_pckev_h
((
v8i16
)
sum1
,
(
v8i16
)
sum1
);
sum1
=
__msa_hadd_u_w
(
sum0
,
sum0
);
sum2
=
__msa_hadd_u_d
(
sum1
,
sum1
);
sum1
=
(
v4u32
)
__msa_srari_w
((
v4i32
)
sum2
,
4
);
sum_out
=
__msa_copy_u_w
((
v4i32
)
sum1
,
0
);
return
sum_out
;
}
aom_dsp/x86/avg_intrin_sse2.c
View file @
8ea3319e
...
...
@@ -94,52 +94,6 @@ void aom_minmax_8x8_sse2(const uint8_t *s, int p, const uint8_t *d, int dp,
*
min
=
_mm_extract_epi16
(
minabsdiff
,
0
);
}
unsigned
int
aom_avg_8x8_sse2
(
const
uint8_t
*
s
,
int
p
)
{
__m128i
s0
,
s1
,
u0
;
unsigned
int
avg
=
0
;
u0
=
_mm_setzero_si128
();
s0
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
s
)),
u0
);
s1
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
s
+
p
)),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s1
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
s
+
2
*
p
)),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s1
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
s
+
3
*
p
)),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s1
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
s
+
4
*
p
)),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s1
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
s
+
5
*
p
)),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s1
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
s
+
6
*
p
)),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s1
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
s
+
7
*
p
)),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s0
=
_mm_adds_epu16
(
s0
,
_mm_srli_si128
(
s0
,
8
));
s0
=
_mm_adds_epu16
(
s0
,
_mm_srli_epi64
(
s0
,
32
));
s0
=
_mm_adds_epu16
(
s0
,
_mm_srli_epi64
(
s0
,
16
));
avg
=
_mm_extract_epi16
(
s0
,
0
);
return
(
avg
+
32
)
>>
6
;
}
unsigned
int
aom_avg_4x4_sse2
(
const
uint8_t
*
s
,
int
p
)
{
__m128i
s0
,
s1
,
u0
;
unsigned
int
avg
=
0
;
u0
=
_mm_setzero_si128
();
s0
=
_mm_unpacklo_epi8
(
xx_loadl_32
(
s
),
u0
);
s1
=
_mm_unpacklo_epi8
(
xx_loadl_32
(
s
+
p
),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s1
=
_mm_unpacklo_epi8
(
xx_loadl_32
(
s
+
2
*
p
),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s1
=
_mm_unpacklo_epi8
(
xx_loadl_32
(
s
+
3
*
p
),
u0
);
s0
=
_mm_adds_epu16
(
s0
,
s1
);
s0
=
_mm_adds_epu16
(
s0
,
_mm_srli_si128
(
s0
,
4
));
s0
=
_mm_adds_epu16
(
s0
,
_mm_srli_epi64
(
s0
,
16
));
avg
=
_mm_extract_epi16
(
s0
,
0
);
return
(
avg
+
8
)
>>
4
;
}
static
void
hadamard_col8_sse2
(
__m128i
*
in
,
int
iter
)
{
__m128i
a0
=
in
[
0
];
__m128i
a1
=
in
[
1
];
...
...
av1/av1.cmake
View file @
8ea3319e
...
...
@@ -145,9 +145,7 @@ set(AOM_AV1_ENCODER_SOURCES
"
${
AOM_ROOT
}
/av1/encoder/tokenize.c"
"
${
AOM_ROOT
}
/av1/encoder/tokenize.h"
"
${
AOM_ROOT
}
/av1/encoder/treewriter.c"
"
${
AOM_ROOT
}
/av1/encoder/treewriter.h"
"
${
AOM_ROOT
}
/av1/encoder/variance_tree.c"
"
${
AOM_ROOT
}
/av1/encoder/variance_tree.h"
)
"
${
AOM_ROOT
}
/av1/encoder/treewriter.h"
)
set
(
AOM_AV1_COMMON_INTRIN_SSE2
"
${
AOM_ROOT
}
/av1/common/x86/idct_intrin_sse2.c"
)
...
...
av1/av1_cx.mk
View file @
8ea3319e
...
...
@@ -23,8 +23,6 @@ AV1_CX_SRCS-yes += encoder/av1_quantize.h
AV1_CX_SRCS-yes
+=
encoder/bitstream.c
AV1_CX_SRCS-yes
+=
encoder/context_tree.c
AV1_CX_SRCS-yes
+=
encoder/context_tree.h
AV1_CX_SRCS-yes
+=
encoder/variance_tree.c
AV1_CX_SRCS-yes
+=
encoder/variance_tree.h
AV1_CX_SRCS-yes
+=
encoder/cost.h
AV1_CX_SRCS-yes
+=
encoder/cost.c
AV1_CX_SRCS-yes
+=
encoder/dct.c
...
...
av1/encoder/encodeframe.c
View file @
8ea3319e
This diff is collapsed.
Click to expand it.
av1/encoder/encodeframe.h
View file @
8ea3319e
...
...
@@ -35,8 +35,6 @@ void av1_init_tile_data(struct AV1_COMP *cpi);
void
av1_encode_tile
(
struct
AV1_COMP
*
cpi
,
struct
ThreadData
*
td
,
int
tile_row
,
int
tile_col
);
void
av1_set_variance_partition_thresholds
(
struct
AV1_COMP
*
cpi
,
int
q
);
void
av1_update_tx_type_count
(
const
struct
AV1Common
*
cm
,
MACROBLOCKD
*
xd
,
#if CONFIG_TXK_SEL
int
block
,
int
plane
,
...
...
av1/encoder/encoder.c
View file @
8ea3319e
...
...
@@ -483,7 +483,6 @@ static void dealloc_compressor_data(AV1_COMP *cpi) {
cpi
->
tile_tok
[
0
][
0
]
=
0
;
av1_free_pc_tree
(
&
cpi
->
td
);
av1_free_var_tree
(
&
cpi
->
td
);
#if CONFIG_PALETTE
if
(
cpi
->
common
.
allow_screen_content_tools
)
...
...
@@ -2588,7 +2587,6 @@ void av1_remove_compressor(AV1_COMP *cpi) {
#endif // CONFIG_PALETTE
aom_free
(
thread_data
->
td
->
counts
);
av1_free_pc_tree
(
thread_data
->
td
);
av1_free_var_tree
(
thread_data
->
td
);
aom_free
(
thread_data
->
td
);
}
}
...
...
@@ -3963,7 +3961,6 @@ static void encode_without_recode_loop(AV1_COMP *cpi) {
reset_use_upsampled_references
(
cpi
);
av1_set_quantizer
(
cm
,
q
);
av1_set_variance_partition_thresholds
(
cpi
,
q
);
setup_frame
(
cpi
);
suppress_active_map
(
cpi
);
...
...
av1/encoder/encoder.h
View file @
8ea3319e
...
...
@@ -37,7 +37,6 @@
#include "av1/encoder/rd.h"
#include "av1/encoder/speed_features.h"
#include "av1/encoder/tokenize.h"
#include "av1/encoder/variance_tree.h"
#if CONFIG_XIPHRC
#include "av1/encoder/ratectrl_xiph.h"
#endif
...
...
@@ -327,9 +326,6 @@ typedef struct ThreadData {
PC_TREE
*
pc_tree
;
PC_TREE
*
pc_root
[
MAX_MIB_SIZE_LOG2
-
MIN_MIB_SIZE_LOG2
+
1
];
VAR_TREE
*
var_tree
;
VAR_TREE
*
var_root
[
MAX_MIB_SIZE_LOG2
-
MIN_MIB_SIZE_LOG2
+
1
];
#if CONFIG_PALETTE
PALETTE_BUFFER
*
palette_buffer
;
#endif // CONFIG_PALETTE
...
...
@@ -620,17 +616,6 @@ typedef struct AV1_COMP {
int
superres_pending
;
#endif // CONFIG_FRAME_SUPERRES
// VAR_BASED_PARTITION thresholds
// 0 - threshold_128x128;
// 1 - threshold_64x64;
// 2 - threshold_32x32;
// 3 - threshold_16x16;
// 4 - threshold_8x8;
int64_t
vbp_thresholds
[
5
];
int64_t
vbp_threshold_minmax
;
int64_t
vbp_threshold_sad
;
BLOCK_SIZE
vbp_bsize_min
;
// VARIANCE_AQ segment map refresh
int
vaq_refresh
;
...
...
av1/encoder/ethread.c
View file @
8ea3319e
...
...
@@ -93,10 +93,6 @@ void av1_encode_tiles_mt(AV1_COMP *cpi) {
thread_data
->
td
->
pc_tree
=
NULL
;
av1_setup_pc_tree
(
cm
,
thread_data
->
td
);
// Set up variance tree if needed.
if
(
cpi
->
sf
.
partition_search_type
==
VAR_BASED_PARTITION
)
av1_setup_var_tree
(
cm
,
thread_data
->
td
);
// Allocate frame counters in thread data.
CHECK_MEM_ERROR
(
cm
,
thread_data
->
td
->
counts
,
aom_calloc
(
1
,
sizeof
(
*
thread_data
->
td
->
counts
)));
...
...
av1/encoder/rd.c
View file @
8ea3319e
...
...
@@ -374,8 +374,7 @@ void av1_initialize_rd_consts(AV1_COMP *cpi) {
if
(
cpi
->
oxcf
.
pass
!=
1
)
{
av1_fill_token_costs
(
x
->
token_costs
,
cm
->
fc
->
coef_probs
);
if
(
cpi
->
sf
.
partition_search_type
!=
VAR_BASED_PARTITION
||
cm
->
frame_type
==
KEY_FRAME
)
{
if
(
cm
->
frame_type
==
KEY_FRAME
)
{
#if CONFIG_EXT_PARTITION_TYPES
for
(
i
=
0
;
i
<
PARTITION_PLOFFSET
;
++
i
)
av1_cost_tokens
(
cpi
->
partition_cost
[
i
],
cm
->
fc
->
partition_prob
[
i
],
...
...
av1/encoder/speed_features.h
View file @
8ea3319e
...
...
@@ -195,11 +195,7 @@ typedef enum {
// Always use a fixed size partition
FIXED_PARTITION
,
REFERENCE_PARTITION
,
// Use an arbitrary partitioning scheme based on source variance within
// a 64X64 SB
VAR_BASED_PARTITION
REFERENCE_PARTITION
}
PARTITION_SEARCH_TYPE
;
typedef
enum
{
...
...
av1/encoder/variance_tree.c
deleted
100644 → 0
View file @
ef39c843
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "av1/encoder/variance_tree.h"
#include "av1/encoder/encoder.h"
void
av1_setup_var_tree
(
struct
AV1Common
*
cm
,
ThreadData
*
td
)
{
int
i
,
j
;
#if CONFIG_EXT_PARTITION
const
int
leaf_nodes
=
1024
;
const
int
tree_nodes
=
1024
+
256
+
64
+
16
+
4
+
1
;
#else
const
int
leaf_nodes
=
256
;
const
int
tree_nodes
=
256
+
64
+
16
+
4
+
1
;
#endif // CONFIG_EXT_PARTITION
int
index
=
0
;
VAR_TREE
*
this_var
;
int
nodes
;
aom_free
(
td
->
var_tree
);
CHECK_MEM_ERROR
(
cm
,
td
->
var_tree
,
aom_calloc
(
tree_nodes
,
sizeof
(
*
td
->
var_tree
)));
this_var
=
&
td
->
var_tree
[
0
];
// Sets up all the leaf nodes in the tree.
for
(
index
=
0
;
index
<
leaf_nodes
;
++
index
)
{
VAR_TREE
*
const
leaf
=
&
td
->
var_tree
[
index
];
leaf
->
split
[
0
]
=
NULL
;
}
// Each node has 4 leaf nodes, fill in the child pointers
// from leafs to the root.
for
(
nodes
=
leaf_nodes
>>
2
;
nodes
>
0
;
nodes
>>=
2
)
{
for
(
i
=
0
;
i
<
nodes
;
++
i
,
++
index
)
{
VAR_TREE
*
const
node
=
&
td
->
var_tree
[
index
];
for
(
j
=
0
;
j
<
4
;
j
++
)
node
->
split
[
j
]
=
this_var
++
;
}
}
// Set up the root node for the largest superblock size
i
=
MAX_MIB_SIZE_LOG2
-
MIN_MIB_SIZE_LOG2
;
td
->
var_root
[
i
]
=
&
td
->
var_tree
[
tree_nodes
-
1
];
// Set up the root nodes for the rest of the possible superblock sizes
while
(
--
i
>=
0
)
{
td
->
var_root
[
i
]
=
td
->
var_root
[
i
+
1
]
->
split
[
0
];
}
}
void
av1_free_var_tree
(
ThreadData
*
td
)
{
aom_free
(
td
->
var_tree
);
td
->
var_tree
=
NULL
;
}
av1/encoder/variance_tree.h
deleted
100644 → 0
View file @
ef39c843
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AV1_ENCODER_VARIANCE_TREE_H_
#define AV1_ENCODER_VARIANCE_TREE_H_
#include <assert.h>
#include "./aom_config.h"
#include "aom/aom_integer.h"
#include "av1/common/enums.h"
#ifdef __cplusplus
extern
"C"
{
#endif
struct
AV1Common
;
struct
ThreadData
;
typedef
struct
{
int64_t
sum_square_error
;
int64_t
sum_error
;
int
log2_count
;
int
variance
;
}
VAR
;
typedef
struct
{
VAR
none
;
VAR
horz
[
2
];
VAR
vert
[
2
];
}
partition_variance
;
typedef
struct
VAR_TREE
{
int
force_split
;
partition_variance
variances
;
struct
VAR_TREE
*
split
[
4
];
BLOCK_SIZE
bsize
;
const
uint8_t
*
src
;
const
uint8_t
*
ref
;
int
src_stride
;
int
ref_stride
;
int
width
;
int
height
;
#if CONFIG_HIGHBITDEPTH
int
highbd
;
#endif // CONFIG_HIGHBITDEPTH
}
VAR_TREE
;
void
av1_setup_var_tree
(
struct
AV1Common
*
cm
,
struct
ThreadData
*
td
);
void
av1_free_var_tree
(
struct
ThreadData
*
td
);
// Set variance values given sum square error, sum error, count.
static
INLINE
void
fill_variance
(
int64_t
s2
,
int64_t
s
,
int
c
,
VAR
*
v
)
{
v
->
sum_square_error
=
s2
;
v
->
sum_error
=
s
;
v
->
log2_count
=
c
;
v
->
variance
=
(
int
)(
256
*
(
v
->
sum_square_error
-
((
v
->
sum_error
*
v
->
sum_error
)
>>
v
->
log2_count
))
>>
v
->
log2_count
);
}
static
INLINE
void
sum_2_variances
(
const
VAR
*
a
,
const
VAR
*
b
,
VAR
*
r
)
{
assert
(
a
->
log2_count
==
b
->
log2_count
);
fill_variance
(
a
->
sum_square_error
+
b
->
sum_square_error
,
a
->
sum_error
+
b
->
sum_error
,
a
->
log2_count
+
1
,
r
);
}
static
INLINE
void
fill_variance_node
(
VAR_TREE
*
vt
)
{
sum_2_variances
(
&
vt
->
split
[
0
]
->
variances
.
none
,
&
vt
->
split
[
1
]
->
variances
.
none
,
&
vt
->
variances
.
horz
[
0
]);
sum_2_variances
(
&
vt
->
split
[
2
]
->
variances
.
none
,
&
vt
->
split
[
3
]
->
variances
.
none
,
&
vt
->
variances
.
horz
[
1
]);
sum_2_variances
(
&
vt
->
split
[
0
]
->
variances
.
none
,
&
vt
->
split
[
2
]
->
variances
.
none
,
&
vt
->
variances
.
vert
[
0
]);
sum_2_variances
(
&
vt
->
split
[
1
]
->
variances
.
none
,
&
vt
->
split
[
3
]
->
variances
.
none
,
&
vt
->
variances
.
vert
[
1
]);
sum_2_variances
(
&
vt
->
variances
.
vert
[
0
],
&
vt
->
variances
.
vert
[
1
],
&
vt
->
variances
.
none
);
}
#ifdef __cplusplus
}
// extern "C"
#endif
#endif
/* AV1_ENCODER_VARIANCE_TREE_H_ */
test/avg_test.cc
View file @
8ea3319e
...
...
@@ -53,21 +53,6 @@ class AverageTestBase : public ::testing::Test {
rnd_
.
Reset
(
ACMRandom
::
DeterministicSeed
());
}
// Sum Pixels
static
unsigned
int
ReferenceAverage8x8
(
const
uint8_t
*
source
,
int
pitch
)
{
unsigned
int
average
=
0
;
for
(
int
h
=
0
;
h
<
8
;
++
h
)
for
(
int
w
=
0
;
w
<
8
;
++
w
)
average
+=
source
[
h
*
pitch
+
w
];
return
((
average
+
32
)
>>
6
);
}
static
unsigned
int
ReferenceAverage4x4
(
const
uint8_t
*
source
,
int
pitch
)
{
unsigned
int
average
=
0
;
for
(
int
h
=
0
;
h
<
4
;
++
h
)
for
(
int
w
=
0
;
w
<
4
;
++
w
)
average
+=
source
[
h
*
pitch
+
w
];
return
((
average
+
8
)
>>
4
);
}
void
FillConstant
(
uint8_t
fill_constant
)
{
for
(
int
i
=
0
;
i
<
width_
*
height_
;
++
i
)
{
source_data_
[
i
]
=
fill_constant
;
...
...
@@ -86,35 +71,6 @@ class AverageTestBase : public ::testing::Test {
ACMRandom
rnd_
;
};
typedef
unsigned
int
(
*
AverageFunction
)(
const
uint8_t
*
s
,
int
pitch
);
typedef
std
::
tr1
::
tuple
<
int
,
int
,
int
,
int
,
AverageFunction
>
AvgFunc
;
class
AverageTest
:
public
AverageTestBase
,
public
::
testing
::
WithParamInterface
<
AvgFunc
>
{
public:
AverageTest
()
:
AverageTestBase
(
GET_PARAM
(
0
),
GET_PARAM
(
1
))
{}
protected:
void
CheckAverages
()
{
const
int
block_size
=
GET_PARAM
(
3
);
unsigned
int
expected
=
0
;
if
(
block_size
==
8
)
{
expected
=
ReferenceAverage8x8
(
source_data_
+
GET_PARAM
(
2
),
source_stride_
);
}
else
if
(
block_size
==
4
)
{
expected
=
ReferenceAverage4x4
(
source_data_
+
GET_PARAM
(
2
),
source_stride_
);
}
ASM_REGISTER_STATE_CHECK
(
GET_PARAM
(
4
)(
source_data_
+
GET_PARAM
(
2
),
source_stride_
));
unsigned
int
actual
=
GET_PARAM
(
4
)(
source_data_
+
GET_PARAM
(
2
),
source_stride_
);
EXPECT_EQ
(
expected
,
actual
);
}
};
typedef
void
(
*
IntProRowFunc
)(
int16_t
hbuf
[
16
],
uint8_t
const
*
ref
,
const
int
ref_stride
,
const
int
height
);
...
...
@@ -229,25 +185,6 @@ class SatdTest : public ::testing::Test,
uint8_t
*
AverageTestBase
::
source_data_
=
NULL
;
TEST_P
(
AverageTest
,
MinValue
)
{
FillConstant
(
0
);
CheckAverages
();
}
TEST_P
(
AverageTest
,
MaxValue
)
{
FillConstant
(
255
);
CheckAverages
();