Permalink
Browse files

各種アップデート; Kaoruko はいったん削除

  • Loading branch information...
azyobuzin committed Oct 13, 2018
1 parent ed2c783 commit a1a90804ea369944746518bad3427b6ae673c486
Showing with 84 additions and 789 deletions.
  1. +5 −3 docker/toa/Dockerfile
  2. +33 −19 docker/wagahigh/Dockerfile
  3. +24 −106 src/Blockhash/Blockhash.cs
  4. +4 −4 src/Blockhash/Blockhash.csproj
  5. +1 −1 src/Blockhash/RestrictedBinaryHeap.cs
  6. +0 −3 src/Kaoruko/.bowerrc
  7. +0 −12 src/Kaoruko/Kaoruko.csproj
  8. +0 −110 src/Kaoruko/Pages/Index.cshtml
  9. +0 −17 src/Kaoruko/Pages/Index.cshtml.cs
  10. +0 −71 src/Kaoruko/Pages/_Layout.cshtml
  11. +0 −18 src/Kaoruko/Pages/_ValidationScriptsPartial.cshtml
  12. +0 −2 src/Kaoruko/Pages/_ViewImports.cshtml
  13. +0 −3 src/Kaoruko/Pages/_ViewStart.cshtml
  14. +0 −26 src/Kaoruko/Program.cs
  15. +0 −47 src/Kaoruko/Startup.cs
  16. +0 −10 src/Kaoruko/appsettings.Development.json
  17. +0 −8 src/Kaoruko/appsettings.json
  18. +0 −10 src/Kaoruko/bower.json
  19. +0 −24 src/Kaoruko/bundleconfig.json
  20. +0 −35 src/Kaoruko/wwwroot/css/site.css
  21. +0 −1 src/Kaoruko/wwwroot/css/site.min.css
  22. BIN src/Kaoruko/wwwroot/favicon.ico
  23. +0 −1 src/Kaoruko/wwwroot/images/banner1.svg
  24. +0 −1 src/Kaoruko/wwwroot/images/banner2.svg
  25. +0 −1 src/Kaoruko/wwwroot/images/banner3.svg
  26. +0 −1 src/Kaoruko/wwwroot/images/banner4.svg
  27. +0 −1 src/Kaoruko/wwwroot/js/site.js
  28. 0 src/Kaoruko/wwwroot/js/site.min.js
  29. +1 −1 src/Mihiro/App.config
  30. +5 −23 src/Mihiro/Mihiro.csproj
  31. +0 −63 src/Mihiro/Properties/Resources.Designer.cs
  32. +0 −117 src/Mihiro/Properties/Resources.resx
  33. +0 −26 src/Mihiro/Properties/Settings.Designer.cs
  34. +0 −7 src/Mihiro/Properties/Settings.settings
  35. +5 −5 src/Toa.Core/Toa.Core.csproj
  36. +1 −1 src/Toa.Core/WagahighOperator.cs
  37. +1 −1 src/Toa.Grpc/Toa.Grpc.csproj
  38. +1 −1 src/Toa.Standalone/Toa.Standalone.csproj
  39. +2 −2 src/ToaX11Playground/ToaX11Playground.csproj
  40. +1 −7 src/WagahighChoices.sln
@@ -1,10 +1,12 @@
FROM wagahigh

USER root
RUN wget -O - https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-zesty-prod zesty main" > /etc/apt/sources.list.d/dotnetdev.list' && \

RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
rm packages-microsoft-prod.deb && \
apt-get update -y && \
apt-get install -y dotnet-runtime-2.0.0 && \
apt-get install -y dotnet-runtime-2.1 && \
rm -rf /var/lib/apt/lists/*

USER wagahigh
@@ -1,23 +1,43 @@
FROM ubuntu:17.04
FROM ubuntu:18.04

RUN useradd -m wagahigh

# なぜか ADD --chown が効かない……
ADD wagahigh.tar.xz /home/wagahigh/.wine/drive_c/wagahigh/
RUN chown -R wagahigh:wagahigh /home/wagahigh

# apt-get update がクソ遅いので日本サーバーに変更
RUN sed -i 's|//archive\.ubuntu\.com|//jp\.archive\.ubuntu\.com|g' /etc/apt/sources.list
RUN sed -i 's|//archive\.ubuntu\.com|//jp\.archive\.ubuntu\.com|g' /etc/apt/sources.list && \
sed -i 's/^deb-src/# deb-src/g' /etc/apt/sources.list

# 必要なパッケージのインストール
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \
apt-get install -y --no-install-recommends wget apt-transport-https software-properties-common gpg-agent

# Wine のインストール
RUN dpkg --add-architecture i386 && \
apt-get update -y && \
apt-get install -y wget apt-transport-https software-properties-common && \
wget -O - https://dl.winehq.org/wine-builds/Release.key | apt-key add - && \
wget -qO - https://dl.winehq.org/wine-builds/Release.key | apt-key add - && \
apt-add-repository -y https://dl.winehq.org/wine-builds/ubuntu/ && \
apt-get update -y && \
apt-get install -y locales make winehq-devel xvfb x11vnc xdotool ffmpeg && \
rm -rf /var/lib/apt/lists/*
apt-get install -y winehq-devel

# 日本的に
RUN apt-get install -y locales tzdata && \
locale-gen ja_JP.UTF-8 && \
echo 'Asia/Tokyo' > /etc/timezone && \
rm /etc/localtime && \
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
dpkg-reconfigure tzdata

# ツールのインストール
RUN apt-get install -y --no-install-recommends xvfb x11vnc xdotool

RUN locale-gen ja_JP.UTF-8
# パッケージリポジトリの winetricks は古いので直接ダウンロード
RUN apt-get install -y make && \
wget -qO - https://github.com/Winetricks/winetricks/archive/20180815.tar.gz | tar -xzf - && \
make -C winetricks-20180815 install && \
rm -rf winetricks-20180815 && \
apt-mark auto make && apt-get autoremove -y

# 各種環境変数
# WINEDLLOVERRIDES: Wine の初回起動時に Mono と Gecko を入れろダイアログを表示させない
@@ -27,18 +47,12 @@ ENV LANG="ja_JP.UTF-8" \
WINEDLLOVERRIDES="mscoree=d;mshtml=d" \
W_OPT_UNATTENDED=1

# パッケージリポジトリの winetricks は古いので直接ダウンロード
RUN wget -O - https://github.com/Winetricks/winetricks/archive/20171018.tar.gz | tar -xzf - && \
make -C winetricks-20171018 install && \
rm -rf winetricks-20171018

WORKDIR /home/wagahigh

# Wine は通常ユーザーで実行する
RUN su -c 'winetricks wenquanyi' wagahigh

COPY run_wagahigh.sh /
RUN chmod a+rx /run_wagahigh.sh

WORKDIR /home/wagahigh
USER wagahigh

RUN winetricks wenquanyi

CMD /run_wagahigh.sh
@@ -135,7 +135,6 @@ private static void ComputeHashQuick<TImage>(TImage image, int bits, Span<byte>

// note: 公式 C 実装では 256
var h = 255 * 3 * (ulong)blockWidth * (ulong)blockHeight / 2;
var canCreateResultParallel = groupSize % 8 == 0;

Parallel.For(0, 4, groupIndex =>
{
@@ -163,63 +162,23 @@ private static void ComputeHashQuick<TImage>(TImage image, int bits, Span<byte>
? (heap.GetHead() + heap.GetSecond()) / 2
: heap.GetHead();

if (!canCreateResultParallel)
{
blocks[blocksLength + groupIndex] = med;
return;
}

// 8 で割り切れるのでうまいことやっていく
if (med > h)
{
for (blockIndex = blockStart; blockIndex < blockEnd; blockIndex += 8)
{
uint b = 0;
if (blocks[blockIndex] >= med) b |= 1 << 7;
if (blocks[blockIndex + 1] >= med) b |= 1 << 6;
if (blocks[blockIndex + 2] >= med) b |= 1 << 5;
if (blocks[blockIndex + 3] >= med) b |= 1 << 4;
if (blocks[blockIndex + 4] >= med) b |= 1 << 3;
if (blocks[blockIndex + 5] >= med) b |= 1 << 2;
if (blocks[blockIndex + 6] >= med) b |= 1 << 1;
if (blocks[blockIndex + 7] >= med) b |= 1;
dest[blockIndex / 8] = (byte)b;
}
}
else
{
for (blockIndex = blockStart; blockIndex < blockEnd; blockIndex += 8)
{
uint b = 0;
if (blocks[blockIndex] > med) b |= 1 << 7;
if (blocks[blockIndex + 1] > med) b |= 1 << 6;
if (blocks[blockIndex + 2] > med) b |= 1 << 5;
if (blocks[blockIndex + 3] > med) b |= 1 << 4;
if (blocks[blockIndex + 4] > med) b |= 1 << 3;
if (blocks[blockIndex + 5] > med) b |= 1 << 2;
if (blocks[blockIndex + 6] > med) b |= 1 << 1;
if (blocks[blockIndex + 7] > med) b |= 1;
dest[blockIndex / 8] = (byte)b;
}
}
// 結果を余剰スペースに保存
blocks[blocksLength + groupIndex] = med;
});

if (!canCreateResultParallel)
for (var groupIndex = 0; groupIndex < 4; groupIndex++)
{
for (var groupIndex = 0; groupIndex < 4; groupIndex++)
{
var med = blocks[blocksLength + groupIndex];
var isMedLarger = med > h;
var med = blocks[blocksLength + groupIndex];
var isMedLarger = med > h;

var blockIndex = groupIndex * groupSize;
var blockEnd = blockIndex + groupSize;
var blockIndex = groupIndex * groupSize;
var blockEnd = blockIndex + groupSize;

for (; blockIndex < blockEnd; blockIndex++)
{
var block = blocks[blockIndex];
if (block > med || (isMedLarger && block == med))
dest[blockIndex / 8] |= (byte)(1 << (7 - blockIndex % 8));
}
for (; blockIndex < blockEnd; blockIndex++)
{
var block = blocks[blockIndex];
if (block > med || (isMedLarger && block == med))
dest[blockIndex / 8] |= (byte)(1 << (7 - blockIndex % 8));
}
}
}
@@ -290,7 +249,6 @@ private static void ComputeHashSlow<TImage>(TImage image, int bits, Span<byte> d

// note: 公式 C 実装では 256
var h = 255 * 3 * blockWidth * blockHeight / 2;
var canCreateResultParallel = groupSize % 8 == 0;

Parallel.For(0, 4, groupIndex =>
{
@@ -318,63 +276,23 @@ private static void ComputeHashSlow<TImage>(TImage image, int bits, Span<byte> d
? (heap.GetHead() + heap.GetSecond()) / 2
: heap.GetHead();

if (!canCreateResultParallel)
{
blocks[blocksLength + groupIndex] = med;
return;
}

// 8 で割り切れるのでうまいことやっていく
if (med > h)
{
for (blockIndex = blockStart; blockIndex < blockEnd; blockIndex += 8)
{
uint b = 0;
if (blocks[blockIndex] >= med) b |= 1 << 7;
if (blocks[blockIndex + 1] >= med) b |= 1 << 6;
if (blocks[blockIndex + 2] >= med) b |= 1 << 5;
if (blocks[blockIndex + 3] >= med) b |= 1 << 4;
if (blocks[blockIndex + 4] >= med) b |= 1 << 3;
if (blocks[blockIndex + 5] >= med) b |= 1 << 2;
if (blocks[blockIndex + 6] >= med) b |= 1 << 1;
if (blocks[blockIndex + 7] >= med) b |= 1;
dest[blockIndex / 8] = (byte)b;
}
}
else
{
for (blockIndex = blockStart; blockIndex < blockEnd; blockIndex += 8)
{
uint b = 0;
if (blocks[blockIndex] > med) b |= 1 << 7;
if (blocks[blockIndex + 1] > med) b |= 1 << 6;
if (blocks[blockIndex + 2] > med) b |= 1 << 5;
if (blocks[blockIndex + 3] > med) b |= 1 << 4;
if (blocks[blockIndex + 4] > med) b |= 1 << 3;
if (blocks[blockIndex + 5] > med) b |= 1 << 2;
if (blocks[blockIndex + 6] > med) b |= 1 << 1;
if (blocks[blockIndex + 7] > med) b |= 1;
dest[blockIndex / 8] = (byte)b;
}
}
// 結果を余剰スペースに保存
blocks[blocksLength + groupIndex] = med;
});

if (!canCreateResultParallel)
for (var groupIndex = 0; groupIndex < 4; groupIndex++)
{
for (var groupIndex = 0; groupIndex < 4; groupIndex++)
{
var med = blocks[blocksLength + groupIndex];
var isMedLarger = med > h;
var med = blocks[blocksLength + groupIndex];
var isMedLarger = med > h;

var blockIndex = groupIndex * groupSize;
var blockEnd = blockIndex + groupSize;
var blockIndex = groupIndex * groupSize;
var blockEnd = blockIndex + groupSize;

for (; blockIndex < blockEnd; blockIndex++)
{
var block = blocks[blockIndex];
if (block > med || (isMedLarger && Math.Abs(block - med) < 1.0))
dest[blockIndex / 8] |= (byte)(1 << (7 - blockIndex % 8));
}
for (; blockIndex < blockEnd; blockIndex++)
{
var block = blocks[blockIndex];
if (block > med || (isMedLarger && Math.Abs(block - med) < 1.0))
dest[blockIndex / 8] |= (byte)(1 << (7 - blockIndex % 8));
}
}
}
@@ -8,10 +8,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Buffers" Version="4.4.0" />
<PackageReference Include="System.Memory" Version="4.4.0-preview2-25405-01" />
<PackageReference Include="System.Numerics.Vectors" Version="4.4.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" />
<PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Memory" Version="4.5.1" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
</ItemGroup>

</Project>
@@ -6,7 +6,7 @@ namespace WagahighChoices
partial class Blockhash
{
[StructLayout(LayoutKind.Auto)]
internal struct RestrictedBinaryHeap<T> where T : IComparable<T>
internal ref struct RestrictedBinaryHeap<T> where T : IComparable<T>
{
private Span<T> _array;
private int _count;

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit a1a9080

Please sign in to comment.