Changeset 282

Show
Ignore:
Timestamp:
01/10/07 23:56:56 (2 years ago)
Author:
astrange
Message:

Cosmetic cleanups for color conversion.
Implement YUV 4:2:2 copying (closes #68).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ColorConversions.c

    r280 r282  
    152152} 
    153153 
    154 void SlowY420(UInt8 * o, int outRB, int width, int height, AVFrame * picture) 
     154void Y420toY422(UInt8 * o, int outRB, int width, int height, AVFrame * picture) 
    155155{ 
    156156        static void (*y420_function)(UInt8* baseAddr, int outRB, int width, int height, AVFrame * picture) = NULL; 
     
    170170#include <emmintrin.h> 
    171171 
    172 void SlowY420(UInt8 * o, int outRB, int width, int height, AVFrame * picture) 
     172void Y420toY422(UInt8 * o, int outRB, int width, int height, AVFrame * picture) 
    173173{ 
    174174        UInt8          *yc = picture->data[0], *uc = picture->data[1], *vc = picture->data[2]; 
     
    218218#endif 
    219219 
    220 void BGR24toRGB24(UInt8 *baseAddr, long rowBytes, long width, long height, AVFrame *picture) 
     220void BGR24toRGB24(UInt8 *baseAddr, int rowBytes, int width, int height, AVFrame *picture) 
    221221{ 
    222222        int i, j; 
     
    236236} 
    237237 
    238 void RGB32toRGB32(UInt8 *baseAddr, long rowBytes, long width, long height, AVFrame *picture) 
     238void RGB32toRGB32(UInt8 *baseAddr, int rowBytes, int width, int height, AVFrame *picture) 
    239239{ 
    240240        int x, y; 
     
    253253        } 
    254254} 
     255 
     256void Y422toY422(UInt8* o, int outRB, int width, int height, AVFrame * picture) 
     257{ 
     258        UInt8          *yc = picture->data[0], *u = picture->data[1], *v = picture->data[2]; 
     259        int             rY = picture->linesize[0], rU = picture->linesize[1], rV = picture->linesize[2], y = 0, x, x2; 
     260         
     261        for (; y < height; y++) { 
     262                for (x = 0, x2 = 0; x < width; x += 2, x2 += 4) { 
     263                        int             hx = x >> 1; 
     264                        o[x2] = u[hx]; 
     265                        o[x2 + 1] = yc[x]; 
     266                        o[x2 + 2] = v[hx]; 
     267                        o[x2 + 3] = yc[x + 1]; 
     268                } 
     269                 
     270                o += outRB; 
     271                yc += rY; 
     272                u += rU; 
     273                v += rV; 
     274        } 
     275} 
  • trunk/ColorConversions.h

    r279 r282  
    2222 
    2323extern void FastY420(UInt8 *baseAddr, AVFrame *picture); 
    24 extern void SlowY420(UInt8* baseAddr, int rowBytes, int width, int height, AVFrame * picture); 
    25 extern void RGB32toRGB32(UInt8 *baseAddr, long rowBytes, long width, long height, AVFrame *picture); 
    26 extern void BGR24toRGB24(UInt8 *baseAddr, long rowBytes, long width, long height, AVFrame *picture); 
     24extern void Y420toY422(UInt8* baseAddr, int rowBytes, int width, int height, AVFrame * picture); 
     25extern void RGB32toRGB32(UInt8 *baseAddr, int rowBytes, int width, int height, AVFrame *picture); 
     26extern void BGR24toRGB24(UInt8 *baseAddr, int rowBytes, int width, int height, AVFrame *picture); 
     27extern void Y422toY422(UInt8* o, int outRB, int width, int height, AVFrame * picture); 
  • trunk/FFusionCodec.c

    r279 r282  
    924924        else if (myDrp->pixelFormat == k2vuyPixelFormat && glob->avContext->pix_fmt == PIX_FMT_YUV420P) 
    925925        { 
    926                 SlowY420((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
     926                Y420toY422((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
    927927        } 
    928928        else if (myDrp->pixelFormat == k24RGBPixelFormat && glob->avContext->pix_fmt == PIX_FMT_BGR24) 
     
    933933        { 
    934934                RGB32toRGB32((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
     935        } 
     936        else if (myDrp->pixelFormat == k2vuyPixelFormat && glob->avContext->pix_fmt == PIX_FMT_YUV422P) 
     937        { 
     938                Y422toY422((UInt8 *)drp->baseAddr, drp->rowBytes, myDrp->width, myDrp->height, picture); 
    935939        } 
    936940        else