XSF Discussion - 2019-10-27


  1. jonas’

    MattJ, blurhash calculated server-side or blurhash expected to be sent from the client?

  2. Ge0rG

    I'd say it should be part of the SIMS

  3. MattJ

    jonas’: I think either works - there are some advantages to client-side (sender)

  4. Ge0rG

    MattJ: what's the benefit of blurhash over a small BoB preview?

  5. MattJ

    Sender controlled preview doesn't necessarily cover the NSFW case without extra work

  6. Ge0rG

    the only difference between blurhash and preview is the resolution, right?

  7. MattJ

    Kinda, kinda not

  8. MattJ

    You can get away with lower resolution blurhash because of the blurring

  9. MattJ

    Preview at the same resolution would be blocky

  10. MattJ

    Very

  11. Ge0rG

    MattJ: most modern rendering algorithms will blur instead of blocking

  12. MattJ

    All blurhash algorithms blur, regardless of image type/etc.

  13. Zash

    All? There's more than one?

  14. MattJ

    Implementations

  15. MattJ

    Sorry, I have a baby in one hand and the other is multitasking between making lunch and typing

  16. Ge0rG

    MattJ: if we add a BoB into SIMS, we surely can demand it to be blurred up to the original image resolution ;)

  17. Zash

    And like a tiny very compressed jpeg image there

  18. Zash

    8x8 or smaller

  19. MattJ

    I really don't care if you want to spec the same effect a different way that works

  20. MattJ

    I am just trying to do stuff

  21. MattJ

    Currently that means I am not going to get everyone in a channel to upgrade their clients to one that sends a hash, but I have a bit of influence on the server sidr

  22. MattJ

    Currently that means I am not going to get everyone in a channel to upgrade their clients to one that sends a hash, but I have a bit of influence on the server side

  23. MattJ

    Blurhash is well defined with multiple libraries available

  24. Ge0rG

    JPEG is well defined with multiple libraries available ;)

  25. MattJ

    If you can do better, I beg you to

  26. Zash

    Reviwe progessive JPEG! :)

  27. jonas’

    12:29:19 Ge0rG> MattJ: most modern rendering algorithms will blur instead of blocking Quality of blurhash isn’t comparable to linearly interpolated pixels of a low-res previow

  28. Ge0rG

    Zash: awesome idea! make the preview image the first layer of the progressive jpeg, that way we can skip some bits on the actual transmission!

  29. Ge0rG

    jonas’: this is exactly what I want to learn - what's the difference?

  30. jonas’

    https://blurha.sh/

  31. jonas’

    look at it

  32. jonas’

    technically, I think they use spherical functions or something like that and save the coefficients for those

  33. jonas’

    but I haven’t gotten around to look into it in more detail yet

  34. Zash

    From when I read the spec it sounded like one block of JPEG

  35. Ge0rG

    converting an image into an 8x8 px JPEG is a standard feature of any platform that supports JPEG images. Converting into blurha.sh... not so much

  36. MattJ

    The 4x3 JPEG file I made is 667 bytes compared to 28 bytes for the same image's blurhash

  37. MattJ

    and some things display it blocky, some do blur (but so far I haven't managed to find an image viewer that does blur and also allows unlimited zoom)

  38. Daniel

    That's one of these moments where actually studying that stuff at university would have been helpful. Because I don't really understand what blurhash is doing

  39. Daniel

    Need to ask my university buddies at some point

  40. edhelas

    I really like the idea behind blurhash, would be pleased to use it in Movim :)

  41. Ge0rG

    again, what's the actual benefit over a significantly downscaled picture?

  42. Zash

    Presumably that the "hash" is smaller.

  43. Daniel

    No jpeg overhead?

  44. Daniel

    The decoding / upscalling is specified?

  45. Ge0rG

    the jpeg overhead needs to be offset by the additional library overhead, though ;)

  46. Ge0rG

    okay, https://github.com/woltapp/blurhash/blob/master/Kotlin/lib/src/main/java/com/wolt/blurhashkt/BlurHashDecoder.kt doesn't look like a huge overhead ;)

  47. Ge0rG

    > We usually decode placeholders that are 32 or even 20 pixels wide, and then let the UI layer scale them up, which is indistinguishable from decoding them at full size.

  48. Ge0rG

    Heh.

  49. Zash

    Huh

  50. edhelas

    could be really nice to also use it for the avatars :)

  51. jonas’

    I’d question the "shell-safe" base83 encoding though. the character set contains $ and * and # and { and } and [ and ]

  52. jonas’

    not that it matters much

  53. jonas’

    Daniel, they essentially do what jpeg does

  54. jonas’

    I’m not quite sure why the rendering is that much better though

  55. jonas’

    maybe because they have more bits for the few pixels

  56. Zash

    Because it's done in JavaScript of course

  57. jonas’

    ah, probably because what jpeg would normally expand to just 8x8 pixels, they expand to more pixels, and they don’t do that linearly, but they evaluate the cosine functions the DCT gave

  58. jonas’

    that’s why it’s smoother than upscaling a 8x8 jpeg

  59. lovetox

    what i dont get

  60. lovetox

    ok there are librarys who let me get the hash from a picture

  61. lovetox

    but i dont see one that let me get a picture from the hash

  62. jonas’

    note, blurhash is a misnomer

  63. jonas’

    it’s not a cryptographic one-way hash function

  64. jonas’

    lovetox, https://github.com/halcy/blurhash-python here is an encoder and decoder thing

  65. lovetox

    where do you see the decode?

  66. jonas’

    https://github.com/halcy/blurhash-python/blob/master/blurhash/blurhash.py#L77

  67. lovetox

    hm yeah but this is some fork

  68. lovetox

    not the original project

  69. lovetox

    but good :)

  70. jonas’

    it’s linked in their readme

  71. jonas’

    I guess their decoders are all JS because web

  72. lovetox

    yeah hm the original project has it in c and only wraps in python

  73. lovetox

    also it lets me just pass a filename

  74. lovetox

    with this fork, i have to install PIL and numpy to even pass something to the lib

  75. jonas’

    which makes sense

  76. jonas’

    (the original C thing also is only an encoder)

  77. lovetox

    why does it make sense, i will never install numpy and PIL only to get a blurhash

  78. lovetox

    insane to me :)

  79. jonas’

    you need PIL to load image data

  80. jonas’

    you need numpy to efficiently calculate the DCT and do the inverse

  81. lovetox

    i dont think so, the c implementation doesnt need numpy so why should the python one

  82. jonas’

    you can do it in pure python, but it’ll be slow

  83. lovetox

    they should just add a decode method to the c version

  84. lovetox

    and nobody needs the pure python one

  85. jonas’

    I bet "PRs welcome"

  86. jonas’

    except that the C version has restrictions on the input file formats. e.g. they don’t support all JPEG and PNG variants

  87. lovetox

    or i save me the whole trouble with 3 thirdparty librarys

  88. lovetox

    and just show the same blurred out placeholder for all pictures

  89. lovetox

    this seems like a gimmick, i get that its nice for webpages with many pictures

  90. lovetox

    but for a messaging client where most of the time only one picture is on the screen

  91. lovetox

    i would not add all that stuff