Mercurial > libavcodec.hg
comparison imgresample.c @ 2979:bfabfdf9ce55 libavcodec
COSMETICS: tabs --> spaces, some prettyprinting
| author | diego |
|---|---|
| date | Thu, 22 Dec 2005 01:10:11 +0000 |
| parents | ef2149182f1c |
| children | 0b546eab515d |
comparison
equal
deleted
inserted
replaced
| 2978:403183bbb505 | 2979:bfabfdf9ce55 |
|---|---|
| 62 return ((pos) >> (POS_FRAC_BITS - PHASE_BITS)) & ((1 << PHASE_BITS) - 1); | 62 return ((pos) >> (POS_FRAC_BITS - PHASE_BITS)) & ((1 << PHASE_BITS) - 1); |
| 63 } | 63 } |
| 64 | 64 |
| 65 /* This function must be optimized */ | 65 /* This function must be optimized */ |
| 66 static void h_resample_fast(uint8_t *dst, int dst_width, const uint8_t *src, | 66 static void h_resample_fast(uint8_t *dst, int dst_width, const uint8_t *src, |
| 67 int src_width, int src_start, int src_incr, | 67 int src_width, int src_start, int src_incr, |
| 68 int16_t *filters) | 68 int16_t *filters) |
| 69 { | 69 { |
| 70 int src_pos, phase, sum, i; | 70 int src_pos, phase, sum, i; |
| 71 const uint8_t *s; | 71 const uint8_t *s; |
| 72 int16_t *filter; | 72 int16_t *filter; |
| 73 | 73 |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 /* This function must be optimized */ | 109 /* This function must be optimized */ |
| 110 static void v_resample(uint8_t *dst, int dst_width, const uint8_t *src, | 110 static void v_resample(uint8_t *dst, int dst_width, const uint8_t *src, |
| 111 int wrap, int16_t *filter) | 111 int wrap, int16_t *filter) |
| 112 { | 112 { |
| 113 int sum, i; | 113 int sum, i; |
| 114 const uint8_t *s; | 114 const uint8_t *s; |
| 115 | 115 |
| 116 s = src; | 116 s = src; |
| 165 | 165 |
| 166 #define DUMP(reg) movq_r2m(reg, tmp); printf(#reg "=%016Lx\n", tmp.uq); | 166 #define DUMP(reg) movq_r2m(reg, tmp); printf(#reg "=%016Lx\n", tmp.uq); |
| 167 | 167 |
| 168 /* XXX: do four pixels at a time */ | 168 /* XXX: do four pixels at a time */ |
| 169 static void h_resample_fast4_mmx(uint8_t *dst, int dst_width, | 169 static void h_resample_fast4_mmx(uint8_t *dst, int dst_width, |
| 170 const uint8_t *src, int src_width, | 170 const uint8_t *src, int src_width, |
| 171 int src_start, int src_incr, int16_t *filters) | 171 int src_start, int src_incr, int16_t *filters) |
| 172 { | 172 { |
| 173 int src_pos, phase; | 173 int src_pos, phase; |
| 174 const uint8_t *s; | 174 const uint8_t *s; |
| 175 int16_t *filter; | 175 int16_t *filter; |
| 210 } | 210 } |
| 211 emms(); | 211 emms(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 static void v_resample4_mmx(uint8_t *dst, int dst_width, const uint8_t *src, | 214 static void v_resample4_mmx(uint8_t *dst, int dst_width, const uint8_t *src, |
| 215 int wrap, int16_t *filter) | 215 int wrap, int16_t *filter) |
| 216 { | 216 { |
| 217 int sum, i, v; | 217 int sum, i, v; |
| 218 const uint8_t *s; | 218 const uint8_t *s; |
| 219 mmx_t tmp; | 219 mmx_t tmp; |
| 220 mmx_t coefs[4]; | 220 mmx_t coefs[4]; |
| 275 emms(); | 275 emms(); |
| 276 } | 276 } |
| 277 #endif | 277 #endif |
| 278 | 278 |
| 279 #ifdef HAVE_ALTIVEC | 279 #ifdef HAVE_ALTIVEC |
| 280 typedef union { | 280 typedef union { |
| 281 vector unsigned char v; | 281 vector unsigned char v; |
| 282 unsigned char c[16]; | 282 unsigned char c[16]; |
| 283 } vec_uc_t; | 283 } vec_uc_t; |
| 284 | 284 |
| 285 typedef union { | 285 typedef union { |
| 286 vector signed short v; | 286 vector signed short v; |
| 287 signed short s[8]; | 287 signed short s[8]; |
| 288 } vec_ss_t; | 288 } vec_ss_t; |
| 289 | 289 |
| 290 void v_resample16_altivec(uint8_t *dst, int dst_width, const uint8_t *src, | 290 void v_resample16_altivec(uint8_t *dst, int dst_width, const uint8_t *src, |
| 291 int wrap, int16_t *filter) | 291 int wrap, int16_t *filter) |
| 292 { | 292 { |
| 293 int sum, i; | 293 int sum, i; |
| 294 const uint8_t *s; | 294 const uint8_t *s; |
| 295 vector unsigned char *tv, tmp, dstv, zero; | 295 vector unsigned char *tv, tmp, dstv, zero; |
| 296 vec_ss_t srchv[4], srclv[4], fv[4]; | 296 vec_ss_t srchv[4], srclv[4], fv[4]; |
| 403 } | 403 } |
| 404 #endif | 404 #endif |
| 405 | 405 |
| 406 /* slow version to handle limit cases. Does not need optimisation */ | 406 /* slow version to handle limit cases. Does not need optimisation */ |
| 407 static void h_resample_slow(uint8_t *dst, int dst_width, | 407 static void h_resample_slow(uint8_t *dst, int dst_width, |
| 408 const uint8_t *src, int src_width, | 408 const uint8_t *src, int src_width, |
| 409 int src_start, int src_incr, int16_t *filters) | 409 int src_start, int src_incr, int16_t *filters) |
| 410 { | 410 { |
| 411 int src_pos, phase, sum, j, v, i; | 411 int src_pos, phase, sum, j, v, i; |
| 412 const uint8_t *s, *src_end; | 412 const uint8_t *s, *src_end; |
| 413 int16_t *filter; | 413 int16_t *filter; |
| 439 dst++; | 439 dst++; |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 | 442 |
| 443 static void h_resample(uint8_t *dst, int dst_width, const uint8_t *src, | 443 static void h_resample(uint8_t *dst, int dst_width, const uint8_t *src, |
| 444 int src_width, int src_start, int src_incr, | 444 int src_width, int src_start, int src_incr, |
| 445 int16_t *filters) | 445 int16_t *filters) |
| 446 { | 446 { |
| 447 int n, src_end; | 447 int n, src_end; |
| 448 | 448 |
| 449 if (src_start < 0) { | 449 if (src_start < 0) { |
| 450 n = (0 - src_start + src_incr - 1) / src_incr; | 450 n = (0 - src_start + src_incr - 1) / src_incr; |
| 557 int padleft, int padright) | 557 int padleft, int padright) |
| 558 { | 558 { |
| 559 ImgReSampleContext *s; | 559 ImgReSampleContext *s; |
| 560 | 560 |
| 561 if (!owidth || !oheight || !iwidth || !iheight) | 561 if (!owidth || !oheight || !iwidth || !iheight) |
| 562 return NULL; | 562 return NULL; |
| 563 | 563 |
| 564 s = av_mallocz(sizeof(ImgReSampleContext)); | 564 s = av_mallocz(sizeof(ImgReSampleContext)); |
| 565 if (!s) | 565 if (!s) |
| 566 return NULL; | 566 return NULL; |
| 567 if((unsigned)owidth >= UINT_MAX / (LINE_BUF_HEIGHT + NB_TAPS)) | 567 if((unsigned)owidth >= UINT_MAX / (LINE_BUF_HEIGHT + NB_TAPS)) |
