Mercurial > mplayer.hg
comparison libvo/vo_directx.c @ 19242:8298ac25902e
optimize and simplify memcpy usage, use mem2agpcpy_pic
author | reimar |
---|---|
date | Sat, 29 Jul 2006 18:24:27 +0000 |
parents | 68560e9f3d6f |
children | 36589811e5d0 |
comparison
equal
deleted
inserted
replaced
19241:832945beef9f | 19242:8298ac25902e |
---|---|
1122 uint8_t *d; | 1122 uint8_t *d; |
1123 uint32_t i=0, uvstride=dstride/2; | 1123 uint32_t i=0, uvstride=dstride/2; |
1124 // copy Y | 1124 // copy Y |
1125 d=image+dstride*y+x; | 1125 d=image+dstride*y+x; |
1126 s=src[0]; | 1126 s=src[0]; |
1127 for(i=0;i<h;i++){ | 1127 mem2agpcpy_pic(d,s,w,h,dstride,stride[0]); |
1128 memcpy(d,s,w); | |
1129 s+=stride[0]; | |
1130 d+=dstride; | |
1131 } | |
1132 | 1128 |
1133 w/=2;h/=2;x/=2;y/=2; | 1129 w/=2;h/=2;x/=2;y/=2; |
1134 | 1130 |
1135 // copy U | 1131 // copy U |
1136 d=image+dstride*image_height + uvstride*y+x; | 1132 d=image+dstride*image_height + uvstride*y+x; |
1137 if(image_format == IMGFMT_YV12)s=src[2]; | 1133 if(image_format == IMGFMT_YV12)s=src[2]; |
1138 else s=src[1]; | 1134 else s=src[1]; |
1139 for(i=0;i<h;i++){ | 1135 mem2agpcpy_pic(d,s,w,h,uvstride,stride[1]); |
1140 memcpy(d,s,w); | |
1141 s+=stride[1]; | |
1142 d+=uvstride; | |
1143 } | |
1144 | 1136 |
1145 // copy V | 1137 // copy V |
1146 d=image+dstride*image_height +uvstride*(image_height/2) + uvstride*y+x; | 1138 d=image+dstride*image_height +uvstride*(image_height/2) + uvstride*y+x; |
1147 if(image_format == IMGFMT_YV12)s=src[1]; | 1139 if(image_format == IMGFMT_YV12)s=src[1]; |
1148 else s=src[2]; | 1140 else s=src[2]; |
1149 for(i=0;i<h;i++){ | 1141 mem2agpcpy_pic(d,s,w,h,uvstride,stride[2]); |
1150 memcpy(d,s,w); | |
1151 s+=stride[2]; | |
1152 d+=uvstride; | |
1153 } | |
1154 return 0; | 1142 return 0; |
1155 } | 1143 } |
1156 | 1144 |
1157 static void flip_page(void) | 1145 static void flip_page(void) |
1158 { | 1146 { |
1257 else | 1245 else |
1258 { | 1246 { |
1259 // copy Y | 1247 // copy Y |
1260 d=image+dstride*y+x; | 1248 d=image+dstride*y+x; |
1261 s=mpi->planes[0]; | 1249 s=mpi->planes[0]; |
1262 for(i=0;i<h;i++){ | 1250 mem2agpcpy_pic(d,s,w,h,dstride,mpi->stride[0]); |
1263 memcpy(d,s,w); | |
1264 s+=mpi->stride[0]; | |
1265 d+=dstride; | |
1266 } | |
1267 w/=4;h/=4;x/=4;y/=4; | 1251 w/=4;h/=4;x/=4;y/=4; |
1268 // copy V | 1252 // copy V |
1269 d=image+dstride*image_height + dstride*y/4+x; | 1253 d=image+dstride*image_height + dstride*y/4+x; |
1270 s=mpi->planes[2]; | 1254 s=mpi->planes[2]; |
1271 for(i=0;i<h;i++){ | 1255 mem2agpcpy_pic(d,s,w,h,dstride/4,mpi->stride[1]); |
1272 memcpy(d,s,w); | |
1273 s+=mpi->stride[1]; | |
1274 d+=dstride/4; | |
1275 } | |
1276 // copy U | 1256 // copy U |
1277 d=image+dstride*image_height + dstride*image_height/16 + dstride/4*y+x; | 1257 d=image+dstride*image_height + dstride*image_height/16 + dstride/4*y+x; |
1278 s=mpi->planes[1]; | 1258 s=mpi->planes[1]; |
1279 for(i=0;i<h;i++){ | 1259 mem2agpcpy_pic(d,s,w,h,dstride/4,mpi->stride[2]); |
1280 memcpy(d,s,w); | |
1281 s+=mpi->stride[2]; | |
1282 d+=dstride/4; | |
1283 } | |
1284 } | 1260 } |
1285 } | 1261 } |
1286 else //packed | 1262 else //packed |
1287 { | 1263 { |
1288 memcpy( image, mpi->planes[0], image_height * dstride); | 1264 memcpy( image, mpi->planes[0], image_height * dstride); |