comparison postproc/swscale_template.c @ 2575:37da7219ebaf

c optimizations
author michael
date Tue, 30 Oct 2001 22:03:25 +0000
parents f2353173d52c
children 437ed06579d8
comparison
equal deleted inserted replaced
2574:cc926eda63cd 2575:37da7219ebaf
786 } 786 }
787 #else 787 #else
788 //FIXME unroll C loop and dont recalculate UV 788 //FIXME unroll C loop and dont recalculate UV
789 asm volatile ("\n\t"::: "memory"); 789 asm volatile ("\n\t"::: "memory");
790 790
791 if(dstbpp==32 || dstbpp==24) 791 if(dstbpp==32)
792 { 792 {
793 for(i=0;i<dstw;i++){ 793 for(i=0; i<dstw-1; i+=2){
794 // vertical linear interpolation && yuv2rgb in a single step: 794 // vertical linear interpolation && yuv2rgb in a single step:
795 int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; 795 int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
796 int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)];
796 int U=((uvbuf0[i/2]*uvalpha1+uvbuf1[i/2]*uvalpha)>>19); 797 int U=((uvbuf0[i/2]*uvalpha1+uvbuf1[i/2]*uvalpha)>>19);
797 int V=((uvbuf0[i/2+2048]*uvalpha1+uvbuf1[i/2+2048]*uvalpha)>>19); 798 int V=((uvbuf0[i/2+2048]*uvalpha1+uvbuf1[i/2+2048]*uvalpha)>>19);
798 dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)]; 799
799 dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)]; 800 int Cb= yuvtab_40cf[U];
800 dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)]; 801 int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];
801 dest+=dstbpp>>3; 802 int Cr= yuvtab_3343[V];
803
804 dest[4*i+0]=clip_table[((Y1 + Cb) >>13)];
805 dest[4*i+1]=clip_table[((Y1 + Cg) >>13)];
806 dest[4*i+2]=clip_table[((Y1 + Cr) >>13)];
807
808 dest[4*i+4]=clip_table[((Y2 + Cb) >>13)];
809 dest[4*i+5]=clip_table[((Y2 + Cg) >>13)];
810 dest[4*i+6]=clip_table[((Y2 + Cr) >>13)];
802 } 811 }
803 } 812 }
804 else if(dstbpp==16) 813 if(dstbpp==24)
805 { 814 {
806 for(i=0;i<dstw;i++){ 815 for(i=0; i<dstw-1; i+=2){
807 // vertical linear interpolation && yuv2rgb in a single step: 816 // vertical linear interpolation && yuv2rgb in a single step:
808 int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; 817 int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
818 int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)];
809 int U=((uvbuf0[i/2]*uvalpha1+uvbuf1[i/2]*uvalpha)>>19); 819 int U=((uvbuf0[i/2]*uvalpha1+uvbuf1[i/2]*uvalpha)>>19);
810 int V=((uvbuf0[i/2+2048]*uvalpha1+uvbuf1[i/2+2048]*uvalpha)>>19); 820 int V=((uvbuf0[i/2+2048]*uvalpha1+uvbuf1[i/2+2048]*uvalpha)>>19);
811 821
812 ((uint16_t*)dest)[i] = 822 int Cb= yuvtab_40cf[U];
813 (clip_table[(Y + yuvtab_40cf[U]) >>13]>>3) | 823 int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];
814 ((clip_table[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13]<<3)&0x07E0) | 824 int Cr= yuvtab_3343[V];
815 ((clip_table[(Y + yuvtab_3343[V]) >>13]<<8)&0xF800); 825
826 dest[0]=clip_table[((Y1 + Cb) >>13)];
827 dest[1]=clip_table[((Y1 + Cg) >>13)];
828 dest[2]=clip_table[((Y1 + Cr) >>13)];
829
830 dest[3]=clip_table[((Y2 + Cb) >>13)];
831 dest[4]=clip_table[((Y2 + Cg) >>13)];
832 dest[5]=clip_table[((Y2 + Cr) >>13)];
833 dest+=6;
816 } 834 }
817 } 835 }
818 else if(dstbpp==15) 836 else if(dstbpp==16)
819 { 837 {
820 for(i=0;i<dstw;i++){ 838 for(i=0; i<dstw-1; i+=2){
821 // vertical linear interpolation && yuv2rgb in a single step: 839 // vertical linear interpolation && yuv2rgb in a single step:
822 int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; 840 int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
841 int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)];
823 int U=((uvbuf0[i/2]*uvalpha1+uvbuf1[i/2]*uvalpha)>>19); 842 int U=((uvbuf0[i/2]*uvalpha1+uvbuf1[i/2]*uvalpha)>>19);
824 int V=((uvbuf0[i/2+2048]*uvalpha1+uvbuf1[i/2+2048]*uvalpha)>>19); 843 int V=((uvbuf0[i/2+2048]*uvalpha1+uvbuf1[i/2+2048]*uvalpha)>>19);
825 844
845 int Cb= yuvtab_40cf[U];
846 int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];
847 int Cr= yuvtab_3343[V];
848
826 ((uint16_t*)dest)[i] = 849 ((uint16_t*)dest)[i] =
827 (clip_table[(Y + yuvtab_40cf[U]) >>13]>>3) | 850 (clip_table[(Y1 + Cb) >>13]>>3) |
828 ((clip_table[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13]<<2)&0x03E0) | 851 ((clip_table[(Y1 + Cg) >>13]<<3)&0x07E0) |
829 ((clip_table[(Y + yuvtab_3343[V]) >>13]<<7)&0x7C00); 852 ((clip_table[(Y1 + Cr) >>13]<<8)&0xF800);
853
854 ((uint16_t*)dest)[i+1] =
855 (clip_table[(Y2 + Cb) >>13]>>3) |
856 ((clip_table[(Y2 + Cg) >>13]<<3)&0x07E0) |
857 ((clip_table[(Y2 + Cr) >>13]<<8)&0xF800);
858 }
859 }
860 else if(dstbpp==15)
861 {
862 for(i=0; i<dstw-1; i+=2){
863 // vertical linear interpolation && yuv2rgb in a single step:
864 int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
865 int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)];
866 int U=((uvbuf0[i/2]*uvalpha1+uvbuf1[i/2]*uvalpha)>>19);
867 int V=((uvbuf0[i/2+2048]*uvalpha1+uvbuf1[i/2+2048]*uvalpha)>>19);
868
869 int Cb= yuvtab_40cf[U];
870 int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];
871 int Cr= yuvtab_3343[V];
872
873 ((uint16_t*)dest)[i] =
874 (clip_table[(Y1 + Cb) >>13]>>3) |
875 ((clip_table[(Y1 + Cg) >>13]<<2)&0x03E0) |
876 ((clip_table[(Y1 + Cr) >>13]<<7)&0x7C00);
877 ((uint16_t*)dest)[i+1] =
878 (clip_table[(Y2 + Cb) >>13]>>3) |
879 ((clip_table[(Y2 + Cg) >>13]<<2)&0x03E0) |
880 ((clip_table[(Y2 + Cr) >>13]<<7)&0x7C00);
830 } 881 }
831 } 882 }
832 #endif 883 #endif
833 } //!FULL_UV_IPOL 884 } //!FULL_UV_IPOL
834 } 885 }