{"id":31579012,"url":"https://github.com/winscripter/vlcgenerator","last_synced_at":"2025-10-05T20:45:05.330Z","repository":{"id":317997253,"uuid":"1069647503","full_name":"winscripter/VLCGenerator","owner":"winscripter","description":"Generate serializers for Variable Length Code Tables in C#","archived":false,"fork":false,"pushed_at":"2025-10-04T12:10:21.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-04T12:28:15.370Z","etag":null,"topics":["codedom","codegen","csharp","generator","productivity","scaffolding","source-generator","variable-length-code","vlc"],"latest_commit_sha":null,"homepage":"https://nuget.org/packages/vlcgen","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/winscripter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-04T10:50:35.000Z","updated_at":"2025-10-04T12:19:55.000Z","dependencies_parsed_at":"2025-10-04T12:28:19.898Z","dependency_job_id":"339d96f6-6ae8-40f1-accd-b572b06ba1f7","html_url":"https://github.com/winscripter/VLCGenerator","commit_stats":null,"previous_names":["winscripter/vlcgenerator"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/winscripter/VLCGenerator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winscripter%2FVLCGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winscripter%2FVLCGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winscripter%2FVLCGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winscripter%2FVLCGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winscripter","download_url":"https://codeload.github.com/winscripter/VLCGenerator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winscripter%2FVLCGenerator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278517813,"owners_count":26000173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["codedom","codegen","csharp","generator","productivity","scaffolding","source-generator","variable-length-code","vlc"],"created_at":"2025-10-05T20:45:02.733Z","updated_at":"2025-10-05T20:45:05.325Z","avatar_url":"https://github.com/winscripter.png","language":"C#","readme":"﻿# VLCGenerator: Generate Variable Length Code Table I/O in C#\nThis is a tool that takes a Domain-Specific Language representing a number\nto Variable Length Code (VLC) table and produces C# code to read/write those\nVLCs at bit level. It is highly customizable, and best of all - produces C# code\nthat's **incredibly fast and optimized**, with zero allocations.\n\nFor example, with this razor-like syntax:\n```\n@namespace MyCompany.MyProduct.VlcSerializers\n@class SampleVlcSerializer\n@visibility public\n@readerType BitReader\n@readBitMethod Read\n@writerType BitWriter\n@writeBitMethod Write\n\n0 0\n1 10\n2 110\n3 11110\n4 11100\n5 11101\n6 11111\n```\nIt will now generate for you C# code that represents a class SampleVlcSerializer in\nnamespace `MyCompany.MyProduct.VlcSerializers`. Inside, there are two static methods:\n- Decode(BitReader reader) -\u003e long\n- Encode(BitWriter, long) -\u003e void\n\nIf you invoke Decode and the next, say, 5 bits of the input BitReader (or any other input type specified in the `@readerType` option) are equal to, say, `11100`,\nthis method will consume those 5 bits and return the number 4.\n\nIf you invoke Encode with your BitWriter (or any other input type specified in the `@writerType` option) and a number 5, this method will encode the bits `11101` accordingly.\n\nYou can configure everything. Namespace, class name, class visibility,\nthe type in place of BitReader and BitWriter, and even the method to invoke\nto read/write bits in the type in place of BitReader and BitWriter.\n\n# Syntax for vlcdef files\nThe syntax is very simple. It is Razor-like syntax.\n\nFiles with this syntax should be saved under the `.vlcdef` extension.\n\n## Code definitions\nThose define the VLC. Prior to the first whitespace is the value of the VLC, and anything afterwards are the bits to encode it. Example:\n```\n1 101\n2 110\n3 011\n4 001\n5 010\n```\nBits required to encode the VLC can also have spaces in them too. They're optional, but can be used to, for instance, separate bits for readability.\n\n```\n1 1011 0100\n2 0101 1000\n3 1001 0011\n```\nThose are equivalent to:\n```\n1 10110100\n2 01011000\n3 10010011\n```\n\n## Options\nThese let you configure the generated code output.\n\nThey start with the '@' character.\n\n`@namespace` lets you configure the namespace where the generated VLC serializer class will be put in the generated code.\n```\n@namespace MyCompany.MyProduct.VlcSerializers\n```\n\n`@class` lets you configure the name of the VLC serializer class.\n```\n@class MyVlcSerializer\n```\n\n`@visibility` lets you configure the access modifier of the VLC serializer class (`MyVlcSerializer`). Defaults to `internal`, but can be changed to be `public`.\n```\n@visibility public\n```\n\n`@readerType` specifies the type of the first parameter that the `Decode` method in the `MyVlcSerializer` class takes. For example, with this:\n```\n@readerType MyCompany.Utilities.BitStream\n```\nthe `Decode` method will look like:\n```cs\npublic static long Decode(MyCompany.Utilities.BitStream reader)\n```\n\nSimilarly, `readBitMethod` specifies the name of the method to invoke inside the `reader` parameter in order to read a single bit.\n\nThe `writerType` and `writeBitMethod` is same as `readerType` and `readBitMethod`, but specific to the `Encode` method and, writing instead of reading.\n\n# Usage\nInstall the `vlcgen` tool from NuGet globally\n```\ndotnet tool install --global vlcgen\n```\nNow, provide your VLCDEF file with the aforementioned syntax. Let's name it `MySerializers.vlcdef`. And let's\nsay we want the output C# file to be `MySerializers.g.cs`. Run this command to generate:\n```\nvlcgen MySerializers.vlcdef MySerializers.g.cs\n```\nAnd that's it! Just drag and drop `MySerializers.g.cs` into your project and you're good to go.\n\n# Use cases\nThis generator should be a lifesaver when working on implementing decoders and encoders of specific\nfile formats and video codecs in C#. Examples:\n- 🔉 MP3 and AAC include VLCs for Huffman coding\n- 🔉 Dolby AC-3/E-AC-3 use VLCs in Exponent and Mantissa coding\n- 🖼️ JPEG uses Huffman coding which includes VLCs\n- 📽️ ITU-T H.262 includes many VLCs for macro-block types\n- 📽️ ITU-T H.264's CABAC and CAVLC include VLCs for mb_type and coeff_token, respectively\n\n\u003chr /\u003e\n\n# License\nMIT License\n\nCopyright (c) 2023-2025, winscripter\n\nSee LICENSE.txt for license details.\n\n\u003chr /\u003e\n\nMade with .NET 8 and Visual Studio 2026.\n\nMade by winscripter.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinscripter%2Fvlcgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinscripter%2Fvlcgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinscripter%2Fvlcgenerator/lists"}