comparison vp3.c @ 1984:ef919e9ef73e libavcodec

separate out put_signed_pixels_clamped() into its own function and implement an optimized MMX version of the function
author melanson
date Tue, 27 Apr 2004 03:58:06 +0000
parents 89422281f6f6
children 141a9539e270
comparison
equal deleted inserted replaced
1983:1205bf58c420 1984:ef919e9ef73e
2058 int stride; 2058 int stride;
2059 int motion_x, motion_y; 2059 int motion_x, motion_y;
2060 int upper_motion_limit, lower_motion_limit; 2060 int upper_motion_limit, lower_motion_limit;
2061 int motion_halfpel_index; 2061 int motion_halfpel_index;
2062 uint8_t *motion_source; 2062 uint8_t *motion_source;
2063
2064 int16_t *op;
2065 uint8_t *dest;
2066 int j, k;
2067 2063
2068 debug_vp3(" vp3: rendering final fragments for %s\n", 2064 debug_vp3(" vp3: rendering final fragments for %s\n",
2069 (plane == 0) ? "Y plane" : (plane == 1) ? "U plane" : "V plane"); 2065 (plane == 0) ? "Y plane" : (plane == 1) ? "U plane" : "V plane");
2070 2066
2071 /* set up plane-specific parameters */ 2067 /* set up plane-specific parameters */
2184 s->dsp.vp3_idct(s->all_fragments[i].coeffs, 2180 s->dsp.vp3_idct(s->all_fragments[i].coeffs,
2185 dequantizer, 2181 dequantizer,
2186 s->all_fragments[i].coeff_count, 2182 s->all_fragments[i].coeff_count,
2187 output_samples); 2183 output_samples);
2188 if (s->all_fragments[i].coding_method == MODE_INTRA) { 2184 if (s->all_fragments[i].coding_method == MODE_INTRA) {
2189 /* this really needs to be optimized sooner or later */ 2185 s->dsp.put_signed_pixels_clamped(output_samples,
2190 op = output_samples; 2186 output_plane + s->all_fragments[i].first_pixel,
2191 dest = output_plane + s->all_fragments[i].first_pixel; 2187 stride);
2192 for (j = 0; j < 8; j++) {
2193 for (k = 0; k < 8; k++) {
2194 if (*op < -128)
2195 *dest = 0;
2196 else if (*op > 127)
2197 *dest = 255;
2198 else
2199 *dest = (uint8_t)(*op + 128);
2200 op++;
2201 dest++;
2202 }
2203 dest += (stride - 8);
2204 }
2205 } else { 2188 } else {
2206 s->dsp.add_pixels_clamped(output_samples, 2189 s->dsp.add_pixels_clamped(output_samples,
2207 output_plane + s->all_fragments[i].first_pixel, 2190 output_plane + s->all_fragments[i].first_pixel,
2208 stride); 2191 stride);
2209 } 2192 }