summaryrefslogtreecommitdiff
path: root/vp8/common
diff options
context:
space:
mode:
Diffstat (limited to 'vp8/common')
-rw-r--r--vp8/common/blockd.h71
-rw-r--r--vp8/common/default_coef_probs.h2
-rw-r--r--vp8/common/entropy.h4
-rw-r--r--vp8/common/idctllm.c152
4 files changed, 224 insertions, 5 deletions
diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h
index 64fc06546..3c43a1e9a 100644
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -54,7 +54,6 @@ typedef struct {
#define PLANE_TYPE_UV 2
#define PLANE_TYPE_Y_WITH_DC 3
-
typedef char ENTROPY_CONTEXT;
typedef struct {
ENTROPY_CONTEXT y1[4];
@@ -179,6 +178,50 @@ typedef enum {
B_MODE_COUNT
} B_PREDICTION_MODE;
+#if CONFIG_HYBRIDTRANSFORM8X8
+// convert MB_PREDICTION_MODE to B_PREDICTION_MODE
+static B_PREDICTION_MODE pred_mode_conv(MB_PREDICTION_MODE mode) {
+ B_PREDICTION_MODE b_mode;
+ switch (mode) {
+ case DC_PRED:
+ b_mode = B_DC_PRED;
+ break;
+ case V_PRED:
+ b_mode = B_VE_PRED;
+ break;
+ case H_PRED:
+ b_mode = B_HE_PRED;
+ break;
+ case TM_PRED:
+ b_mode = B_TM_PRED;
+ break;
+ case D45_PRED:
+ b_mode = B_LD_PRED;
+ break;
+ case D135_PRED:
+ b_mode = B_RD_PRED;
+ break;
+ case D117_PRED:
+ b_mode = B_VR_PRED;
+ break;
+ case D153_PRED:
+ b_mode = B_HD_PRED;
+ break;
+ case D27_PRED:
+ b_mode = B_VL_PRED;
+ break;
+ case D63_PRED:
+ b_mode = B_HU_PRED;
+ break;
+ default :
+ // for debug purpose, to be removed after full testing
+ assert(0);
+ break;
+ }
+ return b_mode;
+}
+#endif
+
#define VP8_BINTRAMODES (B_HU_PRED + 1) /* 10 */
#define VP8_SUBMVREFS (1 + NEW4X4 - LEFT4X4)
@@ -389,6 +432,32 @@ typedef struct MacroBlockD {
} MACROBLOCKD;
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM
+// transform mapping
+static void txfm_map(BLOCKD *b, B_PREDICTION_MODE bmode) {
+ switch (bmode) {
+ case B_TM_PRED :
+ case B_RD_PRED :
+ b->bmi.as_mode.tx_type = ADST_ADST;
+ break;
+
+ case B_VE_PRED :
+ case B_VR_PRED :
+ b->bmi.as_mode.tx_type = ADST_DCT;
+ break;
+
+ case B_HE_PRED :
+ case B_HD_PRED :
+ case B_HU_PRED :
+ b->bmi.as_mode.tx_type = DCT_ADST;
+ break;
+
+ default :
+ b->bmi.as_mode.tx_type = DCT_DCT;
+ break;
+ }
+}
+#endif
extern void vp8_build_block_doffsets(MACROBLOCKD *x);
extern void vp8_setup_block_dptrs(MACROBLOCKD *x);
diff --git a/vp8/common/default_coef_probs.h b/vp8/common/default_coef_probs.h
index dfb0e5ea7..940e971b7 100644
--- a/vp8/common/default_coef_probs.h
+++ b/vp8/common/default_coef_probs.h
@@ -434,7 +434,7 @@ vp8_default_coef_probs_8x8[BLOCK_TYPES_8X8]
{ 6, 117, 180, 254, 199, 216, 255, 251, 128, 128, 128}
}
}
-#if CONFIG_HTRANS8X8
+#if CONFIG_HYBRIDTRANSFORM8X8
,
{ /* block Type 3 */
{ /* Coeff Band 0 */
diff --git a/vp8/common/entropy.h b/vp8/common/entropy.h
index 4497a3d47..190221c16 100644
--- a/vp8/common/entropy.h
+++ b/vp8/common/entropy.h
@@ -60,9 +60,9 @@ extern vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */
/* Coefficients are predicted via a 3-dimensional probability table. */
/* Outside dimension. 0 = Y no DC, 1 = Y2, 2 = UV, 3 = Y with DC */
-
#define BLOCK_TYPES 4
-#if CONFIG_HTRANS8X8
+
+#if CONFIG_HYBRIDTRANSFORM8X8
#define BLOCK_TYPES_8X8 4
#else
#define BLOCK_TYPES_8X8 3
diff --git a/vp8/common/idctllm.c b/vp8/common/idctllm.c
index e549fe098..616e4938e 100644
--- a/vp8/common/idctllm.c
+++ b/vp8/common/idctllm.c
@@ -35,6 +35,8 @@ static const int cospi8sqrt2minus1 = 20091;
static const int sinpi8sqrt2 = 35468;
static const int rounding = 0;
+// TODO: these transforms can be further converted into integer forms
+// for complexity optimization
#if CONFIG_HYBRIDTRANSFORM
float idct_4[16] = {
0.500000000000000, 0.653281482438188, 0.500000000000000, 0.270598050073099,
@@ -51,11 +53,52 @@ float iadst_4[16] = {
};
#endif
+#if CONFIG_HYBRIDTRANSFORM8X8
+float idct_8[64] = {
+ 0.353553390593274, 0.490392640201615, 0.461939766255643, 0.415734806151273,
+ 0.353553390593274, 0.277785116509801, 0.191341716182545, 0.097545161008064,
+ 0.353553390593274, 0.415734806151273, 0.191341716182545, -0.097545161008064,
+ -0.353553390593274, -0.490392640201615, -0.461939766255643, -0.277785116509801,
+ 0.353553390593274, 0.277785116509801, -0.191341716182545, -0.490392640201615,
+ -0.353553390593274, 0.097545161008064, 0.461939766255643, 0.415734806151273,
+ 0.353553390593274, 0.097545161008064, -0.461939766255643, -0.277785116509801,
+ 0.353553390593274, 0.415734806151273, -0.191341716182545, -0.490392640201615,
+ 0.353553390593274, -0.097545161008064, -0.461939766255643, 0.277785116509801,
+ 0.353553390593274, -0.415734806151273, -0.191341716182545, 0.490392640201615,
+ 0.353553390593274, -0.277785116509801, -0.191341716182545, 0.490392640201615,
+ -0.353553390593274, -0.097545161008064, 0.461939766255643, -0.415734806151273,
+ 0.353553390593274, -0.415734806151273, 0.191341716182545, 0.097545161008064,
+ -0.353553390593274, 0.490392640201615, -0.461939766255643, 0.277785116509801,
+ 0.353553390593274, -0.490392640201615, 0.461939766255643, -0.415734806151273,
+ 0.353553390593274, -0.277785116509801, 0.191341716182545, -0.097545161008064
+};
+
+float iadst_8[64] = {
+ 0.089131608307533, 0.255357107325376, 0.387095214016349, 0.466553967085785,
+ 0.483002021635509, 0.434217976756762, 0.326790388032145, 0.175227946595735,
+ 0.175227946595735, 0.434217976756762, 0.466553967085785, 0.255357107325376,
+ -0.089131608307533, -0.387095214016348, -0.483002021635509, -0.326790388032145,
+ 0.255357107325376, 0.483002021635509, 0.175227946595735, -0.326790388032145,
+ -0.466553967085785, -0.089131608307533, 0.387095214016349, 0.434217976756762,
+ 0.326790388032145, 0.387095214016349, -0.255357107325376, -0.434217976756762,
+ 0.175227946595735, 0.466553967085786, -0.089131608307534, -0.483002021635509,
+ 0.387095214016349, 0.175227946595735, -0.483002021635509, 0.089131608307533,
+ 0.434217976756762, -0.326790388032145, -0.255357107325377, 0.466553967085785,
+ 0.434217976756762, -0.089131608307533, -0.326790388032145, 0.483002021635509,
+ -0.255357107325376, -0.175227946595735, 0.466553967085785, -0.387095214016348,
+ 0.466553967085785, -0.326790388032145, 0.089131608307533, 0.175227946595735,
+ -0.387095214016348, 0.483002021635509, -0.434217976756762, 0.255357107325376,
+ 0.483002021635509, -0.466553967085785, 0.434217976756762, -0.387095214016348,
+ 0.326790388032145, -0.255357107325375, 0.175227946595736, -0.089131608307532
+};
+#endif
+
#if CONFIG_HYBRIDTRANSFORM
void vp8_iht4x4llm_c(short *input, short *output, int pitch, TX_TYPE tx_type) {
int i, j, k;
float bufa[16], bufb[16]; // buffers are for floating-point test purpose
- // the implementation could be simplified in conjunction with integer transform
+ // the implementation could be simplified in
+ // conjunction with integer transform
short *ip = input;
short *op = output;
int shortpitch = pitch >> 1;
@@ -158,6 +201,113 @@ void vp8_iht4x4llm_c(short *input, short *output, int pitch, TX_TYPE tx_type) {
}
#endif
+#if CONFIG_HYBRIDTRANSFORM8X8
+void vp8_iht8x8llm_c(short *input, short *output, int pitch, TX_TYPE tx_type) {
+ int i, j, k;
+ float bufa[64], bufb[64]; // buffers are for floating-point test purpose
+ // the implementation could be simplified in
+ // conjunction with integer transform
+ short *ip = input;
+ short *op = output;
+ int shortpitch = pitch >> 1;
+
+ float *pfa = &bufa[0];
+ float *pfb = &bufb[0];
+
+ // pointers to vertical and horizontal transforms
+ float *ptv, *pth;
+
+ // load and convert residual array into floating-point
+ for(j = 0; j < 8; j++) {
+ for(i = 0; i < 8; i++) {
+ pfa[i] = (float)ip[i];
+ }
+ pfa += 8;
+ ip += 8;
+ }
+
+ // vertical transformation
+ pfa = &bufa[0];
+ pfb = &bufb[0];
+
+ switch(tx_type) {
+ case ADST_ADST :
+ case ADST_DCT :
+ ptv = &iadst_8[0];
+ break;
+
+ default :
+ ptv = &idct_8[0];
+ break;
+ }
+
+ for(j = 0; j < 8; j++) {
+ for(i = 0; i < 8; i++) {
+ pfb[i] = 0 ;
+ for(k = 0; k < 8; k++) {
+ pfb[i] += ptv[k] * pfa[(k<<3)];
+ }
+ pfa += 1;
+ }
+
+ pfb += 8;
+ ptv += 8;
+ pfa = &bufa[0];
+ }
+
+ // horizontal transformation
+ pfa = &bufa[0];
+ pfb = &bufb[0];
+
+ switch(tx_type) {
+ case ADST_ADST :
+ case DCT_ADST :
+ pth = &iadst_8[0];
+ break;
+
+ default :
+ pth = &idct_8[0];
+ break;
+ }
+
+ for(j = 0; j < 8; j++) {
+ for(i = 0; i < 8; i++) {
+ pfa[i] = 0;
+ for(k = 0; k < 8; k++) {
+ pfa[i] += pfb[k] * pth[k];
+ }
+ pth += 8;
+ }
+
+ pfa += 8;
+ pfb += 8;
+
+ switch(tx_type) {
+ case ADST_ADST :
+ case DCT_ADST :
+ pth = &iadst_8[0];
+ break;
+
+ default :
+ pth = &idct_8[0];
+ break;
+ }
+ }
+
+ // convert to short integer format and load BLOCKD buffer
+ op = output;
+ pfa = &bufa[0];
+
+ for(j = 0; j < 8; j++) {
+ for(i = 0; i < 8; i++) {
+ op[i] = (pfa[i] > 0 ) ? (short)( pfa[i] / 8 + 0.49) :
+ -(short)( - pfa[i] / 8 + 0.49);
+ }
+ op += shortpitch;
+ pfa += 8;
+ }
+}
+#endif
void vp8_short_idct4x4llm_c(short *input, short *output, int pitch) {
int i;