summaryrefslogtreecommitdiff
path: root/libavcodec/vp3.c
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/vp3.c
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/vp3.c')
-rw-r--r--libavcodec/vp3.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 0667d99eb8..cf22ee6ce0 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2051,6 +2051,7 @@ static void render_fragments(Vp3DecodeContext *s,
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 @@ static void render_fragments(Vp3DecodeContext *s,
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 @@ av_log(s->avctx, AV_LOG_ERROR, " help! got beefy vector! (%X, %X)\n", motion_x,
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);
}