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