Mercurial > libavcodec.hg
comparison dsputil.c @ 5887:83ac4620c6ed libavcodec
intrax8 decoder patch by "someone"
author | michael |
---|---|
date | Fri, 09 Nov 2007 21:37:48 +0000 |
parents | efa3c1f9259a |
children | 290812aa9bd5 |
comparison
equal
deleted
inserted
replaced
5886:85c4aca68be3 | 5887:83ac4620c6ed |
---|---|
2559 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, uint8_t *src, int stride, int rnd) { | 2559 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, uint8_t *src, int stride, int rnd) { |
2560 put_pixels8_c(dst, src, stride, 8); | 2560 put_pixels8_c(dst, src, stride, 8); |
2561 } | 2561 } |
2562 #endif /* CONFIG_VC1_DECODER||CONFIG_WMV3_DECODER */ | 2562 #endif /* CONFIG_VC1_DECODER||CONFIG_WMV3_DECODER */ |
2563 | 2563 |
2564 #if defined(CONFIG_WMV2_DECODER) || defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER) | |
2565 void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); | |
2566 #endif | |
2567 | |
2564 #if defined(CONFIG_H264_ENCODER) | 2568 #if defined(CONFIG_H264_ENCODER) |
2565 /* H264 specific */ | 2569 /* H264 specific */ |
2566 void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx); | 2570 void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx); |
2567 #endif /* CONFIG_H264_ENCODER */ | 2571 #endif /* CONFIG_H264_ENCODER */ |
2568 | 2572 |
3756 } | 3760 } |
3757 dst[i] = tmp - 0x8000; | 3761 dst[i] = tmp - 0x8000; |
3758 } | 3762 } |
3759 } | 3763 } |
3760 | 3764 |
3765 #define W0 2048 | |
3766 #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ | |
3767 #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ | |
3768 #define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */ | |
3769 #define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */ | |
3770 #define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */ | |
3771 #define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */ | |
3772 #define W7 565 /* 2048*sqrt (2)*cos (7*pi/16) */ | |
3773 | |
3774 static void wmv2_idct_row(short * b) | |
3775 { | |
3776 int s1,s2; | |
3777 int a0,a1,a2,a3,a4,a5,a6,a7; | |
3778 /*step 1*/ | |
3779 a1 = W1*b[1]+W7*b[7]; | |
3780 a7 = W7*b[1]-W1*b[7]; | |
3781 a5 = W5*b[5]+W3*b[3]; | |
3782 a3 = W3*b[5]-W5*b[3]; | |
3783 a2 = W2*b[2]+W6*b[6]; | |
3784 a6 = W6*b[2]-W2*b[6]; | |
3785 a0 = W0*b[0]+W0*b[4]; | |
3786 a4 = W0*b[0]-W0*b[4]; | |
3787 /*step 2*/ | |
3788 s1 = (181*(a1-a5+a7-a3)+128)>>8;//1,3,5,7, | |
3789 s2 = (181*(a1-a5-a7+a3)+128)>>8; | |
3790 /*step 3*/ | |
3791 b[0] = (a0+a2+a1+a5 + (1<<7))>>8; | |
3792 b[1] = (a4+a6 +s1 + (1<<7))>>8; | |
3793 b[2] = (a4-a6 +s2 + (1<<7))>>8; | |
3794 b[3] = (a0-a2+a7+a3 + (1<<7))>>8; | |
3795 b[4] = (a0-a2-a7-a3 + (1<<7))>>8; | |
3796 b[5] = (a4-a6 -s2 + (1<<7))>>8; | |
3797 b[6] = (a4+a6 -s1 + (1<<7))>>8; | |
3798 b[7] = (a0+a2-a1-a5 + (1<<7))>>8; | |
3799 } | |
3800 static void wmv2_idct_col(short * b) | |
3801 { | |
3802 int s1,s2; | |
3803 int a0,a1,a2,a3,a4,a5,a6,a7; | |
3804 /*step 1, with extended precision*/ | |
3805 a1 = (W1*b[8*1]+W7*b[8*7] + 4)>>3; | |
3806 a7 = (W7*b[8*1]-W1*b[8*7] + 4)>>3; | |
3807 a5 = (W5*b[8*5]+W3*b[8*3] + 4)>>3; | |
3808 a3 = (W3*b[8*5]-W5*b[8*3] + 4)>>3; | |
3809 a2 = (W2*b[8*2]+W6*b[8*6] + 4)>>3; | |
3810 a6 = (W6*b[8*2]-W2*b[8*6] + 4)>>3; | |
3811 a0 = (W0*b[8*0]+W0*b[8*4] )>>3; | |
3812 a4 = (W0*b[8*0]-W0*b[8*4] )>>3; | |
3813 /*step 2*/ | |
3814 s1 = (181*(a1-a5+a7-a3)+128)>>8; | |
3815 s2 = (181*(a1-a5-a7+a3)+128)>>8; | |
3816 /*step 3*/ | |
3817 b[8*0] = (a0+a2+a1+a5 + (1<<13))>>14; | |
3818 b[8*1] = (a4+a6 +s1 + (1<<13))>>14; | |
3819 b[8*2] = (a4-a6 +s2 + (1<<13))>>14; | |
3820 b[8*3] = (a0-a2+a7+a3 + (1<<13))>>14; | |
3821 | |
3822 b[8*4] = (a0-a2-a7-a3 + (1<<13))>>14; | |
3823 b[8*5] = (a4-a6 -s2 + (1<<13))>>14; | |
3824 b[8*6] = (a4+a6 -s1 + (1<<13))>>14; | |
3825 b[8*7] = (a0+a2-a1-a5 + (1<<13))>>14; | |
3826 } | |
3827 void ff_wmv2_idct_c(short * block){ | |
3828 int i; | |
3829 | |
3830 for(i=0;i<64;i+=8){ | |
3831 wmv2_idct_row(block+i); | |
3832 } | |
3833 for(i=0;i<8;i++){ | |
3834 wmv2_idct_col(block+i); | |
3835 } | |
3836 } | |
3761 /* XXX: those functions should be suppressed ASAP when all IDCTs are | 3837 /* XXX: those functions should be suppressed ASAP when all IDCTs are |
3762 converted */ | 3838 converted */ |
3839 static void ff_wmv2_idct_put_c(uint8_t *dest, int line_size, DCTELEM *block) | |
3840 { | |
3841 ff_wmv2_idct_c(block); | |
3842 put_pixels_clamped_c(block, dest, line_size); | |
3843 } | |
3844 static void ff_wmv2_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block) | |
3845 { | |
3846 ff_wmv2_idct_c(block); | |
3847 add_pixels_clamped_c(block, dest, line_size); | |
3848 } | |
3763 static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block) | 3849 static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block) |
3764 { | 3850 { |
3765 j_rev_dct (block); | 3851 j_rev_dct (block); |
3766 put_pixels_clamped_c(block, dest, line_size); | 3852 put_pixels_clamped_c(block, dest, line_size); |
3767 } | 3853 } |
3897 avctx->idct_algo==FF_IDCT_VP3){ | 3983 avctx->idct_algo==FF_IDCT_VP3){ |
3898 c->idct_put= ff_vp3_idct_put_c; | 3984 c->idct_put= ff_vp3_idct_put_c; |
3899 c->idct_add= ff_vp3_idct_add_c; | 3985 c->idct_add= ff_vp3_idct_add_c; |
3900 c->idct = ff_vp3_idct_c; | 3986 c->idct = ff_vp3_idct_c; |
3901 c->idct_permutation_type= FF_NO_IDCT_PERM; | 3987 c->idct_permutation_type= FF_NO_IDCT_PERM; |
3988 }else if(avctx->idct_algo==FF_IDCT_WMV2){ | |
3989 c->idct_put= ff_wmv2_idct_put_c; | |
3990 c->idct_add= ff_wmv2_idct_add_c; | |
3991 c->idct = ff_wmv2_idct_c; | |
3992 c->idct_permutation_type= FF_NO_IDCT_PERM; | |
3902 }else{ //accurate/default | 3993 }else{ //accurate/default |
3903 c->idct_put= simple_idct_put; | 3994 c->idct_put= simple_idct_put; |
3904 c->idct_add= simple_idct_add; | 3995 c->idct_add= simple_idct_add; |
3905 c->idct = simple_idct; | 3996 c->idct = simple_idct; |
3906 c->idct_permutation_type= FF_NO_IDCT_PERM; | 3997 c->idct_permutation_type= FF_NO_IDCT_PERM; |
4053 #ifdef CONFIG_CAVS_DECODER | 4144 #ifdef CONFIG_CAVS_DECODER |
4054 ff_cavsdsp_init(c,avctx); | 4145 ff_cavsdsp_init(c,avctx); |
4055 #endif | 4146 #endif |
4056 #if defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER) | 4147 #if defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER) |
4057 ff_vc1dsp_init(c,avctx); | 4148 ff_vc1dsp_init(c,avctx); |
4149 #endif | |
4150 #if defined(CONFIG_WMV2_DECODER) || defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER) | |
4151 ff_intrax8dsp_init(c,avctx); | |
4058 #endif | 4152 #endif |
4059 #if defined(CONFIG_H264_ENCODER) | 4153 #if defined(CONFIG_H264_ENCODER) |
4060 ff_h264dspenc_init(c,avctx); | 4154 ff_h264dspenc_init(c,avctx); |
4061 #endif | 4155 #endif |
4062 | 4156 |