imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp
branchRCL_3
changeset 21 6257223ede8a
parent 20 2b4b06654caa
child 22 9d4d3445ce6e
equal deleted inserted replaced
20:2b4b06654caa 21:6257223ede8a
    25 
    25 
    26 #include <IclExtJpegApi.h>
    26 #include <IclExtJpegApi.h>
    27 #include "thumbnailimagedecoder.h"
    27 #include "thumbnailimagedecoder.h"
    28 #include "thumbnaillog.h"
    28 #include "thumbnaillog.h"
    29 #include "thumbnailpanic.h"
    29 #include "thumbnailpanic.h"
       
    30 #include "OstTraceDefinitions.h"
       
    31 #ifdef OST_TRACE_COMPILER_IN_USE
       
    32 #include "thumbnailimagedecoderTraces.h"
       
    33 #endif
       
    34 
    30 
    35 
    31 const TUid KImageTypeSVGUid = 
    36 const TUid KImageTypeSVGUid = 
    32     {
    37     {
    33     0x102073E7
    38     0x102073E7
    34 };
    39 };
    79 void CThumbnailImageDecoder::CreateL( RFile64& aFile, MThumbnailProviderObserver&
    84 void CThumbnailImageDecoder::CreateL( RFile64& aFile, MThumbnailProviderObserver&
    80     aObserver, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const
    85     aObserver, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const
    81     TDataType& aMimeType, const TSize& aSize)
    86     TDataType& aMimeType, const TSize& aSize)
    82     {
    87     {
    83     TN_DEBUG1( "CThumbnailImageDecoder::CreateL() start" );
    88     TN_DEBUG1( "CThumbnailImageDecoder::CreateL() start" );
       
    89     OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODER_CREATEL, "CThumbnailImageDecoder::CreateL - start" );
    84 
    90 
    85     iBuffer = NULL;
    91     iBuffer = NULL;
    86     iSize = aSize;
    92     iSize = aSize;
    87     iMimeType = aMimeType;
    93     iMimeType = aMimeType;
    88     iObserver = &aObserver;
    94     iObserver = &aObserver;
    98         }
   104         }
    99     iFrameInfoFlags = info.iFlags;
   105     iFrameInfoFlags = info.iFlags;
   100     iOriginalSize = info.iOverallSizeInPixels;
   106     iOriginalSize = info.iOverallSizeInPixels;
   101     
   107     
   102     TN_DEBUG1( "CThumbnailImageDecoder::CreateL() end" );
   108     TN_DEBUG1( "CThumbnailImageDecoder::CreateL() end" );
       
   109     OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODER_CREATEL, "CThumbnailImageDecoder::CreateL - end" );
   103     }
   110     }
   104 
   111 
   105 
   112 
   106 // -----------------------------------------------------------------------------
   113 // -----------------------------------------------------------------------------
   107 // CThumbnailImageDecoder::CreateL()
   114 // CThumbnailImageDecoder::CreateL()
   111 void CThumbnailImageDecoder::CreateL( const TDesC8* aBuffer, MThumbnailProviderObserver&
   118 void CThumbnailImageDecoder::CreateL( const TDesC8* aBuffer, MThumbnailProviderObserver&
   112     aObserver, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const
   119     aObserver, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const
   113     TDataType& aMimeType, const TSize& aSize)
   120     TDataType& aMimeType, const TSize& aSize)
   114     {
   121     {
   115     TN_DEBUG1( "CThumbnailImageDecoder::CreateL() start" );
   122     TN_DEBUG1( "CThumbnailImageDecoder::CreateL() start" );
       
   123     OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODER_CREATEL, "CThumbnailImageDecoder::CreateL - start" );
   116 
   124 
   117     iSize = aSize;
   125     iSize = aSize;
   118     iMimeType = aMimeType;
   126     iMimeType = aMimeType;
   119     iObserver = &aObserver;
   127     iObserver = &aObserver;
   120     iBuffer = aBuffer;
   128     iBuffer = aBuffer;
   129         }
   137         }
   130     iFrameInfoFlags = info.iFlags;
   138     iFrameInfoFlags = info.iFlags;
   131     iOriginalSize = info.iOverallSizeInPixels;
   139     iOriginalSize = info.iOverallSizeInPixels;
   132     
   140     
   133     TN_DEBUG1( "CThumbnailImageDecoder::CreateL() end" );
   141     TN_DEBUG1( "CThumbnailImageDecoder::CreateL() end" );
       
   142     OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODER_CREATEL, "CThumbnailImageDecoder::CreateL - end" );
   134     }
   143     }
   135 
   144 
   136 // -----------------------------------------------------------------------------
   145 // -----------------------------------------------------------------------------
   137 // CThumbnailImageDecoder::DecodeL()
   146 // CThumbnailImageDecoder::DecodeL()
   138 // Decode the thumbnail image
   147 // Decode the thumbnail image
   139 // -----------------------------------------------------------------------------
   148 // -----------------------------------------------------------------------------
   140 //
   149 //
   141 void CThumbnailImageDecoder::DecodeL( const TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailFlags aFlags)
   150 void CThumbnailImageDecoder::DecodeL( const TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailFlags aFlags)
   142     {
   151     {
   143     TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() start" );
   152     TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() start" );
       
   153     OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - start" );
   144     
   154     
   145     // Create the bitmap
   155     // Create the bitmap
   146     if ( !iBitmap )
   156     if ( !iBitmap )
   147         {
   157         {
   148         iBitmap = new( ELeave )CFbsBitmap();
   158         iBitmap = new( ELeave )CFbsBitmap();
   149         }
   159         }
   150     
   160     
   151     TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() %d x %d", iSize.iWidth, iSize.iHeight );
   161     TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() %d x %d", iSize.iWidth, iSize.iHeight );
       
   162     OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;iSize.iWidth=%d;iSize.iHeight=%d", iSize.iWidth, iSize.iHeight );
   152     if( iOriginalSize.iWidth < iOriginalSize.iHeight )
   163     if( iOriginalSize.iWidth < iOriginalSize.iHeight )
   153         {
   164         {
   154         TInt height = iSize.iHeight;
   165         TInt height = iSize.iHeight;
   155         iSize.iHeight = iSize.iWidth;
   166         iSize.iHeight = iSize.iWidth;
   156         iSize.iWidth = height;
   167         iSize.iWidth = height;
   157         iPortrait = ETrue;
   168         iPortrait = ETrue;
   158         TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() %d x %d", iSize.iWidth, iSize.iHeight );
   169         TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() %d x %d", iSize.iWidth, iSize.iHeight );
       
   170         OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;iSize.iWidth=%d;iSize.iHeight=%d", iSize.iWidth, iSize.iHeight );
   159         }
   171         }
   160     else
   172     else
   161         {
   173         {
   162         iPortrait = EFalse;
   174         iPortrait = EFalse;
   163         }
   175         }
   164     
   176     
   165     TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() iOriginalSize = %d x %d", iOriginalSize.iWidth, iOriginalSize.iHeight );
   177     TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() iOriginalSize = %d x %d", iOriginalSize.iWidth, iOriginalSize.iHeight );
       
   178     OstTraceExt2( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;iOriginalSize.iWidth=%d;iOriginalSize.iHeight=%d", iOriginalSize.iWidth, iOriginalSize.iHeight );
   166 
   179 
   167     //Size in both x and y dimension must be non-zero, positive value
   180     //Size in both x and y dimension must be non-zero, positive value
   168     TSize loadSize( iOriginalSize) ;
   181     TSize loadSize( iOriginalSize) ;
   169     
   182     
   170     if(iOriginalSize.iHeight < iSize.iHeight || iOriginalSize.iWidth < iSize.iWidth )
   183     if(iOriginalSize.iHeight < iSize.iHeight || iOriginalSize.iWidth < iSize.iWidth )
   171         {
   184         {
   172         loadSize = iOriginalSize;
   185         loadSize = iOriginalSize;
   173         TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() LoadSize is OriginalSize" );
   186         TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() LoadSize is OriginalSize" );
       
   187         OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - LoadSize is OriginalSize" );
   174         }
   188         }
   175     else if((iFrameInfoFlags& TFrameInfo::EFullyScaleable || IsSvg()) && aFlags == !CThumbnailManager::ECropToAspectRatio)
   189     else if((iFrameInfoFlags& TFrameInfo::EFullyScaleable || IsSvg()) && aFlags == !CThumbnailManager::ECropToAspectRatio)
   176         {
   190         {
   177         loadSize = iSize;
   191         loadSize = iSize;
   178         TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() EFullyScaleable start" );
   192         TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() EFullyScaleable start" );
       
   193         OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - EFullyScaleable start" );
   179         const TReal32 srcAspect = static_cast < TReal32 > (
   194         const TReal32 srcAspect = static_cast < TReal32 > (
   180               iOriginalSize.iWidth ) / iOriginalSize.iHeight;
   195               iOriginalSize.iWidth ) / iOriginalSize.iHeight;
   181 
   196 
   182           // set loadsize to maximum size within target size 
   197           // set loadsize to maximum size within target size 
   183           if ( (loadSize.iHeight * srcAspect) <= loadSize.iWidth )
   198           if ( (loadSize.iHeight * srcAspect) <= loadSize.iWidth )
   194               Math::Round( trg, src, 0 );
   209               Math::Round( trg, src, 0 );
   195               loadSize.SetSize( loadSize.iWidth, trg );
   210               loadSize.SetSize( loadSize.iWidth, trg );
   196               }
   211               }
   197         
   212         
   198         TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() EFullyScaleable loadSize = %d x %d", loadSize.iWidth, loadSize.iHeight );
   213         TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() EFullyScaleable loadSize = %d x %d", loadSize.iWidth, loadSize.iHeight );
       
   214         OstTraceExt2( TRACE_NORMAL, DUP6_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - EFullyScaleable;loadSize.iWidth=%d;loadSize.iHeight=%d", loadSize.iWidth, loadSize.iHeight );
   199         }
   215         }
   200     else 
   216     else 
   201         {
   217         {
   202         
   218         
   203         // Size reduction factor. 1/1, 1/2, 1/4, and 1/8 are possible values for all
   219         // Size reduction factor. 1/1, 1/2, 1/4, and 1/8 are possible values for all
   221             {
   237             {
   222             loadSize.iHeight++;
   238             loadSize.iHeight++;
   223             }
   239             }
   224         TN_DEBUG4( 
   240         TN_DEBUG4( 
   225             "CThumbnailImageDecoder::DecodeL() - loadSize = (%d,%d) reduction = 1/%d ", loadSize.iWidth, loadSize.iHeight, reductionFactor );
   241             "CThumbnailImageDecoder::DecodeL() - loadSize = (%d,%d) reduction = 1/%d ", loadSize.iWidth, loadSize.iHeight, reductionFactor );
       
   242         OstTraceExt3( TRACE_NORMAL, DUP7_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;loadSize.iWidth=%d;loadSize.iHeight=%d;reductionFactor=%d", loadSize.iWidth, loadSize.iHeight, reductionFactor );
   226         }
   243         }
   227 
   244 
   228     TInt err = iBitmap->Create( loadSize, aDisplayMode );
   245     TInt err = iBitmap->Create( loadSize, aDisplayMode );
   229     if (err != KErrNone)
   246     if (err != KErrNone)
   230         {
   247         {
   236     iDecoder->Convert( &iStatus, * iBitmap );
   253     iDecoder->Convert( &iStatus, * iBitmap );
   237     
   254     
   238     SetActive();
   255     SetActive();
   239     
   256     
   240     TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() end" );
   257     TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() end" );
       
   258     OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - end" );
   241     }
   259     }
   242 
   260 
   243 
   261 
   244 // -----------------------------------------------------------------------------
   262 // -----------------------------------------------------------------------------
   245 // CThumbnailImageDecoder::Release()
   263 // CThumbnailImageDecoder::Release()
   345 //
   363 //
   346 void CThumbnailImageDecoder::CreateDecoderL( CThumbnailManager::TThumbnailQualityPreference
   364 void CThumbnailImageDecoder::CreateDecoderL( CThumbnailManager::TThumbnailQualityPreference
   347     aFlags )
   365     aFlags )
   348     {
   366     {
   349     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() start" );
   367     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() start" );
       
   368     OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - start" );
   350     
   369     
   351     TBool thumbFound( EFalse );
   370     TBool thumbFound( EFalse );
   352     
   371     
   353     // If the image is in jpeg format, try to get thumbnail from EXIF data (if EOptimizeForQuality not set)
   372     // If the image is in jpeg format, try to get thumbnail from EXIF data (if EOptimizeForQuality not set)
   354     if ( IsJpeg() && !( aFlags == CThumbnailManager::EOptimizeForQuality ))
   373     if ( IsJpeg() && !( aFlags == CThumbnailManager::EOptimizeForQuality ))
   355         {
   374         {
   356         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() create exif decoder" );
   375         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() create exif decoder" );
       
   376         OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - create exif decoder" );
   357         TRAPD( err, CreateExifDecoderL( aFlags ));
   377         TRAPD( err, CreateExifDecoderL( aFlags ));
   358         thumbFound = ( err == KErrNone );
   378         thumbFound = ( err == KErrNone );
   359         iEXIF = ETrue;
   379         iEXIF = ETrue;
   360         }
   380         }
   361 
   381 
   362     if ( !thumbFound )
   382     if ( !thumbFound )
   363         {
   383         {
   364         iEXIF = EFalse;
   384         iEXIF = EFalse;
   365         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() create normal decoder" );
   385         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() create normal decoder" );
       
   386         OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - create normal decoder" );
   366         
   387         
   367         delete iDecoder;
   388         delete iDecoder;
   368         iDecoder = NULL;
   389         iDecoder = NULL;
   369         
   390         
   370         TFileName fullName;
   391         TFileName fullName;
   391                 {
   412                 {
   392                 iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, 
   413                 iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, 
   393                         options, KImageTypeSVGUid, KNullUid, KNullUid );
   414                         options, KImageTypeSVGUid, KNullUid, KNullUid );
   394                 
   415                 
   395                 TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
   416                 TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
       
   417                 OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
   396                 }
   418                 }
   397             else
   419             else
   398                 {
   420                 {
   399                 TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options, KImageTypeSVGUid ) );
   421                 TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options, KImageTypeSVGUid ) );
   400                 
   422                 
   401                 if ( decErr != KErrNone )
   423                 if ( decErr != KErrNone )
   402                     {
   424                     {
   403                     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - error 1" );
   425                     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - error 1" );
       
   426                     OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - error 1" );
   404                     
   427                     
   405                     User::Leave( decErr );
   428                     User::Leave( decErr );
   406                     }
   429                     }
   407                 
   430                 
   408                 TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
   431                 TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
       
   432                 OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
   409                 }
   433                 }
   410             }
   434             }
   411         else if ( !IsJpeg())
   435         else if ( !IsJpeg())
   412             {
   436             {
   413             if ( !iBuffer )
   437             if ( !iBuffer )
   414                 {
   438                 {
   415                 iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, options );
   439                 iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, options );
   416                 
   440                 
   417                 TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
   441                 TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
       
   442                 OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
   418                 }
   443                 }
   419             else
   444             else
   420                 {
   445                 {
   421                 TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, iMimeType.Des8(), options) );
   446                 TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, iMimeType.Des8(), options) );
   422                 
   447                 
   423                 if ( decErr != KErrNone )
   448                 if ( decErr != KErrNone )
   424                     {                        
   449                     {                        
   425                     TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder error %d", decErr );
   450                     TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder error %d", decErr );
       
   451                     OstTrace1( TRACE_NORMAL, DUP7_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder error;decErr=%d", decErr );
   426                     LeaveIfCorruptL(decErr);
   452                     LeaveIfCorruptL(decErr);
   427                     
   453                     
   428                     // don't force any mime type
   454                     // don't force any mime type
   429                     TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
   455                     TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
   430                     
   456                     
   431                     if ( decErr != KErrNone )
   457                     if ( decErr != KErrNone )
   432                         {                        
   458                         {                        
   433                         TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder no mime error %d", decErr );
   459                         TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder no mime error %d", decErr );
       
   460                         OstTrace1( TRACE_NORMAL, DUP8_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder no mime error;decErr=%d", decErr );
   434                         
   461                         
   435                         User::Leave( decErr );
   462                         User::Leave( decErr );
   436                         }
   463                         }
   437                     }
   464                     }
   438                 
   465                 
   439                 TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
   466                 TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
       
   467                 OstTrace0( TRACE_NORMAL, DUP9_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
   440                 }
   468                 }
   441             }
   469             }
   442         else
   470         else
   443             {
   471             {
   444             if ( !iBuffer )
   472             if ( !iBuffer )
   447                         CExtJpegDecoder::EHwImplementation, iFs, fullName, options) );
   475                         CExtJpegDecoder::EHwImplementation, iFs, fullName, options) );
   448                 
   476                 
   449                 if ( decErr != KErrNone )
   477                 if ( decErr != KErrNone )
   450                     {
   478                     {
   451                     TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
   479                     TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
       
   480                     OstTrace1( TRACE_NORMAL, DUP10_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL;decErr=%d - HW CExtJpegDecoder failed ", decErr );
   452                     LeaveIfCorruptL(decErr);
   481                     LeaveIfCorruptL(decErr);
   453                     
   482                     
   454                     TRAP( decErr, iDecoder = CExtJpegDecoder::FileNewL(
   483                     TRAP( decErr, iDecoder = CExtJpegDecoder::FileNewL(
   455                             CExtJpegDecoder::ESwImplementation, iFs, fullName, options) );
   484                             CExtJpegDecoder::ESwImplementation, iFs, fullName, options) );
   456                     
   485                     
   457                     if ( decErr != KErrNone )
   486                     if ( decErr != KErrNone )
   458                         {
   487                         {
   459                         TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
   488                         TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
       
   489                         OstTrace1( TRACE_NORMAL, DUP11_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - SW CExtJpegDecoder failed;decErr=%d", decErr );
   460                         LeaveIfCorruptL(decErr);
   490                         LeaveIfCorruptL(decErr);
   461                         
   491                         
   462                         TRAP( decErr, iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, options ));
   492                         TRAP( decErr, iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, options ));
   463                         
   493                         
   464                         if( decErr != KErrNone)
   494                         if( decErr != KErrNone)
   465                             {
   495                             {
   466                             TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder failed %d", decErr);
   496                             TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder failed %d", decErr);
       
   497                             OstTrace1( TRACE_NORMAL, DUP12_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder failed ;decErr=%d", decErr );
   467                             User::Leave( decErr );
   498                             User::Leave( decErr );
   468                             }
   499                             }
   469                         
   500                         
   470                         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
   501                         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
       
   502                         OstTrace0( TRACE_NORMAL, DUP13_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
   471                         }
   503                         }
   472                     else
   504                     else
   473                         {
   505                         {
   474                         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder created" );
   506                         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder created" );
       
   507                         OstTrace0( TRACE_NORMAL, DUP14_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - SW CExtJpegDecoder created" );
   475                         }
   508                         }
   476                     }
   509                     }
   477                 else 
   510                 else 
   478                     {
   511                     {
   479                     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder created" );
   512                     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder created" );
       
   513                     OstTrace0( TRACE_NORMAL, DUP15_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL" );
   480                     }
   514                     }
   481                 }
   515                 }
   482             else
   516             else
   483                 {
   517                 {
   484                 TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
   518                 TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
   485                         CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
   519                         CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
   486                 
   520                 
   487                 if ( decErr != KErrNone )
   521                 if ( decErr != KErrNone )
   488                     {
   522                     {
   489                     TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
   523                     TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
       
   524                     OstTrace1( TRACE_NORMAL, DUP16_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - HW CExtJpegDecoder failed;decErr=%d", decErr );
   490                     LeaveIfCorruptL(decErr);
   525                     LeaveIfCorruptL(decErr);
   491                     
   526                     
   492                     TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
   527                     TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
   493                             CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
   528                             CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
   494                     
   529                     
   495                     if ( decErr != KErrNone )
   530                     if ( decErr != KErrNone )
   496                         {                       
   531                         {                       
   497                         TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
   532                         TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
       
   533                         OstTrace1( TRACE_NORMAL, DUP17_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - SW CExtJpegDecoder failed;decErr=%d", decErr );
   498                         LeaveIfCorruptL(decErr);
   534                         LeaveIfCorruptL(decErr);
   499                         TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, iMimeType.Des8(), options) );
   535                         TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, iMimeType.Des8(), options) );
   500                         
   536                         
   501                         if ( decErr != KErrNone )
   537                         if ( decErr != KErrNone )
   502                             {                        
   538                             {                        
   503                             TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder failed %d", decErr);
   539                             TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder failed %d", decErr);
       
   540                             OstTrace1( TRACE_NORMAL, DUP18_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder failed;decErr=%d", decErr );
   504                             LeaveIfCorruptL(decErr);
   541                             LeaveIfCorruptL(decErr);
   505                             // don't force any mime type
   542                             // don't force any mime type
   506                             TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
   543                             TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
   507 
   544 
   508                             if ( decErr != KErrNone )
   545                             if ( decErr != KErrNone )
   509                                 {                                
   546                                 {                                
   510                                 TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder no mime failed %d", decErr);
   547                                 TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder no mime failed %d", decErr);
       
   548                                 OstTrace1( TRACE_NORMAL, DUP19_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder no mime failed;decErr=%d", decErr );
   511                                 User::Leave( decErr );
   549                                 User::Leave( decErr );
   512                                 }
   550                                 }
   513                             }
   551                             }
   514                         
   552                         
   515                         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
   553                         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
       
   554                         OstTrace0( TRACE_NORMAL, DUP20_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
   516                         }
   555                         }
   517                     else
   556                     else
   518                         {
   557                         {
   519                         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder created" );
   558                         TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder created" );
       
   559                         OstTrace0( TRACE_NORMAL, DUP21_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - SW CExtJpegDecoder created" );
   520                         }               
   560                         }               
   521                     }
   561                     }
   522                 else
   562                 else
   523                     {
   563                     {
   524                     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder created" );
   564                     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder created" );
       
   565                     OstTrace0( TRACE_NORMAL, DUP22_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - HW CExtJpegDecoder created" );
   525                     }               
   566                     }               
   526                 }
   567                 }
   527             }
   568             }
   528         }
   569         }
   529     
   570     
   530     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() end" );
   571     TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() end" );
       
   572     OstTrace0( TRACE_NORMAL, DUP23_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - end" );
   531     }
   573     }
   532 
   574 
   533 
   575 
   534 // -----------------------------------------------------------------------------
   576 // -----------------------------------------------------------------------------
   535 // CThumbnailImageDecoder::CreateExifDecoderL()
   577 // CThumbnailImageDecoder::CreateExifDecoderL()
   537 //
   579 //
   538 void CThumbnailImageDecoder::CreateExifDecoderL( CThumbnailManager
   580 void CThumbnailImageDecoder::CreateExifDecoderL( CThumbnailManager
   539     ::TThumbnailQualityPreference aFlags )
   581     ::TThumbnailQualityPreference aFlags )
   540     {
   582     {
   541     TN_DEBUG1( "CThumbnailImageDecoder::CreateExifDecoderL() start" );
   583     TN_DEBUG1( "CThumbnailImageDecoder::CreateExifDecoderL() start" );
       
   584     OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODER_CREATEEXIFDECODERL, "CThumbnailImageDecoder::CreateExifDecoderL - start" );
   542     
   585     
   543     // If the image is in jpeg format, try to get thumbnail from EXIF data.
   586     // If the image is in jpeg format, try to get thumbnail from EXIF data.
   544     CExifRead* reader = NULL;
   587     CExifRead* reader = NULL;
   545     
   588     
   546     if ( !iBuffer )
   589     if ( !iBuffer )
   598         TN_DEBUG2( "CThumbnailImageDecoder::CreateExifDecoderL() - CExtJpegDecoder err == %d", err );
   641         TN_DEBUG2( "CThumbnailImageDecoder::CreateExifDecoderL() - CExtJpegDecoder err == %d", err );
   599         User::LeaveIfError( err );
   642         User::LeaveIfError( err );
   600         }
   643         }
   601 
   644 
   602     TN_DEBUG1( "CThumbnailImageDecoder::CreateExifDecoderL() end" );
   645     TN_DEBUG1( "CThumbnailImageDecoder::CreateExifDecoderL() end" );
       
   646     OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODER_CREATEEXIFDECODERL, "CThumbnailImageDecoder::CreateExifDecoderL - end" );
   603     }
   647     }
   604 
   648 
   605 
   649 
   606 // -----------------------------------------------------------------------------
   650 // -----------------------------------------------------------------------------
   607 // CThumbnailImageDecoder::CreateExifDecoderL()
   651 // CThumbnailImageDecoder::CreateExifDecoderL()