Skip to content

Commit ff74e39

Browse files
committed
up package and README
1 parent b81a940 commit ff74e39

3 files changed

Lines changed: 86 additions & 25 deletions

File tree

README.md

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22

33
Decode Portable PixMap images in .NET8.
44

5+
6+
7+
## PixMap Format
8+
9+
**Header**
10+
11+
```
12+
P<x>
13+
# comment
14+
<width> <height>
15+
<max>
16+
```
17+
18+
**Example**
19+
20+
```
21+
P6
22+
640 480
23+
65535
24+
```
25+
26+
**Kinds**
27+
528
| Magic Number | Type | Extension | Image Type | Encoding |
629
| ------------ | ---- | --------- | ---------- | -------- |
730
| P1 | PBM | .pbm | B/W | ASCII |
@@ -11,6 +34,8 @@ Decode Portable PixMap images in .NET8.
1134
| P5 | PGM | .pgm | Gray | Binary |
1235
| P6 | PPM | .ppm | RGB | Binary |
1336

37+
38+
1439
## Usage
1540

1641
```cs
@@ -21,29 +46,33 @@ IPpmImage ppmImage = await PpmImageReader.ReadAsync(@"C:\image.ppm");
2146
IImage rawImage = await RawImageReader.ReadAsync((@"C:\image.raw", 1920, 1080, 12, 0);
2247
```
2348

24-
## Benchmark [WIP]
2549

26-
> BenchmarkDotNet v0.13.12, Windows 11 (10.0.22621.3007/22H2/2022Update/SunValley2)
50+
51+
## Benchmark
52+
53+
> BenchmarkDotNet v0.13.12, Windows 11 (10.0.22621.3672/22H2/2022Update/SunValley2)
2754
> AMD Ryzen 7 PRO 4750GE with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
28-
> .NET SDK 8.0.200-preview.23624.5
29-
> [Host] : .NET 8.0.1 (8.0.123.58001), X64 RyuJIT AVX2 [AttachedDebugger]
30-
> DefaultJob : .NET 8.0.1 (8.0.123.58001), X64 RyuJIT AVX2
31-
32-
33-
| Method | Filename | Mean | Error | StdDev | Median | Gen0 | Gen1 | Gen2 | Allocated |
34-
| ---------- | -------------- | ----------: | ---------: | --------: | ----------: | -------: | -------: | -------: | --------: |
35-
| ReadHeader | P1-200x200.pbm | 78.65 us | 0.508 us | 0.475 us | 78.45 us | 4.0283 | - | - | 7.96 KB |
36-
| ReadImage | P1-200x200.pbm | 459.96 us | 9.005 us | 11.709 us | 455.43 us | 25.3906 | - | - | 51.87 KB |
37-
| ReadHeader | P2-300x200.pgm | 75.32 us | 0.255 us | 0.226 us | 75.34 us | 4.0283 | - | - | 7.94 KB |
38-
| ReadImage | P2-300x200.pgm | 1,138.71 us | 14.674 us | 13.726 us | 1,140.11 us | 35.1563 | - | - | 75.98 KB |
39-
| ReadHeader | P3-300x300.ppm | 78.10 us | 0.712 us | 0.594 us | 78.21 us | 4.0283 | - | - | 8.13 KB |
40-
| ReadImage | P3-300x300.ppm | 6,935.08 us | 104.674 us | 97.912 us | 6,985.39 us | 78.1250 | 78.1250 | 78.1250 | 321.88 KB |
41-
| ReadHeader | P4-305x400.pbm | 77.23 us | 1.494 us | 1.889 us | 76.07 us | 3.7842 | - | - | 7.62 KB |
42-
| ReadImage | P4-305x400.pbm | 216.83 us | 3.972 us | 3.521 us | 216.33 us | 38.0859 | 38.0859 | 38.0859 | 128.74 KB |
43-
| ReadHeader | P5-300x246.pgm | 78.56 us | 1.184 us | 1.108 us | 78.68 us | 3.7842 | - | - | 7.76 KB |
44-
| ReadImage | P5-300x246.pgm | 123.08 us | 2.279 us | 2.132 us | 122.29 us | 41.5039 | - | - | 82.11 KB |
45-
| ReadHeader | P6-640x426.ppm | 79.81 us | 0.578 us | 0.512 us | 79.80 us | 3.7842 | - | - | 7.76 KB |
46-
| ReadImage | P6-640x426.ppm | 537.06 us | 10.726 us | 17.624 us | 535.36 us | 249.0234 | 249.0234 | 249.0234 | 808.97 KB |
55+
> .NET SDK 8.0.300
56+
> [Host] : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2 [AttachedDebugger]
57+
> DefaultJob : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
58+
59+
60+
| Method | Filename | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated |
61+
| ---------- | -------------- | ----------: | --------: | --------: | -------: | -------: | -------: | --------: |
62+
| ReadHeader | P1-200x200.pbm | 69.76 us | 0.303 us | 0.283 us | 3.9063 | - | - | 7.46 KB |
63+
| ReadImage | P1-200x200.pbm | 345.65 us | 4.595 us | 4.073 us | 24.9023 | - | - | 47.38 KB |
64+
| ReadHeader | P2-300x200.pgm | 72.01 us | 1.324 us | 1.238 us | 3.9063 | - | - | 7.44 KB |
65+
| ReadImage | P2-300x200.pgm | 842.29 us | 4.745 us | 4.439 us | 34.1797 | - | - | 67.02 KB |
66+
| ReadHeader | P3-300x300.ppm | 69.91 us | 0.333 us | 0.295 us | 3.9063 | - | - | 7.63 KB |
67+
| ReadImage | P3-300x300.ppm | 5,275.37 us | 16.544 us | 15.475 us | 78.1250 | 78.1250 | 78.1250 | 272.26 KB |
68+
| ReadHeader | P4-305x400.pbm | 73.66 us | 0.300 us | 0.266 us | 3.6621 | - | - | 7.12 KB |
69+
| ReadImage | P4-305x400.pbm | 194.32 us | 1.287 us | 1.141 us | 38.3301 | 38.3301 | 38.3301 | 127.17 KB |
70+
| ReadHeader | P5-300x246.pgm | 69.91 us | 1.326 us | 1.419 us | 3.6621 | - | - | 7.26 KB |
71+
| ReadImage | P5-300x246.pgm | 101.39 us | 0.581 us | 0.543 us | 41.5039 | - | - | 80.3 KB |
72+
| ReadHeader | P6-640x426.ppm | 72.04 us | 0.450 us | 0.399 us | 3.6621 | - | - | 7.26 KB |
73+
| ReadImage | P6-640x426.ppm | 455.97 us | 3.875 us | 3.625 us | 249.5117 | 249.5117 | 249.5117 | 807.15 KB |
74+
75+
4776

4877
## References
4978

src/PpmDecoderSharp.Test/PpmDecoderSharp.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="FluentAssertions" Version="6.12.0" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
15-
<PackageReference Include="xunit" Version="2.6.6" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
15+
<PackageReference Include="xunit" Version="2.8.1" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
<PrivateAssets>all</PrivateAssets>
1919
</PackageReference>
20-
<PackageReference Include="coverlet.collector" Version="6.0.0">
20+
<PackageReference Include="coverlet.collector" Version="6.0.2">
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2222
<PrivateAssets>all</PrivateAssets>
2323
</PackageReference>

src/PpmDecoderSharp/PpmDecoderSharp.csproj

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,38 @@
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
8+
9+
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
10+
<FileVersion>0.1.0</FileVersion>
11+
<Version>0.1.0</Version>
12+
13+
<Authors>thinva</Authors>
14+
<Title>PpmDecoderSharp</Title>
15+
<Description>Decode PortablePixMap (ppm) images</Description>
16+
<PackageProjectUrl>https://github.com/hsytkm/PpmDecoderSharp</PackageProjectUrl>
17+
<RepositoryUrl>https://github.com/hsytkm/PpmDecoderSharp</RepositoryUrl>
18+
<NeutralLanguage>en-US</NeutralLanguage>
19+
<PackageTags>pbm/pgm/ppm</PackageTags>
20+
<Copyright>Copyright (c) 2024 thinva</Copyright>
21+
<RepositoryType>git</RepositoryType>
22+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
23+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
24+
<IncludeSymbols>true</IncludeSymbols>
25+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
26+
<!--<PackageLicenseExpression>MIT</PackageLicenseExpression>-->
27+
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
28+
<PackageReadmeFile>README.md</PackageReadmeFile>
829
</PropertyGroup>
930

31+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
32+
<DeterministicSourceRoot>/_/</DeterministicSourceRoot>
33+
<RepoRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\'))</RepoRoot>
34+
<PathMap>$(RepoRoot)=$(DeterministicSourceRoot)</PathMap>
35+
</PropertyGroup>
36+
37+
<ItemGroup>
38+
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="" />
39+
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
40+
</ItemGroup>
41+
1042
</Project>

0 commit comments

Comments
 (0)