Mercurial > libavcodec.hg
comparison snow.c @ 5627:a920d9b58f19 libavcodec
Cosmetics
author | lu_zero |
---|---|
date | Sat, 01 Sep 2007 14:00:47 +0000 |
parents | 946c2db0a093 |
children | 873ea64637d9 |
comparison
equal
deleted
inserted
replaced
5626:09fb7275a6bf | 5627:a920d9b58f19 |
---|---|
714 } | 714 } |
715 | 715 |
716 return v; | 716 return v; |
717 } | 717 } |
718 | 718 |
719 static av_always_inline void lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ | 719 static av_always_inline void |
720 lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, | |
721 int dst_step, int src_step, int ref_step, | |
722 int width, int mul, int add, int shift, | |
723 int highpass, int inverse){ | |
720 const int mirror_left= !highpass; | 724 const int mirror_left= !highpass; |
721 const int mirror_right= (width&1) ^ highpass; | 725 const int mirror_right= (width&1) ^ highpass; |
722 const int w= (width>>1) - 1 + (highpass & width); | 726 const int w= (width>>1) - 1 + (highpass & width); |
723 int i; | 727 int i; |
724 | 728 |
728 dst += dst_step; | 732 dst += dst_step; |
729 src += src_step; | 733 src += src_step; |
730 } | 734 } |
731 | 735 |
732 for(i=0; i<w; i++){ | 736 for(i=0; i<w; i++){ |
733 dst[i*dst_step] = LIFT(src[i*src_step], ((mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add)>>shift), inverse); | 737 dst[i*dst_step] = |
738 LIFT(src[i*src_step], | |
739 ((mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add)>>shift), | |
740 inverse); | |
734 } | 741 } |
735 | 742 |
736 if(mirror_right){ | 743 if(mirror_right){ |
737 dst[w*dst_step] = LIFT(src[w*src_step], ((mul*2*ref[w*ref_step]+add)>>shift), inverse); | 744 dst[w*dst_step] = |
738 } | 745 LIFT(src[w*src_step], |
739 } | 746 ((mul*2*ref[w*ref_step]+add)>>shift), |
740 | 747 inverse); |
741 static av_always_inline void inv_lift(IDWTELEM *dst, IDWTELEM *src, IDWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ | 748 } |
749 } | |
750 | |
751 static av_always_inline void | |
752 inv_lift(IDWTELEM *dst, IDWTELEM *src, IDWTELEM *ref, | |
753 int dst_step, int src_step, int ref_step, | |
754 int width, int mul, int add, int shift, | |
755 int highpass, int inverse){ | |
742 const int mirror_left= !highpass; | 756 const int mirror_left= !highpass; |
743 const int mirror_right= (width&1) ^ highpass; | 757 const int mirror_right= (width&1) ^ highpass; |
744 const int w= (width>>1) - 1 + (highpass & width); | 758 const int w= (width>>1) - 1 + (highpass & width); |
745 int i; | 759 int i; |
746 | 760 |
750 dst += dst_step; | 764 dst += dst_step; |
751 src += src_step; | 765 src += src_step; |
752 } | 766 } |
753 | 767 |
754 for(i=0; i<w; i++){ | 768 for(i=0; i<w; i++){ |
755 dst[i*dst_step] = LIFT(src[i*src_step], ((mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add)>>shift), inverse); | 769 dst[i*dst_step] = |
770 LIFT(src[i*src_step], | |
771 ((mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add)>>shift), | |
772 inverse); | |
756 } | 773 } |
757 | 774 |
758 if(mirror_right){ | 775 if(mirror_right){ |
759 dst[w*dst_step] = LIFT(src[w*src_step], ((mul*2*ref[w*ref_step]+add)>>shift), inverse); | 776 dst[w*dst_step] = |
777 LIFT(src[w*src_step], | |
778 ((mul*2*ref[w*ref_step]+add)>>shift), | |
779 inverse); | |
760 } | 780 } |
761 } | 781 } |
762 | 782 |
763 #ifndef liftS | 783 #ifndef liftS |
764 static av_always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ | 784 static av_always_inline void |
785 liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref, | |
786 int dst_step, int src_step, int ref_step, | |
787 int width, int mul, int add, int shift, | |
788 int highpass, int inverse){ | |
765 const int mirror_left= !highpass; | 789 const int mirror_left= !highpass; |
766 const int mirror_right= (width&1) ^ highpass; | 790 const int mirror_right= (width&1) ^ highpass; |
767 const int w= (width>>1) - 1 + (highpass & width); | 791 const int w= (width>>1) - 1 + (highpass & width); |
768 int i; | 792 int i; |
769 | 793 |
770 assert(shift == 4); | 794 assert(shift == 4); |
771 #define LIFTS(src, ref, inv) ((inv) ? (src) + (((ref) + 4*(src))>>shift): -((-16*(src) + (ref) + add/4 + 1 + (5<<25))/(5*4) - (1<<23))) | 795 #define LIFTS(src, ref, inv) \ |
796 ((inv) ? \ | |
797 (src) + (((ref) + 4*(src))>>shift): \ | |
798 -((-16*(src) + (ref) + add/4 + 1 + (5<<25))/(5*4) - (1<<23))) | |
772 if(mirror_left){ | 799 if(mirror_left){ |
773 dst[0] = LIFTS(src[0], mul*2*ref[0]+add, inverse); | 800 dst[0] = LIFTS(src[0], mul*2*ref[0]+add, inverse); |
774 dst += dst_step; | 801 dst += dst_step; |
775 src += src_step; | 802 src += src_step; |
776 } | 803 } |
777 | 804 |
778 for(i=0; i<w; i++){ | 805 for(i=0; i<w; i++){ |
779 dst[i*dst_step] = LIFTS(src[i*src_step], mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add, inverse); | 806 dst[i*dst_step] = |
807 LIFTS(src[i*src_step], | |
808 mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add, | |
809 inverse); | |
780 } | 810 } |
781 | 811 |
782 if(mirror_right){ | 812 if(mirror_right){ |
783 dst[w*dst_step] = LIFTS(src[w*src_step], mul*2*ref[w*ref_step]+add, inverse); | 813 dst[w*dst_step] = |
784 } | 814 LIFTS(src[w*src_step], mul*2*ref[w*ref_step]+add, inverse); |
785 } | 815 } |
786 static av_always_inline void inv_liftS(IDWTELEM *dst, IDWTELEM *src, IDWTELEM *ref, int dst_step, int src_step, int ref_step, int width, int mul, int add, int shift, int highpass, int inverse){ | 816 } |
817 static av_always_inline void | |
818 inv_liftS(IDWTELEM *dst, IDWTELEM *src, IDWTELEM *ref, | |
819 int dst_step, int src_step, int ref_step, | |
820 int width, int mul, int add, int shift, | |
821 int highpass, int inverse){ | |
787 const int mirror_left= !highpass; | 822 const int mirror_left= !highpass; |
788 const int mirror_right= (width&1) ^ highpass; | 823 const int mirror_right= (width&1) ^ highpass; |
789 const int w= (width>>1) - 1 + (highpass & width); | 824 const int w= (width>>1) - 1 + (highpass & width); |
790 int i; | 825 int i; |
791 | 826 |
792 assert(shift == 4); | 827 assert(shift == 4); |
793 #define LIFTS(src, ref, inv) ((inv) ? (src) + (((ref) + 4*(src))>>shift): -((-16*(src) + (ref) + add/4 + 1 + (5<<25))/(5*4) - (1<<23))) | 828 #define LIFTS(src, ref, inv) \ |
829 ((inv) ? \ | |
830 (src) + (((ref) + 4*(src))>>shift): \ | |
831 -((-16*(src) + (ref) + add/4 + 1 + (5<<25))/(5*4) - (1<<23))) | |
794 if(mirror_left){ | 832 if(mirror_left){ |
795 dst[0] = LIFTS(src[0], mul*2*ref[0]+add, inverse); | 833 dst[0] = LIFTS(src[0], mul*2*ref[0]+add, inverse); |
796 dst += dst_step; | 834 dst += dst_step; |
797 src += src_step; | 835 src += src_step; |
798 } | 836 } |
799 | 837 |
800 for(i=0; i<w; i++){ | 838 for(i=0; i<w; i++){ |
801 dst[i*dst_step] = LIFTS(src[i*src_step], mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add, inverse); | 839 dst[i*dst_step] = |
840 LIFTS(src[i*src_step], | |
841 mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add, | |
842 inverse); | |
802 } | 843 } |
803 | 844 |
804 if(mirror_right){ | 845 if(mirror_right){ |
805 dst[w*dst_step] = LIFTS(src[w*src_step], mul*2*ref[w*ref_step]+add, inverse); | 846 dst[w*dst_step] = |
847 LIFTS(src[w*src_step], mul*2*ref[w*ref_step]+add, inverse); | |
806 } | 848 } |
807 } | 849 } |
808 #endif | 850 #endif |
809 | 851 |
810 static void horizontal_decompose53i(DWTELEM *b, int width){ | 852 static void horizontal_decompose53i(DWTELEM *b, int width){ |