Remove some Y2-related code.

Change-Id: I4f46d142c2a8d1e8a880cfac63702dcbfb999b78
This commit is contained in:
Ronald S. Bultje 2013-02-15 10:15:42 -08:00
parent 7755657ea7
commit 46dff5d233
28 changed files with 167 additions and 1276 deletions

View File

@ -12,15 +12,15 @@
#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_SB][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, 4, 4, 4, 4, 6, 6, 6, 6},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 6, 6, 6, 6}
};
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_SB][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, 4, 4, 4, 4, 6, 6, 6, 6},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 6, 6, 6, 6}
};

View File

@ -52,8 +52,8 @@ typedef struct {
} POS;
typedef enum PlaneType {
PLANE_TYPE_Y_NO_DC = 0,
PLANE_TYPE_Y2,
PLANE_TYPE_Y_NO_DC_UNUSED = 0,
PLANE_TYPE_Y2_UNUSED,
PLANE_TYPE_UV,
PLANE_TYPE_Y_WITH_DC,
} PLANE_TYPE;
@ -63,7 +63,6 @@ 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) \
@ -144,7 +143,6 @@ typedef enum {
#if CONFIG_LOSSLESS
#define WHT_UPSCALE_FACTOR 3
#define Y2_WHT_UPSCALE_FACTOR 2
#endif
typedef enum {
@ -288,23 +286,23 @@ typedef struct blockd {
} BLOCKD;
typedef struct superblockd {
/* 32x32 Y and 16x16 U/V. No 2nd order transform yet. */
/* 32x32 Y and 16x16 U/V */
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;
typedef struct macroblockd {
DECLARE_ALIGNED(16, int16_t, diff[400]); /* from idct diff */
DECLARE_ALIGNED(16, int16_t, diff[384]); /* 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, qcoeff[384]);
DECLARE_ALIGNED(16, int16_t, dqcoeff[384]);
DECLARE_ALIGNED(16, uint16_t, eobs[24]);
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 */
@ -321,7 +319,7 @@ typedef struct macroblockd {
int left_available;
int right_available;
/* Y,U,V,Y2 */
/* Y,U,V */
ENTROPY_CONTEXT_PLANES *above_context;
ENTROPY_CONTEXT_PLANES *left_context;
@ -377,17 +375,10 @@ typedef struct macroblockd {
/* Inverse transform function pointers. */
void (*inv_txm4x4_1)(int16_t *input, int16_t *output, int pitch);
void (*inv_txm4x4)(int16_t *input, int16_t *output, int pitch);
void (*inv_2ndtxm4x4_1)(int16_t *in, int16_t *out);
void (*inv_2ndtxm4x4)(int16_t *in, int16_t *out);
void (*itxm_add)(int16_t *input, const int16_t *dq,
uint8_t *pred, uint8_t *output, int pitch, int stride);
void (*dc_itxm_add)(int16_t *input, const int16_t *dq,
uint8_t *pred, uint8_t *output, int pitch, int stride, int dc);
void (*dc_only_itxm_add)(int input_dc, uint8_t *pred_ptr,
uint8_t *dst_ptr, int pitch, int stride);
void (*dc_itxm_add_y_block)(int16_t *q, const int16_t *dq,
uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs,
const int16_t *dc);
void (*itxm_add_y_block)(int16_t *q, const int16_t *dq,
uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs);
void (*itxm_add_uv_block)(int16_t *q, const int16_t *dq,
@ -488,8 +479,8 @@ static TX_TYPE txfm_map(B_PREDICTION_MODE bmode) {
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_SB][24];
extern const uint8_t vp9_block2above[TX_SIZE_MAX_SB][24];
#define USE_ADST_FOR_I16X16_8X8 0
#define USE_ADST_FOR_I16X16_4X4 0
@ -623,20 +614,6 @@ static TX_TYPE get_tx_type(const MACROBLOCKD *xd, const BLOCKD *b) {
return tx_type;
}
static int get_2nd_order_usage(const MACROBLOCKD *xd) {
#if 1
return 0;
#else
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;
#endif
}
extern void vp9_build_block_doffsets(MACROBLOCKD *xd);
extern void vp9_setup_block_dptrs(MACROBLOCKD *xd);

View File

@ -298,122 +298,7 @@ void vp9_ihtllm_c(const int16_t *input, int16_t *output, int pitch,
}
}
void vp9_short_inv_walsh4x4_c(int16_t *input, int16_t *output) {
int i;
int a1, b1, c1, d1;
int16_t *ip = input;
int16_t *op = output;
for (i = 0; i < 4; i++) {
a1 = ((ip[0] + ip[3]));
b1 = ((ip[1] + ip[2]));
c1 = ((ip[1] - ip[2]));
d1 = ((ip[0] - ip[3]));
op[0] = (a1 + b1 + 1) >> 1;
op[1] = (c1 + d1) >> 1;
op[2] = (a1 - b1) >> 1;
op[3] = (d1 - c1) >> 1;
ip += 4;
op += 4;
}
ip = output;
op = output;
for (i = 0; i < 4; i++) {
a1 = ip[0] + ip[12];
b1 = ip[4] + ip[8];
c1 = ip[4] - ip[8];
d1 = ip[0] - ip[12];
op[0] = (a1 + b1 + 1) >> 1;
op[4] = (c1 + d1) >> 1;
op[8] = (a1 - b1) >> 1;
op[12] = (d1 - c1) >> 1;
ip++;
op++;
}
}
void vp9_short_inv_walsh4x4_1_c(int16_t *in, int16_t *out) {
int i;
int16_t tmp[4];
int16_t *ip = in;
int16_t *op = tmp;
op[0] = (ip[0] + 1) >> 1;
op[1] = op[2] = op[3] = (ip[0] >> 1);
ip = tmp;
op = out;
for (i = 0; i < 4; i++) {
op[0] = (ip[0] + 1) >> 1;
op[4] = op[8] = op[12] = (ip[0] >> 1);
ip++;
op++;
}
}
#if CONFIG_LOSSLESS
void vp9_short_inv_walsh4x4_lossless_c(int16_t *input, int16_t *output) {
int i;
int a1, b1, c1, d1;
int16_t *ip = input;
int16_t *op = output;
for (i = 0; i < 4; i++) {
a1 = ((ip[0] + ip[3])) >> Y2_WHT_UPSCALE_FACTOR;
b1 = ((ip[1] + ip[2])) >> Y2_WHT_UPSCALE_FACTOR;
c1 = ((ip[1] - ip[2])) >> Y2_WHT_UPSCALE_FACTOR;
d1 = ((ip[0] - ip[3])) >> Y2_WHT_UPSCALE_FACTOR;
op[0] = (a1 + b1 + 1) >> 1;
op[1] = (c1 + d1) >> 1;
op[2] = (a1 - b1) >> 1;
op[3] = (d1 - c1) >> 1;
ip += 4;
op += 4;
}
ip = output;
op = output;
for (i = 0; i < 4; i++) {
a1 = ip[0] + ip[12];
b1 = ip[4] + ip[8];
c1 = ip[4] - ip[8];
d1 = ip[0] - ip[12];
op[0] = ((a1 + b1 + 1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
op[4] = ((c1 + d1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
op[8] = ((a1 - b1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
op[12] = ((d1 - c1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
ip++;
op++;
}
}
void vp9_short_inv_walsh4x4_1_lossless_c(int16_t *in, int16_t *out) {
int i;
int16_t tmp[4];
int16_t *ip = in;
int16_t *op = tmp;
op[0] = ((ip[0] >> Y2_WHT_UPSCALE_FACTOR) + 1) >> 1;
op[1] = op[2] = op[3] = ((ip[0] >> Y2_WHT_UPSCALE_FACTOR) >> 1);
ip = tmp;
op = out;
for (i = 0; i < 4; i++) {
op[0] = ((ip[0] + 1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
op[4] = op[8] = op[12] = ((ip[0] >> 1)) << Y2_WHT_UPSCALE_FACTOR;
ip++;
op++;
}
}
void vp9_short_inv_walsh4x4_x8_c(int16_t *input, int16_t *output, int pitch) {
int i;
int a1, b1, c1, d1;
@ -913,20 +798,6 @@ void vp9_short_idct1_8x8_c(int16_t *input, int16_t *output) {
*output = (out + 16) >> 5;
}
void vp9_short_ihaar2x2_c(int16_t *input, int16_t *output, int pitch) {
int i;
int16_t *ip = input; // 0, 1, 4, 8
int16_t *op = output;
for (i = 0; i < 16; i++) {
op[i] = 0;
}
op[0] = (ip[0] + ip[1] + ip[4] + ip[8] + 1) >> 1;
op[1] = (ip[0] - ip[1] + ip[4] - ip[8]) >> 1;
op[4] = (ip[0] + ip[1] - ip[4] - ip[8]) >> 1;
op[8] = (ip[0] - ip[1] - ip[4] + ip[8]) >> 1;
}
void idct16_1d(int16_t *input, int16_t *output) {
int16_t step1[16], step2[16];
int temp1, temp2;

View File

@ -11,24 +11,6 @@
#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)
@ -39,14 +21,6 @@ void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int block, int 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 */
xd->inv_2ndtxm4x4(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]);
@ -85,13 +59,6 @@ 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]);

View File

@ -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;
}

View File

@ -133,7 +133,6 @@ 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;
@ -184,8 +183,8 @@ 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 y2dc_delta_q_unused;
int y2ac_delta_q_unused;
int uvdc_delta_q;
int uvac_delta_q;
@ -217,7 +216,7 @@ typedef struct VP9Common {
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 "" */

View File

@ -29,12 +29,6 @@ forward_decls vp9_common_forward_decls
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"
specialize vp9_dequant_idct_add_y_block_8x8
@ -44,18 +38,12 @@ 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"
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"
specialize vp9_dequant_idct_add_y_block
@ -280,9 +268,6 @@ specialize vp9_short_idct10_8x8
prototype void vp9_short_idct1_8x8 "int16_t *input, int16_t *output"
specialize vp9_short_idct1_8x8
prototype void vp9_short_ihaar2x2 "int16_t *input, int16_t *output, int pitch"
specialize vp9_short_ihaar2x2
prototype void vp9_short_idct16x16 "int16_t *input, int16_t *output, int pitch"
specialize vp9_short_idct16x16
@ -312,15 +297,6 @@ specialize vp9_short_iht4x4
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
#
# 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_inv_walsh4x4 "int16_t *in, int16_t *out"
specialize vp9_short_inv_walsh4x4_
# dct and add
@ -334,10 +310,6 @@ prototype void vp9_short_inv_walsh4x4_x8 "int16_t *input, int16_t *output, int p
specialize vp9_short_inv_walsh4x4_x8
prototype void vp9_dc_only_inv_walsh_add "int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride"
specialize vp9_dc_only_inv_walsh_add
prototype void vp9_short_inv_walsh4x4_1_lossless "int16_t *in, int16_t *out"
specialize vp9_short_inv_walsh4x4_1_lossless
prototype void vp9_short_inv_walsh4x4_lossless "int16_t *in, int16_t *out"
specialize vp9_short_inv_walsh4x4_lossless
fi
prototype unsigned int vp9_sad32x3 "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, int max_sad"
@ -552,7 +524,7 @@ 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
@ -596,27 +568,18 @@ specialize vp9_fht
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
prototype void vp9_short_fdct4x4 "int16_t *InputData, int16_t *OutputData, int pitch"
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
prototype void vp9_short_walsh4x4_lossless "int16_t *InputData, int16_t *OutputData, int pitch"
specialize vp9_short_walsh4x4_lossless
prototype void vp9_short_walsh4x4_x8 "int16_t *InputData, int16_t *OutputData, int pitch"
specialize vp9_short_walsh4x4_x8

View File

@ -83,7 +83,6 @@ void vp9_init_de_quantizer(VP9D_COMP *pbi) {
for (Q = 0; Q < QINDEX_RANGE; Q++) {
pc->Y1dequant[Q][0] = (int16_t)vp9_dc_quant(Q, pc->y1dc_delta_q);
pc->Y2dequant[Q][0] = (int16_t)vp9_dc2quant(Q, pc->y2dc_delta_q);
pc->UVdequant[Q][0] = (int16_t)vp9_dc_uv_quant(Q, pc->uvdc_delta_q);
/* all the ac values =; */
@ -91,7 +90,6 @@ void vp9_init_de_quantizer(VP9D_COMP *pbi) {
int rc = vp9_default_zig_zag1d_4x4[i];
pc->Y1dequant[Q][rc] = (int16_t)vp9_ac_yquant(Q);
pc->Y2dequant[Q][rc] = (int16_t)vp9_ac2quant(Q, pc->y2ac_delta_q);
pc->UVdequant[Q][rc] = (int16_t)vp9_ac_uv_quant(Q, pc->uvac_delta_q);
}
}
@ -126,12 +124,8 @@ static void mb_init_dequantizer(VP9D_COMP *pbi, MACROBLOCKD *xd) {
xd->inv_txm4x4_1 = vp9_short_idct4x4llm_1;
xd->inv_txm4x4 = vp9_short_idct4x4llm;
xd->inv_2ndtxm4x4_1 = vp9_short_inv_walsh4x4_1;
xd->inv_2ndtxm4x4 = vp9_short_inv_walsh4x4;
xd->itxm_add = vp9_dequant_idct_add;
xd->dc_only_itxm_add = vp9_dc_only_idct_add_c;
xd->dc_itxm_add = vp9_dequant_dc_idct_add;
xd->dc_itxm_add_y_block = vp9_dequant_dc_idct_add_y_block;
xd->itxm_add_y_block = vp9_dequant_idct_add_y_block;
xd->itxm_add_uv_block = vp9_dequant_idct_add_uv_block;
#if CONFIG_LOSSLESS
@ -139,12 +133,8 @@ static void mb_init_dequantizer(VP9D_COMP *pbi, MACROBLOCKD *xd) {
assert(QIndex == 0);
xd->inv_txm4x4_1 = vp9_short_inv_walsh4x4_1_x8;
xd->inv_txm4x4 = vp9_short_inv_walsh4x4_x8;
xd->inv_2ndtxm4x4_1 = vp9_short_inv_walsh4x4_1_lossless;
xd->inv_2ndtxm4x4 = vp9_short_inv_walsh4x4_lossless;
xd->itxm_add = vp9_dequant_idct_add_lossless_c;
xd->dc_only_itxm_add = vp9_dc_only_inv_walsh_add_c;
xd->dc_itxm_add = vp9_dequant_dc_idct_add_lossless_c;
xd->dc_itxm_add_y_block = vp9_dequant_dc_idct_add_y_block_lossless_c;
xd->itxm_add_y_block = vp9_dequant_idct_add_y_block_lossless_c;
xd->itxm_add_uv_block = vp9_dequant_idct_add_uv_block_lossless_c;
}
@ -153,9 +143,6 @@ static void mb_init_dequantizer(VP9D_COMP *pbi, MACROBLOCKD *xd) {
for (i = 16; i < 24; i++) {
xd->block[i].dequant = pc->UVdequant[QIndex];
}
xd->block[24].dequant = pc->Y2dequant[QIndex];
}
/* skip_recon_mb() is Modified: Instead of writing the result to predictor buffer and then copying it
@ -222,7 +209,6 @@ static void decode_16x16(VP9D_COMP *pbi, MACROBLOCKD *xd,
BOOL_DECODER* const bc) {
BLOCKD *bd = &xd->block[0];
TX_TYPE tx_type = get_tx_type_16x16(xd, bd);
assert(get_2nd_order_usage(xd) == 0);
#ifdef DEC_DEBUG
if (dec_debug) {
int i;
@ -274,7 +260,6 @@ static void decode_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd,
#endif
if (tx_type != DCT_DCT || xd->mode_info_context->mbmi.mode == I8X8_PRED) {
int i;
assert(get_2nd_order_usage(xd) == 0);
for (i = 0; i < 4; i++) {
int ib = vp9_i8x8_block[i];
int idx = (ib & 0x02) ? (ib + 2) : ib;
@ -294,39 +279,16 @@ static void decode_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd,
xd->eobs[idx]);
} else {
vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride,
0, xd->eobs[idx]);
xd->eobs[idx]);
}
}
} else if (xd->mode_info_context->mbmi.mode == SPLITMV ||
get_2nd_order_usage(xd) == 0) {
assert(get_2nd_order_usage(xd) == 0);
} else {
vp9_dequant_idct_add_y_block_8x8(xd->qcoeff,
xd->block[0].dequant,
xd->predictor,
xd->dst.y_buffer,
xd->dst.y_stride,
xd->eobs, xd);
} else {
BLOCKD *b = &xd->block[24];
assert(get_2nd_order_usage(xd) == 1);
vp9_dequantize_b_2x2(b);
vp9_short_ihaar2x2(&b->dqcoeff[0], b->diff, 8);
((int *)b->qcoeff)[0] = 0; // 2nd order block are set to 0 after idct
((int *)b->qcoeff)[1] = 0;
((int *)b->qcoeff)[2] = 0;
((int *)b->qcoeff)[3] = 0;
((int *)b->qcoeff)[4] = 0;
((int *)b->qcoeff)[5] = 0;
((int *)b->qcoeff)[6] = 0;
((int *)b->qcoeff)[7] = 0;
vp9_dequant_dc_idct_add_y_block_8x8(xd->qcoeff,
xd->block[0].dequant,
xd->predictor,
xd->dst.y_buffer,
xd->dst.y_stride,
xd->eobs,
xd->block[24].diff,
xd);
}
// Now do UV
@ -374,7 +336,6 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
int i, eobtotal = 0;
MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
if (mode == I8X8_PRED) {
assert(get_2nd_order_usage(xd) == 0);
for (i = 0; i < 4; i++) {
int ib = vp9_i8x8_block[i];
const int iblock[4] = {0, 1, 4, 5};
@ -407,7 +368,6 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
*(b->base_dst) + b->dst, 8, b->dst_stride);
}
} else if (mode == B_PRED) {
assert(get_2nd_order_usage(xd) == 0);
for (i = 0; i < 16; i++) {
int b_mode;
BLOCKD *b = &xd->block[i];
@ -434,8 +394,6 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
if (!xd->mode_info_context->mbmi.mb_skip_coeff) {
vp9_decode_mb_tokens_4x4_uv(pbi, xd, bc);
}
xd->above_context->y2 = 0;
xd->left_context->y2 = 0;
vp9_build_intra_predictors_mbuv(xd);
xd->itxm_add_uv_block(xd->qcoeff + 16 * 16,
xd->block[16].dequant,
@ -444,8 +402,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
xd->dst.v_buffer,
xd->dst.uv_stride,
xd->eobs + 16);
} else if (mode == SPLITMV || get_2nd_order_usage(xd) == 0) {
assert(get_2nd_order_usage(xd) == 0);
} else if (mode == SPLITMV || get_tx_type_4x4(xd, &xd->block[0]) == DCT_DCT) {
xd->itxm_add_y_block(xd->qcoeff,
xd->block[0].dequant,
xd->predictor,
@ -477,48 +434,18 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
}
}
#endif
tx_type = get_tx_type_4x4(xd, &xd->block[0]);
if (tx_type != DCT_DCT) {
assert(get_2nd_order_usage(xd) == 0);
for (i = 0; i < 16; i++) {
BLOCKD *b = &xd->block[i];
tx_type = get_tx_type_4x4(xd, b);
if (tx_type != DCT_DCT) {
vp9_ht_dequant_idct_add_c(tx_type, b->qcoeff,
b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16,
b->dst_stride, b->eob);
} else {
xd->itxm_add(b->qcoeff, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride);
}
}
} else {
BLOCKD *b = &xd->block[24];
assert(get_2nd_order_usage(xd) == 1);
vp9_dequantize_b(b);
if (xd->eobs[24] > 1) {
xd->inv_2ndtxm4x4(&b->dqcoeff[0], b->diff);
((int *)b->qcoeff)[0] = 0;
((int *)b->qcoeff)[1] = 0;
((int *)b->qcoeff)[2] = 0;
((int *)b->qcoeff)[3] = 0;
((int *)b->qcoeff)[4] = 0;
((int *)b->qcoeff)[5] = 0;
((int *)b->qcoeff)[6] = 0;
((int *)b->qcoeff)[7] = 0;
for (i = 0; i < 16; i++) {
BLOCKD *b = &xd->block[i];
tx_type = get_tx_type_4x4(xd, b);
if (tx_type != DCT_DCT) {
vp9_ht_dequant_idct_add_c(tx_type, b->qcoeff,
b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16,
b->dst_stride, b->eob);
} else {
xd->inv_2ndtxm4x4_1(&b->dqcoeff[0], b->diff);
((int *)b->qcoeff)[0] = 0;
xd->itxm_add(b->qcoeff, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride);
}
vp9_dequantize_b(b);
xd->dc_itxm_add_y_block(xd->qcoeff,
xd->block[0].dequant,
xd->predictor,
xd->dst.y_buffer,
xd->dst.y_stride,
xd->eobs,
xd->block[24].diff);
}
xd->itxm_add_uv_block(xd->qcoeff + 16 * 16,
xd->block[16].dequant,
@ -560,7 +487,6 @@ static void decode_8x8_sb(VP9D_COMP *pbi, MACROBLOCKD *xd,
BOOL_DECODER* const bc, int n,
int maska, int shiftb) {
int x_idx = n & maska, y_idx = n >> shiftb;
BLOCKD *b = &xd->block[24];
TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[0]);
if (tx_type != DCT_DCT) {
int i;
@ -587,24 +513,9 @@ static void decode_8x8_sb(VP9D_COMP *pbi, MACROBLOCKD *xd,
+ x_idx * 16 + (i & 1) * 8,
xd->dst.y_buffer + (y_idx * 16 + (i / 2) * 8) * xd->dst.y_stride
+ x_idx * 16 + (i & 1) * 8,
stride, stride, 0, b->eob);
stride, stride, b->eob);
}
}
} else if (get_2nd_order_usage(xd) == 1) {
vp9_dequantize_b_2x2(b);
vp9_short_ihaar2x2(&b->dqcoeff[0], b->diff, 8);
((int *)b->qcoeff)[0] = 0; // 2nd order block are set to 0 after idct
((int *)b->qcoeff)[1] = 0;
((int *)b->qcoeff)[2] = 0;
((int *)b->qcoeff)[3] = 0;
((int *)b->qcoeff)[4] = 0;
((int *)b->qcoeff)[5] = 0;
((int *)b->qcoeff)[6] = 0;
((int *)b->qcoeff)[7] = 0;
vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(
xd->qcoeff, xd->block[0].dequant,
xd->dst.y_buffer + y_idx * 16 * xd->dst.y_stride + x_idx * 16,
xd->dst.y_stride, xd->eobs, xd->block[24].diff, xd);
} else {
vp9_dequant_idct_add_y_block_8x8_inplace_c(
xd->qcoeff, xd->block[0].dequant,
@ -622,7 +533,6 @@ static void decode_4x4_sb(VP9D_COMP *pbi, MACROBLOCKD *xd,
BOOL_DECODER* const bc, int n,
int maska, int shiftb) {
int x_idx = n & maska, y_idx = n >> shiftb;
BLOCKD *b = &xd->block[24];
TX_TYPE tx_type = get_tx_type_4x4(xd, &xd->block[0]);
if (tx_type != DCT_DCT) {
int i;
@ -647,26 +557,6 @@ static void decode_4x4_sb(VP9D_COMP *pbi, MACROBLOCKD *xd,
xd->dst.y_stride, xd->dst.y_stride);
}
}
} else if (get_2nd_order_usage(xd) == 1) {
vp9_dequantize_b(b);
if (xd->eobs[24] > 1) {
xd->inv_2ndtxm4x4(&b->dqcoeff[0], b->diff);
((int *)b->qcoeff)[0] = 0;
((int *)b->qcoeff)[1] = 0;
((int *)b->qcoeff)[2] = 0;
((int *)b->qcoeff)[3] = 0;
((int *)b->qcoeff)[4] = 0;
((int *)b->qcoeff)[5] = 0;
((int *)b->qcoeff)[6] = 0;
((int *)b->qcoeff)[7] = 0;
} else {
xd->inv_2ndtxm4x4_1(&b->dqcoeff[0], b->diff);
((int *)b->qcoeff)[0] = 0;
}
vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(
xd->qcoeff, xd->block[0].dequant,
xd->dst.y_buffer + y_idx * 16 * xd->dst.y_stride + x_idx * 16,
xd->dst.y_stride, xd->eobs, xd->block[24].diff, xd);
} else {
vp9_dequant_idct_add_y_block_4x4_inplace_c(
xd->qcoeff, xd->block[0].dequant,
@ -780,7 +670,7 @@ static void decode_superblock64(VP9D_COMP *pbi, MACROBLOCKD *xd,
xd->above_context = pc->above_context + mb_col + x_idx;
xd->left_context = pc->left_context + y_idx;
xd->mode_info_context = orig_mi + x_idx + y_idx * mis;
for (i = 0; i < 25; i++) {
for (i = 0; i < 24; i++) {
xd->block[i].eob = 0;
xd->eobs[i] = 0;
}
@ -885,7 +775,7 @@ static void decode_superblock32(VP9D_COMP *pbi, MACROBLOCKD *xd,
xd->above_context = pc->above_context + mb_col + x_idx;
xd->left_context = pc->left_context + y_idx + (mb_row & 2);
xd->mode_info_context = orig_mi + x_idx + y_idx * mis;
for (i = 0; i < 25; i++) {
for (i = 0; i < 24; i++) {
xd->block[i].eob = 0;
xd->eobs[i] = 0;
}
@ -931,7 +821,7 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
if (xd->mode_info_context->mbmi.mb_skip_coeff) {
vp9_reset_mb_tokens_context(xd);
} else if (!bool_error(bc)) {
for (i = 0; i < 25; i++) {
for (i = 0; i < 24; i++) {
xd->block[i].eob = 0;
xd->eobs[i] = 0;
}
@ -1594,8 +1484,10 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) {
q_update = 0;
/* AC 1st order Q = default */
pc->y1dc_delta_q = get_delta_q(&header_bc, pc->y1dc_delta_q, &q_update);
pc->y2dc_delta_q = get_delta_q(&header_bc, pc->y2dc_delta_q, &q_update);
pc->y2ac_delta_q = get_delta_q(&header_bc, pc->y2ac_delta_q, &q_update);
pc->y2dc_delta_q_unused = get_delta_q(&header_bc, pc->y2dc_delta_q_unused,
&q_update);
pc->y2ac_delta_q_unused = get_delta_q(&header_bc, pc->y2ac_delta_q_unused,
&q_update);
pc->uvdc_delta_q = get_delta_q(&header_bc, pc->uvdc_delta_q, &q_update);
pc->uvac_delta_q = get_delta_q(&header_bc, pc->uvac_delta_q, &q_update);

View File

@ -185,20 +185,9 @@ void vp9_dequant_dc_idct_add_lossless_c(int16_t *input, const int16_t *dq,
}
#endif
void vp9_dequantize_b_2x2_c(BLOCKD *d) {
int i;
int16_t *DQ = d->dqcoeff;
const int16_t *Q = d->qcoeff;
const int16_t *DQC = d->dequant;
for (i = 0; i < 16; i++) {
DQ[i] = (int16_t)((Q[i] * DQC[i]));
}
}
void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq,
uint8_t *pred, uint8_t *dest, int pitch,
int stride, int dc, int eob) {
int stride, int eob) {
int16_t output[64];
int16_t *diff_ptr = output;
int i;
@ -206,8 +195,7 @@ void vp9_dequant_idct_add_8x8_c(int16_t *input, const int16_t *dq,
/* If dc is 1, then input[0] is the reconstructed value, do not need
* dequantization. Also, when dc is 1, dc is counted in eobs, namely eobs >=1.
*/
if (!dc)
input[0] *= dq[0];
input[0] *= dq[0];
/* The calculation can be simplified if there are not many non-zero dct
* coefficients. Use eobs to decide what to do.

View File

@ -95,8 +95,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
ENTROPY_CONTEXT above_ec = A0[aidx] != 0, left_ec = L0[lidx] != 0;
FRAME_CONTEXT *const fc = &dx->common.fc;
int recent_energy = 0;
int nodc = (type == PLANE_TYPE_Y_NO_DC);
int pt, c = nodc;
int pt, c = 0;
vp9_coeff_probs *coef_probs;
vp9_prob *prob;
vp9_coeff_count *coef_counts;
@ -121,10 +120,8 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
coef_counts = fc->hybrid_coef_counts_8x8;
}
#if CONFIG_CNVCONTEXT
if (type != PLANE_TYPE_Y2) {
above_ec = (A0[aidx] + A0[aidx + 1]) != 0;
left_ec = (L0[lidx] + L0[lidx + 1]) != 0;
}
above_ec = (A0[aidx] + A0[aidx + 1]) != 0;
left_ec = (L0[lidx] + L0[lidx + 1]) != 0;
#endif
break;
case TX_16X16:
@ -141,7 +138,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
ENTROPY_CONTEXT *L1 = (ENTROPY_CONTEXT *) (xd->left_context + 1);
above_ec = (A0[aidx] + A0[aidx + 1] + A1[aidx] + A1[aidx + 1]) != 0;
left_ec = (L0[lidx] + L0[lidx + 1] + L1[lidx] + L1[lidx + 1]) != 0;
} else if (type != PLANE_TYPE_Y2) {
} else {
above_ec = (A0[aidx] + A0[aidx + 1] + A0[aidx + 2] + A0[aidx + 3]) != 0;
left_ec = (L0[lidx] + L0[lidx + 1] + L0[lidx + 2] + L0[lidx + 3]) != 0;
}
@ -162,7 +159,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
A2[aidx] + A2[aidx + 1] + A3[aidx] + A3[aidx + 1]) != 0;
left_ec = (L0[lidx] + L0[lidx + 1] + L1[lidx] + L1[lidx + 1] +
L2[lidx] + L2[lidx + 1] + L3[lidx] + L3[lidx + 1]) != 0;
} else if (type != PLANE_TYPE_Y2) {
} else {
ENTROPY_CONTEXT *A1 = (ENTROPY_CONTEXT *) (xd->above_context + 1);
ENTROPY_CONTEXT *L1 = (ENTROPY_CONTEXT *) (xd->left_context + 1);
above_ec = (A0[aidx] + A0[aidx + 1] + A0[aidx + 2] + A0[aidx + 3] +
@ -253,8 +250,8 @@ SKIP_START:
if (c < seg_eob)
coef_counts[type][get_coef_band(c)][pt][DCT_EOB_TOKEN]++;
A0[aidx] = L0[lidx] = (c > !type);
if (txfm_size >= TX_8X8 && type != PLANE_TYPE_Y2) {
A0[aidx] = L0[lidx] = (c > 0);
if (txfm_size >= TX_8X8) {
A0[aidx + 1] = L0[lidx + 1] = A0[aidx];
if (txfm_size >= TX_16X16) {
if (type == PLANE_TYPE_UV) {
@ -298,10 +295,6 @@ static int get_eob(MACROBLOCKD* const xd, int segment_id, int eob_max) {
int vp9_decode_sb_tokens(VP9D_COMP* const pbi,
MACROBLOCKD* const xd,
BOOL_DECODER* const bc) {
ENTROPY_CONTEXT* const A0 = (ENTROPY_CONTEXT *) xd->above_context;
ENTROPY_CONTEXT* const L0 = (ENTROPY_CONTEXT *) xd->left_context;
ENTROPY_CONTEXT* const A1 = (ENTROPY_CONTEXT *) (xd->above_context + 1);
ENTROPY_CONTEXT* const L1 = (ENTROPY_CONTEXT *) (xd->left_context + 1);
uint16_t *const eobs = xd->eobs;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
int c, i, eobtotal = 0, seg_eob;
@ -324,17 +317,12 @@ int vp9_decode_sb_tokens(VP9D_COMP* const pbi,
eobtotal += c;
}
// no Y2 block
A0[8] = L0[8] = A1[8] = L1[8] = 0;
return eobtotal;
}
static int vp9_decode_mb_tokens_16x16(VP9D_COMP* const pbi,
MACROBLOCKD* const xd,
BOOL_DECODER* const bc) {
ENTROPY_CONTEXT* const A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT* const L = (ENTROPY_CONTEXT *)xd->left_context;
uint16_t *const eobs = xd->eobs;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
int c, i, eobtotal = 0, seg_eob;
@ -356,8 +344,6 @@ static int vp9_decode_mb_tokens_16x16(VP9D_COMP* const pbi,
TX_8X8);
eobtotal += c;
}
A[8] = 0;
L[8] = 0;
return eobtotal;
}
@ -365,32 +351,14 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
MACROBLOCKD* const xd,
BOOL_DECODER* const bc) {
uint16_t *const eobs = xd->eobs;
PLANE_TYPE type;
int c, i, eobtotal = 0, seg_eob;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
int has_2nd_order = get_2nd_order_usage(xd);
// 2nd order DC block
if (has_2nd_order) {
eobs[24] = c = decode_coefs(pbi, xd, bc, 24, PLANE_TYPE_Y2,
DCT_DCT, get_eob(xd, segment_id, 4),
xd->block[24].qcoeff,
vp9_default_zig_zag1d_4x4, TX_8X8);
eobtotal += c - 4;
type = PLANE_TYPE_Y_NO_DC;
} else {
xd->above_context->y2 = 0;
xd->left_context->y2 = 0;
eobs[24] = 0;
type = PLANE_TYPE_Y_WITH_DC;
}
// luma blocks
seg_eob = get_eob(xd, segment_id, 64);
for (i = 0; i < 16; i += 4) {
eobs[i] = c = decode_coefs(pbi, xd, bc, i, type,
type == PLANE_TYPE_Y_WITH_DC ?
get_tx_type(xd, xd->block + i) : DCT_DCT,
eobs[i] = c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_Y_WITH_DC,
get_tx_type(xd, xd->block + i),
seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d_8x8, TX_8X8);
eobtotal += c;
@ -492,26 +460,13 @@ static int vp9_decode_mb_tokens_4x4(VP9D_COMP* const dx,
MACROBLOCKD* const xd,
BOOL_DECODER* const bc) {
int i, eobtotal = 0;
PLANE_TYPE type;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_eob = get_eob(xd, segment_id, 16);
const int has_2nd_order = get_2nd_order_usage(xd);
// 2nd order DC block
if (has_2nd_order) {
eobtotal += decode_coefs_4x4(dx, xd, bc, PLANE_TYPE_Y2, 24, seg_eob,
DCT_DCT, vp9_default_zig_zag1d_4x4) - 16;
type = PLANE_TYPE_Y_NO_DC;
} else {
xd->above_context->y2 = 0;
xd->left_context->y2 = 0;
xd->eobs[24] = 0;
type = PLANE_TYPE_Y_WITH_DC;
}
// luma blocks
for (i = 0; i < 16; ++i) {
eobtotal += decode_coefs_4x4_y(dx, xd, bc, type, i, seg_eob);
eobtotal += decode_coefs_4x4_y(dx, xd, bc,
PLANE_TYPE_Y_WITH_DC, i, seg_eob);
}
// chroma blocks

View File

@ -14,56 +14,6 @@
#include "vp9/decoder/vp9_dequantize.h"
#endif
void vp9_dequant_dc_idct_add_y_block_c(int16_t *q, const int16_t *dq,
uint8_t *pre,
uint8_t *dst,
int stride, uint16_t *eobs,
const int16_t *dc) {
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
if (*eobs++ > 1)
vp9_dequant_dc_idct_add_c(q, dq, pre, dst, 16, stride, dc[0]);
else
vp9_dc_only_idct_add_c(dc[0], pre, dst, 16, stride);
q += 16;
pre += 4;
dst += 4;
dc++;
}
pre += 64 - 16;
dst += 4 * stride - 16;
}
}
void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(int16_t *q,
const int16_t *dq,
uint8_t *dst,
int stride,
uint16_t *eobs,
const int16_t *dc,
MACROBLOCKD *xd) {
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
if (*eobs++ > 1)
xd->dc_itxm_add(q, dq, dst, dst, stride, stride, dc[0]);
else
xd->dc_only_itxm_add(dc[0], dst, dst, stride, stride);
q += 16;
dst += 4;
dc++;
}
dst += 4 * stride - 16;
}
}
void vp9_dequant_idct_add_y_block_4x4_inplace_c(int16_t *q,
const int16_t *dq,
uint8_t *dst,
@ -198,71 +148,23 @@ void vp9_dequant_idct_add_uv_block_4x4_inplace_c(int16_t *q, const int16_t *dq,
}
}
void vp9_dequant_dc_idct_add_y_block_8x8_c(int16_t *q, const int16_t *dq,
uint8_t *pre,
uint8_t *dst,
int stride, uint16_t *eobs,
const int16_t *dc,
MACROBLOCKD *xd) {
q[0] = dc[0];
vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride, 1, xd->eobs[0]);
q[64] = dc[1];
vp9_dequant_idct_add_8x8_c(&q[64], dq, pre + 8, dst + 8, 16, stride, 1,
xd->eobs[4]);
q[128] = dc[4];
vp9_dequant_idct_add_8x8_c(&q[128], dq, pre + 8 * 16,
dst + 8 * stride, 16, stride, 1, xd->eobs[8]);
q[192] = dc[8];
vp9_dequant_idct_add_8x8_c(&q[192], dq, pre + 8 * 16 + 8,
dst + 8 * stride + 8, 16, stride, 1,
xd->eobs[12]);
}
void vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(int16_t *q,
const int16_t *dq,
uint8_t *dst,
int stride,
uint16_t *eobs,
const int16_t *dc,
MACROBLOCKD *xd) {
q[0] = dc[0];
vp9_dequant_idct_add_8x8_c(q, dq, dst, dst, stride, stride, 1, xd->eobs[0]);
q[64] = dc[1];
vp9_dequant_idct_add_8x8_c(&q[64], dq, dst + 8,
dst + 8, stride, stride, 1, xd->eobs[4]);
q[128] = dc[4];
vp9_dequant_idct_add_8x8_c(&q[128], dq, dst + 8 * stride,
dst + 8 * stride, stride, stride, 1,
xd->eobs[8]);
q[192] = dc[8];
vp9_dequant_idct_add_8x8_c(&q[192], dq, dst + 8 * stride + 8,
dst + 8 * stride + 8, stride, stride, 1,
xd->eobs[12]);
}
void vp9_dequant_idct_add_y_block_8x8_inplace_c(int16_t *q,
const int16_t *dq,
uint8_t *dst,
int stride,
uint16_t *eobs,
MACROBLOCKD *xd) {
vp9_dequant_idct_add_8x8_c(q, dq, dst, dst, stride, stride, 0, xd->eobs[0]);
vp9_dequant_idct_add_8x8_c(q, dq, dst, dst, stride, stride, xd->eobs[0]);
vp9_dequant_idct_add_8x8_c(&q[64], dq, dst + 8,
dst + 8, stride, stride, 0, xd->eobs[4]);
dst + 8, stride, stride, xd->eobs[4]);
vp9_dequant_idct_add_8x8_c(&q[128], dq, dst + 8 * stride,
dst + 8 * stride, stride, stride, 0,
dst + 8 * stride, stride, stride,
xd->eobs[8]);
vp9_dequant_idct_add_8x8_c(&q[192], dq, dst + 8 * stride + 8,
dst + 8 * stride + 8, stride, stride, 0,
dst + 8 * stride + 8, stride, stride,
xd->eobs[12]);
}
@ -274,13 +176,13 @@ void vp9_dequant_idct_add_y_block_8x8_c(int16_t *q, const int16_t *dq,
uint8_t *origdest = dst;
uint8_t *origpred = pre;
vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride, 0, xd->eobs[0]);
vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride, xd->eobs[0]);
vp9_dequant_idct_add_8x8_c(&q[64], dq, origpred + 8,
origdest + 8, 16, stride, 0, xd->eobs[4]);
origdest + 8, 16, stride, xd->eobs[4]);
vp9_dequant_idct_add_8x8_c(&q[128], dq, origpred + 8 * 16,
origdest + 8 * stride, 16, stride, 0, xd->eobs[8]);
origdest + 8 * stride, 16, stride, xd->eobs[8]);
vp9_dequant_idct_add_8x8_c(&q[192], dq, origpred + 8 * 16 + 8,
origdest + 8 * stride + 8, 16, stride, 0,
origdest + 8 * stride + 8, 16, stride,
xd->eobs[12]);
}
@ -290,12 +192,12 @@ void vp9_dequant_idct_add_uv_block_8x8_c(int16_t *q, const int16_t *dq,
uint8_t *dstv,
int stride, uint16_t *eobs,
MACROBLOCKD *xd) {
vp9_dequant_idct_add_8x8_c(q, dq, pre, dstu, 8, stride, 0, xd->eobs[16]);
vp9_dequant_idct_add_8x8_c(q, dq, pre, dstu, 8, stride, xd->eobs[16]);
q += 64;
pre += 64;
vp9_dequant_idct_add_8x8_c(q, dq, pre, dstv, 8, stride, 0, xd->eobs[20]);
vp9_dequant_idct_add_8x8_c(q, dq, pre, dstv, 8, stride, xd->eobs[20]);
}
void vp9_dequant_idct_add_uv_block_8x8_inplace_c(int16_t *q, const int16_t *dq,
@ -304,41 +206,15 @@ void vp9_dequant_idct_add_uv_block_8x8_inplace_c(int16_t *q, const int16_t *dq,
int stride,
uint16_t *eobs,
MACROBLOCKD *xd) {
vp9_dequant_idct_add_8x8_c(q, dq, dstu, dstu, stride, stride, 0,
vp9_dequant_idct_add_8x8_c(q, dq, dstu, dstu, stride, stride,
xd->eobs[16]);
q += 64;
vp9_dequant_idct_add_8x8_c(q, dq, dstv, dstv, stride, stride, 0,
vp9_dequant_idct_add_8x8_c(q, dq, dstv, dstv, stride, stride,
xd->eobs[20]);
}
#if CONFIG_LOSSLESS
void vp9_dequant_dc_idct_add_y_block_lossless_c(int16_t *q, const int16_t *dq,
uint8_t *pre,
uint8_t *dst,
int stride,
uint16_t *eobs,
const int16_t *dc) {
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
if (*eobs++ > 1)
vp9_dequant_dc_idct_add_lossless_c(q, dq, pre, dst, 16, stride, dc[0]);
else
vp9_dc_only_inv_walsh_add_c(dc[0], pre, dst, 16, stride);
q += 16;
pre += 4;
dst += 4;
dc++;
}
pre += 64 - 16;
dst += 4 * stride - 16;
}
}
void vp9_dequant_idct_add_y_block_lossless_c(int16_t *q, const int16_t *dq,
uint8_t *pre,
uint8_t *dst,

View File

@ -49,7 +49,7 @@ typedef struct {
vp9_prob const *coef_probs_8x8[BLOCK_TYPES_8X8];
vp9_prob const *coef_probs_16X16[BLOCK_TYPES_16X16];
uint8_t eob[25];
uint8_t eob[24];
} DETOK;

View File

@ -1786,8 +1786,8 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
// Transmit Dc, Second order and Uv quantizer delta information
put_delta_q(&header_bc, pc->y1dc_delta_q);
put_delta_q(&header_bc, pc->y2dc_delta_q);
put_delta_q(&header_bc, pc->y2ac_delta_q);
put_delta_q(&header_bc, pc->y2dc_delta_q_unused);
put_delta_q(&header_bc, pc->y2ac_delta_q_unused);
put_delta_q(&header_bc, pc->uvdc_delta_q);
put_delta_q(&header_bc, pc->uvac_delta_q);

View File

@ -89,11 +89,10 @@ typedef struct superblock {
} SUPERBLOCK;
typedef struct macroblock {
DECLARE_ALIGNED(16, int16_t, src_diff[400]); // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
DECLARE_ALIGNED(16, int16_t, coeff[400]); // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
DECLARE_ALIGNED(16, int16_t, src_diff[384]); // 16x16 Y 8x8 U 8x8 V
DECLARE_ALIGNED(16, int16_t, coeff[384]); // 16x16 Y 8x8 U 8x8 V
// 16 Y blocks, 4 U blocks, 4 V blocks,
// 1 DC 2nd order block each with 16 entries
BLOCK block[25];
BLOCK block[24];
SUPERBLOCK sb_coeff_data;
@ -171,15 +170,12 @@ typedef struct macroblock {
void (*fwd_txm4x4)(int16_t *input, int16_t *output, int pitch);
void (*fwd_txm8x4)(int16_t *input, int16_t *output, int pitch);
void (*fwd_2ndtxm4x4)(int16_t *input, int16_t *output, int pitch);
void (*fwd_txm8x8)(int16_t *input, int16_t *output, int pitch);
void (*fwd_txm16x16)(int16_t *input, int16_t *output, int pitch);
void (*fwd_2ndtxm2x2)(int16_t *input, int16_t *output, int pitch);
void (*quantize_b_4x4)(BLOCK *b, BLOCKD *d);
void (*quantize_b_4x4_pair)(BLOCK *b1, BLOCK *b2, BLOCKD *d0, BLOCKD *d1);
void (*quantize_b_16x16)(BLOCK *b, BLOCKD *d);
void (*quantize_b_8x8)(BLOCK *b, BLOCKD *d);
void (*quantize_b_2x2)(BLOCK *b, BLOCKD *d);
} MACROBLOCK;
#endif // VP9_ENCODER_VP9_BLOCK_H_

View File

@ -564,22 +564,6 @@ void vp9_short_fdct8x8_c(short *InputData, short *OutputData, int pitch) {
}
#endif
void vp9_short_fhaar2x2_c(short *input, short *output, int pitch) {
/* [1 1; 1 -1] orthogonal transform */
/* use position: 0,1, 4, 8 */
int i;
short *ip1 = input;
short *op1 = output;
for (i = 0; i < 16; i++) {
op1[i] = 0;
}
op1[0] = (ip1[0] + ip1[1] + ip1[4] + ip1[8] + 1) >> 1;
op1[1] = (ip1[0] - ip1[1] + ip1[4] - ip1[8]) >> 1;
op1[4] = (ip1[0] + ip1[1] - ip1[4] - ip1[8]) >> 1;
op1[8] = (ip1[0] - ip1[1] - ip1[4] + ip1[8]) >> 1;
}
/* For test */
#define TEST_INT 1
#if TEST_INT
@ -912,87 +896,7 @@ void vp9_short_fdct8x8_c(int16_t *input, int16_t *output, int pitch) {
}
#endif
void vp9_short_walsh4x4_c(short *input, short *output, int pitch) {
int i;
int a1, b1, c1, d1;
short *ip = input;
short *op = output;
int pitch_short = pitch >> 1;
for (i = 0; i < 4; i++) {
a1 = ip[0 * pitch_short] + ip[3 * pitch_short];
b1 = ip[1 * pitch_short] + ip[2 * pitch_short];
c1 = ip[1 * pitch_short] - ip[2 * pitch_short];
d1 = ip[0 * pitch_short] - ip[3 * pitch_short];
op[0] = (a1 + b1 + 1) >> 1;
op[4] = (c1 + d1) >> 1;
op[8] = (a1 - b1) >> 1;
op[12] = (d1 - c1) >> 1;
ip++;
op++;
}
ip = output;
op = output;
for (i = 0; i < 4; i++) {
a1 = ip[0] + ip[3];
b1 = ip[1] + ip[2];
c1 = ip[1] - ip[2];
d1 = ip[0] - ip[3];
op[0] = (a1 + b1 + 1) >> 1;
op[1] = (c1 + d1) >> 1;
op[2] = (a1 - b1) >> 1;
op[3] = (d1 - c1) >> 1;
ip += 4;
op += 4;
}
}
#if CONFIG_LOSSLESS
void vp9_short_walsh4x4_lossless_c(short *input, short *output, int pitch) {
int i;
int a1, b1, c1, d1;
short *ip = input;
short *op = output;
int pitch_short = pitch >> 1;
for (i = 0; i < 4; i++) {
a1 = (ip[0 * pitch_short] + ip[3 * pitch_short]) >> Y2_WHT_UPSCALE_FACTOR;
b1 = (ip[1 * pitch_short] + ip[2 * pitch_short]) >> Y2_WHT_UPSCALE_FACTOR;
c1 = (ip[1 * pitch_short] - ip[2 * pitch_short]) >> Y2_WHT_UPSCALE_FACTOR;
d1 = (ip[0 * pitch_short] - ip[3 * pitch_short]) >> Y2_WHT_UPSCALE_FACTOR;
op[0] = (a1 + b1 + 1) >> 1;
op[4] = (c1 + d1) >> 1;
op[8] = (a1 - b1) >> 1;
op[12] = (d1 - c1) >> 1;
ip++;
op++;
}
ip = output;
op = output;
for (i = 0; i < 4; i++) {
a1 = ip[0] + ip[3];
b1 = ip[1] + ip[2];
c1 = ip[1] - ip[2];
d1 = ip[0] - ip[3];
op[0] = ((a1 + b1 + 1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
op[1] = ((c1 + d1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
op[2] = ((a1 - b1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
op[3] = ((d1 - c1) >> 1) << Y2_WHT_UPSCALE_FACTOR;
ip += 4;
op += 4;
}
}
void vp9_short_walsh4x4_x8_c(short *input, short *output, int pitch) {
int i;
int a1, b1, c1, d1;

View File

@ -1688,10 +1688,7 @@ void vp9_setup_block_ptrs(MACROBLOCK *x) {
}
}
x->block[24].src_diff = x->src_diff + 384;
for (i = 0; i < 25; i++) {
for (i = 0; i < 24; i++) {
x->block[i].coeff = x->coeff + i * 16;
}
}

View File

@ -166,26 +166,14 @@ static void subtract_mb(MACROBLOCK *x) {
x->e_mbd.predictor, x->src.uv_stride);
}
static void build_dcblock_4x4(MACROBLOCK *x) {
int16_t *src_diff_ptr = &x->src_diff[384];
int i;
for (i = 0; i < 16; i++) {
src_diff_ptr[i] = x->coeff[i * 16];
x->coeff[i * 16] = 0;
}
}
void vp9_transform_mby_4x4(MACROBLOCK *x) {
int i;
MACROBLOCKD *xd = &x->e_mbd;
int has_2nd_order = get_2nd_order_usage(xd);
for (i = 0; i < 16; i++) {
BLOCK *b = &x->block[i];
TX_TYPE tx_type = get_tx_type_4x4(xd, &xd->block[i]);
if (tx_type != DCT_DCT) {
assert(has_2nd_order == 0);
vp9_fht_c(b->src_diff, 32, b->coeff, tx_type, 4);
} else if (!(i & 1) && get_tx_type_4x4(xd, &xd->block[i + 1]) == DCT_DCT) {
x->fwd_txm8x4(&x->block[i].src_diff[0],
@ -196,17 +184,6 @@ void vp9_transform_mby_4x4(MACROBLOCK *x) {
&x->block[i].coeff[0], 32);
}
}
if (has_2nd_order) {
// build dc block from 16 y dc values
build_dcblock_4x4(x);
// do 2nd order transform on the dc block
x->fwd_2ndtxm4x4(&x->block[24].src_diff[0],
&x->block[24].coeff[0], 8);
} else {
vpx_memset(x->block[24].coeff, 0, 16 * sizeof(x->block[24].coeff[0]));
}
}
void vp9_transform_mbuv_4x4(MACROBLOCK *x) {
@ -223,34 +200,15 @@ static void transform_mb_4x4(MACROBLOCK *x) {
vp9_transform_mbuv_4x4(x);
}
static void build_dcblock_8x8(MACROBLOCK *x) {
int16_t *src_diff_ptr = x->block[24].src_diff;
int i;
for (i = 0; i < 16; i++) {
src_diff_ptr[i] = 0;
}
src_diff_ptr[0] = x->coeff[0 * 16];
src_diff_ptr[1] = x->coeff[4 * 16];
src_diff_ptr[4] = x->coeff[8 * 16];
src_diff_ptr[8] = x->coeff[12 * 16];
x->coeff[0 * 16] = 0;
x->coeff[4 * 16] = 0;
x->coeff[8 * 16] = 0;
x->coeff[12 * 16] = 0;
}
void vp9_transform_mby_8x8(MACROBLOCK *x) {
int i;
MACROBLOCKD *xd = &x->e_mbd;
TX_TYPE tx_type;
int has_2nd_order = get_2nd_order_usage(xd);
for (i = 0; i < 9; i += 8) {
BLOCK *b = &x->block[i];
tx_type = get_tx_type_8x8(xd, &xd->block[i]);
if (tx_type != DCT_DCT) {
assert(has_2nd_order == 0);
vp9_fht_c(b->src_diff, 32, b->coeff, tx_type, 8);
} else {
x->fwd_txm8x8(&x->block[i].src_diff[0],
@ -261,24 +219,12 @@ void vp9_transform_mby_8x8(MACROBLOCK *x) {
BLOCK *b = &x->block[i];
tx_type = get_tx_type_8x8(xd, &xd->block[i]);
if (tx_type != DCT_DCT) {
assert(has_2nd_order == 0);
vp9_fht_c(b->src_diff, 32, (b + 2)->coeff, tx_type, 8);
} else {
x->fwd_txm8x8(&x->block[i].src_diff[0],
&x->block[i + 2].coeff[0], 32);
}
}
if (has_2nd_order) {
// build dc block from 2x2 y dc values
build_dcblock_8x8(x);
// do 2nd order transform on the dc block
x->fwd_2ndtxm2x2(&x->block[24].src_diff[0],
&x->block[24].coeff[0], 8);
} else {
vpx_memset(x->block[24].coeff, 0, 16 * sizeof(x->block[24].coeff[0]));
}
}
void vp9_transform_mbuv_8x8(MACROBLOCK *x) {
@ -379,7 +325,7 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
int16_t *qcoeff_ptr = d->qcoeff;
int16_t *dqcoeff_ptr = d->dqcoeff;
int eob = d->eob, final_eob, sz = 0;
int i0 = (type == PLANE_TYPE_Y_NO_DC);
const int i0 = 0;
int rc, x, next;
int64_t rdmult, rddiv, rd_cost0, rd_cost1;
int rate0, rate1, error0, error1, t0, t1;
@ -582,80 +528,11 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
final_eob++;
d->eob = final_eob;
*a = *l = (d->eob > !type);
}
/**************************************************************************
our inverse hadamard transform effectively is weighted sum of all 16 inputs
with weight either 1 or -1. It has a last stage scaling of (sum+1)>>2. And
dc only idct is (dc+16)>>5. So if all the sums are between -65 and 63 the
output after inverse wht and idct will be all zero. A sum of absolute value
smaller than 65 guarantees all 16 different (+1/-1) weighted sums in wht
fall between -65 and +65.
**************************************************************************/
#define SUM_2ND_COEFF_THRESH 65
static void check_reset_2nd_coeffs(MACROBLOCKD *xd,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) {
int sum = 0;
int i;
BLOCKD *bd = &xd->block[24];
if (bd->dequant[0] >= SUM_2ND_COEFF_THRESH
&& bd->dequant[1] >= SUM_2ND_COEFF_THRESH)
return;
for (i = 0; i < bd->eob; i++) {
int coef = bd->dqcoeff[vp9_default_zig_zag1d_4x4[i]];
sum += (coef >= 0) ? coef : -coef;
if (sum >= SUM_2ND_COEFF_THRESH)
return;
}
if (sum < SUM_2ND_COEFF_THRESH) {
for (i = 0; i < bd->eob; i++) {
int rc = vp9_default_zig_zag1d_4x4[i];
bd->qcoeff[rc] = 0;
bd->dqcoeff[rc] = 0;
}
bd->eob = 0;
*a = *l = (bd->eob != 0);
}
}
#define SUM_2ND_COEFF_THRESH_8X8 32
static void check_reset_8x8_2nd_coeffs(MACROBLOCKD *xd,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) {
int sum = 0;
BLOCKD *bd = &xd->block[24];
int coef;
coef = bd->dqcoeff[0];
sum += (coef >= 0) ? coef : -coef;
coef = bd->dqcoeff[1];
sum += (coef >= 0) ? coef : -coef;
coef = bd->dqcoeff[4];
sum += (coef >= 0) ? coef : -coef;
coef = bd->dqcoeff[8];
sum += (coef >= 0) ? coef : -coef;
if (sum < SUM_2ND_COEFF_THRESH_8X8) {
bd->qcoeff[0] = 0;
bd->dqcoeff[0] = 0;
bd->qcoeff[1] = 0;
bd->dqcoeff[1] = 0;
bd->qcoeff[4] = 0;
bd->dqcoeff[4] = 0;
bd->qcoeff[8] = 0;
bd->dqcoeff[8] = 0;
bd->eob = 0;
*a = *l = (bd->eob != 0);
}
*a = *l = (d->eob > 0);
}
void vp9_optimize_mby_4x4(MACROBLOCK *x) {
int b;
PLANE_TYPE type;
int has_2nd_order;
ENTROPY_CONTEXT_PLANES t_above, t_left;
ENTROPY_CONTEXT *ta;
ENTROPY_CONTEXT *tl;
@ -669,25 +546,11 @@ void vp9_optimize_mby_4x4(MACROBLOCK *x) {
ta = (ENTROPY_CONTEXT *)&t_above;
tl = (ENTROPY_CONTEXT *)&t_left;
has_2nd_order = get_2nd_order_usage(&x->e_mbd);
type = has_2nd_order ? PLANE_TYPE_Y_NO_DC : PLANE_TYPE_Y_WITH_DC;
for (b = 0; b < 16; b++) {
optimize_b(x, b, type,
optimize_b(x, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above[TX_4X4][b],
tl + vp9_block2left[TX_4X4][b], TX_4X4);
}
if (has_2nd_order) {
b = 24;
optimize_b(x, b, PLANE_TYPE_Y2,
ta + vp9_block2above[TX_4X4][b],
tl + vp9_block2left[TX_4X4][b], TX_4X4);
check_reset_2nd_coeffs(&x->e_mbd,
ta + vp9_block2above[TX_4X4][b],
tl + vp9_block2left[TX_4X4][b]);
}
}
void vp9_optimize_mbuv_4x4(MACROBLOCK *x) {
@ -719,11 +582,9 @@ static void optimize_mb_4x4(MACROBLOCK *x) {
void vp9_optimize_mby_8x8(MACROBLOCK *x) {
int b;
PLANE_TYPE type;
ENTROPY_CONTEXT_PLANES t_above, t_left;
ENTROPY_CONTEXT *ta;
ENTROPY_CONTEXT *tl;
int has_2nd_order = get_2nd_order_usage(&x->e_mbd);
if (!x->e_mbd.above_context || !x->e_mbd.left_context)
return;
@ -733,7 +594,6 @@ void vp9_optimize_mby_8x8(MACROBLOCK *x) {
ta = (ENTROPY_CONTEXT *)&t_above;
tl = (ENTROPY_CONTEXT *)&t_left;
type = has_2nd_order ? PLANE_TYPE_Y_NO_DC : PLANE_TYPE_Y_WITH_DC;
for (b = 0; b < 16; b += 4) {
ENTROPY_CONTEXT *const a = ta + vp9_block2above[TX_8X8][b];
ENTROPY_CONTEXT *const l = tl + vp9_block2left[TX_8X8][b];
@ -744,17 +604,10 @@ void vp9_optimize_mby_8x8(MACROBLOCK *x) {
ENTROPY_CONTEXT above_ec = a[0];
ENTROPY_CONTEXT left_ec = l[0];
#endif
optimize_b(x, b, type, &above_ec, &left_ec, TX_8X8);
optimize_b(x, b, PLANE_TYPE_Y_WITH_DC, &above_ec, &left_ec, TX_8X8);
a[1] = a[0] = above_ec;
l[1] = l[0] = left_ec;
}
// 8x8 always have 2nd order block
if (has_2nd_order) {
check_reset_8x8_2nd_coeffs(&x->e_mbd,
ta + vp9_block2above[TX_8X8][24],
tl + vp9_block2left[TX_8X8][24]);
}
}
void vp9_optimize_mbuv_8x8(MACROBLOCK *x) {

View File

@ -845,14 +845,11 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
cpi->mb.fwd_txm8x8 = vp9_short_fdct8x8;
cpi->mb.fwd_txm8x4 = vp9_short_fdct8x4;
cpi->mb.fwd_txm4x4 = vp9_short_fdct4x4;
cpi->mb.fwd_2ndtxm4x4 = vp9_short_walsh4x4;
cpi->mb.fwd_2ndtxm2x2 = vp9_short_fhaar2x2;
#if CONFIG_LOSSLESS
if (cpi->oxcf.lossless) {
cpi->mb.fwd_txm8x4 = vp9_short_walsh8x4_x8;
cpi->mb.fwd_txm4x4 = vp9_short_walsh4x4_x8;
cpi->mb.fwd_2ndtxm4x4 = vp9_short_walsh4x4_lossless;
}
#endif
@ -860,7 +857,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
cpi->mb.quantize_b_4x4_pair = vp9_regular_quantize_b_4x4_pair;
cpi->mb.quantize_b_8x8 = vp9_regular_quantize_b_8x8;
cpi->mb.quantize_b_16x16 = vp9_regular_quantize_b_16x16;
cpi->mb.quantize_b_2x2 = vp9_regular_quantize_b_2x2;
vp9_init_quantizer(cpi);
@ -1222,16 +1218,12 @@ void vp9_change_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
cpi->mb.e_mbd.inv_txm4x4_1 = vp9_short_idct4x4llm_1;
cpi->mb.e_mbd.inv_txm4x4 = vp9_short_idct4x4llm;
cpi->mb.e_mbd.inv_2ndtxm4x4_1 = vp9_short_inv_walsh4x4_1;
cpi->mb.e_mbd.inv_2ndtxm4x4 = vp9_short_inv_walsh4x4;
#if CONFIG_LOSSLESS
cpi->oxcf.lossless = oxcf->lossless;
if (cpi->oxcf.lossless) {
cpi->mb.e_mbd.inv_txm4x4_1 = vp9_short_inv_walsh4x4_1_x8;
cpi->mb.e_mbd.inv_txm4x4 = vp9_short_inv_walsh4x4_x8;
cpi->mb.e_mbd.inv_2ndtxm4x4_1 = vp9_short_inv_walsh4x4_1_lossless;
cpi->mb.e_mbd.inv_2ndtxm4x4 = vp9_short_inv_walsh4x4_lossless;
}
#endif

View File

@ -303,18 +303,12 @@ typedef struct VP9_COMP {
DECLARE_ALIGNED(16, short, Y1zbin[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, Y1round[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, Y2quant[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, unsigned char, Y2quant_shift[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, Y2zbin[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, Y2round[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, UVquant[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, unsigned char, UVquant_shift[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, UVzbin[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, UVround[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, zrun_zbin_boost_y1[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, zrun_zbin_boost_y2[QINDEX_RANGE][16]);
DECLARE_ALIGNED(16, short, zrun_zbin_boost_uv[QINDEX_RANGE][16]);
MACROBLOCK mb;

View File

@ -140,26 +140,15 @@ void vp9_regular_quantize_b_4x4(BLOCK *b, BLOCKD *d) {
void vp9_quantize_mby_4x4_c(MACROBLOCK *x) {
int i;
int has_2nd_order = get_2nd_order_usage(&x->e_mbd);
for (i = 0; i < 16; i++) {
TX_TYPE tx_type = get_tx_type_4x4(&x->e_mbd, &x->e_mbd.block[i]);
if (tx_type != DCT_DCT) {
assert(has_2nd_order == 0);
vp9_ht_quantize_b_4x4(&x->block[i], &x->e_mbd.block[i], tx_type);
} else {
x->quantize_b_4x4(&x->block[i], &x->e_mbd.block[i]);
}
}
if (has_2nd_order) {
x->quantize_b_4x4(&x->block[24], &x->e_mbd.block[24]);
} else {
vpx_memset(x->e_mbd.block[24].qcoeff, 0,
16 * sizeof(x->e_mbd.block[24].qcoeff[0]));
vpx_memset(x->e_mbd.block[24].dqcoeff, 0,
16 * sizeof(x->e_mbd.block[24].dqcoeff[0]));
x->e_mbd.block[24].eob = 0;
}
}
void vp9_quantize_mbuv_4x4_c(MACROBLOCK *x) {
@ -174,59 +163,6 @@ void vp9_quantize_mb_4x4_c(MACROBLOCK *x) {
vp9_quantize_mbuv_4x4_c(x);
}
void vp9_regular_quantize_b_2x2(BLOCK *b, BLOCKD *d) {
int i, rc, eob;
int zbin;
int x, y, z, sz;
int16_t *zbin_boost_ptr = b->zrun_zbin_boost;
int zbin_zrun_index = 0;
int16_t *coeff_ptr = b->coeff;
int16_t *zbin_ptr = b->zbin;
int16_t *round_ptr = b->round;
int16_t *quant_ptr = b->quant;
uint8_t *quant_shift_ptr = b->quant_shift;
int16_t *qcoeff_ptr = d->qcoeff;
int16_t *dqcoeff_ptr = d->dqcoeff;
int16_t *dequant_ptr = d->dequant;
int zbin_oq_value = b->zbin_extra;
// double q2nd = 4;
vpx_memset(qcoeff_ptr, 0, 32);
vpx_memset(dqcoeff_ptr, 0, 32);
eob = -1;
if (!b->skip_block) {
for (i = 0; i < 4; i++) {
rc = vp9_default_zig_zag1d_4x4[i];
z = coeff_ptr[rc];
zbin_boost_ptr = &b->zrun_zbin_boost[zbin_zrun_index];
zbin_zrun_index += 4;
zbin = (zbin_ptr[rc] + *zbin_boost_ptr + zbin_oq_value);
sz = (z >> 31); // sign of z
x = (z ^ sz) - sz; // x = abs(z)
if (x >= zbin) {
x += (round_ptr[rc]);
y = ((int)((int)(x * quant_ptr[rc]) >> 16) + x)
>> quant_shift_ptr[rc]; // quantize (x)
x = (y ^ sz) - sz; // get the sign back
qcoeff_ptr[rc] = x; // write to destination
dqcoeff_ptr[rc] = x * dequant_ptr[rc]; // dequantized value
if (y) {
eob = i; // last nonzero coeffs
zbin_zrun_index = 0;
}
}
}
}
d->eob = eob + 1;
}
void vp9_regular_quantize_b_8x8(BLOCK *b, BLOCKD *d) {
int16_t *qcoeff_ptr = d->qcoeff;
int16_t *dqcoeff_ptr = d->dqcoeff;
@ -308,29 +244,13 @@ void vp9_regular_quantize_b_8x8(BLOCK *b, BLOCKD *d) {
void vp9_quantize_mby_8x8(MACROBLOCK *x) {
int i;
int has_2nd_order = get_2nd_order_usage(&x->e_mbd);
for (i = 0; i < 16; i ++) {
x->e_mbd.block[i].eob = 0;
}
x->e_mbd.block[24].eob = 0;
for (i = 0; i < 16; i += 4) {
int ib = (i & 8) + ((i & 4) >> 1);
TX_TYPE tx_type = get_tx_type_8x8(&x->e_mbd, &x->e_mbd.block[ib]);
if (tx_type != DCT_DCT)
assert(has_2nd_order == 0);
x->quantize_b_8x8(&x->block[i], &x->e_mbd.block[i]);
}
if (has_2nd_order) {
x->quantize_b_2x2(&x->block[24], &x->e_mbd.block[24]);
} else {
vpx_memset(x->e_mbd.block[24].qcoeff, 0,
16 * sizeof(x->e_mbd.block[24].qcoeff[0]));
vpx_memset(x->e_mbd.block[24].dqcoeff, 0,
16 * sizeof(x->e_mbd.block[24].dqcoeff[0]));
x->e_mbd.block[24].eob = 0;
}
}
void vp9_quantize_mbuv_8x8(MACROBLOCK *x) {
@ -352,7 +272,6 @@ void vp9_quantize_mby_16x16(MACROBLOCK *x) {
for (i = 0; i < 16; i++)
x->e_mbd.block[i].eob = 0;
x->e_mbd.block[24].eob = 0;
x->quantize_b_16x16(&x->block[0], &x->e_mbd.block[0]);
}
@ -510,13 +429,6 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
cpi->common.Y1dequant[Q][0] = quant_val;
cpi->zrun_zbin_boost_y1[Q][0] = (quant_val * zbin_boost[0]) >> 7;
quant_val = vp9_dc2quant(Q, cpi->common.y2dc_delta_q);
invert_quant(cpi->Y2quant[Q] + 0,
cpi->Y2quant_shift[Q] + 0, quant_val);
cpi->Y2zbin[Q][0] = ((qzbin_factor * quant_val) + 64) >> 7;
cpi->Y2round[Q][0] = (qrounding_factor * quant_val) >> 7;
cpi->common.Y2dequant[Q][0] = quant_val;
cpi->zrun_zbin_boost_y2[Q][0] = (quant_val * zbin_boost[0]) >> 7;
quant_val = vp9_dc_uv_quant(Q, cpi->common.uvdc_delta_q);
invert_quant(cpi->UVquant[Q] + 0,
cpi->UVquant_shift[Q] + 0, quant_val);
@ -538,15 +450,6 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
cpi->zrun_zbin_boost_y1[Q][i] =
((quant_val * zbin_boost[i]) + 64) >> 7;
quant_val = vp9_ac2quant(Q, cpi->common.y2ac_delta_q);
invert_quant(cpi->Y2quant[Q] + rc,
cpi->Y2quant_shift[Q] + rc, quant_val);
cpi->Y2zbin[Q][rc] = ((qzbin_factor * quant_val) + 64) >> 7;
cpi->Y2round[Q][rc] = (qrounding_factor * quant_val) >> 7;
cpi->common.Y2dequant[Q][rc] = quant_val;
cpi->zrun_zbin_boost_y2[Q][i] =
((quant_val * zbin_boost[i]) + 64) >> 7;
quant_val = vp9_ac_uv_quant(Q, cpi->common.uvac_delta_q);
invert_quant(cpi->UVquant[Q] + rc,
cpi->UVquant_shift[Q] + rc, quant_val);
@ -623,25 +526,6 @@ void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) {
vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
}
// Y2
zbin_extra = (cpi->common.Y2dequant[QIndex][1] *
((cpi->zbin_over_quant / 2) +
cpi->zbin_mode_boost +
x->act_zbin_adj)) >> 7;
x->block[24].quant = cpi->Y2quant[QIndex];
x->block[24].quant_shift = cpi->Y2quant_shift[QIndex];
x->block[24].zbin = cpi->Y2zbin[QIndex];
x->block[24].round = cpi->Y2round[QIndex];
x->e_mbd.block[24].dequant = cpi->common.Y2dequant[QIndex];
x->block[24].zrun_zbin_boost = cpi->zrun_zbin_boost_y2[QIndex];
x->block[24].zbin_extra = (int16_t)zbin_extra;
// TBD perhaps not use for Y2
// Segment skip feature.
x->block[24].skip_block =
vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
/* save this macroblock QIndex for vp9_update_zbin_extra() */
x->e_mbd.q_index = QIndex;
}
@ -669,14 +553,6 @@ void vp9_update_zbin_extra(VP9_COMP *cpi, MACROBLOCK *x) {
for (i = 16; i < 24; i++) {
x->block[i].zbin_extra = (int16_t)zbin_extra;
}
// Y2
zbin_extra = (cpi->common.Y2dequant[QIndex][1] *
((cpi->zbin_over_quant / 2) +
cpi->zbin_mode_boost +
x->act_zbin_adj)) >> 7;
x->block[24].zbin_extra = (int16_t)zbin_extra;
}
void vp9_frame_init_quantizer(VP9_COMP *cpi) {
@ -695,10 +571,10 @@ void vp9_set_quantizer(struct VP9_COMP *cpi, int Q) {
// if any of the delta_q values are changing update flag will
// have to be set.
cm->y1dc_delta_q = 0;
cm->y2ac_delta_q = 0;
cm->y2ac_delta_q_unused = 0;
cm->uvdc_delta_q = 0;
cm->uvac_delta_q = 0;
cm->y2dc_delta_q = 0;
cm->y2dc_delta_q_unused = 0;
// quantizer has to be reinitialized if any delta_q changes.
// As there are not any here for now this is inactive code.

View File

@ -50,11 +50,6 @@ extern prototype_quantize_block(vp9_quantize_quantb_8x8);
#endif
extern prototype_quantize_block(vp9_quantize_quantb_16x16);
#ifndef vp9_quantize_quantb_2x2
#define vp9_quantize_quantb_2x2 vp9_regular_quantize_b_2x2
#endif
extern prototype_quantize_block(vp9_quantize_quantb_2x2);
#ifndef vp9_quantize_mb_4x4
#define vp9_quantize_mb_4x4 vp9_quantize_mb_4x4_c
#endif

View File

@ -320,26 +320,7 @@ int vp9_block_error_c(int16_t *coeff, int16_t *dqcoeff, int block_size) {
return error;
}
int vp9_mbblock_error_8x8_c(MACROBLOCK *mb, int dc) {
BLOCK *be;
BLOCKD *bd;
int i, j;
int berror, error = 0;
for (i = 0; i < 16; i+=4) {
be = &mb->block[i];
bd = &mb->e_mbd.block[i];
berror = 0;
for (j = dc; j < 64; j++) {
int this_diff = be->coeff[j] - bd->dqcoeff[j];
berror += this_diff * this_diff;
}
error += berror;
}
return error;
}
int vp9_mbblock_error_c(MACROBLOCK *mb, int dc) {
int vp9_mbblock_error_c(MACROBLOCK *mb) {
BLOCK *be;
BLOCKD *bd;
int i, j;
@ -349,7 +330,7 @@ int vp9_mbblock_error_c(MACROBLOCK *mb, int dc) {
be = &mb->block[i];
bd = &mb->e_mbd.block[i];
berror = 0;
for (j = dc; j < 16; j++) {
for (j = 0; j < 16; j++) {
int this_diff = be->coeff[j] - bd->dqcoeff[j];
berror += this_diff * this_diff;
}
@ -428,7 +409,7 @@ static INLINE int cost_coeffs(MACROBLOCK *mb,
const int eob = b->eob;
MACROBLOCKD *xd = &mb->e_mbd;
const int ib = (int)(b - xd->block);
int c = (type == PLANE_TYPE_Y_NO_DC) ? 1 : 0;
int c = 0;
int cost = 0, seg_eob;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int *scan;
@ -453,13 +434,8 @@ static INLINE int cost_coeffs(MACROBLOCK *mb,
}
break;
case TX_8X8:
if (type == PLANE_TYPE_Y2) {
scan = vp9_default_zig_zag1d_4x4;
seg_eob = 4;
} else {
scan = vp9_default_zig_zag1d_8x8;
seg_eob = 64;
}
scan = vp9_default_zig_zag1d_8x8;
seg_eob = 64;
break;
case TX_16X16:
scan = vp9_default_zig_zag1d_16x16;
@ -511,12 +487,12 @@ static INLINE int cost_coeffs(MACROBLOCK *mb,
}
// is eob first coefficient;
pt = (c > !type);
pt = (c > 0);
*a = *l = pt;
return cost;
}
static int rdcost_mby_4x4(MACROBLOCK *mb, int has_2nd_order, int backup) {
static int rdcost_mby_4x4(MACROBLOCK *mb, int backup) {
int cost = 0;
int b;
MACROBLOCKD *xd = &mb->e_mbd;
@ -536,19 +512,11 @@ static int rdcost_mby_4x4(MACROBLOCK *mb, int has_2nd_order, int backup) {
}
for (b = 0; b < 16; b++)
cost += cost_coeffs(mb, xd->block + b,
(has_2nd_order ?
PLANE_TYPE_Y_NO_DC : PLANE_TYPE_Y_WITH_DC),
cost += cost_coeffs(mb, xd->block + b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above[TX_4X4][b],
tl + vp9_block2left[TX_4X4][b],
TX_4X4);
if (has_2nd_order)
cost += cost_coeffs(mb, xd->block + 24, PLANE_TYPE_Y2,
ta + vp9_block2above[TX_4X4][24],
tl + vp9_block2left[TX_4X4][24],
TX_4X4);
return cost;
}
@ -557,26 +525,17 @@ static void macro_block_yrd_4x4(MACROBLOCK *mb,
int *Distortion,
int *skippable, int backup) {
MACROBLOCKD *const xd = &mb->e_mbd;
BLOCK *const mb_y2 = mb->block + 24;
BLOCKD *const x_y2 = xd->block + 24;
int d, has_2nd_order;
xd->mode_info_context->mbmi.txfm_size = TX_4X4;
has_2nd_order = get_2nd_order_usage(xd);
// Fdct and building the 2nd order block
vp9_transform_mby_4x4(mb);
vp9_quantize_mby_4x4(mb);
d = vp9_mbblock_error(mb, has_2nd_order);
if (has_2nd_order)
d += vp9_block_error(mb_y2->coeff, x_y2->dqcoeff, 16);
*Distortion = (d >> 2);
// rate
*Rate = rdcost_mby_4x4(mb, has_2nd_order, backup);
*skippable = vp9_mby_is_skippable_4x4(&mb->e_mbd, has_2nd_order);
*Distortion = vp9_mbblock_error(mb) >> 2;
*Rate = rdcost_mby_4x4(mb, backup);
*skippable = vp9_mby_is_skippable_4x4(xd);
}
static int rdcost_mby_8x8(MACROBLOCK *mb, int has_2nd_order, int backup) {
static int rdcost_mby_8x8(MACROBLOCK *mb, int backup) {
int cost = 0;
int b;
MACROBLOCKD *xd = &mb->e_mbd;
@ -596,18 +555,11 @@ static int rdcost_mby_8x8(MACROBLOCK *mb, int has_2nd_order, int backup) {
}
for (b = 0; b < 16; b += 4)
cost += cost_coeffs(mb, xd->block + b,
(has_2nd_order ?
PLANE_TYPE_Y_NO_DC : PLANE_TYPE_Y_WITH_DC),
cost += cost_coeffs(mb, xd->block + b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above[TX_8X8][b],
tl + vp9_block2left[TX_8X8][b],
TX_8X8);
if (has_2nd_order)
cost += cost_coeffs(mb, xd->block + 24, PLANE_TYPE_Y2,
ta + vp9_block2above[TX_8X8][24],
tl + vp9_block2left[TX_8X8][24],
TX_8X8);
return cost;
}
@ -616,23 +568,14 @@ static void macro_block_yrd_8x8(MACROBLOCK *mb,
int *Distortion,
int *skippable, int backup) {
MACROBLOCKD *const xd = &mb->e_mbd;
BLOCK *const mb_y2 = mb->block + 24;
BLOCKD *const x_y2 = xd->block + 24;
int d, has_2nd_order;
xd->mode_info_context->mbmi.txfm_size = TX_8X8;
vp9_transform_mby_8x8(mb);
vp9_quantize_mby_8x8(mb);
has_2nd_order = get_2nd_order_usage(xd);
d = vp9_mbblock_error_8x8_c(mb, has_2nd_order);
if (has_2nd_order)
d += vp9_block_error(mb_y2->coeff, x_y2->dqcoeff, 16);
*Distortion = (d >> 2);
// rate
*Rate = rdcost_mby_8x8(mb, has_2nd_order, backup);
*skippable = vp9_mby_is_skippable_8x8(&mb->e_mbd, has_2nd_order);
*Distortion = vp9_mbblock_error(mb) >> 2;
*Rate = rdcost_mby_8x8(mb, backup);
*skippable = vp9_mby_is_skippable_8x8(xd);
}
static int rdcost_mby_16x16(MACROBLOCK *mb, int backup) {
@ -658,7 +601,6 @@ static int rdcost_mby_16x16(MACROBLOCK *mb, int backup) {
static void macro_block_yrd_16x16(MACROBLOCK *mb, int *Rate, int *Distortion,
int *skippable, int backup) {
int d;
MACROBLOCKD *xd = &mb->e_mbd;
xd->mode_info_context->mbmi.txfm_size = TX_16X16;
@ -671,12 +613,9 @@ static void macro_block_yrd_16x16(MACROBLOCK *mb, int *Rate, int *Distortion,
xd->mode_info_context->mbmi.mode < I8X8_PRED)
vp9_optimize_mby_16x16(mb);
d = vp9_mbblock_error(mb, 0);
*Distortion = (d >> 2);
// rate
*Distortion = vp9_mbblock_error(mb) >> 2;
*Rate = rdcost_mby_16x16(mb, backup);
*skippable = vp9_mby_is_skippable_16x16(&mb->e_mbd);
*skippable = vp9_mby_is_skippable_16x16(xd);
}
static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
@ -1401,7 +1340,6 @@ static int64_t rd_pick_intra8x8block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
vp9_subtract_4b_c(be, b, 16);
assert(get_2nd_order_usage(xd) == 0);
if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
TX_TYPE tx_type = get_tx_type_8x8(xd, b);
if (tx_type != DCT_DCT)
@ -2862,8 +2800,8 @@ static int rd_pick_best_mbsegmentation(VP9_COMP *cpi, MACROBLOCK *x,
*returndistortion = bsi.d;
*returnyrate = bsi.segment_yrate;
*skippable = bsi.txfm_size == TX_4X4 ?
vp9_mby_is_skippable_4x4(&x->e_mbd, 0) :
vp9_mby_is_skippable_8x8(&x->e_mbd, 0);
vp9_mby_is_skippable_4x4(&x->e_mbd) :
vp9_mby_is_skippable_8x8(&x->e_mbd);
/* save partitions */
mbmi->txfm_size = bsi.txfm_size;
@ -3376,7 +3314,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
}
if ((int)sse < threshold) {
unsigned int q2dc = xd->block[24].dequant[0];
unsigned int q2dc = xd->block[0].dequant[0];
/* If there is no codeable 2nd order dc
or a very small uniform pixel change change */
if ((sse - var < q2dc * q2dc >> 4) ||

View File

@ -1,48 +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.
*/
#include <stdlib.h>
#include "vpx_ports/mem.h"
#include "./vp9_rtcd.h"
unsigned int vp9_satd16x16_c(const uint8_t *src_ptr,
int src_stride,
const uint8_t *ref_ptr,
int ref_stride,
unsigned int *psatd) {
int r, c, i;
unsigned int satd = 0;
DECLARE_ALIGNED(16, int16_t, diff_in[256]);
DECLARE_ALIGNED(16, int16_t, diff_out[16]);
int16_t *in;
for (r = 0; r < 16; r++) {
for (c = 0; c < 16; c++) {
diff_in[r * 16 + c] = src_ptr[c] - ref_ptr[c];
}
src_ptr += src_stride;
ref_ptr += ref_stride;
}
in = diff_in;
for (r = 0; r < 16; r += 4) {
for (c = 0; c < 16; c += 4) {
vp9_short_walsh4x4_c(in + c, diff_out, 32);
for (i = 0; i < 16; i++)
satd += abs(diff_out[i]);
}
in += 64;
}
if (psatd)
*psatd = satd;
return satd;
}

View File

@ -108,7 +108,7 @@ static void tokenize_b(VP9_COMP *cpi,
TX_SIZE tx_size,
int dry_run) {
int pt; /* near block/prev token context index */
int c = (type == PLANE_TYPE_Y_NO_DC) ? 1 : 0;
int c = 0;
int recent_energy = 0;
const BLOCKD * const b = xd->block + ib;
const int eob = b->eob; /* one beyond last nonzero coeff */
@ -153,17 +153,12 @@ static void tokenize_b(VP9_COMP *cpi,
}
break;
case TX_8X8:
if (type == PLANE_TYPE_Y2) {
seg_eob = 4;
scan = vp9_default_zig_zag1d_4x4;
} else {
#if CONFIG_CNVCONTEXT
a_ec = (a[0] + a[1]) != 0;
l_ec = (l[0] + l[1]) != 0;
a_ec = (a[0] + a[1]) != 0;
l_ec = (l[0] + l[1]) != 0;
#endif
seg_eob = 64;
scan = vp9_default_zig_zag1d_8x8;
}
seg_eob = 64;
scan = vp9_default_zig_zag1d_8x8;
if (tx_type != DCT_DCT) {
counts = cpi->hybrid_coef_counts_8x8;
probs = cpi->common.fc.hybrid_coef_probs_8x8;
@ -235,8 +230,7 @@ static void tokenize_b(VP9_COMP *cpi,
t->Token = token;
t->context_tree = probs[type][band][pt];
t->skip_eob_node = (pt == 0) && ((band > 0 && type != PLANE_TYPE_Y_NO_DC) ||
(band > 1 && type == PLANE_TYPE_Y_NO_DC));
t->skip_eob_node = (pt == 0) && (band > 0);
assert(vp9_coef_encodings[t->Token].Len - t->skip_eob_node > 0);
if (!dry_run) {
++counts[type][band][pt][token];
@ -247,11 +241,11 @@ static void tokenize_b(VP9_COMP *cpi,
} while (c < eob && ++c < seg_eob);
*tp = t;
a_ec = l_ec = (c > !type); /* 0 <-> all coeff data is zero */
a_ec = l_ec = (c > 0); /* 0 <-> all coeff data is zero */
a[0] = a_ec;
l[0] = l_ec;
if (tx_size == TX_8X8 && type != PLANE_TYPE_Y2) {
if (tx_size == TX_8X8) {
a[1] = a_ec;
l[1] = l_ec;
} else if (tx_size == TX_16X16) {
@ -270,18 +264,13 @@ static void tokenize_b(VP9_COMP *cpi,
}
}
int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd, int has_2nd_order) {
int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd) {
int skip = 1;
int i = 0;
if (has_2nd_order) {
for (i = 0; i < 16; i++)
skip &= (xd->block[i].eob < 2);
skip &= (!xd->block[24].eob);
} else {
for (i = 0; i < 16; i++)
skip &= (!xd->block[i].eob);
}
for (i = 0; i < 16; i++)
skip &= (!xd->block[i].eob);
return skip;
}
@ -294,23 +283,18 @@ int vp9_mbuv_is_skippable_4x4(MACROBLOCKD *xd) {
return skip;
}
static int mb_is_skippable_4x4(MACROBLOCKD *xd, int has_2nd_order) {
return (vp9_mby_is_skippable_4x4(xd, has_2nd_order) &
static int mb_is_skippable_4x4(MACROBLOCKD *xd) {
return (vp9_mby_is_skippable_4x4(xd) &
vp9_mbuv_is_skippable_4x4(xd));
}
int vp9_mby_is_skippable_8x8(MACROBLOCKD *xd, int has_2nd_order) {
int vp9_mby_is_skippable_8x8(MACROBLOCKD *xd) {
int skip = 1;
int i = 0;
if (has_2nd_order) {
for (i = 0; i < 16; i += 4)
skip &= (xd->block[i].eob < 2);
skip &= (!xd->block[24].eob);
} else {
for (i = 0; i < 16; i += 4)
skip &= (!xd->block[i].eob);
}
for (i = 0; i < 16; i += 4)
skip &= (!xd->block[i].eob);
return skip;
}
@ -318,13 +302,13 @@ int vp9_mbuv_is_skippable_8x8(MACROBLOCKD *xd) {
return (!xd->block[16].eob) & (!xd->block[20].eob);
}
static int mb_is_skippable_8x8(MACROBLOCKD *xd, int has_2nd_order) {
return (vp9_mby_is_skippable_8x8(xd, has_2nd_order) &
static int mb_is_skippable_8x8(MACROBLOCKD *xd) {
return (vp9_mby_is_skippable_8x8(xd) &
vp9_mbuv_is_skippable_8x8(xd));
}
static int mb_is_skippable_8x8_4x4uv(MACROBLOCKD *xd, int has_2nd_order) {
return (vp9_mby_is_skippable_8x8(xd, has_2nd_order) &
static int mb_is_skippable_8x8_4x4uv(MACROBLOCKD *xd) {
return (vp9_mby_is_skippable_8x8(xd) &
vp9_mbuv_is_skippable_4x4(xd));
}
@ -360,10 +344,6 @@ void vp9_tokenize_sb(VP9_COMP *cpi,
VP9_COMMON * const cm = &cpi->common;
MB_MODE_INFO * const mbmi = &xd->mode_info_context->mbmi;
TOKENEXTRA *t_backup = *t;
ENTROPY_CONTEXT *A[2] = { (ENTROPY_CONTEXT *) (xd->above_context + 0),
(ENTROPY_CONTEXT *) (xd->above_context + 1), };
ENTROPY_CONTEXT *L[2] = { (ENTROPY_CONTEXT *) (xd->left_context + 0),
(ENTROPY_CONTEXT *) (xd->left_context + 1), };
const int mb_skip_context = vp9_get_pred_context(cm, xd, PRED_MBSKIP);
const int segment_id = mbmi->segment_id;
const int skip_inc = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
@ -394,7 +374,6 @@ void vp9_tokenize_sb(VP9_COMP *cpi,
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV,
TX_16X16, dry_run);
}
A[0][8] = L[0][8] = A[1][8] = L[1][8] = 0;
if (dry_run)
*t = t_backup;
}
@ -403,8 +382,6 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
MACROBLOCKD *xd,
TOKENEXTRA **t,
int dry_run) {
PLANE_TYPE plane_type;
int has_2nd_order;
int b;
int tx_size = xd->mode_info_context->mbmi.txfm_size;
int mb_skip_context = vp9_get_pred_context(&cpi->common, xd, PRED_MBSKIP);
@ -421,8 +398,6 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
} else
skip_inc = 0;
has_2nd_order = get_2nd_order_usage(xd);
switch (tx_size) {
case TX_16X16:
@ -432,15 +407,15 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
if (xd->mode_info_context->mbmi.mode == I8X8_PRED ||
xd->mode_info_context->mbmi.mode == SPLITMV)
xd->mode_info_context->mbmi.mb_skip_coeff =
mb_is_skippable_8x8_4x4uv(xd, 0);
mb_is_skippable_8x8_4x4uv(xd);
else
xd->mode_info_context->mbmi.mb_skip_coeff =
mb_is_skippable_8x8(xd, has_2nd_order);
mb_is_skippable_8x8(xd);
break;
default:
xd->mode_info_context->mbmi.mb_skip_coeff =
mb_is_skippable_4x4(xd, has_2nd_order);
mb_is_skippable_4x4(xd);
break;
}
@ -461,15 +436,6 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
if (!dry_run)
cpi->skip_false_count[mb_skip_context] += skip_inc;
if (has_2nd_order) {
tokenize_b(cpi, xd, 24, t, PLANE_TYPE_Y2, tx_size, dry_run);
plane_type = PLANE_TYPE_Y_NO_DC;
} else {
xd->above_context->y2 = 0;
xd->left_context->y2 = 0;
plane_type = PLANE_TYPE_Y_WITH_DC;
}
if (tx_size == TX_16X16) {
tokenize_b(cpi, xd, 0, t, PLANE_TYPE_Y_WITH_DC, TX_16X16, dry_run);
for (b = 16; b < 24; b += 4) {
@ -477,7 +443,7 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
}
} else if (tx_size == TX_8X8) {
for (b = 0; b < 16; b += 4) {
tokenize_b(cpi, xd, b, t, plane_type, TX_8X8, dry_run);
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, TX_8X8, dry_run);
}
if (xd->mode_info_context->mbmi.mode == I8X8_PRED ||
xd->mode_info_context->mbmi.mode == SPLITMV) {
@ -490,11 +456,10 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
}
}
} else {
for (b = 0; b < 24; b++) {
if (b >= 16)
plane_type = PLANE_TYPE_UV;
tokenize_b(cpi, xd, b, t, plane_type, TX_4X4, dry_run);
}
for (b = 0; b < 16; b++)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, TX_4X4, dry_run);
for (b = 16; b < 24; b++)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_4X4, dry_run);
}
if (dry_run)
*t = t_backup;
@ -727,10 +692,8 @@ static INLINE void stuff_b(VP9_COMP *cpi,
break;
case TX_8X8:
#if CONFIG_CNVCONTEXT
if (type != PLANE_TYPE_Y2) {
a_ec = (a[0] + a[1]) != 0;
l_ec = (l[0] + l[1]) != 0;
}
a_ec = (a[0] + a[1]) != 0;
l_ec = (l[0] + l[1]) != 0;
#endif
if (tx_type != DCT_DCT) {
counts = cpi->hybrid_coef_counts_8x8;
@ -774,14 +737,14 @@ static INLINE void stuff_b(VP9_COMP *cpi,
VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec);
band = get_coef_band((type == PLANE_TYPE_Y_NO_DC) ? 1 : 0);
band = get_coef_band(0);
t->Token = DCT_EOB_TOKEN;
t->context_tree = probs[type][band][pt];
t->skip_eob_node = 0;
++t;
*tp = t;
*a = *l = 0;
if (tx_size == TX_8X8 && type != PLANE_TYPE_Y2) {
if (tx_size == TX_8X8) {
a[1] = 0;
l[1] = 0;
} else if (tx_size == TX_16X16) {
@ -806,26 +769,12 @@ static INLINE void stuff_b(VP9_COMP *cpi,
static void stuff_mb_8x8(VP9_COMP *cpi, MACROBLOCKD *xd,
TOKENEXTRA **t, int dry_run) {
PLANE_TYPE plane_type;
int b;
int has_2nd_order = get_2nd_order_usage(xd);
if (has_2nd_order) {
stuff_b(cpi, xd, 24, t, PLANE_TYPE_Y2, TX_8X8, dry_run);
plane_type = PLANE_TYPE_Y_NO_DC;
} else {
#if CONFIG_CNVCONTEXT
xd->above_context->y2 = 0;
xd->left_context->y2 = 0;
#endif
plane_type = PLANE_TYPE_Y_WITH_DC;
}
for (b = 0; b < 24; b += 4) {
if (b >= 16)
plane_type = PLANE_TYPE_UV;
stuff_b(cpi, xd, b, t, plane_type, TX_8X8, dry_run);
}
for (b = 0; b < 16; b += 4)
stuff_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, TX_8X8, dry_run);
for (b = 16; b < 24; b += 4)
stuff_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_8X8, dry_run);
}
static void stuff_mb_16x16(VP9_COMP *cpi, MACROBLOCKD *xd,
@ -836,56 +785,26 @@ static void stuff_mb_16x16(VP9_COMP *cpi, MACROBLOCKD *xd,
for (b = 16; b < 24; b += 4) {
stuff_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_8X8, dry_run);
}
#if CONFIG_CNVCONTEXT
xd->above_context->y2 = 0;
xd->left_context->y2 = 0;
#endif
}
static void stuff_mb_4x4(VP9_COMP *cpi, MACROBLOCKD *xd,
TOKENEXTRA **t, int dry_run) {
int b;
PLANE_TYPE plane_type;
int has_2nd_order = get_2nd_order_usage(xd);
if (has_2nd_order) {
stuff_b(cpi, xd, 24, t, PLANE_TYPE_Y2, TX_4X4, dry_run);
plane_type = PLANE_TYPE_Y_NO_DC;
} else {
xd->above_context->y2 = 0;
xd->left_context->y2 = 0;
plane_type = PLANE_TYPE_Y_WITH_DC;
}
for (b = 0; b < 24; b++) {
if (b >= 16)
plane_type = PLANE_TYPE_UV;
stuff_b(cpi, xd, b, t, plane_type, TX_4X4, dry_run);
}
for (b = 0; b < 16; b++)
stuff_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, TX_4X4, dry_run);
for (b = 16; b < 24; b++)
stuff_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_4X4, dry_run);
}
static void stuff_mb_8x8_4x4uv(VP9_COMP *cpi, MACROBLOCKD *xd,
TOKENEXTRA **t, int dry_run) {
PLANE_TYPE plane_type;
int b;
int has_2nd_order = get_2nd_order_usage(xd);
if (has_2nd_order) {
stuff_b(cpi, xd, 24, t, PLANE_TYPE_Y2, TX_8X8, dry_run);
plane_type = PLANE_TYPE_Y_NO_DC;
} else {
xd->above_context->y2 = 0;
xd->left_context->y2 = 0;
plane_type = PLANE_TYPE_Y_WITH_DC;
}
for (b = 0; b < 16; b += 4) {
stuff_b(cpi, xd, b, t, plane_type, TX_8X8, dry_run);
}
for (b = 16; b < 24; b++) {
for (b = 0; b < 16; b += 4)
stuff_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, TX_8X8, dry_run);
for (b = 16; b < 24; b++)
stuff_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_4X4, dry_run);
}
}
void vp9_stuff_mb(VP9_COMP *cpi, MACROBLOCKD *xd, TOKENEXTRA **t, int dry_run) {

View File

@ -31,9 +31,9 @@ typedef struct {
typedef int64_t vp9_coeff_accum[COEF_BANDS][PREV_COEF_CONTEXTS]
[MAX_ENTROPY_TOKENS];
extern int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd, int has_y2_block);
extern int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd);
extern int vp9_mbuv_is_skippable_4x4(MACROBLOCKD *xd);
extern int vp9_mby_is_skippable_8x8(MACROBLOCKD *xd, int has_y2_block);
extern int vp9_mby_is_skippable_8x8(MACROBLOCKD *xd);
extern int vp9_mbuv_is_skippable_8x8(MACROBLOCKD *xd);
extern int vp9_mby_is_skippable_16x16(MACROBLOCKD *xd);
extern int vp9_sby_is_skippable_32x32(MACROBLOCKD *xd);

View File

@ -125,7 +125,7 @@ sym(vp9_block_error_mmx):
ret
;int vp9_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
;int vp9_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr);
global sym(vp9_mbblock_error_mmx_impl) PRIVATE
sym(vp9_mbblock_error_mmx_impl):
push rbp
@ -142,10 +142,6 @@ sym(vp9_mbblock_error_mmx_impl):
mov rdi, arg(1) ;dcoef_ptr
pxor mm2, mm2
movd mm1, dword ptr arg(2) ;dc
por mm1, mm2
pcmpeqw mm1, mm7
mov rcx, 16
.mberror_loop_mmx:
@ -160,7 +156,6 @@ sym(vp9_mbblock_error_mmx_impl):
pmaddwd mm5, mm5
psubw mm3, mm4
pand mm3, mm1
pmaddwd mm3, mm3
paddd mm2, mm5
@ -202,28 +197,24 @@ sym(vp9_mbblock_error_mmx_impl):
ret
;int vp9_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
;int vp9_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr);
global sym(vp9_mbblock_error_xmm_impl) PRIVATE
sym(vp9_mbblock_error_xmm_impl):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 3
SAVE_XMM 6
SAVE_XMM 5
push rsi
push rdi
; end prolog
mov rsi, arg(0) ;coeff_ptr
pxor xmm6, xmm6
pxor xmm5, xmm5
mov rdi, arg(1) ;dcoef_ptr
pxor xmm4, xmm4
movd xmm5, dword ptr arg(2) ;dc
por xmm5, xmm4
pcmpeqw xmm5, xmm6
mov rcx, 16
.mberror_loop:
@ -238,7 +229,6 @@ sym(vp9_mbblock_error_xmm_impl):
pmaddwd xmm2, xmm2
psubw xmm0, xmm1
pand xmm0, xmm5
pmaddwd xmm0, xmm0
add rsi, 32
@ -252,9 +242,9 @@ sym(vp9_mbblock_error_xmm_impl):
jnz .mberror_loop
movdqa xmm0, xmm4
punpckldq xmm0, xmm6
punpckldq xmm0, xmm5
punpckhdq xmm4, xmm6
punpckhdq xmm4, xmm5
paddd xmm0, xmm4
movdqa xmm1, xmm0

View File

@ -23,11 +23,11 @@ void vp9_short_fdct8x4_mmx(short *input, short *output, int pitch) {
vp9_short_fdct4x4_mmx(input + 4, output + 16, pitch);
}
int vp9_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
int vp9_mbblock_error_mmx(MACROBLOCK *mb, int dc) {
int vp9_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr);
int vp9_mbblock_error_mmx(MACROBLOCK *mb) {
short *coeff_ptr = mb->block[0].coeff;
short *dcoef_ptr = mb->e_mbd.block[0].dqcoeff;
return vp9_mbblock_error_mmx_impl(coeff_ptr, dcoef_ptr, dc);
return vp9_mbblock_error_mmx_impl(coeff_ptr, dcoef_ptr);
}
int vp9_mbuverror_mmx_impl(short *s_ptr, short *d_ptr);
@ -51,11 +51,11 @@ void vp9_subtract_b_mmx(BLOCK *be, BLOCKD *bd, int pitch) {
#endif
#if HAVE_SSE2
int vp9_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
int vp9_mbblock_error_xmm(MACROBLOCK *mb, int dc) {
int vp9_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr);
int vp9_mbblock_error_xmm(MACROBLOCK *mb) {
short *coeff_ptr = mb->block[0].coeff;
short *dcoef_ptr = mb->e_mbd.block[0].dqcoeff;
return vp9_mbblock_error_xmm_impl(coeff_ptr, dcoef_ptr, dc);
return vp9_mbblock_error_xmm_impl(coeff_ptr, dcoef_ptr);
}
int vp9_mbuverror_xmm_impl(short *s_ptr, short *d_ptr);

View File

@ -65,7 +65,6 @@ VP9_CX_SRCS-yes += encoder/vp9_quantize.c
VP9_CX_SRCS-yes += encoder/vp9_ratectrl.c
VP9_CX_SRCS-yes += encoder/vp9_rdopt.c
VP9_CX_SRCS-yes += encoder/vp9_sad_c.c
VP9_CX_SRCS-yes += encoder/vp9_satd_c.c
VP9_CX_SRCS-yes += encoder/vp9_segmentation.c
VP9_CX_SRCS-yes += encoder/vp9_segmentation.h
VP9_CX_SRCS-$(CONFIG_INTERNAL_STATS) += encoder/vp9_ssim.c