graphicscomposition/openwfcompositionengine/common/src/owfimage.c
branchNewGraphicsArchitecture
changeset 61 4ac0d9f65e95
parent 39 a4b63488e0b0
child 143 3db46cb3f779
equal deleted inserted replaced
56:9e4149274002 61:4ac0d9f65e95
   376                     srcPtr ++;
   376                     srcPtr ++;
   377                     count--;
   377                     count--;
   378                 }
   378                 }
   379                 break;
   379                 break;
   380             }
   380             }
   381 #ifdef OWF_IMAGE_INTERNAL_PIXEL_IS_FLOAT
   381             
   382             case OWF_IMAGE_UYVY:
   382             case OWF_IMAGE_UYVY:
   383             {
   383             {
   384                 OWFuint8* srcPtr = (OWFuint8*) srcLinePtr;
   384                 OWFuint8* srcPtr = (OWFuint8*) srcLinePtr;
   385                 OWFint y,u,v,r,g,b,x;
   385                 OWFint y,u,v,r,g,b,x;
   386                 for (x = 0; x < count; x++)
   386                 for (x = 0; x < count; x++)
   419                     dstPtr++;                  
   419                     dstPtr++;                  
   420                     srcPtr += 4;                                      
   420                     srcPtr += 4;                                      
   421                 }
   421                 }
   422                 break;
   422                 break;
   423             }
   423             }
   424 #endif     
   424      
   425             default:
   425             default:
   426             {
   426             {
   427                 return OWF_FALSE; /* source format not supported */
   427                 return OWF_FALSE; /* source format not supported */
   428             }
   428             }
   429         }
   429         }
   604                     srcPtr ++;
   604                     srcPtr ++;
   605                 }
   605                 }
   606                 break;
   606                 break;
   607             }
   607             }
   608 #ifdef OWF_IMAGE_INTERNAL_PIXEL_IS_FLOAT
   608 #ifdef OWF_IMAGE_INTERNAL_PIXEL_IS_FLOAT
   609 			/* TODO: Fix this code! It should be converting from ARGB into YUV, not the other way around. */
       
   610             case OWF_IMAGE_UYVY:
   609             case OWF_IMAGE_UYVY:
   611             {
   610             {
   612                 OWFuint8* srcPtr = (OWFuint8*) srcLinePtr;
   611                 return OWF_FALSE; /* this is not supported */
   613                 OWFint y,u,v,r,g,b,x;
       
   614                 for (x = 0; x < count; x++)
       
   615                 {
       
   616                     u = srcPtr[0] - 128;
       
   617                     v = srcPtr[2] - 128;
       
   618                     y = srcPtr[3] - 16;
       
   619                     
       
   620                     r = ((298 * y + 409 * u) / 256);
       
   621                     g = ((298 * y - 100 * v - 208 * u) / 256);
       
   622                     b = ((298 * y + 516 * v) / 256);
       
   623                     
       
   624                     CLIP(r);
       
   625                     CLIP(g);
       
   626                     CLIP(b);
       
   627                     
       
   628                     dstPtr->color.alpha = 255;
       
   629                     dstPtr->color.red = r;
       
   630                     dstPtr->color.green = g;
       
   631                     dstPtr->color.blue = b;
       
   632                     dstPtr++;
       
   633                     
       
   634                     y = srcPtr[1] - 16;
       
   635                     r = ((298 * y + 409 * u) / 256);
       
   636                     g = ((298 * y - 100 * v - 208 * u) / 256);
       
   637                     b = ((298 * y + 516 * v) / 256);
       
   638                     
       
   639                     CLIP(r);
       
   640                     CLIP(g);
       
   641                     CLIP(b);
       
   642                     
       
   643                     dstPtr->color.alpha = 255;
       
   644                     dstPtr->color.red = r;
       
   645                     dstPtr->color.green = g;
       
   646                     dstPtr->color.blue = b;
       
   647                     dstPtr++;                  
       
   648                     srcPtr += 4;                                      
       
   649                 }
       
   650                 break;
       
   651             }
   612             }
   652 #endif
   613 #endif
   653                 
   614                 
   654             default:
   615             default:
   655             {
   616             {