mmserv/thumbnailengine/TneProcessorInc/yuv2rgb16.h
changeset 28 ebf79c79991a
equal deleted inserted replaced
25:6f7ceef7b1d1 28:ebf79c79991a
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   YUV to EColor64K colorspace converter concrete classes 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef     __YUV2RGB16_H__
       
    21 #define     __YUV2RGB16_H__
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #ifndef __YUVCONVERTER_H__
       
    26 #include "yuvconverter.h"
       
    27 #endif
       
    28 
       
    29 //  CLASS DEFINITIONS
       
    30 
       
    31 class CYuv2Rgb16 : public CYuvConverter
       
    32 {
       
    33 public: // CYuvConverter methods
       
    34     // Constructors & destructor
       
    35     CYuv2Rgb16();
       
    36     ~CYuv2Rgb16();
       
    37     void ConstructL(TUint aWidth, TUint aHeight, TUint aMaxWidth, TUint aMaxHeight);
       
    38     
       
    39     void Convert(const TUint8 *aYBuf, const TUint8 *aUBuf,
       
    40                  const TUint8 *aVBuf,
       
    41                  TUint aBufWidth, TUint aBufHeight,
       
    42                  TUint8 *aTarget, TUint aTargetScanlineLength);
       
    43 
       
    44     void SetGamma(TInt /*aGamma*/) {};
       
    45 
       
    46 protected: // Data
       
    47     
       
    48     TUint iWidth, iHeight;
       
    49     
       
    50 };
       
    51 
       
    52 
       
    53 // The fixed point constants for YUV -> RGB conversion
       
    54 const TInt KYMult = 296;
       
    55 const TInt KCrToR = 408;
       
    56 const TInt KCbToG =  96;
       
    57 const TInt KCrToG = 204;
       
    58 const TInt KCbToB = 520;
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // UvToRDiff
       
    62 // Calculate the red color difference from Cr by using fixed point values.
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 inline TInt UvToRDiff(
       
    66     TInt aCr,
       
    67     TInt /*aCb*/)
       
    68     {
       
    69     return (KCrToR * aCr) / 256;
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // UvToGDiff
       
    74 // Calculate the green color difference from Cr and Cb components
       
    75 // by using fixed point values.
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 inline TInt UvToGDiff(
       
    79     TInt aCr,
       
    80     TInt aCb)
       
    81     {
       
    82     return (KCbToG * aCb + KCrToG * aCr) / 256;
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // UvToBDiff
       
    87 // Calculate the blue color difference from Cb by using fixed point values.
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 inline TInt UvToBDiff(
       
    91     TInt /*aCr*/,
       
    92     TInt aCb)
       
    93     {
       
    94     return (KCbToB * aCb) / 256;
       
    95     }
       
    96 
       
    97 
       
    98 #endif