ref: 4632a96d9771b49d6edfe78b68e5dfbafa75fff3
parent: 8fc8583a4c9e28e3d852fa270aac5925a053966d
parent: f6fd5b2704690d8c83745175001a359863a96e69
author: Dmitry Kovalev <dkovalev@google.com>
date: Tue Feb 25 06:06:05 EST 2014
Merge "Using vp9_subtract_plane instead of vp9_subtract_{sb, sby, sbuv}."
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -51,7 +51,7 @@
}
}
-static void subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
+void vp9_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &x->e_mbd.plane[plane];
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
@@ -62,22 +62,6 @@
pd->dst.buf, pd->dst.stride);
}
-void vp9_subtract_sby(MACROBLOCK *x, BLOCK_SIZE bsize) {
- subtract_plane(x, bsize, 0);
-}
-
-void vp9_subtract_sbuv(MACROBLOCK *x, BLOCK_SIZE bsize) {
- int i;
-
- for (i = 1; i < MAX_MB_PLANE; i++)
- subtract_plane(x, bsize, i);
-}
-
-void vp9_subtract_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
- vp9_subtract_sby(x, bsize);
- vp9_subtract_sbuv(x, bsize);
-}
-
#define RDTRUNC(RM, DM, R, D) ((128 + (R) * (RM)) & 0xFF)
typedef struct vp9_token_state vp9_token_state;
@@ -494,7 +478,7 @@
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct encode_b_args arg = {x, &ctx, &mbmi->skip};
- vp9_subtract_sby(x, bsize);
+ vp9_subtract_plane(x, bsize, 0);
if (x->optimize)
optimize_init_b(0, bsize, &arg);
@@ -507,17 +491,18 @@
struct optimize_ctx ctx;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct encode_b_args arg = {x, &ctx, &mbmi->skip};
+ int plane;
- if (!x->skip_recode)
- vp9_subtract_sb(x, bsize);
+ for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
+ if (!x->skip_recode)
+ vp9_subtract_plane(x, bsize, plane);
- if (x->optimize && (!x->skip_recode || !x->skip_optimize)) {
- int i;
- for (i = 0; i < MAX_MB_PLANE; ++i)
- optimize_init_b(i, bsize, &arg);
- }
+ if (x->optimize && (!x->skip_recode || !x->skip_optimize))
+ optimize_init_b(plane, bsize, &arg);
- vp9_foreach_transformed_block(xd, bsize, encode_block, &arg);
+ vp9_foreach_transformed_block_in_plane(xd, bsize, plane, encode_block,
+ &arg);
+ }
}
static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
--- a/vp9/encoder/vp9_encodemb.h
+++ b/vp9/encoder/vp9_encodemb.h
@@ -26,9 +26,7 @@
void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
-void vp9_subtract_sby(MACROBLOCK *x, BLOCK_SIZE bsize);
-void vp9_subtract_sbuv(MACROBLOCK *x, BLOCK_SIZE bsize);
-void vp9_subtract_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
+void vp9_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
void vp9_encode_block_intra(MACROBLOCK *x, int plane, int block,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -953,7 +953,7 @@
assert(bs == mbmi->sb_type);
if (b_inter_mode)
- vp9_subtract_sby(x, bs);
+ vp9_subtract_plane(x, bs, 0);
if (cpi->sf.tx_size_search_method == USE_LARGESTALL ||
(cpi->sf.tx_size_search_method != USE_FULL_RD &&
@@ -1295,8 +1295,11 @@
if (ref_best_rd < 0)
goto term;
- if (is_inter_block(mbmi))
- vp9_subtract_sbuv(x, bsize);
+ if (is_inter_block(mbmi)) {
+ int plane;
+ for (plane = 1; plane < MAX_MB_PLANE; ++plane)
+ vp9_subtract_plane(x, bsize, plane);
+ }
*rate = 0;
*distortion = 0;
--
⑨