comparison 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
comparison
equal deleted inserted replaced
1976:5dfde318d44a 1977:89422281f6f6
2049 { 2049 {
2050 int x, y; 2050 int x, y;
2051 int m, n; 2051 int m, n;
2052 int i = first_fragment; 2052 int i = first_fragment;
2053 int16_t *dequantizer; 2053 int16_t *dequantizer;
2054 DCTELEM __align16 output_samples[64];
2054 unsigned char *output_plane; 2055 unsigned char *output_plane;
2055 unsigned char *last_plane; 2056 unsigned char *last_plane;
2056 unsigned char *golden_plane; 2057 unsigned char *golden_plane;
2057 int stride; 2058 int stride;
2058 int motion_x, motion_y; 2059 int motion_x, motion_y;
2059 int upper_motion_limit, lower_motion_limit; 2060 int upper_motion_limit, lower_motion_limit;
2060 int motion_halfpel_index; 2061 int motion_halfpel_index;
2061 uint8_t *motion_source; 2062 uint8_t *motion_source;
2063
2064 int16_t *op;
2065 uint8_t *dest;
2066 int j, k;
2062 2067
2063 debug_vp3(" vp3: rendering final fragments for %s\n", 2068 debug_vp3(" vp3: rendering final fragments for %s\n",
2064 (plane == 0) ? "Y plane" : (plane == 1) ? "U plane" : "V plane"); 2069 (plane == 0) ? "Y plane" : (plane == 1) ? "U plane" : "V plane");
2065 2070
2066 /* set up plane-specific parameters */ 2071 /* set up plane-specific parameters */
2174 debug_idct("fragment %d, coding mode %d, DC = %d, dequant = %d:\n", 2179 debug_idct("fragment %d, coding mode %d, DC = %d, dequant = %d:\n",
2175 i, s->all_fragments[i].coding_method, 2180 i, s->all_fragments[i].coding_method,
2176 s->all_fragments[i].coeffs[0], dequantizer[0]); 2181 s->all_fragments[i].coeffs[0], dequantizer[0]);
2177 2182
2178 /* invert DCT and place (or add) in final output */ 2183 /* invert DCT and place (or add) in final output */
2184 s->dsp.vp3_idct(s->all_fragments[i].coeffs,
2185 dequantizer,
2186 s->all_fragments[i].coeff_count,
2187 output_samples);
2179 if (s->all_fragments[i].coding_method == MODE_INTRA) { 2188 if (s->all_fragments[i].coding_method == MODE_INTRA) {
2180 s->dsp.vp3_idct_put(s->all_fragments[i].coeffs, 2189 /* this really needs to be optimized sooner or later */
2181 dequantizer, 2190 op = output_samples;
2182 s->all_fragments[i].coeff_count, 2191 dest = output_plane + s->all_fragments[i].first_pixel;
2183 output_plane + s->all_fragments[i].first_pixel, 2192 for (j = 0; j < 8; j++) {
2184 stride); 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 }
2185 } else { 2205 } else {
2186 s->dsp.vp3_idct_add(s->all_fragments[i].coeffs, 2206 s->dsp.add_pixels_clamped(output_samples,
2187 dequantizer,
2188 s->all_fragments[i].coeff_count,
2189 output_plane + s->all_fragments[i].first_pixel, 2207 output_plane + s->all_fragments[i].first_pixel,
2190 stride); 2208 stride);
2191 } 2209 }
2192 2210
2193 debug_idct("block after idct_%s():\n", 2211 debug_idct("block after idct_%s():\n",