comparison libswscale/cs_test.c @ 22829:9ade9f0ebfc0

Handle proper compilation on Mac OS X. Fix data alignment bug (the original purpose of the code is unclear, though). patch by Marc Hoffman, mmh pleasantst com
author diego
date Fri, 30 Mar 2007 22:09:13 +0000
parents a9b8e965de13
children 5922ce1dfefc
comparison
equal deleted inserted replaced
22828:591da5b6d6e8 22829:9ade9f0ebfc0
21 #include <stdio.h> 21 #include <stdio.h>
22 #include <string.h> /* for memset() */ 22 #include <string.h> /* for memset() */
23 #include <unistd.h> 23 #include <unistd.h>
24 #include <stdlib.h> 24 #include <stdlib.h>
25 #include <inttypes.h> 25 #include <inttypes.h>
26 #include <malloc.h>
27 26
28 #include "swscale.h" 27 #include "swscale.h"
29 #include "rgb2rgb.h" 28 #include "rgb2rgb.h"
30 29
31 #define SIZE 1000 30 #define SIZE 1000
32 #define srcByte 0x55 31 #define srcByte 0x55
33 #define dstByte 0xBB 32 #define dstByte 0xBB
34 33
35 #ifdef __APPLE_CC__
36 #define memalign(x,y) malloc(y)
37 #endif
38 34
39 static int cpu_caps; 35 static int cpu_caps;
40 36
41 static char *args_parse(int argc, char *argv[]) 37 static char *args_parse(int argc, char *argv[])
42 { 38 {
62 } 58 }
63 59
64 int main(int argc, char **argv) 60 int main(int argc, char **argv)
65 { 61 {
66 int i, funcNum; 62 int i, funcNum;
67 uint8_t *srcBuffer= (uint8_t*)memalign(128, SIZE); 63 uint8_t *srcBuffer= (uint8_t*)av_malloc(SIZE);
68 uint8_t *dstBuffer= (uint8_t*)memalign(128, SIZE); 64 uint8_t *dstBuffer= (uint8_t*)av_malloc(SIZE);
69 int failedNum=0; 65 int failedNum=0;
70 int passedNum=0; 66 int passedNum=0;
71 67
72 av_log(NULL, AV_LOG_INFO, "memory corruption test ...\n"); 68 av_log(NULL, AV_LOG_INFO, "memory corruption test ...\n");
73 args_parse(argc, argv); 69 args_parse(argc, argv);
83 av_log(NULL, AV_LOG_INFO,"."); 79 av_log(NULL, AV_LOG_INFO,".");
84 memset(srcBuffer, srcByte, SIZE); 80 memset(srcBuffer, srcByte, SIZE);
85 81
86 for(width=32; width<64; width++){ 82 for(width=32; width<64; width++){
87 int dstOffset; 83 int dstOffset;
88 for(dstOffset=128; dstOffset<196; dstOffset++){ 84 for(dstOffset=128; dstOffset<196; dstOffset+=4){
89 int srcOffset; 85 int srcOffset;
90 memset(dstBuffer, dstByte, SIZE); 86 memset(dstBuffer, dstByte, SIZE);
91 87
92 for(srcOffset=128; srcOffset<196; srcOffset++){ 88 for(srcOffset=128; srcOffset<196; srcOffset+=4){
93 uint8_t *src= srcBuffer+srcOffset; 89 uint8_t *src= srcBuffer+srcOffset;
94 uint8_t *dst= dstBuffer+dstOffset; 90 uint8_t *dst= dstBuffer+dstOffset;
95 char *name=NULL; 91 char *name=NULL;
96 92
97 if(failed) break; //don't fill the screen with shit ... 93 if(failed) break; //don't fill the screen with shit ...