Upload
naver-d2
View
1.309
Download
1
Embed Size (px)
Citation preview
2.1����������� ������������������ ����������� ������������������ 2012����������� ������������������ 모바일����������� ������������������ 브라우저����������� ������������������ 점유율����������� ������������������
2.2����������� ������������������ ����������� ������������������ 이미지����������� ������������������ 리소스����������� ������������������ 제약����������� ������������������ 살펴보기����������� ������������������
3.1����������� ������������������ ����������� ������������������ 이가����������� ������������������ 없으면����������� ������������������ 잇몸으로…⋯����������� ������������������
4.1����������� ������������������ ����������� ������������������ 이렇게����������� ������������������ 합니다.����������� ������������������
5.1����������� ������������������ ����������� ������������������ DEMO����������� ������������������
5.2����������� ������������������ ����������� ������������������ 소소한����������� ������������������ Tips����������� ������������������
500����������� ������������������ x����������� ������������������ 29400����������� ������������������
=����������� ������������������ 44,100,000����������� ������������������ px����������� ������������������ 500����������� ������������������ x����������� ������������������ 29400����������� ������������������
=����������� ������������������ 44,100,000����������� ������������������ px����������� ������������������ 500����������� ������������������ x����������� ������������������ 29400����������� ������������������
=����������� ������������������ 44����������� ������������������ Mpx����������� ������������������
=����������� ������������������ 44,100,000����������� ������������������ px����������� ������������������ 500����������� ������������������ x����������� ������������������ 29400����������� ������������������
=����������� ������������������ 44����������� ������������������ Mpx����������� ������������������
decoded GIF,����������� ������������������ PNG,����������� ������������������ and����������� ������������������ TIFF����������� ������������������ images����������� ������������������ is����������� ������������������ 3����������� ������������������ megapixels����������� ������������������ less����������� ������������������ than����������� ������������������ 256����������� ������������������ MB����������� ������������������ RAM����������� ������������������
5����������� ������������������ megapixels����������� ������������������ greater����������� ������������������ or����������� ������������������ equal����������� ������������������ than����������� ������������������ 256����������� ������������������ MB����������� ������������������ RAM
JPEG����������� ������������������ is����������� ������������������ 32����������� ������������������ megapixels����������� ������������������ subsampling����������� ������������������
sixteenth����������� ������������������ ����������� ������������������
2����������� ������������������ megapixels����������� ������������������ are����������� ������������������ subsampled
Know����������� ������������������ iOS����������� ������������������ Resource����������� ������������������ Limits����������� ������������������
• ����������� ������������������ The����������� ������������������ maximum����������� ������������������ size����������� ������������������ for����������� ������������������ decoded����������� ������������������ GIF,����������� ������������������ PNG,����������� ������������������ and����������� ������������������ TIFF����������� ������������������ images����������� ������������������ is����������� ������������������ 3����������� ������������������ megapixels����������� ������������������ for����������� ������������������ devices����������� ������������������ with����������� ������������������ less����������� ������������������ than����������� ������������������ 256����������� ������������������ MB����������� ������������������ RAM����������� ������������������
����������� ������������������ and����������� ������������������ 5����������� ������������������ megapixels����������� ������������������ for����������� ������������������ devices����������� ������������������ with����������� ������������������ greater����������� ������������������ or����������� ������������������ equal����������� ������������������ than����������� ������������������ 256����������� ������������������ MB����������� ������������������ RAM.����������� ������������������
����������� ������������������
• width����������� ������������������ *����������� ������������������ height����������� ������������������ ≤����������� ������������������ 3����������� ������������������ *����������� ������������������ 1024����������� ������������������ *����������� ������������������ 1024����������� ������������������ for����������� ������������������ devices����������� ������������������ with����������� ������������������ less����������� ������������������ than����������� ������������������ 256����������� ������������������ MB����������� ������������������ RAM����������� ������������������
����������� ������������������
• The����������� ������������������ maximum����������� ������������������ decoded����������� ������������������ image����������� ������������������ size����������� ������������������ for����������� ������������������ JPEG����������� ������������������ is����������� ������������������ 32����������� ������������������ megapixels����������� ������������������ using����������� ������������������ subsampling����������� ������������������
JPEG����������� ������������������ images����������� ������������������ can����������� ������������������ be����������� ������������������ up����������� ������������������ to����������� ������������������ 32����������� ������������������ megapixels����������� ������������������ due����������� ������������������ to����������� ������������������ subsampling,����������� ������������������ which����������� ������������������ allows����������� ������������������ JPEG����������� ������������������ images����������� ������������������ to����������� ������������������ decode����������� ������������������ to����������� ������������������ a����������� ������������������ size����������� ������������������ that����������� ������������������ has����������� ������������������ one����������� ������������������ sixteenth����������� ������������������ ����������� ������������������
the����������� ������������������ number����������� ������������������ of����������� ������������������ pixels.����������� ������������������ JPEG����������� ������������������ images����������� ������������������ larger����������� ������������������ than����������� ������������������ 2����������� ������������������ megapixels����������� ������������������ are����������� ������������������ subsampled—―that����������� ������������������ is,����������� ������������������ decoded����������� ������������������ to����������� ������������������ a����������� ������������������ reduced����������� ������������������ size.����������� ������������������ ����������� ������������������
����������� ������������������
• The����������� ������������������ maximum����������� ������������������ size����������� ������������������ for����������� ������������������ a����������� ������������������ canvas����������� ������������������ element����������� ������������������ is����������� ������������������ 3����������� ������������������ megapixels����������� ������������������ for����������� ������������������ devices����������� ������������������ with����������� ������������������ less����������� ������������������ than����������� ������������������ 256����������� ������������������ MB����������� ������������������ RAM����������� ������������������ ����������� ������������������
����������� ������������������ and����������� ������������������ 5����������� ������������������ megapixels����������� ������������������ for����������� ������������������ devices����������� ������������������ with����������� ������������������ greater����������� ������������������ or����������� ������������������ equal����������� ������������������ than����������� ������������������ 256����������� ������������������ MB����������� ������������������ RAM����������� ������������������
����������� ������������������ 출처����������� ������������������ :����������� ������������������ ����������� ������������������
http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/CreatingContentforSafarioniPho
ne/CreatingContentforSafarioniPhone.html����������� ������������������
참고����������� ������������������ :����������� ������������������ ����������� ������������������ (NULI����������� ������������������ NHN����������� ������������������ ����������� ������������������ 웹표준)����������� ������������������
http://html.nhndesign.com/blog/17978����������� ������������������
.����������� ������������������ >=����������� ������������������ 256M
#ifdef����������� ������������������ ANDROID_LARGE_MEMORY_DEVICE����������� ������������������
#define����������� ������������������ MIN_RLE_ALLOC_SIZE����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ (8*1024*1024)����������� ������������������
#define����������� ������������������ MAX_SIZE_BEFORE_SUBSAMPLE����������� ������������������ ����������� ������������������ ����������� ������������������ (8*1024*1024)����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ #define����������� ������������������ MIN_RLE_ALLOC_SIZE����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ (2*1024*1024)����������� ������������������
#define����������� ������������������ MAX_SIZE_BEFORE_SUBSAMPLE����������� ������������������ ����������� ������������������ ����������� ������������������ (2*1024*1024)����������� ������������������
//����������� ������������������ flag����������� ������������������ to����������� ������������������ tell����������� ������������������ us����������� ������������������ when����������� ������������������ we're����������� ������������������ on����������� ������������������ a����������� ������������������ large-ram����������� ������������������ device����������� ������������������ (e.g.����������� ������������������ >=����������� ������������������ 256M)����������� ������������������
#ifdef����������� ������������������ ANDROID_LARGE_MEMORY_DEVICE����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ don't����������� ������������������ use����������� ������������������ RLE����������� ������������������ for����������� ������������������ images����������� ������������������ smaller����������� ������������������ than����������� ������������������ this,����������� ������������������ since����������� ������������������ they����������� ������������������ incur����������� ������������������ a����������� ������������������ drawing����������� ������������������ cost����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ (and����������� ������������������ don't����������� ������������������ work����������� ������������������ as����������� ������������������ patterns����������� ������������������ yet)����������� ������������������ we����������� ������������������ only����������� ������������������ want����������� ������������������ to����������� ������������������ use����������� ������������������ RLE����������� ������������������ when����������� ������������������ we����������� ������������������ must����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ #define����������� ������������������ MIN_RLE_ALLOC_SIZE����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ (8*1024*1024)����������� ������������������
����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ see����������� ������������������ dox����������� ������������������ for����������� ������������������ computeMaxBitmapSizeForCache()����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ #define����������� ������������������ MAX_SIZE_BEFORE_SUBSAMPLE����������� ������������������ ����������� ������������������ ����������� ������������������ (8*1024*1024)����������� ������������������
����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ preserve����������� ������������������ quality����������� ������������������ for����������� ������������������ 24/32bit����������� ������������������ src����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ static����������� ������������������ const����������� ������������������ SkBitmap::Config����������� ������������������ gPrefConfigTable[6]����������� ������������������ =����������� ������������������ {����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ SkBitmap::kIndex8_Config,����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ src:����������� ������������������ index,����������� ������������������ opaque����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ SkBitmap::kIndex8_Config,����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ src:����������� ������������������ index,����������� ������������������ alpha����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ SkBitmap::kRGB_565_Config,����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ src:����������� ������������������ 16bit,����������� ������������������ opaque����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ SkBitmap::kARGB_8888_Config,����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ src:����������� ������������������ 16bit,����������� ������������������ alpha����������� ������������������ ����������� ������������������ (promote����������� ������������������ to����������� ������������������ 32bit)����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ SkBitmap::kARGB_8888_Config,����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ src:����������� ������������������ 32bit,����������� ������������������ opaque����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ SkBitmap::kARGB_8888_Config,����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ src:����������� ������������������ 32bit,����������� ������������������ alpha����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ };����������� ������������������
#else����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ #define����������� ������������������ MIN_RLE_ALLOC_SIZE����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ (2*1024*1024)����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ #define����������� ������������������ MAX_SIZE_BEFORE_SUBSAMPLE����������� ������������������ ����������� ������������������ ����������� ������������������ (2*1024*1024)����������� ������������������
����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ //����������� ������������������ tries����������� ������������������ to����������� ������������������ minimize����������� ������������������ memory����������� ������������������ usage����������� ������������������ (i.e.����������� ������������������ demote����������� ������������������ opaque����������� ������������������ 32bit����������� ������������������ ->����������� ������������������ 16bit)����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ static����������� ������������������ const����������� ������������������ SkBitmap::Config����������� ������������������ gPrefConfigTable[6]����������� ������������������ =����������� ������������������ {����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ …⋯����������� ������������������ 생략����������� ������������������
};����������� ������������������
#endif����������� ������������������
����������� ������������������
/*����������� ������������������ ����������� ������������������ Images����������� ������������������ larger����������� ������������������ than����������� ������������������ this����������� ������������������ should����������� ������������������ be����������� ������������������ subsampled.����������� ������������������ Using����������� ������������������ ashmem,����������� ������������������ the����������� ������������������ decoded����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ pixels����������� ������������������ will����������� ������������������ be����������� ������������������ purged����������� ������������������ as����������� ������������������ needed,����������� ������������������ so����������� ������������������ this����������� ������������������ value����������� ������������������ can����������� ������������������ be����������� ������������������ pretty����������� ������������������ large.����������� ������������������ Making����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ it����������� ������������������ too����������� ������������������ small����������� ������������������ hurts����������� ������������������ image����������� ������������������ quality����������� ������������������ (e.g.����������� ������������������ abc.com����������� ������������������ background).����������� ������������������ 2Meg����������� ������������������ works����������� ������������������ for����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ the����������� ������������������ sites����������� ������������������ I've����������� ������������������ tested,����������� ������������������ but����������� ������������������ if����������� ������������������ we����������� ������������������ hit����������� ������������������ important����������� ������������������ sites����������� ������������������ that����������� ������������������ need����������� ������������������ more,����������� ������������������ we����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ should����������� ������������������ try����������� ������������������ increasing����������� ������������������ it����������� ������������������ and����������� ������������������ see����������� ������������������ if����������� ������������������ it����������� ������������������ has����������� ������������������ negative����������� ������������������ impact����������� ������������������ on����������� ������������������ performance����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ (i.e.����������� ������������������ we����������� ������������������ end����������� ������������������ up����������� ������������������ thrashing����������� ������������������ because����������� ������������������ we����������� ������������������ need����������� ������������������ to����������� ������������������ keep����������� ������������������ decoding����������� ������������������ images����������� ������������������ that����������� ������������������ have����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ been����������� ������������������ purged.����������� ������������������
����������� ������������������ ����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ Perhaps����������� ������������������ this����������� ������������������ value����������� ������������������ should����������� ������������������ be����������� ������������������ some����������� ������������������ fraction����������� ������������������ of����������� ������������������ the����������� ������������������ available����������� ������������������ RAM...����������� ������������������
*/����������� ������������������
static����������� ������������������ size_t����������� ������������������ computeMaxBitmapSizeForCache()����������� ������������������ {����������� ������������������
����������� ������������������ ����������� ������������������ ����������� ������������������ ����������� ������������������ return����������� ������������������ MAX_SIZE_BEFORE_SUBSAMPLE;����������� ������������������
}����������� ������������������
출처����������� ������������������ :����������� ������������������ ����������� ������������������
git����������� ������������������ clone����������� ������������������ https://android.googlesource.com/platform/external/webkit����������� ������������������
IOS����������� ������������������ Android����������� ������������������
Embed����������� ������������������ Browser����������� ������������������ Safari����������� ������������������ Android����������� ������������������ Browser����������� ������������������
Layout����������� ������������������ Engine����������� ������������������ WebKit����������� ������������������ WebKit����������� ������������������
Max.����������� ������������������ ����������� ������������������ Decoded����������� ������������������ Image����������� ������������������ Pixels����������� ������������������
3����������� ������������������ M����������� ������������������ –����������� ������������������ 5����������� ������������������ M����������� ������������������ ����������� ������������������ (jpeg����������� ������������������ 32����������� ������������������ M)����������� ������������������
2����������� ������������������ M����������� ������������������ –����������� ������������������ 8����������� ������������������ M����������� ������������������
Force����������� ������������������ Resize����������� ������������������ (subsampling)����������� ������������������
jpeg����������� ������������������ 2����������� ������������������ M����������� ������������������ over����������� ������������������ 2����������� ������������������ or����������� ������������������ 8����������� ������������������ M����������� ������������������ over����������� ������������������
Huristic����������� ������������������ 6����������� ������������������ M����������� ������������������ over����������� ������������������ -����������� ������������������
=����������� ������������������ 44,100,000����������� ������������������ px����������� ������������������ 500����������� ������������������ x����������� ������������������ 29400����������� ������������������
44����������� ������������������ Mpx����������� ������������������ >����������� ������������������ 2-8Mpx����������� ������������������
XSU����������� ������������������ (min/maX����������� ������������������ Scan����������� ������������������ Unit)����������� ������������������
XSU����������� ������������������ XSU����������� ������������������ XSU����������� ������������������ XSU����������� ������������������
XSU����������� ������������������ XSU����������� ������������������ XSU����������� ������������������ …⋯N����������� ������������������
XSU����������� ������������������ XSU����������� ������������������ XSU����������� ������������������ XSU����������� ������������������
XSU����������� ������������������ XSU����������� ������������������ XSU����������� ������������������ …⋯N����������� ������������������
Contents����������� ������������������ ROI����������� ������������������ Graph����������� ������������������
XSU����������� ������������������
Threshold����������� ������������������ Value����������� ������������������
Callback����������� ������������������ &����������� ������������������ Image����������� ������������������ Partitioning����������� ������������������
Image����������� ������������������
C.����������� ������������������ ROI����������� ������������������ Graph����������� ������������������
Callback����������� ������������������
Handler����������� ������������������
[email protected]����������� ������������������