Upgrade to Pro — share decks privately, control downloads, hide ads and more …

まだJPEGで消耗してるの?/iOSDC-Reject-Conference

 まだJPEGで消耗してるの?/iOSDC-Reject-Conference

253696343a018052ff394eb1f63e3d6f?s=128

Taketo Yoshida

August 30, 2016
Tweet

Transcript

  1. 1 ·ͩ+1&(Ͱফ໣ͯ͠Δͷʁ ʙ8FC1Ͱ૑Δշద৽ฉϥΠϑʙ ٢ా݈ਓ೔ຊܦࡁ৽ฉࣾσδλϧฤ੒ہฤ੒෦

  2. 2 ೔ຊܦࡁ৽ฉࣾͷJ04ΤϯδχΞ ࣗݾ঺հ ࢴ໘ϏϡʔΞʔΞϓϦͷ։ൃ (JUIVC!UBNBOZBO ٢ా݈ਓ :PTIJEB5BLFUP

  3. 3 গ͠Ͱ΋ը૾ͷ௨৴ྔΛݮΒͯ͠ μ΢ϯϩʔυΛ଎͍ͨ͘͠ʜ

  4. 4 J04্Ͱ8FC1Λ࢖༻ͯ͠ಘͨ ஌ݟΛൃද͠·͢

  5. 5 8FC1ͱ͸ʁ (PPHMF͕։ൃ͍ͯ͠Δը૾ϑΥʔϚοτ ՄٯѹॖͱඇՄٯѹॖͷ྆ํΛαϙʔτ ඇՄٯѹॖͰ͸+1&(ͱൺ΂ͯখ͘͞ͳΔ

  6. 6 ଞࣾͷ࠾༻ࣄྫ

  7. 7 IUUQXXXTMJEFTIBSFOFUTVTJFZZJPTJPT

  8. 8 IUUQUFDIMJGFDPPLQBEDPNFOUSZ

  9. 9 IUUQIPNFTEFTJHOFSTIBUFOBCMPHDPNFOUSZ

  10. 10 ೔ܦͰ͸ࢴ໘ϏϡʔΞʔͰ8FC1Λ࢖༻

  11. 11 ࢴ໘ΠϝʔδΛ8FC1Ͱ഑৴ +1&(ͱಉըૉ਺Ͱ໿ݮ ಉըૉ਺Ͱ΋ϊΠζΛখ͘͞ ˞݄೔ͷேץͰଌఆ

  12. 12 ༰ྔ.#ˠ.# μ΢ϯϩʔυ଎౓ඵˠඵ ˞݄೔ͷேץͰଌఆ

  13. 13 J04ʹͯ8FC1Λѻ͏ʹ͸

  14. 14 MJCXFCQΛ࢖༻͢Δ IUUQTHJUIVCDPNXFCNQSPKFDUMJCXFCQ

  15. 15 private func freeImageData(info: UnsafeMutablePointer<Void>, data: UnsafePointer<Void>, size: Int) {

    free(UnsafeMutablePointer<Void>(data)) } extension UIImage { static func imageFromWebPData(data: NSData) -> UIImage? { var config = WebPDecoderConfig() if WebPInitDecoderConfig(&config) == 0 { return nil } if WebPGetFeatures(UnsafePointer<UInt8>(data.bytes), data.length, &config.input) != VP8_STATUS_OK { return nil } config.output.colorspace = config.input.has_alpha != 0 ? MODE_rgbA : MODE_RGB if WebPDecode(UnsafePointer<UInt8>(data.bytes), data.length, &config) != VP8_STATUS_OK { return nil } let width = config.input.width let height = config.input.height let provider = CGDataProviderCreateWithData(nil, config.output.u.RGBA.rgba, config.output.u.RGBA.size, freeImageData) let colorSpaceRef = CGColorSpaceCreateDeviceRGB() let components = config.input.has_alpha != 0 ? 4 : 3 let bi = config.input.has_alpha != 0 ? CGBitmapInfo(rawValue: CGBitmapInfo.ByteOrderDefault.rawValue | CGImageAlphaInfo.PremultipliedLast.rawValue) : CGBitmapInfo.ByteOrderMask guard let imageRef = CGImageCreate( Int(width), Int(height), 8, components * 8, components * Int(width), colorSpaceRef, bi, provider, nil, true, .RenderingIntentDefault) else { return nil } return UIImage(CGImage: imageRef) } } MJCXFCQΛѻ͍΍͘͢͢ΔͨΊʹ&YUFOTJPOΛॻ͘
  16. 16 ϙΠϯλʔຬࡌͳΜͰ0CK$Ͱ ॻ͍ͨํָ͕͔΋ʜ

  17. 17 J04Ͱ΋8FC1͸αϙʔτ֎ͳͷʁ

  18. 18 IUUQXXXDOFUDPNOFXTBQQMFJPTNBDPTUFTUTHPPHMFTXFCQHSBQIJDTUPTQFFEVQXFC

  19. 19 αϙʔτŝŦᴸᴸᴸ ƅ˲ƅ ᴸᴸᴸ

  20. 20 J04CFUBͰݕূͯ͠Έͨ

  21. 21

  22. 22 ( ゚д゚) ・・・   (つд⊂)ゴシゴシ   (;゚д゚) ・・・   (つд⊂)ゴシゴシゴシ

      _, ._ (;゚ Д゚) …!?
  23. 23 Ͳ͏͍͏͜ͱͩͬͯ͹Α

  24. 24 5XJUUFSͰௐ΂ͯΈͨ

  25. 25

  26. 26

  27. 27 ΍ͬͺŠŮᴸᴸᴸᴸ "A ᴸᴸᴸᴸ

  28. 28 ࠓͷͱ͜ΖMJCXFCQΛ࢖͏͔͠ͳ͍

  29. 29 8FC1ͷύϑΥʔϚϯε

  30. 30 8FC1ͷύϑΥʔϚϯε ࣮ࡍ+1&(ͱൺֱͨ࣌͠ͷαΠζ͸ʁ μ΢ϯϩʔυ͔Βදࣔ·Ͱʹ͔͔Δ࣌ؒ͸ʁ ը࣭ͷධՁ͸ͲͷΑ͏ʹߦ͏ʁ

  31. 31 ೥݄೔ேץϖʔδ޿ࠂ໘ ˞.#ͷ1/( YQY

  32. 32 QY QY QY QY QY ͭͷαΠζͷը૾+1&(ͱ8&#1Λ༻ҙ͢Δ

  33. 33 ࣮ࡍ+1&(ͱൺֱͨ࣌͠ͷαΠζ͸ʁ

  34. 34 ը૾ͷԣαΠζ QY +1&(ͷαΠζ ,# 8FC1ͷαΠζ ,#   

                dͷαΠζͷ࡟ݮ
  35. 35 μ΢ϯϩʔυ͔Βදࣔ·Ͱʹ
 ͔͔Δ࣌ؒ͸ʁ

  36. 36 J04Ͱ8FC1Λ࢖༻͢Δ࣌͸ σίʔυ࣌ؒΛߟྀ͢Δඞཁ͕͋Δ

  37. 37 EPXOMPBE࣌ؒ KQFHEFDPEF࣌ؒ +1&(ͷ৔߹ ࣮࣭ͷμ΢ϯϩʔυ࣌ؒ

  38. 38 EPXOMPBE࣌ؒ XFCQEFDPEF࣌ؒ 8FC1ͷ৔߹ ࣮࣭ͷμ΢ϯϩʔυ࣌ؒ

  39. 39 var start = NSDate() [download(url128a), download(url128b), download(url128c), download(url128d), download(url128e)].sequence().then

    { images in let elapsed = NSDate().timeIntervalSinceDate(start) NSLog(elapsed) } ͭͷϑΝΠϧΛಉ࣌ʹμ΢ϯϩʔυͯ͠6**NBHF·Ͱ མͱ͜͠Μͩ࣌ͷ࣌ؒΛ࣮࣭ͷμ΢ϯϩʔυ࣌ؒͱͯ͠ܭଌ ˞࣮ݧ؀ڥJ1IPOFT4PGUCBOL(-5&
  40. 40 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

    1.8 2 128 256 512 1024 2048 ) ( webp jpeg ը૾αΠζ͕େ͖͍΄Ͳ࣮࣭ͷμ΢ϯϩʔυ࣌ؒ͸୹ॖ͞ΕΔ
  41. 41 ը૾αΠζ͕େ͖͍΄Ͳ ௨৴ίετσίʔυίετ

  42. 42 ৽ฉͷΑ͏ͳըૉ਺͕ଟ͍ը૾ μ΢ϯϩʔυ͢ΔΞϓϦʹ͸༗ޮ

  43. 43 ը࣭ͷධՁ͸ͲͷΑ͏ʹߦ͏ʁ

  44. 44 44*. ͭͷը૾͕Ͳͷఔ౓ࣅ௨͍ͬͯΔ͔Λ൑அ͢Δख๏ Ұൠతʹ44*.ͷ஋͕Ҏ্͋Ε͹ΦϦδφϧͱಉ౳ͷ඼࣭ αΠζΛ཈͑ͭͭྼԽ͠ͳ͍ϥΠϯͰύϥϝʔλΛௐ੔͢Δ

  45. 45 IUUQTHJUIVCDPNKUFSSBDFQZTTJN

  46. 46 ·ͱΊ

  47. 47 ·ͱΊ J04ͷ8FC1ͷαϙʔτΛকདྷతʹ͋Δ͔΋ ըૉ਺͕ଟ͍ը૾Λ࢖͍ͬͯΔͳΒ͹8FC1Λ࢖͏Ձ஋͕͋Δ 44*.Λར༻͢Δ͜ͱͰը࣭ͷධՁ͕Մೳ

  48. 48 5IBOLZPVGPSMJTUFOJOHUPNF