Mercurial > libavcodec.hg
comparison vp8dsp.c @ 11974:356b20a6566d libavcodec
VP8 bilinear filter
author | conrad |
---|---|
date | Sun, 27 Jun 2010 01:46:29 +0000 |
parents | 496d1300204d |
children | c3afb5be0d9b |
comparison
equal
deleted
inserted
replaced
11973:7ca225db75e8 | 11974:356b20a6566d |
---|---|
346 VP8_EPEL_HV(4, FILTER_6TAP, FILTER_4TAP, h6v4) | 346 VP8_EPEL_HV(4, FILTER_6TAP, FILTER_4TAP, h6v4) |
347 VP8_EPEL_HV(16, FILTER_6TAP, FILTER_6TAP, h6v6) | 347 VP8_EPEL_HV(16, FILTER_6TAP, FILTER_6TAP, h6v6) |
348 VP8_EPEL_HV(8, FILTER_6TAP, FILTER_6TAP, h6v6) | 348 VP8_EPEL_HV(8, FILTER_6TAP, FILTER_6TAP, h6v6) |
349 VP8_EPEL_HV(4, FILTER_6TAP, FILTER_6TAP, h6v6) | 349 VP8_EPEL_HV(4, FILTER_6TAP, FILTER_6TAP, h6v6) |
350 | 350 |
351 #define VP8_BILINEAR(SIZE) \ | |
352 static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \ | |
353 { \ | |
354 int a = 8-mx, b = mx; \ | |
355 int x, y; \ | |
356 \ | |
357 for (y = 0; y < h; y++) { \ | |
358 for (x = 0; x < SIZE; x++) \ | |
359 dst[x] = (a*src[x] + b*src[x+1] + 4) >> 3; \ | |
360 dst += stride; \ | |
361 src += stride; \ | |
362 } \ | |
363 } \ | |
364 static void put_vp8_bilinear ## SIZE ## _v_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \ | |
365 { \ | |
366 int c = 8-my, d = my; \ | |
367 int x, y; \ | |
368 \ | |
369 for (y = 0; y < h; y++) { \ | |
370 for (x = 0; x < SIZE; x++) \ | |
371 dst[x] = (c*src[x] + d*src[x+stride] + 4) >> 3; \ | |
372 dst += stride; \ | |
373 src += stride; \ | |
374 } \ | |
375 } \ | |
376 \ | |
377 static void put_vp8_bilinear ## SIZE ## _hv_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \ | |
378 { \ | |
379 int a = 8-mx, b = mx; \ | |
380 int c = 8-my, d = my; \ | |
381 int x, y; \ | |
382 uint8_t tmp_array[(2*SIZE+1)*SIZE]; \ | |
383 uint8_t *tmp = tmp_array; \ | |
384 \ | |
385 for (y = 0; y < h+1; y++) { \ | |
386 for (x = 0; x < SIZE; x++) \ | |
387 tmp[x] = (a*src[x] + b*src[x+1] + 4) >> 3; \ | |
388 tmp += SIZE; \ | |
389 src += stride; \ | |
390 } \ | |
391 \ | |
392 tmp = tmp_array; \ | |
393 \ | |
394 for (y = 0; y < h; y++) { \ | |
395 for (x = 0; x < SIZE; x++) \ | |
396 dst[x] = (c*tmp[x] + d*tmp[x+SIZE] + 4) >> 3; \ | |
397 dst += stride; \ | |
398 tmp += SIZE; \ | |
399 } \ | |
400 } | |
401 | |
402 VP8_BILINEAR(16) | |
403 VP8_BILINEAR(8) | |
404 VP8_BILINEAR(4) | |
405 | |
351 #define VP8_MC_FUNC(IDX, SIZE) \ | 406 #define VP8_MC_FUNC(IDX, SIZE) \ |
352 dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \ | 407 dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \ |
353 dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## _h4_c; \ | 408 dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## _h4_c; \ |
354 dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## _h6_c; \ | 409 dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## _h6_c; \ |
355 dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epel ## SIZE ## _v4_c; \ | 410 dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epel ## SIZE ## _v4_c; \ |
357 dsp->put_vp8_epel_pixels_tab[IDX][1][2] = put_vp8_epel ## SIZE ## _h6v4_c; \ | 412 dsp->put_vp8_epel_pixels_tab[IDX][1][2] = put_vp8_epel ## SIZE ## _h6v4_c; \ |
358 dsp->put_vp8_epel_pixels_tab[IDX][2][0] = put_vp8_epel ## SIZE ## _v6_c; \ | 413 dsp->put_vp8_epel_pixels_tab[IDX][2][0] = put_vp8_epel ## SIZE ## _v6_c; \ |
359 dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## _h4v6_c; \ | 414 dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## _h4v6_c; \ |
360 dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## _h6v6_c | 415 dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## _h6v6_c |
361 | 416 |
417 #define VP8_BILINEAR_MC_FUNC(IDX, SIZE) \ | |
418 dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \ | |
419 dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = put_vp8_bilinear ## SIZE ## _h_c; \ | |
420 dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = put_vp8_bilinear ## SIZE ## _h_c; \ | |
421 dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] = put_vp8_bilinear ## SIZE ## _v_c; \ | |
422 dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] = put_vp8_bilinear ## SIZE ## _hv_c; \ | |
423 dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] = put_vp8_bilinear ## SIZE ## _hv_c; \ | |
424 dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] = put_vp8_bilinear ## SIZE ## _v_c; \ | |
425 dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] = put_vp8_bilinear ## SIZE ## _hv_c; \ | |
426 dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinear ## SIZE ## _hv_c | |
427 | |
362 av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) | 428 av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) |
363 { | 429 { |
364 dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c; | 430 dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c; |
365 dsp->vp8_idct_add = vp8_idct_add_c; | 431 dsp->vp8_idct_add = vp8_idct_add_c; |
366 dsp->vp8_idct_dc_add = vp8_idct_dc_add_c; | 432 dsp->vp8_idct_dc_add = vp8_idct_dc_add_c; |
379 dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c; | 445 dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c; |
380 | 446 |
381 VP8_MC_FUNC(0, 16); | 447 VP8_MC_FUNC(0, 16); |
382 VP8_MC_FUNC(1, 8); | 448 VP8_MC_FUNC(1, 8); |
383 VP8_MC_FUNC(2, 4); | 449 VP8_MC_FUNC(2, 4); |
384 } | 450 |
451 VP8_BILINEAR_MC_FUNC(0, 16); | |
452 VP8_BILINEAR_MC_FUNC(1, 8); | |
453 VP8_BILINEAR_MC_FUNC(2, 4); | |
454 } |