Mercurial > libavcodec.hg
comparison i386/vp3dsp_sse2.c @ 1977:89422281f6f6 libavcodec
reorganize and simplify the VP3 IDCT stuff
author | melanson |
---|---|
date | Mon, 26 Apr 2004 00:20:29 +0000 |
parents | 8dc96e383480 |
children | 6d104923f8f3 |
comparison
equal
deleted
inserted
replaced
1976:5dfde318d44a | 1977:89422281f6f6 |
---|---|
797 | 797 |
798 | 798 |
799 void vp3_dsp_init_sse2(void) | 799 void vp3_dsp_init_sse2(void) |
800 { | 800 { |
801 /* nop */ | 801 /* nop */ |
802 av_log(NULL, AV_LOG_INFO, "Hey! SSE2!\n"); | |
802 } | 803 } |
803 | 804 |
804 | 805 |
805 static void vp3_idct_sse2(int16_t *input_data, int16_t *dequant_matrix, | 806 void vp3_idct_sse2(int16_t *input_data, int16_t *dequant_matrix, |
806 int16_t *output_data) | 807 int coeff_count, int16_t *output_data) |
807 { | 808 { |
808 unsigned char *input_bytes = (unsigned char *)input_data; | 809 unsigned char *input_bytes = (unsigned char *)input_data; |
809 unsigned char *dequant_matrix_bytes = (unsigned char *)dequant_matrix; | 810 unsigned char *dequant_matrix_bytes = (unsigned char *)dequant_matrix; |
810 unsigned char *dequant_const_bytes = (unsigned char *)SSE2_dequant_const; | 811 unsigned char *dequant_const_bytes = (unsigned char *)SSE2_dequant_const; |
811 unsigned char *output_data_bytes = (unsigned char *)output_data; | 812 unsigned char *output_data_bytes = (unsigned char *)output_data; |
830 | 831 |
831 SSE2_Transpose(); | 832 SSE2_Transpose(); |
832 | 833 |
833 SSE2_Column_IDCT(); | 834 SSE2_Column_IDCT(); |
834 } | 835 } |
835 | |
836 | |
837 void vp3_idct_put_sse2(int16_t *input_data, int16_t *dequant_matrix, | |
838 int coeff_count, uint8_t *dest, int stride) | |
839 { | |
840 int16_t transformed_data[64]; | |
841 int16_t *op; | |
842 int i, j; | |
843 | |
844 vp3_idct_sse2(input_data, dequant_matrix, transformed_data); | |
845 | |
846 /* place in final output */ | |
847 op = transformed_data; | |
848 for (i = 0; i < 8; i++) { | |
849 for (j = 0; j < 8; j++) { | |
850 if (*op < -128) | |
851 *dest = 0; | |
852 else if (*op > 127) | |
853 *dest = 255; | |
854 else | |
855 *dest = (uint8_t)(*op + 128); | |
856 op++; | |
857 dest++; | |
858 } | |
859 dest += (stride - 8); | |
860 } | |
861 } | |
862 | |
863 | |
864 void vp3_idct_add_sse2(int16_t *input_data, int16_t *dequant_matrix, | |
865 int coeff_count, uint8_t *dest, int stride) | |
866 { | |
867 int16_t transformed_data[64]; | |
868 int16_t *op; | |
869 int i, j; | |
870 int16_t sample; | |
871 | |
872 vp3_idct_sse2(input_data, dequant_matrix, transformed_data); | |
873 | |
874 /* place in final output */ | |
875 op = transformed_data; | |
876 for (i = 0; i < 8; i++) { | |
877 for (j = 0; j < 8; j++) { | |
878 sample = *dest + *op; | |
879 if (sample < 0) | |
880 *dest = 0; | |
881 else if (sample > 255) | |
882 *dest = 255; | |
883 else | |
884 *dest = (uint8_t)(sample & 0xFF); | |
885 op++; | |
886 dest++; | |
887 } | |
888 dest += (stride - 8); | |
889 } | |
890 } |