Thread: parse error?

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    29

    parse error?

    What is this error?

    error: parse error before "YUV"

    Code:
    YUV	  *QMUL_format_converter(Image* image) 
    {
    	size = image->width * image->height;
    	
    	YUV *yuv = (YUV *) malloc(sizeof(YUV));
    	
    	yuv->y   = (int *) malloc(size);
    	yuv->u   = (int *) malloc(size);
    	yuv->v   = (int *) malloc(size);
    	
    	for(i=0;i<=size;i++){
    		*(yuv->y + i) = (0.257) * (*image->data + (i*3)) + (0.504) * (*image->data + (i*3+1)) + (0.098) * (*image->data + (i*3+2)) + 16;
    						
    		*(yuv->u + i) = (0.439) * (*image->data + (i*3)) + (0.368) * (*image->data + (i*3+1)) - (0.071) * (*image->data + (i*3+2)) + 128;
    						
    		*(yuv->v + i) =(-0.148) * (*image->data + (i*3)) - (0.291) * (*image->data + (i*3+1)) + (0.439) * (*image->data + (i*3+2)) + 128;
    	}
    
    	return YUV;
    }
    Disk space: the final frontier

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > YUV *yuv = (YUV *) malloc(sizeof(YUV));
    1. It's a declaration after a statement - this isn't allowed in C
    2. You're casting malloc.

  3. #3
    old man
    Join Date
    Dec 2005
    Posts
    90
    Also, is 'return YUV;' what you want? (YUV is a typedef ... not a struct pointer)

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    29
    Quote Originally Posted by eerok
    Also, is 'return YUV;' what you want? (YUV is a typedef ... not a struct pointer)
    It's a typedef and a structure.
    Disk space: the final frontier

  5. #5
    Registered User
    Join Date
    Aug 2005
    Posts
    29
    Ok solved it... the return was meant to be 'yuv' not 'YUV'

    How annoying,
    Disk space: the final frontier

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    See what having stupid variable names gets you?


    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    old man
    Join Date
    Dec 2005
    Posts
    90
    Quote Originally Posted by cblix
    Quote Originally Posted by eerok
    Also, is 'return YUV;' what you want? (YUV is a typedef ... not a struct pointer)
    It's a typedef and a structure.
    Ok solved it... the return was meant to be 'yuv' not 'YUV'
    I guess I'll have to learn to be less subtle around here

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. How to monitor process creation?
    By markiz in forum Windows Programming
    Replies: 31
    Last Post: 03-17-2008, 02:39 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM