src/video/ps2gs/SDL_gsyuv.c
changeset 1838 3d138844ceab
parent 1643 51038e80ae59
child 1662 782fd950bd46
child 1895 c121d94672cb
child 4159 a1b03ba2fcd0
equal deleted inserted replaced
1837:6987e947c77a 1838:3d138844ceab
   323 	int h, w, i;
   323 	int h, w, i;
   324 	Uint32 *lum, *Cr, *Cb;
   324 	Uint32 *lum, *Cr, *Cb;
   325 	int lum_pitch;
   325 	int lum_pitch;
   326 	int crb_pitch;
   326 	int crb_pitch;
   327 	Uint32 *lum_src, *Cr_src, *Cb_src;
   327 	Uint32 *lum_src, *Cr_src, *Cb_src;
   328 	Uint32 *src, *dst;
   328 	Uint32 *srcp, *dstp;
   329 	unsigned int x, y;
   329 	unsigned int x, y;
   330 	SDL_Surface *screen;
   330 	SDL_Surface *screen;
   331 
   331 
   332 	/* Find out where the various portions of the image are */
   332 	/* Find out where the various portions of the image are */
   333 	hwdata = overlay->hwdata;
   333 	hwdata = overlay->hwdata;
   343 		Cb =  (Uint32 *)overlay->pixels[1];
   343 		Cb =  (Uint32 *)overlay->pixels[1];
   344 	    default:
   344 	    default:
   345 		SDL_SetError("Unsupported YUV format in blit (?)");
   345 		SDL_SetError("Unsupported YUV format in blit (?)");
   346 		return(-1);
   346 		return(-1);
   347 	}
   347 	}
   348 	dst = (Uint32 *)hwdata->ipu_imem;
   348 	dstp = (Uint32 *)hwdata->ipu_imem;
   349 	lum_pitch = overlay->w/4;
   349 	lum_pitch = overlay->w/4;
   350 	crb_pitch = (overlay->w/2)/4;
   350 	crb_pitch = (overlay->w/2)/4;
   351 
   351 
   352 	/* Copy blocks of 16x16 pixels to the DMA area */
   352 	/* Copy blocks of 16x16 pixels to the DMA area */
   353 	for ( h=overlay->h/16; h; --h ) {
   353 	for ( h=overlay->h/16; h; --h ) {
   354 		lum_src = lum;
   354 		lum_src = lum;
   355 		Cr_src = Cr;
   355 		Cr_src = Cr;
   356 		Cb_src = Cb;
   356 		Cb_src = Cb;
   357 		for ( w=overlay->w/16; w; --w ) {
   357 		for ( w=overlay->w/16; w; --w ) {
   358 			src = lum_src;
   358 			srcp = lum_src;
   359 			for ( i=0; i<16; ++i ) {
   359 			for ( i=0; i<16; ++i ) {
   360 				dst[0] = src[0];
   360 				dstp[0] = srcp[0];
   361 				dst[1] = src[1];
   361 				dstp[1] = srcp[1];
   362 				dst[2] = src[2];
   362 				dstp[2] = srcp[2];
   363 				dst[3] = src[3];
   363 				dstp[3] = srcp[3];
   364 				src += lum_pitch;
   364 				srcp += lum_pitch;
   365 				dst += 4;
   365 				dstp += 4;
   366 			}
   366 			}
   367 			src = Cb_src;
   367 			srcp = Cb_src;
   368 			for ( i=0; i<8; ++i ) {
   368 			for ( i=0; i<8; ++i ) {
   369 				dst[0] = src[0];
   369 				dstp[0] = srcp[0];
   370 				dst[1] = src[1];
   370 				dstp[1] = srcp[1];
   371 				src += crb_pitch;
   371 				srcp += crb_pitch;
   372 				dst += 2;
   372 				dstp += 2;
   373 			}
   373 			}
   374 			src = Cr_src;
   374 			srcp = Cr_src;
   375 			for ( i=0; i<8; ++i ) {
   375 			for ( i=0; i<8; ++i ) {
   376 				dst[0] = src[0];
   376 				dstp[0] = srcp[0];
   377 				dst[1] = src[1];
   377 				dstp[1] = srcp[1];
   378 				src += crb_pitch;
   378 				srcp += crb_pitch;
   379 				dst += 2;
   379 				dstp += 2;
   380 			}
   380 			}
   381 			lum_src += 16 / 4;
   381 			lum_src += 16 / 4;
   382 			Cb_src += 8 / 4;
   382 			Cb_src += 8 / 4;
   383 			Cr_src += 8 / 4;
   383 			Cr_src += 8 / 4;
   384 		}
   384 		}