diff vp3.c @ 1977:89422281f6f6 libavcodec

reorganize and simplify the VP3 IDCT stuff
author melanson
date Mon, 26 Apr 2004 00:20:29 +0000
parents 8a556283601d
children ef919e9ef73e
line wrap: on
line diff
--- a/vp3.c	Sun Apr 25 19:03:35 2004 +0000
+++ b/vp3.c	Mon Apr 26 00:20:29 2004 +0000
@@ -2051,6 +2051,7 @@
     int m, n;
     int i = first_fragment;
     int16_t *dequantizer;
+    DCTELEM __align16 output_samples[64];
     unsigned char *output_plane;
     unsigned char *last_plane;
     unsigned char *golden_plane;
@@ -2060,6 +2061,10 @@
     int motion_halfpel_index;
     uint8_t *motion_source;
 
+    int16_t *op;
+    uint8_t *dest;
+    int j, k;
+
     debug_vp3("  vp3: rendering final fragments for %s\n",
         (plane == 0) ? "Y plane" : (plane == 1) ? "U plane" : "V plane");
 
@@ -2176,16 +2181,29 @@
                     s->all_fragments[i].coeffs[0], dequantizer[0]);
 
                 /* invert DCT and place (or add) in final output */
+                s->dsp.vp3_idct(s->all_fragments[i].coeffs,
+                    dequantizer,
+                    s->all_fragments[i].coeff_count,
+                    output_samples);
                 if (s->all_fragments[i].coding_method == MODE_INTRA) {
-                    s->dsp.vp3_idct_put(s->all_fragments[i].coeffs, 
-                        dequantizer,
-                        s->all_fragments[i].coeff_count,
-                        output_plane + s->all_fragments[i].first_pixel,
-                        stride);
+                    /* this really needs to be optimized sooner or later */
+                    op = output_samples;
+                    dest = output_plane + s->all_fragments[i].first_pixel;
+                    for (j = 0; j < 8; j++) {
+                        for (k = 0; k < 8; k++) {
+                            if (*op < -128)
+                                *dest = 0;
+                            else if (*op > 127)
+                                *dest = 255;
+                            else
+                                *dest = (uint8_t)(*op + 128);
+                            op++;
+                            dest++;
+                        }
+                        dest += (stride - 8);
+                    }
                 } else {
-                    s->dsp.vp3_idct_add(s->all_fragments[i].coeffs, 
-                        dequantizer,
-                        s->all_fragments[i].coeff_count,
+                    s->dsp.add_pixels_clamped(output_samples,
                         output_plane + s->all_fragments[i].first_pixel,
                         stride);
                 }