Video Filters: xBRZ, HQX, Scale2x, 2xSai, Super2xSai, SuperEagle support
This commit is contained in:
parent
a5518ec5d5
commit
7e3def34f5
35 changed files with 16503 additions and 108 deletions
|
@ -534,6 +534,7 @@
|
|||
<ClInclude Include="VrcIrq.h" />
|
||||
<ClInclude Include="VsControlManager.h" />
|
||||
<ClInclude Include="VsSystem.h" />
|
||||
<ClInclude Include="ScaleFilter.h" />
|
||||
<ClInclude Include="Zapper.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -592,6 +593,7 @@
|
|||
<ClCompile Include="VideoDecoder.cpp" />
|
||||
<ClCompile Include="BaseVideoFilter.cpp" />
|
||||
<ClCompile Include="VsControlManager.cpp" />
|
||||
<ClCompile Include="ScaleFilter.cpp" />
|
||||
<ClCompile Include="Zapper.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -587,6 +587,9 @@
|
|||
<ClInclude Include="Mapper60.h">
|
||||
<Filter>Nes\Mappers\Unnamed</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ScaleFilter.h">
|
||||
<Filter>VideoDecoder</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -730,5 +733,8 @@
|
|||
<ClCompile Include="BaseMapper.cpp">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ScaleFilter.cpp">
|
||||
<Filter>VideoDecoder</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
class DefaultVideoFilter : public BaseVideoFilter
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
uint32_t ProcessIntensifyBits(uint16_t ppuPixel);
|
||||
|
||||
public:
|
||||
|
|
|
@ -56,6 +56,20 @@ enum class VideoFilterType
|
|||
{
|
||||
None = 0,
|
||||
NTSC = 1,
|
||||
xBRZ2x = 2,
|
||||
xBRZ3x = 3,
|
||||
xBRZ4x = 4,
|
||||
xBRZ5x = 5,
|
||||
xBRZ6x = 6,
|
||||
HQ2x = 7,
|
||||
HQ3x = 8,
|
||||
HQ4x = 9,
|
||||
Scale2x = 10,
|
||||
Scale3x = 11,
|
||||
Scale4x = 12,
|
||||
_2xSai = 13,
|
||||
Super2xSai = 14,
|
||||
SuperEagle = 15,
|
||||
HdPack = 999
|
||||
};
|
||||
|
||||
|
|
63
Core/ScaleFilter.cpp
Normal file
63
Core/ScaleFilter.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include "stdafx.h"
|
||||
#include "PPU.h"
|
||||
#include "ScaleFilter.h"
|
||||
#include "../Utilities/xBRZ/xbrz.h"
|
||||
#include "../Utilities/HQX/hqx.h"
|
||||
#include "../Utilities/Scale2x/scalebit.h"
|
||||
#include "../Utilities/KreedSaiEagle/SaiEagle.h"
|
||||
|
||||
ScaleFilter::ScaleFilter(ScaleFilterType scaleFilterType, uint32_t scale)
|
||||
{
|
||||
_scaleFilterType = scaleFilterType;
|
||||
_filterScale = scale;
|
||||
_decodedPpuBuffer = new uint32_t[PPU::PixelCount];
|
||||
|
||||
if(_scaleFilterType == ScaleFilterType::HQX) {
|
||||
hqxInit();
|
||||
}
|
||||
}
|
||||
|
||||
ScaleFilter::~ScaleFilter()
|
||||
{
|
||||
delete[] _decodedPpuBuffer;
|
||||
}
|
||||
|
||||
FrameInfo ScaleFilter::GetFrameInfo()
|
||||
{
|
||||
OverscanDimensions overscan = GetOverscan();
|
||||
return{ overscan.GetScreenWidth()*_filterScale, overscan.GetScreenHeight()*_filterScale, 4 };
|
||||
}
|
||||
|
||||
void ScaleFilter::ApplyFilter(uint16_t *ppuOutputBuffer)
|
||||
{
|
||||
OverscanDimensions overscan = EmulationSettings::GetOverscanDimensions();
|
||||
|
||||
uint32_t* outputBuffer = _decodedPpuBuffer;
|
||||
for(uint32_t i = overscan.Top, iMax = 240 - overscan.Bottom; i < iMax; i++) {
|
||||
for(uint32_t j = overscan.Left, jMax = 256 - overscan.Right; j < jMax; j++) {
|
||||
*outputBuffer = ProcessIntensifyBits(ppuOutputBuffer[i * 256 + j]);
|
||||
outputBuffer++;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t height = overscan.GetScreenHeight();
|
||||
uint32_t width = overscan.GetScreenWidth();
|
||||
|
||||
if(_scaleFilterType == ScaleFilterType::xBRZ) {
|
||||
xbrz::scale(_filterScale, _decodedPpuBuffer, (uint32_t*)GetOutputBuffer(), width, height, xbrz::ColorFormat::ARGB);
|
||||
} else if(_scaleFilterType == ScaleFilterType::HQX) {
|
||||
switch(_filterScale) {
|
||||
case 2: hq2x_32(_decodedPpuBuffer, (uint32_t*)GetOutputBuffer(), width, height); break;
|
||||
case 3: hq3x_32(_decodedPpuBuffer, (uint32_t*)GetOutputBuffer(), width, height); break;
|
||||
case 4: hq4x_32(_decodedPpuBuffer, (uint32_t*)GetOutputBuffer(), width, height); break;
|
||||
}
|
||||
} else if(_scaleFilterType == ScaleFilterType::Scale2x) {
|
||||
scale(_filterScale, GetOutputBuffer(), width*sizeof(uint32_t)*_filterScale, _decodedPpuBuffer, width*sizeof(uint32_t), 4, width, height);
|
||||
} else if(_scaleFilterType == ScaleFilterType::_2xSai) {
|
||||
twoxsai_generic_xrgb8888(width, height, _decodedPpuBuffer, width, (uint32_t*)GetOutputBuffer(), width * _filterScale);
|
||||
} else if(_scaleFilterType == ScaleFilterType::Super2xSai) {
|
||||
supertwoxsai_generic_xrgb8888(width, height, _decodedPpuBuffer, width, (uint32_t*)GetOutputBuffer(), width * _filterScale);
|
||||
} else if(_scaleFilterType == ScaleFilterType::SuperEagle) {
|
||||
supereagle_generic_xrgb8888(width, height, _decodedPpuBuffer, width, (uint32_t*)GetOutputBuffer(), width * _filterScale);
|
||||
}
|
||||
}
|
29
Core/ScaleFilter.h
Normal file
29
Core/ScaleFilter.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "DefaultVideoFilter.h"
|
||||
|
||||
enum class ScaleFilterType
|
||||
{
|
||||
xBRZ,
|
||||
HQX,
|
||||
Scale2x,
|
||||
_2xSai,
|
||||
Super2xSai,
|
||||
SuperEagle,
|
||||
};
|
||||
|
||||
class ScaleFilter : public DefaultVideoFilter
|
||||
{
|
||||
private:
|
||||
uint32_t *_decodedPpuBuffer;
|
||||
uint32_t _filterScale;
|
||||
ScaleFilterType _scaleFilterType;
|
||||
|
||||
public:
|
||||
ScaleFilter(ScaleFilterType scaleFilterType, uint32_t scale);
|
||||
virtual ~ScaleFilter();
|
||||
|
||||
void ApplyFilter(uint16_t *ppuOutputBuffer);
|
||||
FrameInfo GetFrameInfo();
|
||||
};
|
|
@ -5,6 +5,7 @@
|
|||
#include "DefaultVideoFilter.h"
|
||||
#include "NtscFilter.h"
|
||||
#include "HdVideoFilter.h"
|
||||
#include "ScaleFilter.h"
|
||||
#include "VideoRenderer.h"
|
||||
|
||||
unique_ptr<VideoDecoder> VideoDecoder::Instance;
|
||||
|
@ -52,6 +53,21 @@ void VideoDecoder::UpdateVideoFilter()
|
|||
switch(_videoFilterType) {
|
||||
case VideoFilterType::None: _videoFilter.reset(new DefaultVideoFilter()); break;
|
||||
case VideoFilterType::NTSC: _videoFilter.reset(new NtscFilter()); break;
|
||||
case VideoFilterType::xBRZ2x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::xBRZ, 2)); break;
|
||||
case VideoFilterType::xBRZ3x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::xBRZ, 3)); break;
|
||||
case VideoFilterType::xBRZ4x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::xBRZ, 4)); break;
|
||||
case VideoFilterType::xBRZ5x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::xBRZ, 5)); break;
|
||||
case VideoFilterType::xBRZ6x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::xBRZ, 6)); break;
|
||||
case VideoFilterType::HQ2x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::HQX, 2)); break;
|
||||
case VideoFilterType::HQ3x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::HQX, 3)); break;
|
||||
case VideoFilterType::HQ4x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::HQX, 4)); break;
|
||||
case VideoFilterType::Scale2x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::Scale2x, 2)); break;
|
||||
case VideoFilterType::Scale3x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::Scale2x, 3)); break;
|
||||
case VideoFilterType::Scale4x: _videoFilter.reset(new ScaleFilter(ScaleFilterType::Scale2x, 4)); break;
|
||||
case VideoFilterType::_2xSai: _videoFilter.reset(new ScaleFilter(ScaleFilterType::_2xSai, 2)); break;
|
||||
case VideoFilterType::Super2xSai: _videoFilter.reset(new ScaleFilter(ScaleFilterType::Super2xSai, 2)); break;
|
||||
case VideoFilterType::SuperEagle: _videoFilter.reset(new ScaleFilter(ScaleFilterType::SuperEagle, 2)); break;
|
||||
|
||||
case VideoFilterType::HdPack: _videoFilter.reset(new HdVideoFilter()); break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,20 @@
|
|||
<Enum ID="VideoFilterType">
|
||||
<Value ID="None">None</Value>
|
||||
<Value ID="NTSC">NTSC</Value>
|
||||
<Value ID="xBRZ2x">xBRZ 2x</Value>
|
||||
<Value ID="xBRZ3x">xBRZ 3x</Value>
|
||||
<Value ID="xBRZ4x">xBRZ 4x</Value>
|
||||
<Value ID="xBRZ5x">xBRZ 5x</Value>
|
||||
<Value ID="xBRZ6x">xBRZ 6x</Value>
|
||||
<Value ID="HQ2x">HQ 2x</Value>
|
||||
<Value ID="HQ3x">HQ 3x</Value>
|
||||
<Value ID="HQ4x">HQ 4x</Value>
|
||||
<Value ID="Scale2x">Scale 2x</Value>
|
||||
<Value ID="Scale3x">Scale 3x</Value>
|
||||
<Value ID="Scale4x">Scale 4x</Value>
|
||||
<Value ID="_2xSai">2xSai</Value>
|
||||
<Value ID="Super2xSai">Super2xSai</Value>
|
||||
<Value ID="SuperEagle">SuperEagle</Value>
|
||||
</Enum>
|
||||
<Enum ID="ConsoleType">
|
||||
<Value ID="Nes">NES</Value>
|
||||
|
|
|
@ -327,6 +327,20 @@
|
|||
<Enum ID="VideoFilterType">
|
||||
<Value ID="None">Aucun</Value>
|
||||
<Value ID="NTSC">NTSC</Value>
|
||||
<Value ID="xBRZ2x">xBRZ 2x</Value>
|
||||
<Value ID="xBRZ3x">xBRZ 3x</Value>
|
||||
<Value ID="xBRZ4x">xBRZ 4x</Value>
|
||||
<Value ID="xBRZ5x">xBRZ 5x</Value>
|
||||
<Value ID="xBRZ6x">xBRZ 6x</Value>
|
||||
<Value ID="HQ2x">HQ 2x</Value>
|
||||
<Value ID="HQ3x">HQ 3x</Value>
|
||||
<Value ID="HQ4x">HQ 4x</Value>
|
||||
<Value ID="Scale2x">Scale2x</Value>
|
||||
<Value ID="Scale3x">Scale3x</Value>
|
||||
<Value ID="Scale4x">Scale4x</Value>
|
||||
<Value ID="_2xSai">2xSai</Value>
|
||||
<Value ID="Super2xSai">Super2xSai</Value>
|
||||
<Value ID="SuperEagle">SuperEagle</Value>
|
||||
</Enum>
|
||||
<Enum ID="ConsoleType">
|
||||
<Value ID="Nes">NES</Value>
|
||||
|
|
|
@ -320,6 +320,20 @@
|
|||
<Enum ID="VideoFilterType">
|
||||
<Value ID="None">なし</Value>
|
||||
<Value ID="NTSC">NTSC</Value>
|
||||
<Value ID="xBRZ2x">xBRZ 2x</Value>
|
||||
<Value ID="xBRZ3x">xBRZ 3x</Value>
|
||||
<Value ID="xBRZ4x">xBRZ 4x</Value>
|
||||
<Value ID="xBRZ5x">xBRZ 5x</Value>
|
||||
<Value ID="xBRZ6x">xBRZ 6x</Value>
|
||||
<Value ID="HQ2x">HQ 2x</Value>
|
||||
<Value ID="HQ3x">HQ 3x</Value>
|
||||
<Value ID="HQ4x">HQ 4x</Value>
|
||||
<Value ID="Scale2x">Scale 2x</Value>
|
||||
<Value ID="Scale3x">Scale 3x</Value>
|
||||
<Value ID="Scale4x">Scale 4x</Value>
|
||||
<Value ID="_2xSai">2xSai</Value>
|
||||
<Value ID="Super2xSai">Super2xSai</Value>
|
||||
<Value ID="SuperEagle">SuperEagle</Value>
|
||||
</Enum>
|
||||
<Enum ID="ConsoleType">
|
||||
<Value ID="Nes">NES</Value>
|
||||
|
|
370
GUI.NET/Forms/frmMain.Designer.cs
generated
370
GUI.NET/Forms/frmMain.Designer.cs
generated
|
@ -81,6 +81,20 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuVideoFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuNoneFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuNtscFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuXBRZ2xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuXBRZ3xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuXBRZ4xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuXBRZ5xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuXBRZ6xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem16 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuHQ2xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuHQ3xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuHQ4xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem17 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuScale2xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuScale3xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuScale4xFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuAudioConfig = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuInput = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -130,6 +144,10 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuCheckForUpdates = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem18 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnu2xSaiFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuSuper2xSaiFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuSuperEagleFilter = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.panelRenderer.SuspendLayout();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -143,9 +161,9 @@ namespace Mesen.GUI.Forms
|
|||
this.panelRenderer.BackColor = System.Drawing.Color.Black;
|
||||
this.panelRenderer.Controls.Add(this.ctrlRenderer);
|
||||
this.panelRenderer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelRenderer.Location = new System.Drawing.Point(0, 26);
|
||||
this.panelRenderer.Location = new System.Drawing.Point(0, 24);
|
||||
this.panelRenderer.Name = "panelRenderer";
|
||||
this.panelRenderer.Size = new System.Drawing.Size(304, 216);
|
||||
this.panelRenderer.Size = new System.Drawing.Size(304, 218);
|
||||
this.panelRenderer.TabIndex = 2;
|
||||
this.panelRenderer.Click += new System.EventHandler(this.panelRenderer_Click);
|
||||
//
|
||||
|
@ -169,7 +187,7 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuHelp});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Size = new System.Drawing.Size(304, 26);
|
||||
this.menuStrip.Size = new System.Drawing.Size(304, 24);
|
||||
this.menuStrip.TabIndex = 0;
|
||||
this.menuStrip.Text = "menuStrip1";
|
||||
this.menuStrip.VisibleChanged += new System.EventHandler(this.menuStrip_VisibleChanged);
|
||||
|
@ -187,7 +205,7 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuExit});
|
||||
this.mnuFile.Name = "mnuFile";
|
||||
this.mnuFile.ShortcutKeyDisplayString = "";
|
||||
this.mnuFile.Size = new System.Drawing.Size(40, 22);
|
||||
this.mnuFile.Size = new System.Drawing.Size(37, 20);
|
||||
this.mnuFile.Text = "File";
|
||||
//
|
||||
// mnuOpen
|
||||
|
@ -195,50 +213,50 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.FolderOpen;
|
||||
this.mnuOpen.Name = "mnuOpen";
|
||||
this.mnuOpen.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
|
||||
this.mnuOpen.Size = new System.Drawing.Size(154, 22);
|
||||
this.mnuOpen.Size = new System.Drawing.Size(146, 22);
|
||||
this.mnuOpen.Text = "Open";
|
||||
this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click);
|
||||
//
|
||||
// toolStripMenuItem4
|
||||
//
|
||||
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
|
||||
this.toolStripMenuItem4.Size = new System.Drawing.Size(151, 6);
|
||||
this.toolStripMenuItem4.Size = new System.Drawing.Size(143, 6);
|
||||
//
|
||||
// mnuSaveState
|
||||
//
|
||||
this.mnuSaveState.Name = "mnuSaveState";
|
||||
this.mnuSaveState.Size = new System.Drawing.Size(154, 22);
|
||||
this.mnuSaveState.Size = new System.Drawing.Size(146, 22);
|
||||
this.mnuSaveState.Text = "Save State";
|
||||
this.mnuSaveState.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening);
|
||||
//
|
||||
// mnuLoadState
|
||||
//
|
||||
this.mnuLoadState.Name = "mnuLoadState";
|
||||
this.mnuLoadState.Size = new System.Drawing.Size(154, 22);
|
||||
this.mnuLoadState.Size = new System.Drawing.Size(146, 22);
|
||||
this.mnuLoadState.Text = "Load State";
|
||||
this.mnuLoadState.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening);
|
||||
//
|
||||
// toolStripMenuItem7
|
||||
//
|
||||
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
|
||||
this.toolStripMenuItem7.Size = new System.Drawing.Size(151, 6);
|
||||
this.toolStripMenuItem7.Size = new System.Drawing.Size(143, 6);
|
||||
//
|
||||
// mnuRecentFiles
|
||||
//
|
||||
this.mnuRecentFiles.Name = "mnuRecentFiles";
|
||||
this.mnuRecentFiles.Size = new System.Drawing.Size(154, 22);
|
||||
this.mnuRecentFiles.Size = new System.Drawing.Size(146, 22);
|
||||
this.mnuRecentFiles.Text = "Recent Files";
|
||||
//
|
||||
// toolStripMenuItem6
|
||||
//
|
||||
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
|
||||
this.toolStripMenuItem6.Size = new System.Drawing.Size(151, 6);
|
||||
this.toolStripMenuItem6.Size = new System.Drawing.Size(143, 6);
|
||||
//
|
||||
// mnuExit
|
||||
//
|
||||
this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit;
|
||||
this.mnuExit.Name = "mnuExit";
|
||||
this.mnuExit.Size = new System.Drawing.Size(154, 22);
|
||||
this.mnuExit.Size = new System.Drawing.Size(146, 22);
|
||||
this.mnuExit.Text = "Exit";
|
||||
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
|
||||
//
|
||||
|
@ -257,7 +275,7 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuInsertCoin1,
|
||||
this.mnuInsertCoin2});
|
||||
this.mnuGame.Name = "mnuGame";
|
||||
this.mnuGame.Size = new System.Drawing.Size(55, 22);
|
||||
this.mnuGame.Size = new System.Drawing.Size(50, 20);
|
||||
this.mnuGame.Text = "Game";
|
||||
//
|
||||
// mnuPause
|
||||
|
@ -266,7 +284,7 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuPause.Image = global::Mesen.GUI.Properties.Resources.Pause;
|
||||
this.mnuPause.Name = "mnuPause";
|
||||
this.mnuPause.ShortcutKeyDisplayString = "Esc";
|
||||
this.mnuPause.Size = new System.Drawing.Size(220, 22);
|
||||
this.mnuPause.Size = new System.Drawing.Size(200, 22);
|
||||
this.mnuPause.Text = "Pause";
|
||||
this.mnuPause.Click += new System.EventHandler(this.mnuPause_Click);
|
||||
//
|
||||
|
@ -275,7 +293,7 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuReset.Enabled = false;
|
||||
this.mnuReset.Image = global::Mesen.GUI.Properties.Resources.Reset;
|
||||
this.mnuReset.Name = "mnuReset";
|
||||
this.mnuReset.Size = new System.Drawing.Size(220, 22);
|
||||
this.mnuReset.Size = new System.Drawing.Size(200, 22);
|
||||
this.mnuReset.Text = "Reset";
|
||||
this.mnuReset.Click += new System.EventHandler(this.mnuReset_Click);
|
||||
//
|
||||
|
@ -284,20 +302,20 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuStop.Enabled = false;
|
||||
this.mnuStop.Image = global::Mesen.GUI.Properties.Resources.Stop;
|
||||
this.mnuStop.Name = "mnuStop";
|
||||
this.mnuStop.Size = new System.Drawing.Size(220, 22);
|
||||
this.mnuStop.Size = new System.Drawing.Size(200, 22);
|
||||
this.mnuStop.Text = "Stop";
|
||||
this.mnuStop.Click += new System.EventHandler(this.mnuStop_Click);
|
||||
//
|
||||
// sepFdsDisk
|
||||
//
|
||||
this.sepFdsDisk.Name = "sepFdsDisk";
|
||||
this.sepFdsDisk.Size = new System.Drawing.Size(217, 6);
|
||||
this.sepFdsDisk.Size = new System.Drawing.Size(197, 6);
|
||||
//
|
||||
// mnuSwitchDiskSide
|
||||
//
|
||||
this.mnuSwitchDiskSide.Name = "mnuSwitchDiskSide";
|
||||
this.mnuSwitchDiskSide.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B)));
|
||||
this.mnuSwitchDiskSide.Size = new System.Drawing.Size(220, 22);
|
||||
this.mnuSwitchDiskSide.Size = new System.Drawing.Size(200, 22);
|
||||
this.mnuSwitchDiskSide.Text = "Switch Disk Side";
|
||||
this.mnuSwitchDiskSide.Click += new System.EventHandler(this.mnuSwitchDiskSide_Click);
|
||||
//
|
||||
|
@ -305,28 +323,28 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuSelectDisk.Image = global::Mesen.GUI.Properties.Resources.Floppy;
|
||||
this.mnuSelectDisk.Name = "mnuSelectDisk";
|
||||
this.mnuSelectDisk.Size = new System.Drawing.Size(220, 22);
|
||||
this.mnuSelectDisk.Size = new System.Drawing.Size(200, 22);
|
||||
this.mnuSelectDisk.Text = "Select Disk";
|
||||
//
|
||||
// mnuEjectDisk
|
||||
//
|
||||
this.mnuEjectDisk.Image = global::Mesen.GUI.Properties.Resources.Eject;
|
||||
this.mnuEjectDisk.Name = "mnuEjectDisk";
|
||||
this.mnuEjectDisk.Size = new System.Drawing.Size(220, 22);
|
||||
this.mnuEjectDisk.Size = new System.Drawing.Size(200, 22);
|
||||
this.mnuEjectDisk.Text = "Eject Disk";
|
||||
this.mnuEjectDisk.Click += new System.EventHandler(this.mnuEjectDisk_Click);
|
||||
//
|
||||
// sepVsSystem
|
||||
//
|
||||
this.sepVsSystem.Name = "sepVsSystem";
|
||||
this.sepVsSystem.Size = new System.Drawing.Size(217, 6);
|
||||
this.sepVsSystem.Size = new System.Drawing.Size(197, 6);
|
||||
this.sepVsSystem.Visible = false;
|
||||
//
|
||||
// mnuVsGameConfig
|
||||
//
|
||||
this.mnuVsGameConfig.Image = global::Mesen.GUI.Properties.Resources.DipSwitches;
|
||||
this.mnuVsGameConfig.Name = "mnuVsGameConfig";
|
||||
this.mnuVsGameConfig.Size = new System.Drawing.Size(220, 22);
|
||||
this.mnuVsGameConfig.Size = new System.Drawing.Size(200, 22);
|
||||
this.mnuVsGameConfig.Text = "Game Configuration";
|
||||
this.mnuVsGameConfig.Click += new System.EventHandler(this.mnuVsGameConfig_Click);
|
||||
//
|
||||
|
@ -334,7 +352,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuInsertCoin1.Image = global::Mesen.GUI.Properties.Resources.coins;
|
||||
this.mnuInsertCoin1.Name = "mnuInsertCoin1";
|
||||
this.mnuInsertCoin1.Size = new System.Drawing.Size(220, 22);
|
||||
this.mnuInsertCoin1.Size = new System.Drawing.Size(200, 22);
|
||||
this.mnuInsertCoin1.Text = "Insert Coin (1)";
|
||||
this.mnuInsertCoin1.Visible = false;
|
||||
this.mnuInsertCoin1.Click += new System.EventHandler(this.mnuInsertCoin1_Click);
|
||||
|
@ -343,7 +361,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuInsertCoin2.Image = global::Mesen.GUI.Properties.Resources.coins;
|
||||
this.mnuInsertCoin2.Name = "mnuInsertCoin2";
|
||||
this.mnuInsertCoin2.Size = new System.Drawing.Size(220, 22);
|
||||
this.mnuInsertCoin2.Size = new System.Drawing.Size(200, 22);
|
||||
this.mnuInsertCoin2.Text = "Insert Coin (2)";
|
||||
this.mnuInsertCoin2.Visible = false;
|
||||
this.mnuInsertCoin2.Click += new System.EventHandler(this.mnuInsertCoin2_Click);
|
||||
|
@ -362,7 +380,7 @@ namespace Mesen.GUI.Forms
|
|||
this.toolStripMenuItem11,
|
||||
this.mnuPreferences});
|
||||
this.mnuOptions.Name = "mnuOptions";
|
||||
this.mnuOptions.Size = new System.Drawing.Size(64, 22);
|
||||
this.mnuOptions.Size = new System.Drawing.Size(61, 20);
|
||||
this.mnuOptions.Text = "Options";
|
||||
//
|
||||
// mnuEmulationSpeed
|
||||
|
@ -382,26 +400,26 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuShowFPS});
|
||||
this.mnuEmulationSpeed.Image = global::Mesen.GUI.Properties.Resources.Speed;
|
||||
this.mnuEmulationSpeed.Name = "mnuEmulationSpeed";
|
||||
this.mnuEmulationSpeed.Size = new System.Drawing.Size(144, 22);
|
||||
this.mnuEmulationSpeed.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuEmulationSpeed.Text = "Speed";
|
||||
//
|
||||
// mnuEmuSpeedNormal
|
||||
//
|
||||
this.mnuEmuSpeedNormal.Name = "mnuEmuSpeedNormal";
|
||||
this.mnuEmuSpeedNormal.Size = new System.Drawing.Size(196, 22);
|
||||
this.mnuEmuSpeedNormal.Size = new System.Drawing.Size(182, 22);
|
||||
this.mnuEmuSpeedNormal.Text = "Normal (100%)";
|
||||
this.mnuEmuSpeedNormal.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||
//
|
||||
// toolStripMenuItem8
|
||||
//
|
||||
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
|
||||
this.toolStripMenuItem8.Size = new System.Drawing.Size(193, 6);
|
||||
this.toolStripMenuItem8.Size = new System.Drawing.Size(179, 6);
|
||||
//
|
||||
// mnuIncreaseSpeed
|
||||
//
|
||||
this.mnuIncreaseSpeed.Name = "mnuIncreaseSpeed";
|
||||
this.mnuIncreaseSpeed.ShortcutKeyDisplayString = "=";
|
||||
this.mnuIncreaseSpeed.Size = new System.Drawing.Size(196, 22);
|
||||
this.mnuIncreaseSpeed.Size = new System.Drawing.Size(182, 22);
|
||||
this.mnuIncreaseSpeed.Text = "Increase Speed";
|
||||
this.mnuIncreaseSpeed.Click += new System.EventHandler(this.mnuIncreaseSpeed_Click);
|
||||
//
|
||||
|
@ -409,7 +427,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuDecreaseSpeed.Name = "mnuDecreaseSpeed";
|
||||
this.mnuDecreaseSpeed.ShortcutKeyDisplayString = "-";
|
||||
this.mnuDecreaseSpeed.Size = new System.Drawing.Size(196, 22);
|
||||
this.mnuDecreaseSpeed.Size = new System.Drawing.Size(182, 22);
|
||||
this.mnuDecreaseSpeed.Text = "Decrease Speed";
|
||||
this.mnuDecreaseSpeed.Click += new System.EventHandler(this.mnuDecreaseSpeed_Click);
|
||||
//
|
||||
|
@ -417,19 +435,19 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuEmuSpeedMaximumSpeed.Name = "mnuEmuSpeedMaximumSpeed";
|
||||
this.mnuEmuSpeedMaximumSpeed.ShortcutKeys = System.Windows.Forms.Keys.F9;
|
||||
this.mnuEmuSpeedMaximumSpeed.Size = new System.Drawing.Size(196, 22);
|
||||
this.mnuEmuSpeedMaximumSpeed.Size = new System.Drawing.Size(182, 22);
|
||||
this.mnuEmuSpeedMaximumSpeed.Text = "Maximum Speed";
|
||||
this.mnuEmuSpeedMaximumSpeed.Click += new System.EventHandler(this.mnuEmuSpeedMaximumSpeed_Click);
|
||||
//
|
||||
// toolStripMenuItem9
|
||||
//
|
||||
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
|
||||
this.toolStripMenuItem9.Size = new System.Drawing.Size(193, 6);
|
||||
this.toolStripMenuItem9.Size = new System.Drawing.Size(179, 6);
|
||||
//
|
||||
// mnuEmuSpeedTriple
|
||||
//
|
||||
this.mnuEmuSpeedTriple.Name = "mnuEmuSpeedTriple";
|
||||
this.mnuEmuSpeedTriple.Size = new System.Drawing.Size(196, 22);
|
||||
this.mnuEmuSpeedTriple.Size = new System.Drawing.Size(182, 22);
|
||||
this.mnuEmuSpeedTriple.Tag = "";
|
||||
this.mnuEmuSpeedTriple.Text = "Triple (300%)";
|
||||
this.mnuEmuSpeedTriple.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||
|
@ -437,35 +455,35 @@ namespace Mesen.GUI.Forms
|
|||
// mnuEmuSpeedDouble
|
||||
//
|
||||
this.mnuEmuSpeedDouble.Name = "mnuEmuSpeedDouble";
|
||||
this.mnuEmuSpeedDouble.Size = new System.Drawing.Size(196, 22);
|
||||
this.mnuEmuSpeedDouble.Size = new System.Drawing.Size(182, 22);
|
||||
this.mnuEmuSpeedDouble.Text = "Double (200%)";
|
||||
this.mnuEmuSpeedDouble.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||
//
|
||||
// mnuEmuSpeedHalf
|
||||
//
|
||||
this.mnuEmuSpeedHalf.Name = "mnuEmuSpeedHalf";
|
||||
this.mnuEmuSpeedHalf.Size = new System.Drawing.Size(196, 22);
|
||||
this.mnuEmuSpeedHalf.Size = new System.Drawing.Size(182, 22);
|
||||
this.mnuEmuSpeedHalf.Text = "Half (50%)";
|
||||
this.mnuEmuSpeedHalf.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||
//
|
||||
// mnuEmuSpeedQuarter
|
||||
//
|
||||
this.mnuEmuSpeedQuarter.Name = "mnuEmuSpeedQuarter";
|
||||
this.mnuEmuSpeedQuarter.Size = new System.Drawing.Size(196, 22);
|
||||
this.mnuEmuSpeedQuarter.Size = new System.Drawing.Size(182, 22);
|
||||
this.mnuEmuSpeedQuarter.Text = "Quarter (25%)";
|
||||
this.mnuEmuSpeedQuarter.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||
//
|
||||
// toolStripMenuItem14
|
||||
//
|
||||
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
|
||||
this.toolStripMenuItem14.Size = new System.Drawing.Size(193, 6);
|
||||
this.toolStripMenuItem14.Size = new System.Drawing.Size(179, 6);
|
||||
//
|
||||
// mnuShowFPS
|
||||
//
|
||||
this.mnuShowFPS.CheckOnClick = true;
|
||||
this.mnuShowFPS.Name = "mnuShowFPS";
|
||||
this.mnuShowFPS.ShortcutKeys = System.Windows.Forms.Keys.F10;
|
||||
this.mnuShowFPS.Size = new System.Drawing.Size(196, 22);
|
||||
this.mnuShowFPS.Size = new System.Drawing.Size(182, 22);
|
||||
this.mnuShowFPS.Text = "Show FPS";
|
||||
this.mnuShowFPS.Click += new System.EventHandler(this.mnuShowFPS_Click);
|
||||
//
|
||||
|
@ -481,13 +499,13 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuFullscreen});
|
||||
this.mnuVideoScale.Image = global::Mesen.GUI.Properties.Resources.Fullscreen;
|
||||
this.mnuVideoScale.Name = "mnuVideoScale";
|
||||
this.mnuVideoScale.Size = new System.Drawing.Size(144, 22);
|
||||
this.mnuVideoScale.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuVideoScale.Text = "Video Size";
|
||||
//
|
||||
// mnuScale1x
|
||||
//
|
||||
this.mnuScale1x.Name = "mnuScale1x";
|
||||
this.mnuScale1x.Size = new System.Drawing.Size(163, 22);
|
||||
this.mnuScale1x.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuScale1x.Tag = "1";
|
||||
this.mnuScale1x.Text = "1x";
|
||||
this.mnuScale1x.Click += new System.EventHandler(this.mnuScale_Click);
|
||||
|
@ -495,7 +513,7 @@ namespace Mesen.GUI.Forms
|
|||
// mnuScale2x
|
||||
//
|
||||
this.mnuScale2x.Name = "mnuScale2x";
|
||||
this.mnuScale2x.Size = new System.Drawing.Size(163, 22);
|
||||
this.mnuScale2x.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuScale2x.Tag = "2";
|
||||
this.mnuScale2x.Text = "2x";
|
||||
this.mnuScale2x.Click += new System.EventHandler(this.mnuScale_Click);
|
||||
|
@ -503,7 +521,7 @@ namespace Mesen.GUI.Forms
|
|||
// mnuScale3x
|
||||
//
|
||||
this.mnuScale3x.Name = "mnuScale3x";
|
||||
this.mnuScale3x.Size = new System.Drawing.Size(163, 22);
|
||||
this.mnuScale3x.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuScale3x.Tag = "3";
|
||||
this.mnuScale3x.Text = "3x";
|
||||
this.mnuScale3x.Click += new System.EventHandler(this.mnuScale_Click);
|
||||
|
@ -511,7 +529,7 @@ namespace Mesen.GUI.Forms
|
|||
// mnuScale4x
|
||||
//
|
||||
this.mnuScale4x.Name = "mnuScale4x";
|
||||
this.mnuScale4x.Size = new System.Drawing.Size(163, 22);
|
||||
this.mnuScale4x.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuScale4x.Tag = "4";
|
||||
this.mnuScale4x.Text = "4x";
|
||||
this.mnuScale4x.Click += new System.EventHandler(this.mnuScale_Click);
|
||||
|
@ -519,20 +537,20 @@ namespace Mesen.GUI.Forms
|
|||
// mnuScaleCustom
|
||||
//
|
||||
this.mnuScaleCustom.Name = "mnuScaleCustom";
|
||||
this.mnuScaleCustom.Size = new System.Drawing.Size(163, 22);
|
||||
this.mnuScaleCustom.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuScaleCustom.Text = "Custom";
|
||||
this.mnuScaleCustom.Click += new System.EventHandler(this.mnuScaleCustom_Click);
|
||||
//
|
||||
// toolStripMenuItem13
|
||||
//
|
||||
this.toolStripMenuItem13.Name = "toolStripMenuItem13";
|
||||
this.toolStripMenuItem13.Size = new System.Drawing.Size(160, 6);
|
||||
this.toolStripMenuItem13.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuFullscreen
|
||||
//
|
||||
this.mnuFullscreen.Name = "mnuFullscreen";
|
||||
this.mnuFullscreen.ShortcutKeys = System.Windows.Forms.Keys.F11;
|
||||
this.mnuFullscreen.Size = new System.Drawing.Size(163, 22);
|
||||
this.mnuFullscreen.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuFullscreen.Text = "Fullscreen";
|
||||
this.mnuFullscreen.Click += new System.EventHandler(this.mnuFullscreen_Click);
|
||||
//
|
||||
|
@ -540,35 +558,145 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuVideoFilter.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mnuNoneFilter,
|
||||
this.mnuNtscFilter});
|
||||
this.mnuNtscFilter,
|
||||
this.toolStripMenuItem15,
|
||||
this.mnuXBRZ2xFilter,
|
||||
this.mnuXBRZ3xFilter,
|
||||
this.mnuXBRZ4xFilter,
|
||||
this.mnuXBRZ5xFilter,
|
||||
this.mnuXBRZ6xFilter,
|
||||
this.toolStripMenuItem16,
|
||||
this.mnuHQ2xFilter,
|
||||
this.mnuHQ3xFilter,
|
||||
this.mnuHQ4xFilter,
|
||||
this.toolStripMenuItem17,
|
||||
this.mnuScale2xFilter,
|
||||
this.mnuScale3xFilter,
|
||||
this.mnuScale4xFilter,
|
||||
this.toolStripMenuItem18,
|
||||
this.mnu2xSaiFilter,
|
||||
this.mnuSuper2xSaiFilter,
|
||||
this.mnuSuperEagleFilter});
|
||||
this.mnuVideoFilter.Name = "mnuVideoFilter";
|
||||
this.mnuVideoFilter.Size = new System.Drawing.Size(144, 22);
|
||||
this.mnuVideoFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuVideoFilter.Text = "Video Filter";
|
||||
//
|
||||
// mnuNoneFilter
|
||||
//
|
||||
this.mnuNoneFilter.Name = "mnuNoneFilter";
|
||||
this.mnuNoneFilter.Size = new System.Drawing.Size(109, 22);
|
||||
this.mnuNoneFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuNoneFilter.Text = "None";
|
||||
this.mnuNoneFilter.Click += new System.EventHandler(this.mnuNoneFilter_Click);
|
||||
//
|
||||
// mnuNtscFilter
|
||||
//
|
||||
this.mnuNtscFilter.Name = "mnuNtscFilter";
|
||||
this.mnuNtscFilter.Size = new System.Drawing.Size(109, 22);
|
||||
this.mnuNtscFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuNtscFilter.Text = "NTSC";
|
||||
this.mnuNtscFilter.Click += new System.EventHandler(this.mnuNtscFilter_Click);
|
||||
//
|
||||
// toolStripMenuItem15
|
||||
//
|
||||
this.toolStripMenuItem15.Name = "toolStripMenuItem15";
|
||||
this.toolStripMenuItem15.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuXBRZ2xFilter
|
||||
//
|
||||
this.mnuXBRZ2xFilter.Name = "mnuXBRZ2xFilter";
|
||||
this.mnuXBRZ2xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuXBRZ2xFilter.Text = "xBRZ 2x";
|
||||
this.mnuXBRZ2xFilter.Click += new System.EventHandler(this.mnuXBRZ2xFilter_Click);
|
||||
//
|
||||
// mnuXBRZ3xFilter
|
||||
//
|
||||
this.mnuXBRZ3xFilter.Name = "mnuXBRZ3xFilter";
|
||||
this.mnuXBRZ3xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuXBRZ3xFilter.Text = "xBRZ 3x";
|
||||
this.mnuXBRZ3xFilter.Click += new System.EventHandler(this.mnuXBRZ3xFilter_Click);
|
||||
//
|
||||
// mnuXBRZ4xFilter
|
||||
//
|
||||
this.mnuXBRZ4xFilter.Name = "mnuXBRZ4xFilter";
|
||||
this.mnuXBRZ4xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuXBRZ4xFilter.Text = "xBRZ 4x";
|
||||
this.mnuXBRZ4xFilter.Click += new System.EventHandler(this.mnuXBRZ4xFilter_Click);
|
||||
//
|
||||
// mnuXBRZ5xFilter
|
||||
//
|
||||
this.mnuXBRZ5xFilter.Name = "mnuXBRZ5xFilter";
|
||||
this.mnuXBRZ5xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuXBRZ5xFilter.Text = "xBRZ 5x";
|
||||
this.mnuXBRZ5xFilter.Click += new System.EventHandler(this.mnuXBRZ5xFilter_Click);
|
||||
//
|
||||
// mnuXBRZ6xFilter
|
||||
//
|
||||
this.mnuXBRZ6xFilter.Name = "mnuXBRZ6xFilter";
|
||||
this.mnuXBRZ6xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuXBRZ6xFilter.Text = "xBRZ 6x";
|
||||
this.mnuXBRZ6xFilter.Click += new System.EventHandler(this.mnuXBRZ6xFilter_Click);
|
||||
//
|
||||
// toolStripMenuItem16
|
||||
//
|
||||
this.toolStripMenuItem16.Name = "toolStripMenuItem16";
|
||||
this.toolStripMenuItem16.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuHQ2xFilter
|
||||
//
|
||||
this.mnuHQ2xFilter.Name = "mnuHQ2xFilter";
|
||||
this.mnuHQ2xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuHQ2xFilter.Text = "HQ 2x";
|
||||
this.mnuHQ2xFilter.Click += new System.EventHandler(this.mnuHQ2xFilter_Click);
|
||||
//
|
||||
// mnuHQ3xFilter
|
||||
//
|
||||
this.mnuHQ3xFilter.Name = "mnuHQ3xFilter";
|
||||
this.mnuHQ3xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuHQ3xFilter.Text = "HQ 3x";
|
||||
this.mnuHQ3xFilter.Click += new System.EventHandler(this.mnuHQ3xFilter_Click);
|
||||
//
|
||||
// mnuHQ4xFilter
|
||||
//
|
||||
this.mnuHQ4xFilter.Name = "mnuHQ4xFilter";
|
||||
this.mnuHQ4xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuHQ4xFilter.Text = "HQ 4x";
|
||||
this.mnuHQ4xFilter.Click += new System.EventHandler(this.mnuHQ4xFilter_Click);
|
||||
//
|
||||
// toolStripMenuItem17
|
||||
//
|
||||
this.toolStripMenuItem17.Name = "toolStripMenuItem17";
|
||||
this.toolStripMenuItem17.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuScale2xFilter
|
||||
//
|
||||
this.mnuScale2xFilter.Name = "mnuScale2xFilter";
|
||||
this.mnuScale2xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuScale2xFilter.Text = "Scale2x";
|
||||
this.mnuScale2xFilter.Click += new System.EventHandler(this.mnuScale2xFilter_Click);
|
||||
//
|
||||
// mnuScale3xFilter
|
||||
//
|
||||
this.mnuScale3xFilter.Name = "mnuScale3xFilter";
|
||||
this.mnuScale3xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuScale3xFilter.Text = "Scale3x";
|
||||
this.mnuScale3xFilter.Click += new System.EventHandler(this.mnuScale3xFilter_Click);
|
||||
//
|
||||
// mnuScale4xFilter
|
||||
//
|
||||
this.mnuScale4xFilter.Name = "mnuScale4xFilter";
|
||||
this.mnuScale4xFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuScale4xFilter.Text = "Scale4x";
|
||||
this.mnuScale4xFilter.Click += new System.EventHandler(this.mnuScale4xFilter_Click);
|
||||
//
|
||||
// toolStripMenuItem10
|
||||
//
|
||||
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
|
||||
this.toolStripMenuItem10.Size = new System.Drawing.Size(141, 6);
|
||||
this.toolStripMenuItem10.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuAudioConfig
|
||||
//
|
||||
this.mnuAudioConfig.Image = global::Mesen.GUI.Properties.Resources.Audio;
|
||||
this.mnuAudioConfig.Name = "mnuAudioConfig";
|
||||
this.mnuAudioConfig.Size = new System.Drawing.Size(144, 22);
|
||||
this.mnuAudioConfig.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuAudioConfig.Text = "Audio";
|
||||
this.mnuAudioConfig.Click += new System.EventHandler(this.mnuAudioConfig_Click);
|
||||
//
|
||||
|
@ -576,7 +704,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuInput.Image = global::Mesen.GUI.Properties.Resources.Controller;
|
||||
this.mnuInput.Name = "mnuInput";
|
||||
this.mnuInput.Size = new System.Drawing.Size(144, 22);
|
||||
this.mnuInput.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuInput.Text = "Input";
|
||||
this.mnuInput.Click += new System.EventHandler(this.mnuInput_Click);
|
||||
//
|
||||
|
@ -589,34 +717,34 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuRegionDendy});
|
||||
this.mnuRegion.Image = global::Mesen.GUI.Properties.Resources.Globe;
|
||||
this.mnuRegion.Name = "mnuRegion";
|
||||
this.mnuRegion.Size = new System.Drawing.Size(144, 22);
|
||||
this.mnuRegion.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuRegion.Text = "Region";
|
||||
//
|
||||
// mnuRegionAuto
|
||||
//
|
||||
this.mnuRegionAuto.Name = "mnuRegionAuto";
|
||||
this.mnuRegionAuto.Size = new System.Drawing.Size(113, 22);
|
||||
this.mnuRegionAuto.Size = new System.Drawing.Size(108, 22);
|
||||
this.mnuRegionAuto.Text = "Auto";
|
||||
this.mnuRegionAuto.Click += new System.EventHandler(this.mnuRegion_Click);
|
||||
//
|
||||
// mnuRegionNtsc
|
||||
//
|
||||
this.mnuRegionNtsc.Name = "mnuRegionNtsc";
|
||||
this.mnuRegionNtsc.Size = new System.Drawing.Size(113, 22);
|
||||
this.mnuRegionNtsc.Size = new System.Drawing.Size(108, 22);
|
||||
this.mnuRegionNtsc.Text = "NTSC";
|
||||
this.mnuRegionNtsc.Click += new System.EventHandler(this.mnuRegion_Click);
|
||||
//
|
||||
// mnuRegionPal
|
||||
//
|
||||
this.mnuRegionPal.Name = "mnuRegionPal";
|
||||
this.mnuRegionPal.Size = new System.Drawing.Size(113, 22);
|
||||
this.mnuRegionPal.Size = new System.Drawing.Size(108, 22);
|
||||
this.mnuRegionPal.Text = "PAL";
|
||||
this.mnuRegionPal.Click += new System.EventHandler(this.mnuRegion_Click);
|
||||
//
|
||||
// mnuRegionDendy
|
||||
//
|
||||
this.mnuRegionDendy.Name = "mnuRegionDendy";
|
||||
this.mnuRegionDendy.Size = new System.Drawing.Size(113, 22);
|
||||
this.mnuRegionDendy.Size = new System.Drawing.Size(108, 22);
|
||||
this.mnuRegionDendy.Text = "Dendy";
|
||||
this.mnuRegionDendy.Click += new System.EventHandler(this.mnuRegion_Click);
|
||||
//
|
||||
|
@ -624,20 +752,20 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuVideoConfig.Image = global::Mesen.GUI.Properties.Resources.Video;
|
||||
this.mnuVideoConfig.Name = "mnuVideoConfig";
|
||||
this.mnuVideoConfig.Size = new System.Drawing.Size(144, 22);
|
||||
this.mnuVideoConfig.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuVideoConfig.Text = "Video";
|
||||
this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click);
|
||||
//
|
||||
// toolStripMenuItem11
|
||||
//
|
||||
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
|
||||
this.toolStripMenuItem11.Size = new System.Drawing.Size(141, 6);
|
||||
this.toolStripMenuItem11.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuPreferences
|
||||
//
|
||||
this.mnuPreferences.Image = global::Mesen.GUI.Properties.Resources.Cog;
|
||||
this.mnuPreferences.Name = "mnuPreferences";
|
||||
this.mnuPreferences.Size = new System.Drawing.Size(144, 22);
|
||||
this.mnuPreferences.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuPreferences.Text = "Preferences";
|
||||
this.mnuPreferences.Click += new System.EventHandler(this.mnuPreferences_Click);
|
||||
//
|
||||
|
@ -653,7 +781,7 @@ namespace Mesen.GUI.Forms
|
|||
this.toolStripMenuItem1,
|
||||
this.mnuTakeScreenshot});
|
||||
this.mnuTools.Name = "mnuTools";
|
||||
this.mnuTools.Size = new System.Drawing.Size(50, 22);
|
||||
this.mnuTools.Size = new System.Drawing.Size(48, 20);
|
||||
this.mnuTools.Text = "Tools";
|
||||
//
|
||||
// mnuNetPlay
|
||||
|
@ -667,20 +795,20 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuProfile});
|
||||
this.mnuNetPlay.Image = global::Mesen.GUI.Properties.Resources.NetPlay;
|
||||
this.mnuNetPlay.Name = "mnuNetPlay";
|
||||
this.mnuNetPlay.Size = new System.Drawing.Size(202, 22);
|
||||
this.mnuNetPlay.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuNetPlay.Text = "Net Play";
|
||||
//
|
||||
// mnuStartServer
|
||||
//
|
||||
this.mnuStartServer.Name = "mnuStartServer";
|
||||
this.mnuStartServer.Size = new System.Drawing.Size(190, 22);
|
||||
this.mnuStartServer.Size = new System.Drawing.Size(177, 22);
|
||||
this.mnuStartServer.Text = "Start Server";
|
||||
this.mnuStartServer.Click += new System.EventHandler(this.mnuStartServer_Click);
|
||||
//
|
||||
// mnuConnect
|
||||
//
|
||||
this.mnuConnect.Name = "mnuConnect";
|
||||
this.mnuConnect.Size = new System.Drawing.Size(190, 22);
|
||||
this.mnuConnect.Size = new System.Drawing.Size(177, 22);
|
||||
this.mnuConnect.Text = "Connect to Server";
|
||||
this.mnuConnect.Click += new System.EventHandler(this.mnuConnect_Click);
|
||||
//
|
||||
|
@ -694,66 +822,66 @@ namespace Mesen.GUI.Forms
|
|||
this.toolStripMenuItem3,
|
||||
this.mnuNetPlaySpectator});
|
||||
this.mnuNetPlaySelectController.Name = "mnuNetPlaySelectController";
|
||||
this.mnuNetPlaySelectController.Size = new System.Drawing.Size(190, 22);
|
||||
this.mnuNetPlaySelectController.Size = new System.Drawing.Size(177, 22);
|
||||
this.mnuNetPlaySelectController.Text = "Select Controller";
|
||||
//
|
||||
// mnuNetPlayPlayer1
|
||||
//
|
||||
this.mnuNetPlayPlayer1.Name = "mnuNetPlayPlayer1";
|
||||
this.mnuNetPlayPlayer1.Size = new System.Drawing.Size(133, 22);
|
||||
this.mnuNetPlayPlayer1.Size = new System.Drawing.Size(124, 22);
|
||||
this.mnuNetPlayPlayer1.Text = "Player 1";
|
||||
this.mnuNetPlayPlayer1.Click += new System.EventHandler(this.mnuNetPlayPlayer1_Click);
|
||||
//
|
||||
// mnuNetPlayPlayer2
|
||||
//
|
||||
this.mnuNetPlayPlayer2.Name = "mnuNetPlayPlayer2";
|
||||
this.mnuNetPlayPlayer2.Size = new System.Drawing.Size(133, 22);
|
||||
this.mnuNetPlayPlayer2.Size = new System.Drawing.Size(124, 22);
|
||||
this.mnuNetPlayPlayer2.Text = "Player 2";
|
||||
this.mnuNetPlayPlayer2.Click += new System.EventHandler(this.mnuNetPlayPlayer2_Click);
|
||||
//
|
||||
// mnuNetPlayPlayer3
|
||||
//
|
||||
this.mnuNetPlayPlayer3.Name = "mnuNetPlayPlayer3";
|
||||
this.mnuNetPlayPlayer3.Size = new System.Drawing.Size(133, 22);
|
||||
this.mnuNetPlayPlayer3.Size = new System.Drawing.Size(124, 22);
|
||||
this.mnuNetPlayPlayer3.Text = "Player 3";
|
||||
this.mnuNetPlayPlayer3.Click += new System.EventHandler(this.mnuNetPlayPlayer3_Click);
|
||||
//
|
||||
// mnuNetPlayPlayer4
|
||||
//
|
||||
this.mnuNetPlayPlayer4.Name = "mnuNetPlayPlayer4";
|
||||
this.mnuNetPlayPlayer4.Size = new System.Drawing.Size(133, 22);
|
||||
this.mnuNetPlayPlayer4.Size = new System.Drawing.Size(124, 22);
|
||||
this.mnuNetPlayPlayer4.Text = "Player 4";
|
||||
this.mnuNetPlayPlayer4.Click += new System.EventHandler(this.mnuNetPlayPlayer4_Click);
|
||||
//
|
||||
// toolStripMenuItem3
|
||||
//
|
||||
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||
this.toolStripMenuItem3.Size = new System.Drawing.Size(130, 6);
|
||||
this.toolStripMenuItem3.Size = new System.Drawing.Size(121, 6);
|
||||
//
|
||||
// mnuNetPlaySpectator
|
||||
//
|
||||
this.mnuNetPlaySpectator.Name = "mnuNetPlaySpectator";
|
||||
this.mnuNetPlaySpectator.Size = new System.Drawing.Size(133, 22);
|
||||
this.mnuNetPlaySpectator.Size = new System.Drawing.Size(124, 22);
|
||||
this.mnuNetPlaySpectator.Text = "Spectator";
|
||||
this.mnuNetPlaySpectator.Click += new System.EventHandler(this.mnuNetPlaySpectator_Click);
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(187, 6);
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(174, 6);
|
||||
//
|
||||
// mnuFindServer
|
||||
//
|
||||
this.mnuFindServer.Enabled = false;
|
||||
this.mnuFindServer.Name = "mnuFindServer";
|
||||
this.mnuFindServer.Size = new System.Drawing.Size(190, 22);
|
||||
this.mnuFindServer.Size = new System.Drawing.Size(177, 22);
|
||||
this.mnuFindServer.Text = "Find Public Server...";
|
||||
this.mnuFindServer.Visible = false;
|
||||
//
|
||||
// mnuProfile
|
||||
//
|
||||
this.mnuProfile.Name = "mnuProfile";
|
||||
this.mnuProfile.Size = new System.Drawing.Size(190, 22);
|
||||
this.mnuProfile.Size = new System.Drawing.Size(177, 22);
|
||||
this.mnuProfile.Text = "Configure Profile";
|
||||
this.mnuProfile.Click += new System.EventHandler(this.mnuProfile_Click);
|
||||
//
|
||||
|
@ -765,13 +893,13 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuStopMovie});
|
||||
this.mnuMovies.Image = global::Mesen.GUI.Properties.Resources.Movie;
|
||||
this.mnuMovies.Name = "mnuMovies";
|
||||
this.mnuMovies.Size = new System.Drawing.Size(202, 22);
|
||||
this.mnuMovies.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuMovies.Text = "Movies";
|
||||
//
|
||||
// mnuPlayMovie
|
||||
//
|
||||
this.mnuPlayMovie.Name = "mnuPlayMovie";
|
||||
this.mnuPlayMovie.Size = new System.Drawing.Size(160, 22);
|
||||
this.mnuPlayMovie.Size = new System.Drawing.Size(149, 22);
|
||||
this.mnuPlayMovie.Text = "Play...";
|
||||
this.mnuPlayMovie.Click += new System.EventHandler(this.mnuPlayMovie_Click);
|
||||
//
|
||||
|
@ -781,41 +909,41 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuRecordFromStart,
|
||||
this.mnuRecordFromNow});
|
||||
this.mnuRecordFrom.Name = "mnuRecordFrom";
|
||||
this.mnuRecordFrom.Size = new System.Drawing.Size(160, 22);
|
||||
this.mnuRecordFrom.Size = new System.Drawing.Size(149, 22);
|
||||
this.mnuRecordFrom.Text = "Record from...";
|
||||
//
|
||||
// mnuRecordFromStart
|
||||
//
|
||||
this.mnuRecordFromStart.Name = "mnuRecordFromStart";
|
||||
this.mnuRecordFromStart.Size = new System.Drawing.Size(106, 22);
|
||||
this.mnuRecordFromStart.Size = new System.Drawing.Size(99, 22);
|
||||
this.mnuRecordFromStart.Text = "Start";
|
||||
this.mnuRecordFromStart.Click += new System.EventHandler(this.mnuRecordFromStart_Click);
|
||||
//
|
||||
// mnuRecordFromNow
|
||||
//
|
||||
this.mnuRecordFromNow.Name = "mnuRecordFromNow";
|
||||
this.mnuRecordFromNow.Size = new System.Drawing.Size(106, 22);
|
||||
this.mnuRecordFromNow.Size = new System.Drawing.Size(99, 22);
|
||||
this.mnuRecordFromNow.Text = "Now";
|
||||
this.mnuRecordFromNow.Click += new System.EventHandler(this.mnuRecordFromNow_Click);
|
||||
//
|
||||
// mnuStopMovie
|
||||
//
|
||||
this.mnuStopMovie.Name = "mnuStopMovie";
|
||||
this.mnuStopMovie.Size = new System.Drawing.Size(160, 22);
|
||||
this.mnuStopMovie.Size = new System.Drawing.Size(149, 22);
|
||||
this.mnuStopMovie.Text = "Stop";
|
||||
this.mnuStopMovie.Click += new System.EventHandler(this.mnuStopMovie_Click);
|
||||
//
|
||||
// mnuCheats
|
||||
//
|
||||
this.mnuCheats.Name = "mnuCheats";
|
||||
this.mnuCheats.Size = new System.Drawing.Size(202, 22);
|
||||
this.mnuCheats.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuCheats.Text = "Cheats";
|
||||
this.mnuCheats.Click += new System.EventHandler(this.mnuCheats_Click);
|
||||
//
|
||||
// toolStripMenuItem12
|
||||
//
|
||||
this.toolStripMenuItem12.Name = "toolStripMenuItem12";
|
||||
this.toolStripMenuItem12.Size = new System.Drawing.Size(199, 6);
|
||||
this.toolStripMenuItem12.Size = new System.Drawing.Size(182, 6);
|
||||
//
|
||||
// mnuTests
|
||||
//
|
||||
|
@ -825,13 +953,13 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuTestStopRecording,
|
||||
this.mnuRunAllTests});
|
||||
this.mnuTests.Name = "mnuTests";
|
||||
this.mnuTests.Size = new System.Drawing.Size(202, 22);
|
||||
this.mnuTests.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuTests.Text = "Tests";
|
||||
//
|
||||
// mnuTestRun
|
||||
//
|
||||
this.mnuTestRun.Name = "mnuTestRun";
|
||||
this.mnuTestRun.Size = new System.Drawing.Size(208, 22);
|
||||
this.mnuTestRun.Size = new System.Drawing.Size(193, 22);
|
||||
this.mnuTestRun.Text = "Run...";
|
||||
this.mnuTestRun.Click += new System.EventHandler(this.mnuTestRun_Click);
|
||||
//
|
||||
|
@ -843,35 +971,35 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuTestRecordMovie,
|
||||
this.mnuTestRecordTest});
|
||||
this.mnuTestRecordFrom.Name = "mnuTestRecordFrom";
|
||||
this.mnuTestRecordFrom.Size = new System.Drawing.Size(208, 22);
|
||||
this.mnuTestRecordFrom.Size = new System.Drawing.Size(193, 22);
|
||||
this.mnuTestRecordFrom.Text = "Record from...";
|
||||
//
|
||||
// mnuTestRecordStart
|
||||
//
|
||||
this.mnuTestRecordStart.Name = "mnuTestRecordStart";
|
||||
this.mnuTestRecordStart.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
|
||||
this.mnuTestRecordStart.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuTestRecordStart.Size = new System.Drawing.Size(138, 22);
|
||||
this.mnuTestRecordStart.Text = "Start";
|
||||
this.mnuTestRecordStart.Click += new System.EventHandler(this.mnuTestRecordStart_Click);
|
||||
//
|
||||
// mnuTestRecordNow
|
||||
//
|
||||
this.mnuTestRecordNow.Name = "mnuTestRecordNow";
|
||||
this.mnuTestRecordNow.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuTestRecordNow.Size = new System.Drawing.Size(138, 22);
|
||||
this.mnuTestRecordNow.Text = "Now";
|
||||
this.mnuTestRecordNow.Click += new System.EventHandler(this.mnuTestRecordNow_Click);
|
||||
//
|
||||
// mnuTestRecordMovie
|
||||
//
|
||||
this.mnuTestRecordMovie.Name = "mnuTestRecordMovie";
|
||||
this.mnuTestRecordMovie.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuTestRecordMovie.Size = new System.Drawing.Size(138, 22);
|
||||
this.mnuTestRecordMovie.Text = "Movie";
|
||||
this.mnuTestRecordMovie.Click += new System.EventHandler(this.mnuTestRecordMovie_Click);
|
||||
//
|
||||
// mnuTestRecordTest
|
||||
//
|
||||
this.mnuTestRecordTest.Name = "mnuTestRecordTest";
|
||||
this.mnuTestRecordTest.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuTestRecordTest.Size = new System.Drawing.Size(138, 22);
|
||||
this.mnuTestRecordTest.Text = "Test";
|
||||
this.mnuTestRecordTest.Click += new System.EventHandler(this.mnuTestRecordTest_Click);
|
||||
//
|
||||
|
@ -879,35 +1007,35 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuTestStopRecording.Name = "mnuTestStopRecording";
|
||||
this.mnuTestStopRecording.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R)));
|
||||
this.mnuTestStopRecording.Size = new System.Drawing.Size(208, 22);
|
||||
this.mnuTestStopRecording.Size = new System.Drawing.Size(193, 22);
|
||||
this.mnuTestStopRecording.Text = "Stop recording";
|
||||
this.mnuTestStopRecording.Click += new System.EventHandler(this.mnuTestStopRecording_Click);
|
||||
//
|
||||
// mnuRunAllTests
|
||||
//
|
||||
this.mnuRunAllTests.Name = "mnuRunAllTests";
|
||||
this.mnuRunAllTests.Size = new System.Drawing.Size(208, 22);
|
||||
this.mnuRunAllTests.Size = new System.Drawing.Size(193, 22);
|
||||
this.mnuRunAllTests.Text = "Run all tests";
|
||||
this.mnuRunAllTests.Click += new System.EventHandler(this.mnuRunAllTests_Click);
|
||||
//
|
||||
// mnuDebugger
|
||||
//
|
||||
this.mnuDebugger.Name = "mnuDebugger";
|
||||
this.mnuDebugger.Size = new System.Drawing.Size(202, 22);
|
||||
this.mnuDebugger.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuDebugger.Text = "Debugger";
|
||||
this.mnuDebugger.Click += new System.EventHandler(this.mnuDebugger_Click);
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(199, 6);
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(182, 6);
|
||||
//
|
||||
// mnuTakeScreenshot
|
||||
//
|
||||
this.mnuTakeScreenshot.Image = global::Mesen.GUI.Properties.Resources.Camera;
|
||||
this.mnuTakeScreenshot.Name = "mnuTakeScreenshot";
|
||||
this.mnuTakeScreenshot.ShortcutKeys = System.Windows.Forms.Keys.F12;
|
||||
this.mnuTakeScreenshot.Size = new System.Drawing.Size(202, 22);
|
||||
this.mnuTakeScreenshot.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuTakeScreenshot.Text = "Take Screenshot";
|
||||
this.mnuTakeScreenshot.Click += new System.EventHandler(this.mnuTakeScreenshot_Click);
|
||||
//
|
||||
|
@ -918,30 +1046,56 @@ namespace Mesen.GUI.Forms
|
|||
this.toolStripMenuItem5,
|
||||
this.mnuAbout});
|
||||
this.mnuHelp.Name = "mnuHelp";
|
||||
this.mnuHelp.Size = new System.Drawing.Size(46, 22);
|
||||
this.mnuHelp.Size = new System.Drawing.Size(44, 20);
|
||||
this.mnuHelp.Text = "Help";
|
||||
//
|
||||
// mnuCheckForUpdates
|
||||
//
|
||||
this.mnuCheckForUpdates.Image = global::Mesen.GUI.Properties.Resources.SoftwareUpdate;
|
||||
this.mnuCheckForUpdates.Name = "mnuCheckForUpdates";
|
||||
this.mnuCheckForUpdates.Size = new System.Drawing.Size(181, 22);
|
||||
this.mnuCheckForUpdates.Size = new System.Drawing.Size(170, 22);
|
||||
this.mnuCheckForUpdates.Text = "Check for updates";
|
||||
this.mnuCheckForUpdates.Click += new System.EventHandler(this.mnuCheckForUpdates_Click);
|
||||
//
|
||||
// toolStripMenuItem5
|
||||
//
|
||||
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(178, 6);
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(167, 6);
|
||||
//
|
||||
// mnuAbout
|
||||
//
|
||||
this.mnuAbout.Image = global::Mesen.GUI.Properties.Resources.Help;
|
||||
this.mnuAbout.Name = "mnuAbout";
|
||||
this.mnuAbout.Size = new System.Drawing.Size(181, 22);
|
||||
this.mnuAbout.Size = new System.Drawing.Size(170, 22);
|
||||
this.mnuAbout.Text = "About";
|
||||
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
|
||||
//
|
||||
// toolStripMenuItem18
|
||||
//
|
||||
this.toolStripMenuItem18.Name = "toolStripMenuItem18";
|
||||
this.toolStripMenuItem18.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnu2xSaiFilter
|
||||
//
|
||||
this.mnu2xSaiFilter.Name = "mnu2xSaiFilter";
|
||||
this.mnu2xSaiFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnu2xSaiFilter.Text = "2xSai";
|
||||
this.mnu2xSaiFilter.Click += new System.EventHandler(this.mnu2xSaiFilter_Click);
|
||||
//
|
||||
// mnuSuper2xSaiFilter
|
||||
//
|
||||
this.mnuSuper2xSaiFilter.Name = "mnuSuper2xSaiFilter";
|
||||
this.mnuSuper2xSaiFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuSuper2xSaiFilter.Text = "Super2xSai";
|
||||
this.mnuSuper2xSaiFilter.Click += new System.EventHandler(this.mnuSuper2xSaiFilter_Click);
|
||||
//
|
||||
// mnuSuperEagleFilter
|
||||
//
|
||||
this.mnuSuperEagleFilter.Name = "mnuSuperEagleFilter";
|
||||
this.mnuSuperEagleFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuSuperEagleFilter.Text = "SuperEagle";
|
||||
this.mnuSuperEagleFilter.Click += new System.EventHandler(this.mnuSuperEagleFilter_Click);
|
||||
//
|
||||
// frmMain
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
@ -1067,6 +1221,24 @@ namespace Mesen.GUI.Forms
|
|||
private System.Windows.Forms.ToolStripMenuItem mnuInsertCoin1;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuVsGameConfig;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuInsertCoin2;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem15;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ2xFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ3xFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ4xFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ5xFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuXBRZ6xFilter;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem16;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuHQ2xFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuHQ3xFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuHQ4xFilter;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem17;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuScale2xFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuScale3xFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuScale4xFilter;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem18;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnu2xSaiFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuSuper2xSaiFilter;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuSuperEagleFilter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -931,6 +931,20 @@ namespace Mesen.GUI.Forms
|
|||
{
|
||||
mnuNoneFilter.Checked = (filterType == VideoFilterType.None);
|
||||
mnuNtscFilter.Checked = (filterType == VideoFilterType.NTSC);
|
||||
mnuXBRZ2xFilter.Checked = (filterType == VideoFilterType.xBRZ2x);
|
||||
mnuXBRZ3xFilter.Checked = (filterType == VideoFilterType.xBRZ3x);
|
||||
mnuXBRZ4xFilter.Checked = (filterType == VideoFilterType.xBRZ4x);
|
||||
mnuXBRZ5xFilter.Checked = (filterType == VideoFilterType.xBRZ5x);
|
||||
mnuXBRZ6xFilter.Checked = (filterType == VideoFilterType.xBRZ6x);
|
||||
mnuHQ2xFilter.Checked = (filterType == VideoFilterType.HQ2x);
|
||||
mnuHQ3xFilter.Checked = (filterType == VideoFilterType.HQ3x);
|
||||
mnuHQ4xFilter.Checked = (filterType == VideoFilterType.HQ4x);
|
||||
mnuScale2xFilter.Checked = (filterType == VideoFilterType.Scale2x);
|
||||
mnuScale3xFilter.Checked = (filterType == VideoFilterType.Scale3x);
|
||||
mnuScale4xFilter.Checked = (filterType == VideoFilterType.Scale4x);
|
||||
mnu2xSaiFilter.Checked = (filterType == VideoFilterType._2xSai);
|
||||
mnuSuper2xSaiFilter.Checked = (filterType == VideoFilterType.Super2xSai);
|
||||
mnuSuperEagleFilter.Checked = (filterType == VideoFilterType.SuperEagle);
|
||||
|
||||
ConfigManager.Config.VideoInfo.VideoFilter = filterType;
|
||||
ConfigManager.ApplyChanges();
|
||||
|
@ -945,18 +959,91 @@ namespace Mesen.GUI.Forms
|
|||
UpdateScaleMenu(scale);
|
||||
}
|
||||
|
||||
private void SetVideoFilter(VideoFilterType type)
|
||||
{
|
||||
InteropEmu.SetVideoFilter(type);
|
||||
UpdateFilterMenu(type);
|
||||
_customSize = false;
|
||||
}
|
||||
|
||||
private void mnuNoneFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
InteropEmu.SetVideoFilter(VideoFilterType.None);
|
||||
UpdateFilterMenu(VideoFilterType.None);
|
||||
_customSize = false;
|
||||
SetVideoFilter(VideoFilterType.None);
|
||||
}
|
||||
|
||||
private void mnuNtscFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
InteropEmu.SetVideoFilter(VideoFilterType.NTSC);
|
||||
UpdateFilterMenu(VideoFilterType.NTSC);
|
||||
_customSize = false;
|
||||
SetVideoFilter(VideoFilterType.NTSC);
|
||||
}
|
||||
|
||||
private void mnuXBRZ2xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.xBRZ2x);
|
||||
}
|
||||
|
||||
private void mnuXBRZ3xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.xBRZ3x);
|
||||
}
|
||||
|
||||
private void mnuXBRZ4xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.xBRZ4x);
|
||||
}
|
||||
|
||||
private void mnuXBRZ5xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.xBRZ5x);
|
||||
}
|
||||
|
||||
private void mnuXBRZ6xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.xBRZ6x);
|
||||
}
|
||||
|
||||
private void mnuHQ2xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.HQ2x);
|
||||
}
|
||||
|
||||
private void mnuHQ3xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.HQ3x);
|
||||
}
|
||||
|
||||
private void mnuHQ4xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.HQ4x);
|
||||
}
|
||||
|
||||
private void mnuScale2xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.Scale2x);
|
||||
}
|
||||
|
||||
private void mnuScale3xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.Scale3x);
|
||||
}
|
||||
|
||||
private void mnuScale4xFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.Scale4x);
|
||||
}
|
||||
|
||||
private void mnu2xSaiFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType._2xSai);
|
||||
}
|
||||
|
||||
private void mnuSuper2xSaiFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.Super2xSai);
|
||||
}
|
||||
|
||||
private void mnuSuperEagleFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetVideoFilter(VideoFilterType.SuperEagle);
|
||||
}
|
||||
|
||||
private void InitializeFdsDiskMenu()
|
||||
|
|
|
@ -121,9 +121,9 @@
|
|||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>110, 17</value>
|
||||
<value>107, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>231, 17</value>
|
||||
<value>220, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -634,6 +634,20 @@ namespace Mesen.GUI
|
|||
{
|
||||
None = 0,
|
||||
NTSC = 1,
|
||||
xBRZ2x = 2,
|
||||
xBRZ3x = 3,
|
||||
xBRZ4x = 4,
|
||||
xBRZ5x = 5,
|
||||
xBRZ6x = 6,
|
||||
HQ2x = 7,
|
||||
HQ3x = 8,
|
||||
HQ4x = 9,
|
||||
Scale2x = 10,
|
||||
Scale3x = 11,
|
||||
Scale4x = 12,
|
||||
_2xSai = 13,
|
||||
Super2xSai = 14,
|
||||
SuperEagle = 15
|
||||
}
|
||||
|
||||
public enum VideoAspectRatio
|
||||
|
|
142
Utilities/HQX/common.h
Normal file
142
Utilities/HQX/common.h
Normal file
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright (C) 2003 Maxim Stepin ( maxst@hiend3d.com )
|
||||
*
|
||||
* Copyright (C) 2010 Cameron Zemek ( grom@zeminvaders.net)
|
||||
* Copyright (C) 2011 Francois Gannaz <mytskine@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __HQX_COMMON_H_
|
||||
#define __HQX_COMMON_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <complex>
|
||||
|
||||
#define MASK_2 0x0000FF00
|
||||
#define MASK_13 0x00FF00FF
|
||||
#define MASK_RGB 0x00FFFFFF
|
||||
#define MASK_ALPHA 0xFF000000
|
||||
|
||||
#define Ymask 0x00FF0000
|
||||
#define Umask 0x0000FF00
|
||||
#define Vmask 0x000000FF
|
||||
#define trY 0x00300000
|
||||
#define trU 0x00000700
|
||||
#define trV 0x00000006
|
||||
|
||||
/* RGB to YUV lookup table */
|
||||
extern uint32_t RGBtoYUV[16777216];
|
||||
|
||||
static inline uint32_t rgb_to_yuv(uint32_t c)
|
||||
{
|
||||
// Mask against MASK_RGB to discard the alpha channel
|
||||
return RGBtoYUV[MASK_RGB & c];
|
||||
}
|
||||
|
||||
/* Test if there is difference in color */
|
||||
static inline int yuv_diff(uint32_t yuv1, uint32_t yuv2) {
|
||||
return (( std::abs((int)((yuv1 & Ymask) - (yuv2 & Ymask))) > trY ) ||
|
||||
( std::abs((int)((yuv1 & Umask) - (yuv2 & Umask))) > trU ) ||
|
||||
( std::abs((int)((yuv1 & Vmask) - (yuv2 & Vmask))) > trV ) );
|
||||
}
|
||||
|
||||
static inline int Diff(uint32_t c1, uint32_t c2)
|
||||
{
|
||||
return yuv_diff(rgb_to_yuv(c1), rgb_to_yuv(c2));
|
||||
}
|
||||
|
||||
/* Interpolate functions */
|
||||
static inline uint32_t Interpolate_2(uint32_t c1, int w1, uint32_t c2, int w2, int s)
|
||||
{
|
||||
if (c1 == c2) {
|
||||
return c1;
|
||||
}
|
||||
return
|
||||
(((((c1 & MASK_ALPHA) >> 24) * w1 + ((c2 & MASK_ALPHA) >> 24) * w2) << (24-s)) & MASK_ALPHA) +
|
||||
((((c1 & MASK_2) * w1 + (c2 & MASK_2) * w2) >> s) & MASK_2) +
|
||||
((((c1 & MASK_13) * w1 + (c2 & MASK_13) * w2) >> s) & MASK_13);
|
||||
}
|
||||
|
||||
static inline uint32_t Interpolate_3(uint32_t c1, int w1, uint32_t c2, int w2, uint32_t c3, int w3, int s)
|
||||
{
|
||||
return
|
||||
(((((c1 & MASK_ALPHA) >> 24) * w1 + ((c2 & MASK_ALPHA) >> 24) * w2 + ((c3 & MASK_ALPHA) >> 24) * w3) << (24-s)) & MASK_ALPHA) +
|
||||
((((c1 & MASK_2) * w1 + (c2 & MASK_2) * w2 + (c3 & MASK_2) * w3) >> s) & MASK_2) +
|
||||
((((c1 & MASK_13) * w1 + (c2 & MASK_13) * w2 + (c3 & MASK_13) * w3) >> s) & MASK_13);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp1(uint32_t c1, uint32_t c2)
|
||||
{
|
||||
//(c1*3+c2) >> 2;
|
||||
return Interpolate_2(c1, 3, c2, 1, 2);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp2(uint32_t c1, uint32_t c2, uint32_t c3)
|
||||
{
|
||||
//(c1*2+c2+c3) >> 2;
|
||||
return Interpolate_3(c1, 2, c2, 1, c3, 1, 2);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp3(uint32_t c1, uint32_t c2)
|
||||
{
|
||||
//(c1*7+c2)/8;
|
||||
return Interpolate_2(c1, 7, c2, 1, 3);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp4(uint32_t c1, uint32_t c2, uint32_t c3)
|
||||
{
|
||||
//(c1*2+(c2+c3)*7)/16;
|
||||
return Interpolate_3(c1, 2, c2, 7, c3, 7, 4);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp5(uint32_t c1, uint32_t c2)
|
||||
{
|
||||
//(c1+c2) >> 1;
|
||||
return Interpolate_2(c1, 1, c2, 1, 1);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp6(uint32_t c1, uint32_t c2, uint32_t c3)
|
||||
{
|
||||
//(c1*5+c2*2+c3)/8;
|
||||
return Interpolate_3(c1, 5, c2, 2, c3, 1, 3);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp7(uint32_t c1, uint32_t c2, uint32_t c3)
|
||||
{
|
||||
//(c1*6+c2+c3)/8;
|
||||
return Interpolate_3(c1, 6, c2, 1, c3, 1, 3);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp8(uint32_t c1, uint32_t c2)
|
||||
{
|
||||
//(c1*5+c2*3)/8;
|
||||
return Interpolate_2(c1, 5, c2, 3, 3);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp9(uint32_t c1, uint32_t c2, uint32_t c3)
|
||||
{
|
||||
//(c1*2+(c2+c3)*3)/8;
|
||||
return Interpolate_3(c1, 2, c2, 3, c3, 3, 3);
|
||||
}
|
||||
|
||||
static inline uint32_t Interp10(uint32_t c1, uint32_t c2, uint32_t c3)
|
||||
{
|
||||
//(c1*14+c2+c3)/16;
|
||||
return Interpolate_3(c1, 14, c2, 1, c3, 1, 4);
|
||||
}
|
||||
|
||||
#endif
|
2811
Utilities/HQX/hq2x.cpp
Normal file
2811
Utilities/HQX/hq2x.cpp
Normal file
File diff suppressed because it is too large
Load diff
3789
Utilities/HQX/hq3x.cpp
Normal file
3789
Utilities/HQX/hq3x.cpp
Normal file
File diff suppressed because it is too large
Load diff
5235
Utilities/HQX/hq4x.cpp
Normal file
5235
Utilities/HQX/hq4x.cpp
Normal file
File diff suppressed because it is too large
Load diff
55
Utilities/HQX/hqx.h
Normal file
55
Utilities/HQX/hqx.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 2003 Maxim Stepin ( maxst@hiend3d.com )
|
||||
*
|
||||
* Copyright (C) 2010 Cameron Zemek ( grom@zeminvaders.net)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __HQX_H_
|
||||
#define __HQX_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined( __GNUC__ )
|
||||
#ifdef __MINGW32__
|
||||
#define HQX_CALLCONV __stdcall
|
||||
#else
|
||||
#define HQX_CALLCONV
|
||||
#endif
|
||||
#else
|
||||
#define HQX_CALLCONV
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef DLL_EXPORT
|
||||
#define HQX_API __declspec(dllexport)
|
||||
#else
|
||||
#define HQX_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define HQX_API
|
||||
#endif
|
||||
|
||||
void HQX_CALLCONV hqxInit(void);
|
||||
void HQX_CALLCONV hq2x_32( uint32_t * src, uint32_t * dest, int width, int height );
|
||||
void HQX_CALLCONV hq3x_32( uint32_t * src, uint32_t * dest, int width, int height );
|
||||
void HQX_CALLCONV hq4x_32( uint32_t * src, uint32_t * dest, int width, int height );
|
||||
|
||||
void HQX_CALLCONV hq2x_32_rb( uint32_t * src, uint32_t src_rowBytes, uint32_t * dest, uint32_t dest_rowBytes, int width, int height );
|
||||
void HQX_CALLCONV hq3x_32_rb( uint32_t * src, uint32_t src_rowBytes, uint32_t * dest, uint32_t dest_rowBytes, int width, int height );
|
||||
void HQX_CALLCONV hq4x_32_rb( uint32_t * src, uint32_t src_rowBytes, uint32_t * dest, uint32_t dest_rowBytes, int width, int height );
|
||||
|
||||
#endif
|
40
Utilities/HQX/init.cpp
Normal file
40
Utilities/HQX/init.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Cameron Zemek ( grom@zeminvaders.net)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "../stdafx.h"
|
||||
#include <stdint.h>
|
||||
#include "hqx.h"
|
||||
|
||||
uint32_t RGBtoYUV[16777216];
|
||||
uint32_t YUV1, YUV2;
|
||||
|
||||
void HQX_CALLCONV hqxInit(void)
|
||||
{
|
||||
/* Initalize RGB to YUV lookup table */
|
||||
uint32_t c, r, g, b, y, u, v;
|
||||
for (c = 0; c < 16777215; c++) {
|
||||
r = (c & 0xFF0000) >> 16;
|
||||
g = (c & 0x00FF00) >> 8;
|
||||
b = c & 0x0000FF;
|
||||
y = (uint32_t)(0.299*r + 0.587*g + 0.114*b);
|
||||
u = (uint32_t)(-0.169*r - 0.331*g + 0.5*b) + 128;
|
||||
v = (uint32_t)(0.5*r - 0.419*g - 0.081*b) + 128;
|
||||
RGBtoYUV[c] = (y << 16) + (u << 8) + v;
|
||||
}
|
||||
}
|
164
Utilities/KreedSaiEagle/2xSai.cpp
Normal file
164
Utilities/KreedSaiEagle/2xSai.cpp
Normal file
|
@ -0,0 +1,164 @@
|
|||
/* This is a heavily modified version of the file used in RetroArch */
|
||||
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "../stdafx.h"
|
||||
|
||||
#define twoxsai_interpolate_xrgb8888(A, B) ((((A) & 0xFEFEFEFE) >> 1) + (((B) & 0xFEFEFEFE) >> 1) + ((A) & (B) & 0x01010101))
|
||||
|
||||
#define twoxsai_interpolate2_xrgb8888(A, B, C, D) ((((A) & 0xFCFCFCFC) >> 2) + (((B) & 0xFCFCFCFC) >> 2) + (((C) & 0xFCFCFCFC) >> 2) + (((D) & 0xFCFCFCFC) >> 2) + (((((A) & 0x03030303) + ((B) & 0x03030303) + ((C) & 0x03030303) + ((D) & 0x03030303)) >> 2) & 0x03030303))
|
||||
|
||||
#define twoxsai_interpolate_rgb565(A, B) ((((A) & 0xF7DE) >> 1) + (((B) & 0xF7DE) >> 1) + ((A) & (B) & 0x0821))
|
||||
|
||||
#define twoxsai_interpolate2_rgb565(A, B, C, D) ((((A) & 0xE79C) >> 2) + (((B) & 0xE79C) >> 2) + (((C) & 0xE79C) >> 2) + (((D) & 0xE79C) >> 2) + (((((A) & 0x1863) + ((B) & 0x1863) + ((C) & 0x1863) + ((D) & 0x1863)) >> 2) & 0x1863))
|
||||
|
||||
#define twoxsai_interpolate_4444(A, B) (((A & 0xEEEE) >> 1) + ((B & 0xEEEE) >> 1) + (A & B & 0x1111))
|
||||
#define twoxsai_interpolate2_4444(A, B, C, D) (((A & 0xCCCC) >> 2) + ((B & 0xCCCC) >> 2) + ((C & 0xCCCC) >> 2) + ((D & 0xCCCC) >> 2) + ((((A & 0x3333) + (B & 0x3333) + (C & 0x3333) + (D & 0x3333)) >> 2) & 0x3333))
|
||||
|
||||
#define twoxsai_result(A, B, C, D) (((A) != (C) || (A) != (D)) - ((B) != (C) || (B) != (D)));
|
||||
|
||||
#define twoxsai_declare_variables(typename_t, in, nextline) \
|
||||
typename_t product, product1, product2; \
|
||||
typename_t colorI = *(in - nextline - 1); \
|
||||
typename_t colorE = *(in - nextline + 0); \
|
||||
typename_t colorF = *(in - nextline + 1); \
|
||||
typename_t colorJ = *(in - nextline + 2); \
|
||||
typename_t colorG = *(in - 1); \
|
||||
typename_t colorA = *(in + 0); \
|
||||
typename_t colorB = *(in + 1); \
|
||||
typename_t colorK = *(in + 2); \
|
||||
typename_t colorH = *(in + nextline - 1); \
|
||||
typename_t colorC = *(in + nextline + 0); \
|
||||
typename_t colorD = *(in + nextline + 1); \
|
||||
typename_t colorL = *(in + nextline + 2); \
|
||||
typename_t colorM = *(in + nextline + nextline - 1); \
|
||||
typename_t colorN = *(in + nextline + nextline + 0); \
|
||||
typename_t colorO = *(in + nextline + nextline + 1);
|
||||
|
||||
#ifndef twoxsai_function
|
||||
#define twoxsai_function(result_cb, interpolate_cb, interpolate2_cb) \
|
||||
if (colorA == colorD && colorB != colorC) \
|
||||
{ \
|
||||
if ((colorA == colorE && colorB == colorL) || (colorA == colorC && colorA == colorF && colorB != colorE && colorB == colorJ)) \
|
||||
product = colorA; \
|
||||
else \
|
||||
{ \
|
||||
product = interpolate_cb(colorA, colorB); \
|
||||
} \
|
||||
if ((colorA == colorG && colorC == colorO) || (colorA == colorB && colorA == colorH && colorG != colorC && colorC == colorM)) \
|
||||
product1 = colorA; \
|
||||
else \
|
||||
{ \
|
||||
product1 = interpolate_cb(colorA, colorC); \
|
||||
} \
|
||||
product2 = colorA; \
|
||||
} else if (colorB == colorC && colorA != colorD) \
|
||||
{ \
|
||||
if ((colorB == colorF && colorA == colorH) || (colorB == colorE && colorB == colorD && colorA != colorF && colorA == colorI)) \
|
||||
product = colorB; \
|
||||
else \
|
||||
{ \
|
||||
product = interpolate_cb(colorA, colorB); \
|
||||
} \
|
||||
if ((colorC == colorH && colorA == colorF) || (colorC == colorG && colorC == colorD && colorA != colorH && colorA == colorI)) \
|
||||
product1 = colorC; \
|
||||
else \
|
||||
{ \
|
||||
product1 = interpolate_cb(colorA, colorC); \
|
||||
} \
|
||||
product2 = colorB; \
|
||||
} \
|
||||
else if (colorA == colorD && colorB == colorC) \
|
||||
{ \
|
||||
if (colorA == colorB) \
|
||||
{ \
|
||||
product = colorA; \
|
||||
product1 = colorA; \
|
||||
product2 = colorA; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int r = 0; \
|
||||
product1 = interpolate_cb(colorA, colorC); \
|
||||
product = interpolate_cb(colorA, colorB); \
|
||||
r += result_cb(colorA, colorB, colorG, colorE); \
|
||||
r += result_cb(colorB, colorA, colorK, colorF); \
|
||||
r += result_cb(colorB, colorA, colorH, colorN); \
|
||||
r += result_cb(colorA, colorB, colorL, colorO); \
|
||||
if (r > 0) \
|
||||
product2 = colorA; \
|
||||
else if (r < 0) \
|
||||
product2 = colorB; \
|
||||
else \
|
||||
{ \
|
||||
product2 = interpolate2_cb(colorA, colorB, colorC, colorD); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
product2 = interpolate2_cb(colorA, colorB, colorC, colorD); \
|
||||
if (colorA == colorC && colorA == colorF && colorB != colorE && colorB == colorJ) \
|
||||
product = colorA; \
|
||||
else if (colorB == colorE && colorB == colorD && colorA != colorF && colorA == colorI) \
|
||||
product = colorB; \
|
||||
else \
|
||||
{ \
|
||||
product = interpolate_cb(colorA, colorB); \
|
||||
} \
|
||||
if (colorA == colorB && colorA == colorH && colorG != colorC && colorC == colorM) \
|
||||
product1 = colorA; \
|
||||
else if (colorC == colorG && colorC == colorD && colorA != colorH && colorA == colorI) \
|
||||
product1 = colorC; \
|
||||
else \
|
||||
{ \
|
||||
product1 = interpolate_cb(colorA, colorC); \
|
||||
} \
|
||||
} \
|
||||
out[0] = colorA; \
|
||||
out[1] = product; \
|
||||
out[dst_stride] = product1; \
|
||||
out[dst_stride + 1] = product2; \
|
||||
++in; \
|
||||
out += 2
|
||||
#endif
|
||||
|
||||
void twoxsai_generic_xrgb8888(unsigned width, unsigned height, uint32_t *src, unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
||||
{
|
||||
unsigned finish;
|
||||
for(; height; height--) {
|
||||
uint32_t *in = (uint32_t*)src;
|
||||
uint32_t *out = (uint32_t*)dst;
|
||||
|
||||
for(finish = width; finish; finish -= 1) {
|
||||
twoxsai_declare_variables(uint32_t, in, (height > 1 ? src_stride : 0));
|
||||
|
||||
/*
|
||||
* Map of the pixels: I|E F|J
|
||||
* G|A B|K
|
||||
* H|C D|L
|
||||
* M|N O|P
|
||||
*/
|
||||
|
||||
twoxsai_function(twoxsai_result, twoxsai_interpolate_xrgb8888, twoxsai_interpolate2_xrgb8888);
|
||||
}
|
||||
|
||||
src += src_stride;
|
||||
dst += 2 * dst_stride;
|
||||
}
|
||||
}
|
7
Utilities/KreedSaiEagle/SaiEagle.h
Normal file
7
Utilities/KreedSaiEagle/SaiEagle.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
#include "../stdafx.h"
|
||||
|
||||
extern void supertwoxsai_generic_xrgb8888(unsigned width, unsigned height, uint32_t *src, unsigned src_stride, uint32_t *dst, unsigned dst_stride);
|
||||
extern void twoxsai_generic_xrgb8888(unsigned width, unsigned height, uint32_t *src, unsigned src_stride, uint32_t *dst, unsigned dst_stride);
|
||||
extern void supereagle_generic_xrgb8888(unsigned width, unsigned height, uint32_t *src, unsigned src_stride, uint32_t *dst, unsigned dst_stride);
|
||||
|
138
Utilities/KreedSaiEagle/Super2xSai.cpp
Normal file
138
Utilities/KreedSaiEagle/Super2xSai.cpp
Normal file
|
@ -0,0 +1,138 @@
|
|||
/* This is a heavily modified version of the file used in RetroArch */
|
||||
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2010-2014 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "../stdafx.h"
|
||||
|
||||
#define supertwoxsai_interpolate_xrgb8888(A, B) ((((A) & 0xFEFEFEFE) >> 1) + (((B) & 0xFEFEFEFE) >> 1) + ((A) & (B) & 0x01010101))
|
||||
|
||||
#define supertwoxsai_interpolate2_xrgb8888(A, B, C, D) ((((A) & 0xFCFCFCFC) >> 2) + (((B) & 0xFCFCFCFC) >> 2) + (((C) & 0xFCFCFCFC) >> 2) + (((D) & 0xFCFCFCFC) >> 2) + (((((A) & 0x03030303) + ((B) & 0x03030303) + ((C) & 0x03030303) + ((D) & 0x03030303)) >> 2) & 0x03030303))
|
||||
|
||||
#define supertwoxsai_interpolate_rgb565(A, B) ((((A) & 0xF7DE) >> 1) + (((B) & 0xF7DE) >> 1) + ((A) & (B) & 0x0821));
|
||||
|
||||
#define supertwoxsai_interpolate2_rgb565(A, B, C, D) ((((A) & 0xE79C) >> 2) + (((B) & 0xE79C) >> 2) + (((C) & 0xE79C) >> 2) + (((D) & 0xE79C) >> 2) + (((((A) & 0x1863) + ((B) & 0x1863) + ((C) & 0x1863) + ((D) & 0x1863)) >> 2) & 0x1863))
|
||||
|
||||
#define supertwoxsai_result(A, B, C, D) (((A) != (C) || (A) != (D)) - ((B) != (C) || (B) != (D)))
|
||||
|
||||
#ifndef supertwoxsai_declare_variables
|
||||
#define supertwoxsai_declare_variables(typename_t, in, nextline) \
|
||||
typename_t product1a, product1b, product2a, product2b; \
|
||||
const typename_t colorB0 = *(in - nextline - 1); \
|
||||
const typename_t colorB1 = *(in - nextline + 0); \
|
||||
const typename_t colorB2 = *(in - nextline + 1); \
|
||||
const typename_t colorB3 = *(in - nextline + 2); \
|
||||
const typename_t color4 = *(in - 1); \
|
||||
const typename_t color5 = *(in + 0); \
|
||||
const typename_t color6 = *(in + 1); \
|
||||
const typename_t colorS2 = *(in + 2); \
|
||||
const typename_t color1 = *(in + nextline - 1); \
|
||||
const typename_t color2 = *(in + nextline + 0); \
|
||||
const typename_t color3 = *(in + nextline + 1); \
|
||||
const typename_t colorS1 = *(in + nextline + 2); \
|
||||
const typename_t colorA0 = *(in + nextline + nextline - 1); \
|
||||
const typename_t colorA1 = *(in + nextline + nextline + 0); \
|
||||
const typename_t colorA2 = *(in + nextline + nextline + 1); \
|
||||
const typename_t colorA3 = *(in + nextline + nextline + 2)
|
||||
#endif
|
||||
|
||||
#ifndef supertwoxsai_function
|
||||
#define supertwoxsai_function(result_cb, interpolate_cb, interpolate2_cb) \
|
||||
if (color2 == color6 && color5 != color3) \
|
||||
product2b = product1b = color2; \
|
||||
else if (color5 == color3 && color2 != color6) \
|
||||
product2b = product1b = color5; \
|
||||
else if (color5 == color3 && color2 == color6) \
|
||||
{ \
|
||||
int r = 0; \
|
||||
r += result_cb(color6, color5, color1, colorA1); \
|
||||
r += result_cb(color6, color5, color4, colorB1); \
|
||||
r += result_cb(color6, color5, colorA2, colorS1); \
|
||||
r += result_cb(color6, color5, colorB2, colorS2); \
|
||||
if (r > 0) \
|
||||
product2b = product1b = color6; \
|
||||
else if (r < 0) \
|
||||
product2b = product1b = color5; \
|
||||
else \
|
||||
product2b = product1b = interpolate_cb(color5, color6); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0) \
|
||||
product2b = interpolate2_cb(color3, color3, color3, color2); \
|
||||
else if ((color5 == color2 && color2 == colorA2) & (colorA1 != color3 && color2 != colorA3)) \
|
||||
product2b = interpolate2_cb(color2, color2, color2, color3); \
|
||||
else \
|
||||
product2b = interpolate_cb(color2, color3); \
|
||||
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0) \
|
||||
product1b = interpolate2_cb(color6, color6, color6, color5); \
|
||||
else if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3) \
|
||||
product1b = interpolate2_cb(color6, color5, color5, color5); \
|
||||
else \
|
||||
product1b = interpolate_cb(color5, color6); \
|
||||
} \
|
||||
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2) \
|
||||
{ \
|
||||
product2a = interpolate_cb(color2, color5); \
|
||||
} \
|
||||
else if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0) \
|
||||
{ \
|
||||
product2a = interpolate_cb(color2, color5); \
|
||||
} \
|
||||
else \
|
||||
product2a = color2; \
|
||||
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2) \
|
||||
{ \
|
||||
product1a = interpolate_cb(color2, color5); \
|
||||
} \
|
||||
else if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0) \
|
||||
{ \
|
||||
product1a = interpolate_cb(color2, color5); \
|
||||
} \
|
||||
else \
|
||||
product1a = color5; \
|
||||
out[0] = product1a; \
|
||||
out[1] = product1b; \
|
||||
out[dst_stride] = product2a; \
|
||||
out[dst_stride + 1] = product2b; \
|
||||
++in; \
|
||||
out += 2
|
||||
#endif
|
||||
|
||||
void supertwoxsai_generic_xrgb8888(unsigned width, unsigned height, uint32_t *src, unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
||||
{
|
||||
unsigned finish;
|
||||
for(; height; height--) {
|
||||
uint32_t *in = (uint32_t*)src;
|
||||
uint32_t *out = (uint32_t*)dst;
|
||||
|
||||
for(finish = width; finish; finish -= 1) {
|
||||
supertwoxsai_declare_variables(uint32_t, in, (height > 1 ? src_stride : 0));
|
||||
|
||||
//--------------------------- B1 B2
|
||||
// 4 5 6 S2
|
||||
// 1 2 3 S1
|
||||
// A1 A2
|
||||
//--------------------------------------
|
||||
|
||||
supertwoxsai_function(supertwoxsai_result, supertwoxsai_interpolate_xrgb8888, supertwoxsai_interpolate2_xrgb8888);
|
||||
}
|
||||
|
||||
src += src_stride;
|
||||
dst += 2 * dst_stride;
|
||||
}
|
||||
}
|
149
Utilities/KreedSaiEagle/SuperEagle.cpp
Normal file
149
Utilities/KreedSaiEagle/SuperEagle.cpp
Normal file
|
@ -0,0 +1,149 @@
|
|||
/* This is a heavily modified version of the file used in RetroArch */
|
||||
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "../stdafx.h"
|
||||
|
||||
#define supereagle_interpolate_xrgb8888(A, B) ((((A) & 0xFEFEFEFE) >> 1) + (((B) & 0xFEFEFEFE) >> 1) + ((A) & (B) & 0x01010101))
|
||||
|
||||
#define supereagle_interpolate2_xrgb8888(A, B, C, D) ((((A) & 0xFCFCFCFC) >> 2) + (((B) & 0xFCFCFCFC) >> 2) + (((C) & 0xFCFCFCFC) >> 2) + (((D) & 0xFCFCFCFC) >> 2) + (((((A) & 0x03030303) + ((B) & 0x03030303) + ((C) & 0x03030303) + ((D) & 0x03030303)) >> 2) & 0x03030303))
|
||||
|
||||
#define supereagle_interpolate_rgb565(A, B) ((((A) & 0xF7DE) >> 1) + (((B) & 0xF7DE) >> 1) + ((A) & (B) & 0x0821));
|
||||
|
||||
#define supereagle_interpolate2_rgb565(A, B, C, D) ((((A) & 0xE79C) >> 2) + (((B) & 0xE79C) >> 2) + (((C) & 0xE79C) >> 2) + (((D) & 0xE79C) >> 2) + (((((A) & 0x1863) + ((B) & 0x1863) + ((C) & 0x1863) + ((D) & 0x1863)) >> 2) & 0x1863))
|
||||
|
||||
#define supereagle_result(A, B, C, D) (((A) != (C) || (A) != (D)) - ((B) != (C) || (B) != (D)));
|
||||
|
||||
#define supereagle_declare_variables(typename_t, in, nextline) \
|
||||
typename_t product1a, product1b, product2a, product2b; \
|
||||
const typename_t colorB1 = *(in - nextline + 0); \
|
||||
const typename_t colorB2 = *(in - nextline + 1); \
|
||||
const typename_t color4 = *(in - 1); \
|
||||
const typename_t color5 = *(in + 0); \
|
||||
const typename_t color6 = *(in + 1); \
|
||||
const typename_t colorS2 = *(in + 2); \
|
||||
const typename_t color1 = *(in + nextline - 1); \
|
||||
const typename_t color2 = *(in + nextline + 0); \
|
||||
const typename_t color3 = *(in + nextline + 1); \
|
||||
const typename_t colorS1 = *(in + nextline + 2); \
|
||||
const typename_t colorA1 = *(in + nextline + nextline + 0); \
|
||||
const typename_t colorA2 = *(in + nextline + nextline + 1)
|
||||
|
||||
#ifndef supereagle_function
|
||||
#define supereagle_function(result_cb, interpolate_cb, interpolate2_cb) \
|
||||
if (color2 == color6 && color5 != color3) \
|
||||
{ \
|
||||
product1b = product2a = color2; \
|
||||
if ((color1 == color2) || (color6 == colorB2)) \
|
||||
{ \
|
||||
product1a = interpolate_cb(color2, color5); \
|
||||
product1a = interpolate_cb(color2, product1a); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
product1a = interpolate_cb(color5, color6); \
|
||||
} \
|
||||
if ((color6 == colorS2) || (color2 == colorA1)) \
|
||||
{ \
|
||||
product2b = interpolate_cb(color2, color3); \
|
||||
product2b = interpolate_cb(color2, product2b); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
product2b = interpolate_cb(color2, color3); \
|
||||
} \
|
||||
} \
|
||||
else if (color5 == color3 && color2 != color6) \
|
||||
{ \
|
||||
product2b = product1a = color5; \
|
||||
if ((colorB1 == color5) || (color3 == colorS1)) \
|
||||
{ \
|
||||
product1b = interpolate_cb(color5, color6); \
|
||||
product1b = interpolate_cb(color5, product1b); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
product1b = interpolate_cb(color5, color6); \
|
||||
} \
|
||||
if ((color3 == colorA2) || (color4 == color5)) \
|
||||
{ \
|
||||
product2a = interpolate_cb(color5, color2); \
|
||||
product2a = interpolate_cb(color5, product2a); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
product2a = interpolate_cb(color2, color3); \
|
||||
} \
|
||||
} \
|
||||
else if (color5 == color3 && color2 == color6) \
|
||||
{ \
|
||||
int r = 0; \
|
||||
r += supereagle_result(color6, color5, color1, colorA1); \
|
||||
r += supereagle_result(color6, color5, color4, colorB1); \
|
||||
r += supereagle_result(color6, color5, colorA2, colorS1); \
|
||||
r += supereagle_result(color6, color5, colorB2, colorS2); \
|
||||
if (r > 0) \
|
||||
{ \
|
||||
product1b = product2a = color2; \
|
||||
product1a = product2b = interpolate_cb(color5, color6); \
|
||||
} \
|
||||
else if (r < 0) \
|
||||
{ \
|
||||
product2b = product1a = color5; \
|
||||
product1b = product2a = interpolate_cb(color5, color6); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
product2b = product1a = color5; \
|
||||
product1b = product2a = color2; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
product2b = product1a = interpolate_cb(color2, color6); \
|
||||
product2b = interpolate2_cb(color3, color3, color3, product2b); \
|
||||
product1a = interpolate2_cb(color5, color5, color5, product1a); \
|
||||
product2a = product1b = interpolate_cb(color5, color3); \
|
||||
product2a = interpolate2_cb(color2, color2, color2, product2a); \
|
||||
product1b = interpolate2_cb(color6, color6, color6, product1b); \
|
||||
} \
|
||||
out[0] = product1a; \
|
||||
out[1] = product1b; \
|
||||
out[dst_stride] = product2a; \
|
||||
out[dst_stride + 1] = product2b; \
|
||||
++in; \
|
||||
out += 2
|
||||
#endif
|
||||
|
||||
void supereagle_generic_xrgb8888(unsigned width, unsigned height, uint32_t *src, unsigned src_stride, uint32_t *dst, unsigned dst_stride)
|
||||
{
|
||||
unsigned finish;
|
||||
for(; height; height--) {
|
||||
uint32_t *in = (uint32_t*)src;
|
||||
uint32_t *out = (uint32_t*)dst;
|
||||
|
||||
for(finish = width; finish; finish -= 1) {
|
||||
supereagle_declare_variables(uint32_t, in, (height > 1 ? src_stride : 0));
|
||||
|
||||
supereagle_function(supereagle_result, supereagle_interpolate_xrgb8888, supereagle_interpolate2_xrgb8888);
|
||||
}
|
||||
|
||||
src += src_stride;
|
||||
dst += 2 * dst_stride;
|
||||
}
|
||||
}
|
662
Utilities/Scale2x/scale2x.cpp
Normal file
662
Utilities/Scale2x/scale2x.cpp
Normal file
|
@ -0,0 +1,662 @@
|
|||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains a C and MMX implementation of the Scale2x effect.
|
||||
*
|
||||
* You can find an high level description of the effect at :
|
||||
*
|
||||
* http://www.scale2x.it/
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "../stdafx.h"
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "scale2x.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/***************************************************************************/
|
||||
/* Scale2x C implementation */
|
||||
|
||||
/**
|
||||
* Define the macro USE_SCALE_RANDOMWRITE to enable
|
||||
* an optimized version which writes memory in random order.
|
||||
* This version is a little faster if you write in system memory.
|
||||
* But it's a lot slower if you write in video memory.
|
||||
* So, enable it only if you are sure to never write directly in video memory.
|
||||
*/
|
||||
/* #define USE_SCALE_RANDOMWRITE */
|
||||
|
||||
static inline void scale2x_8_def_whole(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst0[0] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
dst1[0] = src1[0] == src2[0] ? src2[0] : src1[0];
|
||||
dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 2;
|
||||
dst1 += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0];
|
||||
dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 2;
|
||||
dst1 += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst0[1] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0];
|
||||
dst1[1] = src1[0] == src2[0] ? src2[0] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale2x_8_def_border(scale2x_uint8* dst, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale2x_8_def_center(scale2x_uint8* dst, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale2x_16_def_whole(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst0[0] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
dst1[0] = src1[0] == src2[0] ? src2[0] : src1[0];
|
||||
dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 2;
|
||||
dst1 += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0];
|
||||
dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 2;
|
||||
dst1 += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst0[1] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0];
|
||||
dst1[1] = src1[0] == src2[0] ? src2[0] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale2x_16_def_border(scale2x_uint16* dst, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale2x_16_def_center(scale2x_uint16* dst, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale2x_32_def_whole(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst0[0] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
dst1[0] = src1[0] == src2[0] ? src2[0] : src1[0];
|
||||
dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 2;
|
||||
dst1 += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0];
|
||||
dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 2;
|
||||
dst1 += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst0[1] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0];
|
||||
dst1[1] = src1[0] == src2[0] ? src2[0] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale2x_32_def_border(scale2x_uint32* dst, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[1] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0];
|
||||
dst[1] = src1[0] == src0[0] ? src0[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale2x_32_def_center(scale2x_uint32* dst, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 2;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2 a row of pixels of 8 bits.
|
||||
* The function is implemented in C.
|
||||
* The pixels over the left and right borders are assumed of the same color of
|
||||
* the pixels on the border.
|
||||
* Note that the implementation is optimized to write data sequentially to
|
||||
* maximize the bandwidth on video memory.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, double length in pixels.
|
||||
* \param dst1 Second destination row, double length in pixels.
|
||||
*/
|
||||
void scale2x_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale2x_8_def_whole(dst0, dst1, src0, src1, src2, count);
|
||||
#else
|
||||
scale2x_8_def_border(dst0, src0, src1, src2, count);
|
||||
scale2x_8_def_border(dst1, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2 a row of pixels of 16 bits.
|
||||
* This function operates like scale2x_8_def() but for 16 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, double length in pixels.
|
||||
* \param dst1 Second destination row, double length in pixels.
|
||||
*/
|
||||
void scale2x_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale2x_16_def_whole(dst0, dst1, src0, src1, src2, count);
|
||||
#else
|
||||
scale2x_16_def_border(dst0, src0, src1, src2, count);
|
||||
scale2x_16_def_border(dst1, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2 a row of pixels of 32 bits.
|
||||
* This function operates like scale2x_8_def() but for 32 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, double length in pixels.
|
||||
* \param dst1 Second destination row, double length in pixels.
|
||||
*/
|
||||
void scale2x_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale2x_32_def_whole(dst0, dst1, src0, src1, src2, count);
|
||||
#else
|
||||
scale2x_32_def_border(dst0, src0, src1, src2, count);
|
||||
scale2x_32_def_border(dst1, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2x3 a row of pixels of 8 bits.
|
||||
* \note Like scale2x_8_def();
|
||||
*/
|
||||
void scale2x3_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale2x_8_def_whole(dst0, dst2, src0, src1, src2, count);
|
||||
scale2x_8_def_center(dst1, src0, src1, src2, count);
|
||||
#else
|
||||
scale2x_8_def_border(dst0, src0, src1, src2, count);
|
||||
scale2x_8_def_center(dst1, src0, src1, src2, count);
|
||||
scale2x_8_def_border(dst2, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2x3 a row of pixels of 16 bits.
|
||||
* \note Like scale2x_16_def();
|
||||
*/
|
||||
void scale2x3_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale2x_16_def_whole(dst0, dst2, src0, src1, src2, count);
|
||||
scale2x_16_def_center(dst1, src0, src1, src2, count);
|
||||
#else
|
||||
scale2x_16_def_border(dst0, src0, src1, src2, count);
|
||||
scale2x_16_def_center(dst1, src0, src1, src2, count);
|
||||
scale2x_16_def_border(dst2, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2x3 a row of pixels of 32 bits.
|
||||
* \note Like scale2x_32_def();
|
||||
*/
|
||||
void scale2x3_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale2x_32_def_whole(dst0, dst2, src0, src1, src2, count);
|
||||
scale2x_32_def_center(dst1, src0, src1, src2, count);
|
||||
#else
|
||||
scale2x_32_def_border(dst0, src0, src1, src2, count);
|
||||
scale2x_32_def_center(dst1, src0, src1, src2, count);
|
||||
scale2x_32_def_border(dst2, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2x4 a row of pixels of 8 bits.
|
||||
* \note Like scale2x_8_def();
|
||||
*/
|
||||
void scale2x4_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale2x_8_def_whole(dst0, dst3, src0, src1, src2, count);
|
||||
scale2x_8_def_center(dst1, src0, src1, src2, count);
|
||||
scale2x_8_def_center(dst2, src0, src1, src2, count);
|
||||
#else
|
||||
scale2x_8_def_border(dst0, src0, src1, src2, count);
|
||||
scale2x_8_def_center(dst1, src0, src1, src2, count);
|
||||
scale2x_8_def_center(dst2, src0, src1, src2, count);
|
||||
scale2x_8_def_border(dst3, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2x4 a row of pixels of 16 bits.
|
||||
* \note Like scale2x_16_def();
|
||||
*/
|
||||
void scale2x4_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale2x_16_def_whole(dst0, dst3, src0, src1, src2, count);
|
||||
scale2x_16_def_center(dst1, src0, src1, src2, count);
|
||||
scale2x_16_def_center(dst2, src0, src1, src2, count);
|
||||
#else
|
||||
scale2x_16_def_border(dst0, src0, src1, src2, count);
|
||||
scale2x_16_def_center(dst1, src0, src1, src2, count);
|
||||
scale2x_16_def_center(dst2, src0, src1, src2, count);
|
||||
scale2x_16_def_border(dst3, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 2x4 a row of pixels of 32 bits.
|
||||
* \note Like scale2x_32_def();
|
||||
*/
|
||||
void scale2x4_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale2x_32_def_whole(dst0, dst3, src0, src1, src2, count);
|
||||
scale2x_32_def_center(dst1, src0, src1, src2, count);
|
||||
scale2x_32_def_center(dst2, src0, src1, src2, count);
|
||||
#else
|
||||
scale2x_32_def_border(dst0, src0, src1, src2, count);
|
||||
scale2x_32_def_center(dst1, src0, src1, src2, count);
|
||||
scale2x_32_def_center(dst2, src0, src1, src2, count);
|
||||
scale2x_32_def_border(dst3, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
64
Utilities/Scale2x/scale2x.h
Normal file
64
Utilities/Scale2x/scale2x.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __SCALE2X_H
|
||||
#define __SCALE2X_H
|
||||
|
||||
typedef unsigned char scale2x_uint8;
|
||||
typedef unsigned short scale2x_uint16;
|
||||
typedef unsigned scale2x_uint32;
|
||||
|
||||
void scale2x_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
|
||||
void scale2x_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
|
||||
void scale2x_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
|
||||
|
||||
void scale2x3_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
|
||||
void scale2x3_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
|
||||
void scale2x3_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
|
||||
|
||||
void scale2x4_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
|
||||
void scale2x4_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
|
||||
void scale2x4_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
|
||||
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
|
||||
void scale2x_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
|
||||
void scale2x_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
|
||||
void scale2x_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
|
||||
|
||||
void scale2x3_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
|
||||
void scale2x3_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
|
||||
void scale2x3_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
|
||||
|
||||
void scale2x4_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
|
||||
void scale2x4_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
|
||||
void scale2x4_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
|
||||
|
||||
/**
|
||||
* End the use of the MMX instructions.
|
||||
* This function must be called before using any floating-point operations.
|
||||
*/
|
||||
static inline void scale2x_mmx_emms(void)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"emms"
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
697
Utilities/Scale2x/scale3x.cpp
Normal file
697
Utilities/Scale2x/scale3x.cpp
Normal file
|
@ -0,0 +1,697 @@
|
|||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains a C and MMX implementation of the Scale2x effect.
|
||||
*
|
||||
* You can find an high level description of the effect at :
|
||||
*
|
||||
* http://www.scale2x.it/
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "../stdafx.h"
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "scale3x.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/***************************************************************************/
|
||||
/* Scale3x C implementation */
|
||||
|
||||
/**
|
||||
* Define the macro USE_SCALE_RANDOMWRITE to enable
|
||||
* an optimized version which writes memory in random order.
|
||||
* This version is a little faster if you write in system memory.
|
||||
* But it's a lot slower if you write in video memory.
|
||||
* So, enable it only if you are sure to never write directly in video memory.
|
||||
*/
|
||||
/* #define USE_SCALE_RANDOMWRITE */
|
||||
|
||||
static inline void scale3x_8_def_whole(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0];
|
||||
dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
dst1[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = (src1[0] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[0]) ? src2[0] : src1[0];
|
||||
dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = src1[0];
|
||||
dst2[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 3;
|
||||
dst1 += 3;
|
||||
dst2 += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0];
|
||||
dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0];
|
||||
dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = src1[0];
|
||||
dst2[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 3;
|
||||
dst1 += 3;
|
||||
dst2 += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0];
|
||||
dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0];
|
||||
dst2[2] = src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = src1[0];
|
||||
dst2[2] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale3x_8_def_border(scale3x_uint8* dst, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale3x_8_def_center(scale3x_uint8* dst, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale3x_16_def_whole(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* dst2, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0];
|
||||
dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
dst1[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = (src1[0] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[0]) ? src2[0] : src1[0];
|
||||
dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = src1[0];
|
||||
dst2[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 3;
|
||||
dst1 += 3;
|
||||
dst2 += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0];
|
||||
dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0];
|
||||
dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = src1[0];
|
||||
dst2[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 3;
|
||||
dst1 += 3;
|
||||
dst2 += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0];
|
||||
dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0];
|
||||
dst2[2] = src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = src1[0];
|
||||
dst2[2] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale3x_16_def_border(scale3x_uint16* dst, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale3x_16_def_center(scale3x_uint16* dst, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale3x_32_def_whole(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0];
|
||||
dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
dst1[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = (src1[0] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[0]) ? src2[0] : src1[0];
|
||||
dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = src1[0];
|
||||
dst2[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 3;
|
||||
dst1 += 3;
|
||||
dst2 += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0];
|
||||
dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0];
|
||||
dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = src1[0];
|
||||
dst2[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst0 += 3;
|
||||
dst1 += 3;
|
||||
dst2 += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0];
|
||||
dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0];
|
||||
dst2[2] = src1[0];
|
||||
} else {
|
||||
dst0[0] = src1[0];
|
||||
dst0[1] = src1[0];
|
||||
dst0[2] = src1[0];
|
||||
dst1[0] = src1[0];
|
||||
dst1[1] = src1[0];
|
||||
dst1[2] = src1[0];
|
||||
dst2[0] = src1[0];
|
||||
dst2[1] = src1[0];
|
||||
dst2[2] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale3x_32_def_border(scale3x_uint32* dst, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[1] == src0[0] ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0];
|
||||
dst[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0];
|
||||
dst[2] = src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void scale3x_32_def_center(scale3x_uint32* dst, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count)
|
||||
{
|
||||
assert(count >= 2);
|
||||
|
||||
/* first pixel */
|
||||
if (src0[0] != src2[0] && src1[0] != src1[1]) {
|
||||
dst[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
|
||||
/* central pixels */
|
||||
count -= 2;
|
||||
while (count) {
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[1]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
|
||||
++src0;
|
||||
++src1;
|
||||
++src2;
|
||||
dst += 3;
|
||||
--count;
|
||||
}
|
||||
|
||||
/* last pixel */
|
||||
if (src0[0] != src2[0] && src1[-1] != src1[0]) {
|
||||
dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0];
|
||||
} else {
|
||||
dst[0] = src1[0];
|
||||
dst[1] = src1[0];
|
||||
dst[2] = src1[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 3 a row of pixels of 8 bits.
|
||||
* The function is implemented in C.
|
||||
* The pixels over the left and right borders are assumed of the same color of
|
||||
* the pixels on the border.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, triple length in pixels.
|
||||
* \param dst1 Second destination row, triple length in pixels.
|
||||
* \param dst2 Third destination row, triple length in pixels.
|
||||
*/
|
||||
void scale3x_8_def(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale3x_8_def_whole(dst0, dst1, dst2, src0, src1, src2, count);
|
||||
#else
|
||||
scale3x_8_def_border(dst0, src0, src1, src2, count);
|
||||
scale3x_8_def_center(dst1, src0, src1, src2, count);
|
||||
scale3x_8_def_border(dst2, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 3 a row of pixels of 16 bits.
|
||||
* This function operates like scale3x_8_def() but for 16 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, triple length in pixels.
|
||||
* \param dst1 Second destination row, triple length in pixels.
|
||||
* \param dst2 Third destination row, triple length in pixels.
|
||||
*/
|
||||
void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* dst2, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale3x_16_def_whole(dst0, dst1, dst2, src0, src1, src2, count);
|
||||
#else
|
||||
scale3x_16_def_border(dst0, src0, src1, src2, count);
|
||||
scale3x_16_def_center(dst1, src0, src1, src2, count);
|
||||
scale3x_16_def_border(dst2, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale by a factor of 3 a row of pixels of 32 bits.
|
||||
* This function operates like scale3x_8_def() but for 32 bits pixels.
|
||||
* \param src0 Pointer at the first pixel of the previous row.
|
||||
* \param src1 Pointer at the first pixel of the current row.
|
||||
* \param src2 Pointer at the first pixel of the next row.
|
||||
* \param count Length in pixels of the src0, src1 and src2 rows.
|
||||
* It must be at least 2.
|
||||
* \param dst0 First destination row, triple length in pixels.
|
||||
* \param dst1 Second destination row, triple length in pixels.
|
||||
* \param dst2 Third destination row, triple length in pixels.
|
||||
*/
|
||||
void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count)
|
||||
{
|
||||
#ifdef USE_SCALE_RANDOMWRITE
|
||||
scale3x_32_def_whole(dst0, dst1, dst2, src0, src1, src2, count);
|
||||
#else
|
||||
scale3x_32_def_border(dst0, src0, src1, src2, count);
|
||||
scale3x_32_def_center(dst1, src0, src1, src2, count);
|
||||
scale3x_32_def_border(dst2, src2, src1, src0, count);
|
||||
#endif
|
||||
}
|
||||
|
29
Utilities/Scale2x/scale3x.h
Normal file
29
Utilities/Scale2x/scale3x.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __SCALE3X_H
|
||||
#define __SCALE3X_H
|
||||
|
||||
typedef unsigned char scale3x_uint8;
|
||||
typedef unsigned short scale3x_uint16;
|
||||
typedef unsigned scale3x_uint32;
|
||||
|
||||
void scale3x_8_def(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count);
|
||||
void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* dst2, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count);
|
||||
void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count);
|
||||
|
||||
#endif
|
||||
|
505
Utilities/Scale2x/scalebit.cpp
Normal file
505
Utilities/Scale2x/scalebit.cpp
Normal file
|
@ -0,0 +1,505 @@
|
|||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2003, 2004 Andrea Mazzoleni
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains an example implementation of the Scale effect
|
||||
* applyed to a generic bitmap.
|
||||
*
|
||||
* You can find an high level description of the effect at :
|
||||
*
|
||||
* http://www.scale2x.it/
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "../stdafx.h"
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "scale2x.h"
|
||||
#include "scale3x.h"
|
||||
|
||||
#if HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define SSDST(bits, num) (scale2x_uint##bits *)dst##num
|
||||
#define SSSRC(bits, num) (const scale2x_uint##bits *)src##num
|
||||
|
||||
/**
|
||||
* Apply the Scale2x effect on a group of rows. Used internally.
|
||||
*/
|
||||
static inline void stage_scale2x(void* dst0, void* dst1, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row)
|
||||
{
|
||||
switch (pixel) {
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
case 1 : scale2x_8_mmx(SSDST(8,0), SSDST(8,1), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break;
|
||||
case 2 : scale2x_16_mmx(SSDST(16,0), SSDST(16,1), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break;
|
||||
case 4 : scale2x_32_mmx(SSDST(32,0), SSDST(32,1), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break;
|
||||
#else
|
||||
case 1 : scale2x_8_def(SSDST(8,0), SSDST(8,1), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break;
|
||||
case 2 : scale2x_16_def(SSDST(16,0), SSDST(16,1), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break;
|
||||
case 4 : scale2x_32_def(SSDST(32,0), SSDST(32,1), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale2x3 effect on a group of rows. Used internally.
|
||||
*/
|
||||
static inline void stage_scale2x3(void* dst0, void* dst1, void* dst2, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row)
|
||||
{
|
||||
switch (pixel) {
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
case 1 : scale2x3_8_mmx(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break;
|
||||
case 2 : scale2x3_16_mmx(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break;
|
||||
case 4 : scale2x3_32_mmx(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break;
|
||||
#else
|
||||
case 1 : scale2x3_8_def(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break;
|
||||
case 2 : scale2x3_16_def(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break;
|
||||
case 4 : scale2x3_32_def(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale2x4 effect on a group of rows. Used internally.
|
||||
*/
|
||||
static inline void stage_scale2x4(void* dst0, void* dst1, void* dst2, void* dst3, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row)
|
||||
{
|
||||
switch (pixel) {
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
case 1 : scale2x4_8_mmx(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSDST(8,3), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break;
|
||||
case 2 : scale2x4_16_mmx(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSDST(16,3), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break;
|
||||
case 4 : scale2x4_32_mmx(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSDST(32,3), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break;
|
||||
#else
|
||||
case 1 : scale2x4_8_def(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSDST(8,3), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break;
|
||||
case 2 : scale2x4_16_def(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSDST(16,3), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break;
|
||||
case 4 : scale2x4_32_def(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSDST(32,3), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale3x effect on a group of rows. Used internally.
|
||||
*/
|
||||
static inline void stage_scale3x(void* dst0, void* dst1, void* dst2, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row)
|
||||
{
|
||||
switch (pixel) {
|
||||
case 1 : scale3x_8_def(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break;
|
||||
case 2 : scale3x_16_def(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break;
|
||||
case 4 : scale3x_32_def(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale4x effect on a group of rows. Used internally.
|
||||
*/
|
||||
static inline void stage_scale4x(void* dst0, void* dst1, void* dst2, void* dst3, const void* src0, const void* src1, const void* src2, const void* src3, unsigned pixel, unsigned pixel_per_row)
|
||||
{
|
||||
stage_scale2x(dst0, dst1, src0, src1, src2, pixel, 2 * pixel_per_row);
|
||||
stage_scale2x(dst2, dst3, src1, src2, src3, pixel, 2 * pixel_per_row);
|
||||
}
|
||||
|
||||
#define SCDST(i) (dst+(i)*dst_slice)
|
||||
#define SCSRC(i) (src+(i)*src_slice)
|
||||
#define SCMID(i) (mid[(i)])
|
||||
|
||||
/**
|
||||
* Apply the Scale2x effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 2x2 times the size of the source bitmap.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale2x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height)
|
||||
{
|
||||
unsigned char* dst = (unsigned char*)void_dst;
|
||||
const unsigned char* src = (const unsigned char*)void_src;
|
||||
unsigned count;
|
||||
|
||||
assert(height >= 2);
|
||||
|
||||
count = height;
|
||||
|
||||
stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width);
|
||||
|
||||
dst = SCDST(2);
|
||||
|
||||
count -= 2;
|
||||
while (count) {
|
||||
stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width);
|
||||
|
||||
dst = SCDST(2);
|
||||
src = SCSRC(1);
|
||||
|
||||
--count;
|
||||
}
|
||||
|
||||
stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width);
|
||||
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
scale2x_mmx_emms();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale2x3 effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 2x3 times the size of the source bitmap.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale2x3(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height)
|
||||
{
|
||||
unsigned char* dst = (unsigned char*)void_dst;
|
||||
const unsigned char* src = (const unsigned char*)void_src;
|
||||
unsigned count;
|
||||
|
||||
assert(height >= 2);
|
||||
|
||||
count = height;
|
||||
|
||||
stage_scale2x3(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width);
|
||||
|
||||
dst = SCDST(3);
|
||||
|
||||
count -= 2;
|
||||
while (count) {
|
||||
stage_scale2x3(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width);
|
||||
|
||||
dst = SCDST(3);
|
||||
src = SCSRC(1);
|
||||
|
||||
--count;
|
||||
}
|
||||
|
||||
stage_scale2x3(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width);
|
||||
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
scale2x_mmx_emms();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale2x4 effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 2x4 times the size of the source bitmap.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale2x4(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height)
|
||||
{
|
||||
unsigned char* dst = (unsigned char*)void_dst;
|
||||
const unsigned char* src = (const unsigned char*)void_src;
|
||||
unsigned count;
|
||||
|
||||
assert(height >= 2);
|
||||
|
||||
count = height;
|
||||
|
||||
stage_scale2x4(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
|
||||
count -= 2;
|
||||
while (count) {
|
||||
stage_scale2x4(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
src = SCSRC(1);
|
||||
|
||||
--count;
|
||||
}
|
||||
|
||||
stage_scale2x4(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width);
|
||||
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
scale2x_mmx_emms();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale3x effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 3x3 times the size of the source bitmap.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale3x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height)
|
||||
{
|
||||
unsigned char* dst = (unsigned char*)void_dst;
|
||||
const unsigned char* src = (const unsigned char*)void_src;
|
||||
unsigned count;
|
||||
|
||||
assert(height >= 2);
|
||||
|
||||
count = height;
|
||||
|
||||
stage_scale3x(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width);
|
||||
|
||||
dst = SCDST(3);
|
||||
|
||||
count -= 2;
|
||||
while (count) {
|
||||
stage_scale3x(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width);
|
||||
|
||||
dst = SCDST(3);
|
||||
src = SCSRC(1);
|
||||
|
||||
--count;
|
||||
}
|
||||
|
||||
stage_scale3x(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale4x effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 4x4 times the size of the source bitmap.
|
||||
* \note This function requires also a small buffer bitmap used internally to store
|
||||
* intermediate results. This bitmap must have at least an horizontal size in bytes of 2*width*pixel,
|
||||
* and a vertical size of 6 rows. The memory of this buffer must not be allocated
|
||||
* in video memory because it's also read and not only written. Generally
|
||||
* a heap (malloc) or a stack (alloca) buffer is the best choice.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_mid Pointer at the first pixel of the buffer bitmap.
|
||||
* \param mid_slice Size in bytes of a buffer bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale4x_buf(void* void_dst, unsigned dst_slice, void* void_mid, unsigned mid_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height)
|
||||
{
|
||||
unsigned char* dst = (unsigned char*)void_dst;
|
||||
const unsigned char* src = (const unsigned char*)void_src;
|
||||
unsigned count;
|
||||
unsigned char* mid[6];
|
||||
|
||||
assert(height >= 4);
|
||||
|
||||
count = height;
|
||||
|
||||
/* set the 6 buffer pointers */
|
||||
mid[0] = (unsigned char*)void_mid;
|
||||
mid[1] = mid[0] + mid_slice;
|
||||
mid[2] = mid[1] + mid_slice;
|
||||
mid[3] = mid[2] + mid_slice;
|
||||
mid[4] = mid[3] + mid_slice;
|
||||
mid[5] = mid[4] + mid_slice;
|
||||
|
||||
stage_scale2x(SCMID(-2+6), SCMID(-1+6), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width);
|
||||
stage_scale2x(SCMID(0), SCMID(1), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width);
|
||||
stage_scale2x(SCMID(2), SCMID(3), SCSRC(1), SCSRC(2), SCSRC(3), pixel, width);
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(-2+6), SCMID(-2+6), SCMID(-1+6), SCMID(0), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(-1+6), SCMID(0), SCMID(1), SCMID(2), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
|
||||
count -= 4;
|
||||
while (count) {
|
||||
unsigned char* tmp;
|
||||
|
||||
stage_scale2x(SCMID(4), SCMID(5), SCSRC(2), SCSRC(3), SCSRC(4), pixel, width);
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1), SCMID(2), SCMID(3), SCMID(4), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
src = SCSRC(1);
|
||||
|
||||
tmp = SCMID(0); /* shift by 2 position */
|
||||
SCMID(0) = SCMID(2);
|
||||
SCMID(2) = SCMID(4);
|
||||
SCMID(4) = tmp;
|
||||
tmp = SCMID(1);
|
||||
SCMID(1) = SCMID(3);
|
||||
SCMID(3) = SCMID(5);
|
||||
SCMID(5) = tmp;
|
||||
|
||||
--count;
|
||||
}
|
||||
|
||||
stage_scale2x(SCMID(4), SCMID(5), SCSRC(2), SCSRC(3), SCSRC(3), pixel, width);
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1), SCMID(2), SCMID(3), SCMID(4), pixel, width);
|
||||
|
||||
dst = SCDST(4);
|
||||
|
||||
stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(3), SCMID(4), SCMID(5), SCMID(5), pixel, width);
|
||||
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
scale2x_mmx_emms();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale4x effect on a bitmap.
|
||||
* The destination bitmap is filled with the scaled version of the source bitmap.
|
||||
* The source bitmap isn't modified.
|
||||
* The destination bitmap must be manually allocated before calling the function,
|
||||
* note that the resulting size is exactly 4x4 times the size of the source bitmap.
|
||||
* \note This function operates like ::scale4x_buf() but the intermediate buffer is
|
||||
* automatically allocated in the stack.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
static void scale4x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height)
|
||||
{
|
||||
unsigned mid_slice;
|
||||
void* mid;
|
||||
|
||||
mid_slice = 2 * pixel * width; /* required space for 1 row buffer */
|
||||
|
||||
mid_slice = (mid_slice + 0x7) & ~0x7; /* align to 8 bytes */
|
||||
|
||||
#if HAVE_ALLOCA
|
||||
mid = alloca(6 * mid_slice); /* allocate space for 6 row buffers */
|
||||
|
||||
assert(mid != 0); /* alloca should never fails */
|
||||
#else
|
||||
mid = malloc(6 * mid_slice); /* allocate space for 6 row buffers */
|
||||
|
||||
if (!mid)
|
||||
return;
|
||||
#endif
|
||||
|
||||
scale4x_buf(void_dst, dst_slice, mid, mid_slice, void_src, src_slice, pixel, width, height);
|
||||
|
||||
#if !HAVE_ALLOCA
|
||||
free(mid);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the scale implementation is applicable at the given arguments.
|
||||
* \param scale Scale factor. 2, 203 (fox 2x3), 204 (for 2x4), 3 or 4.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
* \return
|
||||
* - -1 on precondition violated.
|
||||
* - 0 on success.
|
||||
*/
|
||||
int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned height)
|
||||
{
|
||||
if (pixel != 1 && pixel != 2 && pixel != 4)
|
||||
return -1;
|
||||
|
||||
switch (scale) {
|
||||
case 202 :
|
||||
case 203 :
|
||||
case 204 :
|
||||
case 2 :
|
||||
case 303 :
|
||||
case 3 :
|
||||
if (height < 2)
|
||||
return -1;
|
||||
break;
|
||||
case 404 :
|
||||
case 4 :
|
||||
if (height < 4)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (width < 2)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the Scale effect on a bitmap.
|
||||
* This function is simply a common interface for ::scale2x(), ::scale3x() and ::scale4x().
|
||||
* \param scale Scale factor. 2, 203 (fox 2x3), 204 (for 2x4), 3 or 4.
|
||||
* \param void_dst Pointer at the first pixel of the destination bitmap.
|
||||
* \param dst_slice Size in bytes of a destination bitmap row.
|
||||
* \param void_src Pointer at the first pixel of the source bitmap.
|
||||
* \param src_slice Size in bytes of a source bitmap row.
|
||||
* \param pixel Bytes per pixel of the source and destination bitmap.
|
||||
* \param width Horizontal size in pixels of the source bitmap.
|
||||
* \param height Vertical size in pixels of the source bitmap.
|
||||
*/
|
||||
void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height)
|
||||
{
|
||||
switch (scale) {
|
||||
case 202 :
|
||||
case 2 :
|
||||
scale2x(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
|
||||
break;
|
||||
case 203 :
|
||||
scale2x3(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
|
||||
break;
|
||||
case 204 :
|
||||
scale2x4(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
|
||||
break;
|
||||
case 303 :
|
||||
case 3 :
|
||||
scale3x(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
|
||||
break;
|
||||
case 404 :
|
||||
case 4 :
|
||||
scale4x(void_dst, dst_slice, void_src, src_slice, pixel, width, height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
33
Utilities/Scale2x/scalebit.h
Normal file
33
Utilities/Scale2x/scalebit.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* This file is part of the Scale2x project.
|
||||
*
|
||||
* Copyright (C) 2003 Andrea Mazzoleni
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains an example implementation of the Scale effect
|
||||
* applyed to a generic bitmap.
|
||||
*
|
||||
* You can find an high level description of the effect at :
|
||||
*
|
||||
* http://www.scale2x.it/
|
||||
*/
|
||||
|
||||
#ifndef __SCALEBIT_H
|
||||
#define __SCALEBIT_H
|
||||
|
||||
int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned height);
|
||||
void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height);
|
||||
|
||||
#endif
|
||||
|
|
@ -388,7 +388,10 @@
|
|||
<ClInclude Include="blip_buf.h" />
|
||||
<ClInclude Include="CRC32.h" />
|
||||
<ClInclude Include="FolderUtilities.h" />
|
||||
<ClInclude Include="HQX\common.h" />
|
||||
<ClInclude Include="HQX\hqx.h" />
|
||||
<ClInclude Include="IpsPatcher.h" />
|
||||
<ClInclude Include="KreedSaiEagle\SaiEagle.h" />
|
||||
<ClInclude Include="LowPassFilter.h" />
|
||||
<ClInclude Include="md5.h" />
|
||||
<ClInclude Include="miniz.h" />
|
||||
|
@ -397,6 +400,9 @@
|
|||
<ClInclude Include="nes_ntsc_config.h" />
|
||||
<ClInclude Include="nes_ntsc_impl.h" />
|
||||
<ClInclude Include="PNGHelper.h" />
|
||||
<ClInclude Include="Scale2x\scale2x.h" />
|
||||
<ClInclude Include="Scale2x\scale3x.h" />
|
||||
<ClInclude Include="Scale2x\scalebit.h" />
|
||||
<ClInclude Include="UPnPPortMapper.h" />
|
||||
<ClInclude Include="SimpleLock.h" />
|
||||
<ClInclude Include="Socket.h" />
|
||||
|
@ -404,6 +410,8 @@
|
|||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="Timer.h" />
|
||||
<ClInclude Include="UTF8Util.h" />
|
||||
<ClInclude Include="xBRZ\config.h" />
|
||||
<ClInclude Include="xBRZ\xbrz.h" />
|
||||
<ClInclude Include="ZipReader.h" />
|
||||
<ClInclude Include="ZipWriter.h" />
|
||||
</ItemGroup>
|
||||
|
@ -411,12 +419,22 @@
|
|||
<ClCompile Include="blip_buf.cpp" />
|
||||
<ClCompile Include="CRC32.cpp" />
|
||||
<ClCompile Include="FolderUtilities.cpp" />
|
||||
<ClCompile Include="HQX\hq2x.cpp" />
|
||||
<ClCompile Include="HQX\hq3x.cpp" />
|
||||
<ClCompile Include="HQX\hq4x.cpp" />
|
||||
<ClCompile Include="HQX\init.cpp" />
|
||||
<ClCompile Include="IpsPatcher.cpp" />
|
||||
<ClCompile Include="KreedSaiEagle\2xSai.cpp" />
|
||||
<ClCompile Include="KreedSaiEagle\Super2xSai.cpp" />
|
||||
<ClCompile Include="KreedSaiEagle\SuperEagle.cpp" />
|
||||
<ClCompile Include="md5.cpp" />
|
||||
<ClCompile Include="miniz.cpp" />
|
||||
<ClCompile Include="nes_ntsc.cpp" />
|
||||
<ClCompile Include="PNGHelper.cpp" />
|
||||
<ClCompile Include="AutoResetEvent.cpp" />
|
||||
<ClCompile Include="Scale2x\scale2x.cpp" />
|
||||
<ClCompile Include="Scale2x\scale3x.cpp" />
|
||||
<ClCompile Include="Scale2x\scalebit.cpp" />
|
||||
<ClCompile Include="SimpleLock.cpp" />
|
||||
<ClCompile Include="Socket.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -434,6 +452,7 @@
|
|||
<ClCompile Include="Timer.cpp" />
|
||||
<ClCompile Include="UPnPPortMapper.cpp" />
|
||||
<ClCompile Include="UTF8Util.cpp" />
|
||||
<ClCompile Include="xBRZ\xbrz.cpp" />
|
||||
<ClCompile Include="ZipReader.cpp" />
|
||||
<ClCompile Include="ZipWriter.cpp" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -9,6 +9,18 @@
|
|||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="xBRZ">
|
||||
<UniqueIdentifier>{34df7dd9-5f1b-4aec-9212-1b70f1fada59}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HQX">
|
||||
<UniqueIdentifier>{c29925fd-7698-4db8-a328-73ef7f8993a9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Scale2x">
|
||||
<UniqueIdentifier>{87329bd1-28ac-4ced-a4c2-b51777018d16}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="KreedSaiEagle">
|
||||
<UniqueIdentifier>{8e159744-fb91-4e16-aa82-8d8703ba2762}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
|
@ -74,6 +86,30 @@
|
|||
<ClInclude Include="nes_ntsc_impl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="xBRZ\config.h">
|
||||
<Filter>xBRZ</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="xBRZ\xbrz.h">
|
||||
<Filter>xBRZ</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HQX\hqx.h">
|
||||
<Filter>HQX</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HQX\common.h">
|
||||
<Filter>HQX</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Scale2x\scale2x.h">
|
||||
<Filter>Scale2x</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Scale2x\scale3x.h">
|
||||
<Filter>Scale2x</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Scale2x\scalebit.h">
|
||||
<Filter>Scale2x</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="KreedSaiEagle\SaiEagle.h">
|
||||
<Filter>KreedSaiEagle</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
@ -127,5 +163,38 @@
|
|||
<ClCompile Include="nes_ntsc.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="xBRZ\xbrz.cpp">
|
||||
<Filter>xBRZ</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HQX\hq2x.cpp">
|
||||
<Filter>HQX</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HQX\hq3x.cpp">
|
||||
<Filter>HQX</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HQX\hq4x.cpp">
|
||||
<Filter>HQX</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HQX\init.cpp">
|
||||
<Filter>HQX</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Scale2x\scale2x.cpp">
|
||||
<Filter>Scale2x</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Scale2x\scale3x.cpp">
|
||||
<Filter>Scale2x</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Scale2x\scalebit.cpp">
|
||||
<Filter>Scale2x</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KreedSaiEagle\SuperEagle.cpp">
|
||||
<Filter>KreedSaiEagle</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KreedSaiEagle\Super2xSai.cpp">
|
||||
<Filter>KreedSaiEagle</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KreedSaiEagle\2xSai.cpp">
|
||||
<Filter>KreedSaiEagle</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
33
Utilities/xBRZ/config.h
Normal file
33
Utilities/xBRZ/config.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
// ****************************************************************************
|
||||
// * This file is part of the HqMAME project. It is distributed under *
|
||||
// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
|
||||
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
|
||||
// * *
|
||||
// * Additionally and as a special exception, the author gives permission *
|
||||
// * to link the code of this program with the MAME library (or with modified *
|
||||
// * versions of MAME that use the same license as MAME), and distribute *
|
||||
// * linked combinations including the two. You must obey the GNU General *
|
||||
// * Public License in all respects for all of the code used other than MAME. *
|
||||
// * If you modify this file, you may extend this exception to your version *
|
||||
// * of the file, but you are not obligated to do so. If you do not wish to *
|
||||
// * do so, delete this exception statement from your version. *
|
||||
// ****************************************************************************
|
||||
|
||||
#ifndef XBRZ_CONFIG_HEADER_284578425345
|
||||
#define XBRZ_CONFIG_HEADER_284578425345
|
||||
|
||||
//do NOT include any headers here! used by xBRZ_dll!!!
|
||||
|
||||
namespace xbrz
|
||||
{
|
||||
struct ScalerCfg
|
||||
{
|
||||
double luminanceWeight = 1;
|
||||
double equalColorTolerance = 30;
|
||||
double dominantDirectionThreshold = 3.6;
|
||||
double steepDirectionThreshold = 2.2;
|
||||
double newTestAttribute = 0; //unused; test new parameters
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
1215
Utilities/xBRZ/xbrz.cpp
Normal file
1215
Utilities/xBRZ/xbrz.cpp
Normal file
File diff suppressed because it is too large
Load diff
94
Utilities/xBRZ/xbrz.h
Normal file
94
Utilities/xBRZ/xbrz.h
Normal file
|
@ -0,0 +1,94 @@
|
|||
// ****************************************************************************
|
||||
// * This file is part of the HqMAME project. It is distributed under *
|
||||
// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
|
||||
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
|
||||
// * *
|
||||
// * Additionally and as a special exception, the author gives permission *
|
||||
// * to link the code of this program with the MAME library (or with modified *
|
||||
// * versions of MAME that use the same license as MAME), and distribute *
|
||||
// * linked combinations including the two. You must obey the GNU General *
|
||||
// * Public License in all respects for all of the code used other than MAME. *
|
||||
// * If you modify this file, you may extend this exception to your version *
|
||||
// * of the file, but you are not obligated to do so. If you do not wish to *
|
||||
// * do so, delete this exception statement from your version. *
|
||||
// ****************************************************************************
|
||||
|
||||
#ifndef XBRZ_HEADER_3847894708239054
|
||||
#define XBRZ_HEADER_3847894708239054
|
||||
|
||||
#include <cstddef> //size_t
|
||||
#include <cstdint> //uint32_t
|
||||
#include <limits>
|
||||
#include "config.h"
|
||||
|
||||
namespace xbrz
|
||||
{
|
||||
/*
|
||||
-------------------------------------------------------------------------
|
||||
| xBRZ: "Scale by rules" - high quality image upscaling filter by Zenju |
|
||||
-------------------------------------------------------------------------
|
||||
using a modified approach of xBR:
|
||||
http://board.byuu.org/viewtopic.php?f=10&t=2248
|
||||
- new rule set preserving small image features
|
||||
- highly optimized for performance
|
||||
- support alpha channel
|
||||
- support multithreading
|
||||
- support 64-bit architectures
|
||||
- support processing image slices
|
||||
- support scaling up to 6xBRZ
|
||||
*/
|
||||
|
||||
enum class ColorFormat //from high bits -> low bits, 8 bit per channel
|
||||
{
|
||||
RGB, //8 bit for each red, green, blue, upper 8 bits unused
|
||||
ARGB, //including alpha channel, BGRA byte order on little-endian machines
|
||||
};
|
||||
|
||||
/*
|
||||
-> map source (srcWidth * srcHeight) to target (scale * width x scale * height) image, optionally processing a half-open slice of rows [yFirst, yLast) only
|
||||
-> support for source/target pitch in bytes!
|
||||
-> if your emulator changes only a few image slices during each cycle (e.g. DOSBox) then there's no need to run xBRZ on the complete image:
|
||||
Just make sure you enlarge the source image slice by 2 rows on top and 2 on bottom (this is the additional range the xBRZ algorithm is using during analysis)
|
||||
Caveat: If there are multiple changed slices, make sure they do not overlap after adding these additional rows in order to avoid a memory race condition
|
||||
in the target image data if you are using multiple threads for processing each enlarged slice!
|
||||
|
||||
THREAD-SAFETY: - parts of the same image may be scaled by multiple threads as long as the [yFirst, yLast) ranges do not overlap!
|
||||
- there is a minor inefficiency for the first row of a slice, so avoid processing single rows only; suggestion: process 8-16 rows at least
|
||||
*/
|
||||
void scale(size_t factor, //valid range: 2 - 6
|
||||
const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight,
|
||||
ColorFormat colFmt,
|
||||
const ScalerCfg& cfg = ScalerCfg(),
|
||||
int yFirst = 0, int yLast = std::numeric_limits<int>::max()); //slice of source image
|
||||
|
||||
void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight,
|
||||
uint32_t* trg, int trgWidth, int trgHeight);
|
||||
|
||||
enum SliceType
|
||||
{
|
||||
NN_SCALE_SLICE_SOURCE,
|
||||
NN_SCALE_SLICE_TARGET,
|
||||
};
|
||||
void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight, int srcPitch, //pitch in bytes!
|
||||
uint32_t* trg, int trgWidth, int trgHeight, int trgPitch,
|
||||
SliceType st, int yFirst, int yLast);
|
||||
|
||||
//parameter tuning
|
||||
bool equalColorTest(uint32_t col1, uint32_t col2, ColorFormat colFmt, double luminanceWeight, double equalColorTolerance);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//########################### implementation ###########################
|
||||
inline
|
||||
void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight,
|
||||
uint32_t* trg, int trgWidth, int trgHeight)
|
||||
{
|
||||
nearestNeighborScale(src, srcWidth, srcHeight, srcWidth * sizeof(uint32_t),
|
||||
trg, trgWidth, trgHeight, trgWidth * sizeof(uint32_t),
|
||||
NN_SCALE_SLICE_TARGET, 0, trgHeight);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue