comparison dsputil.c @ 11231:0fc1cdd984b7 libavcodec

Bink video decoder
author kostya
date Sun, 21 Feb 2010 13:28:46 +0000
parents d464f498e19f
children 98970e51365a
comparison
equal deleted inserted replaced
11230:9f25ae41c807 11231:0fc1cdd984b7
52 /* pngdec.c */ 52 /* pngdec.c */
53 void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp); 53 void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp);
54 54
55 /* eaidct.c */ 55 /* eaidct.c */
56 void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); 56 void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
57
58 /* binkidct.c */
59 void ff_bink_idct_c (DCTELEM *block);
60 void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block);
61 void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
57 62
58 uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, }; 63 uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, };
59 uint32_t ff_squareTbl[512] = {0, }; 64 uint32_t ff_squareTbl[512] = {0, };
60 65
61 // 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size 66 // 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size
654 } 659 }
655 pixels += (line_size - 8); 660 pixels += (line_size - 8);
656 } 661 }
657 } 662 }
658 663
664 static void put_pixels_nonclamped_c(const DCTELEM *block, uint8_t *restrict pixels,
665 int line_size)
666 {
667 int i;
668
669 /* read the pixels */
670 for(i=0;i<8;i++) {
671 pixels[0] = block[0];
672 pixels[1] = block[1];
673 pixels[2] = block[2];
674 pixels[3] = block[3];
675 pixels[4] = block[4];
676 pixels[5] = block[5];
677 pixels[6] = block[6];
678 pixels[7] = block[7];
679
680 pixels += line_size;
681 block += 8;
682 }
683 }
684
659 static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, 685 static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
660 int line_size) 686 int line_size)
661 { 687 {
662 int i; 688 int i;
663 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; 689 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
743 { 769 {
744 int sum=0, i; 770 int sum=0, i;
745 for(i=0; i<64; i++) 771 for(i=0; i<64; i++)
746 sum+= FFABS(block[i]); 772 sum+= FFABS(block[i]);
747 return sum; 773 return sum;
774 }
775
776 static void fill_block16_c(uint8_t *block, uint8_t value, int line_size, int h)
777 {
778 int i;
779
780 for (i = 0; i < h; i++) {
781 memset(block, value, 16);
782 block += line_size;
783 }
784 }
785
786 static void fill_block8_c(uint8_t *block, uint8_t value, int line_size, int h)
787 {
788 int i;
789
790 for (i = 0; i < h; i++) {
791 memset(block, value, 8);
792 block += line_size;
793 }
794 }
795
796 static void scale_block_c(const uint8_t src[64]/*align 8*/, uint8_t *dst/*align 8*/, int linesize)
797 {
798 int i, j;
799 uint16_t *dst1 = dst;
800 uint16_t *dst2 = dst + linesize;
801
802 for (j = 0; j < 8; j++) {
803 for (i = 0; i < 8; i++) {
804 dst1[i] = dst2[i] = src[i] * 0x0101;
805 }
806 src += 8;
807 dst1 += linesize;
808 dst2 += linesize;
809 }
748 } 810 }
749 811
750 #if 0 812 #if 0
751 813
752 #define PIXOP2(OPNAME, OP) \ 814 #define PIXOP2(OPNAME, OP) \
4555 c->idct = ff_faanidct; 4617 c->idct = ff_faanidct;
4556 c->idct_permutation_type= FF_NO_IDCT_PERM; 4618 c->idct_permutation_type= FF_NO_IDCT_PERM;
4557 }else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) { 4619 }else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) {
4558 c->idct_put= ff_ea_idct_put_c; 4620 c->idct_put= ff_ea_idct_put_c;
4559 c->idct_permutation_type= FF_NO_IDCT_PERM; 4621 c->idct_permutation_type= FF_NO_IDCT_PERM;
4622 }else if(CONFIG_BINK_DECODER && avctx->idct_algo==FF_IDCT_BINK) {
4623 c->idct = ff_bink_idct_c;
4624 c->idct_add = ff_bink_idct_add_c;
4625 c->idct_put = ff_bink_idct_put_c;
4626 c->idct_permutation_type = FF_NO_IDCT_PERM;
4560 }else{ //accurate/default 4627 }else{ //accurate/default
4561 c->idct_put= ff_simple_idct_put; 4628 c->idct_put= ff_simple_idct_put;
4562 c->idct_add= ff_simple_idct_add; 4629 c->idct_add= ff_simple_idct_add;
4563 c->idct = ff_simple_idct; 4630 c->idct = ff_simple_idct;
4564 c->idct_permutation_type= FF_NO_IDCT_PERM; 4631 c->idct_permutation_type= FF_NO_IDCT_PERM;
4578 4645
4579 c->get_pixels = get_pixels_c; 4646 c->get_pixels = get_pixels_c;
4580 c->diff_pixels = diff_pixels_c; 4647 c->diff_pixels = diff_pixels_c;
4581 c->put_pixels_clamped = put_pixels_clamped_c; 4648 c->put_pixels_clamped = put_pixels_clamped_c;
4582 c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; 4649 c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
4650 c->put_pixels_nonclamped = put_pixels_nonclamped_c;
4583 c->add_pixels_clamped = add_pixels_clamped_c; 4651 c->add_pixels_clamped = add_pixels_clamped_c;
4584 c->add_pixels8 = add_pixels8_c; 4652 c->add_pixels8 = add_pixels8_c;
4585 c->add_pixels4 = add_pixels4_c; 4653 c->add_pixels4 = add_pixels4_c;
4586 c->sum_abs_dctelem = sum_abs_dctelem_c; 4654 c->sum_abs_dctelem = sum_abs_dctelem_c;
4587 c->gmc1 = gmc1_c; 4655 c->gmc1 = gmc1_c;
4588 c->gmc = ff_gmc_c; 4656 c->gmc = ff_gmc_c;
4589 c->clear_block = clear_block_c; 4657 c->clear_block = clear_block_c;
4590 c->clear_blocks = clear_blocks_c; 4658 c->clear_blocks = clear_blocks_c;
4591 c->pix_sum = pix_sum_c; 4659 c->pix_sum = pix_sum_c;
4592 c->pix_norm1 = pix_norm1_c; 4660 c->pix_norm1 = pix_norm1_c;
4661
4662 c->fill_block_tab[0] = fill_block16_c;
4663 c->fill_block_tab[1] = fill_block8_c;
4664 c->scale_block = scale_block_c;
4593 4665
4594 /* TODO [0] 16 [1] 8 */ 4666 /* TODO [0] 16 [1] 8 */
4595 c->pix_abs[0][0] = pix_abs16_c; 4667 c->pix_abs[0][0] = pix_abs16_c;
4596 c->pix_abs[0][1] = pix_abs16_x2_c; 4668 c->pix_abs[0][1] = pix_abs16_x2_c;
4597 c->pix_abs[0][2] = pix_abs16_y2_c; 4669 c->pix_abs[0][2] = pix_abs16_y2_c;