summaryrefslogtreecommitdiff
path: root/libavcodec/i386
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2004-04-26 00:20:29 +0000
committerMike Melanson <mike@multimedia.cx>2004-04-26 00:20:29 +0000
commit116824d0aa1c416c3fb0f2c39d339fc00ae251f3 (patch)
tree0d062e4045aee066c0003234e1d4b716ad1b2c83 /libavcodec/i386
parent4ea4b274697767abddda3c425ba4bb43dfdee52f (diff)
reorganize and simplify the VP3 IDCT stuff
Originally committed as revision 3071 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/i386')
-rw-r--r--libavcodec/i386/dsputil_mmx.c8
-rw-r--r--libavcodec/i386/vp3dsp_mmx.c80
-rw-r--r--libavcodec/i386/vp3dsp_sse2.c61
3 files changed, 8 insertions, 141 deletions
diff --git a/libavcodec/i386/dsputil_mmx.c b/libavcodec/i386/dsputil_mmx.c
index 772c9c1f03..61bfc89ac5 100644
--- a/libavcodec/i386/dsputil_mmx.c
+++ b/libavcodec/i386/dsputil_mmx.c
@@ -2149,14 +2149,12 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
/* VP3 optimized DSP functions */
if (mm_flags & MM_SSE2) {
c->vp3_dsp_init = vp3_dsp_init_sse2;
- c->vp3_idct_put = vp3_idct_put_sse2;
- c->vp3_idct_add = vp3_idct_add_sse2;
+ c->vp3_idct = vp3_idct_sse2;
} else {
c->vp3_dsp_init = vp3_dsp_init_mmx;
- c->vp3_idct_put = vp3_idct_put_mmx;
- c->vp3_idct_add = vp3_idct_add_mmx;
+ c->vp3_idct = vp3_idct_mmx;
}
-
+
#ifdef CONFIG_ENCODERS
c->get_pixels = get_pixels_mmx;
c->diff_pixels = diff_pixels_mmx;
diff --git a/libavcodec/i386/vp3dsp_mmx.c b/libavcodec/i386/vp3dsp_mmx.c
index 76007a1d16..319e57f1bb 100644
--- a/libavcodec/i386/vp3dsp_mmx.c
+++ b/libavcodec/i386/vp3dsp_mmx.c
@@ -279,8 +279,8 @@ void vp3_dsp_init_mmx(void)
idct_constants[46] = idct_constants[47] = IdctAdjustBeforeShift;
}
-static void vp3_idct_mmx(int16_t *input_data, int16_t *dequant_matrix,
- int16_t *output_data)
+void vp3_idct_mmx(int16_t *input_data, int16_t *dequant_matrix,
+ int coeff_count, int16_t *output_data)
{
/* eax = quantized input
* ebx = dequantizer matrix
@@ -563,79 +563,3 @@ static void vp3_idct_mmx(int16_t *input_data, int16_t *dequant_matrix,
#undef J
}
-
-void vp3_idct_put_mmx(int16_t *input_data, int16_t *dequant_matrix,
- int coeff_count, uint8_t *dest, int stride)
-{
- int16_t transformed_data[64];
- int16_t *op;
- int i, j;
- uint8_t vector128[8] = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
-
- vp3_idct_mmx(input_data, dequant_matrix, transformed_data);
-
- /* place in final output */
- op = transformed_data;
- movq_m2r(*vector128, mm0);
- for (i = 0; i < 8; i++) {
-#if 1
- for (j = 0; j < 8; j++) {
- if (*op < -128)
- *dest = 0;
- else if (*op > 127)
- *dest = 255;
- else
- *dest = (uint8_t)(*op + 128);
- op++;
- dest++;
- }
- dest += (stride - 8);
-#else
-/* prototype optimization */
- pxor_r2r(mm1, mm1);
- packsswb_m2r(*(op + 4), mm1);
- movq_r2r(mm1, mm2);
- psrlq_i2r(32, mm2);
- packsswb_m2r(*(op + 0), mm1);
- op += 8;
- por_r2r(mm2, mm1);
- paddb_r2r(mm0, mm1);
- movq_r2m(mm1, *dest);
- dest += stride;
-#endif
- }
-
- /* be a good MMX citizen */
- emms();
-}
-
-void vp3_idct_add_mmx(int16_t *input_data, int16_t *dequant_matrix,
- int coeff_count, uint8_t *dest, int stride)
-{
- int16_t transformed_data[64];
- int16_t *op;
- int i, j;
- int16_t sample;
-
- vp3_idct_mmx(input_data, dequant_matrix, transformed_data);
-
- /* place in final output */
- op = transformed_data;
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- sample = *dest + *op;
- if (sample < 0)
- *dest = 0;
- else if (sample > 255)
- *dest = 255;
- else
- *dest = (uint8_t)(sample & 0xFF);
- op++;
- dest++;
- }
- dest += (stride - 8);
- }
-
- /* be a good MMX citizen */
- emms();
-}
diff --git a/libavcodec/i386/vp3dsp_sse2.c b/libavcodec/i386/vp3dsp_sse2.c
index c8f9158afb..6adfd2f9fa 100644
--- a/libavcodec/i386/vp3dsp_sse2.c
+++ b/libavcodec/i386/vp3dsp_sse2.c
@@ -799,11 +799,12 @@ static unsigned short __align16 SSE2_idct_data[7 * 8] =
void vp3_dsp_init_sse2(void)
{
/* nop */
+av_log(NULL, AV_LOG_INFO, "Hey! SSE2!\n");
}
-static void vp3_idct_sse2(int16_t *input_data, int16_t *dequant_matrix,
- int16_t *output_data)
+void vp3_idct_sse2(int16_t *input_data, int16_t *dequant_matrix,
+ int coeff_count, int16_t *output_data)
{
unsigned char *input_bytes = (unsigned char *)input_data;
unsigned char *dequant_matrix_bytes = (unsigned char *)dequant_matrix;
@@ -832,59 +833,3 @@ static void vp3_idct_sse2(int16_t *input_data, int16_t *dequant_matrix,
SSE2_Column_IDCT();
}
-
-
-void vp3_idct_put_sse2(int16_t *input_data, int16_t *dequant_matrix,
- int coeff_count, uint8_t *dest, int stride)
-{
- int16_t transformed_data[64];
- int16_t *op;
- int i, j;
-
- vp3_idct_sse2(input_data, dequant_matrix, transformed_data);
-
- /* place in final output */
- op = transformed_data;
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- if (*op < -128)
- *dest = 0;
- else if (*op > 127)
- *dest = 255;
- else
- *dest = (uint8_t)(*op + 128);
- op++;
- dest++;
- }
- dest += (stride - 8);
- }
-}
-
-
-void vp3_idct_add_sse2(int16_t *input_data, int16_t *dequant_matrix,
- int coeff_count, uint8_t *dest, int stride)
-{
- int16_t transformed_data[64];
- int16_t *op;
- int i, j;
- int16_t sample;
-
- vp3_idct_sse2(input_data, dequant_matrix, transformed_data);
-
- /* place in final output */
- op = transformed_data;
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- sample = *dest + *op;
- if (sample < 0)
- *dest = 0;
- else if (sample > 255)
- *dest = 255;
- else
- *dest = (uint8_t)(sample & 0xFF);
- op++;
- dest++;
- }
- dest += (stride - 8);
- }
-}