Skip to content
GitLab
Menu
Projects
Groups
Snippets
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
1838d877
Commit
1838d877
authored
Oct 28, 2012
by
Jim Bankoski
Committed by
Paul Wilkins
Oct 29, 2012
Browse files
invoke macro removal encodemb
Change-Id: I321280abcf48f3dc16e194d29bde2bd3baec6006
parent
47fb1474
Changes
13
Hide whitespace changes
Inline
Side-by-side
vp8/common/blockd.h
View file @
1838d877
...
...
@@ -255,7 +255,7 @@ typedef struct {
union
b_mode_info
bmi
[
16
];
}
MODE_INFO
;
typedef
struct
{
typedef
struct
blockd
{
short
*
qcoeff
;
short
*
dqcoeff
;
unsigned
char
*
predictor
;
...
...
@@ -277,7 +277,7 @@ typedef struct {
union
b_mode_info
bmi
;
}
BLOCKD
;
typedef
struct
M
acro
B
lock
D
{
typedef
struct
m
acro
b
lock
d
{
DECLARE_ALIGNED
(
16
,
short
,
diff
[
400
]);
/* from idct diff */
DECLARE_ALIGNED
(
16
,
unsigned
char
,
predictor
[
384
]);
DECLARE_ALIGNED
(
16
,
short
,
qcoeff
[
400
]);
...
...
vp8/common/loopfilter.h
View file @
1838d877
...
...
@@ -81,22 +81,22 @@ typedef void loop_filter_uvfunction
/* assorted loopfilter functions which get used elsewhere */
struct
VP8Common
;
struct
M
acro
B
lock
D
;
struct
m
acro
b
lock
d
;
void
vp8_loop_filter_init
(
struct
VP8Common
*
cm
);
void
vp8_loop_filter_frame_init
(
struct
VP8Common
*
cm
,
struct
M
acro
B
lock
D
*
mbd
,
struct
m
acro
b
lock
d
*
mbd
,
int
default_filt_lvl
);
void
vp8_loop_filter_frame
(
struct
VP8Common
*
cm
,
struct
M
acro
B
lock
D
*
mbd
);
void
vp8_loop_filter_frame
(
struct
VP8Common
*
cm
,
struct
m
acro
b
lock
d
*
mbd
);
void
vp8_loop_filter_partial_frame
(
struct
VP8Common
*
cm
,
struct
M
acro
B
lock
D
*
mbd
,
struct
m
acro
b
lock
d
*
mbd
,
int
default_filt_lvl
);
void
vp8_loop_filter_frame_yonly
(
struct
VP8Common
*
cm
,
struct
M
acro
B
lock
D
*
mbd
,
struct
m
acro
b
lock
d
*
mbd
,
int
default_filt_lvl
);
void
vp8_loop_filter_update_sharpness
(
loop_filter_info_n
*
lfi
,
...
...
vp8/common/rtcd_defs.sh
View file @
1838d877
common_forward_decls
()
{
cat
<<
EOF
#include "vp8/common/blockd.h"
struct loop_filter_info;
struct blockd;
struct macroblockd;
struct loop_filter_info;
/* Encoder forward decls */
struct block;
struct macroblock;
struct variance_vtable;
/* Encoder forward decls */
struct variance_vtable;
union int_mv;
...
...
@@ -70,55 +77,55 @@ specialize vp8_recon2b sse2
prototype void vp8_recon4b
"unsigned char *pred_ptr, short *diff_ptr, unsigned char *dst_ptr, int stride"
specialize vp8_recon4b sse2
prototype void vp8_recon_mb
"
MACROBLOCKD
*x"
prototype void vp8_recon_mb
"
struct macroblockd
*x"
specialize vp8_recon_mb
prototype void vp8_recon_mby
"
MACROBLOCKD
*x"
prototype void vp8_recon_mby
"
struct macroblockd
*x"
specialize vp8_recon_mby
prototype void vp8_build_intra_predictors_mby_s
"
MACROBLOCKD
*x"
prototype void vp8_build_intra_predictors_mby_s
"
struct macroblockd
*x"
specialize vp8_build_intra_predictors_mby_s
prototype void vp8_build_intra_predictors_sby_s
"
MACROBLOCKD
*x"
prototype void vp8_build_intra_predictors_sby_s
"
struct macroblockd
*x"
specialize vp8_build_intra_predictors_sby_s
;
prototype void vp8_build_intra_predictors_sbuv_s
"
MACROBLOCKD
*x"
prototype void vp8_build_intra_predictors_sbuv_s
"
struct macroblockd
*x"
specialize vp8_build_intra_predictors_sbuv_s
;
prototype void vp8_build_intra_predictors_mby
"
MACROBLOCKD
*x"
prototype void vp8_build_intra_predictors_mby
"
struct macroblockd
*x"
specialize vp8_build_intra_predictors_mby
;
prototype void vp8_build_comp_intra_predictors_mby
"
MACROBLOCKD
*x"
prototype void vp8_build_comp_intra_predictors_mby
"
struct macroblockd
*x"
specialize vp8_build_comp_intra_predictors_mby
;
prototype void vp8_build_intra_predictors_mby_s
"
MACROBLOCKD
*x"
prototype void vp8_build_intra_predictors_mby_s
"
struct macroblockd
*x"
specialize vp8_build_intra_predictors_mby_s
;
prototype void vp8_build_intra_predictors_mbuv
"
MACROBLOCKD
*x"
prototype void vp8_build_intra_predictors_mbuv
"
struct macroblockd
*x"
specialize vp8_build_intra_predictors_mbuv
;
prototype void vp8_build_intra_predictors_mbuv_s
"
MACROBLOCKD
*x"
prototype void vp8_build_intra_predictors_mbuv_s
"
struct macroblockd
*x"
specialize vp8_build_intra_predictors_mbuv_s
;
prototype void vp8_build_comp_intra_predictors_mbuv
"
MACROBLOCKD
*x"
prototype void vp8_build_comp_intra_predictors_mbuv
"
struct macroblockd
*x"
specialize vp8_build_comp_intra_predictors_mbuv
;
prototype void vp8_intra4x4_predict
"
BLOCKD
*x, int b_mode, unsigned char *predictor"
prototype void vp8_intra4x4_predict
"
struct blockd
*x, int b_mode, unsigned char *predictor"
specialize vp8_intra4x4_predict
;
prototype void vp8_comp_intra4x4_predict
"
BLOCKD
*x, int b_mode, int second_mode, unsigned char *predictor"
prototype void vp8_comp_intra4x4_predict
"
struct blockd
*x, int b_mode, int second_mode, unsigned char *predictor"
specialize vp8_comp_intra4x4_predict
;
prototype void vp8_intra8x8_predict
"
BLOCKD
*x, int b_mode, unsigned char *predictor"
prototype void vp8_intra8x8_predict
"
struct blockd
*x, int b_mode, unsigned char *predictor"
specialize vp8_intra8x8_predict
;
prototype void vp8_comp_intra8x8_predict
"
BLOCKD
*x, int b_mode, int second_mode, unsigned char *predictor"
prototype void vp8_comp_intra8x8_predict
"
struct blockd
*x, int b_mode, int second_mode, unsigned char *predictor"
specialize vp8_comp_intra8x8_predict
;
prototype void vp8_intra_uv4x4_predict
"
BLOCKD
*x, int b_mode, unsigned char *predictor"
prototype void vp8_intra_uv4x4_predict
"
struct blockd
*x, int b_mode, unsigned char *predictor"
specialize vp8_intra_uv4x4_predict
;
prototype void vp8_comp_intra_uv4x4_predict
"
BLOCKD
*x, int b_mode, int second_mode, unsigned char *predictor"
prototype void vp8_comp_intra_uv4x4_predict
"
struct blockd
*x, int b_mode, int second_mode, unsigned char *predictor"
specialize vp8_comp_intra_uv4x4_predict
;
#
...
...
@@ -367,6 +374,30 @@ specialize vp8_sub_pixel_mse32x32
prototype unsigned int vp8_get_mb_ss
"const short *"
specialize vp8_get_mb_ss mmx sse2
# ENCODEMB INVOKE
prototype int vp8_mbblock_error
"struct macroblock *mb, int dc"
specialize vp8_mbblock_error mmx sse2
vp8_mbblock_error_sse2
=
vp8_mbblock_error_xmm
prototype int vp8_block_error
"short *coeff, short *dqcoeff, int block_size"
specialize vp8_block_error mmx sse2
vp8_block_error_sse2
=
vp8_block_error_xmm
prototype void vp8_subtract_b
"struct block *be, struct blockd *bd, int pitch"
specialize vp8_subtract_b mmx sse2
prototype int vp8_mbuverror
"struct macroblock *mb"
specialize vp8_mbuverror mmx sse2
vp8_mbuverror_sse2
=
vp8_mbuverror_xmm
prototype void vp8_subtract_b
"struct block *be, struct blockd *bd, int pitch"
specialize vp8_subtract_b mmx sse2
prototype void vp8_subtract_mby
"short *diff, unsigned char *src, unsigned char *pred, int stride"
specialize vp8_subtract_mby mmx sse2
prototype void vp8_subtract_mbuv
"short *diff, unsigned char *usrc, unsigned char *vsrc, unsigned char *pred, int stride"
specialize vp8_subtract_mbuv mmx sse2
#
# Structured Similarity (SSIM)
...
...
vp8/encoder/block.h
View file @
1838d877
...
...
@@ -24,7 +24,7 @@ typedef struct {
int
offset
;
}
search_site
;
typedef
struct
{
typedef
struct
block
{
// 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
short
*
src_diff
;
short
*
coeff
;
...
...
@@ -82,7 +82,7 @@ typedef struct {
int64_t
txfm_rd_diff
[
NB_TXFM_MODES
];
}
PICK_MODE_CONTEXT
;
typedef
struct
{
typedef
struct
macroblock
{
DECLARE_ALIGNED
(
16
,
short
,
src_diff
[
400
]);
// 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
DECLARE_ALIGNED
(
16
,
short
,
coeff
[
400
]);
// 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
DECLARE_ALIGNED
(
16
,
unsigned
char
,
thismb
[
256
]);
// 16x16 Y
...
...
vp8/encoder/encodeintra.c
View file @
1838d877
...
...
@@ -9,6 +9,7 @@
*/
#include
"vpx_ports/config.h"
#include
"vpx_rtcd.h"
#include
"vp8/common/idct.h"
#include
"quantize.h"
#include
"vp8/common/reconintra.h"
...
...
@@ -18,7 +19,6 @@
#include
"dct.h"
#include
"vp8/common/g_common.h"
#include
"encodeintra.h"
#include
"vpx_rtcd.h"
#if CONFIG_RUNTIME_CPU_DETECT
#define IF_RTCD(x) (x)
...
...
@@ -70,7 +70,7 @@ void vp8_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd,
}
#endif
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
subb
)
(
be
,
b
,
16
);
vp8_subtract_b
(
be
,
b
,
16
);
tx_type
=
get_tx_type
(
&
x
->
e_mbd
,
b
);
if
(
tx_type
!=
DCT_DCT
)
{
...
...
@@ -109,8 +109,7 @@ void vp8_encode_intra16x16mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
vp8_build_comp_intra_predictors_mby
(
xd
);
#endif
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
submby
)(
x
->
src_diff
,
*
(
b
->
base_src
),
xd
->
predictor
,
b
->
src_stride
);
vp8_subtract_mby
(
x
->
src_diff
,
*
(
b
->
base_src
),
xd
->
predictor
,
b
->
src_stride
);
if
(
tx_size
==
TX_16X16
)
{
BLOCKD
*
bd
=
&
xd
->
block
[
0
];
...
...
@@ -159,9 +158,9 @@ void vp8_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
}
#endif
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
submbuv
)(
x
->
src_diff
,
x
->
src
.
u_buffe
r
,
x
->
src
.
v_
buffer
,
xd
->
predictor
,
x
->
src
.
uv_stride
);
vp8_subtract_mbuv
(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
d
->
predicto
r
,
x
->
src
.
u
v_
stride
);
if
(
tx_size
==
TX_4X4
)
{
vp8_transform_mbuv_4x4
(
x
);
vp8_quantize_mbuv_4x4
(
x
);
...
...
@@ -221,7 +220,7 @@ void vp8_encode_intra8x8(const VP8_ENCODER_RTCD *rtcd,
for
(
i
=
0
;
i
<
4
;
i
++
)
{
b
=
&
xd
->
block
[
ib
+
iblock
[
i
]];
be
=
&
x
->
block
[
ib
+
iblock
[
i
]];
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
subb
)
(
be
,
b
,
16
);
vp8_subtract_b
(
be
,
b
,
16
);
x
->
vp8_short_fdct4x4
(
be
->
src_diff
,
be
->
coeff
,
32
);
x
->
quantize_b_4x4
(
be
,
b
);
vp8_inverse_transform_b_4x4
(
IF_RTCD
(
&
rtcd
->
common
->
idct
),
b
,
32
);
...
...
@@ -261,7 +260,7 @@ void vp8_encode_intra_uv4x4(const VP8_ENCODER_RTCD *rtcd,
}
#endif
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
subb
)
(
be
,
b
,
8
);
vp8_subtract_b
(
be
,
b
,
8
);
x
->
vp8_short_fdct4x4
(
be
->
src_diff
,
be
->
coeff
,
16
);
x
->
quantize_b_4x4
(
be
,
b
);
...
...
vp8/encoder/encodemb.c
View file @
1838d877
...
...
@@ -19,6 +19,7 @@
#include
"vpx_mem/vpx_mem.h"
#include
"rdopt.h"
#include
"vp8/common/systemdependent.h"
#include
"vpx_rtcd.h"
#if CONFIG_RUNTIME_CPU_DETECT
#define IF_RTCD(x) (x)
...
...
@@ -126,8 +127,10 @@ void vp8_subtract_mby_c(short *diff, unsigned char *src,
static
void
vp8_subtract_mb
(
const
VP8_ENCODER_RTCD
*
rtcd
,
MACROBLOCK
*
x
)
{
BLOCK
*
b
=
&
x
->
block
[
0
];
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
submby
)(
x
->
src_diff
,
*
(
b
->
base_src
),
x
->
e_mbd
.
predictor
,
b
->
src_stride
);
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
submbuv
)(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_subtract_mby
(
x
->
src_diff
,
*
(
b
->
base_src
),
x
->
e_mbd
.
predictor
,
b
->
src_stride
);
vp8_subtract_mbuv
(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
}
static
void
build_dcblock_4x4
(
MACROBLOCK
*
x
)
{
...
...
@@ -942,8 +945,7 @@ void vp8_encode_inter16x16y(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
vp8_build_1st_inter16x16_predictors_mby
(
xd
,
xd
->
predictor
,
16
,
0
);
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
submby
)(
x
->
src_diff
,
*
(
b
->
base_src
),
xd
->
predictor
,
b
->
src_stride
);
vp8_subtract_mby
(
x
->
src_diff
,
*
(
b
->
base_src
),
xd
->
predictor
,
b
->
src_stride
);
vp8_transform_mby_4x4
(
x
);
vp8_quantize_mby_4x4
(
x
);
...
...
vp8/encoder/encodemb.h
View file @
1838d877
...
...
@@ -15,73 +15,6 @@
#include
"vpx_ports/config.h"
#include
"block.h"
#define prototype_mberr(sym) \
int (sym)(MACROBLOCK *mb, int dc)
#define prototype_berr(sym) \
int (sym)(short *coeff, short *dqcoeff, int block_size)
#define prototype_mbuverr(sym) \
int (sym)(MACROBLOCK *mb)
#define prototype_subb(sym) \
void (sym)(BLOCK *be,BLOCKD *bd, int pitch)
#define prototype_submby(sym) \
void (sym)(short *diff, unsigned char *src, unsigned char *pred, int stride)
#define prototype_submbuv(sym) \
void (sym)(short *diff, unsigned char *usrc, unsigned char *vsrc,\
unsigned char *pred, int stride)
#if ARCH_X86 || ARCH_X86_64
#include
"x86/encodemb_x86.h"
#endif
#if ARCH_ARM
#include
"arm/encodemb_arm.h"
#endif
#ifndef vp8_encodemb_berr
#define vp8_encodemb_berr vp8_block_error_c
#endif
extern
prototype_berr
(
vp8_encodemb_berr
);
#ifndef vp8_encodemb_mberr
#define vp8_encodemb_mberr vp8_mbblock_error_c
#endif
extern
prototype_mberr
(
vp8_encodemb_mberr
);
#ifndef vp8_encodemb_mbuverr
#define vp8_encodemb_mbuverr vp8_mbuverror_c
#endif
extern
prototype_mbuverr
(
vp8_encodemb_mbuverr
);
#ifndef vp8_encodemb_subb
#define vp8_encodemb_subb vp8_subtract_b_c
#endif
extern
prototype_subb
(
vp8_encodemb_subb
);
#ifndef vp8_encodemb_submby
#define vp8_encodemb_submby vp8_subtract_mby_c
#endif
extern
prototype_submby
(
vp8_encodemb_submby
);
#ifndef vp8_encodemb_submbuv
#define vp8_encodemb_submbuv vp8_subtract_mbuv_c
#endif
extern
prototype_submbuv
(
vp8_encodemb_submbuv
);
typedef
struct
{
prototype_berr
(
*
berr
);
prototype_mberr
(
*
mberr
);
prototype_mbuverr
(
*
mbuverr
);
prototype_subb
(
*
subb
);
prototype_submby
(
*
submby
);
prototype_submbuv
(
*
submbuv
);
}
vp8_encodemb_rtcd_vtable_t
;
typedef
struct
{
MB_PREDICTION_MODE
mode
;
MV_REFERENCE_FRAME
ref_frame
;
...
...
vp8/encoder/generic/csystemdependent.c
View file @
1838d877
...
...
@@ -32,14 +32,6 @@ void vp8_cmachine_specific_config(VP8_COMP *cpi) {
cpi
->
rtcd
.
fdct
.
fast4x4
=
vp8_short_fdct4x4_c
;
cpi
->
rtcd
.
fdct
.
fast8x4
=
vp8_short_fdct8x4_c
;
cpi
->
rtcd
.
fdct
.
walsh_short4x4
=
vp8_short_walsh4x4_c
;
cpi
->
rtcd
.
encodemb
.
berr
=
vp8_block_error_c
;
cpi
->
rtcd
.
encodemb
.
mberr
=
vp8_mbblock_error_c
;
cpi
->
rtcd
.
encodemb
.
mbuverr
=
vp8_mbuverror_c
;
cpi
->
rtcd
.
encodemb
.
subb
=
vp8_subtract_b_c
;
cpi
->
rtcd
.
encodemb
.
submby
=
vp8_subtract_mby_c
;
cpi
->
rtcd
.
encodemb
.
submbuv
=
vp8_subtract_mbuv_c
;
cpi
->
rtcd
.
search
.
full_search
=
vp8_full_search_sad
;
cpi
->
rtcd
.
search
.
refining_search
=
vp8_refining_search_sad
;
cpi
->
rtcd
.
search
.
diamond_search
=
vp8_diamond_search_sad
;
...
...
vp8/encoder/onyx_int.h
View file @
1838d877
...
...
@@ -351,7 +351,6 @@ typedef struct {
typedef
struct
VP8_ENCODER_RTCD
{
VP8_COMMON_RTCD
*
common
;
vp8_fdct_rtcd_vtable_t
fdct
;
vp8_encodemb_rtcd_vtable_t
encodemb
;
vp8_search_rtcd_vtable_t
search
;
vp8_temporal_rtcd_vtable_t
temporal
;
}
VP8_ENCODER_RTCD
;
...
...
vp8/encoder/rdopt.c
View file @
1838d877
...
...
@@ -42,7 +42,7 @@
#include
"vp8/common/seg_common.h"
#include
"vp8/common/pred_common.h"
#include
"vp8/common/entropy.h"
#include
"vpx_rtcd.h"
#if CONFIG_NEWBESTREFMV
#include
"vp8/common/mvref_common.h"
#endif
...
...
@@ -710,11 +710,8 @@ static void macro_block_yrd_4x4(MACROBLOCK *mb,
BLOCK
*
beptr
;
int
d
;
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
submby
)(
mb
->
src_diff
,
*
(
mb
->
block
[
0
].
base_src
),
xd
->
predictor
,
mb
->
block
[
0
].
src_stride
);
vp8_subtract_mby
(
mb
->
src_diff
,
*
(
mb
->
block
[
0
].
base_src
),
xd
->
predictor
,
mb
->
block
[
0
].
src_stride
);
// Fdct and building the 2nd order block
for
(
beptr
=
mb
->
block
;
beptr
<
mb
->
block
+
16
;
beptr
+=
2
)
{
...
...
@@ -735,9 +732,9 @@ static void macro_block_yrd_4x4(MACROBLOCK *mb,
mb
->
quantize_b_4x4
(
mb_y2
,
x_y2
);
// Distortion
d
=
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
mb
err
)
(
mb
,
1
);
vp8_mbblock_
err
or
(
mb
,
1
);
d
+=
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
berr
)
(
mb_y2
->
coeff
,
x_y2
->
dqcoeff
,
16
);
d
+=
vp8_block_error
(
mb_y2
->
coeff
,
x_y2
->
dqcoeff
,
16
);
*
Distortion
=
(
d
>>
2
);
// rate
...
...
@@ -784,11 +781,8 @@ static void macro_block_yrd_8x8(MACROBLOCK *mb,
BLOCKD
*
const
x_y2
=
xd
->
block
+
24
;
int
d
;
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
submby
)(
mb
->
src_diff
,
*
(
mb
->
block
[
0
].
base_src
),
xd
->
predictor
,
mb
->
block
[
0
].
src_stride
);
vp8_subtract_mby
(
mb
->
src_diff
,
*
(
mb
->
block
[
0
].
base_src
),
xd
->
predictor
,
mb
->
block
[
0
].
src_stride
);
vp8_transform_mby_8x8
(
mb
);
vp8_quantize_mby_8x8
(
mb
);
...
...
@@ -803,8 +797,8 @@ static void macro_block_yrd_8x8(MACROBLOCK *mb,
xd
->
dqcoeff
[
128
]
=
0
;
xd
->
dqcoeff
[
192
]
=
0
;
d
=
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
mb
err
)
(
mb
,
0
);
d
+=
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
berr
)
(
mb_y2
->
coeff
,
x_y2
->
dqcoeff
,
16
);
d
=
vp8_mbblock_
err
or
(
mb
,
0
);
d
+=
vp8_block_error
(
mb_y2
->
coeff
,
x_y2
->
dqcoeff
,
16
);
*
Distortion
=
(
d
>>
2
);
// rate
...
...
@@ -836,11 +830,8 @@ static void macro_block_yrd_16x16(MACROBLOCK *mb, int *Rate, int *Distortion,
BLOCK
*
be
=
&
mb
->
block
[
0
];
TX_TYPE
tx_type
;
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
submby
)(
mb
->
src_diff
,
*
(
mb
->
block
[
0
].
base_src
),
mb
->
e_mbd
.
predictor
,
mb
->
block
[
0
].
src_stride
);
vp8_subtract_mby
(
mb
->
src_diff
,
*
(
mb
->
block
[
0
].
base_src
),
mb
->
e_mbd
.
predictor
,
mb
->
block
[
0
].
src_stride
);
tx_type
=
get_tx_type_16x16
(
xd
,
b
);
if
(
tx_type
!=
DCT_DCT
)
{
...
...
@@ -855,7 +846,7 @@ static void macro_block_yrd_16x16(MACROBLOCK *mb, int *Rate, int *Distortion,
if
(
mb
->
e_mbd
.
mode_info_context
->
mbmi
.
mode
<
I8X8_PRED
)
vp8_optimize_mby_16x16
(
mb
,
rtcd
);
d
=
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
mb
err
)
(
mb
,
0
);
d
=
vp8_mbblock_
err
or
(
mb
,
0
);
*
Distortion
=
(
d
>>
2
);
// rate
...
...
@@ -1029,8 +1020,8 @@ static void super_block_yrd_8x8(MACROBLOCK *x,
xd
->
dqcoeff
[
128
]
=
0
;
xd
->
dqcoeff
[
192
]
=
0
;
d
+=
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
mb
err
)
(
x
,
0
);
d
+=
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
berr
)
(
by2
->
coeff
,
bdy2
->
dqcoeff
,
16
);
d
+=
vp8_mbblock_
err
or
(
x
,
0
);
d
+=
vp8_block_error
(
by2
->
coeff
,
bdy2
->
dqcoeff
,
16
);
xd
->
above_context
=
ta
+
x_idx
;
xd
->
left_context
=
tl
+
y_idx
;
r
+=
vp8_rdcost_mby_8x8
(
x
,
0
);
...
...
@@ -1121,7 +1112,7 @@ static int64_t rd_pick_intra4x4block(VP8_COMP *cpi, MACROBLOCK *x, BLOCK *be,
rate
+=
bmode_costs
[
mode2
];
}
#endif
ENCODEMB_INVOKE
(
IF_RTCD
(
&
cpi
->
rtcd
.
encodemb
),
subb
)
(
be
,
b
,
16
);
vp8_subtract_b
(
be
,
b
,
16
);
b
->
bmi
.
as_mode
.
first
=
mode
;
tx_type
=
get_tx_type_4x4
(
xd
,
b
);
...
...
@@ -1138,8 +1129,7 @@ static int64_t rd_pick_intra4x4block(VP8_COMP *cpi, MACROBLOCK *x, BLOCK *be,
ratey
=
cost_coeffs
(
x
,
b
,
PLANE_TYPE_Y_WITH_DC
,
&
tempa
,
&
templ
,
TX_4X4
);
rate
+=
ratey
;
distortion
=
ENCODEMB_INVOKE
(
IF_RTCD
(
&
cpi
->
rtcd
.
encodemb
),
berr
)(
be
->
coeff
,
b
->
dqcoeff
,
16
)
>>
2
;
distortion
=
vp8_block_error
(
be
->
coeff
,
b
->
dqcoeff
,
16
)
>>
2
;
this_rd
=
RDCOST
(
x
->
rdmult
,
x
->
rddiv
,
rate
,
distortion
);
...
...
@@ -1621,17 +1611,14 @@ static int rd_cost_mbuv(MACROBLOCK *mb) {
static
int64_t
rd_inter16x16_uv
(
VP8_COMP
*
cpi
,
MACROBLOCK
*
x
,
int
*
rate
,
int
*
distortion
,
int
fullpixel
,
int
*
skip
)
{
ENCODEMB_INVOKE
(
IF_RTCD
(
&
cpi
->
rtcd
.
encodemb
),
submbuv
)(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_subtract_mbuv
(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_transform_mbuv_4x4
(
x
);
vp8_quantize_mbuv_4x4
(
x
);
*
rate
=
rd_cost_mbuv
(
x
);
*
distortion
=
ENCODEMB_INVOKE
(
&
cpi
->
rtcd
.
encodemb
,
mbuverr
)
(
x
)
/
4
;
*
distortion
=
vp8_
mbuverr
or
(
x
)
/
4
;
*
skip
=
mbuv_is_skippable_4x4
(
&
x
->
e_mbd
);
return
RDCOST
(
x
->
rdmult
,
x
->
rddiv
,
*
rate
,
*
distortion
);
...
...
@@ -1696,7 +1683,7 @@ static int64_t rd_inter32x32_uv_8x8(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
xd
->
above_context
=
ta
+
x_idx
;
xd
->
left_context
=
tl
+
y_idx
;
r
+=
rd_cost_mbuv_8x8
(
x
,
0
);
d
+=
ENCODEMB_INVOKE
(
&
cpi
->
rtcd
.
encodemb
,
mbuverr
)
(
x
)
/
4
;
d
+=
vp8_
mbuverr
or
(
x
)
/
4
;
skippable
=
skippable
&&
mbuv_is_skippable_8x8
(
xd
);
}
...
...
@@ -1714,17 +1701,14 @@ static int64_t rd_inter32x32_uv_8x8(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
static
int64_t
rd_inter16x16_uv_8x8
(
VP8_COMP
*
cpi
,
MACROBLOCK
*
x
,
int
*
rate
,
int
*
distortion
,
int
fullpixel
,
int
*
skip
)
{
ENCODEMB_INVOKE
(
IF_RTCD
(
&
cpi
->
rtcd
.
encodemb
),
submbuv
)(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_subtract_mbuv
(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_transform_mbuv_8x8
(
x
);
vp8_quantize_mbuv_8x8
(
x
);
*
rate
=
rd_cost_mbuv_8x8
(
x
,
1
);
*
distortion
=
ENCODEMB_INVOKE
(
&
cpi
->
rtcd
.
encodemb
,
mbuverr
)
(
x
)
/
4
;
*
distortion
=
vp8_
mbuverr
or
(
x
)
/
4
;
*
skip
=
mbuv_is_skippable_8x8
(
&
x
->
e_mbd
);
return
RDCOST
(
x
->
rdmult
,
x
->
rddiv
,
*
rate
,
*
distortion
);
...
...
@@ -1734,14 +1718,14 @@ static int64_t rd_inter16x16_uv_8x8(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
static
int64_t
rd_inter4x4_uv
(
VP8_COMP
*
cpi
,
MACROBLOCK
*
x
,
int
*
rate
,
int
*
distortion
,
int
*
skippable
,
int
fullpixel
)
{
vp8_build_inter4x4_predictors_mbuv
(
&
x
->
e_mbd
);
ENCODEMB_INVOKE
(
IF_RTCD
(
&
cpi
->
rtcd
.
encodemb
),
submbuv
)(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_subtract_mbuv
(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_transform_mbuv_4x4
(
x
);
vp8_quantize_mbuv_4x4
(
x
);
*
rate
=
rd_cost_mbuv
(
x
);
*
distortion
=
ENCODEMB_INVOKE
(
&
cpi
->
rtcd
.
encodemb
,
mbuverr
)
(
x
)
/
4
;
*
distortion
=
vp8_
mbuverr
or
(
x
)
/
4
;
*
skippable
=
mbuv_is_skippable_4x4
(
&
x
->
e_mbd
);
return
RDCOST
(
x
->
rdmult
,
x
->
rddiv
,
*
rate
,
*
distortion
);
...
...
@@ -1786,9 +1770,8 @@ static void rd_pick_intra_mbuv_mode(VP8_COMP *cpi,
}
#endif
ENCODEMB_INVOKE
(
IF_RTCD
(
&
cpi
->
rtcd
.
encodemb
),
submbuv
)(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_subtract_mbuv
(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_transform_mbuv_4x4
(
x
);
vp8_quantize_mbuv_4x4
(
x
);
...
...
@@ -1796,7 +1779,7 @@ static void rd_pick_intra_mbuv_mode(VP8_COMP *cpi,
rate
=
rate_to
+
x
->
intra_uv_mode_cost
[
x
->
e_mbd
.
frame_type
][
mbmi
->
uv_mode
];
distortion
=
ENCODEMB_INVOKE
(
&
cpi
->
rtcd
.
encodemb
,
mbuverr
)
(
x
)
/
4
;
distortion
=
vp8_
mbuverr
or
(
x
)
/
4
;
this_rd
=
RDCOST
(
x
->
rdmult
,
x
->
rddiv
,
rate
,
distortion
);
...
...
@@ -1845,9 +1828,8 @@ static void rd_pick_intra_mbuv_mode_8x8(VP8_COMP *cpi,
mbmi
->
uv_mode
=
mode
;
vp8_build_intra_predictors_mbuv
(
&
x
->
e_mbd
);
ENCODEMB_INVOKE
(
IF_RTCD
(
&
cpi
->
rtcd
.
encodemb
),
submbuv
)(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_subtract_mbuv
(
x
->
src_diff
,
x
->
src
.
u_buffer
,
x
->
src
.
v_buffer
,
x
->
e_mbd
.
predictor
,
x
->
src
.
uv_stride
);
vp8_transform_mbuv_8x8
(
x
);
vp8_quantize_mbuv_8x8
(
x
);
...
...
@@ -1855,7 +1837,7 @@ static void rd_pick_intra_mbuv_mode_8x8(VP8_COMP *cpi,
rate_to
=
rd_cost_mbuv_8x8
(
x
,
1
);
rate
=
rate_to
+
x
->
intra_uv_mode_cost
[
x
->
e_mbd
.
frame_type
][
mbmi
->
uv_mode
];
distortion
=
ENCODEMB_INVOKE
(
&
cpi
->
rtcd
.
encodemb
,
mbuverr
)
(
x
)
/
4
;
distortion
=
vp8_
mbuverr
or
(
x
)
/
4
;
this_rd
=
RDCOST
(
x
->
rdmult
,
x
->
rddiv
,
rate
,
distortion
);
if
(
this_rd
<
best_rd
)
{
...
...
@@ -1905,7 +1887,7 @@ static void super_block_uvrd_8x8(MACROBLOCK *x,
vp8_quantize_mbuv_8x8
(
x
);
s
&=
mbuv_is_skippable_8x8
(
xd
);
d
+=
ENCODEMB_INVOKE
(
&
rtcd
->
encodemb
,
mbuverr
)
(
x
)
>>
2
;
d
+=
vp8_
mbuverr
or
(
x
)
>>
2
;
xd
->
above_context
=
ta
+
x_idx
;
xd
->
left_context
=
tl
+
y_idx
;
r
+=
rd_cost_mbuv_8x8
(
x
,
0
);
...
...
@@ -2115,10 +2097,10 @@ static int64_t encode_inter_mb_segment(MACROBLOCK *x,
vp8_build_inter_predictors_b
(
bd
,
16
,
xd
->
subpixel_predict
);
if
(
xd
->
mode_info_context
->
mbmi
.
second_ref_frame
)
vp8_build_2nd_inter_predictors_b
(
bd
,
16
,
xd
->
subpixel_predict_avg
);