test/testoverlay.c
changeset 1439 4d3bb026cd16
parent 1151 be9c9c8f6d53
child 1662 782fd950bd46
child 1895 c121d94672cb
equal deleted inserted replaced
1438:1f4f09641645 1439:4d3bb026cd16
    32          only as examples.
    32          only as examples.
    33 */
    33 */
    34 
    34 
    35 void RGBtoYUV(Uint8 *rgb, int *yuv, int monochrome, int luminance)
    35 void RGBtoYUV(Uint8 *rgb, int *yuv, int monochrome, int luminance)
    36 {
    36 {
    37     int i;
       
    38 
       
    39     if (monochrome)
    37     if (monochrome)
    40     {
    38     {
    41 #if 1 /* these are the two formulas that I found on the FourCC site... */
    39 #if 1 /* these are the two formulas that I found on the FourCC site... */
    42         yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
    40         yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
    43         yuv[1] = 128;
    41         yuv[1] = 128;
    78             yuv[i]=255;
    76             yuv[i]=255;
    79     }
    77     }
    80     */
    78     */
    81 }
    79 }
    82 
    80 
    83 ConvertRGBtoYV12(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
    81 void ConvertRGBtoYV12(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
    84 {
    82 {
    85 	int x,y;
    83 	int x,y;
    86 	int yuv[3];
    84 	int yuv[3];
    87 	Uint8 *p,*op[3];
    85 	Uint8 *p,*op[3];
    88 
    86 
   118 
   116 
   119 	SDL_UnlockYUVOverlay(o);
   117 	SDL_UnlockYUVOverlay(o);
   120 	SDL_UnlockSurface(s);
   118 	SDL_UnlockSurface(s);
   121 }
   119 }
   122 
   120 
   123 ConvertRGBtoIYUV(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
   121 void ConvertRGBtoIYUV(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
   124 {
   122 {
   125 	int x,y;
   123 	int x,y;
   126 	int yuv[3];
   124 	int yuv[3];
   127 	Uint8 *p,*op[3];
   125 	Uint8 *p,*op[3];
   128 
   126 
   158 
   156 
   159 	SDL_UnlockYUVOverlay(o);
   157 	SDL_UnlockYUVOverlay(o);
   160 	SDL_UnlockSurface(s);
   158 	SDL_UnlockSurface(s);
   161 }
   159 }
   162 
   160 
   163 ConvertRGBtoUYVY(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
   161 void ConvertRGBtoUYVY(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
   164 {
   162 {
   165 	int x,y;
   163 	int x,y;
   166 	int yuv[3];
   164 	int yuv[3];
   167 	Uint8 *p,*op;
   165 	Uint8 *p,*op;
   168 
   166 
   191 
   189 
   192 	SDL_UnlockYUVOverlay(o);
   190 	SDL_UnlockYUVOverlay(o);
   193 	SDL_UnlockSurface(s);
   191 	SDL_UnlockSurface(s);
   194 }
   192 }
   195 
   193 
   196 ConvertRGBtoYVYU(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
   194 void ConvertRGBtoYVYU(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
   197 {
   195 {
   198 	int x,y;
   196 	int x,y;
   199 	int yuv[3];
   197 	int yuv[3];
   200 	Uint8 *p,*op;
   198 	Uint8 *p,*op;
   201 
   199 
   227 
   225 
   228 	SDL_UnlockYUVOverlay(o);
   226 	SDL_UnlockYUVOverlay(o);
   229 	SDL_UnlockSurface(s);
   227 	SDL_UnlockSurface(s);
   230 }
   228 }
   231 
   229 
   232 ConvertRGBtoYUY2(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
   230 void ConvertRGBtoYUY2(SDL_Surface *s, SDL_Overlay *o, int monochrome, int luminance)
   233 {
   231 {
   234 	int x,y;
   232 	int x,y;
   235 	int yuv[3];
   233 	int yuv[3];
   236 	Uint8 *p,*op;
   234 	Uint8 *p,*op;
   237 
   235