Mercurial > libavcodec.hg
comparison dsputil.c @ 1319:449f6e32b425 libavcodec
added support for B-frames and multiple slices
author | tmmm |
---|---|
date | Thu, 19 Jun 2003 01:44:44 +0000 |
parents | a979fab41ed8 |
children | 7d328fd9d8a5 |
comparison
equal
deleted
inserted
replaced
1318:209abbb4c4f7 | 1319:449f6e32b425 |
---|---|
1031 static inline void put_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | 1031 static inline void put_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ |
1032 int i,j; | 1032 int i,j; |
1033 for (i=0; i < height; i++) { | 1033 for (i=0; i < height; i++) { |
1034 for (j=0; j < width; j++) { | 1034 for (j=0; j < width; j++) { |
1035 dst[j] = (2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15; | 1035 dst[j] = (2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15; |
1036 } | |
1037 src += stride; | |
1038 dst += stride; | |
1039 } | |
1040 } | |
1041 | |
1042 static inline void avg_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1043 switch(width){ | |
1044 case 2: avg_pixels2_c (dst, src, stride, height); break; | |
1045 case 4: avg_pixels4_c (dst, src, stride, height); break; | |
1046 case 8: avg_pixels8_c (dst, src, stride, height); break; | |
1047 case 16:avg_pixels16_c(dst, src, stride, height); break; | |
1048 } | |
1049 } | |
1050 | |
1051 static inline void avg_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1052 int i,j; | |
1053 for (i=0; i < height; i++) { | |
1054 for (j=0; j < width; j++) { | |
1055 dst[j] = (dst[j] + ((683*(2*src[j] + src[j+1] + 1)) >> 11) + 1) >> 1; | |
1056 } | |
1057 src += stride; | |
1058 dst += stride; | |
1059 } | |
1060 } | |
1061 | |
1062 static inline void avg_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1063 int i,j; | |
1064 for (i=0; i < height; i++) { | |
1065 for (j=0; j < width; j++) { | |
1066 dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+1] + 1)) >> 11) + 1) >> 1; | |
1067 } | |
1068 src += stride; | |
1069 dst += stride; | |
1070 } | |
1071 } | |
1072 | |
1073 static inline void avg_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1074 int i,j; | |
1075 for (i=0; i < height; i++) { | |
1076 for (j=0; j < width; j++) { | |
1077 dst[j] = (dst[j] + ((683*(2*src[j] + src[j+stride] + 1)) >> 11) + 1) >> 1; | |
1078 } | |
1079 src += stride; | |
1080 dst += stride; | |
1081 } | |
1082 } | |
1083 | |
1084 static inline void avg_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1085 int i,j; | |
1086 for (i=0; i < height; i++) { | |
1087 for (j=0; j < width; j++) { | |
1088 dst[j] = (dst[j] + ((2731*(4*src[j] + 3*src[j+1] + 3*src[j+stride] + 2*src[j+stride+1] + 6)) >> 15) + 1) >> 1; | |
1089 } | |
1090 src += stride; | |
1091 dst += stride; | |
1092 } | |
1093 } | |
1094 | |
1095 static inline void avg_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1096 int i,j; | |
1097 for (i=0; i < height; i++) { | |
1098 for (j=0; j < width; j++) { | |
1099 dst[j] = (dst[j] + ((2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1; | |
1100 } | |
1101 src += stride; | |
1102 dst += stride; | |
1103 } | |
1104 } | |
1105 | |
1106 static inline void avg_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1107 int i,j; | |
1108 for (i=0; i < height; i++) { | |
1109 for (j=0; j < width; j++) { | |
1110 dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+stride] + 1)) >> 11) + 1) >> 1; | |
1111 } | |
1112 src += stride; | |
1113 dst += stride; | |
1114 } | |
1115 } | |
1116 | |
1117 static inline void avg_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1118 int i,j; | |
1119 for (i=0; i < height; i++) { | |
1120 for (j=0; j < width; j++) { | |
1121 dst[j] = (dst[j] + ((2731*(3*src[j] + 2*src[j+1] + 4*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1; | |
1122 } | |
1123 src += stride; | |
1124 dst += stride; | |
1125 } | |
1126 } | |
1127 | |
1128 static inline void avg_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ | |
1129 int i,j; | |
1130 for (i=0; i < height; i++) { | |
1131 for (j=0; j < width; j++) { | |
1132 dst[j] = (dst[j] + ((2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15) + 1) >> 1; | |
1036 } | 1133 } |
1037 src += stride; | 1134 src += stride; |
1038 dst += stride; | 1135 dst += stride; |
1039 } | 1136 } |
1040 } | 1137 } |
2807 | 2904 |
2808 dspfunc(avg, 0, 16); | 2905 dspfunc(avg, 0, 16); |
2809 dspfunc(avg_no_rnd, 0, 16); | 2906 dspfunc(avg_no_rnd, 0, 16); |
2810 dspfunc(avg, 1, 8); | 2907 dspfunc(avg, 1, 8); |
2811 dspfunc(avg_no_rnd, 1, 8); | 2908 dspfunc(avg_no_rnd, 1, 8); |
2909 dspfunc(avg, 2, 4); | |
2910 dspfunc(avg, 3, 2); | |
2812 #undef dspfunc | 2911 #undef dspfunc |
2813 | 2912 |
2814 c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c; | 2913 c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c; |
2815 c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c; | 2914 c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c; |
2816 c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c; | 2915 c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c; |
2818 c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c; | 2917 c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c; |
2819 c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c; | 2918 c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c; |
2820 c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c; | 2919 c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c; |
2821 c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c; | 2920 c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c; |
2822 c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c; | 2921 c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c; |
2922 | |
2923 c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c; | |
2924 c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c; | |
2925 c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c; | |
2926 c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c; | |
2927 c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c; | |
2928 c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c; | |
2929 c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c; | |
2930 c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c; | |
2931 c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c; | |
2823 | 2932 |
2824 #define dspfunc(PFX, IDX, NUM) \ | 2933 #define dspfunc(PFX, IDX, NUM) \ |
2825 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \ | 2934 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \ |
2826 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \ | 2935 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \ |
2827 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \ | 2936 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \ |