{"id":28550665,"url":"https://github.com/dropbox/lopper","last_synced_at":"2026-03-04T05:31:36.861Z","repository":{"id":45676399,"uuid":"51470092","full_name":"dropbox/lopper","owner":"dropbox","description":"A lightweight C++ framework for vectorizing image-processing code","archived":false,"fork":false,"pushed_at":"2017-03-22T18:48:03.000Z","size":151,"stargazers_count":76,"open_issues_count":0,"forks_count":62,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-07-03T20:41:37.012Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dropbox.github.io/lopper/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dropbox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-10T20:32:49.000Z","updated_at":"2025-05-28T01:55:25.000Z","dependencies_parsed_at":"2022-07-20T21:18:28.399Z","dependency_job_id":null,"html_url":"https://github.com/dropbox/lopper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dropbox/lopper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dropbox%2Flopper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dropbox%2Flopper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dropbox%2Flopper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dropbox%2Flopper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dropbox","download_url":"https://codeload.github.com/dropbox/lopper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dropbox%2Flopper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30072501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T05:13:31.218Z","status":"ssl_error","status_checked_at":"2026-03-04T05:10:24.293Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-10T03:10:04.518Z","updated_at":"2026-03-04T05:31:36.831Z","avatar_url":"https://github.com/dropbox.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Lopper\n======\n[![Build status](https://travis-ci.org/dropbox/lopper.svg?branch=master)](https://travis-ci.org/dropbox/lopper)\n\nLopper is a lightweight C++ template meta-programming framework for making vectorizing image-processing code easy, synthesized during Dropbox's 2016 hack week. It was inspired by many (more general) predecessors like Eigen and Halide, but the core focus was in enabling precise control over inlining of primitive computation. It can target platforms that support SSE (4.2) or NEON instructions. Note that Lopper does some very naughty things, like placing variables on the stack without being explicit about it, so take care when using it.\n\nRequirements\n------------\n\nLopper consists only of C++ header files, so no pre-compilation is necessary. Simply include \"lopper/lopper.hpp\" and compile your code with C++11-standard-compliant compiler. You will need CMake to build the unit test.\n\nUsage\n-----\n\nThe code snippets below assume that `using namespace lopper` is in effect.\n\nImages can be wrapped into an expression as follows:\n```\nauto a = Expr\u003c1\u003e(image); // image must be a 1-channel image.\nauto rgb = ExprCache(Expr\u003c3\u003e(image)); // multi-channel images must first be wrapped by ExprCache.\nauto r = rgb.get\u003c0\u003e();\n```\n\nOne can combine expressions to form other expressions:\n```\nauto c = a + a * a;\nauto d = c + 3;\nauto e = c * d; // implicitly expand to (a + a * a) * ((a + a * a) + 3)\n...\n```\n\nIn general, every expression will be inlined during evaluation. In order to reuse values, use `ExprCache`; you must assign the resulting expression to a variable, owing to macro expansion that happens, and must first declare `ExprPrepareContext` as shown below, but it can be very powerful in controlling exactly what arithmetic happens in the evaluation.\n```\nExprPrepareContext();\nauto c = ExprCache(a + a * a);\nauto d = c + 3;\nauto e = c * d; // implicitly equivalent to c = a + a * a; e = c * (c + 3)\n...\n```\n\nTo trigger evaluation, use the `ExprEval` macro on an assignment operation if you haven't inlined anything:\n```\nauto a = Expr\u003c1\u003e(image1) + Expr\u003c1\u003e(image2);\nExprEval(Expr\u003c1\u003e(image3) = a * a);\n```\n\nOn the other hand, you must use `ExprEvalWithContext` macro otherwise:\n```\nExprPrepareContext();\nauto a = ExprCache(Expr\u003c1\u003e(image1) + Expr\u003c1\u003e(image2));\nExprEvalWithContext(Expr\u003c1\u003e(image3) = a * a);\n```\n\nLopper supports rudimentary index manipulation, without providing the full functional expansion (e.g. Halide). Any expression that's instantiated directly from a single-channel image can call `reindex` or `offset`.\n```\nExpr\u003c1\u003e(image1).offset(1, 0) - Expr\u003c1\u003e(image1); // expression for forward horizontal gradient\nExpr\u003c1\u003e(image1).reindex([](int y) { return image1.getHeight() - 1 - y; }); // expression for flipping the image vertically.\n```\n\nSee the unit tests for more examples.\n\nRequirements for Contributors\n-----------------------------\n\nIf you plan to contribute a patch, please read the Contributor License Agreement at https://opensource.dropbox.com/cla/.\n\nLicense\n-------\n\nUnless otherwise noted:\n\n```\nCopyright (c) 2016 Dropbox, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\nContributors\n------------\nLopper was initially written by Jongmin Baek (jongmin@dropbox.com) with plenty of help and advice from Leonard Fink (leonard@dropbox.com), Lailin Chen (lailin@dropbox.com) and Ying Xiong (yxiong@dropbox.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdropbox%2Flopper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdropbox%2Flopper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdropbox%2Flopper/lists"}