[ITC][dali-core][ACR-516][Modified TC according to ACR]
authorJahangir <ja.alam@samsung.com>
Thu, 23 Jun 2016 15:14:23 +0000 (11:14 -0400)
committerJahangir <ja.alam@samsung.com>
Thu, 23 Jun 2016 15:15:04 +0000 (11:15 -0400)
Change-Id: Ie1612cc243df90bbffea23069b83bb8f717dd6bc

src/itc/dali-core/pixel/ITs-pixel-common.cpp
src/itc/dali-core/pixel/ITs-pixel-common.h
src/itc/dali-core/pixel/ITs-pixel.cpp

index cb1fd21..cf1403f 100755 (executable)
  *  @{ 
  */
 //Keeping all the enum names of Pixel in an array for Print Log
-string g_rgPixelEnumList[] = { "A8",
-                                                               "L8",
-                                                               "LA88",
-                                                               "RGB565",
-                                                               "BGR565",
-                                                               "RGBA4444",
-                                                               "BGRA4444",
-                                                               "RGBA5551",
-                                                               "BGRA5551",
-                                                               "RGB888",
-                                                               "RGB8888",
-                                                               "BGR8888",
-                                                               "RGBA8888",
-                                                               "BGRA8888",
-                                                               "COMPRESSED_R11_EAC",
-                                                               "COMPRESSED_SIGNED_R11_EAC",
-                                                               "COMPRESSED_RG11_EAC",
-                                                               "COMPRESSED_SIGNED_RG11_EAC",
-                                                               "COMPRESSED_RGB8_ETC2",
-                                                               "COMPRESSED_SRGB8_ETC2",
-                                                               "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",
-                                                               "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",
-                                                               "COMPRESSED_RGBA8_ETC2_EAC",
-                                                               "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",
-                                                               "COMPRESSED_RGB8_ETC1",
-                                                               "COMPRESSED_RGB_PVRTC_4BPPV1"
-                                                       };
+string g_rgPixelEnumList[] = {
+                                                       "Pixel::INVALID",
+                                                       "Pixel::L8",
+                                                       "Pixel::RGB565",
+                                                       "Pixel::RGB888",
+                                                       "Pixel::RGB8888",
+                                                       "Pixel::BGR8888",
+                                                       "Pixel::BGR565",
+                                                       "Pixel::COMPRESSED_R11_EAC",
+                                                       "Pixel::COMPRESSED_SIGNED_R11_EAC",
+                                                       "Pixel::COMPRESSED_RG11_EAC",
+                                                       "Pixel::COMPRESSED_SIGNED_RG11_EAC",
+                                                       "Pixel::COMPRESSED_RGB8_ETC2",
+                                                       "Pixel::COMPRESSED_SRGB8_ETC2",
+                                                       "Pixel::COMPRESSED_RGB8_ETC1",
+                                                       "Pixel::COMPRESSED_RGB_PVRTC_4BPPV1",
+                                                       "Pixel::A8",                                                            //[index=15] alpha true from here
+                                                       "Pixel::LA88",
+                                                       "Pixel::RGBA5551",
+                                                       "Pixel::RGBA4444",
+                                                       "Pixel::RGBA8888",
+                                                       "Pixel::BGRA8888",
+                                                       "Pixel::BGRA5551",
+                                                       "Pixel::BGRA4444",
+                                                       "Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",
+                                                       "Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",
+                                                       "Pixel::COMPRESSED_RGBA8_ETC2_EAC",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR",
+                                                       "Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",
+                                                       "Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"
+                                                        };
 
 //   Keeping all the enums of Pixel in an array in an order so that first 14 enums do not have alpha channel and rest of them 
 //   have alpha channel : According to help document
-Pixel::Format g_rgPixelFormatA[] = {   Pixel::L8,
-                                                                               Pixel::RGB565,
-                                                                               Pixel::RGB888,
-                                                                               Pixel::RGB8888,
-                                                                               Pixel::BGR8888,
-                                                                               Pixel::BGR565,
-                                                                               Pixel::COMPRESSED_R11_EAC,
-                                                                               Pixel::COMPRESSED_SIGNED_R11_EAC,
-                                                                               Pixel::COMPRESSED_RG11_EAC,
-                                                                               Pixel::COMPRESSED_SIGNED_RG11_EAC,
-                                                                               Pixel::COMPRESSED_RGB8_ETC2,
-                                                                               Pixel::COMPRESSED_SRGB8_ETC2,
-                                                                               Pixel::COMPRESSED_RGB8_ETC1,
-                                                                               Pixel::COMPRESSED_RGB_PVRTC_4BPPV1,
-                                                                               Pixel::A8,
-                                                                               Pixel::LA88,
-                                                                               Pixel::RGBA5551,
-                                                                               Pixel::RGBA4444,
-                                                                               Pixel::RGBA8888,
-                                                                               Pixel::BGRA8888,
-                                                                               Pixel::BGRA5551,
-                                                                               Pixel::BGRA4444,
-                                                                               Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
-                                                                               Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
-                                                                               Pixel::COMPRESSED_RGBA8_ETC2_EAC,
-                                                                               Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
+Pixel::Format g_rgPixelFormatA[] =  {
+                                                                       Pixel::INVALID,
+                                                                       Pixel::L8,
+                                                                       Pixel::RGB565,
+                                                                       Pixel::RGB888,
+                                                                       Pixel::RGB8888,
+                                                                       Pixel::BGR8888,
+                                                                       Pixel::BGR565,
+                                                                       Pixel::COMPRESSED_R11_EAC,
+                                                                       Pixel::COMPRESSED_SIGNED_R11_EAC,
+                                                                       Pixel::COMPRESSED_RG11_EAC,
+                                                                       Pixel::COMPRESSED_SIGNED_RG11_EAC,
+                                                                       Pixel::COMPRESSED_RGB8_ETC2,
+                                                                       Pixel::COMPRESSED_SRGB8_ETC2,
+                                                                       Pixel::COMPRESSED_RGB8_ETC1,
+                                                                       Pixel::COMPRESSED_RGB_PVRTC_4BPPV1,
+                                                                       Pixel::A8,                                              //[index=15] alpha true from here
+                                                                       Pixel::LA88,
+                                                                       Pixel::RGBA5551,
+                                                                       Pixel::RGBA4444,
+                                                                       Pixel::RGBA8888,
+                                                                       Pixel::BGRA8888,
+                                                                       Pixel::BGRA5551,
+                                                                       Pixel::BGRA4444,
+                                                                       Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+                                                                       Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+                                                                       Pixel::COMPRESSED_RGBA8_ETC2_EAC,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR,
+                                                                       Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
+                                                                       Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
                                                                        };
 
 int g_nPixelEnumSize = sizeof( g_rgPixelFormatA )/sizeof( g_rgPixelFormatA[0] );
+int g_nAlpha_Format_Start=15;
 
 //Byte values are set according to help document
-unsigned int g_rgPixelBytePerPxl[] = { 1, 2, 3, 4, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 4, 4, 2, 2, 0, 0, 0, 0 };
+unsigned int g_rgPixelBytePerPxl[] = { 0,1,2,3,4,4,2,0,0,0,0,0,0,0,0,1,2,2,2,4,4,2,2,0,0,0,0,
+                                                                               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+                                                                        };
 
 // For testing purpose, ByteOffSet and BitMask values are set according to source file as no information is given in help document
-int g_rgPixelByteOffset[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 3, 1, 1, 0, 0, 0, 0 };
-int g_rgPixelBitMask[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xff, 0x01, 0x0f, 0xff, 0xff, 0x01, 0x0f, 0, 0, 0, 0 };
 
+int g_rgPixelOffSetAndMask[][2] = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
+                                                               {0,0xff},{1,0xff},{1,0x01},{1,0x0f},{3,0xff},{3,0xff},{1,0x01},{1,0x0f},{0,0},{0,0},{0,0},
+                                                               {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
+                                                               {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}
+                                                               };
 
 /**
  * @function           PixelSetGetforImageAttributes
index 29d2f60..1dc3129 100755 (executable)
@@ -29,9 +29,9 @@ using namespace Toolkit;
 extern string g_rgPixelEnumList[];
 extern Pixel::Format g_rgPixelFormatA[];
 extern int g_nPixelEnumSize;
+extern int g_nAlpha_Format_Start;
 extern unsigned int g_rgPixelBytePerPxl[];
-extern int g_rgPixelByteOffset[];
-extern int g_rgPixelBitMask[];
+extern int g_rgPixelOffSetAndMask[][2];
 /****************Global variable declaration ends**************************/
 
 //Set and Get Pixel format for ImageAttributes
index b67698b..cb39e04 100755 (executable)
@@ -114,18 +114,18 @@ void PixelHasAlpha()
                
                bHasAlpha = Pixel::HasAlpha( pixelFormatGet );
                
-               if( nIndex <= g_nPixelEnumSize/2 && bHasAlpha )
+               if( nIndex < g_nAlpha_Format_Start && bHasAlpha )
                {
-                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet - 1 ].c_str() ;
-                       LOG_E("Pixel::HasAlpha is failed to return false for Pixel");
+                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet ].c_str() ;
+                       LOG_E("Pixel::HasAlpha is failed to return false for " + strPixelVal);
                        test_return_value=1;
                        return;
                }
                
-               if( nIndex > g_nPixelEnumSize/2 && !bHasAlpha )
+               if( nIndex >= g_nAlpha_Format_Start && !bHasAlpha )
                {
-                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet - 1 ].c_str() ;
-                       LOG_E("Pixel::HasAlpha is failed to return true for Pixel");
+                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet ].c_str() ;
+                       LOG_E("Pixel::HasAlpha is failed to return false for " + strPixelVal);
                        test_return_value=1;
                        return;
                }
@@ -153,8 +153,8 @@ void PixelGetBytesPerPixel()
                uGetPixelByte = Pixel::GetBytesPerPixel( pixelFormatGet );
                if( uGetPixelByte != g_rgPixelBytePerPxl[ nIndex ] )
                {
-                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet-1 ].c_str() ;
-                       LOG_E("Pixel::GetBytesPerPixel is failed to get bytes per pixel for Pixel");
+                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet ].c_str() ;
+                       LOG_E("Pixel::GetBytesPerPixel is failed to get bytes per pixel for "+strPixelVal);
                        test_return_value=1;
                        return;
                }
@@ -182,18 +182,18 @@ void PixelGetAlphaOffsetAndMask()
                }
                
                Pixel::GetAlphaOffsetAndMask( pixelFormatGet, nbyteOffset, nbitMask );
-               if( nbyteOffset != g_rgPixelByteOffset[ nIndex ] )
+               if( nbyteOffset != g_rgPixelOffSetAndMask[ nIndex ][0])
                {
-                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet - 1 ].c_str();
-                       LOG_E("Pixel::GetAlphaOffsetAndMask is failed to returns the offset of alpha mask containing byte for Pixel");
+                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet ].c_str();
+                       LOG_E("Pixel::GetAlphaOffsetAndMask is failed to returns the offset of alpha mask containing byte for "+strPixelVal);
                        test_return_value=1;
                        return;
                }
 
-               if( nbitMask != g_rgPixelBitMask[ nIndex ] )
+               if( nbitMask != g_rgPixelOffSetAndMask[ nIndex ][1] )
                {
-                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet - 1 ].c_str();
-                       LOG_E("Pixel::GetAlphaOffsetAndMask is failed to return the bitmask of alpha mask containing byte to get the alpha value for Pixel");
+                       strPixelVal = g_rgPixelEnumList[ pixelFormatGet ].c_str();
+                       LOG_E("Pixel::GetAlphaOffsetAndMask is failed to return the bitmask of alpha mask containing byte to get the alpha value for "+strPixelVal);
                        test_return_value=1;
                        return;
                }