{"id":410,"date":"2019-07-08T15:50:33","date_gmt":"2019-07-08T13:50:33","guid":{"rendered":"https:\/\/hpjansson.org\/blag\/?p=410"},"modified":"2023-02-04T07:26:39","modified_gmt":"2023-02-04T06:26:39","slug":"image-scaling-on-the-cpu","status":"publish","type":"post","link":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/","title":{"rendered":"Battle of the Bilerps: Image Scaling on the CPU"},"content":{"rendered":"\n<p>I've been on a quest for better bilerps lately. \"Bilerp\" is, of course, a contraction of \"<a href=\"https:\/\/en.wikipedia.org\/wiki\/Bilinear_interpolation\" rel=\"nofollow\">bilinear interpolation<\/a>\", and it's how you scale pictures when you're in a hurry. The GNOME Image Viewer (n\u00e9e Eye of GNOME) and ImageMagick have both offered somewhat disappointing experiences in that regard; the former often pauses noticeably between the initial nearest-neighbor and eventual non-awful scaled images, but <em>way<\/em>  more importantly, the latter is too slow to scale animation frames in <a href=\"https:\/\/hpjansson.org\/chafa\/\">Chafa<\/a>.<\/p>\n\n\n\n<p>So, how fast can CPU image scaling be? I went looking, and managed to produce some benchmarks &#8212; and! &#8212; code. If that's your jam, keep reading.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What's measured<\/h2>\n\n\n\n<p>The headline reference falls a little short of the gory details: The practical requirement is to just do whatever it takes to produce middle-of-the-road quality output. Bilinear interpolation starts to resemble nearest-neighbor when you reduce an image by more than 50%, so below that threshold I let the implementations use the fastest supported algorithm that still looks halfway decent.<\/p>\n\n\n\n<p>There are other caveats too. I'll go over those in the discussion of each implementation.<\/p>\n\n\n\n<p>I checked for correctness issues\/artifacts by scaling solid-color images across a large range of sizes. Ideally, the color should be preserved across the entire output image, but fast implementations sometimes take shortcuts that cause them to lose low-order bits due to bad rounding or insufficient precision.<\/p>\n\n\n\n<p>I ran the benchmarks on my workstation, which is an i7-4770K (Haswell) @ 3.5GHz.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Performance summary<br><\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png\" alt=\"Image scaling performance plot (mid-size)\" class=\"wp-image-414\" srcset=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png 800w, https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size-300x225.png 300w, https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size-768x576.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure><\/div>\n\n\n<p>This plot consists of 500 samples per implementation, each of which is the fastest out of 50 runs. The input image is 2000&#215;2000 RGBA pixels at 8 bits per channel. I chose additional parameters (channel ordering, premultiplication) to get the best performance out of each implementation. The image is scaled to a range of sizes (x axis) and the lowest time taken to produce a single output image at each size is plotted (y axis). A line is drawn through the resulting points.<\/p>\n\n\n\n<p>Here's one more:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-10-16383-16383-0.0001-0.1-100-elapsed-size.png\" alt=\"Image scaling performance plot (large size)\" class=\"wp-image-441\" srcset=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-10-16383-16383-0.0001-0.1-100-elapsed-size.png 800w, https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-10-16383-16383-0.0001-0.1-100-elapsed-size-300x225.png 300w, https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-10-16383-16383-0.0001-0.1-100-elapsed-size-768x576.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure><\/div>\n\n\n<p>It's the same thing, but with a huge input and smaller outputs. As you can see, there are substantial differences. It's hard to tell from the plot, but Smolscale MT averages about 50ms per frame. More on that below. But first, a look at another important metric.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Output quality<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"778\" height=\"950\" src=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/vandog-scaled-2.png\" alt=\"Image scaling quality comparison\" class=\"wp-image-453\" srcset=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/vandog-scaled-2.png 778w, https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/vandog-scaled-2-246x300.png 246w, https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/vandog-scaled-2-768x938.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/figure><\/div>\n\n\n<p><a href=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/vandog.png\">Input image<\/a>. It's fair to say that one of these is not like the others. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Discussion<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">GDK-Pixbuf<\/h3>\n\n\n\n<p><a href=\"https:\/\/developer.gnome.org\/gdk-pixbuf\/stable\/\">GDK-Pixbuf<\/a> is the traditional GNOME image library. Despite its various warts, it's served the project well for close to two decades. You can read more about it in <a href=\"https:\/\/people.gnome.org\/~federico\/blog\/my-gdk-pixbuf-braindump.html\">Federico's braindump<\/a> from last year.<\/p>\n\n\n\n<p>For the test, I used the gdk-pixbuf 2.38.1 packages in openSUSE Tumbleweed. With the scaling algorithm set to <code>GDK_INTERP_BILINEAR<\/code>, it provides decent quality at all sizes. I don't think that's strictly in line with how bilinear interpolation is supposed to work, but hey, I'm not complaining.<\/p>\n\n\n\n<p>It is, however, rather slow. In fact, at scaling factors of 0.5 and above, it's the slowest in this test. That's likely because it only supports unassociated alpha, which forces it to do extra work to prevent colors from bleeding disproportionately from pixels of varying transparency. To be fair, the alpha channel when loaded from a typical image file is usually unassociated, and if I'd added the overhead of premultiplying it to the other implementations, it would've bridged some or most of the performance difference.<\/p>\n\n\n\n<p>I suspect it's also the origin of the only correctness issue I could find; color values from completely transparent pixels will be replaced with black in the output. This makes sense because any value multiplied by a weight of zero, will be zero. It's mostly an issue if you plan to change the transparency later, as you might do in the realm of very serious image processing. And you won't be using GDK-Pixbuf in such a context, since <a href=\"http:\/\/www.gegl.org\/\">GEGL<\/a> exists (and is quite a bit less Spartan than its web pages suggest).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Pixman<\/h3>\n\n\n\n<p><a href=\"http:\/\/pixman.org\/\">Pixman<\/a> is the raster image manipulation library used in <a href=\"https:\/\/x.org\/\">X.Org<\/a> and <a href=\"https:\/\/www.cairographics.org\/\">Cairo<\/a>, and therefore indirectly by the entire GNOME desktop. It supports a broad range of pixel formats, transforms, composition and filters. It's otherwise quite minimal, and works with premultiplied alpha only.<\/p>\n\n\n\n<p>I used the pixman 0.36.0 packages in openSUSE Tumbleweed. Pixman subscribes to a stricter definition of bilerp, so I went with that for scaling factors 0.5 and above, and the box filter for smaller factors. Output quality is impeccable, but it has trouble with scaling factors lower than 1\/16384, and when scaling huge images it will sometimes leave a column of uniformly miscolored pixels at one extreme of the image. I'm chalking that up to limited precision.<\/p>\n\n\n\n<p>Anyhow, the corner cases are more than made up for by Pixman's absolutely brutal bilerp (proper) performance. Thanks to its <a href=\"https:\/\/gitlab.freedesktop.org\/pixman\/pixman\/blob\/master\/pixman\/pixman-sse2.c\">hand-optimized SIMD code<\/a>, it's the fastest single-threaded implementation in the 0.5x-1.0x range. However, the box filter does not appear to be likewise optimized, resulting in one of the worst performances at smaller scaling factors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">SDL_gfx<\/h3>\n\n\n\n<p><a href=\"https:\/\/www.libsdl.org\/\">The Simple Directmedia Layer<\/a> is a cross-platform hardware abstraction layer originating in the late 90s as a vehicle for games development. While <a href=\"https:\/\/en.wikipedia.org\/wiki\/Loki_Entertainment\" rel=\"nofollow\">Loki<\/a> famously used it to port a bunch of games to Linux, it's also been a boon to more recent independent games development (cf. titles like <a href=\"https:\/\/store.steampowered.com\/app\/234390\/Teleglitch_Die_More_Edition\/\" rel=\"nofollow\">Teleglitch<\/a>, <a href=\"http:\/\/twistedtreegames.com\/proteus\/\" rel=\"nofollow\">Proteus<\/a>, <a href=\"http:\/\/www.bay12games.com\/dwarves\/\" rel=\"nofollow\">Dwarf Fortress<\/a>). <a href=\"http:\/\/www.ferzkopp.net\/wordpress\/2016\/01\/02\/sdl_gfx-sdl2_gfx\/\">SDL_gfx<\/a> is one of its helper libraries. It has a dead simple API and is packaged for pretty much everything. And it's games stuff, so y'know, maybe it's fast?<\/p>\n\n\n\n<p>I tested libSDL_gfx 2.0.26 and libSDL2_gfx 1.0.4 from Tumbleweed. They perform the same: Not great. Below a scaling factor of 0.5x I had to use a combination of <code>zoomSurface()<\/code> and <code>shrinkSurface()<\/code> to get good quality. That implies two separate passes over the image data, which explains the poor performance at low output sizes. However, <code>zoomSurface()<\/code> alone is also disappointingly slow.<\/p>\n\n\n\n<p>I omitted SDL from the sample output above to save some space, but quality-wise it appears to be on par with GDK-Pixbuf and Pixman. There were no corner cases that I could find, but <code>zoomSurface()<\/code> seems to be unable to work with surfaces bigger than 16383 pixels in either dimension; it returns a <code>NULL<\/code> surface if you go above that.<\/p>\n\n\n\n<p>It's also worth noting that SDL's documentation and pixel format enums do not specify whether the alpha channel is supposed to be premultiplied or unassociated. The <a href=\"https:\/\/wiki.libsdl.org\/SDL_GetSurfaceBlendMode#Remarks\">alpha blending formulas<\/a> seem to imply unassociated, but <code>zoomSurface()<\/code> and <code>shrinkSurface()<\/code> displayed color bleeding with unassociated-alpha input in my tests.<br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Skia<\/h3>\n\n\n\n<p><a href=\"https:\/\/skia.org\/\" rel=\"nofollow\">Skia<\/a> is an influential image library written in C++; Mozilla Firefox, Android and Google Chrome all use it. It's built around a canvas, and supports drawing shapes and text with structured or raster output. It also supports operations directly on raster data &#8212; making it a close analogue to Cairo and Pixman combined.<\/p>\n\n\n\n<p>It's not available as a separate package for my otherwise excellent distro, so I built it from Git tag <a href=\"https:\/\/github.com\/google\/skia\/tree\/chrome\/m76\" rel=\"nofollow\">chrome\/m76<\/a> (~May 2019). It's very straightforward, but you need to build it with Clang (as per the instructions) to get the best possible performance. So that's what I did.<\/p>\n\n\n\n<p>I tested <code>SkPixmap.scalePixels()<\/code>, which takes a quality setting in lieu of the filter type. That's perfect for our purposes; between <code>kLow_SkFilterQuality<\/code>, <code>kMedium_SkFilterQuality<\/code> and <code>kHigh_SkFilterQuality<\/code>, medium is the one we want. The documentation describes it as roughly \"bilerp plus mip-maps\". The other settings are either too coarse (nearest-neighbor or bilerp only) or too slow (bicubic). The API supports both premultiplied and unassociated alpha. I used the former.<\/p>\n\n\n\n<p>So, about the apparent quality&#8230; In all honesty &#8212; it's poor, especially when the output is slightly smaller than 1\/2\u207f relative to the input, i.e. \u00bd*insize-1, \u00bc*insize-1, etc. <a href=\"https:\/\/github.com\/mono\/SkiaSharp\/issues\/520\" rel=\"nofollow\">I'm not the first to make this observation<\/a>. Apart from that, there seems to be a precision issue when working with images (input or output) bigger than 16383 pixels in either dimension. E.g. the color <code>#54555657<\/code> becomes <code>#54545454<\/code>, <code>#60616263<\/code> becomes <code>#60606060<\/code> and so on.<\/p>\n\n\n\n<p>At least it's not slow. Performance is fairly respectable across the board, and it's one of the fastest solutions below 0.5x.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Smolscale<\/h3>\n\n\n\n<p><a href=\"https:\/\/github.com\/hpjansson\/smolscale\" rel=\"nofollow\">Smolscale<\/a> is a <a href=\"https:\/\/www.urbandictionary.com\/define.php?term=Smol\" rel=\"nofollow\">smol<\/a> piece of C code that does image scaling, channel reordering and (un)premultiplication. It's this post's mystery contestant, and you've never heard of it before because up until now it's been living exclusively on my local hard drive.<\/p>\n\n\n\n<p>I wrote it specifically to meet the requirements I laid out before: Fast, middling quality, no artifacts, handles input\/output sizes up to 65535&#215;65535. Smolscale MT is the same implementation, just driven from multiple threads using its row-batch interface.<\/p>\n\n\n\n<p>As I mentioned above, when running in 8 threads it's able to process a 16383&#215;16383-pixel image to a much smaller image in roughly 50ms. Since it samples every single pixel, that corresponds to about 5.3 gigapixels per second, or ~21 gigabytes per second of input data. At that point it's close to maxing out my old DDR3-1600 memory (its theoretical transfer rate is 12.8GB\/s, times two for dual channel ~= 26GB\/s).<\/p>\n\n\n\n<p>I'm going to write about it in detail at some point, but I'll save that for another post. In the meantime, I put up a <a href=\"https:\/\/github.com\/hpjansson\/smolscale\" rel=\"nofollow\">Github dump<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Bonus content!<\/h2>\n\n\n\n<p>I found a 2012-issue Raspberry Pi gathering dust in a drawer. Why not run the benchmarks on that too?<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-armv6l-3-2000-2000-0.001-1.5-107-elapsed-size.png\" alt=\"Image scaling performance plot (ARMv6)\" class=\"wp-image-443\" srcset=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-armv6l-3-2000-2000-0.001-1.5-107-elapsed-size.png 800w, https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-armv6l-3-2000-2000-0.001-1.5-107-elapsed-size-300x225.png 300w, https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-armv6l-3-2000-2000-0.001-1.5-107-elapsed-size-768x576.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure><\/div>\n\n\n<p>I dropped Skia from this run due to build issues that looked like they'd be fairly time consuming to overcome. Smolscale suffers because it's written for 64-bit registers and multiple cores, and this is an ARMv6 platform with 32-bit registers and a single core. Pixman is still brutally efficient; it has <a href=\"https:\/\/gitlab.freedesktop.org\/pixman\/pixman\/blob\/master\/pixman\/pixman-inlines.h\">macro templates for either register size<\/a>. Sweet!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I've been on a quest for better bilerps lately. \"Bilerp\" is, of course, a contraction of \"bilinear interpolation\", and it's how you scale pictures when you're in a hurry. The GNOME Image Viewer (n\u00e9e Eye of GNOME) and ImageMagick have &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,3,6],"tags":[15,17,14,16],"class_list":["post-410","post","type-post","status-publish","format-standard","hentry","category-computing","category-gnome","category-technical","tag-benchmarks","tag-graphics","tag-image-scaling","tag-performance"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Battle of the Bilerps: Image Scaling on the CPU - Et tu, Cthulhu<\/title>\n<meta name=\"description\" content=\"Benchmarks and analysis of smooth image scaling implementations used in the F\/OSS libraries GDK-Pixbuf, Pixman, SDL, Skia and Smolscale.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Battle of the Bilerps: Image Scaling on the CPU - Et tu, Cthulhu\" \/>\n<meta property=\"og:description\" content=\"Benchmarks and analysis of smooth image scaling implementations used in the F\/OSS libraries GDK-Pixbuf, Pixman, SDL, Skia and Smolscale.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/\" \/>\n<meta property=\"og:site_name\" content=\"Et tu, Cthulhu\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-08T13:50:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-04T06:26:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png\" \/>\n<meta name=\"author\" content=\"Hans Petter Jansson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hpj\" \/>\n<meta name=\"twitter:site\" content=\"@hpj\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hans Petter Jansson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/\"},\"author\":{\"name\":\"Hans Petter Jansson\",\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c\"},\"headline\":\"Battle of the Bilerps: Image Scaling on the CPU\",\"datePublished\":\"2019-07-08T13:50:33+00:00\",\"dateModified\":\"2023-02-04T06:26:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/\"},\"wordCount\":1582,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c\"},\"image\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png\",\"keywords\":[\"benchmarks\",\"graphics\",\"image scaling\",\"performance\"],\"articleSection\":[\"Computing\",\"GNOME\",\"Technical\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/\",\"url\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/\",\"name\":\"Battle of the Bilerps: Image Scaling on the CPU - Et tu, Cthulhu\",\"isPartOf\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png\",\"datePublished\":\"2019-07-08T13:50:33+00:00\",\"dateModified\":\"2023-02-04T06:26:39+00:00\",\"description\":\"Benchmarks and analysis of smooth image scaling implementations used in the F\/OSS libraries GDK-Pixbuf, Pixman, SDL, Skia and Smolscale.\",\"breadcrumb\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#primaryimage\",\"url\":\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png\",\"contentUrl\":\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png\",\"width\":800,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hpjansson.org\/blag\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Battle of the Bilerps: Image Scaling on the CPU\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hpjansson.org\/blag\/#website\",\"url\":\"https:\/\/hpjansson.org\/blag\/\",\"name\":\"Et tu, Cthulhu\",\"description\":\"Personal blag of Hans Petter Jansson: Fun with computers edition\",\"publisher\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hpjansson.org\/blag\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c\",\"name\":\"Hans Petter Jansson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/33402e5005b34e5ee4ba4f9fd0c5d754f4505d5fb455736e5c585676cb7f2075?s=96&d=retro&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/33402e5005b34e5ee4ba4f9fd0c5d754f4505d5fb455736e5c585676cb7f2075?s=96&d=retro&r=g\",\"caption\":\"Hans Petter Jansson\"},\"logo\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/hpjansson.org\/\",\"https:\/\/x.com\/hpj\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Battle of the Bilerps: Image Scaling on the CPU - Et tu, Cthulhu","description":"Benchmarks and analysis of smooth image scaling implementations used in the F\/OSS libraries GDK-Pixbuf, Pixman, SDL, Skia and Smolscale.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/","og_locale":"en_US","og_type":"article","og_title":"Battle of the Bilerps: Image Scaling on the CPU - Et tu, Cthulhu","og_description":"Benchmarks and analysis of smooth image scaling implementations used in the F\/OSS libraries GDK-Pixbuf, Pixman, SDL, Skia and Smolscale.","og_url":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/","og_site_name":"Et tu, Cthulhu","article_published_time":"2019-07-08T13:50:33+00:00","article_modified_time":"2023-02-04T06:26:39+00:00","og_image":[{"url":"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png","type":"","width":"","height":""}],"author":"Hans Petter Jansson","twitter_card":"summary_large_image","twitter_creator":"@hpj","twitter_site":"@hpj","twitter_misc":{"Written by":"Hans Petter Jansson","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#article","isPartOf":{"@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/"},"author":{"name":"Hans Petter Jansson","@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c"},"headline":"Battle of the Bilerps: Image Scaling on the CPU","datePublished":"2019-07-08T13:50:33+00:00","dateModified":"2023-02-04T06:26:39+00:00","mainEntityOfPage":{"@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/"},"wordCount":1582,"commentCount":0,"publisher":{"@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c"},"image":{"@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#primaryimage"},"thumbnailUrl":"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png","keywords":["benchmarks","graphics","image scaling","performance"],"articleSection":["Computing","GNOME","Technical"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/","url":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/","name":"Battle of the Bilerps: Image Scaling on the CPU - Et tu, Cthulhu","isPartOf":{"@id":"https:\/\/hpjansson.org\/blag\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#primaryimage"},"image":{"@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#primaryimage"},"thumbnailUrl":"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png","datePublished":"2019-07-08T13:50:33+00:00","dateModified":"2023-02-04T06:26:39+00:00","description":"Benchmarks and analysis of smooth image scaling implementations used in the F\/OSS libraries GDK-Pixbuf, Pixman, SDL, Skia and Smolscale.","breadcrumb":{"@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#primaryimage","url":"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png","contentUrl":"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/07\/resize-50-2000-2000-0.001-1.5-500-elapsed-size.png","width":800,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/hpjansson.org\/blag\/2019\/07\/08\/image-scaling-on-the-cpu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hpjansson.org\/blag\/"},{"@type":"ListItem","position":2,"name":"Battle of the Bilerps: Image Scaling on the CPU"}]},{"@type":"WebSite","@id":"https:\/\/hpjansson.org\/blag\/#website","url":"https:\/\/hpjansson.org\/blag\/","name":"Et tu, Cthulhu","description":"Personal blag of Hans Petter Jansson: Fun with computers edition","publisher":{"@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hpjansson.org\/blag\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c","name":"Hans Petter Jansson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/33402e5005b34e5ee4ba4f9fd0c5d754f4505d5fb455736e5c585676cb7f2075?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/33402e5005b34e5ee4ba4f9fd0c5d754f4505d5fb455736e5c585676cb7f2075?s=96&d=retro&r=g","caption":"Hans Petter Jansson"},"logo":{"@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/hpjansson.org\/","https:\/\/x.com\/hpj"]}]}},"_links":{"self":[{"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/posts\/410","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/comments?post=410"}],"version-history":[{"count":35,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/posts\/410\/revisions"}],"predecessor-version":[{"id":1251,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/posts\/410\/revisions\/1251"}],"wp:attachment":[{"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/media?parent=410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/categories?post=410"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/tags?post=410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}