Merge "Convert coeff to per-plane MACROBLOCK data" into experimental
This commit is contained in:
@@ -90,12 +90,12 @@ typedef struct {
|
|||||||
|
|
||||||
struct macroblock_plane {
|
struct macroblock_plane {
|
||||||
DECLARE_ALIGNED(16, int16_t, src_diff[64*64]);
|
DECLARE_ALIGNED(16, int16_t, src_diff[64*64]);
|
||||||
|
DECLARE_ALIGNED(16, int16_t, coeff[64*64]);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct macroblock MACROBLOCK;
|
typedef struct macroblock MACROBLOCK;
|
||||||
struct macroblock {
|
struct macroblock {
|
||||||
struct macroblock_plane plane[MAX_MB_PLANE];
|
struct macroblock_plane plane[MAX_MB_PLANE];
|
||||||
DECLARE_ALIGNED(16, int16_t, coeff[64*64+32*32*2]);
|
|
||||||
// 16 Y blocks, 4 U blocks, 4 V blocks,
|
// 16 Y blocks, 4 U blocks, 4 V blocks,
|
||||||
BLOCK block[24];
|
BLOCK block[24];
|
||||||
|
|
||||||
|
@@ -1736,8 +1736,12 @@ void vp9_encode_frame(VP9_COMP *cpi) {
|
|||||||
void vp9_setup_block_ptrs(MACROBLOCK *x) {
|
void vp9_setup_block_ptrs(MACROBLOCK *x) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 24; i++)
|
for (i = 0; i < 16; i++)
|
||||||
x->block[i].coeff = x->coeff + i * 16;
|
x->block[i].coeff = x->plane[0].coeff + i * 16;
|
||||||
|
for (i = 16; i < 20; i++)
|
||||||
|
x->block[i].coeff = x->plane[1].coeff + (i - 16) * 16;
|
||||||
|
for (i = 20; i < 24; i++)
|
||||||
|
x->block[i].coeff = x->plane[2].coeff + (i - 20) * 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_build_block_offsets(MACROBLOCK *x) {
|
void vp9_build_block_offsets(MACROBLOCK *x) {
|
||||||
|
@@ -78,7 +78,7 @@ void vp9_transform_sby_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
|||||||
const int x_idx = n & (bw - 1), y_idx = n >> bwl;
|
const int x_idx = n & (bw - 1), y_idx = n >> bwl;
|
||||||
|
|
||||||
vp9_short_fdct32x32(x->plane[0].src_diff + y_idx * stride * 32 + x_idx * 32,
|
vp9_short_fdct32x32(x->plane[0].src_diff + y_idx * stride * 32 + x_idx * 32,
|
||||||
x->coeff + n * 1024, stride * 2);
|
x->plane[0].coeff + n * 1024, stride * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,10 +97,10 @@ void vp9_transform_sby_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
|||||||
if (tx_type != DCT_DCT) {
|
if (tx_type != DCT_DCT) {
|
||||||
vp9_short_fht16x16(x->plane[0].src_diff +
|
vp9_short_fht16x16(x->plane[0].src_diff +
|
||||||
y_idx * stride * 16 + x_idx * 16,
|
y_idx * stride * 16 + x_idx * 16,
|
||||||
x->coeff + n * 256, stride, tx_type);
|
x->plane[0].coeff + n * 256, stride, tx_type);
|
||||||
} else {
|
} else {
|
||||||
x->fwd_txm16x16(x->plane[0].src_diff + y_idx * stride * 16 + x_idx * 16,
|
x->fwd_txm16x16(x->plane[0].src_diff + y_idx * stride * 16 + x_idx * 16,
|
||||||
x->coeff + n * 256, stride * 2);
|
x->plane[0].coeff + n * 256, stride * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,10 +118,10 @@ void vp9_transform_sby_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
|||||||
|
|
||||||
if (tx_type != DCT_DCT) {
|
if (tx_type != DCT_DCT) {
|
||||||
vp9_short_fht8x8(x->plane[0].src_diff + y_idx * stride * 8 + x_idx * 8,
|
vp9_short_fht8x8(x->plane[0].src_diff + y_idx * stride * 8 + x_idx * 8,
|
||||||
x->coeff + n * 64, stride, tx_type);
|
x->plane[0].coeff + n * 64, stride, tx_type);
|
||||||
} else {
|
} else {
|
||||||
x->fwd_txm8x8(x->plane[0].src_diff + y_idx * stride * 8 + x_idx * 8,
|
x->fwd_txm8x8(x->plane[0].src_diff + y_idx * stride * 8 + x_idx * 8,
|
||||||
x->coeff + n * 64, stride * 2);
|
x->plane[0].coeff + n * 64, stride * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,10 +139,10 @@ void vp9_transform_sby_4x4(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
|||||||
|
|
||||||
if (tx_type != DCT_DCT) {
|
if (tx_type != DCT_DCT) {
|
||||||
vp9_short_fht4x4(x->plane[0].src_diff + y_idx * stride * 4 + x_idx * 4,
|
vp9_short_fht4x4(x->plane[0].src_diff + y_idx * stride * 4 + x_idx * 4,
|
||||||
x->coeff + n * 16, stride, tx_type);
|
x->plane[0].coeff + n * 16, stride, tx_type);
|
||||||
} else {
|
} else {
|
||||||
x->fwd_txm4x4(x->plane[0].src_diff + y_idx * stride * 4 + x_idx * 4,
|
x->fwd_txm4x4(x->plane[0].src_diff + y_idx * stride * 4 + x_idx * 4,
|
||||||
x->coeff + n * 16, stride * 2);
|
x->plane[0].coeff + n * 16, stride * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,15 +150,12 @@ void vp9_transform_sby_4x4(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
|||||||
void vp9_transform_sbuv_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
void vp9_transform_sbuv_32x32(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
||||||
assert(bsize == BLOCK_SIZE_SB64X64);
|
assert(bsize == BLOCK_SIZE_SB64X64);
|
||||||
vp9_clear_system_state();
|
vp9_clear_system_state();
|
||||||
vp9_short_fdct32x32(x->plane[1].src_diff,
|
vp9_short_fdct32x32(x->plane[1].src_diff, x->plane[1].coeff, 64);
|
||||||
x->coeff + 4096, 64);
|
vp9_short_fdct32x32(x->plane[2].src_diff, x->plane[2].coeff, 64);
|
||||||
vp9_short_fdct32x32(x->plane[2].src_diff,
|
|
||||||
x->coeff + 4096 + 1024, 64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_transform_sbuv_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
void vp9_transform_sbuv_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize), bhl = mb_height_log2(bsize);
|
const int bwl = mb_width_log2(bsize), bhl = mb_height_log2(bsize);
|
||||||
const int uoff = (16 * 16) << (bwl + bhl), voff = (uoff * 5) >> 2;
|
|
||||||
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
|
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
|
||||||
const int stride = 16 << (bwl - 1);
|
const int stride = 16 << (bwl - 1);
|
||||||
int n;
|
int n;
|
||||||
@@ -168,15 +165,14 @@ void vp9_transform_sbuv_16x16(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
|||||||
const int x_idx = n & (bw - 1), y_idx = n >> (bwl - 1);
|
const int x_idx = n & (bw - 1), y_idx = n >> (bwl - 1);
|
||||||
|
|
||||||
x->fwd_txm16x16(x->plane[1].src_diff + y_idx * stride * 16 + x_idx * 16,
|
x->fwd_txm16x16(x->plane[1].src_diff + y_idx * stride * 16 + x_idx * 16,
|
||||||
x->coeff + uoff + n * 256, stride * 2);
|
x->plane[1].coeff + n * 256, stride * 2);
|
||||||
x->fwd_txm16x16(x->plane[2].src_diff + y_idx * stride * 16 + x_idx * 16,
|
x->fwd_txm16x16(x->plane[2].src_diff + y_idx * stride * 16 + x_idx * 16,
|
||||||
x->coeff + voff + n * 256, stride * 2);
|
x->plane[2].coeff + n * 256, stride * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_transform_sbuv_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
void vp9_transform_sbuv_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize) + 1, bhl = mb_height_log2(bsize) + 1;
|
const int bwl = mb_width_log2(bsize) + 1, bhl = mb_height_log2(bsize) + 1;
|
||||||
const int uoff = (8 * 8) << (bwl + bhl), voff = (uoff * 5) >> 2;
|
|
||||||
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
|
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
|
||||||
const int stride = 8 << (bwl - 1);
|
const int stride = 8 << (bwl - 1);
|
||||||
int n;
|
int n;
|
||||||
@@ -186,15 +182,14 @@ void vp9_transform_sbuv_8x8(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
|||||||
const int x_idx = n & (bw - 1), y_idx = n >> (bwl - 1);
|
const int x_idx = n & (bw - 1), y_idx = n >> (bwl - 1);
|
||||||
|
|
||||||
x->fwd_txm8x8(x->plane[1].src_diff + y_idx * stride * 8 + x_idx * 8,
|
x->fwd_txm8x8(x->plane[1].src_diff + y_idx * stride * 8 + x_idx * 8,
|
||||||
x->coeff + uoff + n * 64, stride * 2);
|
x->plane[1].coeff + n * 64, stride * 2);
|
||||||
x->fwd_txm8x8(x->plane[2].src_diff + y_idx * stride * 8 + x_idx * 8,
|
x->fwd_txm8x8(x->plane[2].src_diff + y_idx * stride * 8 + x_idx * 8,
|
||||||
x->coeff + voff + n * 64, stride * 2);
|
x->plane[2].coeff + n * 64, stride * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_transform_sbuv_4x4(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
void vp9_transform_sbuv_4x4(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
|
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
|
||||||
const int uoff = (4 * 4) << (bwl + bhl), voff = (uoff * 5) >> 2;
|
|
||||||
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
|
const int bw = 1 << (bwl - 1), bh = 1 << (bhl - 1);
|
||||||
const int stride = 4 << (bwl - 1);
|
const int stride = 4 << (bwl - 1);
|
||||||
int n;
|
int n;
|
||||||
@@ -204,9 +199,9 @@ void vp9_transform_sbuv_4x4(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
|
|||||||
const int x_idx = n & (bw - 1), y_idx = n >> (bwl - 1);
|
const int x_idx = n & (bw - 1), y_idx = n >> (bwl - 1);
|
||||||
|
|
||||||
x->fwd_txm4x4(x->plane[1].src_diff + y_idx * stride * 4 + x_idx * 4,
|
x->fwd_txm4x4(x->plane[1].src_diff + y_idx * stride * 4 + x_idx * 4,
|
||||||
x->coeff + uoff + n * 16, stride * 2);
|
x->plane[1].coeff + n * 16, stride * 2);
|
||||||
x->fwd_txm4x4(x->plane[2].src_diff + y_idx * stride * 4 + x_idx * 4,
|
x->fwd_txm4x4(x->plane[2].src_diff + y_idx * stride * 4 + x_idx * 4,
|
||||||
x->coeff + voff + n * 16, stride * 2);
|
x->plane[2].coeff + n * 16, stride * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +260,8 @@ static void optimize_b(VP9_COMMON *const cm,
|
|||||||
vp9_token_state tokens[1025][2];
|
vp9_token_state tokens[1025][2];
|
||||||
unsigned best_index[1025][2];
|
unsigned best_index[1025][2];
|
||||||
const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, ib);
|
const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, ib);
|
||||||
const int16_t *coeff_ptr = mb->coeff + ib * 16;
|
const int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff,
|
||||||
|
pb_idx.block, 16);
|
||||||
int16_t *qcoeff_ptr;
|
int16_t *qcoeff_ptr;
|
||||||
int16_t *dqcoeff_ptr;
|
int16_t *dqcoeff_ptr;
|
||||||
int eob = xd->plane[pb_idx.plane].eobs[pb_idx.block], final_eob, sz = 0;
|
int eob = xd->plane[pb_idx.plane].eobs[pb_idx.block], final_eob, sz = 0;
|
||||||
|
@@ -33,7 +33,7 @@ void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
|
|||||||
int i, rc, eob;
|
int i, rc, eob;
|
||||||
int zbin;
|
int zbin;
|
||||||
int x, y, z, sz;
|
int x, y, z, sz;
|
||||||
int16_t *coeff_ptr = mb->coeff + b_idx * 16;
|
int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[0].coeff, b_idx, 16);
|
||||||
// ht is luma-only
|
// ht is luma-only
|
||||||
int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[0].qcoeff, b_idx, 16);
|
int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[0].qcoeff, b_idx, 16);
|
||||||
int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[0].dqcoeff, b_idx, 16);
|
int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[0].dqcoeff, b_idx, 16);
|
||||||
@@ -90,7 +90,8 @@ void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, int y_blocks) {
|
|||||||
int i, rc, eob;
|
int i, rc, eob;
|
||||||
int zbin;
|
int zbin;
|
||||||
int x, y, z, sz;
|
int x, y, z, sz;
|
||||||
int16_t *coeff_ptr = mb->coeff + b_idx * 16;
|
int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff,
|
||||||
|
pb_idx.block, 16);
|
||||||
int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff,
|
int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff,
|
||||||
pb_idx.block, 16);
|
pb_idx.block, 16);
|
||||||
int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff,
|
int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff,
|
||||||
@@ -151,6 +152,8 @@ void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
|
|||||||
pb_idx.block, 16);
|
pb_idx.block, 16);
|
||||||
int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff,
|
int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff,
|
||||||
pb_idx.block, 16);
|
pb_idx.block, 16);
|
||||||
|
int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff,
|
||||||
|
pb_idx.block, 16);
|
||||||
BLOCK *const b = &mb->block[c_idx];
|
BLOCK *const b = &mb->block[c_idx];
|
||||||
BLOCKD *const d = &xd->block[c_idx];
|
BLOCKD *const d = &xd->block[c_idx];
|
||||||
const int *pt_scan = get_scan_8x8(tx_type);
|
const int *pt_scan = get_scan_8x8(tx_type);
|
||||||
@@ -167,7 +170,6 @@ void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
|
|||||||
int x, y, z, sz;
|
int x, y, z, sz;
|
||||||
int zero_run;
|
int zero_run;
|
||||||
int16_t *zbin_boost_ptr = b->zrun_zbin_boost;
|
int16_t *zbin_boost_ptr = b->zrun_zbin_boost;
|
||||||
int16_t *coeff_ptr = mb->coeff + 16 * b_idx;
|
|
||||||
int16_t *zbin_ptr = b->zbin;
|
int16_t *zbin_ptr = b->zbin;
|
||||||
int16_t *round_ptr = b->round;
|
int16_t *round_ptr = b->round;
|
||||||
int16_t *quant_ptr = b->quant;
|
int16_t *quant_ptr = b->quant;
|
||||||
@@ -295,7 +297,7 @@ void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
|
|||||||
if (c_idx == 16) assert(pb_idx.plane == 1);
|
if (c_idx == 16) assert(pb_idx.plane == 1);
|
||||||
if (c_idx == 20) assert(pb_idx.plane == 2);
|
if (c_idx == 20) assert(pb_idx.plane == 2);
|
||||||
quantize(b->zrun_zbin_boost,
|
quantize(b->zrun_zbin_boost,
|
||||||
mb->coeff + 16 * b_idx,
|
BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff, pb_idx.block, 16),
|
||||||
256, b->skip_block,
|
256, b->skip_block,
|
||||||
b->zbin, b->round, b->quant, b->quant_shift,
|
b->zbin, b->round, b->quant, b->quant_shift,
|
||||||
BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block, 16),
|
BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block, 16),
|
||||||
@@ -317,7 +319,7 @@ void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx, int y_blocks) {
|
|||||||
if (c_idx == 16) assert(pb_idx.plane == 1);
|
if (c_idx == 16) assert(pb_idx.plane == 1);
|
||||||
if (c_idx == 20) assert(pb_idx.plane == 2);
|
if (c_idx == 20) assert(pb_idx.plane == 2);
|
||||||
quantize(b->zrun_zbin_boost,
|
quantize(b->zrun_zbin_boost,
|
||||||
mb->coeff + b_idx * 16,
|
BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff, pb_idx.block, 16),
|
||||||
1024, b->skip_block,
|
1024, b->skip_block,
|
||||||
b->zbin,
|
b->zbin,
|
||||||
b->round, b->quant, b->quant_shift,
|
b->round, b->quant, b->quant_shift,
|
||||||
|
@@ -630,13 +630,13 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
rd[TX_4X4][1] : rd[TX_8X8][1];
|
rd[TX_4X4][1] : rd[TX_8X8][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vp9_sb_block_error_c(int16_t *coeff, int16_t *dqcoeff,
|
static int block_error(int16_t *coeff, int16_t *dqcoeff,
|
||||||
int block_size, int shift) {
|
int block_size, int shift) {
|
||||||
int i;
|
int i;
|
||||||
int64_t error = 0;
|
int64_t error = 0;
|
||||||
|
|
||||||
for (i = 0; i < block_size; i++) {
|
for (i = 0; i < block_size; i++) {
|
||||||
unsigned int this_diff = coeff[i] - dqcoeff[i];
|
int this_diff = coeff[i] - dqcoeff[i];
|
||||||
error += this_diff * this_diff;
|
error += this_diff * this_diff;
|
||||||
}
|
}
|
||||||
error >>= shift;
|
error >>= shift;
|
||||||
@@ -644,24 +644,24 @@ static int vp9_sb_block_error_c(int16_t *coeff, int16_t *dqcoeff,
|
|||||||
return error > INT_MAX ? INT_MAX : (int)error;
|
return error > INT_MAX ? INT_MAX : (int)error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vp9_sb_uv_block_error_c(int16_t *coeff,
|
static int block_error_sby(MACROBLOCK *x, int block_size, int shift) {
|
||||||
int16_t *dqcoeff0, int16_t *dqcoeff1,
|
return block_error(x->plane[0].coeff, x->e_mbd.plane[0].dqcoeff,
|
||||||
int block_size, int shift) {
|
block_size, shift);
|
||||||
int i;
|
}
|
||||||
int64_t error = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < block_size / 2; i++) {
|
static int block_error_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize, int shift) {
|
||||||
unsigned int this_diff = coeff[i] - dqcoeff0[i];
|
const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
|
||||||
error += this_diff * this_diff;
|
int64_t sum = 0;
|
||||||
}
|
int plane;
|
||||||
coeff += block_size / 2;
|
|
||||||
for (i = 0; i < block_size / 2; i++) {
|
|
||||||
unsigned int this_diff = coeff[i] - dqcoeff1[i];
|
|
||||||
error += this_diff * this_diff;
|
|
||||||
}
|
|
||||||
error >>= shift;
|
|
||||||
|
|
||||||
return error > INT_MAX ? INT_MAX : (int)error;
|
for (plane = 1; plane < MAX_MB_PLANE; plane++) {
|
||||||
|
const int subsampling = x->e_mbd.plane[plane].subsampling_x +
|
||||||
|
x->e_mbd.plane[plane].subsampling_y;
|
||||||
|
sum += block_error(x->plane[plane].coeff, x->e_mbd.plane[plane].dqcoeff,
|
||||||
|
16 << (bwl + bhl - subsampling), 0);
|
||||||
|
}
|
||||||
|
sum >>= shift;
|
||||||
|
return sum > INT_MAX ? INT_MAX : (int)sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rdcost_sby_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
|
static int rdcost_sby_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
|
||||||
@@ -698,8 +698,7 @@ static void super_block_yrd_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
|
|||||||
vp9_transform_sby_4x4(x, bsize);
|
vp9_transform_sby_4x4(x, bsize);
|
||||||
vp9_quantize_sby_4x4(x, bsize);
|
vp9_quantize_sby_4x4(x, bsize);
|
||||||
|
|
||||||
*distortion = vp9_sb_block_error_c(x->coeff, xd->plane[0].dqcoeff,
|
*distortion = block_error_sby(x, 16 << (bwl + bhl), 2);
|
||||||
16 << (bwl + bhl), 2);
|
|
||||||
*rate = rdcost_sby_4x4(cm, x, bsize);
|
*rate = rdcost_sby_4x4(cm, x, bsize);
|
||||||
*skippable = vp9_sby_is_skippable(xd, bsize);
|
*skippable = vp9_sby_is_skippable(xd, bsize);
|
||||||
}
|
}
|
||||||
@@ -731,15 +730,14 @@ static int rdcost_sby_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
|
|||||||
static void super_block_yrd_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
|
static void super_block_yrd_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
|
||||||
int *rate, int *distortion, int *skippable,
|
int *rate, int *distortion, int *skippable,
|
||||||
BLOCK_SIZE_TYPE bsize) {
|
BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize) + 1, bhl = mb_height_log2(bsize) + 1;
|
const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
|
||||||
xd->mode_info_context->mbmi.txfm_size = TX_8X8;
|
xd->mode_info_context->mbmi.txfm_size = TX_8X8;
|
||||||
vp9_transform_sby_8x8(x, bsize);
|
vp9_transform_sby_8x8(x, bsize);
|
||||||
vp9_quantize_sby_8x8(x, bsize);
|
vp9_quantize_sby_8x8(x, bsize);
|
||||||
|
|
||||||
*distortion = vp9_sb_block_error_c(x->coeff, xd->plane[0].dqcoeff,
|
*distortion = block_error_sby(x, 16 << (bhl + bwl), 2);
|
||||||
64 << (bhl + bwl), 2);
|
|
||||||
*rate = rdcost_sby_8x8(cm, x, bsize);
|
*rate = rdcost_sby_8x8(cm, x, bsize);
|
||||||
*skippable = vp9_sby_is_skippable(xd, bsize);
|
*skippable = vp9_sby_is_skippable(xd, bsize);
|
||||||
}
|
}
|
||||||
@@ -769,15 +767,14 @@ static int rdcost_sby_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
|
|||||||
static void super_block_yrd_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
|
static void super_block_yrd_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
|
||||||
int *rate, int *distortion, int *skippable,
|
int *rate, int *distortion, int *skippable,
|
||||||
BLOCK_SIZE_TYPE bsize) {
|
BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize), bhl = mb_height_log2(bsize);
|
const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
|
||||||
xd->mode_info_context->mbmi.txfm_size = TX_16X16;
|
xd->mode_info_context->mbmi.txfm_size = TX_16X16;
|
||||||
vp9_transform_sby_16x16(x, bsize);
|
vp9_transform_sby_16x16(x, bsize);
|
||||||
vp9_quantize_sby_16x16(x, bsize);
|
vp9_quantize_sby_16x16(x, bsize);
|
||||||
|
|
||||||
*distortion = vp9_sb_block_error_c(x->coeff, xd->plane[0].dqcoeff,
|
*distortion = block_error_sby(x, 16 << (bwl + bhl), 2);
|
||||||
256 << (bwl + bhl), 2);
|
|
||||||
*rate = rdcost_sby_16x16(cm, x, bsize);
|
*rate = rdcost_sby_16x16(cm, x, bsize);
|
||||||
*skippable = vp9_sby_is_skippable(xd, bsize);
|
*skippable = vp9_sby_is_skippable(xd, bsize);
|
||||||
}
|
}
|
||||||
@@ -809,15 +806,14 @@ static int rdcost_sby_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
|
|||||||
static void super_block_yrd_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
|
static void super_block_yrd_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
|
||||||
int *rate, int *distortion, int *skippable,
|
int *rate, int *distortion, int *skippable,
|
||||||
BLOCK_SIZE_TYPE bsize) {
|
BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize) - 1, bhl = mb_height_log2(bsize) - 1;
|
const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
|
||||||
xd->mode_info_context->mbmi.txfm_size = TX_32X32;
|
xd->mode_info_context->mbmi.txfm_size = TX_32X32;
|
||||||
vp9_transform_sby_32x32(x, bsize);
|
vp9_transform_sby_32x32(x, bsize);
|
||||||
vp9_quantize_sby_32x32(x, bsize);
|
vp9_quantize_sby_32x32(x, bsize);
|
||||||
|
|
||||||
*distortion = vp9_sb_block_error_c(x->coeff, xd->plane[0].dqcoeff,
|
*distortion = block_error_sby(x, 16 << (bwl + bhl), 0);
|
||||||
1024 << (bwl + bhl), 0);
|
|
||||||
*rate = rdcost_sby_32x32(cm, x, bsize);
|
*rate = rdcost_sby_32x32(cm, x, bsize);
|
||||||
*skippable = vp9_sby_is_skippable(xd, bsize);
|
*skippable = vp9_sby_is_skippable(xd, bsize);
|
||||||
}
|
}
|
||||||
@@ -1367,17 +1363,13 @@ static int rd_cost_sbuv_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
|
|||||||
static void super_block_uvrd_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
|
static void super_block_uvrd_4x4(VP9_COMMON *const cm, MACROBLOCK *x,
|
||||||
int *rate, int *distortion, int *skip,
|
int *rate, int *distortion, int *skip,
|
||||||
BLOCK_SIZE_TYPE bsize) {
|
BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
|
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
|
||||||
vp9_transform_sbuv_4x4(x, bsize);
|
vp9_transform_sbuv_4x4(x, bsize);
|
||||||
vp9_quantize_sbuv_4x4(x, bsize);
|
vp9_quantize_sbuv_4x4(x, bsize);
|
||||||
|
|
||||||
*rate = rd_cost_sbuv_4x4(cm, x, bsize);
|
*rate = rd_cost_sbuv_4x4(cm, x, bsize);
|
||||||
*distortion = vp9_sb_uv_block_error_c(x->coeff + (16 << (bwl + bhl)),
|
*distortion = block_error_sbuv(x, bsize, 2);
|
||||||
xd->plane[1].dqcoeff,
|
|
||||||
xd->plane[2].dqcoeff,
|
|
||||||
32 << (bwl + bhl - 2), 2);
|
|
||||||
*skip = vp9_sbuv_is_skippable(xd, bsize);
|
*skip = vp9_sbuv_is_skippable(xd, bsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1412,17 +1404,13 @@ static int rd_cost_sbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
|
|||||||
static void super_block_uvrd_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
|
static void super_block_uvrd_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
|
||||||
int *rate, int *distortion, int *skip,
|
int *rate, int *distortion, int *skip,
|
||||||
BLOCK_SIZE_TYPE bsize) {
|
BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize) + 1, bhl = mb_height_log2(bsize) + 1;
|
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
|
||||||
vp9_transform_sbuv_8x8(x, bsize);
|
vp9_transform_sbuv_8x8(x, bsize);
|
||||||
vp9_quantize_sbuv_8x8(x, bsize);
|
vp9_quantize_sbuv_8x8(x, bsize);
|
||||||
|
|
||||||
*rate = rd_cost_sbuv_8x8(cm, x, bsize);
|
*rate = rd_cost_sbuv_8x8(cm, x, bsize);
|
||||||
*distortion = vp9_sb_uv_block_error_c(x->coeff + (64 << (bwl + bhl)),
|
*distortion = block_error_sbuv(x, bsize, 2);
|
||||||
xd->plane[1].dqcoeff,
|
|
||||||
xd->plane[2].dqcoeff,
|
|
||||||
128 << (bwl + bhl - 2), 2);
|
|
||||||
*skip = vp9_sbuv_is_skippable(xd, bsize);
|
*skip = vp9_sbuv_is_skippable(xd, bsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1457,17 +1445,13 @@ static int rd_cost_sbuv_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
|
|||||||
static void super_block_uvrd_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
|
static void super_block_uvrd_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
|
||||||
int *rate, int *distortion, int *skip,
|
int *rate, int *distortion, int *skip,
|
||||||
BLOCK_SIZE_TYPE bsize) {
|
BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize), bhl = mb_height_log2(bsize);
|
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
|
||||||
vp9_transform_sbuv_16x16(x, bsize);
|
vp9_transform_sbuv_16x16(x, bsize);
|
||||||
vp9_quantize_sbuv_16x16(x, bsize);
|
vp9_quantize_sbuv_16x16(x, bsize);
|
||||||
|
|
||||||
*rate = rd_cost_sbuv_16x16(cm, x, bsize);
|
*rate = rd_cost_sbuv_16x16(cm, x, bsize);
|
||||||
*distortion = vp9_sb_uv_block_error_c(x->coeff + (256 << (bwl + bhl)),
|
*distortion = block_error_sbuv(x, bsize, 2);
|
||||||
xd->plane[1].dqcoeff,
|
|
||||||
xd->plane[2].dqcoeff,
|
|
||||||
512 << (bwl + bhl - 2), 2);
|
|
||||||
*skip = vp9_sbuv_is_skippable(xd, bsize);
|
*skip = vp9_sbuv_is_skippable(xd, bsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1503,17 +1487,13 @@ static int rd_cost_sbuv_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
|
|||||||
static void super_block_uvrd_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
|
static void super_block_uvrd_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
|
||||||
int *rate, int *distortion, int *skip,
|
int *rate, int *distortion, int *skip,
|
||||||
BLOCK_SIZE_TYPE bsize) {
|
BLOCK_SIZE_TYPE bsize) {
|
||||||
const int bwl = mb_width_log2(bsize) - 1, bhl = mb_height_log2(bsize) - 1;
|
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
|
||||||
vp9_transform_sbuv_32x32(x, bsize);
|
vp9_transform_sbuv_32x32(x, bsize);
|
||||||
vp9_quantize_sbuv_32x32(x, bsize);
|
vp9_quantize_sbuv_32x32(x, bsize);
|
||||||
|
|
||||||
*rate = rd_cost_sbuv_32x32(cm, x, bsize);
|
*rate = rd_cost_sbuv_32x32(cm, x, bsize);
|
||||||
*distortion = vp9_sb_uv_block_error_c(x->coeff + (1024 << (bwl + bhl)),
|
*distortion = block_error_sbuv(x, bsize, 0);
|
||||||
xd->plane[1].dqcoeff,
|
|
||||||
xd->plane[2].dqcoeff,
|
|
||||||
2048 << (bwl + bhl - 2), 0);
|
|
||||||
*skip = vp9_sbuv_is_skippable(xd, bsize);
|
*skip = vp9_sbuv_is_skippable(xd, bsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user