Mercurial > libavcodec.hg
comparison vc1dsp.c @ 5253:a69976bf878c libavcodec
Pass modes as parameters instead of calculating them inplace.
Patch by by Christophe GISQUET ( echo $name| awk '//{sub(" ",".");print tolower($0) "@free.fr";}')
Thread: [PATCH] Clean up in C VC-1 DSP functions
author | kostya |
---|---|
date | Sun, 08 Jul 2007 13:34:02 +0000 |
parents | e4b9ca118ab1 |
children | 90d90aecc83c |
comparison
equal
deleted
inserted
replaced
5252:e4b9ca118ab1 | 5253:a69976bf878c |
---|---|
340 return 0; //should not occur | 340 return 0; //should not occur |
341 } | 341 } |
342 | 342 |
343 /** Function used to do motion compensation with bicubic interpolation | 343 /** Function used to do motion compensation with bicubic interpolation |
344 */ | 344 */ |
345 static void vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int mode, int rnd) | 345 static void vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int hmode, int vmode, int rnd) |
346 { | 346 { |
347 int i, j; | 347 int i, j; |
348 uint8_t tmp[8*11], *tptr; | 348 uint8_t tmp[8*11], *tptr; |
349 int m, r; | 349 int r; |
350 | 350 |
351 m = (mode & 3); | |
352 r = rnd; | 351 r = rnd; |
353 src -= stride; | 352 src -= stride; |
354 tptr = tmp; | 353 tptr = tmp; |
355 for(j = 0; j < 11; j++) { | 354 for(j = 0; j < 11; j++) { |
356 for(i = 0; i < 8; i++) | 355 for(i = 0; i < 8; i++) |
357 tptr[i] = av_clip_uint8(vc1_mspel_filter(src + i, 1, m, r)); | 356 tptr[i] = av_clip_uint8(vc1_mspel_filter(src + i, 1, hmode, r)); |
358 src += stride; | 357 src += stride; |
359 tptr += 8; | 358 tptr += 8; |
360 } | 359 } |
361 r = 1 - rnd; | 360 r = 1 - rnd; |
362 m = (mode >> 2) & 3; | |
363 | 361 |
364 tptr = tmp + 8; | 362 tptr = tmp + 8; |
365 for(j = 0; j < 8; j++) { | 363 for(j = 0; j < 8; j++) { |
366 for(i = 0; i < 8; i++) | 364 for(i = 0; i < 8; i++) |
367 dst[i] = av_clip_uint8(vc1_mspel_filter(tptr + i, 8, m, r)); | 365 dst[i] = av_clip_uint8(vc1_mspel_filter(tptr + i, 8, vmode, r)); |
368 dst += stride; | 366 dst += stride; |
369 tptr += 8; | 367 tptr += 8; |
370 } | 368 } |
371 } | 369 } |
372 | 370 |
375 /* this one is defined in dsputil.c */ | 373 /* this one is defined in dsputil.c */ |
376 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd); | 374 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd); |
377 | 375 |
378 #define PUT_VC1_MSPEL(a, b)\ | 376 #define PUT_VC1_MSPEL(a, b)\ |
379 static void put_vc1_mspel_mc ## a ## b ##_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \ | 377 static void put_vc1_mspel_mc ## a ## b ##_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \ |
380 vc1_mspel_mc(dst, src, stride, (a)&((b<<2)), rnd); \ | 378 vc1_mspel_mc(dst, src, stride, a, b, rnd); \ |
381 } | 379 } |
382 | 380 |
383 PUT_VC1_MSPEL(1, 0) | 381 PUT_VC1_MSPEL(1, 0) |
384 PUT_VC1_MSPEL(2, 0) | 382 PUT_VC1_MSPEL(2, 0) |
385 PUT_VC1_MSPEL(3, 0) | 383 PUT_VC1_MSPEL(3, 0) |