aboutsummaryrefslogtreecommitdiff
path: root/vp8/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'vp8/decoder')
-rw-r--r--vp8/decoder/dequantize.h6
-rwxr-xr-xvp8/decoder/mips/dequantize_mips.c168
-rwxr-xr-xvp8/decoder/mips/dequantize_mips.h38
-rwxr-xr-xvp8/decoder/mips/idct_blk_mips.c225
-rwxr-xr-xvp8/decoder/mips/mips_dsystemdependent.c36
5 files changed, 473 insertions, 0 deletions
diff --git a/vp8/decoder/dequantize.h b/vp8/decoder/dequantize.h
index 2e662a593..b3a78c5c1 100644
--- a/vp8/decoder/dequantize.h
+++ b/vp8/decoder/dequantize.h
@@ -50,6 +50,12 @@
#include "arm/dequantize_arm.h"
#endif
+#if ARCH_MIPS
+#if defined(MIPS_DSP_REV) && MIPS_DSP_REV>=2
+#include "mips/dequantize_mips.h"
+#endif
+#endif
+
#ifndef vp8_dequant_block
#define vp8_dequant_block vp8_dequantize_b_c
#endif
diff --git a/vp8/decoder/mips/dequantize_mips.c b/vp8/decoder/mips/dequantize_mips.c
new file mode 100755
index 000000000..49bf224c6
--- /dev/null
+++ b/vp8/decoder/mips/dequantize_mips.c
@@ -0,0 +1,168 @@
+/*
+ * 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 "vpx_ports/config.h"
+#include "dequantize.h"
+#include "idct.h"
+#include "vpx_mem/vpx_mem.h"
+
+DECLARE_ALIGNED(8, const unsigned char, cma[512]) = {
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
+148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
+165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
+182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
+199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
+216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
+233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
+250, 251, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
+};
+
+extern void vp8_short_idct4x4llm_mips(short *input, short *output, int pitch) ;
+extern void vp8_short_idct4x4llm_1_mips(short *input, short *output, int pitch);
+
+
+void vp8_dequant_idct_add_mips(short *input, short *dq, unsigned char *pred,
+ unsigned char *dest, int pitch, int stride)
+{
+ short output[16];
+ short *diff_ptr = output;
+ int i;
+ short a1, a2, a3, a0;
+
+ short input_temp[16];
+ unsigned int in1, dq1, x1, in2, dq2;
+ const unsigned char *cm = &(cma[128]);
+
+ __asm__ __volatile__ (
+ "lh %[in1], 0(%[input]) \n\t"
+ "lh %[dq1], 0(%[dq]) \n\t"
+ "lh %[in2], 2(%[input]) \n\t"
+ "lh %[dq2], 2(%[dq]) \n\t"
+ "append %[in1], %[in2], 16 \n\t"
+ "append %[dq1], %[dq2], 16 \n\t"
+ "mul.ph %[x1], %[dq1], %[in1] \n\t"
+ "sh %[x1], 2(%[input_temp]) \n\t"
+ "srl %[x1], %[x1], 16 \n\t"
+ "sh %[x1], 0(%[input_temp]) \n\t"
+
+ : [x1] "=&r" (x1), [in1] "=&r" (in1), [dq1] "=&r" (dq1),
+ [in2] "=&r" (in2), [dq2] "=&r" (dq2)
+ : [dq] "r" (dq), [input] "r" (input),
+ [input_temp] "r" (input_temp)
+ );
+
+ for (i = 2; i < 16; i++)
+ {
+ input_temp[i] = dq[i] * input[i];
+ }
+
+ /* the idct halves ( >> 1) the pitch */
+ vp8_short_idct4x4llm_mips(input_temp, output, 4);
+
+ vpx_memset(input, 0, 32);
+
+ /* unroll the loop */
+ for (i = 4; i--; )
+ {
+ a0 = diff_ptr[0] + pred[0];
+ a1 = diff_ptr[1] + pred[1];
+ a2 = diff_ptr[2] + pred[2];
+ a3 = diff_ptr[3] + pred[3];
+
+ dest[0] = cm[a0];
+ dest[1] = cm[a1];
+ dest[2] = cm[a2];
+ dest[3] = cm[a3];
+
+ dest += stride;
+ diff_ptr += 4;
+ pred += pitch;
+ }
+}
+
+
+void vp8_dequant_dc_idct_add_mips(short *input, short *dq, unsigned char *pred,
+ unsigned char *dest, int pitch, int stride,
+ int Dc)
+{
+ int i;
+ short output[16];
+ short *diff_ptr = output;
+ short input_temp[16];
+ short a1, a2, a3, a0;
+
+ unsigned int in1, dq1, x1, in2, dq2;
+ const unsigned char *cm = &(cma[128]);
+
+ input_temp[0] = (short)Dc;
+
+ __asm__ __volatile__ (
+ "lh %[in1], 2(%[input]) \n\t"
+ "lh %[dq1], 2(%[dq]) \n\t"
+ "lh %[in2], 4(%[input]) \n\t"
+ "lh %[dq2], 4(%[dq]) \n\t"
+ "append %[in1], %[in2], 16 \n\t"
+ "append %[dq1], %[dq2], 16 \n\t"
+ "mul.ph %[x1], %[dq1], %[in1] \n\t"
+ "sh %[x1], 4(%[input_temp]) \n\t"
+ "srl %[x1], %[x1], 16 \n\t"
+ "sh %[x1], 2(%[input_temp]) \n\t"
+
+ : [x1] "=&r" (x1), [in1] "=&r" (in1), [dq1] "=&r" (dq1),
+ [in2] "=&r" (in2), [dq2] "=&r" (dq2)
+ : [dq] "r" (dq), [input] "r" (input),
+ [input_temp] "r" (input_temp)
+ );
+
+ for (i = 3; i < 16; i++)
+ {
+ input_temp[i] = dq[i] * input[i];
+ }
+
+ vp8_short_idct4x4llm_mips(input_temp, output, 4);
+
+ vpx_memset(input, 0, 32);
+
+ for (i = 4; i--; )
+ {
+ a0 = diff_ptr[0] + pred[0];
+ a1 = diff_ptr[1] + pred[1];
+ a2 = diff_ptr[2] + pred[2];
+ a3 = diff_ptr[3] + pred[3];
+
+ dest[0] = cm[a0];
+ dest[1] = cm[a1];
+ dest[2] = cm[a2];
+ dest[3] = cm[a3];
+
+ dest += stride;
+ diff_ptr += 4;
+ pred += pitch;
+ }
+} \ No newline at end of file
diff --git a/vp8/decoder/mips/dequantize_mips.h b/vp8/decoder/mips/dequantize_mips.h
new file mode 100755
index 000000000..732bda716
--- /dev/null
+++ b/vp8/decoder/mips/dequantize_mips.h
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+
+#ifndef DEQUANTIZE_MIPS_H
+#define DEQUANTIZE_MIPS_H
+
+extern prototype_dequant_idct_add(vp8_dequant_idct_add_mips);
+extern prototype_dequant_dc_idct_add(vp8_dequant_dc_idct_add_mips);
+extern prototype_dequant_dc_idct_add_y_block(vp8_dequant_dc_idct_add_y_block_mips);
+extern prototype_dequant_idct_add_y_block(vp8_dequant_idct_add_y_block_mips);
+extern prototype_dequant_idct_add_uv_block(vp8_dequant_idct_add_uv_block_mips);
+
+#if !CONFIG_RUNTIME_CPU_DETECT
+#undef vp8_dequant_idct_add
+#define vp8_dequant_idct_add vp8_dequant_idct_add_mips
+
+#undef vp8_dequant_dc_idct_add
+#define vp8_dequant_dc_idct_add vp8_dequant_dc_idct_add_mips
+
+#undef vp8_dequant_dc_idct_add_y_block
+#define vp8_dequant_dc_idct_add_y_block vp8_dequant_dc_idct_add_y_block_mips
+
+#undef vp8_dequant_idct_add_y_block
+#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_mips
+
+#undef vp8_dequant_idct_add_uv_block
+#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_mips
+
+#endif
+#endif \ No newline at end of file
diff --git a/vp8/decoder/mips/idct_blk_mips.c b/vp8/decoder/mips/idct_blk_mips.c
new file mode 100755
index 000000000..1ae2a70e6
--- /dev/null
+++ b/vp8/decoder/mips/idct_blk_mips.c
@@ -0,0 +1,225 @@
+/*
+ * 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 "vpx_ports/config.h"
+#include "idct.h"
+#include "dequantize.h"
+
+
+void vp8_dequant_dc_idct_add_y_block_mips
+ (short *q, short *dq, unsigned char *pre,
+ unsigned char *dst, int stride, char *eobs, short *dc)
+{
+ int i, j;
+ int higher = 4*stride - 12;
+
+ /* unroll the loop */
+ for (i = 0; i < 4; i++)
+ {
+ if (*eobs++ > 1)
+ vp8_dequant_dc_idct_add_mips(q, dq, pre, dst, 16, stride, dc[0]);
+ else
+ vp8_dc_only_idct_add_mips(dc[0], pre, dst, 16, stride);
+
+ q += 16;
+ pre += 4;
+ dst += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_dc_idct_add_mips(q, dq, pre, dst, 16, stride, dc[1]);
+ else
+ vp8_dc_only_idct_add_mips(dc[1], pre, dst, 16, stride);
+
+ q += 16;
+ pre += 4;
+ dst += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_dc_idct_add_mips(q, dq, pre, dst, 16, stride, dc[2]);
+ else
+ vp8_dc_only_idct_add_mips(dc[2], pre, dst, 16, stride);
+
+ q += 16;
+ pre += 4;
+ dst += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_dc_idct_add_mips(q, dq, pre, dst, 16, stride, dc[3]);
+ else
+ vp8_dc_only_idct_add_mips(dc[3], pre, dst, 16, stride);
+
+ q += 16;
+ dc += 4;
+ pre += 52;
+ dst += higher;
+ }
+}
+
+
+void vp8_dequant_idct_add_y_block_mips
+ (short *q, short *dq, unsigned char *pre,
+ unsigned char *dst, int stride, char *eobs)
+{
+ int i, j;
+ int higher = 4*stride -12;
+
+ /* unroll the loop */
+ for (i = 4; i--; )
+ {
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dst, 16, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dst, 16, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 4;
+ dst += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dst, 16, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dst, 16, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 4;
+ dst += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dst, 16, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dst, 16, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 4;
+ dst += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dst, 16, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dst, 16, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 52;
+ dst += higher;
+ }
+}
+
+
+void vp8_dequant_idct_add_uv_block_mips
+ (short *q, short *dq, unsigned char *pre,
+ unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
+{
+ int i, j;
+ int higher = 4*stride -4;
+
+ /* unroll the loops */
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dstu, 8, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstu, 8, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 4;
+ dstu += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dstu, 8, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstu, 8, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 28;
+ dstu += higher;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dstu, 8, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstu, 8, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 4;
+ dstu += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dstu, 8, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstu, 8, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 28;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dstv, 8, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstv, 8, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 4;
+ dstv += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dstv, 8, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstv, 8, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 28;
+ dstv += higher;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dstv, 8, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstv, 8, stride);
+ ((int *)q)[0] = 0;
+ }
+
+ q += 16;
+ pre += 4;
+ dstv += 4;
+
+ if (*eobs++ > 1)
+ vp8_dequant_idct_add_mips(q, dq, pre, dstv, 8, stride);
+ else
+ {
+ vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstv, 8, stride);
+ ((int *)q)[0] = 0;
+ }
+} \ No newline at end of file
diff --git a/vp8/decoder/mips/mips_dsystemdependent.c b/vp8/decoder/mips/mips_dsystemdependent.c
new file mode 100755
index 000000000..bb20cc7ec
--- /dev/null
+++ b/vp8/decoder/mips/mips_dsystemdependent.c
@@ -0,0 +1,36 @@
+/*
+ * 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 "vpx_ports/config.h"
+#include "blockd.h"
+#include "pragmas.h"
+#include "postproc.h"
+#include "dboolhuff.h"
+#include "dequantize.h"
+#include "onyxd_int.h"
+
+void vp8_arch_mips_decode_init(VP8D_COMP *pbi)
+{
+#if CONFIG_RUNTIME_CPU_DETECT
+
+#ifdef MIPS_DSP_REV
+#if (MIPS_DSP_REV>=2)
+
+ pbi->dequant.idct_add = vp8_dequant_idct_add_mips;
+ pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_mips;
+ pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_mips;
+ pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_mips;
+ pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_mips;
+
+#endif
+#endif
+#endif
+}